From 92c572e50893a93a810bbe6adb6d3cdbfc225073 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 20 五月 2025 14:17:33 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/controller/SiteController.java | 158 ++++++++++++++++++++++++++++++----------------------
1 files changed, 92 insertions(+), 66 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/SiteController.java b/src/main/java/com/zy/asrs/controller/SiteController.java
index 1305824..cdb066b 100644
--- a/src/main/java/com/zy/asrs/controller/SiteController.java
+++ b/src/main/java/com/zy/asrs/controller/SiteController.java
@@ -171,7 +171,7 @@
vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 绌烘澘淇″彿
vo.setStaNo(staProtocol.getStaNo()); // 鐩爣绔�
vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "浣�" : "楂�"); //楂樹綆搴撲綅
- vo.setCar(staProtocol.isCar() ? "鏈�": "鏃�");
+// vo.setCar(staProtocol.isCar() ? "鏈�": "鏃�");
return R.ok().add(vo);
}
}
@@ -182,8 +182,8 @@
@PostMapping("/detl/update")
@ManagerAuth(memo = "淇敼绔欑偣鏁版嵁")
public R siteDetlUpdate(@RequestParam Integer devNo,
- @RequestParam Short workNo,
- @RequestParam Short staNo,
+ @RequestParam Integer workNo,
+ @RequestParam Integer staNo,
@RequestParam(required = false) String pakMk,
@RequestParam(required = false) Boolean inEnable,
@RequestParam(required = false) Boolean outEnable
@@ -221,7 +221,7 @@
basDevp.setOutEnable(outEnable ? "Y" : "N");
}
basDevpService.updateById(basDevp);
- boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (result) {
return R.ok();
} else {
@@ -232,72 +232,98 @@
}
return R.error("鏇存柊澶辫触");
}
+ @PostMapping("/detl/out")
+ @ManagerAuth(memo = "淇敼绔欑偣鏁版嵁")
+ public R siteDetlout(@RequestParam Integer devNo,
+ @RequestParam Short workNo,
+ @RequestParam Short staNo,
+ @RequestParam(required = false) String pakMk,
+ @RequestParam(required = false) Boolean inEnable,
+ @RequestParam(required = false) Boolean outEnable
+ ) {
+ BasDevp basDevp = basDevpService.selectById(devNo);
+ if (basDevp == null) {
+ return R.error("绔欑偣涓嶅瓨鍦�");
+ }
+ 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 (devNo.equals(entry.getKey())) {
+ StaProtocol staProtocol = entry.getValue();
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ if (pakMk != null) {
+ staProtocol.setPakMk(pakMk.equals("Y"));
+ }
+ if (inEnable != null) {
+ staProtocol.setInEnable(inEnable);
+ basDevp.setInEnable(inEnable ? "Y" : "N");
+ }
+ if (outEnable != null) {
+ staProtocol.setOutEnable(outEnable);
+ basDevp.setOutEnable(outEnable ? "Y" : "N");
+ }
+ staProtocol.setWorkNo(0);
+ staProtocol.setStaNo(0);
+ basDevpService.updateById(basDevp);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
+ if (result) {
+ return R.ok();
+ } else {
+ return R.error("涓嬪彂鍛戒护澶辫触");
+ }
+ }
+ }
+ }
+ return R.error("鏇存柊澶辫触");
+ }
+ @PostMapping("/detl/in")
+ @ManagerAuth(memo = "淇敼绔欑偣鏁版嵁")
+ public R siteDetlint(@RequestParam Integer devNo,
+ @RequestParam Short workNo,
+ @RequestParam Short staNo,
+ @RequestParam(required = false) String pakMk,
+ @RequestParam(required = false) Boolean inEnable,
+ @RequestParam(required = false) Boolean outEnable
+ ) {
+ BasDevp basDevp = basDevpService.selectById(devNo);
+ if (basDevp == null) {
+ return R.error("绔欑偣涓嶅瓨鍦�");
+ }
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ // 閬嶅巻鍏ュ簱鍙�
+ for (DevpSlave.Sta inSta : devp.getInSta()) {
+ if (!devNo.equals(inSta.getBackSta()) ){
+ continue;
+ }
+ // 鑾峰彇鍏ュ簱绔欎俊鎭�
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(inSta.getBackSta());
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ staProtocol.setWorkNo( 9999);
+ staProtocol.setStaNo(inSta.getStaNo());
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
+ if (result) {
+ return R.ok();
+ } else {
+ return R.error("涓嬪彂鍛戒护澶辫触");
+ }
+ }
+ }
+ return R.error("鏇存柊澶辫触");
+ }
public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry){
List<PlcErrorTableVo> list = new ArrayList<>();
StaProtocol staProtocol = entry.getValue();
- if (staProtocol.getBreakerErr()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
- vo.setPlcDesc("鏂矾鍣ㄦ晠闅�");
- vo.setError("鏂矾鍣ㄦ晠闅�");
- list.add(vo);
- }
- if (staProtocol.getInfraredErr()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
- vo.setPlcDesc("鍏夌數寮傚父");
- vo.setError("鍏夌數寮傚父");
- list.add(vo);
- }
- if (staProtocol.getOutTimeErr()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
-
- vo.setPlcDesc("杩愯瓒呮椂");
- vo.setError("杩愯瓒呮椂");
- list.add(vo);
- }
- if (staProtocol.getSeizeSeatErr()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
-
- vo.setPlcDesc("鍗犱綅瓒呮椂");
- vo.setError("鍗犱綅瓒呮椂");
- list.add(vo);
- }
- if (staProtocol.getWrkYgoodsN()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
-
- vo.setPlcDesc("鏈変换鍔℃棤璐ф晠闅�");
- vo.setError("鏈変换鍔℃棤璐ф晠闅�");
- list.add(vo);
- }
- if (staProtocol.getInverterErr()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
-
- vo.setPlcDesc("鍙橀鍣ㄦ晠闅�");
- vo.setError("鍙橀鍣ㄦ晠闅�");
- list.add(vo);
- }
- if (staProtocol.getContactErr()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
-
- vo.setPlcDesc("鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
- vo.setError("鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
- list.add(vo);
- }
- if (staProtocol.getUpcontactErr()){
- PlcErrorTableVo vo = new PlcErrorTableVo();
- vo.setNo(entry.getKey()); // 搴忓彿
-
- vo.setPlcDesc("椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
- vo.setError("椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
- list.add(vo);
- }
if (staProtocol.isFrontErr()){
PlcErrorTableVo vo = new PlcErrorTableVo();
vo.setNo(entry.getKey()); // 搴忓彿
--
Gitblit v1.9.1