From a0914318549b357ef3c438d0c2a3714f58ea3487 Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 23 一月 2026 14:14:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index 6d7f6a0..f9a21d6 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -1,16 +1,21 @@
package com.ruoyi.procurementrecord.utils;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
import com.ruoyi.stock.dto.StockInRecordDto;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
+import com.ruoyi.stock.pojo.StockInRecord;
+import com.ruoyi.stock.service.StockInRecordService;
import com.ruoyi.stock.service.StockInventoryService;
import com.ruoyi.stock.service.StockUninventoryService;
+import com.ruoyi.stock.service.impl.StockInRecordServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -21,6 +26,7 @@
private final ProcurementRecordMapper procurementRecordMapper;
private final StockUninventoryService stockUninventoryService;
private final StockInventoryService stockInventoryService;
+ private final StockInRecordService stockInRecordService;
// 鑾峰彇鍟嗗搧鍏ュ簱鏁伴噺,鍑哄簱鏁伴噺,鍓╀綑搴撳瓨
public Map<String, BigDecimal> getStockQuantity(Long productModelId) {
@@ -44,10 +50,10 @@
* @param recordType
* @param recordId
*/
- public void addUnStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
+ public void addUnStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
stockUninventoryDto.setRecordId(recordId);
- stockUninventoryDto.setRecordType(recordType);
+ stockUninventoryDto.setRecordType(String.valueOf(recordType));
stockUninventoryDto.setQualitity(quantity);
stockUninventoryDto.setProductModelId(productModelId);
stockUninventoryService.addStockUninventory(stockUninventoryDto);
@@ -60,10 +66,10 @@
* @param recordType
* @param recordId
*/
- public void subtractUnStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
+ public void subtractUnStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
stockUninventoryDto.setRecordId(recordId);
- stockUninventoryDto.setRecordType(recordType);
+ stockUninventoryDto.setRecordType(String.valueOf(recordType));
stockUninventoryDto.setQualitity(quantity);
stockUninventoryDto.setProductModelId(productModelId);
stockUninventoryService.subtractStockUninventory(stockUninventoryDto);
@@ -76,10 +82,10 @@
* @param recordType
* @param recordId
*/
- public void addStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
+ public void addStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
- stockInventoryDto.setRecordType(recordType);
+ stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
stockInventoryService.addstockInventory(stockInventoryDto);
@@ -92,12 +98,21 @@
* @param recordType
* @param recordId
*/
- public void substractStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
+ public void substractStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
- stockInventoryDto.setRecordType(recordType);
+ stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
stockInventoryService.subtractStockInventory(stockInventoryDto);
}
+
+ //涓嶅悎鏍煎簱瀛樺垹闄�
+ public void deleteStockRecord(Long recordId, Integer recordType) {
+ StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>()
+ .lambda().eq(StockInRecord::getRecordId, recordId)
+ .eq(StockInRecord::getRecordType, recordType));
+
+ stockInRecordService.batchDelete(Collections.singletonList(one.getId()));
+ }
}
--
Gitblit v1.9.3