From bb7ce41d7525f369a93c8b6f76a05fb90d1031b2 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 28 十二月 2020 17:50:58 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/MelsecCrnThread.java | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/core/thread/MelsecCrnThread.java b/src/main/java/com/zy/core/thread/MelsecCrnThread.java index db83baa..ff55e83 100644 --- a/src/main/java/com/zy/core/thread/MelsecCrnThread.java +++ b/src/main/java/com/zy/core/thread/MelsecCrnThread.java @@ -7,7 +7,9 @@ import com.core.common.Arith; import com.core.common.DateUtils; import com.core.common.SpringUtils; +import com.zy.asrs.entity.BasCrnOpt; import com.zy.asrs.entity.BasCrnp; +import com.zy.asrs.service.BasCrnOptService; import com.zy.asrs.service.BasCrnpService; import com.zy.core.CrnThread; import com.zy.core.cache.MessageQueue; @@ -94,7 +96,7 @@ } Thread.sleep(500); } catch (Exception e) { -// e.printStackTrace(); + e.printStackTrace(); } } @@ -143,6 +145,9 @@ } melsecMcNet.ConnectClose(); + try { + Thread.sleep(1000); + } catch (InterruptedException ignore) {} return result; } @@ -196,6 +201,7 @@ BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); BasCrnp basCrnp = new BasCrnp(); basCrnp.setCrnNo(slave.getId()); + crnProtocol.setAlarm1((short) (crnProtocol.getAlarm1() + 1000)); if (!basCrnpService.updateById(crnProtocol.toSqlModel(basCrnp))){ log.error("鍫嗗灈鏈簆lc鏁版嵁搴撴洿鏂板け璐� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); } @@ -236,6 +242,30 @@ if (result.IsSuccess) { log.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); + + try { + // 鏃ュ織璁板綍 + BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); + BasCrnOpt basCrnOpt = new BasCrnOpt( + command.getTaskNo().intValue(), // 浠诲姟鍙� + command.getCrnNo(), // 鍫嗗灈鏈篬闈炵┖] + new Date(), // 涓嬪彂鏃堕棿 + command.getTaskModeType().toString(), // 妯″紡 + command.getSourcePosX().intValue(), // 婧愭帓 + command.getSourcePosY().intValue(), // 婧愬垪 + command.getSourcePosZ().intValue(), // 婧愬眰 + null, // 婧愮珯 + command.getDestinationPosX().intValue(), // 鐩爣鎺� + command.getDestinationPosY().intValue(), // 鐩爣鍒� + command.getDestinationPosZ().intValue(), // 鐩爣灞� + null, // 鐩爣绔� + null, // 鍝嶅簲缁撴灉 + null, // 淇敼鏃堕棿 + null // 淇敼浜哄憳 + ); + bean.insert(basCrnOpt); + } catch (Exception ignore) {} + return true; } else { OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝啓鍏ュ爢鍨涙満plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); -- Gitblit v1.9.1