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/RgvController.java | 138 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 116 insertions(+), 22 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/RgvController.java b/src/main/java/com/zy/asrs/controller/RgvController.java
index e85e4de..86f0f0f 100644
--- a/src/main/java/com/zy/asrs/controller/RgvController.java
+++ b/src/main/java/com/zy/asrs/controller/RgvController.java
@@ -75,24 +75,44 @@
return R.ok().add(res);
}
+ @PostMapping("/run/del")//Take Put Walk
+ @ManagerAuth(memo = "娓呯┖浠诲姟")
+ public R rgvRunDel(@RequestParam(defaultValue = "0") Integer rgvNo
+ ) {
+ if (rgvNo==null || rgvNo==0){
+ return R.error("璇烽�夋嫨灏忚溅");
+ }
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo);
+ TaskProtocolCache taskProtocolCache = rgvThread.getTaskProtocolCache();
+
+ try {
+ ConcurrentHashMap<String, TaskProtocol> allTaskProtocol = taskProtocolCache.getAllTaskProtocol();
+ for (TaskProtocol taskProtocol : allTaskProtocol.values()){
+ taskProtocolCache.removeTaskProtocol(taskProtocol.getTaskNoDirection());
+ }
+
+ } catch (Exception e) {
+ return R.error("浠诲姟鍒犻櫎澶辫触"+e.getMessage());
+ }
+
+ return R.ok("浠诲姟娓呯┖鎴愬姛");
+ }
+
@PostMapping("/run/walk")//Take Put Walk
@ManagerAuth(memo = "灏忚溅琛岃蛋")
public R rgvRunWalk(@RequestParam(defaultValue = "0") Integer rgvNo,
- @RequestParam(defaultValue = "0") Integer taskNo,
- @RequestParam(defaultValue = "0") Integer rgvStaNo,
+ @RequestParam(defaultValue = "9999") Integer taskNo,
+ @RequestParam(defaultValue = "0") Integer rgvStaNoPut,
@RequestParam(defaultValue = "0") Long rgvPosDestination
) {
if (rgvNo==null || rgvNo==0){
return R.error("璇烽�夋嫨灏忚溅");
}
- if (taskNo==null || taskNo==0){
- return R.error("浣滀笟鍙疯濉啓");
- }
- if ((rgvStaNo == null || rgvStaNo == 0) && (rgvPosDestination==null || rgvPosDestination==0L)){
+ if ((rgvStaNoPut == null || rgvStaNoPut == 0) && (rgvPosDestination==null || rgvPosDestination==0L)){
return R.error("鐩爣绔欑偣璇峰~鍐�");
}
if (rgvPosDestination == null || rgvPosDestination == 0){
- BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNo));
+ BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut));
rgvPosDestination = basDevpPosition.getPlcPosition();
}
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo);
@@ -126,17 +146,14 @@
@PostMapping("/run/put")//Take Put Walk
@ManagerAuth(memo = "灏忚溅鏀捐揣")
public R rgvPutWalk(@RequestParam(defaultValue = "0") Integer rgvNo,
- @RequestParam(defaultValue = "0") Integer taskNo,
- @RequestParam(defaultValue = "0") Integer rgvStaNo,
+ @RequestParam(defaultValue = "9999") Integer taskNo,
+ @RequestParam(defaultValue = "0") Integer rgvStaNoPut,
@RequestParam(defaultValue = "0") Long rgvPosDestination
) {
if (rgvNo==null || rgvNo==0){
return R.error("璇烽�夋嫨灏忚溅");
}
- if (taskNo==null || taskNo==0){
- return R.error("浣滀笟鍙疯濉啓");
- }
- if (rgvStaNo == null || rgvStaNo == 0){
+ if (rgvStaNoPut == null || rgvStaNoPut == 0){
return R.error("鐩爣绔欑偣璇峰~鍐�");
}
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo);
@@ -150,10 +167,12 @@
return R.error("瀛樺湪鎵ц涓换鍔★紝璇峰厛澶勭悊锛侊紒锛�");
}
- BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNo));
+ BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut));
//鎵ц
issuedPut.setTaskNo(Long.valueOf(taskNo));
issuedPut.setTaskStatus(3);
+ issuedPut.setTargetPositionStaNo(basDevpPosition.getDevNo());
+ issuedPut.setTargetPositionStaNoPlcId(basDevpPosition.getPlcId());
issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus()));
issuedPut.setTargetPosition(basDevpPosition.getPlcPosition());
issuedPut.setIsRunning(1);
@@ -170,18 +189,15 @@
@PostMapping("/run/take")//Take Put Walk
@ManagerAuth(memo = "灏忚溅鍙栬揣")
public R rgvTakeWalk(@RequestParam(defaultValue = "0") Integer rgvNo,
- @RequestParam(defaultValue = "0") Integer taskNo,
- @RequestParam(defaultValue = "0") Integer rgvStaNo,
+ @RequestParam(defaultValue = "9999") Integer taskNo,
+ @RequestParam(defaultValue = "0") Integer rgvStaNoTake,
@RequestParam(defaultValue = "0") Long rgvPosDestination
) {
if (rgvNo==null || rgvNo==0){
return R.error("璇烽�夋嫨灏忚溅");
}
- if (taskNo==null || taskNo==0){
- return R.error("浣滀笟鍙疯濉啓");
- }
- if (rgvStaNo == null || rgvStaNo == 0){
- return R.error("鐩爣绔欑偣璇峰~鍐�");
+ if (rgvStaNoTake == null || rgvStaNoTake == 0){
+ return R.error("鍙栬揣绔欑偣璇峰~鍐�");
}
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo);
TaskProtocolCache taskProtocolCache = rgvThread.getTaskProtocolCache();
@@ -193,7 +209,7 @@
return R.error("瀛樺湪鎵ц涓换鍔★紝璇峰厛澶勭悊锛侊紒锛�");
}
- BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNo));
+ BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake));
//鎵ц
issuedTake.setTaskNo(Long.valueOf(taskNo));
issuedTake.setTaskStatus(2);
@@ -209,4 +225,82 @@
return R.ok("浠诲姟鐢熸垚鎴愬姛");
}
+
+ @PostMapping("/run/TakeAndPut")//Take Put Walk
+ @ManagerAuth(memo = "灏忚溅鍙栬揣")
+ public R rgvTakeAndPut(@RequestParam(defaultValue = "0") Integer rgvNo,
+ @RequestParam(defaultValue = "9999") Integer taskNo,
+ @RequestParam(defaultValue = "0") Integer rgvStaNoTake,
+ @RequestParam(defaultValue = "0") Integer rgvStaNoPut,
+ @RequestParam(defaultValue = "0") Long rgvPosDestination
+ ) {
+ if (rgvNo==null || rgvNo==0){
+ return R.error("璇烽�夋嫨灏忚溅");
+ }
+ if (rgvStaNoTake == null || rgvStaNoTake == 0){
+ return R.error("鍙栬揣绔欑偣璇峰~鍐�");
+ }
+ if (rgvStaNoPut == null || rgvStaNoPut == 0){
+ return R.error("鏀捐揣绔欑偣璇峰~鍐�");
+ }
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo);
+ TaskProtocolCache taskProtocolCache = rgvThread.getTaskProtocolCache();
+
+ TaskProtocol issuedTake = new TaskProtocol();
+ TaskProtocol issuedPut = new TaskProtocol();
+ try {
+ ConcurrentHashMap<String, TaskProtocol> allTaskProtocol = taskProtocolCache.getAllTaskProtocol();
+ if (allTaskProtocol.size() > 0) {
+ return R.error("瀛樺湪鎵ц涓换鍔★紝璇峰厛澶勭悊锛侊紒锛�");
+ }
+
+ BasDevpPosition basDevpPositionTake = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake));
+ //鎵ц
+ issuedTake.setTaskNo(Long.valueOf(taskNo));
+ issuedTake.setTaskStatus(2);
+ issuedTake.setTargetPositionStaNo(basDevpPositionTake.getDevNo());
+ issuedTake.setTargetPositionStaNoPlcId(basDevpPositionTake.getPlcId());
+ issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus()));
+ issuedTake.setTargetPosition(basDevpPositionTake.getPlcPosition());
+ issuedTake.setIsRunning(1);
+ issuedTake.setDirection(basDevpPositionTake.getRgvSign()==1);
+
+ BasDevpPosition basDevpPositionPut = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut));
+ //鎵ц
+ issuedPut.setTaskNo(Long.valueOf(taskNo));
+ issuedPut.setTaskStatus(3);
+ issuedPut.setTargetPositionStaNo(basDevpPositionPut.getDevNo());
+ issuedPut.setTargetPositionStaNoPlcId(basDevpPositionPut.getPlcId());
+ issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus()));
+ issuedPut.setTargetPosition(basDevpPositionPut.getPlcPosition());
+ issuedPut.setIsRunning(1);
+ issuedPut.setDirection(basDevpPositionPut.getRgvSign()==1);
+
+ taskProtocolCache.updateTaskProtocol(issuedTake);
+ taskProtocolCache.updateTaskProtocol(issuedPut);
+
+ } catch (Exception e) {
+ return R.error("浠诲姟鐢熸垚澶辫触"+e.getMessage());
+ }
+
+ return R.ok("浠诲姟鐢熸垚鎴愬姛");
+ }
+
+ @PostMapping("/run/delRgvTask")//Take Put Walk
+ @ManagerAuth(memo = "灏忚溅鍙栬揣")
+ public R rgvDelRgvTask(@RequestParam(defaultValue = "0") Integer rgvNo
+ ) {
+ if (rgvNo==null || rgvNo==0){
+ return R.error("璇烽�夋嫨灏忚溅");
+ }
+
+ try {
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo);
+ rgvThread.setDelRgvTask();
+ } catch (Exception e) {
+ return R.error("浠诲姟鐢熸垚澶辫触"+e.getMessage());
+ }
+
+ return R.ok("浠诲姟鐢熸垚鎴愬姛");
+ }
}
--
Gitblit v1.9.1