| | |
| | | try { |
| | | // 根据任务类型更新库位明细 |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { |
| | | // 全版出库:删除所有库位明细 |
| | | subtractLocItem(loc); |
| | | // 全版出库:不删除库位明细,等待PDA快速拣货确认时再删除 |
| | | // subtractLocItem(loc); // 已移除,改为在completeFullOutStock中删除 |
| | | } else { |
| | | // 部分出库(如拣料出库):根据TaskItem数量扣减库位明细 |
| | | subtractLocItemByTaskItems(loc, taskItems, loginUserId); |
| | |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // 根据任务类型更新库位状态 |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | /**修改为库位状态为S.预约入库,保留原有库位*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | |
| | | .eq(Loc::getId, loc.getId()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { |
| | | // 全版出库:不更新库位状态为O,等待PDA快速拣货确认时再更新 |
| | | // 库位状态保持原样(R.出库预约状态) |
| | | } else { |
| | | /**修改为库位状态为O.空库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | |
| | | throw new CoolException("库位不存在!!"); |
| | | } |
| | | LocItem item = new LocItem(); |
| | | LocItem locItem = locItemService.getOne(new LambdaQueryWrapper<LocItem>() |
| | | // 构建查询条件:需要同时匹配物料ID、库位ID、批次和票号 |
| | | LambdaQueryWrapper<LocItem> locItemWrapper = new LambdaQueryWrapper<LocItem>() |
| | | .eq(LocItem::getMatnrId, taskItem.getMatnrId()) |
| | | .eq(LocItem::getLocId, loc.getId()) |
| | | .eq(StringUtils.isNotBlank(taskItem.getBatch()), LocItem::getBatch, taskItem.getBatch()) |
| | | .eq(StringUtils.isNotBlank(taskItem.getFieldsIndex()), LocItem::getFieldsIndex, taskItem.getFieldsIndex()) |
| | | ); |
| | | .eq(LocItem::getLocId, loc.getId()); |
| | | |
| | | // 批次匹配:如果taskItem有批次,则必须匹配;如果taskItem没有批次,则查询批次为null或空字符串的记录 |
| | | if (StringUtils.isNotBlank(taskItem.getBatch())) { |
| | | locItemWrapper.eq(LocItem::getBatch, taskItem.getBatch()); |
| | | } else { |
| | | locItemWrapper.and(wrapper -> wrapper.isNull(LocItem::getBatch).or().eq(LocItem::getBatch, "")); |
| | | } |
| | | |
| | | // 票号匹配:如果taskItem有票号,则必须匹配;如果taskItem没有票号,则查询票号为null或空字符串的记录 |
| | | if (StringUtils.isNotBlank(taskItem.getFieldsIndex())) { |
| | | locItemWrapper.eq(LocItem::getFieldsIndex, taskItem.getFieldsIndex()); |
| | | } else { |
| | | locItemWrapper.and(wrapper -> wrapper.isNull(LocItem::getFieldsIndex).or().eq(LocItem::getFieldsIndex, "")); |
| | | } |
| | | |
| | | LocItem locItem = locItemService.getOne(locItemWrapper); |
| | | if (Objects.isNull(locItem)) { |
| | | // 库位明细不存在,创建新的库位明细 |
| | | BeanUtils.copyProperties(taskItem, item); |