From 74be59f7ae8fe0a4435dc0b532e9a5ba32ab56de Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 11 四月 2024 22:13:04 +0800
Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionCtg.java                     |    7 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/MapNode.java                        |   13 ++
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java         |   60 ++++++---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java                |   38 +----
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/ShuttleServiceImpl.java       |   13 -
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java       |    6 
 zy-asrs-wcs/src/main/resources/application.yml                                           |    4 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java          |   15 --
 /dev/null                                                                                |    5 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java                    |   27 ----
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java        |   16 ++
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/DeviceTypeService.java             |    2 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/DeviceCtgType.java            |    8 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java      |   14 --
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java                          |   13 -
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/LiftController.java             |   24 ---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/DeviceTypeServiceImpl.java    |    6 +
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java                 |   21 ++-
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java              |   17 --
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/ExecuteSupport.java                     |    7 +
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java                        |   11 +
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java |   10 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java                  |    5 
 23 files changed, 146 insertions(+), 196 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/ExecuteSupport.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/ExecuteSupport.java
new file mode 100644
index 0000000..f816e72
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/ExecuteSupport.java
@@ -0,0 +1,7 @@
+package com.zy.asrs.wcs.common;
+
+public interface ExecuteSupport {
+
+    Boolean judgement();
+
+}
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 515b53e..f3e2a32 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
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.zy.asrs.wcs.common.ExecuteSupport;
 import com.zy.asrs.wcs.core.entity.BasShuttle;
 import com.zy.asrs.wcs.core.entity.Loc;
 import com.zy.asrs.wcs.core.entity.Task;
@@ -11,6 +12,7 @@
 import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
 import com.zy.asrs.wcs.core.model.command.ShuttleRedisCommand;
 import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
+import com.zy.asrs.wcs.core.model.enums.ShuttleTaskModeType;
 import com.zy.asrs.wcs.core.service.BasShuttleService;
 import com.zy.asrs.wcs.core.service.LocService;
 import com.zy.asrs.wcs.core.utils.NavigateMapUtils;
@@ -64,12 +66,17 @@
         redisCommand.setAssignCommand(assignCommand);//鍛戒护
         //浠诲姟鏁版嵁淇濆瓨鍒皉edis
         if (redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand))) {
-            //涓嬪彂琛岄┒璺緞
-            boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getTaskNo().intValue());
-            if (!result) {
-                return false;
+            if (assignCommand.getTaskMode() == ShuttleTaskModeType.PAK_IN.id
+                    || assignCommand.getTaskMode() == ShuttleTaskModeType.PAK_OUT.id
+                    || assignCommand.getTaskMode() == ShuttleTaskModeType.MOVE_LOC_NO.id
+                    || assignCommand.getTaskMode() == ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO.id) {
+                //涓嬪彂琛岄┒璺緞
+                boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getTaskNo());
+                if (!result) {
+                    return false;
+                }
             }
-            shuttleProtocol.setTaskNo(assignCommand.getTaskNo().intValue());
+            shuttleProtocol.setTaskNo(assignCommand.getTaskNo());
             return true;
         }
         return false;
@@ -96,7 +103,9 @@
         }
 
         //鍒ゆ柇璁惧鏄惁绌洪棽
-        if (!shuttleThread.isIdle()) {
+        if (!shuttleThread.isIdle(() -> {
+            return shuttleProtocol.getTaskNo().equals(taskNo);
+        })) {
             return false;
         }
 
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 905f5ec..0d519de 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
@@ -17,6 +17,7 @@
 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;
@@ -30,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;
@@ -60,8 +60,6 @@
     private MotionService motionService;
     @Autowired
     private DeviceService deviceService;
-    @Autowired
-    private DeviceTypeService deviceTypeService;
 
     @PreAuthorize("hasAuthority('core:basShuttle:list')")
     @PostMapping("/basShuttle/page")
@@ -202,16 +200,8 @@
     @PostMapping("/basShuttle/moveLoc")
     @Transactional
     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)
-                .eq(DeviceType::getHostId, getHostId()));
-        if (deviceType == null) {
-            return R.error();
-        }
-
         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, param.getShuttleNo()));
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/DeviceCtgController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/DeviceCtgController.java
deleted file mode 100644
index 68f6bf2..0000000
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/DeviceCtgController.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.zy.asrs.wcs.core.controller;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zy.asrs.framework.common.Cools;
-import com.zy.asrs.framework.common.R;
-import com.zy.asrs.wcs.common.annotation.OperationLog;
-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.entity.DeviceCtg;
-import com.zy.asrs.wcs.core.service.DeviceCtgService;
-import com.zy.asrs.wcs.system.controller.BaseController;
-import com.zy.asrs.wcs.utils.ExcelUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-@RestController
-@RequestMapping("/api")
-public class DeviceCtgController extends BaseController {
-
-    @Autowired
-    private DeviceCtgService deviceCtgService;
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:list')")
-    @PostMapping("/deviceCtg/page")
-    public R page(@RequestBody Map<String, Object> map) {
-        BaseParam baseParam = buildParam(map, BaseParam.class);
-        PageParam<DeviceCtg, BaseParam> pageParam = new PageParam<>(baseParam, DeviceCtg.class);
-        return R.ok().add(deviceCtgService.page(pageParam, pageParam.buildWrapper(true)));
-    }
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:list')")
-    @PostMapping("/deviceCtg/list")
-    public R list(@RequestBody Map<String, Object> map) {
-        return R.ok().add(deviceCtgService.list());
-    }
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:list')")
-    @GetMapping("/deviceCtg/{id}")
-    public R get(@PathVariable("id") Long id) {
-        return R.ok().add(deviceCtgService.getById(id));
-    }
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:save')")
-    @OperationLog("娣诲姞Motion璁惧绫诲瀷")
-    @PostMapping("/deviceCtg/save")
-    public R save(@RequestBody DeviceCtg deviceCtg) {
-        if (!deviceCtgService.save(deviceCtg)) {
-            return R.error("娣诲姞澶辫触");
-        }
-        return R.ok("娣诲姞鎴愬姛");
-    }
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:update')")
-    @OperationLog("淇敼Motion璁惧绫诲瀷")
-    @PostMapping("/deviceCtg/update")
-    public R update(@RequestBody DeviceCtg deviceCtg) {
-        if (!deviceCtgService.updateById(deviceCtg)) {
-            return R.error("淇敼澶辫触");
-        }
-        return R.ok("淇敼鎴愬姛");
-    }
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:remove')")
-    @OperationLog("鍒犻櫎Motion璁惧绫诲瀷")
-    @PostMapping("/deviceCtg/remove/{ids}")
-    public R remove(@PathVariable Long[] ids) {
-        if (!deviceCtgService.removeByIds(Arrays.asList(ids))) {
-            return R.error("鍒犻櫎澶辫触");
-        }
-        return R.ok("鍒犻櫎鎴愬姛");
-    }
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:list')")
-    @PostMapping("/deviceCtg/query")
-    public R query(@RequestParam(required = false) String condition) {
-        List<KeyValVo> vos = new ArrayList<>();
-        LambdaQueryWrapper<DeviceCtg> wrapper = new LambdaQueryWrapper<>();
-        if (!Cools.isEmpty(condition)) {
-            wrapper.like(DeviceCtg::getName, condition);
-        }
-        deviceCtgService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
-                item -> vos.add(new KeyValVo(item.getId(), item.getName()))
-        );
-        return R.ok().add(vos);
-    }
-
-    @PreAuthorize("hasAuthority('core:deviceCtg:list')")
-    @PostMapping("/deviceCtg/export")
-    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
-        ExcelUtil.build(ExcelUtil.create(deviceCtgService.list(), DeviceCtg.class), response);
-    }
-
-}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/DeviceCtg.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/DeviceCtg.java
deleted file mode 100644
index 1e8d20e..0000000
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/DeviceCtg.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package com.zy.asrs.wcs.core.entity;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import com.zy.asrs.wcs.system.entity.Host;
-import com.zy.asrs.wcs.system.entity.User;
-import org.springframework.format.annotation.DateTimeFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import com.zy.asrs.framework.common.Cools;
-import com.zy.asrs.framework.common.SpringUtils;
-import com.zy.asrs.wcs.system.service.UserService;
-import com.zy.asrs.wcs.system.service.HostService;
-
-import java.io.Serializable;
-import java.util.Date;
-
-@Data
-@TableName("rcs_device_ctg")
-public class DeviceCtg implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * ID
-     */
-    @ApiModelProperty(value= "ID")
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 缂栧彿
-     */
-    @ApiModelProperty(value= "缂栧彿")
-    private String uuid;
-
-    /**
-     * 鍚嶇О
-     */
-    @ApiModelProperty(value= "鍚嶇О")
-    private String name;
-
-    /**
-     * 鏍囪瘑
-     */
-    @ApiModelProperty(value= "鏍囪瘑")
-    private String flag;
-
-    /**
-     * 鐘舵�� 1: 姝e父  0: 绂佺敤  
-     */
-    @ApiModelProperty(value= "鐘舵�� 1: 姝e父  0: 绂佺敤  ")
-    private Integer status;
-
-    /**
-     * 娣诲姞浜哄憳
-     */
-    @ApiModelProperty(value= "娣诲姞浜哄憳")
-    private Long createBy;
-
-    /**
-     * 娣诲姞鏃堕棿
-     */
-    @ApiModelProperty(value= "娣诲姞鏃堕棿")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    /**
-     * 淇敼浜哄憳
-     */
-    @ApiModelProperty(value= "淇敼浜哄憳")
-    private Long updateBy;
-
-    /**
-     * 淇敼鏃堕棿
-     */
-    @ApiModelProperty(value= "淇敼鏃堕棿")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-    private Date updateTime;
-
-    /**
-     * 澶囨敞
-     */
-    @ApiModelProperty(value= "澶囨敞")
-    private String memo;
-
-    /**
-     * 鏄惁鍒犻櫎 1: 鏄�  0: 鍚�  
-     */
-    @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄�  0: 鍚�  ")
-    @TableLogic
-    private Integer deleted;
-
-    /**
-     * 鎵�灞炴満鏋�
-     */
-    @ApiModelProperty(value= "鎵�灞炴満鏋�")
-    private Long hostId;
-
-    public DeviceCtg() {}
-
-    public DeviceCtg(String uuid,String name,String flag,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) {
-        this.uuid = uuid;
-        this.name = name;
-        this.flag = flag;
-        this.status = status;
-        this.createBy = createBy;
-        this.createTime = createTime;
-        this.updateBy = updateBy;
-        this.updateTime = updateTime;
-        this.memo = memo;
-        this.deleted = deleted;
-        this.hostId = hostId;
-    }
-
-//    DeviceCtg deviceCtg = new DeviceCtg(
-//            null,    // 缂栧彿
-//            null,    // 鍚嶇О[闈炵┖]
-//            null,    // 鏍囪瘑
-//            null,    // 鐘舵��
-//            null,    // 娣诲姞浜哄憳
-//            null,    // 娣诲姞鏃堕棿
-//            null,    // 淇敼浜哄憳
-//            null,    // 淇敼鏃堕棿
-//            null,    // 澶囨敞
-//            null,    // 鏄惁鍒犻櫎
-//            null    // 鎵�灞炴満鏋�
-//    );
-
-    public String getStatus$(){
-        if (null == this.status){ return null; }
-        switch (this.status){
-            case 1:
-                return "姝e父";
-            case 0:
-                return "绂佺敤";
-            default:
-                return String.valueOf(this.status);
-        }
-    }
-
-    public String getCreateBy$(){
-        UserService service = SpringUtils.getBean(UserService.class);
-        User user = service.getById(this.createBy);
-        if (!Cools.isEmpty(user)){
-            return String.valueOf(user.getNickname());
-        }
-        return null;
-    }
-
-    public String getCreateTime$(){
-        if (Cools.isEmpty(this.createTime)){
-            return "";
-        }
-        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
-    }
-
-    public String getUpdateBy$(){
-        UserService service = SpringUtils.getBean(UserService.class);
-        User user = service.getById(this.updateBy);
-        if (!Cools.isEmpty(user)){
-            return String.valueOf(user.getNickname());
-        }
-        return null;
-    }
-
-    public String getUpdateTime$(){
-        if (Cools.isEmpty(this.updateTime)){
-            return "";
-        }
-        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
-    }
-
-    public String getDeleted$(){
-        if (null == this.deleted){ return null; }
-        switch (this.deleted){
-            case 1:
-                return "鏄�";
-            case 0:
-                return "鍚�";
-            default:
-                return String.valueOf(this.deleted);
-        }
-    }
-
-    public String getHostId$(){
-        HostService service = SpringUtils.getBean(HostService.class);
-        Host host = service.getById(this.hostId);
-        if (!Cools.isEmpty(host)){
-            return String.valueOf(host.getName());
-        }
-        return null;
-    }
-
-
-}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java
index 4d64132..4268ff1 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java
@@ -5,9 +5,10 @@
 
 import com.zy.asrs.wcs.core.BuildSupport;
 import com.zy.asrs.wcs.core.model.enums.MotionStsType;
-import com.zy.asrs.wcs.core.service.DeviceCtgService;
 import com.zy.asrs.wcs.core.service.MotionCtgService;
 import com.zy.asrs.wcs.core.service.MotionStsService;
+import com.zy.asrs.wcs.rcs.entity.DeviceType;
+import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 import com.zy.asrs.wcs.system.entity.Host;
 import com.zy.asrs.wcs.system.entity.User;
 import org.springframework.format.annotation.DateTimeFormat;
@@ -343,8 +344,8 @@
     }
 
     public String getDeviceType$(){
-        DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class);
-        DeviceCtg deviceCtg = service.getById(this.deviceCtg);
+        DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class);
+        DeviceType deviceCtg = service.getById(this.deviceCtg);
         if (!Cools.isEmpty(deviceCtg)){
             return String.valueOf(deviceCtg.getName());
         }
@@ -458,8 +459,8 @@
     }
 
     public String getDeviceCtgEl(){
-        DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class);
-        DeviceCtg entity = service.getById(this.deviceCtg);
+        DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class);
+        DeviceType entity = service.getById(this.deviceCtg);
         if (!Cools.isEmpty(entity)){
             return String.valueOf(entity.getFlag());
         }
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionCtg.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionCtg.java
index 9262b7e..cd638f7 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionCtg.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionCtg.java
@@ -3,8 +3,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
-import com.zy.asrs.wcs.core.entity.DeviceCtg;
-import com.zy.asrs.wcs.core.service.DeviceCtgService;
+import com.zy.asrs.wcs.rcs.entity.DeviceType;
 import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 import com.zy.asrs.wcs.system.entity.Host;
 import com.zy.asrs.wcs.system.entity.User;
@@ -149,8 +148,8 @@
 //    );
 
     public String getDeviceCtg$(){
-        DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class);
-        DeviceCtg deviceCtg = service.getById(this.deviceCtg);
+        DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class);
+        DeviceType deviceCtg = service.getById(this.deviceCtg);
         if (!Cools.isEmpty(deviceCtg)){
             return String.valueOf(deviceCtg.getId());
         }
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
index 9e0b818..68d7a94 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -15,12 +15,10 @@
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.core.entity.Motion;
 import com.zy.asrs.wcs.rcs.entity.Device;
-import com.zy.asrs.wcs.rcs.entity.DeviceType;
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
 import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
 import com.zy.asrs.wcs.core.service.MotionService;
 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 org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -46,12 +44,10 @@
     private ShuttleDispatcher shuttleDispatcher;
     @Autowired
     private LiftDispatcher liftDispatcher;
-    //    @Autowired
+//    @Autowired
 //    private ConveyorDispatcher conveyorDispatcher;
     @Autowired
     private DeviceService deviceService;
-    @Autowired
-    private DeviceTypeService deviceTypeService;
 
     public List<Motion> generateMotion(Task task) {
         List<Motion> motionList = new ArrayList<>();
@@ -934,17 +930,9 @@
         // locNo
         String locNo = task.getDestLoc();
 
-        //鑾峰彇绌挎杞︾被鍨�
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
-                .eq(DeviceType::getStatus, 1));
-        if (deviceType == null) {
-            return motionList;
-        }
-
         Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
                 .eq(Device::getDeviceNo, task.getShuttleNo())
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getHostId, task.getHostId())
                 .eq(Device::getStatus, 1));
         if (device == null) {
@@ -995,17 +983,9 @@
         String targetLoc = task.getDestLoc();//浠诲姟鐩爣(鍊熺敤瀛楁)
         String targetSite = task.getDestSite();//浠诲姟绫诲瀷(鍊熺敤瀛楁)
 
-        //鑾峰彇绌挎杞︾被鍨�
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
-                .eq(DeviceType::getStatus, 1));
-        if (deviceType == null) {
-            return motionList;
-        }
-
         Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
                 .eq(Device::getDeviceNo, task.getShuttleNo())
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getHostId, task.getHostId())
                 .eq(Device::getStatus, 1));
         if (device == null) {
@@ -1031,11 +1011,11 @@
                 // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
                 motionList.addAll(kernelService.shuttleMove(
                         MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
+                            dto.setShuttleNo(device.getId().intValue());
                             dto.setLocNo(shuttleLocNo);
                         })),
                         MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
+                            dto.setShuttleNo(device.getId().intValue());
                             dto.setLocNo(targetLoc);
                         })),
                         MotionCtgType.SHUTTLE_MOVE
@@ -1046,28 +1026,28 @@
             //鎵樼洏椤跺崌
             motionList.add(Motion.build(motion -> {
                 motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
-                motion.setDevice(String.valueOf(task.getShuttleNo()));
+                motion.setDevice(String.valueOf(device.getId()));
                 motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val());
             }));
         } else if (targetSite.equals("palletDown")) {
             //鎵樼洏涓嬮檷
             motionList.add(Motion.build(motion -> {
                 motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
-                motion.setDevice(String.valueOf(task.getShuttleNo()));
+                motion.setDevice(String.valueOf(device.getId()));
                 motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val());
             }));
         } else if (targetSite.equals("chargeOpen")) {
             //鍏呯數寮�
             motionList.add(Motion.build(motion -> {
                 motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
-                motion.setDevice(String.valueOf(task.getShuttleNo()));
+                motion.setDevice(String.valueOf(device.getId()));
                 motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_ON.val());
             }));
         } else if (targetSite.equals("chargeClose")) {
             //鍏呯數鍏�
             motionList.add(Motion.build(motion -> {
                 motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
-                motion.setDevice(String.valueOf(task.getShuttleNo()));
+                motion.setDevice(String.valueOf(device.getId()));
                 motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_OFF.val());
             }));
         } else if (targetSite.equals("reset")) {
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
index 1ef90fd..122398a 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -258,11 +258,11 @@
             return true;
         }
 
-        if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.WAITING)
-            && !shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.CHARGING_WAITING)
-        ) {
-            return false;
-        }
+//        if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.WAITING)
+//            && !shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.CHARGING_WAITING)
+//        ) {
+//            return false;
+//        }
 
         //鍒ゆ柇璁惧鏄惁绌洪棽
         if (!shuttleThread.isIdle()) {
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/DeviceCtgMapper.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/DeviceCtgMapper.java
deleted file mode 100644
index 9589adf..0000000
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/DeviceCtgMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.asrs.wcs.core.mapper;
-
-import com.zy.asrs.wcs.core.entity.DeviceCtg;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface DeviceCtgMapper extends BaseMapper<DeviceCtg> {
-
-}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/MapNode.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/MapNode.java
index 3219680..8e5c8cb 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/MapNode.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/MapNode.java
@@ -1,12 +1,13 @@
 package com.zy.asrs.wcs.core.model;
 
+import com.zy.asrs.wcs.rcs.model.protocol.StaProtocol;
 import lombok.Data;
 
 /**
  * 鍦板浘鏁版嵁鑺傜偣
  */
 @Data
-public class MapNode {
+public class MapNode implements Cloneable {
 
     /**
      * -1 绂佺敤
@@ -36,4 +37,14 @@
 
     private Integer bay;
 
+    @Override
+    public MapNode clone() {
+        try {
+            return (MapNode) super.clone();
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
 }
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/DeviceCtgType.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/DeviceCtgType.java
index 2542faa..c020d7a 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/DeviceCtgType.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/DeviceCtgType.java
@@ -2,8 +2,8 @@
 
 import com.zy.asrs.framework.common.SpringUtils;
 import com.zy.asrs.framework.exception.CoolException;
-import com.zy.asrs.wcs.core.entity.DeviceCtg;
-import com.zy.asrs.wcs.core.service.DeviceCtgService;
+import com.zy.asrs.wcs.rcs.entity.DeviceType;
+import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 
 public enum DeviceCtgType {
 
@@ -18,8 +18,8 @@
     }
 
     public long val() {
-        DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class);
-        DeviceCtg entity = service.selectByFlag(this.toString());
+        DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class);
+        DeviceType entity = service.selectByFlag(this.toString());
         if (entity == null) {
             throw new CoolException("DeviceCtgType Error!");
         }
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/DeviceCtgService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/DeviceCtgService.java
deleted file mode 100644
index c56680c..0000000
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/DeviceCtgService.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.zy.asrs.wcs.core.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zy.asrs.wcs.core.entity.DeviceCtg;
-
-public interface DeviceCtgService extends IService<DeviceCtg> {
-
-    DeviceCtg selectByFlag(String flag);
-
-}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/DeviceCtgServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/DeviceCtgServiceImpl.java
deleted file mode 100644
index 7732610..0000000
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/DeviceCtgServiceImpl.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.zy.asrs.wcs.core.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zy.asrs.wcs.core.mapper.DeviceCtgMapper;
-import com.zy.asrs.wcs.core.entity.DeviceCtg;
-import com.zy.asrs.wcs.core.service.DeviceCtgService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-@Service("deviceCtgService")
-public class DeviceCtgServiceImpl extends ServiceImpl<DeviceCtgMapper, DeviceCtg> implements DeviceCtgService {
-
-    @Override
-    public DeviceCtg selectByFlag(String flag) {
-        return this.getOne(new LambdaQueryWrapper<DeviceCtg>().eq(DeviceCtg::getFlag, flag));
-    }
-
-}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
index 6901e42..74784be 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -20,13 +20,11 @@
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
 import com.zy.asrs.wcs.rcs.entity.Device;
-import com.zy.asrs.wcs.rcs.entity.DeviceType;
 import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
 import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
 import com.zy.asrs.wcs.rcs.model.protocol.StaProtocol;
 import com.zy.asrs.wcs.rcs.service.DeviceService;
-import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 import com.zy.asrs.wcs.rcs.thread.DevpThread;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
 import com.zy.asrs.wcs.system.entity.Dict;
@@ -55,8 +53,6 @@
     private MotionService motionService;
     @Autowired
     private DeviceService deviceService;
-    @Autowired
-    private DeviceTypeService deviceTypeService;
     @Autowired
     private LocCtgService locCtgService;
     @Autowired
@@ -117,7 +113,7 @@
                     ArrayList<MapNode> nodes = new ArrayList<>();
                     for (JSONObject object : entry.getValue()) {
                         MapNode mapNode = new MapNode();
-                        mapNode.setValue(object.getInteger("value"));
+                        mapNode.setValue(object.getInteger("shelfType"));
                         mapNode.setTop(object.getInteger("top"));
                         mapNode.setBottom(object.getInteger("bottom"));
                         mapNode.setLeft(object.getInteger("left"));
@@ -143,6 +139,38 @@
 
             for (Map.Entry<Integer, ArrayList<ArrayList<MapNode>>> entry : levData.entrySet()) {
                 ArrayList<ArrayList<MapNode>> lists = entry.getValue();//鑾峰彇鍦板浘
+
+                MapNode mapNode = new MapNode();
+                mapNode.setValue(-1);
+                mapNode.setTop(1000);
+                mapNode.setBottom(1000);
+                mapNode.setLeft(1000);
+                mapNode.setRight(1000);
+                mapNode.setRow(0);
+                mapNode.setBay(0);
+                mapNode.setNo("0-0");
+
+                //鑾峰彇鏈�闀縭ow
+                int row = 0;
+                //缁欐瘡涓猺ow棣栧熬澧炲姞-1鑺傜偣
+                for (ArrayList<MapNode> list : lists) {
+                    if (list.size() > row) {
+                        row = list.size();
+                    }
+
+                    list.add(0, mapNode.clone());
+                    list.add(mapNode.clone());
+                }
+
+                ArrayList<MapNode> headNodes = new ArrayList<>();
+                ArrayList<MapNode> footerNodes = new ArrayList<>();
+                for (int i = 0; i < row+2; i++) {
+                    headNodes.add(mapNode.clone());
+                    footerNodes.add(mapNode.clone());
+                }
+
+                lists.add(0, headNodes);
+                lists.add(footerNodes);
 
                 Integer lev = entry.getKey();
                 Date now = new Date();
@@ -259,15 +287,8 @@
             return;
         }
 
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
-                .eq(DeviceType::getStatus, 1));
-        if (deviceType == null) {
-            return;
-        }
-
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getStatus, 1));
         for (Device device : list) {
             //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
@@ -282,6 +303,10 @@
             }
 
             if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.IDLE)) {
+                continue;
+            }
+
+            if (!shuttleThread.isRequireCharge()) {
                 continue;
             }
 
@@ -406,15 +431,8 @@
             return;
         }
 
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
-                .eq(DeviceType::getStatus, 1));
-        if (deviceType == null) {
-            return;
-        }
-
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getStatus, 1));
         for (Device device : list) {
             //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
index efef568..70f38b1 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
@@ -5,12 +5,12 @@
 import com.zy.asrs.framework.exception.CoolException;
 import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.model.enums.MotionStsType;
-import com.zy.asrs.wcs.core.service.DeviceCtgService;
 import com.zy.asrs.wcs.core.mapper.MotionMapper;
 import com.zy.asrs.wcs.core.entity.Motion;
 import com.zy.asrs.wcs.core.service.MotionService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zy.asrs.wcs.core.service.MotionStsService;
+import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -21,7 +21,7 @@
 public class MotionServiceImpl extends ServiceImpl<MotionMapper, Motion> implements MotionService {
 
     @Autowired
-    private DeviceCtgService deviceCtgService;
+    private DeviceTypeService deviceTypeService;
     @Autowired
     private MotionStsService motionStsService;
 
@@ -29,7 +29,7 @@
     public List<Motion> selectUnCompleteByUuidAndDeviceCtg(String uuid, DeviceCtgType deviceCtgType) {
         return this.list(new LambdaQueryWrapper<Motion>()
                 .eq(Motion::getUuid, uuid)
-                .eq(Motion::getDeviceCtg, deviceCtgService.selectByFlag(deviceCtgType.toString()).getId())
+                .eq(Motion::getDeviceCtg, deviceTypeService.selectByFlag(deviceCtgType.toString()).getId())
                 .lt(Motion::getMotionSts, motionStsService.selectByFlag(MotionStsType.COMPLETE.toString()).getId())
                 .orderByDesc(Motion::getPriority)
         );
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 f464165..9df4890 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
@@ -3,16 +3,11 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.wcs.core.action.LiftAction;
 import com.zy.asrs.wcs.core.action.ShuttleAction;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.utils.RedisUtil;
-import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
 import com.zy.asrs.wcs.rcs.entity.Device;
-import com.zy.asrs.wcs.rcs.entity.DeviceType;
-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 lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -29,24 +24,15 @@
     @Autowired
     private DeviceService deviceService;
     @Autowired
-    private DeviceTypeService deviceTypeService;
-    @Autowired
     private ShuttleAction shuttleAction;
     @Autowired
     private LiftAction liftAction;
 
     @Scheduled(cron = "0/1 * * * * ? ")
     public synchronized void executeShuttle() {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
-                .eq(DeviceType::getStatus, 1));
-        if (deviceType == null) {
-            return;
-        }
-
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
                 .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId()));
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()));
         for (Device device : list) {
             //灏忚溅绌洪棽涓旀湁璺戝簱绋嬪簭
             shuttleAction.moveLoc(device);
@@ -66,16 +52,9 @@
 
     @Scheduled(cron = "0/1 * * * * ? ")
     public synchronized void executeLift() {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Lift))
-                .eq(DeviceType::getStatus, 1));
-        if (deviceType == null) {
-            return;
-        }
-
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
                 .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId()));
+                .eq(Device::getDeviceType, DeviceCtgType.LIFT.val()));
         for (Device device : list) {
             Object object = redisUtil.get(DeviceRedisConstant.LIFT_FLAG + device.getDeviceNo());
             if (object == null) {
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
index 58d0e4b..0cc5517 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -12,6 +12,7 @@
 import com.zy.asrs.wcs.core.entity.TaskCtg;
 import com.zy.asrs.wcs.core.kernel.AnalyzeService;
 import com.zy.asrs.wcs.core.model.NavigateNode;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.model.enums.LiftCodeType;
 import com.zy.asrs.wcs.core.model.enums.NavigationMapType;
 import com.zy.asrs.wcs.core.model.enums.TaskStsType;
@@ -21,11 +22,9 @@
 import com.zy.asrs.wcs.rcs.News;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
-import com.zy.asrs.wcs.rcs.entity.DeviceType;
 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.core.service.MotionService;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -49,16 +48,12 @@
     private LiftDispatcher liftDispatcher;
     @Autowired
     private SnowflakeIdWorker snowflakeIdWorker;
-//    @Autowired
-//    private CommonService commonService;
     @Autowired
     private AnalyzeService analyzeService;
     @Autowired
     private MotionService motionService;
     @Autowired
     private DeviceService deviceService;
-    @Autowired
-    private DeviceTypeService deviceTypeService;
     @Autowired
     private BasShuttleService basShuttleService;
     @Autowired
@@ -69,16 +64,8 @@
         ShuttleThread resThread = null;
         Integer finalDistance = ShuttleDispatcher.INF;
 
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getHostId, task.getHostId())
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)));
-        if (deviceType == null) {
-            throw new CoolException("璁惧绫诲瀷涓嶅瓨鍦�");
-        }
-
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getHostId, task.getHostId())
                 .eq(Device::getStatus, 1));
 
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java
index 1a3efdc..d308757 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java
@@ -6,15 +6,14 @@
 import com.zy.asrs.framework.exception.CoolException;
 import com.zy.asrs.wcs.core.entity.Task;
 import com.zy.asrs.wcs.core.entity.TaskSerialNo;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.service.TaskSerialNoService;
 import com.zy.asrs.wcs.core.service.TaskService;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
-import com.zy.asrs.wcs.rcs.entity.DeviceType;
 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 java.util.ArrayList;
@@ -110,18 +109,10 @@
     }
 
     public static boolean hasShuttleInLoc(String locNo, Long deviceId) {
-        DeviceTypeService deviceTypeService = SpringUtils.getBean(DeviceTypeService.class);
         DeviceService deviceService = SpringUtils.getBean(DeviceService.class);
 
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
-                .eq(DeviceType::getStatus, 1));
-        if (deviceType == null) {
-            return false;
-        }
-
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getStatus, 1));
 
         for (Device device : list) {
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/LiftController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/LiftController.java
index c297209..3cc9b2e 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/LiftController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/LiftController.java
@@ -2,13 +2,13 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.common.R;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
 import com.zy.asrs.wcs.rcs.entity.DeviceType;
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
 import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
 import com.zy.asrs.wcs.rcs.service.DeviceService;
-import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 import com.zy.asrs.wcs.rcs.thread.LiftThread;
 import com.zy.asrs.wcs.system.controller.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,24 +26,14 @@
 
     @Autowired
     private DeviceService deviceService;
-    @Autowired
-    private DeviceTypeService deviceTypeService;
 
     @GetMapping("/lift/status/list")
     public R getLiftStatusList() {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getHostId, getHostId())
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Lift)));
-        if (deviceType == null) {
-            return R.error("璁惧绫诲瀷涓嶅瓨鍦�");
-        }
-
         ArrayList<LiftProtocol> data = new ArrayList<>();
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
                 .eq(Device::getHostId, getHostId())
                 .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId()));
+                .eq(Device::getDeviceType, DeviceCtgType.LIFT.val()));
         for (Device device : list) {
             LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue());
             LiftProtocol status = liftThread.getStatus();
@@ -54,18 +44,10 @@
 
     @GetMapping("/lift/status/one/{deviceNo}")
     public R getLiftStatus(@PathVariable String deviceNo) {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getHostId, getHostId())
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Lift)));
-        if (deviceType == null) {
-            return R.error("璁惧绫诲瀷涓嶅瓨鍦�");
-        }
-
         Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
                 .eq(Device::getHostId, getHostId())
                 .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.LIFT.val())
                 .eq(Device::getDeviceNo, deviceNo));
 
         LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue());
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java
index a01dbf9..d96a34b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java
@@ -2,13 +2,12 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.common.R;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
-import com.zy.asrs.wcs.rcs.entity.DeviceType;
 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.service.ShuttleService;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
 import com.zy.asrs.wcs.system.controller.BaseController;
@@ -25,8 +24,6 @@
     @Autowired
     private DeviceService deviceService;
     @Autowired
-    private DeviceTypeService deviceTypeService;
-    @Autowired
     private ShuttleService shuttleService;
 
     @GetMapping("/shuttle/status/list")
@@ -37,18 +34,10 @@
 
     @GetMapping("/shuttle/status/one/{deviceNo}")
     public R getShuttleStatus(@PathVariable String deviceNo) {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getHostId, getHostId())
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)));
-        if (deviceType == null) {
-            return R.error("璁惧绫诲瀷涓嶅瓨鍦�");
-        }
-
         Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
                 .eq(Device::getHostId, getHostId())
                 .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getDeviceNo, deviceNo));
 
         ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/DeviceTypeService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/DeviceTypeService.java
index a5f39f3..573b67b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/DeviceTypeService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/DeviceTypeService.java
@@ -5,4 +5,6 @@
 
 public interface DeviceTypeService extends IService<DeviceType> {
 
+    DeviceType selectByFlag(String flag);
+
 }
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/DeviceTypeServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/DeviceTypeServiceImpl.java
index d895219..83a4375 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/DeviceTypeServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/DeviceTypeServiceImpl.java
@@ -1,5 +1,6 @@
 package com.zy.asrs.wcs.rcs.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.wcs.rcs.mapper.DeviceTypeMapper;
 import com.zy.asrs.wcs.rcs.entity.DeviceType;
 import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
@@ -9,4 +10,9 @@
 @Service("deviceTypeService")
 public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceType> implements DeviceTypeService {
 
+    @Override
+    public DeviceType selectByFlag(String flag) {
+        return this.getOne(new LambdaQueryWrapper<DeviceType>().eq(DeviceType::getFlag, flag));
+    }
+
 }
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/ShuttleServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/ShuttleServiceImpl.java
index 1680bb6..50bac03 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/ShuttleServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/ShuttleServiceImpl.java
@@ -3,13 +3,13 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.common.R;
 import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
 import com.zy.asrs.wcs.rcs.entity.DeviceType;
 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.service.ShuttleService;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,24 +23,15 @@
 
     @Autowired
     private DeviceService deviceService;
-    @Autowired
-    private DeviceTypeService deviceTypeService;
 
     @Override
     public List<ShuttleProtocol> getShuttleStatusList(Long hostId) {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getHostId, hostId)
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)));
-        if (deviceType == null) {
-            throw new CoolException("璁惧绫诲瀷涓嶅瓨鍦�");
-        }
 
         ArrayList<ShuttleProtocol> data = new ArrayList<>();
         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
                 .eq(Device::getHostId, hostId)
                 .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId()));
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()));
         for (Device device : list) {
             ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
             ShuttleProtocol status = shuttleThread.getStatus();
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
index 0b37b7e..4d17bc2 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
@@ -1,5 +1,6 @@
 package com.zy.asrs.wcs.rcs.thread;
 
+import com.zy.asrs.wcs.common.ExecuteSupport;
 import com.zy.asrs.wcs.core.model.NavigateNode;
 import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
 import com.zy.asrs.wcs.rcs.entity.Device;
@@ -23,7 +24,9 @@
 
     boolean reset(ShuttleCommand command);//澶嶄綅寮�鍏�
 
-    boolean isIdle();//鏄惁绌洪棽
+    boolean isIdle();
+
+    boolean isIdle(ExecuteSupport support);//鏄惁绌洪棽
 
     boolean isRequireCharge();//鏄惁婊¤冻鍏呯數鐘舵��
 
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
index d4b9e83..1f8cf24 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -7,6 +7,7 @@
 import com.zy.asrs.framework.common.DateUtils;
 import com.zy.asrs.framework.common.SpringUtils;
 import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.wcs.common.ExecuteSupport;
 import com.zy.asrs.wcs.core.entity.BasShuttle;
 import com.zy.asrs.wcs.core.entity.Loc;
 import com.zy.asrs.wcs.core.model.NavigateNode;
@@ -110,7 +111,8 @@
                 shuttleProtocol.setCurrentCode(data.getString("groundCode") == null ? "0" : data.getString("groundCode"));
                 //鐢垫睜鐢甸噺
                 shuttleProtocol.setBatteryPower(data.getString("battery") == null ? "0%" : data.getString("battery"));
-
+                //鏁呴殰
+                shuttleProtocol.setErrorCode(deviceStatus == 6 ? "1" : "0");
 
                 //鏄惁椤跺崌
                 shuttleProtocol.setHasLift(data.getInteger("palletStatus") == 1 ? true : false);
@@ -370,11 +372,20 @@
 
     @Override
     public boolean isIdle() {
+        return this.isIdle(null);
+    }
+
+    @Override
+    public boolean isIdle(ExecuteSupport support) {
+        if (null != support) {
+            if (!support.judgement()) {
+                return false;
+            }
+        }
         if (this.shuttleProtocol.getIdle() == null
                 || this.shuttleProtocol.getPakMk() == null
                 || this.shuttleProtocol.getErrorCode() == null
                 || this.shuttleProtocol.getProtocolStatus() == null
-                || this.shuttleProtocol.getTaskNo() == null
         ) {
             return false;
         }
@@ -383,7 +394,6 @@
                 && this.shuttleProtocol.getPakMk()
                 && this.shuttleProtocol.getErrorCode().equals("0")
                 && this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id
-                && this.shuttleProtocol.getTaskNo() == 0
                 ;
         return res;
     }
diff --git a/zy-asrs-wcs/src/main/resources/application.yml b/zy-asrs-wcs/src/main/resources/application.yml
index 92ea33e..5d8b45b 100644
--- a/zy-asrs-wcs/src/main/resources/application.yml
+++ b/zy-asrs-wcs/src/main/resources/application.yml
@@ -18,9 +18,9 @@
 #    url: jdbc:mysql://47.97.1.152:3306/asrs?useUnicode=trKue&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
 #    username: root
 #    password: zy@123
-    url: jdbc:mysql://192.168.2.95:3306/asrs?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://127.0.0.1:3306/asrs?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
     username: root
-    password: root
+    password: xltys1995
 #    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
 #    url: jdbc:sqlserver://47.97.1.152:51433;databasename=jkasrs
 #    username: sa
diff --git a/zy-asrs-wcs/src/main/resources/mapper/core/DeviceCtgMapper.xml b/zy-asrs-wcs/src/main/resources/mapper/core/DeviceCtgMapper.xml
deleted file mode 100644
index 7c0536f..0000000
--- a/zy-asrs-wcs/src/main/resources/mapper/core/DeviceCtgMapper.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.zy.asrs.wcs.core.mapper.DeviceCtgMapper">
-
-</mapper>

--
Gitblit v1.9.1