From 59099ec96f7a2da11df4b0b1593092b0aff38e90 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 23 十月 2025 13:45:52 +0800
Subject: [PATCH] 修改bug
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
index d49ff11..c5a4451 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
@@ -502,10 +502,13 @@
List<TErpClinicOutboundGoods> tErpClinicOutboundGoods2 = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, outboundGoods.getWarehousingBatchId()));
int sum = tErpClinicOutboundGoods2.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum();
- int count = tErpClinicWarehousingBatch.getPurchaseCount() - sum;
+ int count = tErpClinicWarehousingBatch.getWarehousingNumber() - sum;
outboundGoodsDetailNextVo.setSurplusCount(count);
outboundGoodsDetailNextVo.setUnitAmount(tErpClinicWarehousingBatch.getUnitAmount());
+ if(outboundGoodsDetailNextVo.getUnitAmount()==null){
+ outboundGoodsDetailNextVo.setUnitAmount(tErpClinicWarehousingBatch.getSalesAmount());
+ }
outboundGoodsDetailNextVo.setOutboundCount(outboundGoods.getOutboundCount());
outboundGoodsDetailNextVo.setExpiryDate(tErpClinicWarehousingBatch.getExpiryDate());
outboundGoodsDetailNextVo.setTotalAmount(outboundGoodsDetailNextVo.getUnitAmount().multiply(new BigDecimal(outboundGoods.getOutboundCount())));
@@ -536,7 +539,7 @@
supplierClinicId =crmClinic.getId();
}
TErpSupplierInventory tErpSupplierInventory = new TErpSupplierInventory();
- TErpSupplierInventory last1 = erpSupplierInventoryMapper.selectOne(new LambdaQueryWrapper<TErpSupplierInventory>().orderByDesc(BaseModel::getCreateTime).last("limit 1"));
+ TErpSupplierInventory last1 = erpSupplierInventoryMapper.selectOne(new LambdaQueryWrapper<TErpSupplierInventory>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierInventory::getInventoryNumber).last("limit 1"));
if(last1==null){
tErpSupplierInventory.setInventoryNumber("P" + DateUtils.dateTimeNow()+"00001");
}else {
@@ -589,7 +592,7 @@
tErpSupplierWarehousing.setUnitAmount(tErpSupplierWarehousing1.getUnitAmount());
tErpSupplierWarehousing.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(tErpSupplierWarehousing.getGoodsCount())));
// 当前年月日时分秒
- TErpSupplierWarehousing last = erpSupplierWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpSupplierWarehousing>().orderByDesc(BaseModel::getCreateTime).last("LIMIT 1"));
+ TErpSupplierWarehousing last = erpSupplierWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpSupplierWarehousing>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierWarehousing::getWarehouseNo).last("LIMIT 1"));
if(last==null){
tErpSupplierWarehousing.setWarehouseNo("G"+DateUtils.dateTimeNow()+"00001");
}else {
@@ -640,7 +643,7 @@
erpSupplierInventoryGoodsMapper.insert(tErpSupplierInventoryGoods);
} else {
-
+ int i =1;
TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch1 = erpSupplierWarehousingBatchMapper.selectById(inventoryGoodsDto.getId());
String warehousingId1 = tErpSupplierWarehousingBatch1.getWarehousingId();
TErpSupplierWarehousing tErpSupplierWarehousing2 = erpSupplierWarehousingMapper.selectById(warehousingId1);
@@ -681,7 +684,6 @@
throw new RuntimeException("网络繁忙,请重试");
}
-
TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods();
tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId());
tErpSupplierOutboundGoods.setWarehousingId(tErpSupplierWarehousing1.getId());
@@ -689,6 +691,7 @@
tErpSupplierOutboundGoods.setOutboundCount(count);
tErpSupplierOutboundGoods.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(count)));
erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods);
+ i=2;
}
@@ -708,7 +711,7 @@
String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5));
int number = Integer.parseInt(numberPart);
if (number < 99999) {
- number++;
+ number+=i;
} else {
number = 2; // 达到99999后重置为00002
}
@@ -773,7 +776,7 @@
supplierClinicId =crmClinic.getId();
}
TErpClinicInventory tErpSupplierInventory = new TErpClinicInventory();
- TErpClinicInventory last = erpClinicInventoryMapper.selectOne(new LambdaQueryWrapper<TErpClinicInventory>().orderByDesc(BaseModel::getCreateTime).last("limit 1"));
+ TErpClinicInventory last = erpClinicInventoryMapper.selectOne(new LambdaQueryWrapper<TErpClinicInventory>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicInventory::getInventoryNumber).last("limit 1"));
if(last==null){
tErpSupplierInventory.setInventoryNumber("P" + DateUtils.dateTimeNow()+"00001");
}else {
@@ -823,7 +826,7 @@
// tErpSupplierWarehousing.setUnitAmount(erpGoods.getSalesAmount());
tErpSupplierWarehousing.setTotalPrice(tErpSupplierWarehousingBatch.getUnitAmount().multiply(new BigDecimal(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum())));
// 当前年月日时分秒
- TErpClinicWarehousing last1 = erpClinicWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).last("limit 1"));
+ TErpClinicWarehousing last1 = erpClinicWarehousingMapper.selectOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicWarehousing::getWarehouseNo).last("limit 1"));
if(last1==null){
tErpSupplierWarehousing.setWarehouseNo("G" + DateUtils.dateTimeNow()+"00001");
}else {
@@ -886,13 +889,13 @@
erpClinicInventoryGoodsMapper.insert(tErpSupplierInventoryGoods);
} else {
-
+ int i=1;
if(inventoryGoodsDto.getDamagedCount()!=null && inventoryGoodsDto.getDamagedCount()>0){
TErpClinicOutbound tErpSupplierOutbound = new TErpClinicOutbound();
// tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId());
// tErpSupplierOutbound.setSupplierId(supplierClinicId);
tErpSupplierOutbound.setOutboundType(1);
- TErpClinicOutbound last2 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1"));
+ TErpClinicOutbound last2 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicOutbound::getOutboundNumber).last("limit 1"));
if(last2==null){
tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001");
@@ -931,12 +934,13 @@
tErpSupplierOutboundGoods.setOutboundCount(count);
tErpSupplierOutboundGoods.setTotalPrice(erpGoods.getSalesAmount().multiply(new BigDecimal(count)));
erpClinicOutboundGoodsMapper.insert(tErpSupplierOutboundGoods);
+ i=2;
}
TErpClinicOutbound tErpSupplierOutbound = new TErpClinicOutbound();
// tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId());
// tErpSupplierOutbound.setSupplierId(supplierClinicId);
tErpSupplierOutbound.setOutboundType(6);
- TErpClinicOutbound last4 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).last("limit 1"));
+ TErpClinicOutbound last4 = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicOutbound::getOutboundNumber).last("limit 1"));
if(last4==null){
tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001");
}else {
@@ -947,7 +951,7 @@
String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5));
int number = Integer.parseInt(numberPart);
if (number < 99999) {
- number++;
+ number+=i;
} else {
number = 2; // 达到99999后重置为00002
}
--
Gitblit v1.7.1