From 5936220e860f561ff100a9eef4fbd5471c195946 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 08 九月 2025 17:14:39 +0800
Subject: [PATCH] 1
---
src/main/java/com/zy/asrs/controller/OpenController.java | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index 7a62014..fc003ee 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -6,8 +6,11 @@
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.impl.CtuMainServiceImpl;
import com.zy.common.web.BaseController;
+import com.zy.core.DevpThread;
+import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
+import com.zy.core.model.Task;
import com.zy.core.model.protocol.StaProtocol;
import com.zy.core.thread.SiemensDevpThread;
import lombok.extern.slf4j.Slf4j;
@@ -18,6 +21,8 @@
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
+import java.util.Map;
+import java.util.Random;
/**
* Created by vincent on 2022/4/8
@@ -79,12 +84,26 @@
if (param == null || param.getSeqNum() == null || param.getQrCode() == null) {
return R.error("鍙傛暟涓虹┖");
}
- if (param.getQrCode().equals("00001547") && param.getTaskSts() == 10) {
+ if ((param.getQrCode().equals("00001547") || param.getQrCode().equals("1001")) && param.getTaskSts() == 10) {
log.info("1001浠诲姟鐘舵�佷笂鎶ユ帴鏀讹細{}", param);
- ctuMainService.setFlag1001(true);
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+ Map<Integer, StaProtocol> station = devpThread.getStation();
+ StaProtocol staProtocol = station.get(1001);
+ if (staProtocol == null) {
+ return R.error("鏈壘鍒扮珯鐐�");
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ Random rand = new Random();
+ staProtocol.setWorkNo(rand.nextInt(1000));
+ staProtocol.setStaNo((short) 1004);
+ boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
+ if (result) {
+ log.info("涓嬪彂鎴愬姛锛歿},{}", staProtocol.getWorkNo(), 1004);
+ }
} else if (param.getQrCode().equals("00001612") && param.getTaskSts() == 5) {
log.info("1007浠诲姟鐘舵�佷笂鎶ユ帴鏀讹細{}", param);
- ctuMainService.setFlag1007(true);
+
}
return R.ok();
}
@@ -94,6 +113,7 @@
*/
@RequestMapping("/sta/ask/v1")
public R taskSync(@RequestBody AskStaParam param) {
+ log.info("鐘舵�佽闂細{}", param);
if (param == null || param.getAskSta() == null || param.getAskType() == null) {
return R.error("鍙傛暟涓虹┖");
}
--
Gitblit v1.9.1