From db1de2dced1def55238e8a2cba3fbdff70d0f3c1 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 19 五月 2023 10:28:19 +0800
Subject: [PATCH] 指令日志查询
---
src/main/java/com/zy/core/thread/SiemensCrnThread.java | 74 ++++++++++++++++++++++++++++++++----
1 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index 5d4dc1f..32c6cbc 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -9,8 +9,10 @@
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasCrnOpt;
import com.zy.asrs.entity.BasCrnp;
+import com.zy.asrs.entity.CommandInfo;
import com.zy.asrs.service.BasCrnOptService;
import com.zy.asrs.service.BasCrnpService;
+import com.zy.asrs.service.CommandInfoService;
import com.zy.core.CrnThread;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -49,7 +51,7 @@
this.connect();
while (true) {
try {
- int step = 1;
+ int step = 3;
Task task = MessageQueue.poll(SlaveType.Crn, slave.getId());
if (task != null) {
step = task.getStep();
@@ -353,6 +355,16 @@
if (command.getTaskNo() == 0 && command.getAckFinish() == 0) {
command.setTaskNo((short) 9999);
}
+
+ CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class);
+ CommandInfo commandInfo = new CommandInfo();
+ commandInfo.setWrkNo(command.getTaskNo().intValue());
+ commandInfo.setCommandStatus(1);
+ commandInfo.setStartTime(new Date());
+ commandInfo.setDevice("crn");
+ commandInfo.setCommand(JSON.toJSONString(command));
+ commandInfoService.insert(commandInfo);
+
command.setCrnNo(slave.getId());
short[] array = new short[9];
if (command.getAckFinish() == 0) {
@@ -360,14 +372,58 @@
} else {
array[0] = 0;
}
- array[1] = command.getSourcePosZ();
- array[2] = command.getSourcePosY();
- array[3] = command.getSourcePosX();
- array[4] = command.getDestinationPosZ();
- array[5] = command.getDestinationPosY();
- array[6] = command.getDestinationPosX();
- array[7] = command.getSourceStaNo();
- array[8] = command.getDestinationStaNo();
+
+ 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){
+ array[3] = (short)1;
+ }else if (command.getSourcePosX()==(short)4){
+ array[3] = (short)2;
+ }else {
+ array[3] = command.getSourcePosX();
+ }
+
+ 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){
+ array[6] = (short)1;
+ }else if (command.getDestinationPosX()==(short)4){
+ 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();
+
// 浣滀笟淇℃伅
OperateResult result = siemensNet.Write("DB10.0", array);
// 浠诲姟鍙� + 瀹屾垚浣�
--
Gitblit v1.9.1