From db91403b3a83a93e7788b9fd841c4ef242dfcd94 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Thu, 26 Sep 2024 20:33:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=93=81=20=E6=89=B9=E9=87=8F=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E4=BA=8C=E7=BB=B4=E7=A0=81=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionStockListController.java | 19 + .../IDistributionStockListService.java | 7 + .../DistributionStockListServiceImpl.java | 519 ++++++++++-------- 3 files changed, 313 insertions(+), 232 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java index e6d965664..195a3fe0c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java @@ -173,6 +173,25 @@ public class DistributionStockListController extends BladeController { return R.data(orderPackgeCodeDataVo); } + /** + * + * @param orderPackgeCodes 多个库存品码的 ,号分割 + * @return + */ + @GetMapping("/showInventoryPackgeCodes") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "返回模板和模板内容") + public R showInventoryPackgeCodes(@ApiIgnore @RequestParam String orderPackgeCodes){ + + OrderPackgeCodeDataVO orderPackgeCodeDataVo= null; + try { + orderPackgeCodeDataVo = distributionStockListService.showInvnetoryPackgeCodes(orderPackgeCodes); + } catch (Exception e) { + return R.fail(e.getMessage()); + } + return R.data(orderPackgeCodeDataVo); + } + @GetMapping("/showInventorySourcePackageCode") @ApiOperationSupport(order = 2) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java index c814d14c5..9a60f9884 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java @@ -222,6 +222,13 @@ public interface IDistributionStockListService extends BaseService implements IDistributionStockListService { @Autowired - private IDistributionUnpackingDetailsService distributionUnpackingDetailsService; + private IDistributionUnpackingDetailsService distributionUnpackingDetailsService; @Autowired - private IBasicdataClientClient basicdataClientClient; + private IBasicdataClientClient basicdataClientClient; @Autowired - private IBasicdataWarehouseClient basicdataWarehouseClient; + private IBasicdataWarehouseClient basicdataWarehouseClient; @Autowired - private IBasicMaterialClient basicMaterialClient; + private IBasicMaterialClient basicMaterialClient; @Autowired - private IDistributionStockListInfoService distributionStockListInfoService; + private IDistributionStockListInfoService distributionStockListInfoService; @Autowired - private IWarehouseTrayGoodsClient warehouseTrayGoodsClient; + private IWarehouseTrayGoodsClient warehouseTrayGoodsClient; @Autowired private IWarehouseUpdownGoodsClient warehouseUpdownGoodsClient; @Autowired @@ -132,37 +132,36 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl selectDistributionStockListPage(IPage page, DistributionStockListVO distributionStockList) { return page.setRecords(baseMapper.selectDistributionStockListPage(page, distributionStockList)); } @Override - public DistributionStockListEntity getStockListEntity(Long marketId, Long materialId, String incomingBatch ,Long storeId,Long warehouseId) { + public DistributionStockListEntity getStockListEntity(Long marketId, Long materialId, String incomingBatch, Long storeId, Long warehouseId) { DistributionStockListEntity one = baseMapper.selectOne(Wrappers.query().lambda() .eq(DistributionStockListEntity::getMarketId, marketId) .eq(DistributionStockListEntity::getMaterialId, materialId) .eq(DistributionStockListEntity::getIncomingBatch, incomingBatch) - .eq(ObjectUtils.isNotNull(storeId),DistributionStockListEntity::getStoreId, storeId) - .eq(ObjectUtils.isNotNull(warehouseId),DistributionStockListEntity::getWarehouseId, warehouseId) + .eq(ObjectUtils.isNotNull(storeId), DistributionStockListEntity::getStoreId, storeId) + .eq(ObjectUtils.isNotNull(warehouseId), DistributionStockListEntity::getWarehouseId, warehouseId) ); - if(ObjectUtils.isNotNull(one)){ + if (ObjectUtils.isNotNull(one)) { return one; } return null; @@ -172,39 +171,38 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl exportDistributionStockList(Map distributionStockList) { Object ids = distributionStockList.get("ids"); - if(ObjectUtils.isNotNull(ids)){ + if (ObjectUtils.isNotNull(ids)) { distributionStockList.remove("ids"); } BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNotNull(myCurrentWarehouse)){ - distributionStockList.put("warehouseId",myCurrentWarehouse.getId()); - }else{ + if (ObjectUtils.isNotNull(myCurrentWarehouse)) { + distributionStockList.put("warehouseId", myCurrentWarehouse.getId()); + } else { throw new CustomerException("请选择仓库,在进行导出数据!!!"); } QueryWrapper queryWrapper = Condition.getQueryWrapper(distributionStockList, DistributionStockListEntity.class); queryWrapper.lambda().eq(DistributionStockListEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); - if(ObjectUtils.isNotNull(ids)){ - queryWrapper.in(ObjectUtils.isNotNull(ids),"id",String.valueOf(ids).split(",")); + if (ObjectUtils.isNotNull(ids)) { + queryWrapper.in(ObjectUtils.isNotNull(ids), "id", String.valueOf(ids).split(",")); } List distributionStockListEntities = baseMapper.exportDistributionStockList(queryWrapper); - List excelList = new ArrayList<>(); distributionStockListEntities.forEach(stockList -> { // stockList.setServiceType(DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType())); DistributionStockListExcel distributionStockListExcel = new DistributionStockListExcel(); - BeanUtil.copyProperties(stockList,distributionStockListExcel); + BeanUtil.copyProperties(stockList, distributionStockListExcel); String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType()); distributionStockListExcel.setServiceTypeName(value); - distributionStockListExcel.setUnpack(stockList.getUnpack() ? "是":"否"); + distributionStockListExcel.setUnpack(stockList.getUnpack() ? "是" : "否"); //查询包装数量 BasicMaterialEntity materialOwnId = basicMaterialClient.getMaterialOwnId(stockList.getMaterialId()); - if(ObjectUtils.isNotNull(materialOwnId)){ - distributionStockListExcel.setPackNum(materialOwnId.getPackageNum()+""); + if (ObjectUtils.isNotNull(materialOwnId)) { + distributionStockListExcel.setPackNum(materialOwnId.getPackageNum() + ""); } //查询托盘信息 WarehouseTrayGoodsEntity warehouseTrayGoodsEntity = new WarehouseTrayGoodsEntity(); @@ -214,7 +212,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl trayList = warehouseTrayGoodsClient.getTrayList(warehouseTrayGoodsEntity); - if(!trayList.isEmpty()){ + if (!trayList.isEmpty()) { distributionStockListExcel.setTrayCode(trayList.stream().map(WarehouseTrayGoodsEntity::getTrayCode).collect(Collectors.joining(","))); } excelList.add(distributionStockListExcel); @@ -225,27 +223,27 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl exportStock(Map distributionStockList) { Object ids = distributionStockList.get("ids"); - if(ObjectUtils.isNotNull(ids)){ + if (ObjectUtils.isNotNull(ids)) { distributionStockList.remove("ids"); } BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNotNull(myCurrentWarehouse)){ - distributionStockList.put("warehouseId",myCurrentWarehouse.getId()); - }else{ + if (ObjectUtils.isNotNull(myCurrentWarehouse)) { + distributionStockList.put("warehouseId", myCurrentWarehouse.getId()); + } else { throw new CustomerException("请选择仓库,在进行导出数据!!!"); } QueryWrapper queryWrapper = Condition.getQueryWrapper(distributionStockList, DistributionStockListEntity.class); queryWrapper.lambda().eq(DistributionStockListEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); - if(ObjectUtils.isNotNull(ids)){ - queryWrapper.in(ObjectUtils.isNotNull(ids),"id",String.valueOf(ids).split(",")); + if (ObjectUtils.isNotNull(ids)) { + queryWrapper.in(ObjectUtils.isNotNull(ids), "id", String.valueOf(ids).split(",")); } List basicdataClientUserEntityListByUserIds = basicdataClientClient.getBasicdataClientUserEntityListByUserId(AuthUtil.getUserId()); List clientIds = null; if (Func.isNotEmpty(basicdataClientUserEntityListByUserIds)) { clientIds = basicdataClientUserEntityListByUserIds.stream().map(BasicdataClientUserEntity::getClientId).collect(Collectors.toList()); - queryWrapper.in("market_id",clientIds); + queryWrapper.in("market_id", clientIds); } else { throw new CustomerException("当前账号没有绑定商场"); } @@ -256,14 +254,14 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl { // stockList.setServiceType(DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType())); DistributionStockListExcel distributionStockListExcel = new DistributionStockListExcel(); - BeanUtil.copyProperties(stockList,distributionStockListExcel); + BeanUtil.copyProperties(stockList, distributionStockListExcel); String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType()); distributionStockListExcel.setServiceTypeName(value); - distributionStockListExcel.setUnpack(stockList.getUnpack() ? "是":"否"); + distributionStockListExcel.setUnpack(stockList.getUnpack() ? "是" : "否"); //查询包装数量 BasicMaterialEntity materialOwnId = basicMaterialClient.getMaterialOwnId(stockList.getMaterialId()); - if(ObjectUtils.isNotNull(materialOwnId)){ - distributionStockListExcel.setPackNum(materialOwnId.getPackageNum()+""); + if (ObjectUtils.isNotNull(materialOwnId)) { + distributionStockListExcel.setPackNum(materialOwnId.getPackageNum() + ""); } //查询托盘信息 WarehouseTrayGoodsEntity warehouseTrayGoodsEntity = new WarehouseTrayGoodsEntity(); @@ -273,7 +271,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl trayList = warehouseTrayGoodsClient.getTrayList(warehouseTrayGoodsEntity); - if(!trayList.isEmpty()){ + if (!trayList.isEmpty()) { distributionStockListExcel.setTrayCode(trayList.stream().map(WarehouseTrayGoodsEntity::getTrayCode).collect(Collectors.joining(","))); } excelList.add(distributionStockListExcel); @@ -302,12 +300,82 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl list = this.list(wrapper); - if (CollUtil.isNotEmpty(list)){ + if (CollUtil.isNotEmpty(list)) { return list.get(0); } return null; } + @Override + public OrderPackgeCodeDataVO showInvnetoryPackgeCodes(String orderPackgeCodes) { + + OrderPackgeCodeDataVO orderPackgeCodeDataVO = new OrderPackgeCodeDataVO(); + List data = new ArrayList<>(); + BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_11.getValue()); + if (ObjectUtil.isEmpty(template)) { + throw new CustomerException("模板内容未找到"); + } + if (orderPackgeCodes.isEmpty()) { + throw new CustomerException("模板内容未找到"); + } + + String[] packageCodes = orderPackgeCodes.split(","); + + + String html = null; + try { + html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); + orderPackgeCodeDataVO.setTemplateHtml(html); + orderPackgeCodeDataVO.setTemplateId(template.getId()); + + + for (String packageCode : packageCodes) { +//查询库存品包件 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(DisStockListDetailEntity::getStockPackageCode, packageCode); + DisStockListDetailEntity disStockListDetail = disStockListDetailService.getOne(wrapper); + if (Func.isEmpty(disStockListDetail)) { + log.error("##################查询库存品包件失败 packageCode:{}", packageCode); + throw new ServiceException("库存品包件查询失败"); + } + + //查询库存品信息 + DistributionStockListEntity stockListEntity = this.getById(disStockListDetail.getStockListId()); + if (Func.isEmpty(stockListEntity)) { + log.info("##############查询ID:{}", disStockListDetail.getStockListId()); + throw new ServiceException("查询库存品信息失败"); + } + + DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(disStockListDetail.getReservationId()); + if (Func.isEmpty(distributionReservationEntity)) { + log.info("##############查询ID:{}", distributionReservationEntity); + throw new ServiceException("查询库存品信息失败"); + } + Map map = JSONObject.parseObject(JSONObject.toJSONString(stockListEntity), Map.class); + map.put("id", disStockListDetail.getId()); + map.put("customerName", distributionReservationEntity.getConsignee()); + map.put("customerTelephone", distributionReservationEntity.getDeliveryPhone()); + map.put("customerAddress", distributionReservationEntity.getDeliveryAddress()); + map.put("shipperName", " "); + map.put("shipperAddress", " "); + map.put("stockPackageCode", disStockListDetail.getStockPackageCode()); + String filename = QRCodeUtil.createCodeToFile(disStockListDetail.getStockPackageCode()); + map.put("img", QRCodeUtil.getEmpAutograph(filename)); + if (Func.isNotEmpty(stockListEntity.getOrderCode())) { + String fileTypeName = QRCodeUtil.createCodeToFile(stockListEntity.getOrderCode()); + map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); + } + data.add(map); + } + + orderPackgeCodeDataVO.setDataList(data); + return orderPackgeCodeDataVO; + } catch (Exception e) { + throw new CustomerException(e.getMessage()); + } + + + } @Override public void importUser(List data, Boolean isCovered) { @@ -344,7 +412,6 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl list = new ArrayList<>(); Long aLong = 0L; BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if (Func.isEmpty(myCurrentWarehouse)){ - log.error("##################拆包未授权myCurrentWarehouse:{}",myCurrentWarehouse); + if (Func.isEmpty(myCurrentWarehouse)) { + log.error("##################拆包未授权myCurrentWarehouse:{}", myCurrentWarehouse); return false; } - DistributionStockListEntity one2 = this.getOne(Wrappers.query().lambda() - .eq(ObjectUtil.isNotEmpty(distributionStockListDTO.getMaterialId()),DistributionStockListEntity::getMaterialId, distributionStockListDTO.getMaterialId()) + DistributionStockListEntity one2 = this.getOne(Wrappers.query().lambda() + .eq(ObjectUtil.isNotEmpty(distributionStockListDTO.getMaterialId()), DistributionStockListEntity::getMaterialId, distributionStockListDTO.getMaterialId()) .eq(DistributionStockListEntity::getPid, distributionStockListDTO.getId()) .eq(DistributionStockListEntity::getMarketId, distributionStockListDTO.getMarketId()) .eq(DistributionStockListEntity::getWarehouseId, myCurrentWarehouse.getId()) @@ -370,14 +437,14 @@ public class DistributionStockListServiceImpl extends BaseServiceImplquery().lambda() - .eq(DistributionStockListEntity::getId, distributionStockListDTO.getId()) - .eq(DistributionStockListEntity::getMarketId, distributionStockListDTO.getMarketId()) + .eq(DistributionStockListEntity::getId, distributionStockListDTO.getId()) + .eq(DistributionStockListEntity::getMarketId, distributionStockListDTO.getMarketId()) // .eq(DistributionStockListEntity::getMaterialId, distributionStockListDTO.getMaterialId()) - .eq(DistributionStockListEntity::getWarehouseId, myCurrentWarehouse.getId()) - .eq(ObjectUtil.isNotEmpty(distributionStockListDTO.getStoreId()), DistributionStockListEntity::getStoreId, distributionStockListDTO.getStoreId()) + .eq(DistributionStockListEntity::getWarehouseId, myCurrentWarehouse.getId()) + .eq(ObjectUtil.isNotEmpty(distributionStockListDTO.getStoreId()), DistributionStockListEntity::getStoreId, distributionStockListDTO.getStoreId()) ); - if (Func.isEmpty(one)){ - log.info("#############拆包查询父级库存品物不存在##############id:{},MarketId:{},WarehouseId:{}",distributionStockListDTO.getId(),distributionStockListDTO.getMarketId(),myCurrentWarehouse.getId()); + if (Func.isEmpty(one)) { + log.info("#############拆包查询父级库存品物不存在##############id:{},MarketId:{},WarehouseId:{}", distributionStockListDTO.getId(), distributionStockListDTO.getMarketId(), myCurrentWarehouse.getId()); return false; } @@ -385,27 +452,25 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl materialByProductCode = basicMaterialClient.findEntityByPid(distributionStockListDTO.getId()); - if (Func.isEmpty(materialByProductCode)){ - a = materialByProductCode.size()+1; + if (Func.isEmpty(materialByProductCode)) { + a = materialByProductCode.size() + 1; } - basicMaterialEntity.setName(one.getDescriptionGoods()+"-"+a); - basicMaterialEntity.setProductCode(one.getCargoNumber()+"-"+a); + basicMaterialEntity.setName(one.getDescriptionGoods() + "-" + a); + basicMaterialEntity.setProductCode(one.getCargoNumber() + "-" + a); basicMaterialEntity.setPackingSpecification(distributionStockListDTO.getCargoNorms()); basicMaterialEntity.setSku(distributionStockListDTO.getSku()); basicMaterialEntity.setPackageNum(Integer.parseInt(distributionStockListDTO.getPackageNum())); @@ -452,7 +517,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImplquery().lambda() @@ -627,6 +689,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl list = new ArrayList<>(); - if(Func.isNotEmpty(storeId) && storeId != -1){ + if (Func.isNotEmpty(storeId) && storeId != -1) { //门店 list = baseMapper.selectList(Wrappers.query().lambda() - .eq(DistributionStockListEntity::getStoreId,storeId)//门店 - .eq(DistributionStockListEntity::getMaterialId,materialId)//货物 - .eq(DistributionStockListEntity::getIncomingBatch,incomingBatch)//货物 - .eq(ObjectUtils.isNotNull(distributionStockListEntity.getWarehouseId()),DistributionStockListEntity::getWarehouseId,distributionStockListEntity.getWarehouseId()) + .eq(DistributionStockListEntity::getStoreId, storeId)//门店 + .eq(DistributionStockListEntity::getMaterialId, materialId)//货物 + .eq(DistributionStockListEntity::getIncomingBatch, incomingBatch)//货物 + .eq(ObjectUtils.isNotNull(distributionStockListEntity.getWarehouseId()), DistributionStockListEntity::getWarehouseId, distributionStockListEntity.getWarehouseId()) ); - }else if(Func.isNotEmpty(clientId)){ + } else if (Func.isNotEmpty(clientId)) { //客户商场 list = baseMapper.selectList(Wrappers.query().lambda() - .eq(DistributionStockListEntity::getMarketId,clientId)//商场 - .eq(DistributionStockListEntity::getMaterialId,materialId)//货物 - .eq(DistributionStockListEntity::getIncomingBatch,incomingBatch)//货物 - .eq(ObjectUtils.isNotNull(distributionStockListEntity.getWarehouseId()),DistributionStockListEntity::getWarehouseId,distributionStockListEntity.getWarehouseId()) + .eq(DistributionStockListEntity::getMarketId, clientId)//商场 + .eq(DistributionStockListEntity::getMaterialId, materialId)//货物 + .eq(DistributionStockListEntity::getIncomingBatch, incomingBatch)//货物 + .eq(ObjectUtils.isNotNull(distributionStockListEntity.getWarehouseId()), DistributionStockListEntity::getWarehouseId, distributionStockListEntity.getWarehouseId()) ); } - if(list.size() > 0){ + if (list.size() > 0) { AtomicReference num = new AtomicReference<>(0); - list.forEach(i ->{ + list.forEach(i -> { num.updateAndGet(v -> v + i.getQuantityStock()); }); - DistributionStockListEntity distributionStockList= list.get(0); + DistributionStockListEntity distributionStockList = list.get(0); distributionStockList.setQuantityStock(num.get()); - BeanUtils.copyProperties(distributionStockList,distributionStockListVO); + BeanUtils.copyProperties(distributionStockList, distributionStockListVO); return distributionStockListVO; } return null; @@ -671,6 +734,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl page1= baseMapper.pageOwn(page,distributionStockListEntity); + IPage page1 = baseMapper.pageOwn(page, distributionStockListEntity); return page1; } @@ -697,19 +761,19 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl basicdataClientUserEntityListByUserIds = basicdataClientClient.getBasicdataClientUserEntityListByUserId(AuthUtil.getUserId()); - List clientIds =null; - if(Func.isNotEmpty(basicdataClientUserEntityListByUserIds)){ - clientIds = basicdataClientUserEntityListByUserIds.stream().map(BasicdataClientUserEntity::getClientId).collect(Collectors.toList()); - }else { + List clientIds = null; + if (Func.isNotEmpty(basicdataClientUserEntityListByUserIds)) { + clientIds = basicdataClientUserEntityListByUserIds.stream().map(BasicdataClientUserEntity::getClientId).collect(Collectors.toList()); + } else { return null; } - IPage page1= baseMapper.pageClinet(page,distributionStockListEntity,clientIds); - return page1; + IPage page1 = baseMapper.pageClinet(page, distributionStockListEntity, clientIds); + return page1; } @Override public DistributionStockupStockListInfoVO selectStockListInfo(Long reservationId, Long stockListId, Long allocationId) { - return baseMapper.selectStockListInfo(reservationId,stockListId,allocationId); + return baseMapper.selectStockListInfo(reservationId, stockListId, allocationId); } @Override @@ -724,27 +788,26 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl selectStockListInfoList(Long reservationId, Long stockListId) { - return baseMapper.selectStockListInfoList(reservationId,stockListId); + return baseMapper.selectStockListInfoList(reservationId, stockListId); } /** - * * @param reservationId * @param stockListId * @return */ @Override public List selectStockListInfoSelfList(Long reservationId, Long stockListId) { - return baseMapper.selectStockListInfoSelfList(reservationId,stockListId); + return baseMapper.selectStockListInfoSelfList(reservationId, stockListId); } @Override public Integer submitQuantityByStockListId(int num, Long stockListId) { - return baseMapper.submitQuantityByStockListId(num,stockListId); + return baseMapper.submitQuantityByStockListId(num, stockListId); } @Override - public List getAllStockMall(){ + public List getAllStockMall() { return baseMapper.getAllStockMall(); } @@ -754,23 +817,23 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl getListByMarketIdAndMaterialCode(Long marketId, String materialCode,Long warehouseId) { - return baseMapper.getListByMarketIdAndMaterialCode(marketId,materialCode,warehouseId); + public List getListByMarketIdAndMaterialCode(Long marketId, String materialCode, Long warehouseId) { + return baseMapper.getListByMarketIdAndMaterialCode(marketId, materialCode, warehouseId); } @Override - public List getEntityByMarketIdAndMaterialName(Long marketId, String materialName,Long warehouseId) { - return baseMapper.getEntityByMarketIdAndMaterialName(marketId,materialName,warehouseId); + public List getEntityByMarketIdAndMaterialName(Long marketId, String materialName, Long warehouseId) { + return baseMapper.getEntityByMarketIdAndMaterialName(marketId, materialName, warehouseId); } @Override public DistributionStockupStockListInfoVO selectStockListInfoSelf(Long reservationId, Long stockListId, Long allocationId) { - return baseMapper.selectStockListInfoSelf(reservationId,stockListId,allocationId); + return baseMapper.selectStockListInfoSelf(reservationId, stockListId, allocationId); } @Override public List getListByMarketIdAndMaterialName(Long marketId, String materialName, Long warehouseId) { - return baseMapper.getListByMarketIdAndMaterialName(marketId,materialName,warehouseId); + return baseMapper.getListByMarketIdAndMaterialName(marketId, materialName, warehouseId); } /** @@ -788,21 +851,21 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("market_id",marketId) - .eq("material_id",materialId) - .eq("incoming_batch",incomingBatch) - .eq("warehouse_id",warehouseId); + queryWrapper.eq("market_id", marketId) + .eq("material_id", materialId) + .eq("incoming_batch", incomingBatch) + .eq("warehouse_id", warehouseId); distributionStockListEntity = getOne(queryWrapper); - if(Objects.isNull(distributionStockListEntity)){ + if (Objects.isNull(distributionStockListEntity)) { log.warn("##################listAllocation: 库存品信息不存在"); return null; } String sourceType = distributionStockListEntity.getSourceType(); - if("1".equals(sourceType)){ - pageList = baseMapper.listAllocationOrder(page,distributionStockListEntity); - }else{ - pageList = baseMapper.listAllocation(page,distributionStockListEntity); + if ("1".equals(sourceType)) { + pageList = baseMapper.listAllocationOrder(page, distributionStockListEntity); + } else { + pageList = baseMapper.listAllocation(page, distributionStockListEntity); } return pageList; @@ -811,20 +874,19 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl getInventoryList(Map distributionStockList, IPage page) { BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if (Func.isEmpty(myCurrentWarehouse)){ - log.error("####################当前选择仓库信息缺失:{}",myCurrentWarehouse); + if (Func.isEmpty(myCurrentWarehouse)) { + log.error("####################当前选择仓库信息缺失:{}", myCurrentWarehouse); return null; } DistributionStockListDTO stockListDTO = Func.copy(distributionStockList, DistributionStockListDTO.class); stockListDTO.setWarehouseId(myCurrentWarehouse.getId()); - IPage stockListVOList = baseMapper.selectAllStockList(stockListDTO,page); + IPage stockListVOList = baseMapper.selectAllStockList(stockListDTO, page); // List stockListVOList = baseMapper.selectAllStockList(stockListDTO,page); // page.setRecords(stockListVOList); return stockListVOList; } /** - * * @param distributionStockListEntity * @return */ @@ -841,22 +903,20 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl data = new ArrayList<>(); BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_11.getValue()); if (ObjectUtil.isEmpty(template)) { throw new ServiceException("模板内容未找到"); } - if (Func.isEmpty(reservationId)){ + if (Func.isEmpty(reservationId)) { throw new ServiceException("参数缺少"); } - if (Func.isEmpty(stockListId)){ + if (Func.isEmpty(stockListId)) { throw new ServiceException("参数缺少"); } @@ -867,40 +927,40 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl disStockListDetailEntities = distributionReservationMapper.selectInventoryListByReservation(reservationId); - if (Func.isEmpty(disStockListDetailEntities)){ + if (Func.isEmpty(disStockListDetailEntities)) { throw new ServiceException("此预约不存在库存品信息"); } //对指定批次的库存品进行查询是否存在备货包件 List stockUpStockListPack = disStockListDetailEntities.stream().filter(f -> f.getStockListId().equals(stockListId) && f.getReservationId().equals(reservationId) && Func.isNotEmpty(f.getStockPackageCode())).collect(Collectors.toList()); - if (Func.isEmpty(stockUpStockListPack)){ - log.info("##############客户库存品包件信息:{}",disStockListDetailEntities); + if (Func.isEmpty(stockUpStockListPack)) { + log.info("##############客户库存品包件信息:{}", disStockListDetailEntities); throw new ServiceException("该库存品不存在备货包件信息"); } //查询库存品信息 DistributionStockListEntity stockListEntity = this.getById(stockListId); - if (Func.isEmpty(stockListEntity)){ - log.info("##############查询ID:{}",stockListId); + if (Func.isEmpty(stockListEntity)) { + log.info("##############查询ID:{}", stockListId); throw new ServiceException("查询库存品信息失败"); } DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(reservationId); - if (Func.isEmpty(distributionReservationEntity)){ - log.info("##############查询ID:{}",distributionReservationEntity); + if (Func.isEmpty(distributionReservationEntity)) { + log.info("##############查询ID:{}", distributionReservationEntity); throw new ServiceException("查询库存品信息失败"); } for (DisStockListDetailEntity disStockListDetailEntity : stockUpStockListPack) { - Map map =JSONObject.parseObject(JSONObject.toJSONString(stockListEntity), Map.class); - map.put("id",disStockListDetailEntity.getId()); - map.put("customerName",distributionReservationEntity.getConsignee()); - map.put("customerTelephone",distributionReservationEntity.getDeliveryPhone()); - map.put("customerAddress",distributionReservationEntity.getDeliveryAddress()); - map.put("shipperName"," "); - map.put("shipperAddress"," "); - map.put("stockPackageCode",disStockListDetailEntity.getStockPackageCode()); + Map map = JSONObject.parseObject(JSONObject.toJSONString(stockListEntity), Map.class); + map.put("id", disStockListDetailEntity.getId()); + map.put("customerName", distributionReservationEntity.getConsignee()); + map.put("customerTelephone", distributionReservationEntity.getDeliveryPhone()); + map.put("customerAddress", distributionReservationEntity.getDeliveryAddress()); + map.put("shipperName", " "); + map.put("shipperAddress", " "); + map.put("stockPackageCode", disStockListDetailEntity.getStockPackageCode()); String filename = QRCodeUtil.createCodeToFile(disStockListDetailEntity.getStockPackageCode()); map.put("img", QRCodeUtil.getEmpAutograph(filename)); - if (Func.isNotEmpty(stockListEntity.getOrderCode())){ + if (Func.isNotEmpty(stockListEntity.getOrderCode())) { String fileTypeName = QRCodeUtil.createCodeToFile(stockListEntity.getOrderCode()); map.put("imgType", QRCodeUtil.createCodeToFileType(fileTypeName)); } @@ -929,35 +989,35 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl map =JSONObject.parseObject(JSONObject.toJSONString(stockListEntity), Map.class); - map.put("id",disStockListDetail.getId()); - map.put("customerName",distributionReservationEntity.getConsignee()); - map.put("customerTelephone",distributionReservationEntity.getDeliveryPhone()); - map.put("customerAddress",distributionReservationEntity.getDeliveryAddress()); - map.put("shipperName"," "); - map.put("shipperAddress"," "); - map.put("stockPackageCode",disStockListDetail.getStockPackageCode()); + Map map = JSONObject.parseObject(JSONObject.toJSONString(stockListEntity), Map.class); + map.put("id", disStockListDetail.getId()); + map.put("customerName", distributionReservationEntity.getConsignee()); + map.put("customerTelephone", distributionReservationEntity.getDeliveryPhone()); + map.put("customerAddress", distributionReservationEntity.getDeliveryAddress()); + map.put("shipperName", " "); + map.put("shipperAddress", " "); + map.put("stockPackageCode", disStockListDetail.getStockPackageCode()); String filename = QRCodeUtil.createCodeToFile(disStockListDetail.getStockPackageCode()); map.put("img", QRCodeUtil.getEmpAutograph(filename)); - if (Func.isNotEmpty(stockListEntity.getOrderCode())){ + if (Func.isNotEmpty(stockListEntity.getOrderCode())) { String fileTypeName = QRCodeUtil.createCodeToFile(stockListEntity.getOrderCode()); map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); } @@ -974,7 +1034,7 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl getListByMarketIdAndSku(Long mallId, String sku, Long warehouseId) { - return baseMapper.getListByMarketIdAndSku(mallId,sku,warehouseId); + return baseMapper.getListByMarketIdAndSku(mallId, sku, warehouseId); } /** @@ -987,12 +1047,12 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl> mapList = new ArrayList<>(); - switch (sourceType){ + List> mapList = new ArrayList<>(); + switch (sourceType) { case "1": //有数据 break; @@ -1004,16 +1064,16 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl locationStockListInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); - if (Func.isNotEmpty(locationStockListInformation)){ + if (Func.isNotEmpty(locationStockListInformation)) { List collect = locationStockListInformation.stream().map(WarehouseUpdownGoodsEntity::getAllocationId).map(String::valueOf).collect(Collectors.toList()); String[] array = collect.stream().toArray(String[]::new); List allocationInforByIds = warehouseGoodsAllocationClient.getAllocationInforByIds(array); Map collected = allocationInforByIds.stream().collect(Collectors.toMap(WarehouseGoodsAllocationEntity::getId, WarehouseGoodsAllocationEntity::getQrCode)); for (WarehouseUpdownGoodsEntity updownGoodsEntity : locationStockListInformation) { - Map map = new HashMap<>(); - map.put("allocationId",updownGoodsEntity.getAllocationId()); - map.put("allocationName",collected.get(updownGoodsEntity.getAllocationId())); - map.put("handleQuantity",updownGoodsEntity.getNum()); + Map map = new HashMap<>(); + map.put("allocationId", updownGoodsEntity.getAllocationId()); + map.put("allocationName", collected.get(updownGoodsEntity.getAllocationId())); + map.put("handleQuantity", updownGoodsEntity.getNum()); mapList.add(map); } } @@ -1042,10 +1102,10 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl map = JSONObject.parseObject(JSONObject.toJSONString(distributionStockListInfoEntity), Map.class); - map.put("id"," "); - map.put("customerName"," "); - map.put("customerTelephone"," "); - map.put("customerAddress"," "); - map.put("shipperName"," "); - map.put("shipperAddress"," "); - map.put("orderCode",distributionStockListInfoEntity.getOrderCode()); - map.put("stockPackageCode",distributionStockListInfoEntity.getPackageCode()); - String filename = QRCodeUtil.createCodeToFile(distributionStockListInfoEntity.getPackageCode()); - map.put("img", QRCodeUtil.getEmpAutograph(filename)); - if (Func.isNotEmpty(distributionStockListInfoEntity.getOrderCode())){ - String fileTypeName = QRCodeUtil.createCodeToFile(distributionStockListInfoEntity.getOrderCode()); - map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); - } - data.add(map); + Map map = JSONObject.parseObject(JSONObject.toJSONString(distributionStockListInfoEntity), Map.class); + map.put("id", " "); + map.put("customerName", " "); + map.put("customerTelephone", " "); + map.put("customerAddress", " "); + map.put("shipperName", " "); + map.put("shipperAddress", " "); + map.put("orderCode", distributionStockListInfoEntity.getOrderCode()); + map.put("stockPackageCode", distributionStockListInfoEntity.getPackageCode()); + String filename = QRCodeUtil.createCodeToFile(distributionStockListInfoEntity.getPackageCode()); + map.put("img", QRCodeUtil.getEmpAutograph(filename)); + if (Func.isNotEmpty(distributionStockListInfoEntity.getOrderCode())) { + String fileTypeName = QRCodeUtil.createCodeToFile(distributionStockListInfoEntity.getOrderCode()); + map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); + } + data.add(map); } } orderPackgeCodeDataVO.setDataList(data); @@ -1096,37 +1156,37 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl getMerchantStockList(String materielCode) { BladeUser user = AuthUtil.getUser(); - List stockListEntities = baseMapper.getMerchantStockList(user.getTenantId(),materielCode); + List stockListEntities = baseMapper.getMerchantStockList(user.getTenantId(), materielCode); List distributionMerchantStockListVOS = new ArrayList<>(); - if (Func.isNotEmpty(stockListEntities)){ + if (Func.isNotEmpty(stockListEntities)) { for (DistributionStockListEntity stockListEntity : stockListEntities) { - switch (stockListEntity.getSourceType()){ + switch (stockListEntity.getSourceType()) { case "1": //订单转入 List merchantStockListVOS = baseMapper.selectMerchantHaveDataStockListInfo(stockListEntity.getId()); - if (Func.isNotEmpty(merchantStockListVOS)){ + if (Func.isNotEmpty(merchantStockListVOS)) { distributionMerchantStockListVOS.addAll(merchantStockListVOS); } break; case "2": //数据导入 - List merchantNotHaveDataStockListVOS =baseMapper.selectMerchantNotHaveDataStockListInfo(stockListEntity.getId()); - if (Func.isNotEmpty(merchantNotHaveDataStockListVOS)){ + List merchantNotHaveDataStockListVOS = baseMapper.selectMerchantNotHaveDataStockListInfo(stockListEntity.getId()); + if (Func.isNotEmpty(merchantNotHaveDataStockListVOS)) { distributionMerchantStockListVOS.addAll(merchantNotHaveDataStockListVOS); } break; } } } - if (Func.isNotEmpty(distributionMerchantStockListVOS)){ + if (Func.isNotEmpty(distributionMerchantStockListVOS)) { boolean flag = distributionMerchantStockListVOS.stream().anyMatch(m -> m.getTrayName() == null && m.getAllocation() == null); - if (flag){ + if (flag) { //存在有无库位无托盘的库存品 //对无库位无托盘进行汇总 int sum = distributionMerchantStockListVOS.stream().filter(m -> m.getAllocation() == null && m.getTrayName() == null).mapToInt(DistributionMerchantStockListVO::getNum).sum(); @@ -1140,8 +1200,6 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl parcelListEntities = distributionParcelListService.list(Wrappers.query().lambda() @@ -1184,18 +1242,18 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl OrderPackageStockupStatusConstant.yibeihu.getValue().equals(f.getOrderPackageStockupStatus())).map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(",")); - if (Func.isNotBlank(collect)){ - log.error(method+"撤销物料存在包件已备货,collect:{}",collect); - return R.fail(collect+"已备货,无法撤销!!!"); + if (Func.isNotBlank(collect)) { + log.error(method + "撤销物料存在包件已备货,collect:{}", collect); + return R.fail(collect + "已备货,无法撤销!!!"); } - if (Func.isEmpty(parcelListEntities)){ - log.error(method+"查询包件失败,packageIds:{}",packageIds); - return R.fail(403,"操作失败"); + if (Func.isEmpty(parcelListEntities)) { + log.error(method + "查询包件失败,packageIds:{}", packageIds); + return R.fail(403, "操作失败"); } List orderCode = parcelListEntities.stream().map(DistributionParcelListEntity::getOrderCode).collect(Collectors.toList()); - if (Func.isEmpty(orderCode) || orderCode.size()>1){ - log.error(method+"包件数据错误,orderCode:{}",orderCode); - return R.fail(403,"操作失败"); + if (Func.isEmpty(orderCode) || orderCode.size() > 1) { + log.error(method + "包件数据错误,orderCode:{}", orderCode); + return R.fail(403, "操作失败"); } LambdaUpdateWrapper up = new UpdateWrapper().lambda() @@ -1207,26 +1265,24 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl 0){ + if ((stockListEntity.getQuantityStock() - parcelListEntities.size()) > 0) { stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - parcelListEntities.size()); this.updateById(stockListEntity); - }else if ((stockListEntity.getQuantityStock() - parcelListEntities.size()) <= 0){ + } else if ((stockListEntity.getQuantityStock() - parcelListEntities.size()) <= 0) { this.removeById(stockListEntity); } //清理库存品入库记录 distributionStockListInfoService.removeBatchByIds(Func.toLongList(distributionStockListDTO.getStockListInfoIds())); List aaa = new ArrayList<>(); //增加撤销转库存品日志 - parcelListEntities.forEach(p->{ - String content = "包件在"+myCurrentWarehouse.getName()+"由"+AuthUtil.getNickName()+"撤销转库存品,"+"批次号:"+stockListEntity.getIncomingBatch()+"物料名称:"+stockListEntity.getDescriptionGoods()+"物料编码:"+stockListEntity.getCargoNumber(); + parcelListEntities.forEach(p -> { + String content = "包件在" + myCurrentWarehouse.getName() + "由" + AuthUtil.getNickName() + "撤销转库存品," + "批次号:" + stockListEntity.getIncomingBatch() + "物料名称:" + stockListEntity.getDescriptionGoods() + "物料编码:" + stockListEntity.getCargoNumber(); JSONObject js = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), p.getOrderPackageCode(), content, WorkNodeEnums.CANCEL_STOCK_TRANSFER.getCode()); aaa.add(js); }); @@ -1237,23 +1293,22 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl