From c808221f6a427014d8c112d172f5a1e58abab197 Mon Sep 17 00:00:00 2001
From: 18516761980 <56479841@qq.com>
Date: 星期一, 26 五月 2025 18:37:12 +0800
Subject: [PATCH] 环境文件备份,数据库备份
---
src/main/java/com/zy/asrs/controller/RgvController.java | 190 +++++++++++++++++++++++++++++++++--------------
1 files changed, 134 insertions(+), 56 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/RgvController.java b/src/main/java/com/zy/asrs/controller/RgvController.java
index b4c4559..d7a73c0 100644
--- a/src/main/java/com/zy/asrs/controller/RgvController.java
+++ b/src/main/java/com/zy/asrs/controller/RgvController.java
@@ -2,17 +2,20 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
+import com.core.common.Cools;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.RgvStatusType;
-import com.zy.asrs.domain.param.RgvOperatorParam;
-import com.zy.asrs.domain.param.RingThroughParam;
+import com.zy.asrs.domain.param.*;
import com.zy.asrs.domain.vo.*;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.BasRgvErrMapper;
+import com.zy.asrs.service.BasCircularShuttleService;
+import com.zy.asrs.service.BasDevpPositionService;
import com.zy.asrs.service.BasRgvService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.service.impl.MainServiceImpl;
+import com.zy.asrs.utils.NumUtils;
import com.zy.asrs.utils.Utils;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -20,14 +23,17 @@
import com.zy.core.enums.RgvModeType;
import com.zy.core.enums.RgvTaskModeType;
import com.zy.core.enums.SlaveType;
+import com.zy.core.model.DevpSlave;
import com.zy.core.model.RgvSlave;
import com.zy.core.model.Task;
import com.zy.core.model.command.RgvCommand;
import com.zy.core.model.protocol.RgvProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.RgvThread;
+import com.zy.core.thread.SiemensDevpThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -57,6 +63,13 @@
private BasRgvService basRgvService;
@Autowired
private MainServiceImpl mainService;
+ @Autowired
+ private BasDevpPositionService basDevpPositionService;
+ @Autowired
+ private BasCircularShuttleService basCircularShuttleService;
+
+ @Value("${constant-parameters.perimeter}")
+ private Long perimeter;
@PostMapping("/table/rgv/state")
@ManagerAuth(memo = "RGV淇℃伅琛�")
@@ -319,79 +332,144 @@
return false;
}
- @PostMapping("/console/rgv/site/data")
- @ManagerAuth(memo = "灏忚溅瀹炴椂浣嶇疆")
- public R scaleLatestData(){
- List<Map> result = new ArrayList<>();
- for (RgvSlave rgv : slaveProperties.getRgv()) {
- // 鑾峰彇RGV淇℃伅
- RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
- if (rgvThread == null) {
- throw new CoolException("RGV涓嶅湪绾�");
- }
- RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
- if (rgvProtocol == null) {
- throw new CoolException("RGV涓嶅湪绾�");
- }
- Map<String, Object> rgvMap = new HashMap<>();
- rgvMap.put("title", rgvProtocol.getRgvPosI());
- rgvMap.put("id", rgvProtocol.getRgvNo());
- result.add(rgvMap);
- }
- return R.ok().add(result);
- }
@PostMapping("/ring/through/rgv/position/data")
// @ManagerAuth(memo = "鐜┛浣嶇疆淇℃伅")
public R ringThroughRgv(){
List<RingThroughParam> result = new ArrayList<>();
-// for (RgvSlave rgv : slaveProperties.getRgv()) {
- for (int i = 1;i<10;i++) {
+ for (RgvSlave rgv : slaveProperties.getRgv()) {
+// for (int i = 1;i<2;i++) {
// // 鑾峰彇RGV淇℃伅
-// RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
-// if (rgvThread == null) {
-// continue;
-// }
-// RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
-// if (rgvProtocol == null) {
-// continue;
-// }
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
+ if (rgvThread == null) {
+ continue;
+ }
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ continue;
+ }
RingThroughParam ringThroughParam = new RingThroughParam();
-// ringThroughParam.setIndex(rgv.getId());
- ringThroughParam.setIndex(i);
- double[] doubles = Utils.RingThroughXY(183.0, 100.0*i);
- ringThroughParam.setValueX(doubles[0]);
- ringThroughParam.setValueY(doubles[1]);
+ ringThroughParam.setIndex(rgv.getId());
+// ringThroughParam.setIndex(i);
+// double[] doubles = Utils.RingThroughXY2(perimeter, NumUtils.GetRandomIntInRange(183));
+// double[] doubles = Utils.RingThroughXYRgv(perimeter, perimeter-rgvProtocol.RgvPos.doubleValue());
+ double[] doubles = Utils.getRgvPos(perimeter, rgvProtocol.RgvPos.doubleValue());
+// double[] doubles = Utils.RingThroughXY2(183.0, 100*i );
+
+ ringThroughParam.setValueX(doubles[0]-2.94);
+ ringThroughParam.setValueY(doubles[1]-2.94);
+ ringThroughParam.setModeColor(rgvProtocol.modeType.color);
+ ringThroughParam.setStatusColor(rgvProtocol.statusType.color);
result.add(ringThroughParam);
}
return R.ok().add(result);
}
@PostMapping("/ring/through/dev/position/data")
-// @ManagerAuth(memo = "鐜┛浣嶇疆淇℃伅")
+// @ManagerAuth(memo = "绔欑偣淇℃伅")
+ // 绔欑偣浣嶇疆淇℃伅
public R ringThroughDev(){
List<RingThroughParam> result = new ArrayList<>();
-// for (RgvSlave rgv : slaveProperties.getRgv()) {
- for (int i = 1;i<10;i++) {
-// // 鑾峰彇RGV淇℃伅
-// RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
-// if (rgvThread == null) {
-// continue;
-// }
-// RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
-// if (rgvProtocol == null) {
-// continue;
-// }
+ List<BasDevpPosition> basDevpPositions = basDevpPositionService.selectList(new EntityWrapper<>());
+ for (BasDevpPosition basDevpPosition : basDevpPositions){
RingThroughParam ringThroughParam = new RingThroughParam();
-
-// ringThroughParam.setIndex(rgv.getId());
- ringThroughParam.setIndex(i);
- double[] doubles = Utils.RingThroughXY(183.0, 103.0*i);
- ringThroughParam.setValueX(doubles[0]);
- ringThroughParam.setValueY(doubles[1]);
+ ringThroughParam.setIndex(basDevpPosition.getDevNo());
+ double[] doubles = Utils.RingThroughXYSta(perimeter, perimeter-basDevpPosition.getPlcPosition());
+ ringThroughParam.setValueX(doubles[0]>50? doubles[0]+6:doubles[0]-1);
+ ringThroughParam.setValueY(doubles[1]>50? doubles[1]+6:doubles[1]-1);
result.add(ringThroughParam);
}
return R.ok().add(result);
}
+ @PostMapping("/ring/through/track/position/data")
+// @ManagerAuth(memo = "杞ㄩ亾PLC鐘舵�佷俊鎭�")
+ public R wnergyGatheringRingParamTrack(){
+ List<EnergyGatheringRingParam> result = new ArrayList<>();
+ try{
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ if (devp.getId()!=1){
+ break;
+ }
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ if (devpThread.isResult()){
+ if (true){
+ EnergyGatheringRingParam energyGatheringRingParam = new EnergyGatheringRingParam();
+ energyGatheringRingParam.setTrackColor("rgba(0, 230, 118, 0.5)");
+ energyGatheringRingParam.setRadiationColor("rgba(0, 230, 118, 0.5)");
+ result.add(energyGatheringRingParam);
+ } else {
+ EnergyGatheringRingParam energyGatheringRingParam = new EnergyGatheringRingParam();
+ energyGatheringRingParam.setTrackColor("rgba(0, 230, 118, 0.5)");
+ energyGatheringRingParam.setRadiationColor("rgba(0, 230, 118, 0.5)");
+ result.add(energyGatheringRingParam);
+ }
+ }
+ }
+ if (result.isEmpty()){
+ EnergyGatheringRingParam energyGatheringRingParam = new EnergyGatheringRingParam();
+ energyGatheringRingParam.setTrackColor("rgba(0, 0, 0, 81)");
+ energyGatheringRingParam.setRadiationColor("rgba(0, 0, 0, 81)");
+ result.add(energyGatheringRingParam);
+ }
+ } catch (Exception e){
+ EnergyGatheringRingParam energyGatheringRingParam = new EnergyGatheringRingParam();
+ energyGatheringRingParam.setTrackColor("rgba(0, 0, 0, 81)");
+ energyGatheringRingParam.setRadiationColor("rgba(0, 0, 0, 81)");
+ result.add(energyGatheringRingParam);
+ }
+ return R.ok().add(result);
+ }
+
+ @PostMapping("/ring/through/task/wrk/mast/position/data")
+// @ManagerAuth(memo = "浣滀笟淇℃伅")
+ public R ringThroughTaskWrkMast(){
+ List<RgvWrkMastParam> result = new ArrayList<>();
+ List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<>());
+ for (WrkMast wrkMast : wrkMasts){
+ RgvWrkMastParam rgvWrkMastParam = new RgvWrkMastParam(wrkMast);
+ if (Cools.isEmpty(rgvWrkMastParam.getRgvNo())){
+ rgvWrkMastParam.setRgvSts("鏈粦瀹�");
+ } else {
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvWrkMastParam.getRgvNo());
+ if (rgvThread == null) {
+ rgvWrkMastParam.setRgvSts("鏈煡");
+ } else {
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ rgvWrkMastParam.setRgvSts("鏈煡");
+ } else {
+ rgvWrkMastParam.setRgvSts(rgvProtocol.statusType.desc);
+ }
+ }
+ }
+ result.add(rgvWrkMastParam);
+ }
+ return R.ok().add(result);
+ }
+
+ @PostMapping("/task/rgv/circular/shuttle/mast/position/data")
+// @ManagerAuth(memo = "浣滀笟淇℃伅")
+ public R rgvCircularShuttle(){
+ List<RgvCircularShuttleParam> result = new ArrayList<>();
+ List<BasCircularShuttle> basCircularShuttleList = basCircularShuttleService.selectList(new EntityWrapper<>());
+ for (BasCircularShuttle basCircularShuttle : basCircularShuttleList){
+ RgvCircularShuttleParam rgvCircularShuttleParam = new RgvCircularShuttleParam(basCircularShuttle);
+ if (!Cools.isEmpty(rgvCircularShuttleParam.getRgvNo())){
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvCircularShuttleParam.getRgvNo());
+ if (rgvThread != null) {
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol != null) {
+ rgvCircularShuttleParam.setPosition(rgvProtocol.getRgvPos());
+ if (rgvCircularShuttleParam.getStatus()==0){
+ rgvCircularShuttleParam.setStatus$(rgvProtocol.statusType.desc);
+ }
+ }
+ }
+ }
+ result.add(rgvCircularShuttleParam);
+ }
+ return R.ok().add(result);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.1