| | |
| | | if (!this.save(task)) { |
| | | throw new CoolException("任务保存失败!!"); |
| | | } |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) { |
| | | throw new CoolException("库位预约失败!!"); |
| | | } |
| | | updateLocByCode(task.getTargLoc(), LocStsType.LOC_STS_TYPE_S.type, pakin.getBarcode(), null, "库位预约失败!!", true); |
| | | /**获取组拖明细**/ |
| | | List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, pakin.getId())); |
| | | if (waitPakinItems.isEmpty()) { |
| | |
| | | TaskItem taskItem = new TaskItem(); |
| | | BeanUtils.copyProperties(item, taskItem); |
| | | taskItem.setTaskId(task.getId()) |
| | | .setOrderType(OrderType.ORDER_IN.type) |
| | | .setOrderType(item.getType().equals(OrderType.ORDER_PRE.type)?OrderType.ORDER_PRE.type:OrderType.ORDER_IN.type) |
| | | .setSource(item.getId()) |
| | | .setTrackCode(item.getTrackCode()) |
| | | .setCreateBy(loginUserId) |
| | |
| | | }); |
| | | }); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | | .in(WaitPakin::getId, pakins.getId()) |
| | | .set(WaitPakin::getUpdateBy, loginUserId) |
| | | .set(WaitPakin::getCreateBy, loginUserId) |
| | | .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val))) { |
| | | throw new CoolException("组托状态修改失败!!"); |
| | | } |
| | | updateWaitPakinsStatus(waitPakins, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val, loginUserId, true, "组托状态修改失败!!"); |
| | | return R.ok("任务生成完毕!"); |
| | | } |
| | | |
| | |
| | | if (!this.save(task)) { |
| | | throw new CoolException("任务保存失败!!"); |
| | | } |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getTargLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .set(Loc::getBarcode, pakin.getBarcode()))) { |
| | | throw new CoolException("库位预约失败!!"); |
| | | } |
| | | updateLocByCode(task.getTargLoc(), LocStsType.LOC_STS_TYPE_S.type, pakin.getBarcode(), loginUserId, "库位预约失败!!", true); |
| | | /**获取组拖明细**/ |
| | | List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, pakin.getId())); |
| | | if (waitPakinItems.isEmpty()) { |
| | |
| | | }); |
| | | }); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | | .in(WaitPakin::getId, pakins.getId()) |
| | | .set(WaitPakin::getUpdateBy, loginUserId) |
| | | .set(WaitPakin::getCreateBy, loginUserId) |
| | | .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val))) { |
| | | throw new CoolException("组拖状态修改失败!!"); |
| | | } |
| | | updateWaitPakinsStatus(waitPakins, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val, loginUserId, true, "组拖状态修改失败!!"); |
| | | return R.ok("任务生成完毕!"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) { |
| | | throw new CoolException("库位预约失败!!"); |
| | | } |
| | | updateLocByCode(task.getTargLoc(), LocStsType.LOC_STS_TYPE_S.type, pakin.getBarcode(), null, "库位预约失败!!", true); |
| | | /**获取组拖明细**/ |
| | | List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, pakin.getId())); |
| | | if (waitPakinItems.isEmpty()) { |
| | |
| | | }); |
| | | }); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | | .in(WaitPakin::getId, ids) |
| | | .set(WaitPakin::getUpdateBy, loginUserId) |
| | | .set(WaitPakin::getCreateBy, loginUserId) |
| | | .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val))) { |
| | | throw new CoolException("组拖状态修改失败!!"); |
| | | } |
| | | updateWaitPakinsStatus(waitPakins, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val, loginUserId, true, "组拖状态修改失败!!"); |
| | | return R.ok("任务生成完毕!"); |
| | | } |
| | | |
| | |
| | | throw new CoolException("任务保存失败!!"); |
| | | } |
| | | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) { |
| | | throw new CoolException("库位预约失败!!"); |
| | | } |
| | | updateLocByCode(task.getTargLoc(), LocStsType.LOC_STS_TYPE_S.type, pakin.getBarcode(), null, "库位预约失败!!", true); |
| | | /**获取组拖明细**/ |
| | | List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, pakin.getId())); |
| | | if (waitPakinItems.isEmpty()) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | | .in(WaitPakin::getId, ids) |
| | | .set(WaitPakin::getUpdateBy, loginUserId) |
| | | .set(WaitPakin::getCreateBy, loginUserId) |
| | | .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val))) { |
| | | throw new CoolException("组拖状态修改失败!!"); |
| | | } |
| | | updateWaitPakinsStatus(waitPakins, PakinIOStatus.PAKIN_IO_STATUS_TASK_EXCE.val, loginUserId, true, "组拖状态修改失败!!"); |
| | | return R.ok("任务生成完毕!"); |
| | | } |
| | | String msg = "未找库位" + Arrays.toString(errMsg); |
| | |
| | | } |
| | | |
| | | /**修改库位状态为F.在库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, task.getBarcode()) |
| | | .set(Loc::getUseStatus, type) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getCode, task.getTargLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | updateLocByCode(task.getTargLoc(), type, task.getBarcode(), loginUserId, "库位状态修改失败!!", true); |
| | | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .eq(Loc::getCode, task.getOrgLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | updateLocByCode(task.getOrgLoc(), LocStsType.LOC_STS_TYPE_O.type, null, loginUserId, "库位状态修改失败!!", true); |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | updateTaskSnapshot(task, TaskStsType.UPDATED_IN.id, loginUserId, "任务状态修改失败!!"); |
| | | |
| | | } |
| | | |
| | |
| | | for (Task task : tasks) { |
| | | //取消移库任务 |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) && task.getTaskStatus().equals(TaskStsType.GENERATE_IN.id)) { |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | | throw new CoolException("源库位状态修改失败!!"); |
| | | } |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getTargLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { |
| | | throw new CoolException("移库目标库位状态修改失败!!"); |
| | | } |
| | | updateLocByCode(task.getOrgLoc(), LocStsType.LOC_STS_TYPE_F.type, null, null, "源库位状态修改失败!!", false); |
| | | updateLocByCode(task.getTargLoc(), LocStsType.LOC_STS_TYPE_O.type, null, null, "移库目标库位状态修改失败!!", false); |
| | | |
| | | Task outTask = this.getById(task.getParentId()); |
| | | if (!Objects.isNull(outTask)) { |
| | |
| | | throw new CoolException("明细数量修改失败!!"); |
| | | } |
| | | |
| | | if (!checkOrderService.update(new LambdaUpdateWrapper<WkOrder>() |
| | | .eq(WkOrder::getId, taskItem.getOrderId()) |
| | | .setSql("work_qty = work_qty - " + taskItem.getAnfme()))) { |
| | | throw new CoolException("盘点单执行数量修改失败!!"); |
| | | } |
| | | updateWkOrderWorkQty(taskItem.getOrderId(), -taskItem.getAnfme(), null, "盘点单执行数量修改失败!!"); |
| | | |
| | | CheckDiffItem serviceOne = checkDiffItemService.getOne(new LambdaQueryWrapper<CheckDiffItem>().eq(CheckDiffItem::getTaskItemId, taskItem.getId())); |
| | | |
| | |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | for (Long orderId : orderIds) { |
| | | checkOrderService.update(new LambdaUpdateWrapper<WkOrder>() |
| | | .eq(WkOrder::getId, orderId) |
| | | .set(WkOrder::getExceStatus, CheckExceStatus.CHECK_ORDER_STATUS_UN_EXCE.val)); |
| | | updateWkOrderExceStatus(orderId, CheckExceStatus.CHECK_ORDER_STATUS_UN_EXCE.val, null, "盘点单状态修改失败!!"); |
| | | } |
| | | } |
| | | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | | throw new CoolException("源库位状态修改失败!!"); |
| | | } |
| | | updateLocByCode(task.getOrgLoc(), LocStsType.LOC_STS_TYPE_F.type, null, null, "源库位状态修改失败!!", false); |
| | | } |
| | | |
| | | // 出库类任务取消时,回退路径规划阶段占用的目标站点(S→O) |
| | |
| | | } |
| | | |
| | | /**修改为库位状态为O.空库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getId, loc.getId()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | updateLocSnapshot(loc, LocStsType.LOC_STS_TYPE_O.type, null, loginUserId, "库位状态修改失败!!", true); |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>() |
| | | .eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { |
| | | throw new CoolException("库存状态更新失败!!"); |
| | | } |
| | | updateTaskSnapshot(task, TaskStsType.WAVE_SEED.id, loginUserId, "库存状态更新失败!!"); |
| | | |
| | | // if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | // if (!this.update(new LambdaUpdateWrapper<Task>() |
| | |
| | | } |
| | | |
| | | /**修改为库位状态为O.空库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getId, loc.getId()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | updateLocSnapshot(loc, LocStsType.LOC_STS_TYPE_O.type, null, loginUserId, "库位状态修改失败!!", true); |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>() |
| | | .eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTaskStatus, TaskStsType.UPDATED_OUT.id))) { |
| | | throw new CoolException("库存状态更新失败!!"); |
| | | } |
| | | updateTaskSnapshot(task, TaskStsType.UPDATED_OUT.id, loginUserId, "库存状态更新失败!!"); |
| | | |
| | | // if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | // if (!this.update(new LambdaUpdateWrapper<Task>() |
| | |
| | | } |
| | | |
| | | /**修改为库位状态为O.空库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type) |
| | | .set(Loc::getBarcode, loc.getBarcode()) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getId, loc.getId()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | updateLocSnapshot(loc, LocStsType.LOC_STS_TYPE_S.type, loc.getBarcode(), loginUserId, "库位状态修改失败!!", true); |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>() |
| | | .eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTargLoc, task.getOrgLoc()) |
| | | .set(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id))) { |
| | | Task update = new Task(); |
| | | update.setId(task.getId()); |
| | | update.setVersion(task.getVersion()); |
| | | update.setUpdateBy(loginUserId); |
| | | update.setUpdateTime(new Date()); |
| | | update.setTargLoc(task.getOrgLoc()); |
| | | update.setTaskStatus(TaskStsType.COMPLETE_IN.id); |
| | | if (!this.updateById(update)) { |
| | | throw new CoolException("库存状态更新失败!!"); |
| | | } |
| | | task.setUpdateBy(loginUserId); |
| | | task.setUpdateTime(update.getUpdateTime()); |
| | | task.setTargLoc(task.getOrgLoc()); |
| | | task.setTaskStatus(TaskStsType.COMPLETE_IN.id); |
| | | if (update.getVersion() != null) { |
| | | task.setVersion(update.getVersion()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /**修改为库位状态为O.空库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getId, loc.getId()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | updateLocSnapshot(loc, LocStsType.LOC_STS_TYPE_O.type, null, loginUserId, "库位状态修改失败!!", true); |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>() |
| | | .eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTaskStatus, TaskStsType.UPDATED_OUT.id))) { |
| | | throw new CoolException("库存状态更新失败!!"); |
| | | } |
| | | updateTaskSnapshot(task, TaskStsType.UPDATED_OUT.id, loginUserId, "库存状态更新失败!!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) |
| | | .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | updateTaskSnapshot(task, TaskStsType.WCS_EXECUTE_IN.id, null, "任务状态修改失败!!"); |
| | | /**排除移库功能*/ |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | /**如果是普通站点,修改站点状态为出库预约*/ |
| | |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) |
| | | .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_OUT.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | updateTaskSnapshot(task, TaskStsType.WCS_EXECUTE_OUT.id, null, "任务状态修改失败!!"); |
| | | /**如果是普通站点,修改站点状态为入库预约*/ |
| | | if (curSta.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | curSta.setUseStatus(LocStsType.LOC_STS_TYPE_S.type); |
| | |
| | | removeReceiptStock(pakinItem, loginUserId); |
| | | }); |
| | | /**修改库位状态为F.在库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).eq(Loc::getCode, task.getTargLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | updateLocByCode(task.getTargLoc(), LocStsType.LOC_STS_TYPE_F.type, null, null, "库位状态修改失败!!", false); |
| | | updateTaskSnapshot(task, TaskStsType.UPDATED_IN.id, null, "任务状态修改失败!!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /**修改库位状态为"D", "空板"*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type).eq(Loc::getCode, task.getTargLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | updateLocByCode(task.getTargLoc(), LocStsType.LOC_STS_TYPE_D.type, null, null, "库位状态修改失败!!", false); |
| | | updateTaskSnapshot(task, TaskStsType.UPDATED_IN.id, null, "任务状态修改失败!!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized void removeReceiptStock(WaitPakinItem pakinItem, Long loginUserId) { |
| | | WarehouseAreasItem itemServiceOne = warehouseAreasItemService.getOne(new LambdaQueryWrapper<WarehouseAreasItem>() |
| | | .eq(WarehouseAreasItem::getId, pakinItem.getSource())); |
| | | if (Objects.isNull(itemServiceOne)) { |
| | | log.error("数据错误:请查看请货区库存是否存在!!"+pakinItem.getPakinId()); |
| | | return; |
| | | if (pakinItem.getType().equals(OrderType.ORDER_PRE.type)){ |
| | | updateWaitPakinById(pakinItem.getPakinId(), PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val, loginUserId, "组拖状态修改失败!!"); |
| | | }else { |
| | | WarehouseAreasItem itemServiceOne = warehouseAreasItemService.getOne(new LambdaQueryWrapper<WarehouseAreasItem>() |
| | | .eq(WarehouseAreasItem::getId, pakinItem.getSource())); |
| | | if (Objects.isNull(itemServiceOne)) { |
| | | log.error("数据错误:请查看请货区库存是否存在!!"+pakinItem.getPakinId()); |
| | | return; |
| | | // throw new CoolException("!"); |
| | | // throw new CoolException("数据错误:请查看请货区库存是否存在!!"); |
| | | } |
| | | Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 1000000) / 1000000.0; |
| | | Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 1000000) / 1000000.0; |
| | | itemServiceOne.setWorkQty(workQty).setQty(qty); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | | .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val) |
| | | .set(WaitPakin::getUpdateBy, loginUserId) |
| | | .eq(WaitPakin::getId, pakinItem.getPakinId()))) { |
| | | throw new CoolException("组拖状态修改失败!!"); |
| | | } |
| | | |
| | | if (qty.compareTo(itemServiceOne.getAnfme()) == 0.00) { |
| | | if (!warehouseAreasItemService.removeById(itemServiceOne.getId())) { |
| | | throw new CoolException("收货区物料删除失败!!"); |
| | | } |
| | | } else { |
| | | itemServiceOne.setUpdateBy(loginUserId).setUpdateTime(null); |
| | | if (!warehouseAreasItemService.updateById(itemServiceOne)) { |
| | | throw new CoolException("收货区库完成数量修改失败!!"); |
| | | Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 1000000) / 1000000.0; |
| | | Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 1000000) / 1000000.0; |
| | | itemServiceOne.setWorkQty(workQty).setQty(qty); |
| | | |
| | | updateWaitPakinById(pakinItem.getPakinId(), PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val, loginUserId, "组拖状态修改失败!!"); |
| | | |
| | | if (qty.compareTo(itemServiceOne.getAnfme()) == 0.00) { |
| | | if (!warehouseAreasItemService.removeById(itemServiceOne.getId())) { |
| | | throw new CoolException("收货区物料删除失败!!"); |
| | | } |
| | | } else { |
| | | itemServiceOne.setUpdateBy(loginUserId).setUpdateTime(null); |
| | | if (!warehouseAreasItemService.updateById(itemServiceOne)) { |
| | | throw new CoolException("收货区库完成数量修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void updateLocByCode(String locCode, String useStatus, String barcode, Long loginUserId, String errorMessage, boolean updateBarcode) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode), false); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("库位不存在!!"); |
| | | } |
| | | updateLocSnapshot(loc, useStatus, barcode, loginUserId, errorMessage, updateBarcode); |
| | | } |
| | | |
| | | private void updateLocSnapshot(Loc loc, String useStatus, String barcode, Long loginUserId, String errorMessage, boolean updateBarcode) { |
| | | Loc update = new Loc(); |
| | | update.setId(loc.getId()); |
| | | update.setVersion(loc.getVersion()); |
| | | update.setUseStatus(useStatus); |
| | | if (updateBarcode) { |
| | | update.setBarcode(barcode); |
| | | } |
| | | if (loginUserId != null) { |
| | | update.setUpdateBy(loginUserId); |
| | | update.setUpdateTime(new Date()); |
| | | } |
| | | if (!locService.updateById(update)) { |
| | | throw new CoolException(errorMessage); |
| | | } |
| | | loc.setUseStatus(useStatus); |
| | | if (updateBarcode) { |
| | | loc.setBarcode(barcode); |
| | | } |
| | | if (loginUserId != null) { |
| | | loc.setUpdateBy(loginUserId); |
| | | loc.setUpdateTime(update.getUpdateTime()); |
| | | } |
| | | if (update.getVersion() != null) { |
| | | loc.setVersion(update.getVersion()); |
| | | } |
| | | } |
| | | |
| | | private void updateWaitPakinById(Long pakinId, Short ioStatus, Long loginUserId, String errorMessage) { |
| | | WaitPakin waitPakin = waitPakinService.getById(pakinId); |
| | | if (Objects.isNull(waitPakin)) { |
| | | throw new CoolException("组拖不存在!!"); |
| | | } |
| | | updateWaitPakinSnapshot(waitPakin, ioStatus, loginUserId, false, errorMessage); |
| | | } |
| | | |
| | | private void updateWaitPakinsStatus(List<WaitPakin> waitPakins, Short ioStatus, Long loginUserId, boolean updateCreateBy, String errorMessage) { |
| | | for (WaitPakin waitPakin : waitPakins) { |
| | | updateWaitPakinSnapshot(waitPakin, ioStatus, loginUserId, updateCreateBy, errorMessage); |
| | | } |
| | | } |
| | | |
| | | private void updateWaitPakinSnapshot(WaitPakin waitPakin, Short ioStatus, Long loginUserId, boolean updateCreateBy, String errorMessage) { |
| | | WaitPakin update = new WaitPakin(); |
| | | update.setId(waitPakin.getId()); |
| | | update.setVersion(waitPakin.getVersion()); |
| | | update.setIoStatus(ioStatus); |
| | | if (updateCreateBy && loginUserId != null) { |
| | | update.setCreateBy(loginUserId); |
| | | } |
| | | if (loginUserId != null) { |
| | | update.setUpdateBy(loginUserId); |
| | | update.setUpdateTime(new Date()); |
| | | } |
| | | if (!waitPakinService.updateById(update)) { |
| | | throw new CoolException(errorMessage); |
| | | } |
| | | waitPakin.setIoStatus(ioStatus); |
| | | if (loginUserId != null) { |
| | | waitPakin.setUpdateBy(loginUserId); |
| | | waitPakin.setUpdateTime(update.getUpdateTime()); |
| | | } |
| | | if (update.getVersion() != null) { |
| | | waitPakin.setVersion(update.getVersion()); |
| | | } |
| | | } |
| | | |
| | | private void updateWkOrderExceStatus(Long orderId, Short exceStatus, Long loginUserId, String errorMessage) { |
| | | WkOrder order = checkOrderService.getById(orderId); |
| | | if (Objects.isNull(order)) { |
| | | return; |
| | | } |
| | | WkOrder update = new WkOrder(); |
| | | update.setId(order.getId()); |
| | | update.setVersion(order.getVersion()); |
| | | update.setExceStatus(exceStatus); |
| | | if (loginUserId != null) { |
| | | update.setUpdateBy(loginUserId); |
| | | update.setUpdateTime(new Date()); |
| | | } |
| | | if (!checkOrderService.updateById(update)) { |
| | | throw new CoolException(errorMessage); |
| | | } |
| | | order.setExceStatus(exceStatus); |
| | | if (loginUserId != null) { |
| | | order.setUpdateBy(loginUserId); |
| | | order.setUpdateTime(update.getUpdateTime()); |
| | | } |
| | | if (update.getVersion() != null) { |
| | | order.setVersion(update.getVersion()); |
| | | } |
| | | } |
| | | |
| | | private void updateWkOrderWorkQty(Long orderId, Double delta, Long loginUserId, String errorMessage) { |
| | | WkOrder order = checkOrderService.getById(orderId); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("盘点单不存在!!"); |
| | | } |
| | | double currentWorkQty = Objects.isNull(order.getWorkQty()) ? 0.0 : order.getWorkQty(); |
| | | double nextWorkQty = Math.round((currentWorkQty + delta) * 10000) / 10000.0; |
| | | |
| | | WkOrder update = new WkOrder(); |
| | | update.setId(order.getId()); |
| | | update.setVersion(order.getVersion()); |
| | | update.setWorkQty(nextWorkQty); |
| | | if (loginUserId != null) { |
| | | update.setUpdateBy(loginUserId); |
| | | update.setUpdateTime(new Date()); |
| | | } |
| | | if (!checkOrderService.updateById(update)) { |
| | | throw new CoolException(errorMessage); |
| | | } |
| | | order.setWorkQty(nextWorkQty); |
| | | if (loginUserId != null) { |
| | | order.setUpdateBy(loginUserId); |
| | | order.setUpdateTime(update.getUpdateTime()); |
| | | } |
| | | if (update.getVersion() != null) { |
| | | order.setVersion(update.getVersion()); |
| | | } |
| | | } |
| | | |
| | | private void updateTaskSnapshot(Task task, Integer taskStatus, Long loginUserId, String errorMessage) { |
| | | Task update = new Task(); |
| | | update.setId(task.getId()); |
| | | update.setVersion(task.getVersion()); |
| | | update.setTaskStatus(taskStatus); |
| | | if (loginUserId != null) { |
| | | update.setUpdateBy(loginUserId); |
| | | update.setUpdateTime(new Date()); |
| | | } |
| | | if (!this.updateById(update)) { |
| | | throw new CoolException(errorMessage); |
| | | } |
| | | task.setTaskStatus(taskStatus); |
| | | if (loginUserId != null) { |
| | | task.setUpdateBy(loginUserId); |
| | | task.setUpdateTime(update.getUpdateTime()); |
| | | } |
| | | if (update.getVersion() != null) { |
| | | task.setVersion(update.getVersion()); |
| | | } |
| | | } |
| | | } |