diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java index db8470b74..50e716e84 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java @@ -215,6 +215,10 @@ public class DistributionParcelListEntity extends TenantEntity { @TableField(exist = false) private Integer reservationNum; + @ApiModelProperty(value = "是否选择") + @TableField(exist = false) + private Boolean choice; //是否选择 + @ApiModelProperty(value = "备货状态") diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java index cd381e7a1..2ff7f4ef8 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java @@ -39,6 +39,11 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public class DistributionStockListEntity extends TenantEntity { + /** + * 预留1 + */ + @ApiModelProperty(value = "预留1") + private Long id; /** * 预留1 */ diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupOrderListVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupOrderListVO.java index 439fa10b0..80558e1aa 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupOrderListVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupOrderListVO.java @@ -38,5 +38,6 @@ public class DistributionStockupOrderListVO implements Serializable { private Long stockId; //备货id private Long allocationId; //货位id private Integer stockQuantity; //备货数量 + private Integer allocationNumber; //货位数量 } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java index 9b3ce790f..0bd951461 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java @@ -37,28 +37,28 @@ public class DistributionAppDeliveryListVO extends DistributionDeliveryListEntit /** * 装车件数 */ - @ApiModelProperty(value = "装车件数") + @ApiModelProperty(value = "计划装车件数") private Integer loadingNub; /** * 装车订单数 */ - @ApiModelProperty(value = "装车订单数") + @ApiModelProperty(value = "完成装车订单数") private Integer loadOrdNub; /** * 签收件数 */ - @ApiModelProperty(value = "签收件数") + @ApiModelProperty(value = "实际装车件数") private Integer signNub; /** * 签收完成件数 */ - @ApiModelProperty(value = "签收完成件数") + @ApiModelProperty(value = "装车完成件数") private Integer signNubSr; /** * 装车客户数 */ - @ApiModelProperty(value = "装车客户数") + @ApiModelProperty(value = "完成装车客户数") private Integer loadCusNub; /** @@ -136,6 +136,8 @@ public class DistributionAppDeliveryListVO extends DistributionDeliveryListEntit private List reservationList; + + /** * 包条数据 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java index 95a61c883..fbccbe226 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java @@ -112,8 +112,8 @@ public class DistributionDeliveryAppController { @GetMapping("/wrap") @ApiOperationSupport(order = 5) @ApiOperation(value = "查看配送明细", notes = "DistributionAppDeliveryListDTO") - public R> wrap(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO, Query query) { - IPage page = distributionDeliveryListService.selectDistributionAppDeliverywrap(Condition.getPage(query), distributionAppDeliveryListDTO); + public R wrap(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { + DistributionAppDeliveryListVO page = distributionDeliveryListService.selectDistributionAppDeliverywrap(distributionAppDeliveryListDTO); return R.data(page); } @@ -123,8 +123,8 @@ public class DistributionDeliveryAppController { @GetMapping("/wrapIn") @ApiOperationSupport(order = 5) @ApiOperation(value = "查看配送明细", notes = "DistributionAppDeliveryListDTO") - public R> wrapIn(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO, Query query) { - IPage page = distributionDeliveryListService.selectDistributionAppDeliverywrapIn(Condition.getPage(query), distributionAppDeliveryListDTO); + public R> wrapIn(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { + List page = distributionDeliveryListService.selectDistributionAppDeliverywrapIn(distributionAppDeliveryListDTO); return R.data(page); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java index a3c7321eb..7ca33b4aa 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java @@ -155,8 +155,8 @@ public class DistributionParcelListController extends BladeController { @GetMapping("/pickupPack") @ApiOperationSupport(order = 2) @ApiOperation(value = "查询自提包件信息", notes = "传入distributionParcelList") - public R> getPickupPack(@ApiIgnore @RequestParam Map distributionParcelList, Query query) { - List list = distributionParcelListService.getPickupPack(distributionParcelList); + public R> getPickupPack(@ApiIgnore @RequestParam Map distributionParcelList, Query query) { + IPage list = distributionParcelListService.getPickupPack(distributionParcelList,Condition.getPage(query)); return R.data(list); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java index d20c50666..2666780af 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java @@ -139,7 +139,7 @@ public interface IDistributionDeliveryListService extends BaseService selectDistributionAppDeliverywrap(IPage page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO); + DistributionAppDeliveryListVO selectDistributionAppDeliverywrap( DistributionAppDeliveryListDTO distributionAppDeliveryListDTO); /** * 查询配送任务详情 * @param id @@ -151,7 +151,7 @@ public interface IDistributionDeliveryListService extends BaseService getAppDeliveryreservationListPage(IPage page,DistributionAppDeliveryListDTO distributionDeliveryList); - IPage selectDistributionAppDeliverywrapIn(IPage page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO); + List selectDistributionAppDeliverywrapIn( DistributionAppDeliveryListDTO distributionAppDeliveryListDTO); /** * 修改配送任务 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java index 6be0a3dad..faade8b1b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java @@ -152,7 +152,8 @@ public interface IDistributionParcelListService extends BaseService getPickupPack(Map distributionParcelList); + IPage getPickupPack(Map distributionParcelList,IPage page); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index e6cb02814..e97be5653 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -1427,7 +1427,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { nu.set(nu.get() + sum); } //修改预约备货状态 - if(nuy.get() == nu.get()){ + if(nuy.get() >= nu.get()){ DistributionReservationEntity reservationEntity = new DistributionReservationEntity(); reservationEntity.setId(i.getReservationId()); reservationEntity.setStockupStatus(ReservationStockupStatusConstant.yibeihuo.getValue()); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java index a0fbe02a3..7a42654c6 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java @@ -75,6 +75,8 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl selectDistributionDeliveryInfoPage(IPage page, DistributionDeliveryInfoVO distributionDeliveryInfo) { List distributionDeliveryInfoVOS = baseMapper.selectDistributionDeliveryInfoPage(page, distributionDeliveryInfo); @@ -393,8 +395,24 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl selectDistributionAppDeliveryInventory( DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { List inventoryList = distributionReservationMapper.selectInventoryListByReservation(Long.parseLong(distributionAppDeliveryListDTO.getReservationId())); + if (Func.isEmpty(inventoryList)){ + log.error("##########查询该客户库存品信息为null"); + return null; + } + List stockListIds = inventoryList.stream().map(DisStockListDetailEntity::getStockListId).distinct().collect(Collectors.toList()); + List distributionStockListEntities = distributionStockListService.listByIds(stockListIds); + Map stockListMap = distributionStockListEntities.stream().collect(Collectors.toMap(DistributionStockListEntity::getId, Function.identity(), (k1, k2) -> k2)); List disStockListDetailVOS = DistributionDisStockListWrapper.build().listVO(inventoryList); - + disStockListDetailVOS.stream().forEach(sd->{ + if (Func.isNotEmpty(stockListMap.get(sd.getStockListId()))){ + DistributionStockListEntity distributionStockListEntity = stockListMap.get(sd.getStockListId()); + sd.setMarketName(distributionStockListEntity.getMarketName()); + sd.setDescriptionGoods(distributionStockListEntity.getDescriptionGoods()); + sd.setCargoUnit(distributionStockListEntity.getCargoUnit()); + sd.setCargoNorms(distributionStockListEntity.getCargoNorms()); + sd.setCargoNumber(distributionStockListEntity.getCargoNumber()); + } + }); // List distributionAppStockArticleVOS = baseMapper.selectDistributionAppDeliveryInventoryPage(page, distributionAppDeliveryListDTO); return disStockListDetailVOS; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index fc2340a99..734a3a9fc 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -41,10 +41,7 @@ import com.logpm.distribution.service.*; import com.logpm.distribution.vo.*; import com.logpm.distribution.vo.app.*; import com.logpm.distribution.vo.print.PrintPreviewVO; -import com.logpm.distribution.wrapper.DistributionDeliveryListWrapper; -import com.logpm.distribution.wrapper.DistributionParcelListWrapper; -import com.logpm.distribution.wrapper.DistributionReservationWrapper; -import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; +import com.logpm.distribution.wrapper.*; import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; import com.logpm.warehouse.feign.IWarehouseTrayTypeClient; import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; @@ -89,6 +86,7 @@ import org.springframework.data.redis.connection.ReactiveListCommands; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.math.BigDecimal; import java.text.SimpleDateFormat; @@ -141,6 +139,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl stockListDetailEntityList = disStockListDetailService.list(Wrappers.query().lambda() + .eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) + .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationInventoryStatusConstant.quxiao.getValue())); + boolean inventoryLoadingFlag = stockListDetailEntityList.stream().allMatch(i -> i.getStockPackageStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); + boolean inventoryStockUpFlag = stockListDetailEntityList.stream().anyMatch(l -> Func.isEmpty(l.getStockPackageCode())); + if (inventoryStockUpFlag) { + log.error("##################库存品未备货"); + return Resp.scanFail("操作失败","存在库存品未备货"); +// return R.fail("该客户存在库存品暂未备货 一键装车失败!!!"); + } Map> allStockArticle = reservationStockarticleEntityList.stream().filter(f -> Func.isNotEmpty(f.getIsZero())).collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getIsZero)); DistributionDeliverySelfEntity finalDistributionDeliverySelfEntity = distributionDeliverySelfEntity; allStockArticle.forEach((k, v) -> { @@ -1443,16 +1452,16 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl stockListDetailEntityList = disStockListDetailService.list(Wrappers.query().lambda() - .eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) - .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationInventoryStatusConstant.quxiao.getValue())); - boolean inventoryLoadingFlag = stockListDetailEntityList.stream().allMatch(i -> i.getStockPackageStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); - boolean inventoryStockUpFlag = stockListDetailEntityList.stream().anyMatch(l -> Func.isEmpty(l.getStockPackageCode())); - if (inventoryStockUpFlag) { - log.error("##################库存品未备货"); - throw new RuntimeException("该客户存在库存品暂未备货 一键装车失败!!!"); -// return R.fail("该客户存在库存品暂未备货 一键装车失败!!!"); - } +// List stockListDetailEntityList = disStockListDetailService.list(Wrappers.query().lambda() +// .eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) +// .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationInventoryStatusConstant.quxiao.getValue())); +// boolean inventoryLoadingFlag = stockListDetailEntityList.stream().allMatch(i -> i.getStockPackageStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); +// boolean inventoryStockUpFlag = stockListDetailEntityList.stream().anyMatch(l -> Func.isEmpty(l.getStockPackageCode())); +// if (inventoryStockUpFlag) { +// log.error("##################库存品未备货"); +// return Resp.scanFail("操作失败","存在库存品未备货"); +//// return R.fail("该客户存在库存品暂未备货 一键装车失败!!!"); +// } if (!inventoryLoadingFlag) { //存在库存品海为进行装车 for (DisStockListDetailEntity disStockListDetailEntity : stockListDetailEntityList) { @@ -2464,9 +2473,27 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl selectDistributionAppDeliverywrapIn(IPage page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { - List distributionAppStockListVOS = baseMapper.selectListbyink(page, distributionAppDeliveryListDTO.getId()); - return page.setRecords(distributionAppStockListVOS); + public List selectDistributionAppDeliverywrapIn(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { + List detailEntities = baseMapper.selectInventoryListByDeliveryListId(distributionAppDeliveryListDTO.getId()); + if (Func.isEmpty(detailEntities)){ + return null; + } + List stockListIds = detailEntities.stream().map(DisStockListDetailEntity::getStockListId).distinct().collect(Collectors.toList()); + List distributionStockListEntities = distributionStockListService.listByIds(stockListIds); + Map stockListMap = distributionStockListEntities.stream().collect(Collectors.toMap(DistributionStockListEntity::getId, Function.identity(), (k1, k2) -> k2)); + List disStockListDetailVOS = DistributionDisStockListWrapper.build().listVO(detailEntities); + disStockListDetailVOS.stream().forEach(sd->{ + if (Func.isNotEmpty(stockListMap.get(sd.getStockListId()))){ + DistributionStockListEntity distributionStockListEntity = stockListMap.get(sd.getStockListId()); + sd.setMarketName(distributionStockListEntity.getMarketName()); + sd.setDescriptionGoods(distributionStockListEntity.getDescriptionGoods()); + sd.setCargoUnit(distributionStockListEntity.getCargoUnit()); + sd.setCargoNorms(distributionStockListEntity.getCargoNorms()); + sd.setCargoNumber(distributionStockListEntity.getCargoNumber()); + } + }); + + return disStockListDetailVOS; } @Override @@ -3619,7 +3646,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl selectDistributionAppDeliverywrap(IPage page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { + public DistributionAppDeliveryListVO selectDistributionAppDeliverywrap( DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) { //查询配送 // DistributionDeliveryListEntity distributionDeliveryListEntity = baseMapper.selectById(distributionAppDeliveryListDTO.getId()); // DistributionAppDeliveryListVO distributionAppDeliveryListVO = new DistributionAppDeliveryListVO(); @@ -3633,10 +3660,84 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl=distributionAppStockArticleVO.getReservationNum()) {ordCount +=1;} // } + + DistributionDeliveryListEntity distributionDeliveryListEntity = baseMapper.selectById(distributionAppDeliveryListDTO.getId()); + DistributionAppDeliveryListVO distributionAppDeliveryListVO = Func.copy(distributionDeliveryListEntity, DistributionAppDeliveryListVO.class); //查询该配送所有包条 - List parcelListVOS = baseMapper.selectListbypack(page, distributionAppDeliveryListDTO); + List appParcelListVOS = new ArrayList<>(); + List reservationStockarticleEntityList = baseMapper.selectReservationStockByDeliveryId(distributionAppDeliveryListDTO.getId()); + List reservationEntityList = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListDTO.getId()); + if (Func.isEmpty(reservationEntityList)){ + log.error("###################查询配送预约信息异常,deliveryID:{}",distributionAppDeliveryListDTO.getId()); + return null; + } + if (Func.isEmpty(reservationStockarticleEntityList)){ + return null; + } + //计划客户数 + Long customersNumber = reservationStockarticleEntityList.stream().map(DistributionReservationStockarticleEntity::getReservationId).count(); + Long orderNumber = reservationStockarticleEntityList.stream().map(DistributionReservationStockarticleEntity::getStockArticleId).count(); + int signNub = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationNum).sum() + reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationStockListNum).sum(); + //维护计划数量 + distributionAppDeliveryListVO.setCustomersNumber(customersNumber.intValue()); + distributionAppDeliveryListVO.setOrderNumber(orderNumber.intValue()); + distributionAppDeliveryListVO.setSignNub(signNub); + //维护完成情况 + Long loadCusNub = reservationEntityList.stream().filter(r -> r.getLoadingStatus().equals(ReservationLoadingStatusConstant.yizhuangche.getValue())).count(); + distributionAppDeliveryListVO.setLoadCusNub(loadCusNub.intValue()); + AtomicInteger loadOrdNub = new AtomicInteger(); + AtomicInteger signNubSr = new AtomicInteger(); +// distributionLoadscanService.list(Wrappers.query().lambda().eq(DistributionLoadscanEntity::get)) + + reservationStockarticleEntityList.forEach(rs->{ + if (rs.getIsZero().equals(IsOrNoConstant.no.getValue())){ + + List parcelListEntityList = distributionReservationMapper.selectPackageByReservationAndStockArticle(rs.getReservationId(), rs.getStockArticleId()); + List packageLoadingList = distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListDTO.getId()) + .eq(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + .eq(DistributionLoadscanEntity::getReservationId, rs.getReservationId()) + .in(DistributionLoadscanEntity::getPackageId, parcelListEntityList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()))); + if (Func.isNotEmpty(packageLoadingList)){ + signNubSr.getAndAdd(packageLoadingList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum()); + } + boolean packageFlag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); + if (packageFlag){ + //完成订单累加 + loadOrdNub.getAndIncrement(); + } + for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) { + DistributionAppParcelListVO appParcelListVO = Func.copy(parcelListEntity, DistributionAppParcelListVO.class); + appParcelListVOS.add(appParcelListVO); + } + }else if (rs.getIsZero().equals(IsOrNoConstant.yes.getValue())){ + List parcelNumberVOS = distributionReservationMapper.selectReservationZeroOrderDetail(rs.getStockArticleId(), rs.getReservationId()); + List loadscanEntities = distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListDTO.getId()) + .eq(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + .eq(DistributionLoadscanEntity::getReservationId, rs.getReservationId()) + .in(DistributionLoadscanEntity::getPackageId, parcelNumberVOS.stream().map(DistributionParcelNumberVO::getParcelListId).collect(Collectors.toList()))); + if (Func.isNotEmpty(loadscanEntities)){ + //统计装车数量 + signNubSr.getAndAdd(loadscanEntities.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum()); + int zeroPackageLoadingNum = loadscanEntities.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); + if (rs.getReservationNum() == zeroPackageLoadingNum){ + loadOrdNub.getAndIncrement(); + } + } + parcelNumberVOS.forEach(p->{ + DistributionAppParcelListVO appParcelListVO = Func.copy(p, DistributionAppParcelListVO.class); + appParcelListVOS.add(appParcelListVO); + }); + }else { + log.error("############reservation_stockarticle表isZero字段维护错误,reservationId:{}",rs.getReservationId()); + } + }); - return page.setRecords(parcelListVOS); + distributionAppDeliveryListVO.setLoadOrdNub(loadOrdNub.get()); + distributionAppDeliveryListVO.setSignNubSr(signNubSr.get()); +// List parcelListVOS = baseMapper.selectListbypack(page, distributionAppDeliveryListDTO); + return distributionAppDeliveryListVO; } @Override diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index 6aa500fa1..2f09df4b5 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -496,30 +496,33 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl getPickupPack(Map distributionParcelList) { + public IPage getPickupPack(Map distributionParcelList, IPage page) { Object o = distributionParcelList.get("stockArticleId"); Object reservationId = distributionParcelList.get("reservationId"); - List distributionParcelListEntities = baseMapper.selectList(Wrappers.query().lambda() - .eq(DistributionParcelListEntity::getStockArticleId, o) - .eq(DistributionParcelListEntity::getConditions, "1") - ); - List list = new ArrayList<>(); - distributionParcelListEntities.forEach( i ->{ + + DistributionParcelListDTO parcelListEntity = new DistributionParcelListDTO(); + parcelListEntity.setStockArticleId(Long.valueOf(o.toString())); + parcelListEntity.setConditions(1); + IPage distributionParcelListEntityIPage = baseMapper.pageOweList(page, parcelListEntity); + List list = new ArrayList<>(); + distributionParcelListEntityIPage.getRecords().forEach( i ->{ DistributionReservationZeroPackageEntity one = reservationZeroPackageService.getOne(Wrappers.query().lambda() .eq(DistributionReservationZeroPackageEntity::getStockArticleId, i.getStockArticleId()) .eq(DistributionReservationZeroPackageEntity::getReservationId, reservationId) .eq(DistributionReservationZeroPackageEntity::getParcelListId, i.getId()) .apply("zero_package_status in (1,3)") ); - DistributionParcelListVO parcelListVO = new DistributionParcelListVO(); + DistributionParcelListEntity parcelListVO = new DistributionParcelListEntity(); BeanUtils.copyProperties(i,parcelListVO); parcelListVO.setChoice(ObjectUtils.isNotNull(one) ? true : false); list.add(parcelListVO); }); - return list; + distributionParcelListEntityIPage.setRecords(list); + return distributionParcelListEntityIPage; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java index 6c2d5fe49..d5648f8de 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java @@ -17,6 +17,7 @@ package com.logpm.distribution.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -109,7 +110,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl list2 = distrilbutionBillStockService.listPackageSelf(i.getReservationId()); i.setPlanNum(i.getPlanNum()+list2.size()); + List listStock = distributionStockService.list(Wrappers.query().lambda() + .eq(DistributionStockEntity::getBillLadingId, i.getReservationId()) + .eq(DistributionStockEntity::getStockupId, stockupDTO.getStockupId()) + ); + if(!listStock.isEmpty()){ + int sum = listStock.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); + i.setStockupNum(sum); + }else{ + i.setStockupNum(0); + } }); - map.put("orderList", list); } else { //商 ,市 @@ -454,6 +464,16 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl list2 = distributionStockService.list(Wrappers.query().lambda() + .eq(DistributionStockEntity::getReservationId, stockupDTO.getReservationId()) + .eq(DistributionStockEntity::getStockupId, stockupDTO.getStockupId()) + ); + if(!list2.isEmpty()){ + int sum = list2.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); + distributionStockupListVO.setStockupNum(sum); + }else{ + distributionStockupListVO.setStockupNum(0); + } list.add(distributionStockupListVO); } } @@ -606,6 +626,86 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl allocationEntityList = warehouseTaryAllocationClient.getAllocationId(allocationId); + if(ObjectUtils.isNotNull(allocationEntityList) && !allocationEntityList.isEmpty()){ + //查询托盘信息 + + List trayList = warehouseTrayGoodsClient.getTrayList(trayGoodsEntity); + if(!trayList.isEmpty()){ + i.setTrayId(trayList.get(0).getId().toString()); + i.setPallet(trayList.get(0).getTrayCode()); + } + } + }else{ + + List trayList = warehouseTrayGoodsClient.getTrayList(trayGoodsEntity); + if(!trayList.isEmpty()){ + String trayId = trayList.stream().map(WarehouseTrayGoodsEntity::getTrayId).collect(Collectors.toList()).stream().map(Object::toString).collect(Collectors.joining(",")); + String trayCode = trayList.stream().map(WarehouseTrayGoodsEntity::getTrayCode).collect(Collectors.joining(",")); + i.setTrayId(trayId); + i.setPallet(trayCode); + } + } + return i; + + } + + /** + * 查询零担货位信息 + * @param list + * @return + */ + public List getZeroTrayInfo(List list){ + List listStockup = new ArrayList<>(); + Iterator iterator = list.iterator(); + while (iterator.hasNext()){ + DistributionStockupOrderListVO i = iterator.next(); + BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); + if(ObjectUtils.isNull(myCurrentWarehouse)){ + throw new ServiceException("请选择仓库信息!!"); + } + //查询货位信息 + WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity(); + updownGoodsEntity.setAssociationId(Long.valueOf(i.getStockArticleId())); + updownGoodsEntity.setWarehouseId(myCurrentWarehouse.getId()); + updownGoodsEntity.setAssociationValue(i.getOrderCode()); + updownGoodsEntity.setAssociationType("1"); + List information = warehouseUpdownGoodsClient.getLocationStockListInformation(updownGoodsEntity); + if(!information.isEmpty()){ + DistributionStockupOrderListVO finalI = i; + information.stream().forEach(q ->{ + DistributionStockupOrderListVO stockupOrderListVO = new DistributionStockupOrderListVO(); + BeanUtils.copyProperties(finalI,stockupOrderListVO); + //查询托盘信息 + stockupOrderListVO = getTrayInfo(stockupOrderListVO,Long.valueOf(stockupOrderListVO.getStockArticleId()),myCurrentWarehouse.getId(),stockupOrderListVO.getOrderCode(),q.getAllocationId()); + stockupOrderListVO.setAllocation(q.getPositionCode()); + stockupOrderListVO.setAllocationId(q.getAllocationId()); + stockupOrderListVO.setAllocationNumber(q.getNum()); + listStockup.add(stockupOrderListVO); + iterator.remove(); + }); + } + + } + list.addAll(listStockup); + return list; + +} + + /** * 查询自提信息 * @param reservationId @@ -620,35 +720,11 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl{ - BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNull(myCurrentWarehouse)){ - throw new ServiceException("请选择仓库信息!!"); - } - WarehouseTrayGoodsEntity trayGoodsEntity = new WarehouseTrayGoodsEntity(); - trayGoodsEntity.setAssociationId(Long.valueOf(i.getStockArticleId())); - trayGoodsEntity.setWarehouseId(myCurrentWarehouse.getId()); - trayGoodsEntity.setAssociationValue(i.getOrderCode()); - trayGoodsEntity.setAssociationType("1"); - List trayList = warehouseTrayGoodsClient.getTrayList(trayGoodsEntity); - if(!trayList.isEmpty()){ - i.setTrayId(trayList.get(0).getId().toString()); - i.setPallet(trayList.get(0).getTrayCode()); - } - WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity(); - updownGoodsEntity.setAssociationId(Long.valueOf(i.getStockArticleId())); - trayGoodsEntity.setWarehouseId(myCurrentWarehouse.getId()); - trayGoodsEntity.setAssociationValue(i.getOrderCode()); - trayGoodsEntity.setAssociationType("1"); - List information = warehouseUpdownGoodsClient.getLocationStockListInformation(updownGoodsEntity); - if(!information.isEmpty()){ - i.setAllocation(information.get(0).getPositionCode()); - i.setAllocationId(information.get(0).getAllocationId()); - } - }); - + List zeroTrayInfo = getZeroTrayInfo(list); + if(!zeroTrayInfo.isEmpty()){ + list = zeroTrayInfo; + } } - //获取有货位的数据 List collect11 = list.stream().filter(o -> ObjectUtils.isNotNull(o.getAllocationId())).collect(Collectors.toList()); Set listYou = new HashSet<>(); @@ -838,6 +914,14 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl(); } + //零担查询货位,托盘信息 + if(stockupDTO.getIsZero().equals("1")){ + List zeroTrayInfo = getZeroTrayInfo(list); + if(!zeroTrayInfo.isEmpty()){ + list = zeroTrayInfo; + } + } + List collect11 = list.stream().filter(o -> ObjectUtils.isNotNull(o.getAllocationId())).collect(Collectors.toList()); //有货位 Set listYou = new HashSet<>(); // collect11.forEach( p ->{ @@ -882,6 +966,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImplquery().lambda() + .eq(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "1") + .eq(DistributionReservationZeroPackageEntity::getId, i.getId()) + ); + + + if(ObjectUtils.isNull()){ + return Resp.scanFail(i.getCategoryName()+"备货信息未找到!",i.getCategoryName()+"备货信息未找到!"); + } + if(one.getQuantity().equals(one.getRealityQuantity())){ + return Resp.scanFail(i.getCategoryName()+"备货已完成!!",i.getCategoryName()+"备货已完成!!"); + } + } + //把数据取出来 List zeroStockUpData;; @@ -2206,7 +2340,6 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl collect = stockupDTO.getList().stream().filter( //可以 @@ -2214,12 +2347,23 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl stockEntityList = new ArrayList<>(); + List jsonObjectList = new ArrayList<>(); for (StockupZeroVO i : collect) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("warehouseId",myCurrentWarehouse.getId()); //查询是不是当前包件 DistributionReservationZeroPackageEntity byId1 = reservationZeroPackageService.getById(i.getId()); if(ObjectUtils.isNull(byId1)){ continue; } + DistributionStockArticleEntity stockArticle = distributionStockArticleService.getById(byId1.getStockArticleId()); + if(ObjectUtils.isNull(stockArticle)){ + throw new ServiceException("订单数据不存在!!"); + } + jsonObject.put("orderCode",stockArticle.getOrderCode()); + jsonObject.put("waybillCode",stockArticle.getWaybillNumber()); + + //查询备货信息 QueryWrapper queryWrapper = new QueryWrapper<>(); if(stockupDTO.getTypeService().equals("3")){ queryWrapper.eq("bill_lading_id",stockupDTO.getReservationId()); @@ -2232,8 +2376,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl byId.getQuantity()){ +// DistributionReservationZeroPackageEntity byId = reservationZeroPackageService.getById(i.getId()); + if(i.getQuantity() > byId1.getQuantity()){ return Resp.scanFail(i.getCategoryName()+"备货数量大于待备货数量!",i.getCategoryName()+"备货数量大于待备货数量!"); } Optional first = stockupDTO.getList().stream().filter(q -> i.getStockArticleId().equals(q.getStockArticleId()) && q.getQuantity() <= i.getQuantity() && q.getQuantity() > 0).findFirst(); @@ -2243,12 +2387,14 @@ public class DistributionStockupServiceImpl extends BaseServiceImplquery().lambda() .eq(ObjectUtils.isNotNull(updownGoodsEntity.getAllocationId()),WarehouseUpdownGoodsEntity::getAllocationId,updownGoodsEntity.getAllocationId()) - .eq(WarehouseUpdownGoodsEntity::getAssociationValue,updownGoodsEntity.getAssociationValue()) + .eq(ObjectUtils.isNotNull(updownGoodsEntity.getAssociationValue()),WarehouseUpdownGoodsEntity::getAssociationValue,updownGoodsEntity.getAssociationValue()) .eq(WarehouseUpdownGoodsEntity::getWarehouseId,updownGoodsEntity.getWarehouseId()) + .eq(ObjectUtils.isNotNull(updownGoodsEntity.getAssociationType()),WarehouseUpdownGoodsEntity::getAssociationType,updownGoodsEntity.getAssociationType()) .eq(ObjectUtils.isNotNull(updownGoodsEntity.getAssociationId()),WarehouseUpdownGoodsEntity::getAssociationId,updownGoodsEntity.getAssociationId()) ); }