From 97c788f31a57b4e8c3fc8091dc29aab598adeebb Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期日, 04 一月 2026 08:07:00 +0800
Subject: [PATCH] #1
---
src/main/java/com/zy/asrs/controller/SiteController.java | 67 ++++++++++++++++++++++++++++-----
1 files changed, 56 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/SiteController.java b/src/main/java/com/zy/asrs/controller/SiteController.java
index 520935e..7926976 100644
--- a/src/main/java/com/zy/asrs/controller/SiteController.java
+++ b/src/main/java/com/zy/asrs/controller/SiteController.java
@@ -7,15 +7,18 @@
import com.zy.asrs.domain.vo.SiteTableVo;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.service.BasDevpService;
+import com.zy.core.Slave;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.DevpSlave;
import com.zy.core.model.Task;
+import com.zy.core.model.command.LiftCommand;
import com.zy.core.model.protocol.StaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.DevpThread;
+import com.zy.core.thread.SiemensDevpThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -36,6 +39,21 @@
private SlaveProperties slaveProperties;
@Autowired
private BasDevpService basDevpService;
+
+ @GetMapping("/io/mode/info/site")
+ @ManagerAuth(memo = "鍏ュ嚭搴撴ā寮�")
+ public R ioMode(){
+ List<Map<String, Object>> res = new ArrayList<>();
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ Map<String, Object> map2 = new HashMap<>();
+ map2.put("floor", 2);
+ map2.put("modeVal", devpThread.ioModeOf2F.id);
+ map2.put("modeDesc", devpThread.ioModeOf2F.desc);
+ res.add(map2);
+ }
+ return R.ok().add(res);
+ }
@PostMapping("/table/site")
@ManagerAuth(memo = "绔欑偣淇℃伅琛�")
@@ -63,6 +81,8 @@
vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 鍏ュ簱鏍囪
vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 绌烘澘淇″彿
vo.setStaNo(staProtocol.getStaNo()); // 鐩爣绔�
+// vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "浣�" : "楂�"); //楂樹綆搴撲綅
+ vo.setLocType1(devp.getDevNo()==102 ? "楂�" : "浣�");
}
return R.ok().add(list);
}
@@ -149,23 +169,34 @@
public R siteDetlUpdate(@RequestParam Integer siteId,
@RequestParam Short workNo,
@RequestParam Short staNo,
+ @RequestParam Short palletSize,
@RequestParam String pakMk){
for (DevpSlave devp : slaveProperties.getDevp()) {
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
Map<Integer, StaProtocol> station = devpThread.getStation();
for (Map.Entry<Integer, StaProtocol> entry : station.entrySet()) {
if (siteId.equals(entry.getKey())) {
- StaProtocol staProtocol = entry.getValue();
- if (workNo != null) {
- staProtocol.setWorkNo(workNo);
- }
- if (staNo != null) {
- staProtocol.setStaNo(staNo);
- }
- if (pakMk != null) {
- staProtocol.setPakMk(pakMk.equals("Y"));
- }
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// StaProtocol staProtocol = entry.getValue();
+// if (staProtocol == null) {
+// continue;
+// } else {
+// staProtocol = staProtocol.clone();
+// }
+// if (workNo != null) {
+// staProtocol.setWorkNo(workNo);
+// }
+// if (staNo != null) {
+// staProtocol.setStaNo(staNo);
+// }
+// if (pakMk != null) {
+// staProtocol.setPakMk(pakMk.equals("Y"));
+// }
+ LiftCommand command = new LiftCommand();
+ command.setWorkNo(Integer.valueOf(workNo));
+ command.setSourceStaNo(siteId);
+ command.setTargetStaNo(Integer.valueOf(staNo));
+
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, command));
if (result) {
return R.ok();
} else {
@@ -177,5 +208,19 @@
return R.error("plc宸叉帀绾�");
}
+ @GetMapping("/site/{siteId}")
+ public R site(@PathVariable("siteId") Integer siteId){
+ List<DevpSlave> devp = slaveProperties.getDevp();
+ for (DevpSlave slave : devp) {
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, slave.getId());
+ Map<Integer, StaProtocol> station = devpThread.getStation();
+ StaProtocol staProtocol = station.get(siteId);
+ if (staProtocol == null) {
+ continue;
+ }
+ return R.ok().add(staProtocol);
+ }
+ return R.error();
+ }
}
--
Gitblit v1.9.1