From 3d3bfa5cb4efbf784254dcb5fb22da35e34dcbff Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 21 十一月 2023 14:10:42 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/SiemensCrnThread.java | 55 +++++++++++++++++--------------------------------------
1 files changed, 17 insertions(+), 38 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index b403e3e..4c3f48b 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -22,6 +22,7 @@
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -37,6 +38,12 @@
private CrnSlave slave;
private CrnProtocol crnProtocol;
private boolean resetFlag = false;
+ public static final List<Short> staNoOne = new ArrayList<Short>() {{
+ add((short) 2);add((short) 5);add((short) 8);add((short) 12);add((short) 16);add((short) 20);
+ }};
+ public static final List<Short> staNoTwo = new ArrayList<Short>() {{
+ add((short) 3);add((short) 6);add((short) 9);add((short) 13);add((short) 17);add((short) 21);
+ }};
public SiemensCrnThread(CrnSlave slave) {
this.slave = slave;
@@ -368,57 +375,29 @@
} else {
array[0] = 0;
}
+ array[1] = command.getSourcePosZ();
+ array[2] = command.getSourcePosY();
- if (command.getSourcePosZ()==(short)1 && command.getSourcePosY()==(short)1){
- array[1] = (short)0;
- array[2] = (short)0;
- }else if (command.getSourcePosZ()==(short)1 && command.getSourcePosY()==(short)41){
- array[1] = (short)0;
- array[2] = (short)42;
- }else {
- array[1] = command.getSourcePosZ();
- array[2] = command.getSourcePosY();
- }
- if (command.getSourcePosX()==(short)3){
+ if (staNoOne.contains(command.getSourcePosX())){
array[3] = (short)1;
- }else if (command.getSourcePosX()==(short)4){
+ }else if (staNoTwo.contains(command.getSourcePosX())){
array[3] = (short)2;
}else {
array[3] = command.getSourcePosX();
}
+ array[4] = command.getDestinationPosZ();
+ array[5] = command.getDestinationPosY();
- if (command.getDestinationPosZ()==(short)1 && command.getDestinationPosY()==(short)1){
- array[4] = (short)0;
- array[5] = (short)0;
- }else if (command.getDestinationPosZ()==(short)1 && command.getDestinationPosY()==(short)41){
- array[4] = (short)0;
- array[5] = (short)42;
- }else {
- array[4] = command.getDestinationPosZ();
- array[5] = command.getDestinationPosY();
- }
-
- if (command.getDestinationPosX()==(short)3){
+ if (staNoOne.contains(command.getDestinationPosX())){
array[6] = (short)1;
- }else if (command.getDestinationPosX()==(short)4){
+ }else if (staNoTwo.contains(command.getDestinationPosX())){
array[6] = (short)2;
}else {
array[6] = command.getDestinationPosX();
}
- if ((array[1]==(short)0 && array[2] == (short)0) || (array[1]==(short)0 && array[2] == (short)42)){
- array[7]=(short)1;
- }else {
- array[7]=(short)0;
- }
-// array[7] = command.getSourceStaNo();
-
- if ((array[4]==(short)0 && array[5] == (short)0) || (array[4]==(short)0 && array[5] == (short)42)){
- array[8]=(short)1;
- }else {
- array[8]=(short)0;
- }
-// array[8] = command.getDestinationStaNo();
+ array[7] = command.getSourceStaNo();
+ array[8] = command.getDestinationStaNo();
// 浣滀笟淇℃伅
OperateResult result = siemensNet.Write("DB10.0", array);
--
Gitblit v1.9.1