From 4da282d3a87fb648ae6865929f5862b27d05a562 Mon Sep 17 00:00:00 2001 From: cpT <1@123> Date: 星期四, 03 七月 2025 15:07:25 +0800 Subject: [PATCH] #改造 --- src/main/java/com/zy/core/thread/SiemensCrnThread.java | 39 +++++++++++++++++++++++++++------------ 1 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java index 9ba8968..b6671ec 100644 --- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java +++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java @@ -288,14 +288,14 @@ deviceErrorService.addDeviceError("crnWrite", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍫嗗灈鏈烘寚浠や笅鍙�:"+JSON.toJSONString(command.getNowTask())); } catch (Exception e2){ } - try{ - BasErrLogService basErrLogService = SpringUtils.getBean(BasErrLogService.class); - BasErrLog basErrLog = new BasErrLog(command,"","浠诲姟涓嬪彂璁板綍"); - if (!basErrLogService.insert(basErrLog)) { - log.error("鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", slave.getId(), "浠诲姟涓嬪彂璁板綍澶辫触"); - } - } catch (Exception e3){ - } +// try{ +// BasErrLogService basErrLogService = SpringUtils.getBean(BasErrLogService.class); +// BasErrLog basErrLog = new BasErrLog(command,"","浠诲姟涓嬪彂璁板綍"); +// if (!basErrLogService.insert(basErrLog)) { +// log.error("鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", slave.getId(), "浠诲姟涓嬪彂璁板綍澶辫触"); +// } +// } catch (Exception e3){ +// } // convertRow(command); command.setCrnNo(slave.getId()); short[] array = new short[10]; @@ -308,7 +308,8 @@ array[6] = command.getDestinationPosX(); array[7] = command.getDestinationPosY(); array[8] = command.getDestinationPosZ(); - array[9] = command.getCommand(); +// array[9] = command.getCommand(); + array[9] = (short)0; OperateResult result18 = siemensNet.Write("DB100.18", (short)0); try{ Thread.sleep(50L); @@ -322,11 +323,25 @@ try{ Thread.sleep(100L); } catch (Exception e){} - OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB101.0", (short) 4); + OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20); if (resultRead.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()) ){ i++; CrnErrCache.updateCrnErr(slave.getId(), "鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐�"); @@ -335,7 +350,7 @@ try{ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); - deviceErrorService.addDeviceError("crnErr", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍐欏叆娆℃暟"+i+";鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐�:"+JSON.toJSONString(command.getNowTask())); + deviceErrorService.addDeviceError("CrnErr", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍐欏叆娆℃暟"+i+";鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐�:"+JSON.toJSONString(command.getNowTask())); } catch (Exception e2){ } try{ @@ -369,7 +384,7 @@ CrnErrCache.updateCrnErr(slave.getId(), "涓嬪彂DB100.18 鍥炶澶辫触"); try{ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); - deviceErrorService.addDeviceError("crnErr", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍐欏叆娆℃暟"+signFinish+";涓嬪彂DB100.18 鍥炶澶辫触:"+JSON.toJSONString(command.getNowTask())); + deviceErrorService.addDeviceError("CrnErr", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍐欏叆娆℃暟"+signFinish+";涓嬪彂DB100.18 鍥炶澶辫触:"+JSON.toJSONString(command.getNowTask())); } catch (Exception e2){ } try{ -- Gitblit v1.9.1