| | |
| | | waitPakins.forEach(pakin -> { |
| | | BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>() |
| | | .eq(BasContainer::getCode, pakin.getBarcode())); |
| | | if (Objects.isNull(container)) { |
| | | throw new CoolException("容器未维护入库,请维护后再操作!!"); |
| | | } |
| | | /**获取库位*/ |
| | | String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType()); |
| | | if (Cools.isEmpty(targetLoc)) { |
| | |
| | | LocItemWorking locWorking = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>() |
| | | .eq(LocItemWorking::getTaskId, taskItem.getTaskId()) |
| | | .eq(LocItemWorking::getFieldsIndex, taskItem.getFieldsIndex()) |
| | | .eq(StringUtils.isNotBlank(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch()) |
| | | .eq(StringUtils.isNotEmpty(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch()) |
| | | .eq(LocItemWorking::getMatnrId, taskItem.getMatnrId())); |
| | | if (Objects.isNull(locWorking)) { |
| | | throw new CoolException("数据错误,作业中库存数据丢失!!"); |
| | | continue; |
| | | } |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | locWorking.setAnfme(taskItem.getAnfme()); |
| | |
| | | |
| | | tempLocs.forEach(working -> { |
| | | taskItems.forEach(taskItem -> { |
| | | if (taskItem.getMatnrId().equals(working.getMatnrId())) { |
| | | if (taskItem.getFieldsIndex().equals(working.getFieldsIndex())) { |
| | | Double minQty = taskItem.getAnfme(); |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 100) / 100.0; |
| | | minQty = Math.round((working.getAnfme() - taskItem.getQty()) * 100) / 100.0; |
| | | } |
| | | if (minQty.compareTo(0.0) > 0) { |
| | | if (minQty.compareTo(0.0) >= 0) { |
| | | taskItem.setAnfme(minQty); |
| | | if (!taskItemService.updateById(taskItem)) { |
| | | throw new CoolException("任务明细修改失败!!"); |
| | |
| | | .setMatnrCode(working.getMatnrCode()) |
| | | .setSpec(working.getSpec()) |
| | | .setAnfme(working.getAnfme()) |
| | | .setQty(0.0) |
| | | .setBatch(working.getBatch()) |
| | | .setFieldsIndex(working.getFieldsIndex()) |
| | | .setUnit(working.getUnit()) |
| | |
| | | LocItemWorking itemWorking = new LocItemWorking(); |
| | | BeanUtils.copyProperties(taskItem, itemWorking); |
| | | itemWorking.setTaskId(task.getId()) |
| | | .setQty(0.0) |
| | | .setLocId(loc1.getId()) |
| | | .setLocCode(loc1.getCode()); |
| | | workings.add(itemWorking); |
| | |
| | | throw new CoolException("库存状态更新失败!!"); |
| | | } |
| | | |
| | | |
| | | 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>() |
| | | .eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { |
| | | throw new CoolException("库存状态更新失败!!"); |
| | | } |
| | | } else { |
| | | 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("库存状态更新失败!!"); |
| | | } |
| | | // //全板出库,删除临时库存 |
| | | // if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { |
| | | // throw new CoolException("临时库存清除失败!!"); |
| | | // 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>() |
| | | // .eq(Task::getId, task.getId()) |
| | | // .set(Task::getUpdateBy, loginUserId) |
| | | // .set(Task::getUpdateTime, new Date()) |
| | | // .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { |
| | | // throw new CoolException("库存状态更新失败!!"); |
| | | // } |
| | | } |
| | | // } else { |
| | | // 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("库存状态更新失败!!"); |
| | | // } |
| | | //// //全板出库,删除临时库存 |
| | | //// if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { |
| | | //// throw new CoolException("临时库存清除失败!!"); |
| | | //// } |
| | | // } |
| | | |
| | | } |
| | | |