diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java index ca4fece..bc7a529 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java @@ -136,6 +136,7 @@ public class BPSLTask extends AbstractTask { } if (!"2".equals(schBasePoint.getPoint_type()) && schBasePoint.getVehicle_qty() != 0 && ObjectUtil.isEmpty(schBasePoint.getIng_task_code()) + && schBasePoint.getPoint_code().endsWith("01") && (ObjectUtil.isEmpty(schBasePoint.getVehicle_type()) || materialType.equals(schBasePoint.getVehicle_type()))) { log.info("包片上料任务找到当前符合条件的缓存区位置{}", schBasePoint.getPoint_code()); return schBasePoint; @@ -145,7 +146,7 @@ public class BPSLTask extends AbstractTask { } /** - * 1.取货完毕后起点减少最后一份组盘,并且该组盘视为已结束 + * 1.取货完毕后起点减少所有组盘,并且该组盘视为已结束 * 2.包片机LMS不记录点位信息,由人工对组盘进行操作 */ @Override @@ -160,9 +161,9 @@ public class BPSLTask extends AbstractTask { throw new BadRequestException("该任务已取消!"); } String startPoint = taskObj.getPoint_code1(); // 获取起点 - if (startPoint.startsWith("ZJBDJW")) { - startPoint = startPoint.substring(0, startPoint.length() - 2); - } +// if (startPoint.startsWith("ZJBDJW")) { +// startPoint = startPoint.substring(0, startPoint.length() - 2); +// } String endPoint = taskObj.getPoint_code2(); // 获取终点 SchBasePoint startPointObj = pointService.getById(startPoint); SchBasePoint endPointObj = pointService.getById(endPoint); @@ -173,40 +174,39 @@ public class BPSLTask extends AbstractTask { } if (status.equals(TaskStatus.FINISHED)) { // 完成 List vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList()); - String vehicleCode = vehicleCodeList.get(vehicleCodeList.size() - 1); - SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper() - .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) - .eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, - GroupBindMaterialStatusEnum.BOUND.getValue())); - if (ObjectUtil.isNotEmpty(one)) { + for (String vehicleCode : vehicleCodeList) { + SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper() + .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) + .eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, + GroupBindMaterialStatusEnum.BOUND.getValue())); + if (ObjectUtil.isNotEmpty(one)) { // throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到"); // } - one.setTask_code(taskObj.getTask_code()); - one.setPoint_code(endPointObj.getPoint_code()); // 当前位置 - one.setPoint_name(endPointObj.getPoint_name()); - one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); - one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); - one.setUpdate_id(GeneralDefinition.ACS_ID); - one.setUpdate_name(GeneralDefinition.ACS_NAME); - one.setUpdate_time(DateUtil.now()); - vehiclematerialgroupService.updateById(one); - } - // 起点清空 - if (vehicleCodeList.size() == 1) { - startPointObj.setVehicle_code(""); - } else { - StringBuilder vehicle_code = new StringBuilder(); - for (int i = 0; i <= vehicleCodeList.size() - 2; i++) { - vehicle_code.append(vehicleCodeList.get(i)).append(','); + one.setTask_code(taskObj.getTask_code()); + one.setPoint_code(endPointObj.getPoint_code()); // 当前位置 + one.setPoint_name(endPointObj.getPoint_name()); + one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); + one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); + one.setUpdate_id(GeneralDefinition.ACS_ID); + one.setUpdate_name(GeneralDefinition.ACS_NAME); + one.setUpdate_time(DateUtil.now()); + vehiclematerialgroupService.updateById(one); } - startPointObj.setVehicle_code(vehicle_code.toString()); } - if (!startPointObj.getPoint_code().startsWith("ZJBDJW")) { - startPointObj.setVehicle_qty(startPointObj.getVehicle_qty() - 1); + // 起点清空 + // 起点解锁,当前三个点位全部清空 + for(int i=1;i<=3;i++) { + SchBasePoint point = pointService.getById(endPoint.substring(0,endPoint.length()-1)+i); + point.setIng_task_code(""); + point.setVehicle_code("0"); + point.setVehicle_qty(0); + point.setUpdate_time(DateUtil.now()); + point.setIng_task_code(""); + pointService.update(point); } - startPointObj.setIng_task_code(""); - startPointObj.setUpdate_time(DateUtil.now()); - pointService.updateById(startPointObj); +// if (!startPointObj.getPoint_code().startsWith("ZJBDJW")) { +// startPointObj.setVehicle_qty(startPointObj.getVehicle_qty() - 1); +// } //包片上料完毕后,整排打上记号只允许包片上料 pointMapper.updatePointType(endPointObj.getPoint_code().substring(0, endPointObj.getPoint_code().length() - 2), "1"); // 任务完成 @@ -249,18 +249,18 @@ public class BPSLTask extends AbstractTask { //重算最优点 JSONObject jsonObject = JSONObject.parseObject(schBaseTask.getExt_group_data()); SchBasePoint point = this.findNextPoint(jsonObject, schBaseTask); - //正极板两种情况,任务没分配就是点位高度,如果已分配则已减掉,所以重复请求需要加回去,多次变动太恶心了待优化 - if ("1".equals(jsonObject.getString("material_type")) && ObjectUtil.isEmpty(point.getIng_task_code())) { - schBaseTask.setPoint_code1(point.getPoint_code() + "0" + (point.getVehicle_qty())); - } else if ("1".equals(jsonObject.getString("material_type")) && ObjectUtil.isNotEmpty(point.getIng_task_code())) { - schBaseTask.setPoint_code1(point.getPoint_code() + "0" + (point.getVehicle_qty() + 1)); - } else { - schBaseTask.setPoint_code1(point.getPoint_code().replace("HCQ", "QHQ")); - } - //如果是正极板对接位则直接减库存 - if ((point.getPoint_code().startsWith("ZJBDJW")) && ObjectUtil.isEmpty(point.getIng_task_code())) { - point.setVehicle_qty(point.getVehicle_qty() - 1); - } +// //正极板两种情况,任务没分配就是点位高度,如果已分配则已减掉,所以重复请求需要加回去,多次变动太恶心了待优化 +// if ("1".equals(jsonObject.getString("material_type")) && ObjectUtil.isEmpty(point.getIng_task_code())) { +// schBaseTask.setPoint_code1(point.getPoint_code() + "0" + (point.getVehicle_qty())); +// } else if ("1".equals(jsonObject.getString("material_type")) && ObjectUtil.isNotEmpty(point.getIng_task_code())) { +// schBaseTask.setPoint_code1(point.getPoint_code() + "0" + (point.getVehicle_qty() + 1)); +// } else { +// schBaseTask.setPoint_code1(point.getPoint_code().replace("HCQ", "QHQ")); +// } +// //如果是正极板对接位则直接减库存 +// if ((point.getPoint_code().startsWith("ZJBDJW")) && ObjectUtil.isEmpty(point.getIng_task_code())) { +// point.setVehicle_qty(point.getVehicle_qty() - 1); +// } //重算点位时把点位占用 point.setIng_task_code(schBaseTask.getTask_code());