From b22ebe8fad1691b35adcf321fe2e136795b3f81d Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 29 六月 2026 17:58:00 +0800
Subject: [PATCH] 库位
---
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
index 96be8cf..49bd0a5 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -64,6 +64,8 @@
import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
import com.ruoyi.stock.pojo.StockInRecord;
import com.ruoyi.stock.service.StockInRecordService;
+import com.ruoyi.device.mapper.DeviceLedgerMapper;
+import com.ruoyi.device.pojo.DeviceLedger;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -119,6 +121,7 @@
private final StockUtils stockUtils;
private final ApprovalTemplateMapper approvalTemplateMapper;
private final SparePartsMapper sparePartsMapper;
+ private final DeviceLedgerMapper deviceLedgerMapper;
@Override
public List<PurchaseLedger> selectPurchaseLedgerList(PurchaseLedger purchaseLedger) {
@@ -421,6 +424,7 @@
qualityInspect.setProductModelId(saleProduct.getProductModelId());
qualityInspect.setUnit(saleProduct.getUnit());
qualityInspect.setQuantity(saleProduct.getQuantity());
+ qualityInspect.setWarehouse(saleProduct.getStorageLocation());
qualityInspectMapper.insert(qualityInspect);
List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0,null);
if (qualityTestStandard.size()>0){
@@ -495,13 +499,18 @@
if (CollectionUtils.isEmpty(stockRecords)
&& qualityInspect.getQualifiedQuantity() != null
&& qualityInspect.getQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0) {
+ // 浼樺厛浣跨敤璐ㄦ鍗曚腑鐨勫簱浣嶏紝濡傛灉娌℃湁鍒欎娇鐢ㄤ骇鍝佹槑缁嗕腑鐨勫簱浣�
+ String warehouse = StringUtils.hasText(qualityInspect.getWarehouse())
+ ? qualityInspect.getWarehouse()
+ : product.getStorageLocation();
stockUtils.addStockWithBatchNo(
product.getProductModelId(),
qualityInspect.getQualifiedQuantity(),
StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode(),
qualityInspect.getId(),
null,
- purchaseInspectTime == null ? null : purchaseInspectTime.plusDays(1)
+ purchaseInspectTime == null ? null : purchaseInspectTime.plusDays(1),
+ warehouse
);
stockRecords = findQualityStockRecords(qualityInspect.getId(), product.getProductModelId());
}
@@ -548,7 +557,8 @@
StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
purchaseLedger.getId(),
purchaseLedger.getPurchaseContractNumber() + "-" + product.getId(),
- stockCreateTime
+ stockCreateTime,
+ product.getStorageLocation()
);
stockRecords = findDirectStockRecords(purchaseLedger.getId(), purchaseLedger.getPurchaseContractNumber(), product.getProductModelId(), product.getId());
}
@@ -735,6 +745,14 @@
product.setProductCategory(spareParts.getName());
}
}
+
+ // 濡傛灉鏈夎澶嘔D浣嗘病鏈夊簱浣嶏紝浠庤澶囪〃鑷姩濉厖搴撲綅
+ if (product.getDeviceId() != null && StringUtils.isEmpty(product.getStorageLocation())) {
+ DeviceLedger device = deviceLedgerMapper.selectById(product.getDeviceId());
+ if (device != null && StringUtils.isNotEmpty(device.getStorageLocation())) {
+ product.setStorageLocation(device.getStorageLocation());
+ }
+ }
}
// 鍒嗙粍澶勭悊
--
Gitblit v1.9.3