Browse Source

Merge remote-tracking branch 'origin/xuankuang' into xuankuang

zhangxin 7 months ago
parent
commit
7cf4a9cc32

+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/init/StartService.java

@@ -99,6 +99,12 @@ public class StartService implements CommandLineRunner {
         stirringTankClientService.clear();
     }
 
+    /**
+     * 清除未完成和未下发成功的任务
+     */
+    public void delTask()  {
+        stirringTankClientService.delTask();
+    }
 
 
     /**

+ 7 - 0
warewms-ams/src/main/java/com/ruoyi/ams/task/mapper/WcsTaskMapper.java

@@ -83,6 +83,13 @@ public interface WcsTaskMapper extends BaseMapper<WcsTask>
      */
      List<WcsTask> selectWcsUnallocated(Long warehouseId);
 
+    /**
+     * 查询未完成或者未取消的任务
+     * @param warehouseId
+     * @return
+     */
+    List<WcsTask> selectWcsByState(Long warehouseId);
+
     /**
      * 查询同列的任务(里面)
      * @param colNo

+ 5 - 0
warewms-ams/src/main/java/com/ruoyi/ams/task/service/IWcsTaskService.java

@@ -46,6 +46,11 @@ public interface IWcsTaskService {
      */
     List<WcsTask> selectWcsUnallocated(Long warehouseId);
 
+    /**
+     * 查询未完成或者未取消的任务
+     */
+    List<WcsTask> selectWcsByState(Long warehouseId);
+
     /**
      * 查询AGV任务
      *

+ 5 - 0
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -159,6 +159,11 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         return wcsTaskMapper.selectWcsUnallocated(warehouseId);
     }
 
+    @Override
+    public List<WcsTask> selectWcsByState(Long warehouseId) {
+        return wcsTaskMapper.selectWcsByState(warehouseId);
+    }
+
     /**
      * 新增AGV任务
      *

+ 21 - 0
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/StirringTankClientService.java

@@ -4,13 +4,18 @@ package com.ruoyi.ams.xuankuang.service;
 import cn.hutool.core.util.NumberUtil;
 import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
 import com.ruoyi.ams.order.mapper.WmsDocOrderHeaderMapper;
+import com.ruoyi.ams.task.domain.WcsTask;
+import com.ruoyi.ams.task.service.IWcsTaskService;
 import com.ruoyi.ams.xuankuang.domain.dto.SkuAgitatedTankAttrDTO;
+import com.ruoyi.base.constant.Constant;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.hard.xuankang.StirringTankClient;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -23,10 +28,13 @@ import static com.ruoyi.hard.xuankang.StirringTankClient.STIR_TANK_COMMAND.*;
  * @version 1.0
  * @date 2023/4/24 15:31
  */
+@Slf4j
 @Service
 public class StirringTankClientService {
 
 
+    @Autowired
+    private IWcsTaskService wcsTaskService;
     @Autowired
     StirringTankClient stirringTankClient;
     @Autowired
@@ -601,7 +609,20 @@ public class StirringTankClientService {
         return AjaxResult.success();
     }
 
+    /**
+     * 清除未完成和未下发成功的任务
+     * @return
+     */
+    public void delTask() {
+
+        List<WcsTask> wcsTaskList = wcsTaskService.selectWcsByState(Constant.WAREHOUSE_ID);
+        if (wcsTaskList == null || wcsTaskList.size() < 1) { log.info("当前暂无需要处理的任务!"+ new Date());}
+
+        for (WcsTask wcsTask : wcsTaskList) {
 
+            wcsTaskService.callBack(wcsTask.getTaskNo(), 7, null);
+        }
+    }
 
 }
 

+ 7 - 0
warewms-ams/src/main/resources/mapper/ams/WcsTaskMapper.xml

@@ -349,4 +349,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select * from wcs_task
         where task_no = #{taskNo} and state not in (2,7,4,11,12)
     </select>
+
+    <select id="selectWcsByState" resultMap="WcsTaskResult" parameterType="Long">
+        select *
+        from wcs_task
+        where state not in (2,6,7)
+        order by priority desc,create_date
+    </select>
 </mapper>