From 190bec9d5950a76e62b3bb1663f979a644695279 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期六, 09 八月 2025 15:22:27 +0800
Subject: [PATCH] 完善wcs'主控图地图显示
---
src/main/java/com/zy/asrs/controller/MonitorController.java | 126 ++++++++++++++++++++---------------------
1 files changed, 61 insertions(+), 65 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/MonitorController.java b/src/main/java/com/zy/asrs/controller/MonitorController.java
index 27c8c85..3d02d82 100644
--- a/src/main/java/com/zy/asrs/controller/MonitorController.java
+++ b/src/main/java/com/zy/asrs/controller/MonitorController.java
@@ -1,17 +1,23 @@
package com.zy.asrs.controller;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Arith;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.domain.dto.AxisBean;
import com.zy.asrs.domain.dto.WorkChartAxis;
import com.zy.asrs.domain.vo.LocChartPie;
+import com.zy.asrs.entity.LocMast;
import com.zy.asrs.mapper.ReportQueryMapper;
+import com.zy.asrs.service.impl.LocMastServiceImpl;
+import com.zy.common.model.annotations.RateLimit;
import com.zy.common.service.CommonService;
import com.zy.core.CrnThread;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
+import com.zy.core.model.LedSlave;
import com.zy.core.model.protocol.CrnProtocol;
+import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.LedThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -33,6 +39,10 @@
@Autowired
private ReportQueryMapper reportQueryMapper;
+ @Autowired
+ private SlaveProperties slaveProperties;
+ @Autowired
+ private LocMastServiceImpl locMastService;
/**
* 鑾峰彇褰撳墠鏃堕棿
@@ -57,7 +67,7 @@
* 鑾峰彇鍏朵粬淇℃伅
*/
@GetMapping("/other")
- public R monitorOther(@RequestParam("crnId") Integer crnId) {
+ public R monitorOther(@RequestParam("crnId") Integer crnId, @RequestParam("ledId") Integer ledId) {
Double xSpeed = 0.0D;
Double ySpeed = 0.0D;
Double zSpeed = 0.0D;
@@ -98,8 +108,8 @@
}
// 鑾峰彇杈撻�佺嚎plc绾跨▼
- LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, crnId);
- String ledContent = ledThread.getStringBuffer().toString();
+// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, ledId);
+// String ledContent = ledThread.getWorkNos().toString();
// ledContent = "ask鐨勬ā鍧楄惃婊″ぇ绠椾簡钀ㄦ弧澶т簡\n 鏄獦澧冨埌鍩冨強鍡插鍡瞈n 钀ㄨ揪濮嗘墦寮�钀ㄦ弧澶у嚡鎾掗害褰撳姵钀ㄦ弧澶ц�佸笀";
return R.ok(
@@ -111,14 +121,15 @@
.add("yDistance", Arith.multiplys(1, Math.abs(yDistance), 1)) // 绱鍗囬檷璺濈km
.add("xDuration", Arith.multiplys(1, Math.abs(xDuration), 1)) // 绱璧拌鏃堕暱h
.add("yDuration", Arith.multiplys(1, Math.abs(yDuration), 1)) // 绱鍗囬檷鏃堕暱h
- .add("isShow", !Cools.isEmpty(ledContent)) // 鏄惁鏄剧ず鍐呭
- .add("content", ledContent) // 鏄剧ず鍐呭
+// .add("isShow", !Cools.isEmpty(ledContent)) // 鏄惁鏄剧ず鍐呭
+// .add("content", ledContent) // 鏄剧ず鍐呭
);
}
/**
* 鍏ュ簱鎶ヨ〃 -- 鎶樼嚎鍥�
*/
+ @RateLimit(2)
@GetMapping("/pakin/rep")
public R monitorPakinRep(){
// 鍏ュ簱
@@ -133,6 +144,7 @@
return R.ok(pakinRep);
}
+ @RateLimit(2)
@GetMapping("/line/charts")
public R locIoLineCharts(){
Map<String,Object> map=new HashMap<String, Object>();
@@ -183,95 +195,67 @@
/**
* 搴撲綅浣跨敤鎯呭喌缁熻
*/
+ @RateLimit(2)
@GetMapping("/loc/rep")
- public R monitorLocRep(){
+ public R monitorLocRep(@RequestParam("crnId") Integer crnId, @RequestParam("ledId") Integer ledId){
List<Map<String, Object>> pie = new ArrayList<>();
- LocChartPie locUseRate = reportQueryMapper.getLocUseRate();
- if(locUseRate!=null) {
+// LocChartPie locUseRate = reportQueryMapper.getLocUseRate();
+ int Fqty = 0;
+ int Oqty = 0;
+ int Uqty = 0;
+ int Xqty = 0;
+ if(crnId!=null&&crnId<=2) {
+ Fqty=locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).eq("loc_sts","F"));
+ Oqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).eq("loc_sts","O"));
+ Uqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).in("loc_sts", "R","Q","S","P"));
+ Xqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).eq("loc_sts", "X"));
+ }else if(crnId!=null&&crnId==3) {
+ Fqty=locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).eq("loc_sts","F"));
+ Oqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).eq("loc_sts","O"));
+ Uqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).in("loc_sts", "R","Q","S","P"));
+ Xqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).eq("loc_sts", "X"));
+ }
+ if(crnId!=null) {
Map<String, Object> map = new HashMap<>();
map.put("name", "鍦ㄥ簱");
- map.put("value", locUseRate.getFqty());
+ map.put("value", Fqty);
pie.add(map);
Map<String, Object> map1 = new HashMap<>();
map1.put("name", "绌�");
- map1.put("value", locUseRate.getOqty());
+ map1.put("value", Oqty);
pie.add(map1);
Map<String, Object> map2 = new HashMap<>();
map2.put("name", "浣跨敤");
- map2.put("value", locUseRate.getUqty());
+ map2.put("value", Uqty);
pie.add(map2);
Map<String, Object> map3 = new HashMap<>();
map3.put("name", "绂佺敤");
- map3.put("value", locUseRate.getXqty());
+ map3.put("value", Xqty);
pie.add(map3);
}
// 鎬诲簱浣嶆暟
- Integer total = (int) Arith.add(0, locUseRate.getFqty(), locUseRate.getOqty(), locUseRate.getUqty(), locUseRate.getXqty());
+ Integer total = (int) Arith.add(0,Fqty,Oqty,Uqty,Xqty);
// 浣跨敤涓�
- Integer used = locUseRate.getFqty() + locUseRate.getUqty();
+ Integer used = Fqty + Uqty;
// 搴撲綅浣跨敤鐜�
double usedDivides = Arith.divides(3, used, total);
double usedPr = Arith.multiplys(1, usedDivides, 100);
return R.ok(
Cools.add("pie", pie)
- .add("stockCunt", locUseRate.getFqty())
- .add("emptyCount", locUseRate.getOqty())
- .add("noneCount", locUseRate.getXqty())
+ .add("stockCunt",Fqty)
+ .add("emptyCount",Oqty)
+ .add("noneCount",Xqty)
.add("total", total)
.add("used", used)
.add("usedPr", usedPr)
);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/**
* 鑷姩琛ラ浂
*/
@@ -343,8 +327,20 @@
}
}
-
-
-
-
+ /**
+ * 寮傚父閫氱煡
+ */
+ @GetMapping("/led/error")
+ public R monitorLedError(@RequestParam("ledId") Integer ledId) {
+ String errorMsg = "";
+ for (LedSlave slave : slaveProperties.getLed()) {
+ if (slave.getStaArr().contains(ledId)) {
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId());
+ if (null != ledThread) {
+ errorMsg = ledThread.getErrorMsg().toString();
+ }
+ }
+ }
+ return R.ok().add(errorMsg);
+ }
}
--
Gitblit v1.9.1