diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java index d98790833..34c888edd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java @@ -3305,84 +3305,90 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl parcelListIds = new HashSet<>(); - for (int i = 0; i < split.length; i++) { - String s = split[i]; - //查询是不是上传图片 - List list1 = distributionPrintService.list(Wrappers.query().lambda() - .eq(DistributionPrintEntity::getBillLadingId, s) - ); - if (list1.isEmpty()) { - throw new ServiceException("请上传签收图片!!"); - } - int count = (int) list1.stream().filter(ii -> "1".equals(ii.getGenre().toString())).count(); - int count1 = (int) list1.stream().filter(ii -> "2".equals(ii.getGenre().toString())).count(); - int count2 = (int) list1.stream().filter(ii -> "3".equals(ii.getGenre().toString())).count(); - if (count1 < 1 || count < 1 || count2 < 1) { - throw new ServiceException("请上传完整签收图片!!"); - } - //修改提货状态 - DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity(); - billLadingEntity.setConditions(BillLadingStatusConstant.yiqianshou.getValue()); - billLadingEntity.setId(Long.parseLong(s)); - this.updateById(billLadingEntity); - //完成备货状态 - distributionStockupInfoService.maintenanceStockUp(Long.parseLong(s), 2); - //查询自提单是否完成扫描 - Integer integer = this.selectBillLadingPlanNum(Long.parseLong(s)); - List ladingScanEntities = distributionBillLadingScanService.list(Wrappers.query().lambda() - .eq(DistributionBillLadingScanEntity::getBillLadingId, Long.parseLong(s)) - .eq(DistributionBillLadingScanEntity::getMaterialType, "2") - ); - if (Func.isNotEmpty(ladingScanEntities)) { - int sum = ladingScanEntities.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum(); - if (integer != sum) { - //存在资源释放操作 - distributionAsyncService.releaseBillLadingResource(Long.parseLong(s), myCurrentWarehouse.getId()); + try{ + for (int i = 0; i < split.length; i++) { + String s = split[i]; + //查询是不是上传图片 + List list1 = distributionPrintService.list(Wrappers.query().lambda() + .eq(DistributionPrintEntity::getBillLadingId, s) + ); + if (list1.isEmpty()) { + throw new ServiceException("请上传签收图片!!"); } - parcelListIds.addAll(ladingScanEntities.stream().map(DistributionBillLadingScanEntity::getParcelListId).collect(Collectors.toSet())); - for (DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities) { - // 签收发送消息到工厂 - pushFactoryOrderData(myCurrentWarehouse.getId(), ladingScanEntity.getParcelListId().toString(), ladingScanEntity.getOrderSelfNumbering()); + int count = (int) list1.stream().filter(ii -> "1".equals(ii.getGenre().toString())).count(); + int count1 = (int) list1.stream().filter(ii -> "2".equals(ii.getGenre().toString())).count(); + int count2 = (int) list1.stream().filter(ii -> "3".equals(ii.getGenre().toString())).count(); + if (count1 < 1 || count < 1 || count2 < 1) { + throw new ServiceException("请上传完整签收图片!!"); + } + //修改提货状态 + DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity(); + billLadingEntity.setConditions(BillLadingStatusConstant.yiqianshou.getValue()); + billLadingEntity.setId(Long.parseLong(s)); + this.updateById(billLadingEntity); + //完成备货状态 + distributionStockupInfoService.maintenanceStockUp(Long.parseLong(s), 2); + //查询自提单是否完成扫描 + Integer integer = this.selectBillLadingPlanNum(Long.parseLong(s)); + List ladingScanEntities = distributionBillLadingScanService.list(Wrappers.query().lambda() + .eq(DistributionBillLadingScanEntity::getBillLadingId, Long.parseLong(s)) + .eq(DistributionBillLadingScanEntity::getMaterialType, "2") + ); + if (Func.isNotEmpty(ladingScanEntities)) { + int sum = ladingScanEntities.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum(); + if (integer != sum) { + //存在资源释放操作 + distributionAsyncService.releaseBillLadingResource(Long.parseLong(s), myCurrentWarehouse.getId()); + } + parcelListIds.addAll(ladingScanEntities.stream().map(DistributionBillLadingScanEntity::getParcelListId).collect(Collectors.toSet())); + for (DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities) { + // 签收发送消息到工厂 + pushFactoryOrderData(myCurrentWarehouse.getId(), ladingScanEntity.getParcelListId().toString(), ladingScanEntity.getOrderSelfNumbering()); + } + } else { + distributionAsyncService.releaseBillLadingResource(Long.parseLong(s), myCurrentWarehouse.getId()); } - } else { - distributionAsyncService.releaseBillLadingResource(Long.parseLong(s), myCurrentWarehouse.getId()); - } - //修改订单状态 - List list = distrilbutionBillStockService.list(Wrappers.query().lambda() - .eq(DistrilbutionBillStockEntity::getBillLadingId, s) - .apply("order_status in ( '1' , '3')") + //修改订单状态 + List list = distrilbutionBillStockService.list(Wrappers.query().lambda() + .eq(DistrilbutionBillStockEntity::getBillLadingId, s) + .apply("order_status in ( '1' , '3')") // .or(ew -> ew.eq(DistrilbutionBillStockEntity::getBillLadingId, s).apply(DistrilbutionBillStockEntity::getOrderStatus, "2")) - ); - if (!list.isEmpty()) { - list.forEach(li -> { - DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); - stockArticleEntity.setId(li.getStockArticleId()); + ); + if (!list.isEmpty()) { + list.forEach(li -> { + DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); + stockArticleEntity.setId(li.getStockArticleId()); - List list2 = distributionParcelListService.list(Wrappers.query().lambda() - .eq(DistributionParcelListEntity::getStockArticleId, li.getStockArticleId()) - .apply("order_package_status != 70 ") - ); - if (list2.isEmpty()) { - stockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); - } else { - stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); - } - //回退包件数据 - Integer i1 = updatePack(li.getStockArticleId(), Long.valueOf(s)); - if (i1 > 0) { - stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); - } - distributionStockArticleService.updateById(stockArticleEntity); - }); - } - //处理库存品签收数据 - updateStock(s); + List list2 = distributionParcelListService.list(Wrappers.query().lambda() + .eq(DistributionParcelListEntity::getStockArticleId, li.getStockArticleId()) + .apply("order_package_status != 70 ") + ); + if (list2.isEmpty()) { + stockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); + } else { + stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); + } + //回退包件数据 + Integer i1 = updatePack(li.getStockArticleId(), Long.valueOf(s)); + if (i1 > 0) { + stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); + } + distributionStockArticleService.updateById(stockArticleEntity); + }); + } + //处理库存品签收数据 + updateStock(s); - // 回传老系统自提数据 - sendOldSystem(Long.parseLong(s)); + // 回传老系统自提数据 + sendOldSystem(Long.parseLong(s)); + } + }catch (Exception e){ + log.error(">>>>>",e); + return false; } + // 回传工厂数据 sendFactory(myCurrentWarehouse, parcelListIds); @@ -3467,7 +3473,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl