From e9a4418c14ef68fb454300b092c413e8df259ec2 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期六, 13 四月 2024 11:50:56 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java |   45 ++++++++++++++++++---------------------------
 1 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java
index cfca0db..3f70cf7 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java
@@ -10,12 +10,14 @@
 import com.zy.asrs.wcs.common.domain.BaseParam;
 import com.zy.asrs.wcs.common.domain.KeyValVo;
 import com.zy.asrs.wcs.common.domain.PageParam;
+import com.zy.asrs.wcs.core.domain.param.ShuttleMoveLocParam;
 import com.zy.asrs.wcs.core.domain.param.ShuttleOperatorParam;
 import com.zy.asrs.wcs.core.entity.BasShuttle;
 import com.zy.asrs.wcs.core.entity.Motion;
 import com.zy.asrs.wcs.core.entity.Task;
 import com.zy.asrs.wcs.core.entity.TaskCtg;
 import com.zy.asrs.wcs.core.kernel.AnalyzeService;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.model.enums.TaskStsType;
 import com.zy.asrs.wcs.core.service.BasShuttleService;
 import com.zy.asrs.wcs.core.service.MotionService;
@@ -29,7 +31,6 @@
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
 import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
 import com.zy.asrs.wcs.rcs.service.DeviceService;
-import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
 import com.zy.asrs.wcs.system.controller.BaseController;
 import com.zy.asrs.wcs.utils.ExcelUtil;
@@ -59,8 +60,6 @@
     private MotionService motionService;
     @Autowired
     private DeviceService deviceService;
-    @Autowired
-    private DeviceTypeService deviceTypeService;
 
     @PreAuthorize("hasAuthority('core:basShuttle:list')")
     @PostMapping("/basShuttle/page")
@@ -151,11 +150,16 @@
             return R.error();
         }
 
+        String sourceLoc = null;//婧愬簱浣�
         String targetLoc = null;//浠诲姟鐩爣(鍊熺敤瀛楁)
         String targetSite = param.getShuttleTaskMode();//浠诲姟绫诲瀷(鍊熺敤瀛楁)
         if (param.getShuttleTaskMode().equals("moveLoc")) {
             //杩佺Щ浠诲姟
             targetLoc = param.getTargetLocNo();
+        } else if (param.getShuttleTaskMode().equals("takeMove")) {
+            //鍙栨斁璐т换鍔�
+            targetLoc = param.getTargetLocNo();
+            sourceLoc = param.getSourceLocNo();
         }
 
         Task task = new Task();
@@ -165,7 +169,7 @@
         task.setTaskCtg(taskCtg.getId());
         task.setPriority(10);
         task.setOriginSite(null);
-        task.setOriginLoc(null);
+        task.setOriginLoc(sourceLoc);
         task.setDestSite(targetSite);
         task.setDestLoc(targetLoc);
         task.setIoTime(new Date());
@@ -200,25 +204,12 @@
     @PreAuthorize("hasAuthority('core:basShuttle:operator')")
     @PostMapping("/basShuttle/moveLoc")
     @Transactional
-    public synchronized R shuttleMoveLoc(@RequestParam Integer shuttleNo,
-                            @RequestParam Integer moveType,
-                            @RequestParam Integer xStart,
-                            @RequestParam Integer xTarget,
-                            @RequestParam Integer yStart,
-                            @RequestParam Integer yTarget) {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getHostId, getHostId()));
-        if (deviceType == null) {
-            return R.error();
-        }
-
+    public synchronized R shuttleMoveLoc(@RequestBody ShuttleMoveLocParam param) {
         Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getStatus, 1)
                 .eq(Device::getHostId, getHostId())
-                .eq(Device::getDeviceNo, shuttleNo));
+                .eq(Device::getDeviceNo, param.getShuttleNo()));
         if (device == null) {
             return R.error();
         }
@@ -238,13 +229,13 @@
         }
 
         shuttleProtocol.setMoveLoc(true);//寮�鍚窇搴�
-        shuttleProtocol.setMoveType(moveType);
-        shuttleProtocol.setXStart(xStart);
-        shuttleProtocol.setXTarget(xTarget);
-        shuttleProtocol.setXCurrent(xStart);
-        shuttleProtocol.setYStart(yStart);
-        shuttleProtocol.setYTarget(yTarget);
-        shuttleProtocol.setYCurrent(yStart);
+        shuttleProtocol.setMoveType(param.getMoveType());
+        shuttleProtocol.setXStart(param.getStartX());
+        shuttleProtocol.setXTarget(param.getTargetX());
+        shuttleProtocol.setXCurrent(param.getStartX());
+        shuttleProtocol.setYStart(param.getStartY());
+        shuttleProtocol.setYTarget(param.getTargetY());
+        shuttleProtocol.setYCurrent(param.getStartY());
         return R.ok();
     }
 

--
Gitblit v1.9.1