From 3b604eb218a3b167144cc6e5d9c86cd95e16157c Mon Sep 17 00:00:00 2001
From: yxFwq <1>
Date: 星期六, 10 五月 2025 08:08:24 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/JarThread.java |   67 ++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/JarThread.java b/src/main/java/com/zy/core/thread/JarThread.java
index 123fcc9..51c1832 100644
--- a/src/main/java/com/zy/core/thread/JarThread.java
+++ b/src/main/java/com/zy/core/thread/JarThread.java
@@ -122,6 +122,7 @@
                     jarProtocol = new JarProtocol();
                     jarProtocol.setJarNo(slave.getId());
                 }
+                jarProtocol.setJarNo(slave.getId());
                 jarProtocol.setMode(2);//妯″紡
                 jarProtocol.setStatus((short)0);//鐘舵��
                 jarProtocol.setAutoing(true);//鑷姩
@@ -138,11 +139,13 @@
                 return;
             }
             OperateResultExOne<byte[]> result = siemensS7Net.Read("V300", (short) 30);
-            if (result.IsSuccess) {
+            OperateResultExOne<byte[]> result338 = siemensS7Net.Read("V338", (short) 4);
+            if (result.IsSuccess && result338.IsSuccess) {
                 if (null == jarProtocol) {
                     jarProtocol = new JarProtocol();
                     jarProtocol.setJarNo(slave.getId());
                 }
+                jarProtocol.setJarNo(slave.getId());
                 if (slave.getId() == 1 || slave.getId() == 3){
                     jarProtocol.setRightDoor(siemensS7Net.getByteTransform().TransInt16(result.Content, 0) != 0);//宸﹂棬鐘舵��  //鍑烘枡闂�
                     jarProtocol.setLeftDoor(siemensS7Net.getByteTransform().TransInt16(result.Content, 2) != 0);//鍙抽棬鐘舵��  //杩涙枡闂�
@@ -171,8 +174,66 @@
                 jarProtocol.setStatus(siemensS7Net.getByteTransform().TransInt16(result.Content, 16));//鐘舵��
                 jarProtocol.setJarTemperature(siemensS7Net.getByteTransform().TransSingle(result.Content, 26));//娓╁害
 
+                jarProtocol.setJarPressure(siemensS7Net.getByteTransform().TransSingle(result338.Content, 0));//鍘嬪姏
+
                 jarProtocol.setAutoing(siemensS7Net.getByteTransform().TransInt16(result.Content, 12) == 2);//鑷姩
 
+//                if (jarProtocol.statusType .equals(JarStatusType.SOS)){
+//                    jarProtocol.setHoldingSign(!jarProtocol.getStatus().equals(jarProtocol.getUpStatus()));
+//                } else
+                if (jarProtocol.statusType .equals(JarStatusType.SOS2)){
+                    jarProtocol.setHoldingSign(!jarProtocol.getStatus().equals(jarProtocol.getUpStatus()));
+                    if (!jarProtocol.rightDoorClose.equals(jarProtocol.leftDoorClose)) {
+                        if (jarProtocol.rightDoorClose == 0 || jarProtocol.leftDoorClose == 0){
+                            if (jarProtocol.rightDoorClose == 2 || jarProtocol.leftDoorClose == 2){
+                                jarProtocol.setLeftDoorClose(0);//close the left door  //杩涙枡闂�
+                                jarProtocol.setRightDoorClose(0);//close the right door  //鍑烘枡闂�
+                            }
+                        }
+                        if (jarProtocol.rightDoorOpen == 0 || jarProtocol.leftDoorOpen == 0){
+                            if (jarProtocol.rightDoorOpen == 2 || jarProtocol.leftDoorOpen == 2){
+                                jarProtocol.setLeftDoorOpen(0);//open the left door  //杩涙枡闂�
+                                jarProtocol.setRightDoorOpen(0);//open the right door  //鍑烘枡闂�
+                            }
+                        }
+                    }
+                } else if (jarProtocol.statusType .equals(JarStatusType.WAITING3) || jarProtocol.statusType .equals(JarStatusType.WAITING4)){
+                    jarProtocol.setOpenDoorSign(!jarProtocol.getStatus().equals(jarProtocol.getUpStatus()));
+                } else if (jarProtocol.statusType .equals(JarStatusType.WAITING5) || jarProtocol.statusType .equals(JarStatusType.OFF_LINE)){
+                    jarProtocol.setCloseDoorSign(!jarProtocol.getStatus().equals(jarProtocol.getUpStatus()));
+                } else if (jarProtocol.leftDoorOpen==1 || jarProtocol.leftDoorClose==1 ||
+                        jarProtocol.rightDoorOpen==1 || jarProtocol.rightDoorClose==1){
+
+                } else {
+                    if (jarProtocol.statusType .equals(JarStatusType.WAITING2)){
+
+                        if (jarProtocol.rightDoorOpen == 2 || jarProtocol.leftDoorOpen == 2){
+                            jarProtocol.setLeftDoorOpen(0);//open the left door  //杩涙枡闂�
+                            jarProtocol.setRightDoorOpen(0);//open the right door  //鍑烘枡闂�
+                        }
+                        if (jarProtocol.rightDoorClose == 2 || jarProtocol.leftDoorClose == 2){
+                            jarProtocol.setLeftDoorClose(0);//close the left door  //杩涙枡闂�
+                            jarProtocol.setRightDoorClose(0);//close the right door  //鍑烘枡闂�
+                        }
+                    } else if (jarProtocol.statusType .equals(JarStatusType.WAITING1) || jarProtocol.statusType .equals(JarStatusType.MOVING)){
+                        if (!jarProtocol.rightDoorOpen.equals(jarProtocol.leftDoorOpen)) {
+                            if (jarProtocol.rightDoorOpen == 0 || jarProtocol.leftDoorOpen == 0){
+                                if (jarProtocol.rightDoorOpen == 2 || jarProtocol.leftDoorOpen == 2){
+                                    jarProtocol.setLeftDoorOpen(0);//open the left door  //杩涙枡闂�
+                                    jarProtocol.setRightDoorOpen(0);//open the right door  //鍑烘枡闂�
+                                }
+                            }
+                        }
+                        if (jarProtocol.rightDoorClose == 0 || jarProtocol.leftDoorClose == 0){
+                            if (jarProtocol.rightDoorClose == 2 || jarProtocol.leftDoorClose == 2){
+                                jarProtocol.setLeftDoorClose(0);//close the left door  //杩涙枡闂�
+                                jarProtocol.setRightDoorClose(0);//close the right door  //鍑烘枡闂�
+                            }
+                        }
+                    }
+                }
+
+                jarProtocol.setUpStatus(jarProtocol.getStatus());
 //
 //                jarProtocol.setMode(2);//妯″紡
 //                jarProtocol.setStatus((short)6);//鐘舵��
@@ -224,7 +285,7 @@
         String resultV2 = null;
         short resultS2 = 0;
 
-        switch (command.getTaskMode()){
+        switch (command.getTaskModeType().id){
             case 1:
             case 2:
             case 3:
@@ -313,7 +374,7 @@
                 OperateResultExOne<byte[]> resultRead2 = siemensS7Net.Read(resultV2, (short) 2);
                 if (resultRead2.IsSuccess) {
                     short transInt16 = siemensS7Net.getByteTransform().TransInt16(resultRead2.Content, 0);
-                    if (transInt16 == resultS1  || transInt16 == (short) 3){
+                    if (transInt16 == resultS2  || transInt16 == (short) 3){
                         break;
                     } else {
                         log.error("鍐欏叆纭寲缃恜lc鏁版嵁澶辫触锛岄噸鏂颁笅鍙戜换鍔�  鍐欏叆鐩存帴澶辫触 ===>> [id:{}],{},[鍐欏叆娆℃暟:{}]", slave.getId(), JSON.toJSONString(command),writeCount);

--
Gitblit v1.9.1