From 7a806791fba46b27f4a8af6809c270f92be5f11c Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 22 一月 2024 12:53:37 +0800
Subject: [PATCH] #堆垛机下发命令增加库位类型

---
 src/main/java/com/zy/core/thread/SiemensCrnThread.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 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..45edc73 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -278,11 +278,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.20", 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 +297,7 @@
         //鍫嗗灈鏈轰换鍔″啓鍏ュ悗锛屽洖璇讳竴娆★紝鐪嬫槸鍚︽垚鍔�
         Thread.sleep(200);
         try{
-            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 18);
+            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20);
             if (resultRead.IsSuccess) {
                 CrnCommand one = new CrnCommand();
                 one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2));
@@ -304,10 +308,12 @@
                 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, 20));
                 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));

--
Gitblit v1.9.1