From f15d99d9d4fdaff8b13776e861ce958ec9f26749 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期一, 29 九月 2025 15:03:50 +0800 Subject: [PATCH] 诊所erp --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java | 73 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 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..badeda8 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 @@ -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::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber())); + 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>().eq(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){ + 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