| | |
| | | return R.ok(locItems); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderOutItemDto> getOrderOutTaskItemAuto(OrderOutTaskParam param) { |
| | | if (Cools.isEmpty(param.getWaveId())) { |
| | | throw new CoolException("策略参数为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getOrderId())) { |
| | | throw new CoolException("单据ID为空"); |
| | | } |
| | | WaveRule waveRule = waveRuleService.getOne(new LambdaQueryWrapper<WaveRule>() |
| | | .eq(WaveRule::getId, param.getWaveId())); |
| | | if (Cools.isEmpty(waveRule)) { |
| | | throw new CoolException("未找到当前策略"); |
| | | } |
| | | List<OrderOutItemDto> locItems = null; |
| | | locItems = getOutOrderList(param.getOrderId(), waveRule); |
| | | return locItems; |
| | | } |
| | | |
| | | /** |
| | | * 生成出库任务 |
| | | * |
| | |
| | | return LocUtils.isShallowLoc(item.getLocCode()) ? 1 : 0; |
| | | }).reversed()).collect(Collectors.toList()); |
| | | |
| | | WkOrder wkOrder = outStockService.getById(outId); |
| | | if (Cools.isEmpty(wkOrder)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | |
| | | for (OutStockToTaskParams param : Items) { |
| | | if (Objects.isNull(param) || StringUtils.isBlank(param.getLocCode())) { |
| | | continue; |
| | |
| | | |
| | | WkOrderItem orderItem = outStockItemService.getOne(new LambdaQueryWrapper<WkOrderItem>() |
| | | .eq(WkOrderItem::getOrderId, outId) |
| | | .eq(StringUtils.isNotBlank(locItem.getBatch()), WkOrderItem::getSplrBatch, locItem.getBatch()) |
| | | .eq(StringUtils.isNotBlank(locItem.getFieldsIndex()), WkOrderItem::getFieldsIndex, locItem.getFieldsIndex()) |
| | | // .eq(StringUtils.isNotBlank(locItem.getBatch()), WkOrderItem::getSplrBatch, locItem.getBatch()) |
| | | .eq(WkOrderItem::getMatnrId, locItem.getMatnrId())); |
| | | // .eq(StringUtils.isNotBlank(locItem.getFieldsIndex()), WkOrderItem::getFieldsIndex, locItem.getFieldsIndex()) |
| | | |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | |
| | | .setItems(locItems) |
| | | .setSourceId(outId) |
| | | .setSiteNo(param.getSiteNo()); |
| | | //增加备货出库类型判断 |
| | | Short type = wkOrder.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_STOCK_UP.type) |
| | | ?TaskResouceType.TASK_RESOUCE_STOCK_UP.val |
| | | :TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val; |
| | | try { |
| | | //生成出库任务 |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val, taskParams, loginUserId); |
| | | locItemService.generateTask(type, taskParams, loginUserId); |
| | | } catch (Exception e) { |
| | | logger.error("UNK", e); |
| | | throw new CoolException(e.getMessage()); |