From 6203ed7ed55653dbf82739ca58faf1ed2c1bd207 Mon Sep 17 00:00:00 2001 From: Comair <1464848666@qq.com> Date: Sun, 28 Jul 2024 14:35:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=AE=A1=E7=90=86=E5=8F=8A?= =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/shkj/wms/bo/AGVTaskBo.java | 2 +- .../shkj/wms/bo/BusinTaskManageQueryBo.java | 5 +++ .../business/BusinDataTaskController.java | 2 +- .../java/com/shkj/wms/plc/PlcEventTask.java | 8 ++-- .../main/java/com/shkj/wms/plc/PlcInit.java | 2 +- .../shkj/wms/scheduled/ScheduledTasks.java | 9 ++-- .../impl/BusinDataTaskServiceImpl.java | 41 +++++++++++++++---- .../com/shkj/wms/third/dps/DpsCallUtil.java | 5 ++- .../mapper/wms/BusinDataTaskMapper.xml | 8 +++- 9 files changed, 62 insertions(+), 20 deletions(-) diff --git a/shkj-wms/src/main/java/com/shkj/wms/bo/AGVTaskBo.java b/shkj-wms/src/main/java/com/shkj/wms/bo/AGVTaskBo.java index d92bab5..dc62fae 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/bo/AGVTaskBo.java +++ b/shkj-wms/src/main/java/com/shkj/wms/bo/AGVTaskBo.java @@ -44,7 +44,7 @@ public class AGVTaskBo implements Serializable { /** * 任务编号 */ - private Long taskId; + private String taskId; /** * AGV进入巷道号 KW5 KW7 KW9 diff --git a/shkj-wms/src/main/java/com/shkj/wms/bo/BusinTaskManageQueryBo.java b/shkj-wms/src/main/java/com/shkj/wms/bo/BusinTaskManageQueryBo.java index 8bf61b7..7b7278f 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/bo/BusinTaskManageQueryBo.java +++ b/shkj-wms/src/main/java/com/shkj/wms/bo/BusinTaskManageQueryBo.java @@ -37,4 +37,9 @@ public class BusinTaskManageQueryBo implements Serializable { private String createTimeS; private String createTimeE; + private String vehicheModel; + + private String color; + + } diff --git a/shkj-wms/src/main/java/com/shkj/wms/controller/business/BusinDataTaskController.java b/shkj-wms/src/main/java/com/shkj/wms/controller/business/BusinDataTaskController.java index e3afd99..e17f69c 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/controller/business/BusinDataTaskController.java +++ b/shkj-wms/src/main/java/com/shkj/wms/controller/business/BusinDataTaskController.java @@ -104,7 +104,7 @@ public class BusinDataTaskController extends BaseController { @PostMapping("/activeTask") @RepeatSubmit public Result activeTask(BusinTaskManageDistributeBo bo){ - return businDataTaskService.pauseTask(bo); + return businDataTaskService.activeTask(bo); } diff --git a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java index 7b522ac..d68d91a 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java +++ b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java @@ -136,7 +136,7 @@ public class PlcEventTask { private ScheduledExecutorService executorService = Executors.newScheduledThreadPool(8); - @Scheduled(fixedRate = 200) + //@Scheduled(fixedRate = 200) public void init() { //查询需要连接的PLC,初始化连接对象 List plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); @@ -219,7 +219,7 @@ public class PlcEventTask { } } - @Scheduled(fixedRate = 200) + //@Scheduled(fixedRate = 200) public void init1() { //查询需要连接的PLC,初始化连接对象 List plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); @@ -237,7 +237,7 @@ public class PlcEventTask { } } - @Scheduled(fixedRate = 200) + // @Scheduled(fixedRate = 200) public void init2() { //查询需要连接的PLC,初始化连接对象 List plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); @@ -255,7 +255,7 @@ public class PlcEventTask { } } - @Scheduled(fixedDelay = 6000) + // @Scheduled(fixedDelay = 6000) public void writePlcheartbeat() { //根据连接的plcId获取属性 PlcOperate plcOperate = plcInit.getPlcOperate_41(); diff --git a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java index 4c94631..a778a7b 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java +++ b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java @@ -42,7 +42,7 @@ public class PlcInit { RedisTemplate redisTemplate; private ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); - @PostConstruct + //@PostConstruct public void init(){ log.info("初始化连接对象"); executorService.scheduleWithFixedDelay( diff --git a/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java b/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java index b6090b0..5057441 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java +++ b/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java @@ -51,6 +51,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; @Slf4j @Component @@ -178,7 +179,7 @@ public class ScheduledTasks { } - @Scheduled(fixedRate = 200) + // @Scheduled(fixedRate = 200) public void task() { // log.info("开始获取需要执行的任务"); //获取待下发任务数据 @@ -239,7 +240,8 @@ public class ScheduledTasks { taskQueryBo.setTaskType("25"); List businDataTaskVo25 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo); businDataTaskVos.addAll(businDataTaskVo25); - // log.info("要执行的任务信息:"+JsonUtil.toJSONString(businDataTaskVos)); + //按照优先级降序排序,优先级高的优先执行 + businDataTaskVos = businDataTaskVos.stream().sorted(Comparator.comparing(BusinDataTaskVo::getIsTop,Comparator.reverseOrder())).collect(Collectors.toList()); for (BusinDataTaskVo businDataTaskVo : businDataTaskVos) { doTask(businDataTaskVo); } @@ -1807,8 +1809,9 @@ public class ScheduledTasks { log.info("巷道内移库任务给堆垛机下发失败!"+businDataTask.getId()); return Result.err().msg("巷道内移库任务给堆垛机下发失败"); } + }else{ + return Result.err(); } - return Result.ok(); } diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java index 129c48e..73386c0 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java @@ -1311,11 +1311,13 @@ public class BusinDataTaskServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper() .eq(BusinDataTask::getId, bo.getTaskId()).last("limit 1"); BusinDataTask businDataTask = getOne(wrapper); - if (!businDataTask.getTaskStatus().equals("0") && !businDataTask.getTaskStatus().equals("1")) { + String taskStatus = businDataTask.getTaskStatus(); + if (!taskStatus.equals("0") && !taskStatus.equals("1")) { return Result.err().msg("此任务不可取消"); } businDataTask.setTaskStatus("3"); - + Long locationId = businDataTask.getLocationId(); + BaseLocation baseLocation = iBaseLocationService.getById(locationId); //入库时需要释放货位状态 String taskType = businDataTask.getTaskType(); if (taskType.equals(TaskTypeEnum.byhand_in.getValue()) @@ -1323,13 +1325,29 @@ public class BusinDataTaskServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper() .eq(BusinDataTask::getId, bo.getTaskId()).last("limit 1"); BusinDataTask businDataTask = getOne(wrapper); - if (!businDataTask.getTaskStatus().equals("0")) { + if (!"0".equals(businDataTask.getTaskStatus())) { return Result.err().msg("此任务不可提升优先级"); } //提升优先级 - businDataTask.setPriority("1"); + businDataTask.setIsTop("1"); return this.updateById(businDataTask) ? Result.ok() : Result.err(); } @@ -1983,6 +2001,13 @@ public class BusinDataTaskServiceImpl extends ServiceImpl @@ -280,6 +279,13 @@ and task_status !='-1' + + and goodsData.vehiche_model =#{vehicheModel} + + + and goodsData.color =#{color} + + order by task.id desc