From 5d4ebe6d0b7dda230b19f4913bdeb60556b46678 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 13 十月 2025 18:33:47 +0800
Subject: [PATCH] bug修改
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java | 87 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 80 insertions(+), 7 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
index fc7aad7..742bfa3 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.*;
+import com.ruoyi.system.service.TCrmSupplierService;
import com.ruoyi.system.service.TErpClinicWarehousingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.vo.*;
@@ -68,6 +69,11 @@
@Resource
private TErpGoodsTypeMapper erpGoodsTypeMapper;
+ @Resource
+ private TErpMaintenanceReminderMapper erpMaintenanceReminderMapper;
+
+ @Resource
+ private TCrmSupplierMapper crmSupplierMapper;
@Override
@@ -111,13 +117,13 @@
if(tErpSupplierInventoryGoods1!=null){
// 盘盈 查入库
if(tErpSupplierInventoryGoods1.getInventoryType()==1){
- TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGoods1.getWarehousingId());
+ TErpClinicWarehousingBatch tErpSupplierWarehousing = erpClinicWarehousingBatchMapper.selectById(tErpSupplierInventoryGoods1.getWarehousingBatchId());
// List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getWarehousingId, tErpSupplierWarehousing.getId()));
// int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpSupplierWarehousingBatch::getWarehousingNumber).sum();
String goodsId = tErpSupplierInventoryGoods1.getGoodsId();
- TErpGoods goods = erpGoodsMapper.selectById(goodsId);
+// TErpGoods goods = erpGoodsMapper.selectById(goodsId);
int count = tErpSupplierInventoryGoods1.getInventoryCount() - tErpSupplierInventoryGoods1.getDamagedCount();
- BigDecimal multiply = goods.getSalesAmount().multiply(new BigDecimal(count));
+ BigDecimal multiply = tErpSupplierWarehousing.getSalesAmount().multiply(new BigDecimal(count));
add = add.add(multiply);
}else {
// 盘亏 查出库
@@ -125,11 +131,11 @@
List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getOutboundId, tErpSupplierOutbound.getId()));
for (TErpClinicOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) {
- TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierOutboundGood.getWarehousingId());
- String goodsId = tErpSupplierInventoryGoods1.getGoodsId();
- TErpGoods goods = erpGoodsMapper.selectById(goodsId);
+ TErpClinicWarehousingBatch tErpSupplierWarehousing = erpClinicWarehousingBatchMapper.selectById(tErpSupplierOutboundGood.getWarehousingBatchId());
+// String goodsId = tErpSupplierInventoryGoods1.getGoodsId();
+// TErpGoods goods = erpGoodsMapper.selectById(goodsId);
int count = tErpSupplierInventoryGoods1.getInventoryCount() - tErpSupplierInventoryGoods1.getDamagedCount();
- BigDecimal multiply = goods.getSalesAmount().multiply(new BigDecimal(count));
+ BigDecimal multiply = tErpSupplierWarehousing.getSalesAmount().multiply(new BigDecimal(count));
add = add.add(multiply);
}
// int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum();
@@ -162,6 +168,16 @@
TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGood.getWarehousingId());
String goodsId = tErpSupplierInventoryGood.getGoodsId();
TErpGoods goods = erpGoodsMapper.selectById(goodsId);
+
+ if(goods.getGoodsSource()==1){
+ TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId());
+ if(supplier!=null){
+ inventoryDetailVo.setSupplierName(supplier.getSupplierName());
+ }
+ }else {
+ inventoryDetailVo.setSupplierName(goods.getSupplierName());
+ }
+
inventoryDetailVo.setGoodsName(goods.getGoodsName());
TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId());
inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
@@ -183,6 +199,49 @@
inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount());
inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType());
inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount());
+ }else {
+ TErpClinicOutbound tErpSupplierOutbound = erpClinicOutboundMapper.selectById(tErpSupplierInventoryGood.getWarehousingId());
+ List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getOutboundId, tErpSupplierOutbound.getId()));
+ for (TErpClinicOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) {
+ String warehousingId = tErpSupplierOutboundGood.getWarehousingId();
+ TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(warehousingId);
+ String goodsId = tErpSupplierInventoryGood.getGoodsId();
+ TErpGoods goods = erpGoodsMapper.selectById(goodsId);
+ if(goods.getGoodsSource()==1){
+ TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId());
+ if(supplier!=null){
+ inventoryDetailVo.setSupplierName(supplier.getSupplierName());
+ }
+ }else {
+ inventoryDetailVo.setSupplierName(goods.getSupplierName());
+ }
+
+ inventoryDetailVo.setGoodsName(goods.getGoodsName());
+ TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId());
+ inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
+ inventoryDetailVo.setWarehouseNo(tErpSupplierWarehousing.getWarehouseNo());
+ TErpClinicOutboundGoods outboundGoods = erpClinicOutboundGoodsMapper.selectById(tErpSupplierInventoryGood.getWarehousingBatchId());
+
+ TErpClinicWarehousingBatch tErpSupplierWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(outboundGoods.getWarehousingBatchId());
+ inventoryDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
+
+
+ List<TErpClinicWarehousingBatch> tErpSupplierWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getId, outboundGoods.getWarehousingBatchId()));
+ int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpClinicWarehousingBatch::getWarehousingNumber).sum();
+ List<String> collect = tErpSupplierWarehousingBatches.stream().map(TErpClinicWarehousingBatch::getId).collect(Collectors.toList());
+ if(!collect.isEmpty()){
+ List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods1 = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().in(TErpClinicOutboundGoods::getWarehousingBatchId, collect));
+ int sum1 = tErpSupplierOutboundGoods1.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum();
+ sum = sum-sum1;
+ }
+
+ // sum = 剩余库存
+ inventoryDetailVo.setNowCount(sum);
+ inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount());
+ inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType());
+ inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount());
+ }
+
}
inventoryDetailVos.add(inventoryDetailVo);
@@ -336,6 +395,20 @@
tErpClinicWarehousingBatch.setPurchaseCount(dto.getPurchaseCount());
erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch);
+
+ if(goods.getMaintenanceInterval()!=null && !goods.getMaintenanceInterval().isEmpty()){
+ TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder();
+ tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId);
+ tErpMaintenanceReminder.setMaintenanceType(2);
+ tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingBatch.getId());
+ Integer day = Integer.valueOf(goods.getMaintenanceInterval());
+ // 当前时间+day天
+ LocalDateTime time1 = LocalDateTime.now().plusDays(day);
+ tErpMaintenanceReminder.setMaintenanceTime(time1);
+ erpMaintenanceReminderMapper.insert(tErpMaintenanceReminder);
+ }
+
+
totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount())));
}
tErpClinicWarehousing.setTotalPrice(totalPrice);
--
Gitblit v1.7.1