From fb68b101b451988c7ccff13595f6072e98774a59 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期六, 11 五月 2024 13:13:17 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensCrnThread.java |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index ac48c37..5dd4b6d 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -185,6 +185,8 @@
 
                 // 澶嶄綅淇″彿
                 if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
+                    News.error("-------------------------------------------绗竴姝ャ�乕鍫嗗灈鏈哄彿锛歿}, 宸ヤ綔鍙凤細{}, 杞借揣鍙颁俊鍙�:{}]==>> 鐘舵�佷负10锛岀瓑寰呯‘璁わ紒锛�",
+                            slave.getId(),crnProtocol.getTaskNo(), crnProtocol.getLoaded()==1 ? "鏈夌墿" : "鏃犵墿");
                     if (resetFlag) {
                         if(crnProtocol.getTaskNo()==9999){
                             backHpFlag = false;
@@ -256,9 +258,9 @@
                         || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX())
                         || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ())
                 ){
-                    News.error("涓嬪彂鍓嶏細[id:{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
+//                    News.error("涓嬪彂鍓嶏細[id:{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                 } else {
-                    News.info("涓嬪彂鍓嶏細[id:{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
+//                    News.info("涓嬪彂鍓嶏細[id:{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                 }
             }
         }catch (Exception e){
@@ -278,11 +280,15 @@
         array[7] = command.getDestinationPosY(); // 鐩爣浣嶇疆鍒楀彿
         array[8] = command.getDestinationPosZ(); // 鐩爣浣嶇疆灞傚彿
         array[9] = command.getCommand();
-//        array[10] = command.getLocType1();   //鏂板璐х墿绫诲瀷涓嬪彂
+//        array[10] = 0;   //澶囩敤1
+
+        boolean[] array2 = new boolean[1];
+        array2[0] = command.isTraySize();
         OperateResult result = siemensNet.Write("DB100.0", array);
+        OperateResult result2 = siemensNet.Write("DB100.22", array2);
         News.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), array);
 
-        if(!result.IsSuccess){
+        if(!result.IsSuccess || !result2.IsSuccess){
             News.error("鍐欏叆鍫嗗灈鏈簆lc鏁版嵁澶辫触锛岄噸鏂版坊鍔犱换鍔″埌闃熷垪 ===>> [id:{}],{}", slave.getId(), JSON.toJSON(command));
             MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command));
             Thread.sleep(100);
@@ -293,7 +299,7 @@
         //鍫嗗灈鏈轰换鍔″啓鍏ュ悗锛屽洖璇讳竴娆★紝鐪嬫槸鍚︽垚鍔�
         Thread.sleep(200);
         try{
-            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 18);
+            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 24);
             if (resultRead.IsSuccess) {
                 CrnCommand one = new CrnCommand();
                 one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2));
@@ -304,13 +310,15 @@
                 one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12));
                 one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14));
                 one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16));
+                one.setTraySize(siemensNet.getByteTransform().TransBool(resultRead.Content, 22));
                 if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode())
                         || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY())
                         || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX())
                         || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ())
+                        || !command.isTraySize() == one.isTraySize()
                 ){
                     try{
-                        News.error("鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐id:{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
+//                        News.error("鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐id:{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                     }catch (Exception e){
                         try{
                             News.error("鏃ュ織鎵撳嵃澶辫触锛�===>>鍙傛暟one鎶ラ敊 [id:{}],{}", slave.getId(), JSON.toJSON(command),JSON.toJSON(resultRead));
@@ -352,7 +360,7 @@
                                 News.error("鍫嗗灈鏈轰换鍔$‘璁や綅"+commandFinish+"鍐欏叆鏁版嵁涓庡洖璇绘暟鎹笉涓�鑷达紒"+"寰幆鎵ц娆℃暟:"+writeCount2+"娆�");
                             }else{
                                 //浠诲姟鍛戒护鍐欏叆鎴愬姛
-                                News.info("鍫嗗灈鏈轰换鍔$‘璁や綅"+commandFinish+"鍥炶鎴愬姛锛�"+"寰幆鎵ц娆℃暟:"+writeCount2+"娆�");
+//                                News.info("鍫嗗灈鏈轰换鍔$‘璁や綅"+commandFinish+"鍥炶鎴愬姛锛�"+"寰幆鎵ц娆℃暟:"+writeCount2+"娆�");
                                 break;
                             }
                         }else {
@@ -365,13 +373,6 @@
             }
         }
 
-//        if (command.getAckFinish() == 0) {
-//            short commandFinish = 1;
-//            Thread.sleep(200L);
-//            result = siemensNet.Write("DB100.18", commandFinish);
-//            log.info("鍫嗗灈鏈篶ommandFinish涓嬪彂[id:{}] >>>>> {}", slave.getId(), commandFinish);
-////            result = siemensNet.Write("DB100.22", commandFinish);
-//        }
 
         try {
             // 鏃ュ織璁板綍
@@ -399,7 +400,7 @@
         if (result != null && result.IsSuccess) {
             Thread.sleep(200);
             this.readStatus();
-            News.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
+//            News.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
             OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
             return true;
         } else {

--
Gitblit v1.9.1