huminmin
2026-04-07 73e1fe9e92ccd8665ec72803856ab02b17b35a08
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();
@@ -279,7 +288,7 @@
                //直接入库
                String customer = "长治市轴承制造有限公司";
                stockUtils.addStock(productProcessRouteItem.getProductModelId(), productionProductOutput.getQuantity().subtract(productionProductOutput.getScrapQty()),
                        StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(),order.getBatchNo(),customer
                        StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(),order.getBatchNo(),customer,null
                );
            }
            /*更新工单和生产订单*/