| | |
| | | Long batchId = batch != null ? batch.getId() : null; |
| | | String batchCode = batch != null ? batch.getCode() : null; |
| | | |
| | | // 1.5 优先使用工艺路线产品绑定的报工仓库;历史数据未配置时回退虚拟线边库。 |
| | | WarehouseTarget outputTarget = resolveOutputTarget(feedback.getItemId()); |
| | | // 1.5 优先使用工单工序配置的报工仓库(下单时可编辑),其次工艺路线产品,最后回退虚拟线边库 |
| | | WarehouseTarget outputTarget = resolveOutputTarget(feedback.getWorkOrderId(), |
| | | feedback.getProcessId(), feedback.getItemId()); |
| | | |
| | | // 3. 根据是否需要检验分支处理 |
| | | if (checkFlag) { |
| | |
| | | } |
| | | // 2. 通过 sourceLineId 直接定位待检验行 |
| | | MesWmProductProduceLineDO pendingLine = productProduceLineService.validateProductProduceLineExists(sourceLineId); |
| | | WarehouseTarget outputTarget = resolveOutputTarget(pendingLine.getItemId()); |
| | | WarehouseTarget outputTarget = resolveOutputTarget(produce.getWorkOrderId(), |
| | | produce.getProcessId(), pendingLine.getItemId()); |
| | | |
| | | // 3A. 情况一:存在不合格品数量,需要拆分行 |
| | | if (unqualifiedQty != null && unqualifiedQty.compareTo(BigDecimal.ZERO) > 0) { |
| | |
| | | finishProductProduce(produce.getId()); |
| | | } |
| | | |
| | | private WarehouseTarget resolveOutputTarget(Long itemId) { |
| | | private WarehouseTarget resolveOutputTarget(Long workOrderId, Long processId, Long itemId) { |
| | | // 1. 工单工序配置(下单时可编辑) |
| | | if (workOrderId != null && processId != null) { |
| | | MesProWorkOrderProcessDO workOrderProcess = workOrderProcessService |
| | | .getWorkOrderProcessByWorkOrderIdAndProcessId(workOrderId, processId); |
| | | if (workOrderProcess != null && workOrderProcess.getWarehouseId() != null |
| | | && workOrderProcess.getLocationId() != null && workOrderProcess.getAreaId() != null) { |
| | | areaService.validateWarehouseAreaExists(workOrderProcess.getWarehouseId(), |
| | | workOrderProcess.getLocationId(), workOrderProcess.getAreaId()); |
| | | return new WarehouseTarget(workOrderProcess.getWarehouseId(), |
| | | workOrderProcess.getLocationId(), workOrderProcess.getAreaId()); |
| | | } |
| | | } |
| | | // 2. 工艺路线产品配置 |
| | | MesProRouteProductDO routeProduct = itemId != null |
| | | ? routeProductService.getRouteProductByItemId(itemId) : null; |
| | | if (routeProduct != null && routeProduct.getWarehouseId() != null |