diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java index a716b2e07..f05b5a9ee 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java @@ -32,6 +32,14 @@ import lombok.EqualsAndHashCode; public class DistributionAddvaluePackageVO extends DistributionAddvaluePackageEntity { private static final long serialVersionUID = 1L; + /** + * 最大操作数量 零担需要先进行装车 + */ private Integer maxQuantity; + /** + * 计划数量 + */ + private Integer planQuantity; + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionAddvalueAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionAddvalueAppController.java index 4135ac484..bf3201df7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionAddvalueAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionAddvalueAppController.java @@ -95,7 +95,6 @@ public class DistributionAddvalueAppController { return r; } - /** * 编辑保存 */ @@ -107,8 +106,6 @@ public class DistributionAddvalueAppController { return r; } - - /** * 查询编辑增值服务数据 */ @@ -120,8 +117,6 @@ public class DistributionAddvalueAppController { return r; } - - /** * 查询增值服务数据 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java index c995518c2..33ca15b5d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java @@ -130,7 +130,7 @@ public class DistributionSignforController extends BladeController { @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入distributionSignfor") public R> signforPackageList(Long signforId) { - List distributionSignforsnmbVO = distributionSignforService.signforPackageList(signforId); + List distributionSignforsnmbVO= distributionSignforService.signforPackageList(signforId); return R.data(distributionSignforsnmbVO); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueDetailMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueDetailMapper.java index 6cc5af367..f06dbdf17 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueDetailMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueDetailMapper.java @@ -53,7 +53,7 @@ public interface DistributionAddvalueDetailMapper extends BaseMapper - + @@ -27,7 +28,7 @@ - DELETE FROM logpm_distribution_addvalue_detil WHERE addvalue_id = #{addvalueId} + DELETE FROM logpm_distribution_addvalue_detail WHERE addvalue_id = #{addvalueId} @@ -36,7 +37,8 @@ - SELECT * FROM logpm_distribution_addvalue_detail ${ew.customSqlSegment} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml index cd9be75a7..c651c45dc 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml @@ -61,6 +61,7 @@ ldad.num AS num, ldad.flool_num AS floolNum, ldad.distance AS distance, + lda.addvalue_id AS addvalueId, ldad.id AS addvalueDetailId, GROUP_CONCAT(ldap.package_id) AS packageListIds, ldad.record_type AS isAll diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java index 373f0c89b..bc6ce2c25 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java @@ -57,7 +57,7 @@ public interface DistributionAddvaluePackageMapper extends BaseMapper @@ -1037,7 +1038,7 @@ resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO"> SELECT ldrzp.parcel_list_id, - ldrzp.quantity AS quantity, + ldrzp.quantity AS reservationNum, ldrzp.reservation_id AS reservationId, 3 AS conditions, ldsa.order_code AS orderCode, diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml index 52a095749..5f8c92620 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml @@ -555,6 +555,7 @@ CASE WHEN lds.positioning IS NOT NULL THEN true ELSE false END AS positioning, (SELECT COALESCE(COUNT(*), 0) from logpm_distribution_reservation_stockarticle ldrs WHERE ldrs.reservation_id =ldr.id ) ordNub, COALESCE(lds.received_quantity + lds.receivedin_quantity, 0) signNub, + COALESCE(lds.loaded_number + lds.loadedin_number, 0) signNub, COALESCE(ldr.reservation_num + ldr.reservation_stock_list_num, 0) reservationNum FROM logpm_distribution_signfor lds diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java index 716cc075b..c94cbc85f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java @@ -190,18 +190,20 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl packageEntityList = distributionAppAddvalueDTO.getPackageEntityList().stream().filter(p->p.getQuantity()>0).collect(Collectors.toList()); + List packageEntityList = distributionAppAddvalueDTO.getPackageEntityList(); + List packageDTOList = packageEntityList.stream().filter(p -> Func.isNotEmpty(p.getQuantity()) && p.getQuantity() > 0).collect(Collectors.toList()); + if (Func.isEmpty(packageDTOList)){ + return Resp.scanFail("操作失败","无可用包件信息"); + } //查询是否重复添加 DistributionAddvalueEntity addvalueEntity = distributionAddvalueMapper.selectOne(Wrappers.query().lambda() .eq(DistributionAddvalueEntity::getAddvalueId, distributionAppAddvalueDTO.getAddvalueType()) .eq(DistributionAddvalueEntity::getRefId, distributionAppAddvalueDTO.getReservationId()) .eq(DistributionAddvalueEntity::getRefType, 1)); + if (Func.isNotEmpty(addvalueEntity)){ return Resp.scanFail("操作失败", "存在该类型增值服务项,如需更改请编辑"); } - if (Func.isEmpty(packageEntityList)) { - return Resp.scanFail("请添加包件", "请添加包件"); - } DistributionAddvalueDetailEntity distributionAddvalueDetailEntity = new DistributionAddvalueDetailEntity(); if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) { return Resp.scanFail("添加失败", "错误的包件数量"); @@ -211,7 +213,6 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImplquery().lambda() + .eq(DistributionAddvalueEntity::getRefId, distributionAppAddvalueDTO.getReservationId()) + .eq(DistributionAddvalueEntity::getAddvalueId, distributionAppAddvalueDTO.getAddvalueType())); + DistributionAddvalueDetailEntity addvalueDetailEntity = distributionAddvalueDetailService.getOne(Wrappers.query().lambda() + .eq(DistributionAddvalueDetailEntity::getAddvalueId, distributionAddvalueEntity.getId())); + distributionAddvaluePackageMapper.deleteAddvaluePackageList(distributionAppAddvalueDTO.getReservationId(), addvalueDetailEntity.getId()); + distributionAddvalueDetailMapper.deleteAddvalueDetail(distributionAddvalueEntity.getId()); + distributionAddvalueMapper.deleteAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType()); + return Resp.scanSuccess("操作成功","操作成功"); + } switch (distributionAppAddvalueDTO.getAddvalueType()) { case "1": if (Func.isEmpty(distributionAppAddvalueDTO.getFloolNum())) { @@ -377,18 +390,6 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImplquery().lambda() - .eq(DistributionAddvalueEntity::getRefId, distributionAppAddvalueDTO.getReservationId()) - .eq(DistributionAddvalueEntity::getAddvalueId, distributionAppAddvalueDTO.getAddvalueType())); - DistributionAddvalueDetailEntity addvalueDetailEntity = distributionAddvalueDetailService.getOne(Wrappers.query().lambda() - .eq(DistributionAddvalueDetailEntity::getAddvalueId, distributionAddvalueEntity.getId())); - - distributionAddvalueMapper.deleteAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType()); - distributionAddvalueDetailMapper.deleteAddvalueDetail(distributionAddvalueEntity.getId()); - distributionAddvaluePackageMapper.deleteAddvaluePackageList(distributionAppAddvalueDTO.getReservationId(), addvalueDetailEntity.getId()); - } else { //查询出原来的包件信息 DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType()); String packageListIds = addvalueVO.getPackageListIds(); @@ -454,7 +455,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl customList = distributionDeliveryInfoMapper.selectAppcustomListPage(page, distributionDeliveryList.getId()); for (DistributionAppReservationVO distributionAppReservationVO : customList) { - List parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppReservationVO.getId()); + List reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(distributionAppReservationVO.getId()); + List distributionStockEntities = new ArrayList<>(); + List loadscanEntityList = new ArrayList<>(); + List trayList = new ArrayList<>(); + for (DistributionReservationStockarticleEntity reservationStockarticleEntity : reservationStockarticleEntityList) { + if (reservationStockarticleEntity.equals(IsOrNoConstant.no.getValue())){ + //查询订制品备货数量 + List packageListStockUpScan = distributionStockMapper.selectList(Wrappers.query().lambda() + .eq(DistributionStockEntity::getType, 1) + .eq(DistributionStockEntity::getParcelListId, reservationStockarticleEntity.getStockArticleId()) + .eq(DistributionStockEntity::getReservationId, reservationStockarticleEntity.getReservationId())); + if (Func.isNotEmpty(packageListStockUpScan)){ + distributionStockEntities.addAll(packageListStockUpScan); + } + //统计托盘数 + //查询所有包件 + List parcelListEntities = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationStockarticleEntity.getReservationId(), reservationStockarticleEntity.getStockArticleId()); + parcelListEntities.forEach(p->{ + WarehouseTrayGoodsEntity warehouseTrayGoodsEntity = new WarehouseTrayGoodsEntity(); + warehouseTrayGoodsEntity.setAssociationId(p.getId()); + warehouseTrayGoodsEntity.setAssociationType("1"); + List trayGoodsClientTrayList = warehouseTrayGoodsClient.getTrayList(warehouseTrayGoodsEntity); + if (Func.isNotEmpty(trayGoodsClientTrayList)){ + trayList.addAll(trayGoodsClientTrayList); + } + }); + //查询订制品装车数量 + List packageListLoadingScan = distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getReservationId, reservationStockarticleEntity.getReservationId()) + .eq(DistributionLoadscanEntity::getOrderId, reservationStockarticleEntity.getStockArticleId()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + if (Func.isNotEmpty(packageListLoadingScan)){ + loadscanEntityList.addAll(packageListLoadingScan); + } + + }else if (reservationStockarticleEntity.equals(IsOrNoConstant.yes.getValue())){ + //查询零担备货数量 + List zeroPackageListStockUpScan = distributionStockMapper.selectList(Wrappers.query().lambda() + .eq(DistributionStockEntity::getType, 2) + .eq(DistributionStockEntity::getParcelListId, reservationStockarticleEntity.getStockArticleId()) + .eq(DistributionStockEntity::getReservationId, reservationStockarticleEntity.getReservationId())); + if (Func.isNotEmpty(zeroPackageListStockUpScan)){ + distributionStockEntities.addAll(zeroPackageListStockUpScan); + } + //查询零担装车数量 + List zeroPackageListLoadingScan = distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getReservationId, reservationStockarticleEntity.getReservationId()) + .eq(DistributionLoadscanEntity::getOrderId, reservationStockarticleEntity.getStockArticleId()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + if (Func.isNotEmpty(zeroPackageListLoadingScan)){ + loadscanEntityList.addAll(zeroPackageListLoadingScan); + } + } + } + distributionAppReservationVO.setTrayNum(0); + if (Func.isNotEmpty(trayList)){ + Long count = trayList.stream().map(WarehouseTrayGoodsEntity::getTrayId).count(); + distributionAppReservationVO.setTrayNum(count.intValue()); + } List stockListDetailEntityList = distributionReservationMapper.selectInventoryListByReservation(distributionAppReservationVO.getId()); - boolean stockArticleStockupStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageStockupStatus()) && s.getOrderPackageStockupStatus().equals(OrderPackageStockupStatusConstant.yibeihu.getValue())); - boolean inventoryStockupStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode())); - if (stockArticleStockupStatus && inventoryStockupStatus) { +// boolean inventoryStockupStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode())); + //备货数和计划数一致时完成备货 + if (distributionStockEntities.size()+stockListDetailEntityList.stream().filter(s->Func.isNotEmpty(s.getStockPackageCode())).count() == distributionAppReservationVO.getReservationNum()){ distributionAppReservationVO.setIsstock("是"); - } else { + }else { distributionAppReservationVO.setIsstock("否"); } - boolean stockArticleLoadingStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageLoadingStatus()) && s.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); - boolean inventoryLoadingStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode()) && i.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); - if (stockArticleLoadingStatus && inventoryLoadingStatus) { + int packageListScanNum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); + long inventoryListScanNum = stockListDetailEntityList.stream().filter(i -> Func.isNotEmpty(i.getStockPackageCode()) && i.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())).count(); + + if (packageListScanNum + inventoryListScanNum ==distributionAppReservationVO.getReservationNum() ) { distributionAppReservationVO.setIsload("是"); } else { distributionAppReservationVO.setIsload("否"); - } + + + + + +// List parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppReservationVO.getId()); +// +// boolean stockArticleStockupStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageStockupStatus()) && s.getOrderPackageStockupStatus().equals(OrderPackageStockupStatusConstant.yibeihu.getValue())); +// if (stockArticleStockupStatus && inventoryStockupStatus) { +// distributionAppReservationVO.setIsstock("是"); +// } else { +// distributionAppReservationVO.setIsstock("否"); +// } +// boolean stockArticleLoadingStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageLoadingStatus()) && s.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); +// boolean inventoryLoadingStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode()) && i.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); +// if (stockArticleLoadingStatus && inventoryLoadingStatus) { +// distributionAppReservationVO.setIsload("是"); +// } else { +// distributionAppReservationVO.setIsload("否"); +// } + + // //查询备货是否完成 // int aLong = distributionStockMapper.selectCount(new QueryWrapper().lambda() // .eq(DistributionStockEntity::getReservationId, distributionAppReservationVO.getId()) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java index 276d4559c..eebc5ea33 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java @@ -287,7 +287,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl parcelListEntities = baseMapper.getSignforPackageList(signforEntity.getReservationId()); - List reservationStockarticleEntityList = distributionReservationStockarticleService.list(Wrappers.query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, signforEntity.getReservationId()).ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue())); + List reservationStockarticleEntityList = distributionReservationStockarticleService.list(Wrappers.query().lambda() + .eq(DistributionReservationStockarticleEntity::getReservationId, signforEntity.getReservationId()) + .ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue())); List parcelListVOS = new ArrayList<>(); if (Func.isNotEmpty(reservationStockarticleEntityList)){ reservationStockarticleEntityList.forEach(rs->{ @@ -1843,6 +1845,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl parcelListEntityList = distributionReservationMapper.selectPackageByReservationAndStockArticle(rs.getReservationId(), rs.getStockArticleId()); List parcelListVOList = DistributionParcelListWrapper.build().listVO(parcelListEntityList); parcelListVOList.forEach(p -> { + p.setReservationNum(p.getQuantity()); + p.setLoadingNub(0); + p.setSigningNub(0); DistributionLoadscanEntity distributionLoadscanEntity = distributionLoadscanMapper.selectOne(Wrappers.query().lambda().eq(DistributionLoadscanEntity::getPackageId, p.getId())); if (Func.isNotEmpty(distributionLoadscanEntity)) { //该包件存在扫描记录 @@ -1861,6 +1866,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl distributionParcelNumberDTOS = distributionReservationMapper.selectZeroPackageListByReservationId(rs.getReservationId()); + distributionParcelNumberDTOS.forEach(zp->{ + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(zp.getParcelListId()); + DistributionParcelListVO parcelListVO = DistributionParcelListWrapper.build().entityVO(parcelListEntity); +// DistributionParcelListVO parcelListVO = Func.copy(parcelListEntity, DistributionParcelListVO.class); +// parcelListVO.setReservationNum(zp.get); + parcelListVO.setReservationNum(zp.getReservationNum()); + parcelListVO.setLoadingNub(0); + parcelListVO.setSigningNub(0); + DistributionLoadscanEntity distributionLoadscanEntity = distributionLoadscanMapper.selectOne(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getPackageId, zp.getParcelListId()) + .eq(DistributionLoadscanEntity::getReservationId,rs.getReservationId())); + if (Func.isNotEmpty(distributionLoadscanEntity)) { + //该包件存在扫描记录 + String scanStatus = distributionLoadscanEntity.getScanStatus(); + switch (scanStatus) { + case "1": + parcelListVO.setScanStatus(LoadingStatusConstant.quxiao.getName()); + break; + case "2": + parcelListVO.setScanStatus(LoadingStatusConstant.saomiao.getName()); + break; + case "3": + parcelListVO.setScanStatus(LoadingStatusConstant.queren.getName()); + break; + case "4": + parcelListVO.setScanStatus(LoadingStatusConstant.yijianzhuangche.getName()); + break; + } + parcelListVO.setLoadingNub(distributionLoadscanEntity.getLoadedNub()); + parcelListVO.setSigningNub(distributionLoadscanEntity.getReceivedQuantity()); + if (Func.isNotEmpty(distributionLoadscanEntity.getSigningTime())) { + parcelListVO.setSigningTime(distributionLoadscanEntity.getSigningTime()); + } + if (Func.isNotEmpty(distributionLoadscanEntity.getScanUser())) { + parcelListVO.setScanUser(distributionLoadscanEntity.getScanUser()); + } + if (Func.isNotEmpty(distributionLoadscanEntity.getDriverName())) { + parcelListVO.setDriverName(distributionLoadscanEntity.getDriverName()); + } + } + parcelListVOS.add(parcelListVO); + }); } }); } - - return parcelListVOS; }