opt:优化子卷装箱逻辑

This commit is contained in:
2024-07-05 22:14:15 +08:00
parent 6cc8921e1b
commit b30fb9cfca
4 changed files with 9 additions and 17 deletions

View File

@@ -808,9 +808,9 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
if (CollectionUtils.isEmpty(packagerelationList)) { if (CollectionUtils.isEmpty(packagerelationList)) {
throw new BadRequestException("无选中子卷信息"); throw new BadRequestException("无选中子卷信息");
} }
if (packagerelationList.size() > 1) { // if (packagerelationList.size() > 1) {
throw new BadRequestException("暂时只能选择一个子卷"); // throw new BadRequestException("暂时只能选择一个子卷");
} // }
//检查是否存在已分配规格的子卷号 //检查是否存在已分配规格的子卷号
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList()); List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
if (isOutBox.size() > 0) { if (isOutBox.size() > 0) {
@@ -862,12 +862,12 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
boxInfo.put("device_code", deviceCode); boxInfo.put("device_code", deviceCode);
boxInfo.put("material_code", boxType); boxInfo.put("material_code", boxType);
boxInfo.put("num", workIdList.size()); boxInfo.put("num", workIdList.size());
String boxSn = outBoxManageService.outBox(boxInfo); //String boxSn = outBoxManageService.outBox(boxInfo);
stopWatch.stop(); stopWatch.stop();
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis()); System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis()); log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
//空木箱出库测试 //空木箱出库测试
//String boxSn = "33333"; String boxSn = "MX240702000166";
StopWatch stopWatch1 = new StopWatch(); StopWatch stopWatch1 = new StopWatch();
stopWatch1.start(); stopWatch1.start();
//更新及子卷包装状态已分配规格及木箱规格组 //更新及子卷包装状态已分配规格及木箱规格组
@@ -916,7 +916,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
djqPoints.forEach(r -> { djqPoints.forEach(r -> {
//校验重复任务 //校验重复任务
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, r.getContainer_name()).eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区")) List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, r.getContainer_name()).eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"))
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("")).lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED)); .eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("")).lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()));
if (CollectionUtils.isEmpty(taskList)) { if (CollectionUtils.isEmpty(taskList)) {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区")); jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));

View File

@@ -124,17 +124,14 @@ public class ZxDjwTask extends AbstractAcsTask {
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空载具")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1())); packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空载具")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
//3.判断是否最后一个子卷相同木箱号的子卷包装关系如果生成状态0,且个数等于1且子卷号等于当前载具号就是最后一个子卷 //3.判断是否最后一个子卷相同木箱号的子卷包装关系如果生成状态0,且个数等于1且子卷号等于当前载具号就是最后一个子卷
List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, schBaseTask.getVehicle_code2()).eq(PdmBiSubpackagerelation::getStatus, "0")); List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, schBaseTask.getVehicle_code2()).eq(PdmBiSubpackagerelation::getStatus, "0"));
//所有木箱已装箱 if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(schBaseTask.getVehicle_code())) {
if (CollectionUtils.isEmpty(packagerelationList)) { //4.更改木箱信息为已装箱:1
BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, schBaseTask.getVehicle_code2()).ne(BstIvtBoxinfo::getIs_packing, "1")); BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, schBaseTask.getVehicle_code2()).ne(BstIvtBoxinfo::getIs_packing, "1"));
if (bstIvtBoxinfo == null) { if (bstIvtBoxinfo == null) {
throw new BadRequestException("子卷包装关系为已装箱或找该任务的木箱号不存在!"); throw new BadRequestException("子卷包装关系为已装箱或找该任务的木箱号不存在!");
} }
//4.更改木箱信息为已装箱:1
bstIvtBoxinfo.setIs_packing(IOSEnum.IS_NOTANDYES.code("")); bstIvtBoxinfo.setIs_packing(IOSEnum.IS_NOTANDYES.code(""));
bstIvtBoxinfoMapper.updateById(bstIvtBoxinfo); bstIvtBoxinfoMapper.updateById(bstIvtBoxinfo);
}
if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(schBaseTask.getVehicle_code())) {
//5.最后一个子卷,清除装箱位木箱信息 //5.最后一个子卷,清除装箱位木箱信息
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code2())); packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code2()));
} }

View File

@@ -47,7 +47,7 @@ public class AutoSendVehicleToKzj {
@SneakyThrows @SneakyThrows
public void toKzjHcw() { public void toKzjHcw() {
//存在空载具缓存位无空载具的点位 //存在空载具缓存位无空载具的点位
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), PackageInfoIvtEnum.IVT_STATUS.code(""), PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), PackageInfoIvtEnum.SORT_TYPE.code("降序"), ""); List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), PackageInfoIvtEnum.IVT_STATUS.code(""), PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货分配"), PackageInfoIvtEnum.SORT_TYPE.code("降序"), "");
if (CollectionUtils.isEmpty(kzjIvtList)) { if (CollectionUtils.isEmpty(kzjIvtList)) {
return; return;
} }

View File

@@ -62,15 +62,10 @@ public class TaskQueue {
private void executeTask(SchBaseTask task, String pointCode) { private void executeTask(SchBaseTask task, String pointCode) {
if (task != null) { if (task != null) {
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, task.getTask_id())
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("")).lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()));
//被取消或删除的任务不再执行
//if (CollectionUtils.isEmpty(taskList)) {
task.setPoint_code2(pointCode); task.setPoint_code2(pointCode);
task.setTask_status(TaskStatusEnum.START_AND_POINT.getCode()); task.setTask_status(TaskStatusEnum.START_AND_POINT.getCode());
taskService.updateById(task); taskService.updateById(task);
zxqTask.immediateNotifyAcs(null); zxqTask.immediateNotifyAcs(null);
//}
//同步删除子卷包装关系 //同步删除子卷包装关系
LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PdmBiSubpackagerelation::getContainer_name, task.getVehicle_code()); queryWrapper.eq(PdmBiSubpackagerelation::getContainer_name, task.getVehicle_code());