From 05e3e768a8dc83472cee44f8c5a81189fade15b2 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 29 七月 2025 09:54:02 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/OpenController.java  |   47 +++++++++++++++++++++++
 src/main/java/com/zy/asrs/domain/param/ToOutStaParam.java |   14 +++++++
 2 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
new file mode 100644
index 0000000..90d2e08
--- /dev/null
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -0,0 +1,47 @@
+package com.zy.asrs.controller;
+
+import com.core.common.R;
+import com.zy.asrs.domain.param.ToOutStaParam;
+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;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+public class OpenController {
+
+    @RequestMapping("/open/toOutSta")
+    public R toOutSta(@RequestBody ToOutStaParam param) {
+        Integer sourceStaNo = param.getSourceStaNo();
+        SiemensDevpThread siemensDevpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+        if(siemensDevpThread == null) {
+            return R.error("绾跨▼涓嶅瓨鍦�");
+        }
+
+        StaProtocol staProtocol = siemensDevpThread.getStation().get(sourceStaNo).clone();
+        if(staProtocol == null) {
+            return R.error("绔欑偣涓嶅瓨鍦�");
+        }
+
+        if (staProtocol.getWorkNo().intValue() != param.getWrkNo()) {
+            return R.error("宸ヤ綔鍙蜂笉涓�鑷�");
+        }
+
+        if (!staProtocol.isLoading()) {
+            return R.error("绔欑偣鏃犵墿");
+        }
+
+        staProtocol.setWorkNo(param.getWrkNo().shortValue());
+        staProtocol.setStaNo(param.getStaNo().shortValue());
+        boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
+        return R.ok().add(result);
+    }
+
+}
diff --git a/src/main/java/com/zy/asrs/domain/param/ToOutStaParam.java b/src/main/java/com/zy/asrs/domain/param/ToOutStaParam.java
new file mode 100644
index 0000000..0d996ba
--- /dev/null
+++ b/src/main/java/com/zy/asrs/domain/param/ToOutStaParam.java
@@ -0,0 +1,14 @@
+package com.zy.asrs.domain.param;
+
+import lombok.Data;
+
+@Data
+public class ToOutStaParam {
+
+    private Integer wrkNo;
+
+    private Integer sourceStaNo;
+
+    private Integer staNo;
+
+}

--
Gitblit v1.9.1