liding
2026-04-07 de7af74a86374d4bcb58df42316f52c3a8add3ce
fix: 生产工单-领料优化
已修改2个文件
13 ■■■■■ 文件已修改
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -292,6 +292,10 @@
                if (drawMaterialDto.getProductModelId() == null) {
                    throw new RuntimeException("产品型号ID不能为空");
                }
                if (drawMaterialDto.getQualitity() == null  || drawMaterialDto.getQualitity().compareTo(BigDecimal.ZERO) == 0) {
                    throw new RuntimeException("产品" + drawMaterialDto.getProductName() + "型号" + drawMaterialDto.getModel()
                     + "批号" + drawMaterialDto.getBatchNo() + "库存不足!");
                }
                stockUtils.substractStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(),
                        StockOutQualifiedRecordTypeEnum.DRAW_MATERIALS_STOCK_OUT.getCode(), productOrderDto.getId(),
                        drawMaterialDto.getBatchNo(),drawMaterialDto.getCustomer());
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -93,6 +93,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean addProductMain(ProductionProductMainDto dto) {
        SysUser user = userMapper.selectUserById(dto.getUserId());
        ProductionProductMain productionProductMain = new ProductionProductMain();
@@ -177,6 +178,12 @@
                Long modelId = drawMaterial.getProductModelId();
                BigDecimal reportQty = drawMaterial.getReportQty();
                if (reportQty != null && reportQty.compareTo(new BigDecimal(0)) == 0) {
                    throw new RuntimeException("产品" + drawMaterial.getProductName() + "- 型号" + drawMaterial.getModel() +
                            "- 批次号=" + drawMaterial.getBatchNo() + "的料已用完,请重新领料");
                }
                String key = drawMaterial.getProductModelId() + "_" +
                        (drawMaterial.getBatchNo() == null ? "" : drawMaterial.getBatchNo()) + "_" +
                        (drawMaterial.getCustomer() == null ? "" : drawMaterial.getCustomer());
@@ -216,6 +223,8 @@
                order.setDrawMaterials(JSON.toJSONString(existingMaterialList));
                productOrderMapper.updateById(order);
            }
        }else {
            throw new RuntimeException("请领取投入材料");
        }
        /*新增报工产出表*/
        ProductionProductOutput productionProductOutput = new ProductionProductOutput();