From f84448a10d99a0fa82e71088051e3517637edaa7 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 09 四月 2024 15:11:52 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/param/ShuttleMoveLocParam.java |   20 ++++++++++++++++++++
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java                |    6 +++---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java  |   24 ++++++++++--------------
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java             |    9 +++++++--
 4 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
index 6f55847..515b53e 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -217,8 +217,13 @@
             return;
         }
 
-        //灏忚溅绌洪棽涓旀湁璺戝簱绋嬪簭
-        if (!(shuttleThread.isIdle() && shuttleProtocol.getMoveLoc())) {
+        //灏忚溅寮�鍚窇搴撴ā寮�
+        if (!shuttleProtocol.getMoveLoc()) {
+            return;
+        }
+
+        //灏忚溅绌洪棽
+        if (!shuttleThread.isIdle()) {
             return;
         }
 
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..905f5ec 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,6 +10,7 @@
 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;
@@ -200,12 +201,7 @@
     @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) {
+    public synchronized R shuttleMoveLoc(@RequestBody ShuttleMoveLocParam param) {
         DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
                 .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
                 .eq(DeviceType::getStatus, 1)
@@ -218,7 +214,7 @@
                 .eq(Device::getDeviceType, deviceType.getId())
                 .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 +234,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();
     }
 
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/param/ShuttleMoveLocParam.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/param/ShuttleMoveLocParam.java
new file mode 100644
index 0000000..0da8cf2
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/param/ShuttleMoveLocParam.java
@@ -0,0 +1,20 @@
+package com.zy.asrs.wcs.core.domain.param;
+
+import lombok.Data;
+
+@Data
+public class ShuttleMoveLocParam {
+
+    private Integer shuttleNo;
+
+    private Integer moveType;
+
+    private Integer startX;
+
+    private Integer targetX;
+
+    private Integer startY;
+
+    private Integer targetY;
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
index c127569..f464165 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
@@ -48,6 +48,9 @@
                 .eq(Device::getStatus, 1)
                 .eq(Device::getDeviceType, deviceType.getId()));
         for (Device device : list) {
+            //灏忚溅绌洪棽涓旀湁璺戝簱绋嬪簭
+            shuttleAction.moveLoc(device);
+
             Object object = redisUtil.get(DeviceRedisConstant.SHUTTLE_FLAG + device.getDeviceNo());
             if (object == null) {
                 continue;
@@ -58,9 +61,6 @@
                 //瀛樺湪浠诲姟闇�瑕佹墽琛�
                 boolean result = shuttleAction.executeWork(device, taskNo);
             }
-
-            //灏忚溅绌洪棽涓旀湁璺戝簱绋嬪簭
-            shuttleAction.moveLoc(device);
         }
     }
 

--
Gitblit v1.9.1