From f7b8a02843673c19e21b275d1c54e2a778bfedd4 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 08 四月 2026 11:05:41 +0800
Subject: [PATCH] 相同产品型号的生产订单批号需要唯一
---
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
index 61e1dfc..8b2b427 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
+++ b/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
);
}
/*鏇存柊宸ュ崟鍜岀敓浜ц鍗�*/
--
Gitblit v1.9.3