xuhy
4 天以前 433bc1e314ecfd483379ca0e2e74e7c815d3261f
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java
@@ -46,10 +46,18 @@
    private TErpSupplierWarehousingBatchMapper erpSupplierWarehousingBatchMapper;
    @Resource
    private TErpClinicWarehousingBatchMapper erpClinicWarehousingBatchMapper;
    @Resource
    private TErpSupplierWarehousingMapper erpSupplierWarehousingMapper;
    @Resource
    private TErpClinicOutboundGoodsMapper erpClinicOutboundGoodsMapper;
    @Resource
    private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper;
    @Resource
    private  TCrmClinicMapper crmClinicMapper;
@@ -125,26 +133,47 @@
        String warehousingBatchId = tErpMaintenanceReminder.getWarehousingBatchId();
        if(warehousingBatchId != null){
            TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(warehousingBatchId);
            tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
            TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(tErpSupplierWarehousingBatch.getWarehousingId());
            if(tErpSupplierWarehousing!=null){
                String goodsId = tErpSupplierWarehousing.getGoodsId();
                if(goodsId != null){
                    TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                    tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName());
                    tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber());
                    tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode());
                    String packingUnitId = goods.getPackingUnitId();
                    if(packingUnitId != null){
                        TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId);
                        tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
            if(tErpMaintenanceReminder.getMaintenanceType()==2){
                TErpClinicWarehousingBatch tErpSupplierWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(warehousingBatchId);
                tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
                    String goodsId = tErpSupplierWarehousingBatch.getGoodsId();
                    if(goodsId != null){
                        TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                        tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName());
                        tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber());
                        tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode());
                        String packingUnitId = goods.getPackingUnitId();
                        if(packingUnitId != null){
                            TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId);
                            tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
                        }
                    }
                List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, warehousingBatchId));
                int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum();
                tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum);
            }else {
                TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(warehousingBatchId);
                tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
                TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(tErpSupplierWarehousingBatch.getWarehousingId());
                if(tErpSupplierWarehousing!=null){
                    String goodsId = tErpSupplierWarehousing.getGoodsId();
                    if(goodsId != null){
                        TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                        tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName());
                        tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber());
                        tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode());
                        String packingUnitId = goods.getPackingUnitId();
                        if(packingUnitId != null){
                            TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId);
                            tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
                        }
                    }
                }
                List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, warehousingBatchId));
                int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum();
                tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum);
            }
            List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, warehousingBatchId));
            int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum();
            tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum);
        }
        return tErpMaintenanceReminderDetailVo;