From 17a63200983a8e154a1eb3549d1caffa050372c1 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 30 三月 2026 17:14:45 +0800
Subject: [PATCH] feat:1.生产订单领用 2.报工领用(关联订单领用) 3.报工删除(关联报工领用) 4.不合格处理(返工生成返工附件并下载)
---
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java | 47 ++++++++++-------------------------------------
1 files changed, 10 insertions(+), 37 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
index 0ed4db6..3d694ca 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -23,7 +23,6 @@
import com.ruoyi.production.pojo.*;
import com.ruoyi.production.service.ProductOrderService;
import com.ruoyi.quality.mapper.QualityInspectMapper;
-import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.mapper.StockInventoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -32,7 +31,8 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
-import java.util.*;
+import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
@Service
@@ -252,41 +252,6 @@
}
@Override
- public List<StockInventoryDto> getByBomId(Long bomId) {
- List<ProductStructureDto> structureList = productStructureMapper.listBybomId(bomId);
-
- if (CollectionUtils.isEmpty(structureList)) {
- return Collections.emptyList();
- }
-
- Set<Long> allNodeIds = structureList.stream()
- .map(ProductStructureDto::getId)
- .collect(Collectors.toSet());
-
- Set<Long> parentIds = structureList.stream()
- .filter(node -> node.getParentId() != null && node.getParentId() != 0)
- .map(ProductStructureDto::getParentId)
- .collect(Collectors.toSet());
-
- Set<Long> leafNodeIds = new HashSet<>(allNodeIds);
- leafNodeIds.removeAll(parentIds);
-
- // 鑾峰彇鍙跺瓙鑺傜偣鐨� productModelId
- List<Long> productModelIds = structureList.stream()
- .filter(node -> leafNodeIds.contains(node.getId()))
- .map(ProductStructureDto::getProductModelId)
- .filter(Objects::nonNull)
- .distinct()
- .collect(Collectors.toList());
-
- if (productModelIds.isEmpty()) {
- return Collections.emptyList();
- }
-
- return stockInventoryMapper.getStockInventory(productModelIds);
- }
-
- @Override
@Transactional(rollbackFor = Exception.class)
public int drawMaterials(ProductOrderDto productOrderDto) {
if (productOrderDto == null || productOrderDto.getId() == null) {
@@ -308,6 +273,14 @@
if (CollectionUtils.isEmpty(drawMaterialsList)) {
throw new RuntimeException("棰嗘枡鏄庣粏涓嶈兘涓虹┖");
}
+ // 濡傛灉鏈夋暟鎹厛鍔犲簱瀛�
+ ProductOrder productOrder = productOrderMapper.selectById(productOrderDto.getId());
+ if (productOrder != null) {
+ List<DrawMaterialDto> materialDtoList = JSON.parseArray(productOrder.getDrawMaterials(), DrawMaterialDto.class);
+ for (DrawMaterialDto drawMaterialDto : materialDtoList) {
+ stockUtils.addStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), null, productOrderDto.getId());
+ }
+ }
// 澶勭悊棰嗘枡锛堟墸鍑忓簱瀛橈級
try {
--
Gitblit v1.9.3