|
|
|
@ -5939,6 +5939,167 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R retentionScan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
if (distrilbutionloadingscanDTO.getBarcode().isEmpty()) { |
|
|
|
|
log.error("参数缺失Barcode:{}", distrilbutionloadingscanDTO.getBarcode()); |
|
|
|
|
} |
|
|
|
|
//查询包件
|
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)) { |
|
|
|
|
return Resp.scanFail("未授权!!!", "未授权!!!"); |
|
|
|
|
} |
|
|
|
|
Integer retentionType = distrilbutionloadingscanDTO.getRetentionType(); |
|
|
|
|
Long deliveryId = null; |
|
|
|
|
if (Func.isEmpty(distrilbutionloadingscanDTO.getDeliveryId())) { |
|
|
|
|
//不在车次任务内进行扫描
|
|
|
|
|
//查询此包件属于哪个车次
|
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
.ne(DistributionLoadscanEntity::getSignforState, LoadScanSigningStatusConstant.yiqianshou.getValue()) |
|
|
|
|
); |
|
|
|
|
if (loadscanEntityList.isEmpty()) { |
|
|
|
|
//查询库存品
|
|
|
|
|
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnService.list(Wrappers.<DistributionLoadscaninvnEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
.ne(DistributionLoadscaninvnEntity::getSignforState, LoadScanSigningStatusConstant.yiqianshou.getValue()) |
|
|
|
|
); |
|
|
|
|
if (!loadscaninvnEntityList.isEmpty()) { |
|
|
|
|
deliveryId = loadscaninvnEntityList.stream().map(DistributionLoadscaninvnEntity::getDeliveryId).distinct().collect(Collectors.toList()).get(0); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
deliveryId = loadscanEntityList.stream().map(DistributionLoadscanEntity::getDeliveryId).distinct().collect(Collectors.toList()).get(0); |
|
|
|
|
} |
|
|
|
|
if (deliveryId == null) { |
|
|
|
|
return Resp.scanFail("此包件无装车记录", "此包件无装车记录"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
deliveryId = distrilbutionloadingscanDTO.getDeliveryId(); |
|
|
|
|
} |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = this.getById(deliveryId); |
|
|
|
|
List<DistributionRetentionScanVo> retentionScanVos = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
switch (retentionType) { |
|
|
|
|
case 1: |
|
|
|
|
//包件--库存品 和包件
|
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
.eq(DistributionLoadscanEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
); |
|
|
|
|
if (Func.isNotEmpty(loadscanEntityList)) { |
|
|
|
|
if (loadscanEntityList.size() == 1) { |
|
|
|
|
//包件存在装车才能进行滞留
|
|
|
|
|
//通过配送任务和包件确定预约信息
|
|
|
|
|
DistributionLoadscanEntity distributionLoadscanEntity = loadscanEntityList.get(0); |
|
|
|
|
// if (2 == distributionLoadscanEntity.getIsAbnormalLoading()) {
|
|
|
|
|
// //异常装车未进行审核
|
|
|
|
|
// return Resp.scanFail("包件存在异常操作,请先处理异常", "包件存在异常操作,请先处理异常");
|
|
|
|
|
// }
|
|
|
|
|
if (2 == distributionLoadscanEntity.getSignforState()) { |
|
|
|
|
log.info("滞留扫描失败,包件已签收>>>>>>>>>>>>>>>>>>>>>>>reservationId:{},packageCode:{}", distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getOrderPackageCode()); |
|
|
|
|
return Resp.scanFail("包件已签收", "包件已签收"); |
|
|
|
|
} |
|
|
|
|
DistributionRetentionScanVo retentionScanVo = baseMapper.selectRetentionPackage(distributionLoadscanEntity.getOrderPackageCode(), distributionLoadscanEntity.getDeliveryId(), myCurrentWarehouse.getId()); |
|
|
|
|
if (Func.isEmpty(retentionScanVo)){ |
|
|
|
|
//不存在计划之中属于异常驳回的情况
|
|
|
|
|
retentionScanVo = new DistributionRetentionScanVo(); |
|
|
|
|
retentionScanVo.setDeliveryId(distributionLoadscanEntity.getDeliveryId()); |
|
|
|
|
retentionScanVo.setOrderId(distributionLoadscanEntity.getOrderId()); |
|
|
|
|
retentionScanVo.setReservationId(distributionLoadscanEntity.getReservationId()); |
|
|
|
|
retentionScanVo.setTrainNumber(distributionLoadscanEntity.getTrainNumber()); |
|
|
|
|
retentionScanVo.setConditions(1); |
|
|
|
|
retentionScanVo.setScanType(1); |
|
|
|
|
retentionScanVo.setRetentionQuantity(1); |
|
|
|
|
retentionScanVo.setOrderPackageId(distributionLoadscanEntity.getPackageId()); |
|
|
|
|
//查询包件
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionLoadscanEntity.getPackageId()); |
|
|
|
|
retentionScanVo.setOrderCode(parcelListEntity.getOrderCode()); |
|
|
|
|
retentionScanVo.setOrderPackageStatus(parcelListEntity.getOrderPackageStatus()); |
|
|
|
|
retentionScanVo.setOrderPackageCode(parcelListEntity.getOrderPackageCode()); |
|
|
|
|
retentionScanVo.setWaybillNumber(parcelListEntity.getWaybillNumber()); |
|
|
|
|
retentionScanVo.setWaybillId(parcelListEntity.getWaybillId()); |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(distributionLoadscanEntity.getReservationId()); |
|
|
|
|
retentionScanVo.setReservationCode(reservationEntity.getReservationCode()); |
|
|
|
|
} |
|
|
|
|
retentionScanVo.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
retentionScanVo.setWarehouseName(myCurrentWarehouse.getName()); |
|
|
|
|
retentionScanVo.setLoadingId(distributionLoadscanEntity.getId()); |
|
|
|
|
retentionScanVos.add(retentionScanVo); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnService.list(Wrappers.<DistributionLoadscaninvnEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
); |
|
|
|
|
if (Func.isNotEmpty(loadscaninvnEntityList)) { |
|
|
|
|
if (loadscaninvnEntityList.size() == 1) { |
|
|
|
|
|
|
|
|
|
//库存品存在装车数据才能进行滞留操作
|
|
|
|
|
DistributionLoadscaninvnEntity loadscaninvnEntity = loadscaninvnEntityList.get(0); |
|
|
|
|
if (2 == loadscaninvnEntity.getSignforState()) { |
|
|
|
|
return Resp.scanFail("包件已签收", "包件已签收"); |
|
|
|
|
} |
|
|
|
|
DistributionRetentionScanVo inventoryPackage = baseMapper.selectRetentionInventoryPackage(loadscaninvnEntity.getOrderPackageCode(), loadscaninvnEntity.getDeliveryId()); |
|
|
|
|
inventoryPackage.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
inventoryPackage.setWarehouseName(myCurrentWarehouse.getName()); |
|
|
|
|
inventoryPackage.setLoadingId(loadscaninvnEntity.getId()); |
|
|
|
|
retentionScanVos.add(inventoryPackage); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
List<DistributionRetentionScanVo> distributionRetentionScanVos = baseMapper.selectRetentionZeroPackage(distrilbutionloadingscanDTO.getDeliveryId(), distrilbutionloadingscanDTO.getBarcode()); |
|
|
|
|
if (Func.isNotEmpty(distributionRetentionScanVos)) { |
|
|
|
|
retentionScanVos.addAll(distributionRetentionScanVos); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (Func.isEmpty(retentionScanVos)) { |
|
|
|
|
List<DistributionLoadscanAbnormalEntity> list = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
//存在异常进行是否均完成审核判断
|
|
|
|
|
boolean AuditingStatusFlag = list.stream().allMatch(l -> !l.getAuditingStatus().equals(LoadingAbnormalAuditingStatusConstant.daishenhe.getValue())); |
|
|
|
|
if (AuditingStatusFlag){ |
|
|
|
|
return Resp.scanFail("请先处理包件异常操作", "请先处理包件异常操作"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//如果均不存在则就该判断该货物是否属于当前的配送任务,如果属于则是未装车,如果不属于则此码无效
|
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntities = baseMapper.selectPackageListByDeliveryListId(deliveryListEntity.getId()); |
|
|
|
|
boolean flag = false; |
|
|
|
|
if (Func.isNotEmpty(distributionParcelListEntities)) { |
|
|
|
|
List<DistributionParcelListEntity> isHave = distributionParcelListEntities.stream().filter(p -> p.getOrderPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(isHave)) { |
|
|
|
|
flag = isHave.size() == 1; |
|
|
|
|
//判断是否存在有待处理的异常
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = baseMapper.selectInventoryListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
if (Func.isNotEmpty(disStockListDetailEntities)) { |
|
|
|
|
List<DisStockListDetailEntity> isHaveinven = disStockListDetailEntities.stream().filter(inven -> Func.isNotEmpty(inven.getStockPackageCode()) && inven.getStockPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(isHaveinven)) { |
|
|
|
|
flag = isHaveinven.size() == 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (flag) { |
|
|
|
|
//存在该订制品或者库存品包件信息但是未进行装车操作
|
|
|
|
|
return Resp.scanFail("包件未装车", "包件未装车"); |
|
|
|
|
} else { |
|
|
|
|
//该配送任务查询无该包件信息
|
|
|
|
|
return Resp.scanFail("系统无编码", "系统无编码"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.data(retentionScanVos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R retentionPC(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
if (distrilbutionloadingscanDTO.getBarcode().isEmpty()) { |
|
|
|
|
log.error("参数缺失Barcode:{}", distrilbutionloadingscanDTO.getBarcode()); |
|
|
|
|
return R.fail(403, "数据错误"); |
|
|
|
@ -5961,7 +6122,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Integer retentionType = distrilbutionloadingscanDTO.getRetentionType(); |
|
|
|
|
Long deliveryId = null; |
|
|
|
|
Long deliveryId = null; |
|
|
|
|
if (Func.isEmpty(distrilbutionloadingscanDTO.getDeliveryId())) { |
|
|
|
|
//不在车次任务内进行扫描
|
|
|
|
|
//查询此包件属于哪个车次
|
|
|
|
@ -5979,8 +6140,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
); |
|
|
|
|
if (!loadscaninvnEntityList.isEmpty()) { |
|
|
|
|
deliveryId = loadscaninvnEntityList.stream().map(DistributionLoadscaninvnEntity::getDeliveryId).distinct().collect(Collectors.toList()).get(0); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
} else { |
|
|
|
|
deliveryId = null; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
deliveryId = loadscanEntityList.stream().map(DistributionLoadscanEntity::getDeliveryId).distinct().collect(Collectors.toList()).get(0); |
|
|
|
|
} |
|
|
|
|
if (deliveryId == null) { |
|
|
|
@ -6069,12 +6232,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!Func.isEmpty(retentionScanVos)) { |
|
|
|
|
//查询此包件是否存在有异常未处理的数据
|
|
|
|
|
List<DistributionLoadscanAbnormalEntity> list = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, LoadingAbnormalAuditingStatusConstant.daishenhe.getValue()) |
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
//存在异常进行是否均完成审核判断
|
|
|
|
|
boolean AuditingStatusFlag = list.stream().allMatch(l -> !l.getAuditingStatus().equals(LoadingAbnormalAuditingStatusConstant.daishenhe.getValue())); |
|
|
|
|
Long finalDeliveryId = deliveryId; |
|
|
|
|
boolean AuditingStatusFlag = list.stream().anyMatch(f-> finalDeliveryId.equals(f.getDeliveryListId())); |
|
|
|
|
if (AuditingStatusFlag){ |
|
|
|
|
return Resp.scanFail("请先处理包件异常操作", "请先处理包件异常操作"); |
|
|
|
|
} |
|
|
|
@ -7805,16 +7971,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R retentionSave(WarehouseRetentionScanEntity warehouseRetentionScanEntity) { |
|
|
|
|
R r = warehouseRetentionScanClient.saveRetentionScan(warehouseRetentionScanEntity); |
|
|
|
|
Integer code = r.getCode(); |
|
|
|
|
Integer aaa = new Integer(200); |
|
|
|
|
if (code.equals(aaa)){ |
|
|
|
|
return R.success("滞留成功"); |
|
|
|
|
} |
|
|
|
|
return R.fail("滞留失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|