From a89ba5357d7e1958d0b51b914358a5e2152ec7e2 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 30 九月 2025 14:33:38 +0800
Subject: [PATCH] 诊所erp

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
index 254a3e1..73d0896 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
@@ -297,7 +297,7 @@
                 tErpSupplierWarehousingBatch.setExpiryDate(warehousingGoodsNextDto.getExpiryDate().atStartOfDay());
                 erpSupplierWarehousingBatchMapper.insert(tErpSupplierWarehousingBatch);
 
-                if(goods.getMaintenanceInterval()!=null){
+                if(goods.getMaintenanceInterval()!=null && !goods.getMaintenanceInterval().isEmpty()){
                     TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder();
                     tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId);
                     tErpMaintenanceReminder.setMaintenanceType(1);
@@ -464,6 +464,41 @@
                     inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount());
                     inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType());
                     inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount());
+                }else {
+                    TErpSupplierOutbound tErpSupplierOutbound = erpSupplierOutboundMapper.selectById(tErpSupplierInventoryGood.getWarehousingId());
+                    List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getOutboundId, tErpSupplierOutbound.getId()));
+                    for (TErpSupplierOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) {
+                        String warehousingId = tErpSupplierOutboundGood.getWarehousingId();
+                        TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(warehousingId);
+                        String goodsId = tErpSupplierWarehousing.getGoodsId();
+                        TErpGoods goods = erpGoodsMapper.selectById(goodsId);
+                        inventoryDetailVo.setGoodsName(goods.getGoodsName());
+                        TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId());
+                        inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
+                        inventoryDetailVo.setWarehouseNo(tErpSupplierWarehousing.getWarehouseNo());
+
+                        TErpSupplierOutboundGoods tErpSupplierOutboundGoods2 = erpSupplierOutboundGoodsMapper.selectById(tErpSupplierInventoryGood.getWarehousingBatchId());
+
+                        TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(tErpSupplierOutboundGoods2.getWarehousingBatchId());
+                        inventoryDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
+
+
+                        List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber()));
+                        int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpSupplierWarehousingBatch::getWarehousingNumber).sum();
+                        List<String> collect = tErpSupplierWarehousingBatches.stream().map(TErpSupplierWarehousingBatch::getId).collect(Collectors.toList());
+                        if(!collect.isEmpty()){
+                            List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods1 = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, collect));
+                            int sum1 = tErpSupplierOutboundGoods1.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum();
+                            sum = sum-sum1;
+                        }
+
+                        // sum = 剩余库存
+                        inventoryDetailVo.setNowCount(sum);
+                        inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount());
+                        inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType());
+                        inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount());
+                    }
+
                 }
                 inventoryDetailVos.add(inventoryDetailVo);
 

--
Gitblit v1.7.1