From 145809d96eb56b3500bd3b7464e215c738346795 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 21 十一月 2023 16:26:27 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/RgvThread.java | 44 +++++++++++++++++++++++++++++++++++++-------
1 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/RgvThread.java b/src/main/java/com/zy/core/thread/RgvThread.java
index db19743..94d8059 100644
--- a/src/main/java/com/zy/core/thread/RgvThread.java
+++ b/src/main/java/com/zy/core/thread/RgvThread.java
@@ -67,9 +67,17 @@
case 1:
readStatus();
break;
- // 鍐欏叆鏁版嵁
+ // 宸ヤ綅1銆�2鍐欏叆鏁版嵁
case 2:
write((RgvCommand) task.getData());
+ break;
+ //宸ヤ綅1鍐欏叆鏁版嵁
+ case 4:
+ write1((RgvCommand) task.getData());
+ break;
+ //宸ヤ綅2鍐欏叆鏁版嵁
+ case 5:
+ write2((RgvCommand) task.getData());
break;
// 澶嶄綅
case 3:
@@ -90,6 +98,26 @@
command.setDestinationStaNo2((short)0); // 鐩爣绔�
command.setCommand((short)0);
write(command);
+ break;
+ // 鍥炲師鐐� 閬胯
+ case 9:
+ RgvCommand commandAvoidanceXY = (RgvCommand) task.getData();
+ if (null == commandAvoidanceXY) {
+ commandAvoidanceXY = new RgvCommand();
+ }
+ commandAvoidanceXY.setRgvNo(slave.getId()); // RGV缂栧彿
+ commandAvoidanceXY.setTaskNo1((short) 9999); // 宸ヤ綔鍙�
+ commandAvoidanceXY.setAckFinish1((short) 1); // 浠诲姟瀹屾垚纭浣�
+ commandAvoidanceXY.setTaskMode1(RgvTaskModeType.GO_ORIGIN); // 浠诲姟妯″紡
+ commandAvoidanceXY.setSourceStaNo1((short)0); // 婧愮珯
+ commandAvoidanceXY.setDestinationStaNo1((short)0); // 鐩爣绔�
+ commandAvoidanceXY.setTaskNo2((short) 0); // 宸ヤ綔鍙�
+ commandAvoidanceXY.setAckFinish2((short) 1); // 浠诲姟瀹屾垚纭浣�
+ commandAvoidanceXY.setTaskMode2(RgvTaskModeType.GO_ORIGIN); // 浠诲姟妯″紡
+ commandAvoidanceXY.setSourceStaNo2((short)0); // 婧愮珯
+ commandAvoidanceXY.setDestinationStaNo2((short)0); // 鐩爣绔�
+ commandAvoidanceXY.setCommand((short)0);
+ write(commandAvoidanceXY);
break;
default:
break;
@@ -150,7 +178,7 @@
*/
private void readStatus(){
try {
- OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 34);
+ OperateResultExOne<byte[]> result = siemensNet.Read("DB1.0", (short) 34);
if (result.IsSuccess) {
if (null == rgvProtocol) {
rgvProtocol = new RgvProtocol();
@@ -180,7 +208,8 @@
OutputQueue.RGV.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
// 宸ヤ綅1澶嶄綅淇″彿
- if (rgvProtocol.getStatusType1().equals(RgvStatusType.WAITING)) {
+ if (rgvProtocol.getStatusType1().equals(RgvStatusType.WAITING)
+ || rgvProtocol.getStatusType1().equals(RgvStatusType.FETCHWAITING)) {
if (resetFlag1) {
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setAckFinish1((short)1);
@@ -191,7 +220,8 @@
}
// 宸ヤ綅2澶嶄綅淇″彿
- if (rgvProtocol.getStatusType2().equals(RgvStatusType.WAITING)) {
+ if (rgvProtocol.getStatusType2().equals(RgvStatusType.WAITING)
+ || rgvProtocol.getStatusType2().equals(RgvStatusType.FETCHWAITING)) {
if (resetFlag2) {
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setAckFinish2((short)1);
@@ -306,6 +336,7 @@
array[2] = command.getTaskMode1();
array[3] = command.getSourceStaNo1();
array[4] = command.getDestinationStaNo1();
+ siemensNet.Write("DB100.20", command.getCommand());
OperateResult result = siemensNet.Write("DB100.0", array);
@@ -357,15 +388,14 @@
return false;
}
- siemensNet.Write("DB100.20", command.getCommand());
-
command.setRgvNo(slave.getId());
- short[] array = new short[5];
+ short[] array = new short[6];
array[0] = command.getAckFinish2();
array[1] = command.getTaskNo2();
array[2] = command.getTaskMode2();
array[3] = command.getSourceStaNo2();
array[4] = command.getDestinationStaNo2();
+ array[5] = command.getCommand();
OperateResult result = siemensNet.Write("DB100.10", array);
--
Gitblit v1.9.1