From 283ea8cfd97f225d0451d57bf915e6f3a0f2041b Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期日, 28 九月 2025 19:03:34 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/haizhentong --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java | 71 ++++++++++++++++++++++++++++++----- 1 files changed, 61 insertions(+), 10 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 aafd7f6..6653c29 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 @@ -8,6 +8,7 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.system.dto.ClinicOutboundGoodsDto; import com.ruoyi.system.dto.OutboundGoodsNextDto; +import com.ruoyi.system.dto.WarehouseGoodsDto; import com.ruoyi.system.dto.clinicWarehouseGoodsDto; import com.ruoyi.system.mapper.*; import com.ruoyi.system.model.*; @@ -182,6 +183,40 @@ 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); + 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); @@ -238,6 +273,24 @@ pageInfo.setRecords(list); return pageInfo; } + @Override + public List<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user) { + List<TErpGoodsVO> list = this.baseMapper.pageList1(query,user); + if(list.isEmpty()){ + return list; + } + + + List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList()); + if(!typeIds.isEmpty()){ + List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); + for (TErpGoodsVO tErpGoodsVO : list) { + typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); + tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); + } + } + return list; + } @Override public PageInfo<TErpClinicWarehousePageListVO> warehousePageList(TClinicWarehouseQuery query, SysUser user, String supplierClinicId) { @@ -282,31 +335,29 @@ } @Override - public void warehouseGoods(List<clinicWarehouseGoodsDto> dtos, SysUser user, String supplierClinicId) { + public void warehouseGoods(WarehouseGoodsDto dtos, SysUser user, String supplierClinicId) { // dtos根据供应商分组 - Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); +// Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); - for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { - String key = stringListEntry.getKey(); - List<clinicWarehouseGoodsDto> value = stringListEntry.getValue(); +// for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { TErpClinicWarehousing tErpClinicWarehousing = new TErpClinicWarehousing(); tErpClinicWarehousing.setClinicId(supplierClinicId); tErpClinicWarehousing.setCreateId(user.getUserId().toString()); tErpClinicWarehousing.setWarehouseNo("G"+ DateUtils.dateTimeNow()); tErpClinicWarehousing.setCreateTime(LocalDateTime.now()); - tErpClinicWarehousing.setSupplierId(key); tErpClinicWarehousing.setType(3); + tErpClinicWarehousing.setStatus(dtos.getStatus()); this.save(tErpClinicWarehousing); BigDecimal totalPrice = new BigDecimal(0); - for (clinicWarehouseGoodsDto dto : value) { + for (clinicWarehouseGoodsDto dto : dtos.getDtos()) { TErpClinicWarehousingBatch tErpClinicWarehousingBatch = new TErpClinicWarehousingBatch(); tErpClinicWarehousingBatch.setWarehousingId(tErpClinicWarehousing.getId()); tErpClinicWarehousingBatch.setWarehousingNumber(dto.getPurchaseCount()); tErpClinicWarehousingBatch.setBatchNumber(dto.getBatchNumber()); - tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate()); - tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate()); + tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate().atStartOfDay()); + tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay()); tErpClinicWarehousingBatch.setGoodsId(dto.getId()); TErpGoods goods = erpGoodsMapper.selectById(dto.getId()); tErpClinicWarehousingBatch.setGoodsName(goods.getGoodsName()); @@ -324,7 +375,7 @@ tErpClinicWarehousing.setTotalPrice(totalPrice); this.updateById(tErpClinicWarehousing); - } +// } } -- Gitblit v1.7.1