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 | 63 ++++++++++++++++++++++++++++++- 1 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zy/core/thread/JarThread.java b/src/main/java/com/zy/core/thread/JarThread.java index 4f1f973..51c1832 100644 --- a/src/main/java/com/zy/core/thread/JarThread.java +++ b/src/main/java/com/zy/core/thread/JarThread.java @@ -139,7 +139,8 @@ 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()); @@ -173,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);//鐘舵�� @@ -315,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