From 45a87642e46c746802af13bf47bcd70e3b69277a Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期四, 14 十二月 2023 16:49:38 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |   59 ++++-------------------------------------------------------
 1 files changed, 4 insertions(+), 55 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 508d4ff..668c8e3 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -124,9 +124,12 @@
                     // 鍐欐暟鎹� ID+鐩爣绔�
                     case 2:
                         write((StaProtocol)task.getData());
+                        read();
                         break;
                     case 3:
                         write2((StaProtocol)task.getData());
+                        read();
+                        break;
                     default:
                         break;
                 }
@@ -598,30 +601,6 @@
         short[] array = new short[2];
         array[0] = staProtocol.getWorkNo();
         array[1] = staProtocol.getStaNo();
-//        OperateResult write = siemensS7Net.Write("DB100." + index*4, array);
-
-        //鏇存柊鍛戒护鏃ュ織
-//        CommandInfoLogService commandInfoLogService = SpringUtils.getBean(CommandInfoLogService.class);
-//        CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class);
-//        CommandInfo commandInfo = commandInfoService.selectById(staProtocol.getCommandId());
-//        CommandInfoLog commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class);
-//        commandInfoLog.setId(null);
-//        CommandInfoLog commandInfoLog = new CommandInfoLog();
-//        if (commandInfo != null) {
-//            commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class);
-//            commandInfoLog.setId(null);
-//        }else {
-//            Date now = new Date();
-//            commandInfoLog.setCommand(JSON.toJSONString(staProtocol));
-//            commandInfoLog.setCommandStatus(3);
-//            commandInfoLog.setStartTime(now);
-//            commandInfoLog.setExecuteTime(now);
-//            commandInfoLog.setCompleteTime(now);
-//            commandInfoLog.setDevice(SlaveType.Devp.toString());
-//            commandInfoLog.setWrkNo(9999);
-//            commandInfoLog.setTaskNo("9999");
-//            commandInfoLog.setCommandDesc("鎵嬪姩鍛戒护");
-//        }
 
         OperateResult writeResult;
         //浠诲姟涓嬪彂娆℃暟
@@ -643,37 +622,13 @@
                         log.info("鍐欏叆杈撻�佺嚎鍛戒护鍚庤繑鍥炴垚鍔燂紝骞朵笖鍥炶鎴愬姛銆傝緭閫佺嚎plc缂栧彿={}锛寋}锛屽啓鍏ユ鏁�={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
 
                         Date now = new Date();
-
-//                        //鏇存柊鎸囦护鐘舵��
-//                        commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);//杈撻�佺嚎鐩存帴瀹屾垚鐘舵��
-//                        commandInfo.setExecuteTime(now);
-//                        commandInfo.setCompleteTime(now);
-//                        commandInfoService.updateById(commandInfo);
-//
-//                        //鏇存柊鎸囦护鏃ュ織
-//                        commandInfoLog.setDeviceLog("鎸囦护涓嬪彂鎴愬姛");
-//                        commandInfoLog.setCommandStatus(CommandStatusType.COMPLETE.id);//杈撻�佺嚎鐩存帴瀹屾垚鐘舵��
-//                        commandInfoLog.setExecuteTime(now);
-//                        commandInfoLog.setCompleteTime(now);
-//                        commandInfoLogService.insert(commandInfoLog);
-
-                        //鏇存柊浠诲姟姝ュ簭
-//                        TaskWrkService taskWrkService = SpringUtils.getBean(TaskWrkService.class);
-//                        TaskWrk taskWrk = taskWrkService.selectByWrkNo(staProtocol.getWorkNo().intValue());
-//                        if (taskWrk != null) {
-//                            taskWrk.setCommandStep(taskWrk.getCommandStep() + 1);//鏇存柊鎸囦护姝ュ簭
-//                            taskWrkService.updateById(taskWrk);
-//                        }
-
                         break;
                     } else {//杩斿洖缁撴灉鏄垚鍔熶簡锛屼絾鏄湡瀹炲�间笉鐩稿悓
                         writeCount++;
                         OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎鍛戒护鍚庤繑鍥炴垚鍔燂紝浣嗘槸璇诲彇浠诲姟鍊间笉涓�鑷淬�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2},鍐欏叆娆℃暟={3}",
                                 slave.getId(), JSON.toJSON(staProtocol),writeCount));
                         log.error("鍐欏叆杈撻�佺嚎鍛戒护鍚庤繑鍥炴垚鍔燂紝浣嗘槸璇诲彇浠诲姟鍊间笉涓�鑷淬�傝緭閫佺嚎plc缂栧彿={}锛寋}锛屽啓鍏ユ鏁�={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
-//                        //鏇存柊鎸囦护鏃ュ織
-//                        commandInfoLog.setDeviceLog("鎸囦护涓嬪彂澶辫触");
-//                        commandInfoLogService.insert(commandInfoLog);
+
                     }
                 } else {
                     writeCount++;
@@ -681,9 +636,6 @@
                             slave.getId(), JSON.toJSON(staProtocol), writeCount));
                     log.error("鍐欏叆杈撻�佺嚎鍛戒护鍚庤鍙栧け璐ャ�傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
 
-//                    //鏇存柊鎸囦护鏃ュ織
-//                    commandInfoLog.setDeviceLog("鎸囦护涓嬪彂澶辫触");
-//                    commandInfoLogService.insert(commandInfoLog);
                 }
             } else {
                 writeCount++;
@@ -691,9 +643,6 @@
                         slave.getId(), JSON.toJSON(staProtocol),writeCount));
                 log.error("鍐欏叆杈撻�佺嚎鍛戒护澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
 
-//                //鏇存柊鎸囦护鏃ュ織
-//                commandInfoLog.setDeviceLog("鎸囦护涓嬪彂澶辫触");
-//                commandInfoLogService.insert(commandInfoLog);
             }
             Thread.sleep(200);
         }

--
Gitblit v1.9.1