|
|
|
@ -656,14 +656,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (parcelList.getConditions().equals(2)) { |
|
|
|
|
return Resp.scanFail("此包件不是订制品", "此包件不是订制品"); |
|
|
|
|
} |
|
|
|
|
if (OrderPackageStatusConstant.yiqianshou.getValue().equals(parcelList.getOrderPackageStatus())) { |
|
|
|
|
return Resp.scanFail("包件已签收", "包件已签收"); |
|
|
|
|
} |
|
|
|
|
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())) { |
|
|
|
|
return Resp.scanFail("包件已装车", "包件已装车"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda() |
|
|
|
|
if (OrderPackageStatusConstant.yiqianshou.getValue().equals(parcelList.getOrderPackageStatus())) { |
|
|
|
|
return Resp.scanFail("包件已签收", "包件已签收"); |
|
|
|
|
} |
|
|
|
|
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())) { |
|
|
|
|
return Resp.scanFail("包件已装车", "包件已装车"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getPackageId, parcelList.getId()) |
|
|
|
|
); |
|
|
|
@ -676,15 +676,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
String collect = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(",")); |
|
|
|
|
log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}", distributionDeliveryListEntity.getTrainNumber(), collect); |
|
|
|
|
return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常"); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
//这里需要判定文员是否对该异常进行驳回操作
|
|
|
|
|
List<DistributionLoadscanAbnormalEntity> collect = abnormalEntities.stream().filter(f -> distributionDeliveryListEntity.getId().equals(f.getDeliveryListId()) && distrilbutionloadingscanDTO.getReservationId().equals(f.getReservationId())).collect(Collectors.toList()); |
|
|
|
|
if (!collect.isEmpty()) { |
|
|
|
|
//存在异常操作
|
|
|
|
|
if (collect.size() == 1){ |
|
|
|
|
if (collect.size() == 1) { |
|
|
|
|
//判断是否进行审核以及驳货操作
|
|
|
|
|
DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity = collect.get(0); |
|
|
|
|
if (distributionLoadscanAbnormalEntity.getAuditingStatus().equals(3)){ |
|
|
|
|
if (distributionLoadscanAbnormalEntity.getAuditingStatus().equals(3)) { |
|
|
|
|
return Resp.scanFail("包件异常已驳回", "包件异常已驳回"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -800,8 +800,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} else if (parcelListEntityList.isEmpty()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查找出该包件信息
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()).eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId())); |
|
|
|
|
|
|
|
|
@ -2685,8 +2683,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkArgs(DistributionDeliveryListDTO deliveryListDTO,BasicdataWarehouseEntity myCurrentWarehouse ){ |
|
|
|
|
private void checkArgs(DistributionDeliveryListDTO deliveryListDTO, BasicdataWarehouseEntity myCurrentWarehouse) { |
|
|
|
|
if (Func.isEmpty(deliveryListDTO)) { |
|
|
|
|
log.error("deliveryListDTO参数异常+{" + deliveryListDTO + "}"); |
|
|
|
|
throw new CustomerException("请求参数异常"); |
|
|
|
@ -2723,7 +2720,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
Long deliveryListEntityId = deliveryListEntity.getId(); |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
|
|
|
|
|
checkArgs(deliveryListDTO,myCurrentWarehouse); |
|
|
|
|
checkArgs(deliveryListDTO, myCurrentWarehouse); |
|
|
|
|
|
|
|
|
|
List<JSONObject> logs = new ArrayList<>(); |
|
|
|
|
List<JSONObject> pushDatas = new ArrayList<>(); |
|
|
|
@ -3296,9 +3293,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode()); |
|
|
|
|
reservationPackageEntity.setParceListId(p.getId()); |
|
|
|
|
// 对当前保存的包件再次进行验证
|
|
|
|
|
boolean isExit = checkList(list,reservationEntity.getId(),reservationStockarticleEntity.getStockArticleId(),p.getOrderPackageCode()); |
|
|
|
|
log.info(">>>>> 修改计划 验证包件是否存在 {}",isExit); |
|
|
|
|
if(!isExit){ |
|
|
|
|
boolean isExit = checkList(list, reservationEntity.getId(), reservationStockarticleEntity.getStockArticleId(), p.getOrderPackageCode()); |
|
|
|
|
log.info(">>>>> 修改计划 验证包件是否存在 {}", isExit); |
|
|
|
|
if (!isExit) { |
|
|
|
|
distributionReservationPackageService.save(reservationPackageEntity); |
|
|
|
|
distributionAsyncService.checkStockArticleReservationStatus(p); |
|
|
|
|
packageLockIds.add(p.getId()); |
|
|
|
@ -4903,8 +4900,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("自提单号", distrilbutionBillLadingEntity.getPickupBatch()); |
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(map.get("自提单号").toString()); |
|
|
|
@ -4912,7 +4907,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// map.put("收货单单位", reservationEntity.getReceivingUnit());//收货单单位
|
|
|
|
|
// map.put("商场名称", reservationEntity.getStoreName());//商场名称
|
|
|
|
|
// 构建map集合中收货单和商场名称
|
|
|
|
|
buildMapByDistrilbutionBillLadingEntity(map, distrilbutionBillStockEntities, distributionParcelListEntities, distrilbutionBillLadingEntity); |
|
|
|
|
buildMapByDistrilbutionBillLadingEntity(map, distrilbutionBillStockEntities, distributionParcelListEntities, distrilbutionBillLadingEntity); |
|
|
|
|
|
|
|
|
|
map.put("提货人", distrilbutionBillLadingEntity.getConsignee());//提货人
|
|
|
|
|
map.put("联系电话", distrilbutionBillLadingEntity.getConsigneePhone());//收货人电话
|
|
|
|
@ -4976,7 +4971,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
Map<String, Object> m = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询库存品信息
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> detailsEntities = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
@ -4996,14 +4990,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
tempMap.put("合同号", distributionStockListEntity.getOrderCode()); |
|
|
|
|
tempMap.put("物料名称", distributionStockListEntity.getDescriptionGoods()); |
|
|
|
|
//构建产品明细
|
|
|
|
|
Map<String,Object> map1 = new HashMap<>(); |
|
|
|
|
map1.put("物料编码",distributionStockListEntity.getCargoNumber()); |
|
|
|
|
map1.put("物料单位",distributionStockListEntity.getCargoUnit()); |
|
|
|
|
map1.put("物料规格",distributionStockListEntity.getCargoNorms()); |
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
|
map1.put("物料编码", distributionStockListEntity.getCargoNumber()); |
|
|
|
|
map1.put("物料单位", distributionStockListEntity.getCargoUnit()); |
|
|
|
|
map1.put("物料规格", distributionStockListEntity.getCargoNorms()); |
|
|
|
|
//查询此订制品库位信息
|
|
|
|
|
DistributionDeliveryDetailsEntity distributionDeliveryDetailsEntity = inventoryMap.get(distributionStockListEntity.getId()).get(0); |
|
|
|
|
Integer quantity = distributionDeliveryDetailsEntity.getQuantity(); |
|
|
|
|
map1.put("计划数量",quantity); |
|
|
|
|
map1.put("计划数量", quantity); |
|
|
|
|
hejiNum += quantity; |
|
|
|
|
tempMap.put("小计", quantity); |
|
|
|
|
tempMap.put("货位", ""); |
|
|
|
@ -5048,91 +5042,86 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
if (!distrilbutionBillStockEntities.isEmpty()) { |
|
|
|
|
List<Long> ids = distrilbutionBillStockEntities.stream().map(DistrilbutionBillStockEntity::getStockArticleId).collect(Collectors.toList()); |
|
|
|
|
// 得到所以的订单列表
|
|
|
|
|
List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleMapper.selectBatchIds(ids); |
|
|
|
|
for (DistributionStockArticleEntity distributionStockArticleEntity : distributionStockArticleEntities) { |
|
|
|
|
Map<String, Object> tempMap = new HashMap<>(); |
|
|
|
|
// 需要从所有的包件的
|
|
|
|
|
List<DistributionParcelListEntity> ts = new ArrayList<>(); |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) { |
|
|
|
|
if (distributionParcelListEntity.getStockArticleId().equals(distributionStockArticleEntity.getId())) { |
|
|
|
|
ts.add(distributionParcelListEntity); |
|
|
|
|
} |
|
|
|
|
// 得到所以的订单列表
|
|
|
|
|
List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleMapper.selectBatchIds(ids); |
|
|
|
|
for (DistributionStockArticleEntity distributionStockArticleEntity : distributionStockArticleEntities) { |
|
|
|
|
Map<String, Object> tempMap = new HashMap<>(); |
|
|
|
|
// 需要从所有的包件的
|
|
|
|
|
List<DistributionParcelListEntity> ts = new ArrayList<>(); |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) { |
|
|
|
|
if (distributionParcelListEntity.getStockArticleId().equals(distributionStockArticleEntity.getId())) { |
|
|
|
|
ts.add(distributionParcelListEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!mailNames.toString().contains(distributionStockArticleEntity.getMallName())) { |
|
|
|
|
if (!mailNames.toString().isEmpty()) { |
|
|
|
|
mailNames.append(","); |
|
|
|
|
} |
|
|
|
|
mailNames.append(distributionStockArticleEntity.getMallName()); |
|
|
|
|
if (!mailNames.toString().contains(distributionStockArticleEntity.getMallName())) { |
|
|
|
|
if (!mailNames.toString().isEmpty()) { |
|
|
|
|
mailNames.append(","); |
|
|
|
|
} |
|
|
|
|
if (!consigneeUnit.toString().contains(distributionStockArticleEntity.getConsigneeUnit())) { |
|
|
|
|
if (!consigneeUnit.toString().isEmpty()) { |
|
|
|
|
consigneeUnit.append(","); |
|
|
|
|
} |
|
|
|
|
consigneeUnit.append(distributionStockArticleEntity.getConsigneeUnit()); |
|
|
|
|
mailNames.append(distributionStockArticleEntity.getMallName()); |
|
|
|
|
} |
|
|
|
|
if (!consigneeUnit.toString().contains(distributionStockArticleEntity.getConsigneeUnit())) { |
|
|
|
|
if (!consigneeUnit.toString().isEmpty()) { |
|
|
|
|
consigneeUnit.append(","); |
|
|
|
|
} |
|
|
|
|
consigneeUnit.append(distributionStockArticleEntity.getConsigneeUnit()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tempMap.put("序号", a); |
|
|
|
|
tempMap.put("运单号", distributionStockArticleEntity.getWaybillNumber()); |
|
|
|
|
tempMap.put("合同号", distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
String materialNameStr = buildMaterialNameStr(distributionParcelListEntities); |
|
|
|
|
tempMap.put("物料名称", materialNameStr); |
|
|
|
|
|
|
|
|
|
tempMap.put("序号", a); |
|
|
|
|
tempMap.put("运单号", distributionStockArticleEntity.getWaybillNumber()); |
|
|
|
|
tempMap.put("合同号", distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
String materialNameStr = buildMaterialNameStr(distributionParcelListEntities); |
|
|
|
|
tempMap.put("物料名称", materialNameStr); |
|
|
|
|
|
|
|
|
|
// 构建产品明细 --对于每一个订单
|
|
|
|
|
buildProductDetail(tempMap, m, ts); |
|
|
|
|
|
|
|
|
|
Map<String, Object> os = (Map<String, Object>) tempMap.get("产品明细"); |
|
|
|
|
// 构建产品明细 --对于每一个订单
|
|
|
|
|
buildProductDetail(tempMap, m, ts); |
|
|
|
|
|
|
|
|
|
Set<String> strings = os.keySet(); |
|
|
|
|
int sumNum = 0; |
|
|
|
|
for (String string : strings) { |
|
|
|
|
Object o = os.get(string); |
|
|
|
|
sumNum += (o != null) ? (int) o : 0; |
|
|
|
|
} |
|
|
|
|
tempMap.put("小计", sumNum); |
|
|
|
|
hejiNum += sumNum; |
|
|
|
|
// 查询货物货位
|
|
|
|
|
Map<String, Object> os = (Map<String, Object>) tempMap.get("产品明细"); |
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的库位信息
|
|
|
|
|
List<String> orderPackageCodes = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getOrderPackageCode) // 获取每个对象的orderPackageCode
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
Set<String> strings = os.keySet(); |
|
|
|
|
int sumNum = 0; |
|
|
|
|
for (String string : strings) { |
|
|
|
|
Object o = os.get(string); |
|
|
|
|
sumNum += (o != null) ? (int) o : 0; |
|
|
|
|
} |
|
|
|
|
tempMap.put("小计", sumNum); |
|
|
|
|
hejiNum += sumNum; |
|
|
|
|
// 查询货物货位
|
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的库位信息
|
|
|
|
|
List<String> orderPackageCodes = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getOrderPackageCode) // 获取每个对象的orderPackageCode
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
List<Long> orderPackageIds = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getId) // 获取每个对象的包件ID
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(orderPackageCodes)) { |
|
|
|
|
List<String> allocationStrList = distributionParcelListMapper.selectAllocationInforByOrderPackageCode(orderPackageCodes, distrilbutionBillLadingEntity.getWarehouseId()); |
|
|
|
|
String allocationStr = StringUtils.join(allocationStrList, ","); |
|
|
|
|
tempMap.put("货位", allocationStr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的备货区信息
|
|
|
|
|
LambdaQueryWrapper<DistributionStockEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
lambdaQueryWrapper.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.in(DistributionStockEntity::getParcelListId, orderPackageIds); |
|
|
|
|
List<DistributionStockEntity> distributionStockEntities = distributionStockMapper.selectList(lambdaQueryWrapper); |
|
|
|
|
if (!distributionStockEntities.isEmpty()) { |
|
|
|
|
Set<String> stockupAreaStrList = distributionStockEntities.stream().map(DistributionStockEntity::getStockupArea).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
String stockupAreaStr = StringUtils.join(stockupAreaStrList, ","); |
|
|
|
|
tempMap.put("备货区", stockupAreaStr); |
|
|
|
|
} |
|
|
|
|
ls.add(tempMap); |
|
|
|
|
a++; |
|
|
|
|
|
|
|
|
|
List<Long> orderPackageIds = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getId) // 获取每个对象的包件ID
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(orderPackageCodes)) { |
|
|
|
|
List<String> allocationStrList = distributionParcelListMapper.selectAllocationInforByOrderPackageCode(orderPackageCodes, distrilbutionBillLadingEntity.getWarehouseId()); |
|
|
|
|
String allocationStr = StringUtils.join(allocationStrList, ","); |
|
|
|
|
tempMap.put("货位", allocationStr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的备货区信息
|
|
|
|
|
LambdaQueryWrapper<DistributionStockEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
lambdaQueryWrapper.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.in(DistributionStockEntity::getParcelListId, orderPackageIds); |
|
|
|
|
List<DistributionStockEntity> distributionStockEntities = distributionStockMapper.selectList(lambdaQueryWrapper); |
|
|
|
|
if (!distributionStockEntities.isEmpty()) { |
|
|
|
|
Set<String> stockupAreaStrList = distributionStockEntities.stream().map(DistributionStockEntity::getStockupArea).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
String stockupAreaStr = StringUtils.join(stockupAreaStrList, ","); |
|
|
|
|
tempMap.put("备货区", stockupAreaStr); |
|
|
|
|
} |
|
|
|
|
ls.add(tempMap); |
|
|
|
|
a++; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("收货单单位", consigneeUnit.toString()); |
|
|
|
@ -5301,9 +5290,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<DistributionAppReservationVO> getAppDeliveryreservationTraysPage( DistributionAppDeliveryListDTO distributionDeliveryList) { |
|
|
|
|
public List<DistributionAppReservationVO> getAppDeliveryreservationTraysPage(DistributionAppDeliveryListDTO distributionDeliveryList) { |
|
|
|
|
// ---------------------------------2023-09-25 新增托盘详情---------------------------------------------------------------------------------------
|
|
|
|
|
List<DistributionAppReservationVO> customList = distributionDeliveryInfoMapper.selectAppTarysListPage( Long.parseLong(distributionDeliveryList.getReservationId())); |
|
|
|
|
List<DistributionAppReservationVO> customList = distributionDeliveryInfoMapper.selectAppTarysListPage(Long.parseLong(distributionDeliveryList.getReservationId())); |
|
|
|
|
List<DistributionAppReservationVO> a = new ArrayList<>(); |
|
|
|
|
customList.forEach(c -> { |
|
|
|
|
String trayCode = c.getTrayCode(); |
|
|
|
@ -5563,8 +5552,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
public R getPackageListByDeliveryIdAndOrderId(IPage<Object> page, Long deliveryId, Long orderId) { |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)){ |
|
|
|
|
return R.fail(403,"未授权!!!"); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)) { |
|
|
|
|
return R.fail(403, "未授权!!!"); |
|
|
|
|
} |
|
|
|
|
List<DistributionParcelListVO> allPackageList = new ArrayList<>(); |
|
|
|
|
List<DistributionParcelListEntity> reservationPackageList = baseMapper.getPackageListByDeliveryId(deliveryId, orderId); |
|
|
|
@ -5922,16 +5911,45 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
public R retentionScan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
if (distrilbutionloadingscanDTO.getBarcode().isEmpty()) { |
|
|
|
|
log.error("参数缺失Barcode:{}",distrilbutionloadingscanDTO.getBarcode()); |
|
|
|
|
log.error("参数缺失Barcode:{}", distrilbutionloadingscanDTO.getBarcode()); |
|
|
|
|
} |
|
|
|
|
Integer retentionType = distrilbutionloadingscanDTO.getRetentionType(); |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = this.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
List<DistributionRetentionScanVo> retentionScanVos = new ArrayList<>(); |
|
|
|
|
//查询包件
|
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)){ |
|
|
|
|
return Resp.scanFail("未授权!!!","未授权!!!"); |
|
|
|
|
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: |
|
|
|
|
//包件--库存品 和包件
|
|
|
|
@ -5940,21 +5958,44 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
.eq(DistributionLoadscanEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
); |
|
|
|
|
// List<DistributionParcelListEntity> parcelListEntities = baseMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
if (Func.isNotEmpty(loadscanEntityList)) { |
|
|
|
|
if (loadscanEntityList.size() == 1) { |
|
|
|
|
//包件存在装车才能进行滞留
|
|
|
|
|
//通过配送任务和包件确定预约信息
|
|
|
|
|
DistributionLoadscanEntity distributionLoadscanEntity = loadscanEntityList.get(0); |
|
|
|
|
if (2 == distributionLoadscanEntity.getIsAbnormalLoading()){ |
|
|
|
|
//异常装车未进行审核
|
|
|
|
|
return Resp.scanFail("包件存在异常", "包件存在异常"); |
|
|
|
|
} |
|
|
|
|
// 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()); |
|
|
|
|
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 { |
|
|
|
@ -5972,6 +6013,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -5984,6 +6028,16 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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; |
|
|
|
@ -5991,6 +6045,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
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()); |
|
|
|
@ -6008,7 +6063,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} else { |
|
|
|
|
//该配送任务查询无该包件信息
|
|
|
|
|
return Resp.scanFail("系统无编码", "系统无编码"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.data(retentionScanVos); |
|
|
|
@ -6118,7 +6172,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//托盘货物都存在该配送任务的包件列表
|
|
|
|
|
//进行客户划分
|
|
|
|
|
for (WarehouseTrayGoodsEntity warehouseTrayGoodsEntity : goodsLsit) { |
|
|
|
|
DistributionRetentionScanVo retentionScanVo = baseMapper.selectRetentionPackage(warehouseTrayGoodsEntity.getAssociationValue(), distrilbutionloadingscanDTO.getDeliveryId(),myCurrentWarehouse.getId()); |
|
|
|
|
DistributionRetentionScanVo retentionScanVo = baseMapper.selectRetentionPackage(warehouseTrayGoodsEntity.getAssociationValue(), distrilbutionloadingscanDTO.getDeliveryId(), myCurrentWarehouse.getId()); |
|
|
|
|
if (Func.isNotEmpty(retentionScanVo)) { |
|
|
|
|
if (retentionScanVo.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { |
|
|
|
|
log.error("滞留扫描出现签收包件>>>>>>>>>>>>>>>:{}", retentionScanVo.getOrderPackageCode()); |
|
|
|
@ -6168,45 +6222,55 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//需要对该配送任务下的该包件进行取消状态标识
|
|
|
|
|
int row = distributionReservationMapper.cancelReservationPackage(reservationId, orderPackageId); |
|
|
|
|
// 查询该包件是否进行装车
|
|
|
|
|
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, deliveryId).eq(DistributionLoadscanEntity::getReservationId, reservationId) |
|
|
|
|
.eq(DistributionLoadscanEntity::getPackageId, orderPackageId) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); |
|
|
|
|
if (row == 1) { |
|
|
|
|
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, deliveryId).eq(DistributionLoadscanEntity::getReservationId, reservationId) |
|
|
|
|
.eq(DistributionLoadscanEntity::getPackageId, orderPackageId) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); |
|
|
|
|
if (Func.isNotEmpty(loadscanEntity)) { |
|
|
|
|
//修改包件状态 达到回库的状态
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(loadscanEntity.getPackageId()); |
|
|
|
|
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()); |
|
|
|
|
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); |
|
|
|
|
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiruku.getValue()); |
|
|
|
|
distributionParcelListService.updateById(parcelListEntity); |
|
|
|
|
//已经进行装车
|
|
|
|
|
loadscanEntity.setScanStatus(LoadingStatusConstant.quxiao.getValue()); |
|
|
|
|
distributionLoadscanService.updateById(loadscanEntity); |
|
|
|
|
// 对应签收信息的装车数量要进行扣减
|
|
|
|
|
int a = distributionSignforMapper.deductionLoadingPacjageNum(loadscanEntity.getReservationId(), loadscanEntity.getDeliveryId(), loadscanEntity.getLoadedNub()); |
|
|
|
|
//维护订单状态
|
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(), parcelListEntity.getWarehouseId()); |
|
|
|
|
//增加滞留信息
|
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getScanUser() + "取消配车,取消方式:滞留扫描,取消计划,配送车次号:" + loadscanEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); |
|
|
|
|
JSONObject js = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.CANCEL_DISTRIBUTION.getCode()); |
|
|
|
|
aaa.add(js); |
|
|
|
|
|
|
|
|
|
//对滞留包件进行签收信息数量减少
|
|
|
|
|
// distributionSignforMapper.deductionLoadingPacjageNum(reservationId,deliveryId,1);
|
|
|
|
|
//存在计划
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (!aaa.isEmpty()) { |
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(aaa); |
|
|
|
|
} |
|
|
|
|
//进行了一条包件任务的取消,此时就应该对预约、配送任务进行数量的维护
|
|
|
|
|
distributionAsyncService.checkRetentionReservationAndDeliveryInfo(reservationId, deliveryId); |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
//包件未预约 处于异常驳回状态
|
|
|
|
|
//查询异常信息,对异常信息进行清理
|
|
|
|
|
DistributionLoadscanAbnormalEntity abnormalEntity = distributionLoadscanAbnormalService.getOne(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getPackageId, orderPackageId) |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, 3) |
|
|
|
|
); |
|
|
|
|
if (!Objects.isNull(abnormalEntity)){ |
|
|
|
|
//清理异常信息
|
|
|
|
|
distributionLoadscanAbnormalService.removeById(abnormalEntity); |
|
|
|
|
}else { |
|
|
|
|
log.error(">>>>>>>>>>>>>>>查询异常信息错误:{}",orderPackageId); |
|
|
|
|
} |
|
|
|
|
//查询出多个包件信息
|
|
|
|
|
log.info("######################,reservationId:{}", reservationId); |
|
|
|
|
log.error("############查询预约包件信息错误:{}", orderPackageId); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(loadscanEntity)) { |
|
|
|
|
//修改包件状态 达到回库的状态
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(loadscanEntity.getPackageId()); |
|
|
|
|
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()); |
|
|
|
|
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); |
|
|
|
|
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiruku.getValue()); |
|
|
|
|
distributionParcelListService.updateById(parcelListEntity); |
|
|
|
|
//已经进行装车
|
|
|
|
|
loadscanEntity.setScanStatus(LoadingStatusConstant.quxiao.getValue()); |
|
|
|
|
distributionLoadscanService.updateById(loadscanEntity); |
|
|
|
|
// 对应签收信息的装车数量要进行扣减
|
|
|
|
|
int a = distributionSignforMapper.deductionLoadingPacjageNum(loadscanEntity.getReservationId(), loadscanEntity.getDeliveryId(), loadscanEntity.getLoadedNub()); |
|
|
|
|
//维护订单状态
|
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(), parcelListEntity.getWarehouseId()); |
|
|
|
|
//增加滞留信息
|
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getScanUser() + "取消配车,取消方式:滞留扫描,取消计划,配送车次号:" + loadscanEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); |
|
|
|
|
JSONObject js = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.CANCEL_DISTRIBUTION.getCode()); |
|
|
|
|
aaa.add(js); |
|
|
|
|
//对滞留包件进行签收信息数量减少
|
|
|
|
|
} |
|
|
|
|
if (!aaa.isEmpty()) { |
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(aaa); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -7658,9 +7722,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionLoadscanAbnormalService.save(distributionLoadscanAbnormalEntity); |
|
|
|
|
//进行异常审核的标识
|
|
|
|
|
distributionSignforService.update(Wrappers.<DistributionSignforEntity>update().lambda() |
|
|
|
|
.eq(DistributionSignforEntity::getReservationId,reservationList.get(0).getId()) |
|
|
|
|
.eq(DistributionSignforEntity::getDeliveryId,deliveryListEntity.getId()) |
|
|
|
|
.set(DistributionSignforEntity::getIsHaveAbnormalPackage,2) |
|
|
|
|
.eq(DistributionSignforEntity::getReservationId, reservationList.get(0).getId()) |
|
|
|
|
.eq(DistributionSignforEntity::getDeliveryId, deliveryListEntity.getId()) |
|
|
|
|
.set(DistributionSignforEntity::getIsHaveAbnormalPackage, 2) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -7696,8 +7760,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public void maintenanceDeliveryInfo(Long deliveryId) { |
|
|
|
@ -7836,7 +7898,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
JSONObject js = new JSONObject(); |
|
|
|
|
//查询司机用户
|
|
|
|
|
BasicdataDriverArteryEntity driverArtery = arteryClient.getDriverArteryById(userId); |
|
|
|
|
if (!Func.isEmpty(driverArtery)){ |
|
|
|
|
if (!Func.isEmpty(driverArtery)) { |
|
|
|
|
R<User> userR = userClient.userInfoById(driverArtery.getUserId()); |
|
|
|
|
User user = userR.getData(); |
|
|
|
|
js.put("tenantId", user.getTenantId()); |
|
|
|
|