From 0578c6c76f13e367b5dc7d0882efe3c69ca4cb0e Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期五, 15 五月 2026 16:29:30 +0800
Subject: [PATCH] feat(customer): 添加客户银行代码字段并实现批量删除功能
---
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java | 74 +++++++++++++++++++++++++++++-------
1 files changed, 59 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index 5356500..2840974 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -1,10 +1,13 @@
package com.ruoyi.procurementrecord.utils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
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.StockOutRecordDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
import com.ruoyi.stock.mapper.StockInventoryMapper;
import com.ruoyi.stock.pojo.StockInRecord;
@@ -31,7 +34,7 @@
private final StockInventoryMapper stockInventoryMapper;
/**
- * 涓嶅悎鏍煎叆搴�
+ * 娑撳秴鎮庨弽鐓庡弳鎼�?
*
* @param productModelId
* @param quantity
@@ -44,11 +47,11 @@
stockUninventoryDto.setRecordType(String.valueOf(recordType));
stockUninventoryDto.setQualitity(quantity);
stockUninventoryDto.setProductModelId(productModelId);
- stockUninventoryService.addStockInRecordOnly(stockUninventoryDto);
+ stockUninventoryService.addStockUninventory(stockUninventoryDto);
}
/**
- * 涓嶅悎鏍煎嚭搴�
+ * 娑撳秴鎮庨弽鐓庡毉鎼�?
*
* @param productModelId
* @param quantity
@@ -65,40 +68,49 @@
}
/**
- * 鍚堟牸鍏ュ簱
- * @param productModelId
- * @param quantity
+ * 閸氬牊鐗搁崗銉ョ氨
* @param recordType
* @param recordId
*/
public void addStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
+ addStock(productModelId, quantity, recordType, recordId, resolveWarehouseInfoId(null, productModelId, null));
+ }
+
+ public void addStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, Long warehouseInfoId) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setWarehouseInfoId(warehouseInfoId);
stockInventoryService.addStockInRecordOnly(stockInventoryDto);
}
/**
- * 鍚堟牸鍏ュ簱甯︽壒娆″彿
+ * 閸氬牊鐗搁崗銉ョ氨鐢附澹掑▎鈥冲娇
* @param productModelId
* @param quantity
* @param recordType
* @param recordId
*/
- public void addStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) {
+ public StockInRecordDto addStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) {
+ return addStockWithBatchNo(productModelId, quantity, recordType, recordId, batchNo,
+ resolveWarehouseInfoId(null, productModelId, batchNo));
+ }
+
+ public StockInRecordDto addStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo, Long warehouseInfoId) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
stockInventoryDto.setBatchNo(batchNo);
- stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+ stockInventoryDto.setWarehouseInfoId(warehouseInfoId);
+ return stockInventoryService.addStockInRecordOnly(stockInventoryDto);
}
/**
- * 鍚堟牸鍑哄簱
+ * 閸氬牊鐗搁崙鍝勭氨
*
* @param productModelId
* @param quantity
@@ -106,36 +118,59 @@
* @param recordId
*/
public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
+ substractStock(productModelId, quantity, recordType, recordId, resolveWarehouseInfoId(null, productModelId, null));
+ }
+
+ public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, Long warehouseInfoId) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setWarehouseInfoId(warehouseInfoId);
stockInventoryService.subtractStockInventory(stockInventoryDto);
}
- public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) {
+ public StockOutRecordDto substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) {
+ return substractStock(productModelId, quantity, recordType, recordId, batchNo,
+ resolveWarehouseInfoId(null, productModelId, batchNo));
+ }
+
+ public StockOutRecordDto substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo, Long warehouseInfoId) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
stockInventoryDto.setBatchNo(batchNo);
- stockInventoryService.subtractStockInventory(stockInventoryDto);
+ stockInventoryDto.setWarehouseInfoId(warehouseInfoId);
+ return stockInventoryService.addStockOutRecordOnly(stockInventoryDto);
}
- //涓嶅悎鏍煎簱瀛樺垹闄�
+ /**
+ * @param recordType
+ * @param recordId
+ */
+ public void shipmentStatus(String recordType, Long recordId) {
+ LambdaQueryWrapper<StockOutRecord> queryWrapper = new LambdaQueryWrapper<StockOutRecord>().eq(StockOutRecord::getRecordType, recordType)
+ .eq(StockOutRecord::getRecordId, recordId);
+ StockOutRecord stockOutRecord = stockOutRecordService.getOne(queryWrapper);
+ stockOutRecord.setApprovalStatus(0);
+ stockOutRecordService.updateById(stockOutRecord);
+ }
+
public void deleteStockInRecord(Long recordId, String recordType) {
StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>()
.lambda().eq(StockInRecord::getRecordId, recordId)
.eq(StockInRecord::getRecordType, recordType));
if (ObjectUtils.isNotEmpty(one)) {
stockInRecordService.batchDelete(Collections.singletonList(one.getId()));
- //灏嗗簱瀛樺噺鍥炴潵
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
stockInventoryDto.setRecordType(recordType);
stockInventoryDto.setQualitity(one.getStockInNum());
+ stockInventoryDto.setProductModelId(one.getProductModelId());
+ stockInventoryDto.setBatchNo(one.getBatchNo());
stockInventoryMapper.updateSubtractStockInventory((stockInventoryDto));
}
@@ -147,13 +182,22 @@
.eq(StockOutRecord::getRecordType, recordType));
if (ObjectUtils.isNotEmpty(one)) {
stockOutRecordService.batchDelete(Collections.singletonList(one.getId()));
- //灏嗗簱瀛樺姞鍥炴潵
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
stockInventoryDto.setRecordType(recordType);
stockInventoryDto.setQualitity(one.getStockOutNum());
+ stockInventoryDto.setProductModelId(one.getProductModelId());
+ stockInventoryDto.setBatchNo(one.getBatchNo());
+ stockInventoryDto.setWarehouseInfoId(one.getWarehouseInfoId());
stockInventoryMapper.updateAddStockInventory((stockInventoryDto));
}
}
+
+ private Long resolveWarehouseInfoId(Long warehouseInfoId, Long productModelId, String batchNo) {
+ if (warehouseInfoId == null) {
+ throw new IllegalArgumentException("warehouseInfoId涓嶈兘涓虹┖");
+ }
+ return warehouseInfoId;
+ }
}
--
Gitblit v1.9.3