From 3bdbc5fb15a14f341b0febc4fad8ce4f4fecef44 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 12 一月 2021 20:16:39 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/SiemensCrnThread.java | 94 +++++++++++-----------------------------------
1 files changed, 23 insertions(+), 71 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index fb5bced..77fbbc0 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -243,72 +243,15 @@
log.error("鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�");
return false;
}
- if (command.getTaskNo() == 0) {
+ if (command.getTaskNo() == 0 && command.getAckFinish() == 0) {
command.setTaskNo((short) 9999);
- }
- // 浠g悊
- switch (command.getSourcePosX()) {
- case 1:
- command.setSourcePosX((short) 4);
- break;
- case 2:
- command.setSourcePosX((short) 3);
- break;
- case 3:
- command.setSourcePosX((short) 2);
- break;
- case 4:
- command.setSourcePosX((short) 1);
- break;
- case 5:
- command.setSourcePosX((short) 4);
- break;
- case 6:
- command.setSourcePosX((short) 3);
- break;
- case 7:
- command.setSourcePosX((short) 2);
- break;
- case 8:
- command.setSourcePosX((short) 1);
- break;
- default:
- log.info("{}鍙峰爢鍨涙満涓嬫柟鍛戒护閿欒锛屾簮鎺掞細{}", command.getCrnNo(), command.getSourcePosX());
- }
- switch (command.getDestinationPosX()) {
- case 1:
- command.setDestinationPosX((short) 4);
- break;
- case 2:
- command.setDestinationPosX((short) 3);
- break;
- case 3:
- command.setDestinationPosX((short) 2);
- break;
- case 4:
- command.setDestinationPosX((short) 1);
- break;
- case 5:
- command.setDestinationPosX((short) 4);
- break;
- case 6:
- command.setDestinationPosX((short) 3);
- break;
- case 7:
- command.setDestinationPosX((short) 2);
- break;
- case 8:
- command.setDestinationPosX((short) 1);
- break;
- default:
- log.info("{}鍙峰爢鍨涙満涓嬫柟鍛戒护閿欒锛岀洰鏍囨帓锛歿}", command.getCrnNo(), command.getSourcePosX());
}
command.setCrnNo(slave.getId());
short[] array = new short[9];
- if (!command.getTaskModeType().equals(CrnTaskModeType.CLEAR)) {
+ if (command.getAckFinish() == 0) {
array[0] = 5;
} else {
- array[0] = 7;
+ array[0] = 0;
}
array[1] = command.getSourcePosZ();
array[2] = command.getSourcePosY();
@@ -319,15 +262,21 @@
array[7] = command.getSourceStaNo();
array[8] = command.getDestinationStaNo();
// 浣滀笟淇℃伅
- OperateResult result = siemensNet.Write("DB10.0", array);
- // 浠诲姟鍙�
- OperateResult result1 = siemensNet.Write("DB10.24", command.getTaskNo());
- // 缁撴潫浣�
- OperateResult result2 = siemensNet.Write("DB10.28.1", true);
- if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) {
+ OperateResult result = siemensNet.Write("DB1000.0", array);
+ // 浠诲姟鍙� + 瀹屾垚浣�
+ short[] array2 = new short[2];
+ array2[0] = command.getTaskNo();
+ array2[1] = command.getAckFinish();
+ OperateResult result1 = siemensNet.Write("DB1000.24", array2);
- try {
- // 鏃ュ織璁板綍
+ // 缁撴潫浣�
+ if (command.getAckFinish() == 0) {
+ OperateResult result2 = siemensNet.Write("DB1000.28.1", true);
+ }
+
+ // 鏃ュ織璁板綍
+ try {
+ if (command.getAckFinish() != 1) {
BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class);
BasCrnOpt basCrnOpt = new BasCrnOpt(
command.getTaskNo().intValue(), // 浠诲姟鍙�
@@ -337,17 +286,20 @@
command.getSourcePosX().intValue(), // 婧愭帓
command.getSourcePosY().intValue(), // 婧愬垪
command.getSourcePosZ().intValue(), // 婧愬眰
- command.getSourceStaNo().intValue(), // 婧愮珯
+ null, // 婧愮珯
command.getDestinationPosX().intValue(), // 鐩爣鎺�
command.getDestinationPosY().intValue(), // 鐩爣鍒�
command.getDestinationPosZ().intValue(), // 鐩爣灞�
- command.getDestinationStaNo().intValue(), // 鐩爣绔�
+ null, // 鐩爣绔�
null, // 鍝嶅簲缁撴灉
null, // 淇敼鏃堕棿
null // 淇敼浜哄憳
);
bean.insert(basCrnOpt);
- } catch (Exception ignore) {}
+ }
+ } catch (Exception ignore) {}
+
+ if (result.IsSuccess && result1.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)));
--
Gitblit v1.9.1