From 3d61ab52a458045d499a8ad62ed9033a64be8792 Mon Sep 17 00:00:00 2001
From: pjb <123456>
Date: 星期二, 17 六月 2025 18:24:22 +0800
Subject: [PATCH] 库位添加逻辑删除

---
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java |  295 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 201 insertions(+), 94 deletions(-)

diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
index b3f6d2a..dce43a8 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.zy.asrs.framework.common.R;
 import com.zy.asrs.framework.exception.CoolException;
 import com.zy.asrs.wms.apis.wcs.entity.domain.SystemProperties;
@@ -10,9 +11,10 @@
 import com.zy.asrs.wms.apis.wcs.entity.request.*;
 import com.zy.asrs.wms.apis.wcs.entity.response.CommonReponse;
 import com.zy.asrs.wms.apis.wcs.services.WcsApiService;
-import com.zy.asrs.wms.asrs.entity.Task;
-import com.zy.asrs.wms.asrs.entity.TaskDetl;
-import com.zy.asrs.wms.asrs.entity.WaveSeed;
+import com.zy.asrs.wms.apis.wcs.utils.HttpEssUtils;
+import com.zy.asrs.wms.asrs.entity.*;
+import com.zy.asrs.wms.asrs.entity.enums.CacheSiteStatusType;
+import com.zy.asrs.wms.asrs.entity.enums.OrderPickStatus;
 import com.zy.asrs.wms.asrs.entity.enums.TaskStsType;
 import com.zy.asrs.wms.asrs.service.*;
 import io.jsonwebtoken.lang.Collections;
@@ -28,9 +30,9 @@
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -45,12 +47,23 @@
     private TaskService taskService;
     @Autowired
     private TaskDetlService taskDetlService;
-
+    @Autowired
+    private CacheSiteService cacheSiteService;
+    @Autowired
+    private OrderService orderService;
+    @Autowired
+    private OrderDetlService orderDetlService;
     @Autowired
     private WaveSeedService waveSeedService;
 
     @Autowired
     private RestTemplate restTemplate;
+
+    @Autowired
+    private PlatformService platformService;
+
+    @Resource
+    private SystemProperties systemProperties;
 
 
     /**
@@ -67,31 +80,73 @@
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public R containerArrivedNotify(ContainerArrivedParam arrivedParam, String taskType, Long hostId) {
-        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, arrivedParam.getContainerCode()));
-        if (Collections.isEmpty(tasks)) {
+    public R containerArrivedNotify(ContainerArrivedParam arrivedParam, String taskType, Long hostId){
+        Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, arrivedParam.getContainerCode()));
+        if (task == null) {
             return R.error("浠诲姟涓嶅瓨鍦紒锛�");
         }
+        log.info("瀹瑰櫒鍒拌揪鎺ユ敹锛屼换鍔″彿锛歿}锛屽綋鍓嶇姸鎬侊細{}锛屼笂鎶ョ姸鎬侊細{}",task.getTaskNo(),task.getTaskSts$(),TaskStsType.WCS_CONTAINER_RECEIVE.desc);
+
+        taskType = task.getTaskType() > 100 ? "outStock":"inStock";
 
         if (taskType.equals("inStock")) {
-            //DONE 鏍规嵁ESS杩斿洖鐨勫鍣ㄧ紪鐮佷慨鏀逛换鍔℃。涓殑杈撻�佺嚎璧峰浣嶇疆鑺傜偣锛屽強浠诲姟妗e鍣ㄥ埌杈剧姸鎬�
-            taskService.update(new LambdaUpdateWrapper<Task>()
-                    .set(Task::getTaskSts, TaskStsType.WCS_CONTAINER_RECEIVE.id)
-                    .set(Task::getOriginLoc, arrivedParam.getSlotCode())
-                    .eq(Task::getBarcode, arrivedParam.getContainerCode()));
+            if (task.getTaskSts() == 198) {
+                return R.error("鎾涓紒锛�");
+            }
+            if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_IN.id ) {
+                //DONE 鏍规嵁ESS杩斿洖鐨勫鍣ㄧ紪鐮佷慨鏀逛换鍔℃。涓殑杈撻�佺嚎璧峰浣嶇疆鑺傜偣锛屽強浠诲姟妗e鍣ㄥ埌杈剧姸鎬�
+                taskService.update(new LambdaUpdateWrapper<Task>()
+                        .set(Task::getTaskSts, TaskStsType.WCS_CONTAINER_RECEIVE.id)
+                        //杈撻�佺嚎鑺傜偣缂栫爜锛屼笉鏄簮搴撲綅
+                        .set(Task::getOriginSite, arrivedParam.getSlotCode())
+                        .eq(Task::getBarcode, arrivedParam.getContainerCode()));
+            } else {
+                  log.warn("{}娌℃湁涓嬪彂浠诲姟",task.getTaskNo());
+                  R.error(task.getTaskNo()+"娌℃湁涓嬪彂浠诲姟");
+            }
         } else {
-            //瀹瑰櫒鍒拌揪鏃舵洿鏂颁换鍔$姸鎬佷负锛氬叆搴撳畬鎴愶紝瀹氭椂浠诲姟鏍规嵁鐘舵�佺爜鏇存柊搴撳瓨
-            //褰撶姸鎬佷负鍏ュ簱瀹屾垚鏃讹紝鏇存柊搴撳瓨淇℃伅
-//            boolean update = taskService.update(new LambdaUpdateWrapper<Task>()
-//                    .set(Task::getTaskSts, TaskStsType.COMPLETE_OUT.id)
-//                    .set(Task::getOriginLoc, arrivedParam.getSlotCode())
-//                    .eq(Task::getBarcode, arrivedParam.getContainerCode()));
-            //fixme 瀹瑰櫒鍒拌揪鐘舵�佹洿鏀逛负鎾涓�...
-            boolean update = taskService.update(new LambdaUpdateWrapper<Task>()
-                    .set(Task::getTaskSts, TaskStsType.WAVE_SEED.id)
-                    .set(Task::getOriginLoc, arrivedParam.getSlotCode())
-                    .eq(Task::getBarcode, arrivedParam.getContainerCode()));
+            if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_ARRIVED.id
+            || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id ) {
+                // 鍒拌揪鎷i�変綅锛屾帶鍒舵挱绉嶅浜伅
+                    List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getBarcode, task.getBarcode()));
+                    if(cacheSites.size() == 0) {
+                        log.error("鏉$爜锛歿}锛屾湭鎵惧埌鎾澧欎寒鐏�",task.getBarcode());
+                        throw new CoolException("鏈壘鍒版挱绉嶅");
+                    }
+                    for (CacheSite cacheSite:cacheSites) {
+                        // 鑾峰彇浠诲姟鏄庣粏鏁伴噺
+                        List<TaskDetl> taskDetlByTaskId = taskDetlService.getTaskDetlByTaskId(task.getId());
+                        double sum = taskDetlByTaskId.stream().mapToDouble(TaskDetl::getAnfme).sum();
+                        SlapLightControlParam slapLightControlParam = new SlapLightControlParam();
+                        slapLightControlParam.setControllerCode(cacheSite.getMemo()).setTagCode(cacheSite.getSiteNo())
+                                .setColor("GREEN").setMode("LIGHT").setDisplay(String.valueOf(sum));
+                        // 鍙戣捣浜伅璇锋眰
+                        CommonReponse response = HttpEssUtils.post("鍒拌揪鎷i�変綅锛屾挱绉嶅浜伅", HttpEssUtils.PLT_SEND_COMMAND, slapLightControlParam);
+                        if (response.getCode().equals(0)) {
+                            log.info("浠诲姟{}鍒拌揪鎷i�変綅锛屾挱绉嶅{}浜伅鎴愬姛",task.getTaskNo(),cacheSite.getSiteNo());
+                        } else {
+                            log.info("浠诲姟{}鍒拌揪鎷i�変綅锛屾挱绉嶅{}浜伅澶辫触",task.getTaskNo(),cacheSite.getSiteNo());
+                        }
+                    }
+                boolean update = taskService.update(new LambdaUpdateWrapper<Task>()
+                        .set(Task::getTaskSts, TaskStsType.WAVE_SEED.id)
+                        .set(Task::getOriginSite, arrivedParam.getSlotCode())
+                        .eq(Task::getBarcode, arrivedParam.getContainerCode()));
+                if (!update) {
+                    throw new CoolException("瀹瑰櫒鍒拌揪浠诲姟鏇存柊澶辫触锛侊紒");
+                }
 
+            } else if(task.getTaskSts().equals(TaskStsType.UPDATED_OUT.id)) {
+                ConveyorStarParam conveyorStarParam = new ConveyorStarParam();
+                conveyorStarParam.setSlotCode(task.getOriginSite())
+                        .setContainerCode(task.getBarcode())
+                        .setDirection("200");
+                // 鍑哄簱瀹屾垚锛屾竻闄よ緭閫佺嚎鏉$爜锛屽彇涓嬬瀛�
+                    CommonReponse response = HttpEssUtils.post("娓呴櫎杈撻�佺嚎鏉$爜", HttpEssUtils.CONVEYOR_START, conveyorStarParam);
+                    if (response.getCode().equals(200)) {
+                        log.info("{}鍑哄簱瀹屾垚锛屾竻闄}杈撻�佺嚎鏉$爜{}鎴愬姛",task.getTaskNo(),task.getOriginSite(),task.getBarcode());
+                    }
+            }
         }
 
         return R.success("success");
@@ -112,37 +167,43 @@
                 .eq(Task::getTaskNo, callbackParam.getTaskCode()));
         if (!Collections.isEmpty(list)) {
             list.forEach(task -> {
+                log.info("瀹瑰櫒鎵ц鐘舵�佷笂鎶ワ紝浠诲姟鍙凤細{}锛屽綋鍓嶇姸鎬侊細{}锛屼笂鎶ョ姸鎬侊細{}",task.getTaskNo(),task.getTaskSts$(),callbackParam.getEventType());
+                if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_ALLOCATED.event)) {
+                    return;
+                }
+                // ESS鍙兘閰嶇疆涓�涓姸鎬佷笂鎶ユ帴鍙o紝鏍规嵁浠诲姟鍙峰垽鏂槸鍏ュ簱浠诲姟鎴栧嚭搴撲换鍔�
+                String taskType = task.getTaskType() > 100 ? "outStock":"inStock";
                 TaskStsType taskStsType = null;
-                if (stockType.equals("inStock")) { //鍏ュ簱浠诲姟
+                if (taskType.equals("inStock")) { //鍏ュ簱浠诲姟
                     if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_LOAD.event)) { //涓婃姤鍙栫鐘舵��
-                        if (task.getTaskSts() == TaskStsType.WCS_CONVEYOR_START.id) {
+//                        if (task.getTaskSts() == TaskStsType.WCS_CONVEYOR_START.id) {
                             taskStsType = TaskStsType.WCS_TOTE_LOAD;
-                        } else {
-                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_TOTE_LOAD.desc + "浠诲姟";
-                            log.error(errMsg);
-                            throw new CoolException(errMsg);
-                        }
+//                        } else {
+//                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_TOTE_LOAD.desc + "浠诲姟";
+//                            log.error(errMsg);
+//                            throw new CoolException(errMsg);
+//                        }
                     } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_UNLOAD.event)) { //涓婃姤鏀剧鐘舵��
-                        if (task.getTaskSts() == TaskStsType.WCS_TOTE_LOAD.id) {
+//                        if (task.getTaskSts() == TaskStsType.WCS_TOTE_LOAD.id) {
                             taskStsType = TaskStsType.WCS_TOTE_UNLOAD;
-                        } else {
-                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_TOTE_UNLOAD.desc + "浠诲姟";
-                            log.error(errMsg);
-                            throw new CoolException(errMsg);
-                        }
+//                        } else {
+//                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_TOTE_UNLOAD.desc + "浠诲姟";
+//                            log.error(errMsg);
+//                            throw new CoolException(errMsg);
+//                        }
                     } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_STATUS.event)) { //TODO 闇�纭涓婃姤浠诲姟涓紝浠诲姟瀹屾垚鏄摢涓簨浠讹紝鐩墠鏆傚畾task浜嬩欢
-                        if (task.getTaskSts() == TaskStsType.WCS_TOTE_UNLOAD.id) {
+//                        if (task.getTaskSts() == TaskStsType.WCS_TOTE_UNLOAD.id) {
                             taskStsType = TaskStsType.WCS_PUTAWAY_SUCESS;
-                        } else {
-                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_PUTAWAY_SUCESS.desc + "浠诲姟";
-                            log.error(errMsg);
-                            throw new CoolException(errMsg);
-                        }
+//                        } else {
+//                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_PUTAWAY_SUCESS.desc + "浠诲姟";
+//                            log.error(errMsg);
+//                            throw new CoolException(errMsg);
+//                        }
                     }
                     boolean result = taskService.update(new LambdaUpdateWrapper<Task>()
                             .set(Task::getRobotCode, callbackParam.getRobotCode())
-                            .set(Task::getSysTaskCode, callbackParam.getSysTaskCode())
-                            .set(Task::getTaskSts, taskStsType.id)
+//                            .set(Task::getSysTaskCode, callbackParam.getSysTaskCode())
+                            .set(Task::getTaskSts, taskStsType != null ? taskStsType.id : task.getTaskType())
                             .set(Task::getExcudeStatus, callbackParam.getStatus())
                             .set(Task::getTaskDesc, callbackParam.getMessage())
                             .eq(Task::getBarcode, callbackParam.getContainerCode())
@@ -155,42 +216,44 @@
                     }
                 } else { //鍑哄簱浠诲姟
                     if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_LOAD.event)) { //涓婃姤鍙栫鐘舵��
-                        //TODO 瀹氭椂鍣ㄥ紑鍚悗锛岃鍒犻櫎 || task.getTaskType() == TaskStsType.GENERATE_OUT.id
-                        if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT.id || task.getTaskSts() == TaskStsType.GENERATE_OUT.id) {
+//                        if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT.id ) {
                             taskStsType = TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD;
-                        } else {
-                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.desc + "浠诲姟";
-                            log.error(errMsg);
-                            throw new CoolException(errMsg);
-                        }
+//                        } else {
+//                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.desc + "浠诲姟";
+//                            log.error(errMsg);
+//                            throw new CoolException(errMsg);
+//                        }
                     } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_UNLOAD.event)) { //涓婃姤鏀剧鐘舵��
-                        if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.id) {
+//                        if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.id) {
                             taskStsType = TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD;
-                        } else {
-                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.desc + "浠诲姟";
-                            log.error(errMsg);
-                            throw new CoolException(errMsg);
-                        }
+//                        } else {
+//                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.desc + "浠诲姟";
+//                            log.error(errMsg);
+//                            throw new CoolException(errMsg);
+//                        }
                     } else if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_STATUS.event)) { //涓婃姤瀹屾垚鐘舵��
-                        if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.id || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id) {
+//                        if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TOTE_UNLOAD.id || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id) {
                             //鍑哄簱浠诲姟瀹屾垚锛屼慨鏀圭姸鎬佷负瀹瑰櫒鍒拌揪锛屽畾鏃朵换鍔$敓鎴愭挱绉嶆尝娆�
                             taskStsType = TaskStsType.WCS_EXECUTE_OUT_TASK_DONE;
-                        } else {
-                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.desc + "浠诲姟";
-                            log.error(errMsg);
-                            throw new CoolException(errMsg);
-                        }
+//                        } else {
+//                            String errMsg = "浠诲姟缂栧彿锛�" + task.getTaskNo() + "鐘舵�佷负涓嶅尮閰嶏紝" + "涓嶈兘鎵ц锛�" + TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.desc + "浠诲姟";
+//                            log.error(errMsg);
+//                            throw new CoolException(errMsg);
+//                        }
                     }
-
                     //鏇存柊鍑哄簱鐘舵�佸強鐩稿叧瀛楁
-                    taskService.update(new LambdaUpdateWrapper<Task>()
+                    boolean update = taskService.update(new LambdaUpdateWrapper<Task>()
                             .set(Task::getRobotCode, callbackParam.getRobotCode())
                             .set(Task::getSysTaskCode, callbackParam.getSysTaskCode())
-                            .set(Task::getTaskSts, taskStsType.id)
+                            .set(Task::getTaskSts, taskStsType != null ? taskStsType.id : task.getTaskType())
                             .set(Task::getExcudeStatus, callbackParam.getStatus())
                             .set(Task::getTaskDesc, callbackParam.getMessage())
                             .eq(Task::getBarcode, callbackParam.getContainerCode())
                             .eq(Task::getTaskNo, callbackParam.getTaskCode()));
+
+                    if (!update) {
+                        throw new CoolException("浠诲姟鏇存柊澶辫触锛侊紒");
+                    }
 
                 }
 
@@ -272,9 +335,12 @@
 
     @Override
     public R rfidCallback(RfidSingalRequest request) {
-
-
         return null;
+    }
+
+    @Override
+    public R getPlatforms() {
+        return R.ok(platformService.list(new LambdaQueryWrapper<>()));
     }
 
     /**
@@ -283,48 +349,89 @@
      * @param request
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void slapLightLogic(Map<String, Object> request) {
         String taskNo = request.get("taskNo").toString();
         String orderNo = request.get("orderNo").toString();
+
+        List<CacheSite> performs = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderNo, orderNo));
+        if (Objects.isNull(performs.stream().findFirst().get().getPlatformId())) {
+            throw new CoolException("璇锋墦鍗版槑缁嗭紝骞剁粦瀹氱洰鏍囬泦璐у尯");
+        }
 
         //* 1. 鍒ゆ柇褰撳墠瀹瑰櫒鏄惁杩樻湁鐗╂枡鏈嫞锛屾湭鎷e畬闂伅锛屾嫞瀹岄�氱煡瀹瑰櫒娴佸姩锛屽苟鐏伅
         SlapLightControlParam slapParam = new SlapLightControlParam();
         MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
         //榛樿娴佸姩
         boolean converyor = false;
-        //鍒ゆ柇鏄惁杩樻湁鐗╂枡鏈嫞
-
+        //鍒ゆ柇褰撳墠浠诲姟鏄惁杩樻湁鐗╂枡鏈嫞
         if (!checked(orderNo, taskNo)) {
             //璋冪敤涓夋柟鎺ュ彛,闂伅涓嶅仛鎿嶄綔
-
             // 璁剧疆璇锋眰鍙傛暟
             params.add("params", JSONObject.toJSONString(slapParam));
-            log.info("璇锋眰鍦板潃锛歿}锛岃姹傚弬鏁帮細{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
-
+            log.info("鏈畬鎴愰棯鐏姹傚湴鍧�锛歿}锛岃姹傚弬鏁帮細{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
         } else {
-            //璋冪敤涓夋柟鎺ュ彛,鏉ョ伅閫氱煡瀹瑰櫒娴佸姩锛� 浼犵伃鐏弬鏁�
+            //璋冪敤涓夋柟鎺ュ彛,鐏伅閫氱煡瀹瑰櫒娴佸姩锛� 浼犵伃鐏弬鏁�
+            //todo 鍒ゆ柇褰撳墠璁㈠崟鏄惁瀹屾垚锛屽畬鎴愮伃鐏紝鏈畬鎴愪繚鎸佹嫞璐х姸鎬佷寒鐏�
+            Order one = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, orderNo));
 
-            params.add("params", JSONObject.toJSONString(slapParam));
-            log.info("璇锋眰鍦板潃锛歿}锛岃姹傚弬鏁帮細{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
-        }
+            if (Objects.isNull(one)) {
+                throw new CoolException("褰撳墠璁㈠崟鏄庣粏涓嶅瓨鍦紒锛�");
+            }
+//            //鑾峰彇鎾宸插畬鎴愮殑璁㈠崟鏄庣粏
+//            List<OrderDetl> detlList = orderDetls.stream().filter(detl -> {
+//                return detl.getPickStatus() == OrderPickStatus.ORDER_PICK_STATUS_DONE.val;
+//            }).collect(Collectors.toList());
 
-        HttpHeaders headers = new HttpHeaders();
-        headers.add("Content-Type", "application/json");
-        HttpEntity httpEntity = new HttpEntity<>(params, headers);
-        // 璇锋眰
-        ResponseEntity<CommonReponse> exchange = restTemplate.exchange(SystemProperties.CONVEYOR_START, HttpMethod.POST, httpEntity, CommonReponse.class);
-        log.info("涓嬪彂娴佸姩閫氱煡 杩斿洖缁撴灉锛歿}", exchange);
-        if (exchange.getBody() == null) {
-            throw new CoolException("涓嬪彂娴佸姩閫氱煡澶辫触锛侊紒");
-        } else {
-            CommonReponse response = exchange.getBody();
-            if (response.getCode() == 0) {
-                if (!converyor) {
-                    //* 2. 瀹瑰櫒娴佸姩鍒ゆ柇锛屽鏋滄枡绠辨病鏈夌墿鏂� code浼�200锛� 鏈夌墿鏂欎紶100 鎵ц鍥炲簱浠诲姟,淇敼浠诲姟鐘舵�佷负  璋冪敤containerConveryor锛坱askNo锛夋柟娉�
-                    containerConveryor(request.get("taskNo").toString());
+            //鍒ゆ柇鏁伴噺鏄惁涓庤鍗曟槑缁嗙殑闇�姹傞噺鐩稿悓锛岀浉鍚屽垯璁㈠崟瀹屾垚
+            if (one.getPickStatus() == OrderPickStatus.ORDER_PICK_STATUS_DONE.val) {
+                //鎾瀹屾垚锛岄噴鏀剧粦瀹氱珯鐐�
+                List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderNo, orderNo));
+                for (CacheSite cacheSite : cacheSites) {
+                    if (!cacheSite.getSiteStatus().equals(CacheSiteStatusType.O.id)) {
+                        cacheSite.setSiteStatus(CacheSiteStatusType.O.id);
+                        cacheSite.setOrderId(null);
+                        cacheSite.setBarcode(null);
+                        cacheSite.setOrderNo(null);
+                        cacheSite.setPlatformId(null);
+                        cacheSite.setPlatformNo(null);
+                        cacheSite.setUpdateTime(new Date());
+                        if (!cacheSiteService.updateById(cacheSite)) {
+                            throw new CoolException("鎾绔欑偣鏇存柊澶辫触");
+                        }
+                    }
                 }
             }
+            converyor = true;
+            params.add("params", JSONObject.toJSONString(slapParam));
+            log.info("瀹屾垚鐏伅璇锋眰鍦板潃锛歿}锛岃姹傚弬鏁帮細{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
         }
+
+        if (converyor) {
+            Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskNo, request.get("taskNo")));
+            if (Objects.isNull(task)) {
+                throw new CoolException("浠诲姟涓嶅瓨鍦紒锛�");
+            }
+            containerConveryor(task.getBarcode());
+        }
+
+//        HttpHeaders headers = new HttpHeaders();
+//        headers.add("Content-Type", "application/json");
+//        HttpEntity httpEntity = new HttpEntity<>(params, headers);
+//        // 璇锋眰
+//        ResponseEntity<CommonReponse> exchange = restTemplate.exchange(SystemProperties.CONVEYOR_START, HttpMethod.POST, httpEntity, CommonReponse.class);
+//        log.info("涓嬪彂娴佸姩閫氱煡 杩斿洖缁撴灉锛歿}", exchange);
+//        if (exchange.getBody() == null) {
+//            throw new CoolException("涓嬪彂娴佸姩閫氱煡澶辫触锛侊紒");
+//        } else {
+//            CommonReponse response = exchange.getBody();
+//            if (response.getCode() == 0) {
+//                if (!converyor) {
+//                    //* 2. 瀹瑰櫒娴佸姩鍒ゆ柇锛屽鏋滄枡绠辨病鏈夌墿鏂� code浼�200锛� 鏈夌墿鏂欎紶100 鎵ц鍥炲簱浠诲姟,淇敼浠诲姟鐘舵�佷负  璋冪敤containerConveryor锛坱askNo锛夋柟娉�
+//                    containerConveryor(request.get("taskNo").toString());
+//                }
+//            }
+//        }
     }
 
     /**

--
Gitblit v1.9.1