diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/ISchBaseTaskService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/ISchBaseTaskService.java index 4668765..dfdf309 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/ISchBaseTaskService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/ISchBaseTaskService.java @@ -67,6 +67,14 @@ public interface ISchBaseTaskService extends IService { */ List findUnFinishTasksByPoint_code2(String task_code, String point_code2); + /** + * 根据任务号和子托盘查询未完成的任务 + * @param task_code + * @param sub_tray + * @return + */ + List findUnFinishTasksBySub_tray(String task_code, String sub_tray); + /** * 根据任务类型和任务状态查询任务 * @param config_code diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java index d8de2ac..43b3cb3 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java @@ -140,6 +140,19 @@ public class SchBaseTaskServiceImpl extends ServiceImpl findUnFinishTasksBySub_tray(String task_code, String sub_tray) { + Assert.notNull(task_code, "任务编码不能为空!"); + Assert.notNull(sub_tray, "子托盘不能为空!"); + LambdaQueryWrapper lam = new LambdaQueryWrapper<>(); + lam.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()) + .ne(ObjectUtil.isNotEmpty(task_code),SchBaseTask::getTask_code, task_code)// 不是当前任务 + .eq(SchBaseTask::getVehicle_code2, sub_tray) + .eq(SchBaseTask::getIs_delete, false); + List schBaseTasks = schBaseTaskMapper.selectList(lam); + return schBaseTasks; + } + @Override public List findTasksByTaskStatus(String config_code, TaskStatus status) { Assert.notNull(config_code, "任务配置编码不能为空!"); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java index aee1b05..29db93a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java @@ -169,6 +169,7 @@ public abstract class AbstractTask { String apply_point_code = param.getString("device_code"); // 请求点 String next_point = param.getString("next_point"); // 目的点 String config_code = param.getString("config_code"); + String sub_tray = param.getString("sub_tray"); // 1、校验数据 SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper() .eq(SchBaseTaskconfig::getConfig_code, config_code)); @@ -182,6 +183,13 @@ public abstract class AbstractTask { Assert.isFalse(apply_point_lists.size()>0, "该任务申请点位["+apply_point_code+"]已存在未完成的任务,无法申请任务!"); } + //子托盘非空 + if(ObjectUtil.isNotEmpty(sub_tray)) { + //判断该子托盘是否存在未完成任务 + List apply_sub_tray_lists = taskService.findUnFinishTasksBySub_tray("",sub_tray); + Assert.isFalse(apply_sub_tray_lists.size()>0, + "该任务申请子托盘["+sub_tray+"]已存在未完成的任务,无法申请任务!"); + } // 最大可创建任务数 Integer tcmn = taskConfig.getTask_create_max_num(); // 获取申请的任务 diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index f00f364..9a2c91e 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -57,7 +57,7 @@ https://juejin.cn/post/6844903775631572999 - +