From 804b34fb9d6735c434ff0ee69fe3d2c7c4292298 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 14 五月 2026 09:12:34 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_西宁_青铝绿行
---
src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
index 598ae6b..6151f2b 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
@@ -7,6 +7,7 @@
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.production.bean.dto.ProductionOrderPickDto;
import com.ruoyi.production.bean.vo.ProductionOrderPickVo;
@@ -430,7 +431,7 @@
BigDecimal totalReturnQty = oldReturnQty.add(currentReturnQty);
if (currentReturnQty.compareTo(BigDecimal.ZERO) > 0) {
String returnBatchNo = resolveInventoryBatchNoFromStored(oldPick.getBatchNo());
- addInventory(oldPick.getId(), oldPick.getProductModelId(), returnBatchNo, currentReturnQty, FEED_RETURN_IN_RECORD_TYPE);
+ addInventoryRecordOnly(oldPick.getId(), oldPick.getProductModelId(), returnBatchNo, currentReturnQty, FEED_RETURN_IN_RECORD_TYPE);
}
BigDecimal actualQty = defaultDecimal(oldPick.getQuantity())
@@ -734,6 +735,31 @@
throw ex;
} catch (Exception ex) {
throw new ServiceException("鍥炶ˉ搴撳瓨澶辫触锛�" + ex.getMessage());
+ }
+ }
+
+ private void addInventoryRecordOnly(Long recordId,
+ Long productModelId,
+ String batchNo,
+ BigDecimal quantity,
+ String stockInRecordType) {
+ // 浠呰褰曞叆搴撶敵璇凤紝涓嶅仛瀹℃牳閫氳繃銆�
+ BigDecimal addQuantity = defaultDecimal(quantity);
+ if (addQuantity.compareTo(BigDecimal.ZERO) <= 0) {
+ return;
+ }
+ try {
+ StockInventoryDto stockInventoryDto = new StockInventoryDto();
+ stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setBatchNo(batchNo);
+ stockInventoryDto.setQualitity(addQuantity);
+ stockInventoryDto.setRecordType(stockInRecordType);
+ stockInventoryDto.setRecordId(recordId == null ? 0L : recordId);
+ stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+ } catch (ServiceException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServiceException("閫�鏂欏叆搴撹褰曚繚瀛樺け璐ワ細" + ex.getMessage());
}
}
@@ -1153,4 +1179,36 @@
// 鏁伴噺鏍煎紡鍖栬緭鍑猴紙鍘婚櫎鏈熬鏃犳晥0锛夈��
return defaultDecimal(value).stripTrailingZeros().toPlainString();
}
+
+ /**
+ * 鏍¢獙褰撳墠鐢ㄦ埛蹇呴』涓鸿鍗曠彮缁勯暱
+ * @param dto 棰嗘枡DTO
+ */
+ private void validateTeamLeader(ProductionOrderPickDto dto) {
+ // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛ID
+ Long currentUserId = SecurityUtils.getLoginUser().getUserId();
+
+ // 鑾峰彇鐢熶骇璁㈠崟ID
+ Long productionOrderId = resolveProductionOrderId(dto);
+ if (productionOrderId == null) {
+ throw new ServiceException("鐢熶骇璁㈠崟ID涓嶈兘涓虹┖");
+ }
+
+ // 鏌ヨ鐢熶骇璁㈠崟
+ ProductionOrder productionOrder = productionOrderMapper.selectById(productionOrderId);
+ if (productionOrder == null) {
+ throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
+ }
+
+ // 鑾峰彇璁㈠崟鐨勭彮缁勯暱ID
+ Long teamLeaderUserId = productionOrder.getTeamLeaderUserId();
+ if (teamLeaderUserId == null) {
+ throw new ServiceException("璇ヨ鍗曟湭璁剧疆鐝粍闀�");
+ }
+
+ // 鏍¢獙褰撳墠鐢ㄦ埛鏄惁涓虹彮缁勯暱
+ if (!Objects.equals(currentUserId, teamLeaderUserId)) {
+ throw new ServiceException("褰撳墠鐢ㄦ埛涓嶆槸璇ヨ鍗曠殑鐝粍闀匡紝鏃犳硶杩涜棰嗘枡鎿嶄綔");
+ }
+ }
}
--
Gitblit v1.9.3