From 6deef91299e7216963bd4e00766c92ee6f8956d0 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期二, 01 四月 2025 13:54:17 +0800
Subject: [PATCH] 给堆垛机下任务

---
 src/main/java/com/zy/core/thread/SiemensCrnThread.java |   25 ++++++++++---------------
 1 files changed, 10 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 d621d37..321f95c 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -396,24 +396,19 @@
         OperateResult result = siemensNet.Write("DB100.0", array);
 
         int i=0;
+//        if(result.IsSuccess){
+//            log.info("鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鎴愬姛[id:{}]>>>>鍐欏叆[{}]", slave.getId(),JSON.toJSON(command));
+//        }else{
+//            log.error("鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆澶辫触锛侊紒锛乕id:{}]>>>>鍐欏叆[{}]", slave.getId(),JSON.toJSON(command));
+//        }
         do{
             //鍫嗗灈鏈轰换鍔″啓鍏ュ悗锛屽洖璇讳竴娆★紝鐪嬫槸鍚︽垚鍔�
             Thread.sleep(300);
-            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20);
-            if (resultRead.IsSuccess) {
-                CrnCommand one = new CrnCommand();
+            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB101.0", (short) 56);
+            if (result.IsSuccess) {
+                CrnCommand one=new CrnCommand();
                 one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2));
-                one.setTaskMode(siemensNet.getByteTransform().TransInt16(resultRead.Content, 4));
-                one.setSourcePosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 6));
-                one.setSourcePosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 8));
-                one.setSourcePosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 10));
-                one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12));
-                one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14));
-                one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16));
-                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())
+                if (!command.getTaskNo().equals(one.getTaskNo())
                 ){
                     i++;
                     log.error("鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐id:{}]>>>>閲嶅啓[{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), i,JSON.toJSON(command),JSON.toJSON(one));
@@ -449,7 +444,7 @@
         } catch (Exception ignore) {}
 
         if (result != null && result.IsSuccess) {
-            Thread.sleep(200);
+            Thread.sleep(300);
             this.readStatus();
             log.info(methodName + ":鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
             OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));

--
Gitblit v1.9.1