| | |
| | | // 第七步-1:投入数量强制取前端传入的 bomInputQty |
| | | BigDecimal inputBaseQty = bomInputQty; |
| | | |
| | | // 第七步-2:光检外观和包装工序不扣减库存 |
| | | String currentProcessName = productProcess.getName() == null ? "" : productProcess.getName().trim(); |
| | | boolean shouldSkipStockDeduction = PROCESS_OPTICAL_INSPECTION.equals(currentProcessName) |
| | | || PROCESS_PACKAGING.equals(currentProcessName); |
| | | |
| | | for (ProductStructureDto productStructureDto : productStructureDtos) { |
| | | if (productStructureDto.getProductModelId() == null) { |
| | | throw new ServiceException("投入物料产品型号不能为空"); |
| | |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInputMapper.insert(productionProductInput); |
| | | |
| | | stockUtils.substractStock( |
| | | productStructureDto.getProductModelId(), |
| | | needQty, |
| | | StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode(), |
| | | productionProductMain.getId(), |
| | | null, |
| | | null |
| | | ); |
| | | if (!shouldSkipStockDeduction) { |
| | | stockUtils.substractStock( |
| | | productStructureDto.getProductModelId(), |
| | | needQty, |
| | | StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode(), |
| | | productionProductMain.getId(), |
| | | null, |
| | | null |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 第八步:写产出记录并计算本次合格数量 |
| | |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |