From 62b162847e2ca56c15e5ae0228cbd110fcac5716 Mon Sep 17 00:00:00 2001 From: zds <2388969634@qq.com> Date: Thu, 12 Sep 2024 17:57:04 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=89=8B?= =?UTF-8?q?=E6=8C=81=20=20=E7=BC=93=E5=AD=98=E7=A0=81=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20rev:=E4=BF=AE=E6=94=B9=E5=8E=9F=E6=96=99?= =?UTF-8?q?=E5=8C=BA=E3=80=81=E5=8E=9F=E6=96=99=E7=BC=93=E5=AD=98=E5=8C=BA?= =?UTF-8?q?=E8=B4=A7=E4=BD=8D=E5=88=86=E9=85=8D=E9=80=BB=E8=BE=91=EF=BC=9A?= =?UTF-8?q?=E6=8C=89=E5=90=AF=E7=94=A8=E7=9A=84=E6=8E=92=E5=8F=B7=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2=EF=BC=8C=E7=A1=AE=E5=AE=9A=E6=8E=92=E5=8F=B7=E5=90=8E?= =?UTF-8?q?=20=E6=8C=89=20=E5=B1=82=E5=8F=B7=20=E5=8D=87=E5=BA=8F=E3=80=81?= =?UTF-8?q?=E5=88=97=E5=8F=B7=20=E5=8D=87=E5=BA=8F=E8=BF=99=E6=A0=B7?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=E6=9D=A5=E5=88=86=E9=85=8D=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/pda/service/impl/PdaServiceImpl.java | 109 ++++++++++-------- .../sch/point/service/dto/PointLeftDto.java | 14 +++ .../service/impl/SchBasePointServiceImpl.java | 20 ---- .../sch/task/service/ISchBaseTaskService.java | 4 +- .../service/impl/SchBaseTaskServiceImpl.java | 12 +- .../nl/wms/sch/task_manage/AbstractTask.java | 8 +- .../sch/task_manage/GeneralDefinition.java | 7 +- .../sch/task_manage/task/tasks/KJRKTask.java | 4 +- .../sch/task_manage/task/tasks/POINTTask.java | 11 +- .../task_manage/task/tasks/SSXBKJTask.java | 4 +- .../sch/task_manage/task/tasks/YCLCKTask.java | 4 +- .../sch/task_manage/task/tasks/YCLRKTask.java | 104 +++++++++++++++-- .../task/tasks/mapper/PointMapper.java | 5 + .../task/tasks/mapper/PointMapper.xml | 33 +++++- 14 files changed, 234 insertions(+), 105 deletions(-) create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dto/PointLeftDto.java diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java index dd6c6e5..42838b2 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java @@ -1,6 +1,7 @@ package org.nl.wms.pda.service.impl; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -20,6 +21,8 @@ import org.nl.wms.sch.material.service.dao.Material; import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper; import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.dao.SchBasePoint; +import org.nl.wms.sch.task.service.ISchBaseTaskService; +import org.nl.wms.sch.task.service.dao.SchBaseTask; import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; @@ -39,7 +42,7 @@ import java.util.List; @Lazy public class PdaServiceImpl implements PdaService { @Autowired - private PdaMapper pdaMapper; + private ISchBaseTaskService taskService; @Autowired private ISchBasePointService pointService; @Autowired @@ -116,16 +119,8 @@ public class PdaServiceImpl implements PdaService { PdaResponseVo result = new PdaResponseVo(); String subTray = param.getString("sub_tray"); subTray = subTray.trim(); - if(ObjectUtil.isEmpty(subTray)){ - result = PdaResponseVo.pdaResultError("子托盘号不能为空!"); - return result; - } String motherTray = param.getString("mother_tray"); motherTray = motherTray.trim(); - if(ObjectUtil.isEmpty(motherTray)){ - result = PdaResponseVo.pdaResultError("母托盘号不能为空!"); - return result; - } //子拖盘解绑 if(ObjectUtil.isNotEmpty(subTray)){ //查询母托盘 @@ -188,45 +183,69 @@ public class PdaServiceImpl implements PdaService { new_sub_tray = new_sub_tray.trim(); if(ObjectUtil.isEmpty(new_sub_tray)){ result = PdaResponseVo.pdaResultError("新子托盘号不能为空!"); - }else{ - - List materialList = materialMapper.selectList(new LambdaQueryWrapper() - .eq(Material::getPalletSN,new_sub_tray) - .le(Material::getReturn_status, "1") - .eq(Material::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())); - if (ObjectUtil.isEmpty(materialList)) { - result = PdaResponseVo.pdaResultError("新子托盘号无组盘入库单据信息!"); - }else{ - if(ObjectUtil.isEmpty(sub_tray)){ - result = PdaResponseVo.pdaResultError("原子托盘号不能为空!"); - }else if (!sub_tray.startsWith("YBHC")){ - result = PdaResponseVo.pdaResultError("原子托盘号非缓存临时码!"); - }else{ - //更新点位载具 - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(SchBasePoint::getVehicle_code2,sub_tray); + return result; + } + List materialList = materialMapper.selectList(new LambdaQueryWrapper() + .eq(Material::getPalletSN,new_sub_tray) + .le(Material::getReturn_status, "1") + .eq(Material::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())); + if (ObjectUtil.isEmpty(materialList)) { + result = PdaResponseVo.pdaResultError("新子托盘号无组盘入库单据信息!"); + return result; + } + if(ObjectUtil.isEmpty(sub_tray)){ + result = PdaResponseVo.pdaResultError("原子托盘号不能为空!"); + return result; + } + if(!sub_tray.startsWith("YBHC")){ + result = PdaResponseVo.pdaResultError("原子托盘号非缓存临时码YBHC开头!"); + return result; + } + //查询点位记录 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SchBasePoint::getVehicle_code2,sub_tray); + int countPoint = pointMapper.selectCount(queryWrapper); + if(countPoint<=0){ + result = PdaResponseVo.pdaResultError("原子托盘号未在系统点位仓位上!"); + return result; + } + //判断该子托盘是否存在未完成任务 + Integer sub_tray_lists = taskService.findUnFinishTasksBySub_tray("",sub_tray); + if(sub_tray_lists>0){ + result = PdaResponseVo.pdaResultError("该任务申请子托盘[\"+sub_tray+\"]存在未完成的任务!"); + return result; + } + //查询组盘记录 + LambdaQueryWrapper queryWrapper_group = new LambdaQueryWrapper<>(); + queryWrapper_group.eq(SchBaseVehiclematerialgroup::getVehicle_code,sub_tray); + queryWrapper_group.le(SchBaseVehiclematerialgroup::getGroup_bind_material_status,"2"); + int countGroup = vehiclematerialgroupMapper.selectCount(queryWrapper_group); + if(countGroup<=0){ + result = PdaResponseVo.pdaResultError("原子托盘号无已绑定的组盘记录!"); + return result; + } + //更新点位载具 + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(SchBasePoint::getVehicle_code2,sub_tray); - updateWrapper.set(SchBasePoint::getVehicle_code2,new_sub_tray); - updateWrapper.set(SchBasePoint::getUpdate_id,currentUserId); - updateWrapper.set(SchBasePoint::getUpdate_name,nickName); - updateWrapper.set(SchBasePoint::getUpdate_time,now); - pointMapper.update(null,updateWrapper); + updateWrapper.set(SchBasePoint::getVehicle_code2,new_sub_tray); + updateWrapper.set(SchBasePoint::getUpdate_id,currentUserId); + updateWrapper.set(SchBasePoint::getUpdate_name,nickName); + updateWrapper.set(SchBasePoint::getUpdate_time,now); + pointMapper.update(null,updateWrapper); - //更新组盘载具 - LambdaUpdateWrapper updateWrapper_group = new LambdaUpdateWrapper<>(); - updateWrapper_group.eq(SchBaseVehiclematerialgroup::getVehicle_code,sub_tray); - updateWrapper_group.le(SchBaseVehiclematerialgroup::getGroup_bind_material_status,"2"); + //更新组盘载具 + LambdaUpdateWrapper updateWrapper_group = new LambdaUpdateWrapper<>(); + updateWrapper_group.eq(SchBaseVehiclematerialgroup::getVehicle_code,sub_tray); + updateWrapper_group.le(SchBaseVehiclematerialgroup::getGroup_bind_material_status,"2"); - updateWrapper_group.set(SchBaseVehiclematerialgroup::getVehicle_code,new_sub_tray); - updateWrapper_group.set(SchBaseVehiclematerialgroup::getSource_vehicle_code,sub_tray); - updateWrapper_group.set(SchBaseVehiclematerialgroup::getUpdate_id,currentUserId); - updateWrapper_group.set(SchBaseVehiclematerialgroup::getUpdate_name,nickName); - updateWrapper_group.set(SchBaseVehiclematerialgroup::getUpdate_time,now); - vehiclematerialgroupMapper.update(null,updateWrapper_group); - result = PdaResponseVo.pdaResultOk("缓存码变更成功!"); - } - } - } + updateWrapper_group.set(SchBaseVehiclematerialgroup::getVehicle_code,new_sub_tray); + updateWrapper_group.set(SchBaseVehiclematerialgroup::getSource_vehicle_code,sub_tray); + updateWrapper_group.set(SchBaseVehiclematerialgroup::getUpdate_id,currentUserId); + updateWrapper_group.set(SchBaseVehiclematerialgroup::getUpdate_name,nickName); + updateWrapper_group.set(SchBaseVehiclematerialgroup::getUpdate_time,now); + vehiclematerialgroupMapper.update(null,updateWrapper_group); + result = PdaResponseVo.pdaResultOk("缓存码变更成功!"); return result; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dto/PointLeftDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dto/PointLeftDto.java new file mode 100644 index 0000000..180c2a9 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dto/PointLeftDto.java @@ -0,0 +1,14 @@ +package org.nl.wms.sch.point.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PointLeftDto implements Serializable { + /** 点位编码 */ + private Integer row_num; + /** 点位名称 */ + private Integer left_num; + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java index 39a710a..04f1d85 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java @@ -63,7 +63,6 @@ public class SchBasePointServiceImpl extends ServiceImpl lam = new LambdaQueryWrapper<>(); lam.like(ObjectUtil.isNotEmpty(blurry), SchBasePoint::getPoint_code, blurry) -// .or(ObjectUtil.isNotEmpty(blurry), lam1 -> lam1.like(SchBasePoint::getPoint_name, blurry)) .eq(ObjectUtil.isNotEmpty(workshop_code), SchBasePoint::getWorkshop_code, workshop_code) .in(ObjectUtil.isNotEmpty(roles),SchBasePoint::getWorkshop_code,roles) .eq(ObjectUtil.isNotEmpty(region_code), SchBasePoint::getRegion_code, region_code) @@ -83,25 +82,6 @@ public class SchBasePointServiceImpl extends ServiceImpl pages = new Page<>(page.getPage() + 1, page.getSize()); pointMapper.selectPage(pages, lam); - // 可以存放的载具类型 - pages.getRecords().forEach(point -> { - if (ObjectUtil.isNotEmpty(point.getCan_vehicle_type())) { - point.setCan_vehicle_types(Arrays.asList(point.getCan_vehicle_type().split(","))); - } - String pointStatus = point.getPoint_status(); // 点位状态 - String pointType = point.getPoint_type(); // 点位类型 - SchBaseRegion regionObj = regionMapper.selectById(point.getRegion_code()); - if (ObjectUtil.isNotEmpty(regionObj)) { - if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(regionObj.getPoint_status_explain())) { - // 设置 - point.setPoint_status_name(PointUtils.getStatusOrTypeName(regionObj.getPoint_status_explain(), pointStatus)); - } - if (ObjectUtil.isNotEmpty(pointType) && ObjectUtil.isNotEmpty(regionObj.getPoint_type_explain())) { - // 设置 - point.setPoint_type_name(PointUtils.getStatusOrTypeName(regionObj.getPoint_type_explain(), pointType)); - } - } - }); return pages; } 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 da765bd..1d012b4 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 @@ -65,7 +65,7 @@ public interface ISchBaseTaskService extends IService { * @param point_code2 * @return */ - List findUnFinishTasksByPoint_code2(String task_code, String point_code2); + Integer findUnFinishTasksByPoint_code2(String task_code, String point_code2); /** * 根据任务号和子托盘查询未完成的任务 @@ -73,7 +73,7 @@ public interface ISchBaseTaskService extends IService { * @param sub_tray * @return */ - List findUnFinishTasksBySub_tray(String task_code, String sub_tray); + Integer findUnFinishTasksBySub_tray(String task_code, String sub_tray); /** * 根据任务类型和任务状态查询任务 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 7901bc0..03e68a2 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 @@ -126,8 +126,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl findUnFinishTasksByPoint_code2(String task_code, String point_code2) { - Assert.notNull(task_code, "任务编码不能为空!"); + public Integer findUnFinishTasksByPoint_code2(String task_code, String point_code2) { Assert.notNull(point_code2, "点位不能为空!"); LambdaQueryWrapper lam = new LambdaQueryWrapper<>(); lam.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()) @@ -136,21 +135,20 @@ public class SchBaseTaskServiceImpl extends ServiceImpl schBaseTasks = schBaseTaskMapper.selectList(lam); + Integer schBaseTasks = schBaseTaskMapper.selectCount(lam); return schBaseTasks; } @Override - public List findUnFinishTasksBySub_tray(String task_code, String sub_tray) { - Assert.notNull(task_code, "任务编码不能为空!"); + public Integer findUnFinishTasksBySub_tray(String task_code, String sub_tray) { 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; + Integer taskCount = schBaseTaskMapper.selectCount(lam); + return taskCount; } @Override 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 19f3aa2..babab9f 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 @@ -218,15 +218,15 @@ public abstract class AbstractTask { } }else{ //判断该申请点位是否存在起点或终点的未完成任务 - List apply_point_lists = taskService.findUnFinishTasksByPoint_code2("",apply_point_code); - Assert.isFalse(apply_point_lists.size()>0, + Integer apply_point_lists = taskService.findUnFinishTasksByPoint_code2("",apply_point_code); + Assert.isFalse(apply_point_lists>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, + Integer sub_tray_lists = taskService.findUnFinishTasksBySub_tray("",sub_tray); + Assert.isFalse(sub_tray_lists>0, "该任务申请子托盘["+sub_tray+"]已存在未完成的任务,无法申请任务!"); } // 最大可创建任务数 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java index 2a0ef3b..cd4367e 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java @@ -77,9 +77,10 @@ public class GeneralDefinition { public static final String IS_CONNECT_MES = "is_connect_mes"; /** MES路径 */ public static final String MES_URL = "mes_url"; - // 完成/取消 - /** 任务完成 */ - public static final String TASK_FINISH = "任务完成"; + /** 当前货架排 */ + public static final String NOW_YL_ROW = "now_yl_row"; + /** 当前货架排 */ + public static final String NOW_YLHC_ROW = "now_ylhc_row"; /** 任务取消 */ public static final String TASK_CANCEL = "任务取消"; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java index d45445f..bb22c44 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KJRKTask.java @@ -76,8 +76,8 @@ public class KJRKTask extends AbstractTask { continue; }else{ // 获取任务 - List taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); - if(taskList.size()>0){ + Integer taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); + if(taskList>0){ task.setRemark("分配终点点位"+point.getPoint_code()+"已存在未完成任务!"); taskService.update(task); // 消息通知 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java index 716f4d8..dfc6e59 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java @@ -56,8 +56,6 @@ public class POINTTask extends AbstractTask { private IWorkorderService workorderService; @Autowired private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; - @Autowired - private ISysParamService paramService; @Override // @Transactional(rollbackFor = Exception.class) @@ -82,10 +80,7 @@ public class POINTTask extends AbstractTask { SchBasePoint nextSchBasePoint= pointService.getOne(new LambdaQueryWrapper() .eq(SchBasePoint::getPoint_code, task.getPoint_code2())); if(task.getPoint_code2().startsWith("DKT")){ - //判断叠盘机最大叠盘数量 - Param max_dkt_qty = paramService.findByCode(GeneralDefinition.MAX_DKT_QTY); - Assert.notNull(max_dkt_qty, "找不到配置文件,请确认系统参数[max_dkt_qty]配置是否存在!"); - Integer max_qty = Integer.valueOf(max_dkt_qty.getValue()); + Integer max_qty = nextSchBasePoint.getVehicle_max_qty(); //如果是叠盘位,根据当前数量+1为目标地址 int qty=nextSchBasePoint.getVehicle_qty()+1; if(qty <= max_qty){ @@ -105,8 +100,8 @@ public class POINTTask extends AbstractTask { continue; } // 获取任务 - List taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),task.getPoint_code2()); - if(taskList.size()>0){ + Integer taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),task.getPoint_code2()); + if(taskList>0){ task.setRemark("分配终点点位"+task.getPoint_code2()+"已存在未完成任务!"); taskService.update(task); // 消息通知 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java index 15b058b..f821270 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/SSXBKJTask.java @@ -76,8 +76,8 @@ public class SSXBKJTask extends AbstractTask { continue; }else{ // 获取任务 - List taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); - if(taskList.size()>0){ + Integer taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); + if(taskList>0){ task.setRemark("分配起点点位"+point.getPoint_code()+"已存在未完成任务!"); taskService.update(task); // 消息通知 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLCKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLCKTask.java index 8fa8724..0f882c4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLCKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLCKTask.java @@ -121,8 +121,8 @@ public class YCLCKTask extends AbstractTask { continue; }else{ // 获取任务 - List taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); - if(taskList.size()>0){ + Integer taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); + if(taskList>0){ task.setRemark("分配终点点位"+point.getPoint_code()+"已存在未完成任务!"); taskService.update(task); // 消息通知 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLRKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLRKTask.java index 9204363..1ec3ba8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLRKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLRKTask.java @@ -3,6 +3,7 @@ package org.nl.wms.sch.task_manage.task.tasks; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.http.HttpRequest; @@ -12,6 +13,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; +import org.nl.system.service.param.ISysParamService; +import org.nl.system.service.param.dao.Param; import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.mes.domain.Head; import org.nl.wms.mes.domain.QPMES062Request; @@ -25,11 +28,13 @@ import org.nl.wms.sch.material.service.dao.Material; import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper; import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.dao.SchBasePoint; +import org.nl.wms.sch.point.service.dto.PointLeftDto; import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; import org.nl.wms.sch.task.service.dao.SchBaseTask; import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; import org.nl.wms.sch.task_manage.AbstractTask; +import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; import org.nl.wms.sch.task_manage.enums.GroupStatusEnum; import org.nl.wms.sch.task_manage.task.TaskType; @@ -41,10 +46,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -69,7 +71,7 @@ public class YCLRKTask extends AbstractTask { @Autowired private ISchBaseTaskconfigService taskConfigService; @Autowired - private IPdmBdWorkorderService workorderService; + private ISysParamService paramService; @Autowired private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; @Autowired @@ -107,8 +109,8 @@ public class YCLRKTask extends AbstractTask { continue; }else{ // 获取任务 - List taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); - if(taskList.size()>0){ + Integer taskList = taskService.findUnFinishTasksByPoint_code2(task.getTask_code(),point.getPoint_code()); + if(taskList>0){ task.setRemark("分配终点点位"+point.getPoint_code()+"已存在未完成任务!"); taskService.update(task); // 消息通知 @@ -156,11 +158,11 @@ public class YCLRKTask extends AbstractTask { //人工录入的子托盘号以YBHC开头 if(sub_tray.startsWith("YBHC")) { String regionCode = "YLHC"; - return getSchBasePoint(regionCode); + return getSchBasePointByYLHC(regionCode); }else {//非人工录入子托盘 //1、优先从原料库存区查找 String regionCode = "YL"; - SchBasePoint point = getSchBasePoint(regionCode); + SchBasePoint point = getSchBasePointByYL(regionCode); if (ObjectUtil.isNotEmpty(point)){ return point; }else {//2、原料库存区未找到,则去空架缓存区查找 @@ -190,6 +192,90 @@ public class YCLRKTask extends AbstractTask { return null; } + /** + * 根据区域编码查找合适的点位 + * 规则:根据启用的原料区的排号顺序分配,234567一共6排, + * 每次记录当前分配的排号到参数表,下次分配前读取参数表上次分配排号 + * @param regionCode + * @return + */ + private SchBasePoint getSchBasePointByYL(String regionCode) { + List rowist = pointMapper.findPointRowByCondition(regionCode,0); + if(ObjectUtil.isNotEmpty(rowist)){ + Map map = new HashMap(); + for (PointLeftDto pointLeft : rowist) { + map.put(pointLeft.getRow_num(), pointLeft.getLeft_num()); + } + Param now_yl_row = paramService.findByCode(GeneralDefinition.NOW_YL_ROW); + Assert.notNull(now_yl_row, "找不到配置文件,请确认系统参数[now_yl_row]配置是否存在!"); + //获取上次已分配的排数 + Integer row = Integer.valueOf(now_yl_row.getValue()); + //最多轮询7次map + int tryTime = 7; + while(tryTime>0){ + row = row +1; + if(row>7){ + row = row%7; + } + if(map.containsKey(row)){ + //分配原料入库点位 + SchBasePoint point = pointMapper.findPointByCondition2(regionCode,row); + if(ObjectUtil.isNotEmpty(point)){ + //更新参数排号 + now_yl_row.setValue(row.toString()); + paramService.update(now_yl_row); + return point; + } + }else{ + tryTime = tryTime -1; + } + } + } + return null; + } + + /** + * 根据区域编码查找合适的点位 + * 规则:根据启用的原料缓存区的排号顺序分配,234一共3排, + * 每次记录当前分配的排号到参数表,下次分配前读取参数表上次分配排号 + * @param regionCode + * @return + */ + private SchBasePoint getSchBasePointByYLHC(String regionCode) { + List rowist = pointMapper.findPointRowByCondition(regionCode,0); + if(ObjectUtil.isNotEmpty(rowist)){ + Map map = new HashMap(); + for (PointLeftDto pointLeft : rowist) { + map.put(pointLeft.getRow_num(), pointLeft.getLeft_num()); + } + Param now_ylhc_row = paramService.findByCode(GeneralDefinition.NOW_YLHC_ROW); + Assert.notNull(now_ylhc_row, "找不到配置文件,请确认系统参数[now_ylhc_row]配置是否存在!"); + //获取上次已分配的排数 + Integer row = Integer.valueOf(now_ylhc_row.getValue()); + //最多轮询7次map + int tryTime = 7; + while(tryTime>0){ + row = row +1; + if(row>7){ + row = row%7; + } + if(map.containsKey(row)){ + //分配原料入库点位 + SchBasePoint point = pointMapper.findPointByCondition2(regionCode,row); + if(ObjectUtil.isNotEmpty(point)){ + //更新参数排号 + now_ylhc_row.setValue(row.toString()); + paramService.update(now_ylhc_row); + return point; + } + }else{ + tryTime = tryTime -1; + } + } + } + return null; + } + @Override protected void updateStatus(String task_code, TaskStatus status) { // 校验任务 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.java index 3e8b025..7bf70c7 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.java @@ -3,6 +3,7 @@ package org.nl.wms.sch.task_manage.task.tasks.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.nl.wms.mes.domain.QPMES118ResponseBody; import org.nl.wms.sch.point.service.dao.SchBasePoint; +import org.nl.wms.sch.point.service.dto.PointLeftDto; import java.util.List; @@ -16,6 +17,10 @@ public interface PointMapper extends BaseMapper { List findPointByCondition(String regionCode,String point_status,Integer vehicle_qty); + List findPointRowByCondition(String regionCode, Integer vehicle_qty); + + SchBasePoint findPointByCondition2(String regionCode,Integer row_num); + List findPointByParentPoint(String pointCode); void updatePointStatus(String device_code,String state); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.xml index 0d0ce7e..255458d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/mapper/PointMapper.xml @@ -22,7 +22,38 @@ and p.is_used = 1 AND (p.ing_task_code IS NULL or p.ing_task_code = '') AND (p.vehicle_code2 IS NULL or p.vehicle_code2 = '') - ORDER BY region_code + ORDER BY region_code,p.layer_num,p.row_num,p.col_num + + + + +