|
|
|
@ -122,6 +122,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
private final ITrunklinePackageTrackLogClient packageTrackLogClient; |
|
|
|
|
private final IAftersalesWorkOrderClient aftersalesWorkOrderClient; |
|
|
|
|
private final ITrunklineWaybillTrackService waybillTrackService; |
|
|
|
|
private final ITrunklineScanZeroDetailService scanZeroDetailService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<TrunklineCarsLoadVO> loadCarsPageList(LoadCarsDTO loadCarsDTO) { |
|
|
|
@ -3015,8 +3016,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
@Override |
|
|
|
|
public R loadingZero(Long loadId, Long warehouseId, String waybillNo, String orderCode, String trayCode, Integer enterNum, String remark) { |
|
|
|
|
public R loadingZero(Long loadId, Long warehouseId, String waybillNo, String orderCode, String trayCode, Integer enterNum, String remark,List<ZeroPackageDTO> zeroPackageList) { |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); |
|
|
|
|
if (Objects.isNull(carsLoadEntity)) { |
|
|
|
@ -3071,6 +3073,28 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
Long fromWarehouseId = stockArticleEntity.getWarehouseId(); |
|
|
|
|
Long articleId = stockArticleEntity.getId(); |
|
|
|
|
Integer handQuantity = stockArticleEntity.getHandQuantity(); |
|
|
|
|
Integer totalNumber = stockArticleEntity.getTotalNumber(); |
|
|
|
|
|
|
|
|
|
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListClient.findListByStockArticleId(articleId); |
|
|
|
|
//把parcelListEntities转化为id作为key的Map
|
|
|
|
|
Map<Long, DistributionParcelListEntity> parcelListMapById = parcelListEntities.stream().collect(Collectors.toMap(DistributionParcelListEntity::getId, Function.identity())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把parcelListEntities转化成以firsts作为key的map
|
|
|
|
|
Map<String, DistributionParcelListEntity> parcelListMap = parcelListEntities.stream().collect(Collectors.toMap(DistributionParcelListEntity::getFirsts, Function.identity())); |
|
|
|
|
if(CollUtil.isNotEmpty(zeroPackageList)){ |
|
|
|
|
for (ZeroPackageDTO zeroPackageDTO : zeroPackageList) { |
|
|
|
|
Integer en = zeroPackageDTO.getEnterNum(); |
|
|
|
|
String gn = zeroPackageDTO.getGoodsName(); |
|
|
|
|
DistributionParcelListEntity parcelList = parcelListMap.get(gn); |
|
|
|
|
if(Objects.isNull(parcelList)){ |
|
|
|
|
log.warn("##################loadingZero: 品类信息不存在 gn={}", gn); |
|
|
|
|
return R.fail(405, "品类信息有误"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Long loadScanId = null; |
|
|
|
|
Integer isAbnormal = 0; |
|
|
|
|
Integer isData = 1; |
|
|
|
@ -3152,6 +3176,51 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
carsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName()); |
|
|
|
|
trunklineCarsLoadScanService.save(carsLoadScanEntity); |
|
|
|
|
loadScanId = carsLoadScanEntity.getId(); |
|
|
|
|
List<TrunklineScanZeroDetailEntity> zeroDetailList = new ArrayList<>(); |
|
|
|
|
List<DistributionParcelListEntity> updateParceList = new ArrayList<>(); |
|
|
|
|
if(CollUtil.isNotEmpty(zeroPackageList)){ |
|
|
|
|
Long finalLoadScanId = loadScanId; |
|
|
|
|
zeroPackageList.forEach(zeroPackageDTO -> { |
|
|
|
|
TrunklineScanZeroDetailEntity scanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); |
|
|
|
|
scanZeroDetailEntity.setGoodsId(zeroPackageDTO.getGoodsId()); |
|
|
|
|
scanZeroDetailEntity.setScanId(finalLoadScanId); |
|
|
|
|
scanZeroDetailEntity.setGoodsName(zeroPackageDTO.getGoodsName()); |
|
|
|
|
scanZeroDetailEntity.setPackageId(zeroPackageDTO.getPackageId()); |
|
|
|
|
scanZeroDetailEntity.setLoadingNum(zeroPackageDTO.getEnterNum()); |
|
|
|
|
scanZeroDetailEntity.setUnloadNum(0); |
|
|
|
|
zeroDetailList.add(scanZeroDetailEntity); |
|
|
|
|
DistributionParcelListEntity parcelList = parcelListMap.get(zeroPackageDTO.getGoodsName()); |
|
|
|
|
Integer quantity = parcelList.getQuantity(); |
|
|
|
|
DistributionParcelListEntity updateEntity = new DistributionParcelListEntity(); |
|
|
|
|
updateEntity.setId(parcelList.getId()); |
|
|
|
|
updateEntity.setQuantity(quantity-zeroPackageDTO.getEnterNum()); |
|
|
|
|
updateParceList.add(updateEntity); |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
if(enterNum == handQuantity){ |
|
|
|
|
Long finalLoadScanId = loadScanId; |
|
|
|
|
parcelListEntities.forEach(entity -> { |
|
|
|
|
Long waybillDetailId = entity.getAdvanceId(); |
|
|
|
|
WarehouseWayBillDetail entityByWaybillDetailId = warehouseWaybillDetailClient.findEntityByWaybillDetailId(waybillDetailId); |
|
|
|
|
TrunklineScanZeroDetailEntity scanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); |
|
|
|
|
scanZeroDetailEntity.setGoodsId(entityByWaybillDetailId.getProductId()); |
|
|
|
|
scanZeroDetailEntity.setScanId(finalLoadScanId); |
|
|
|
|
scanZeroDetailEntity.setGoodsName(entityByWaybillDetailId.getProductName()); |
|
|
|
|
scanZeroDetailEntity.setPackageId(entity.getId()); |
|
|
|
|
scanZeroDetailEntity.setLoadingNum(entityByWaybillDetailId.getNum()); |
|
|
|
|
scanZeroDetailEntity.setUnloadNum(0); |
|
|
|
|
zeroDetailList.add(scanZeroDetailEntity); |
|
|
|
|
Integer quantity = entity.getQuantity(); |
|
|
|
|
DistributionParcelListEntity updateEntity = new DistributionParcelListEntity(); |
|
|
|
|
updateEntity.setId(entity.getId()); |
|
|
|
|
updateEntity.setQuantity(quantity-entityByWaybillDetailId.getNum()); |
|
|
|
|
updateParceList.add(updateEntity); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
scanZeroDetailService.saveBatch(zeroDetailList); |
|
|
|
|
distributionParcelListClient.updateList(updateParceList); |
|
|
|
|
|
|
|
|
|
difficult = enterNum; |
|
|
|
|
distributionStockArticleClient.submitHandleNumByOrderId(enterNum, articleId); |
|
|
|
|
} else { |
|
|
|
@ -3178,6 +3247,41 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
carsLoadScanEntity.setNum(enterNum); |
|
|
|
|
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); |
|
|
|
|
distributionStockArticleClient.submitHandleNumByOrderId(difficult, articleId); |
|
|
|
|
|
|
|
|
|
List<TrunklineScanZeroDetailEntity> zeroDetailList = new ArrayList<>(); |
|
|
|
|
List<DistributionParcelListEntity> updateParceList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
QueryWrapper<TrunklineScanZeroDetailEntity> queryWrapper1 = new QueryWrapper<>(); |
|
|
|
|
queryWrapper1.eq("scanId",loadScanId); |
|
|
|
|
List<TrunklineScanZeroDetailEntity> scanZeroDetailEntities = scanZeroDetailService.list(queryWrapper1); |
|
|
|
|
//把scanZeroDetailEntities中所有元素的scanId作为key转为Map
|
|
|
|
|
Map<Long, TrunklineScanZeroDetailEntity> map = scanZeroDetailEntities.stream().collect(Collectors.toMap(TrunklineScanZeroDetailEntity::getPackageId, Function.identity())); |
|
|
|
|
|
|
|
|
|
for (ZeroPackageDTO zeroPackageDTO : zeroPackageList) { |
|
|
|
|
Long packageId = zeroPackageDTO.getPackageId(); |
|
|
|
|
Integer enterNum1 = zeroPackageDTO.getEnterNum(); |
|
|
|
|
TrunklineScanZeroDetailEntity scanZeroDetailEntity = map.get(packageId); |
|
|
|
|
if(Objects.isNull(scanZeroDetailEntity)){ |
|
|
|
|
log.warn("##################loadingZero: 品类信息不存在 packageId={}", packageId); |
|
|
|
|
return R.fail(405, "品类信息有误"); |
|
|
|
|
} |
|
|
|
|
DistributionParcelListEntity parcelList = parcelListMapById.get(packageId); |
|
|
|
|
if(Objects.isNull(parcelList)){ |
|
|
|
|
log.warn("##################loadingZero: 包件信息不存在 packageId={}", packageId); |
|
|
|
|
return R.fail(405, "包件信息不存在"); |
|
|
|
|
} |
|
|
|
|
Integer quantity = parcelList.getQuantity(); |
|
|
|
|
|
|
|
|
|
Integer loadingNum = scanZeroDetailEntity.getLoadingNum(); |
|
|
|
|
int i2 = enterNum1 - loadingNum; |
|
|
|
|
parcelList.setQuantity(quantity-i2); |
|
|
|
|
updateParceList.add(parcelList); |
|
|
|
|
scanZeroDetailEntity.setLoadingNum(enterNum1); |
|
|
|
|
zeroDetailList.add(scanZeroDetailEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
distributionParcelListClient.updateList(updateParceList); |
|
|
|
|
scanZeroDetailService.updateBatchById(zeroDetailList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
audio = (enterNum)+"件"; |
|
|
|
@ -5929,7 +6033,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
String waybillNo = e.getWaybillNo(); |
|
|
|
|
Integer planNum = e.getPlanNum(); |
|
|
|
|
if (realNum < planNum) { |
|
|
|
|
loadingZero(loadId, warehouseId, waybillNo, orderCode, null, planNum, "手动一键装车"); |
|
|
|
|
loadingZero(loadId, warehouseId, waybillNo, orderCode, null, planNum, "手动一键装车",null); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -6939,7 +7043,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
String waybillNo = loadingZeroDTO.getWaybillNo(); |
|
|
|
|
Integer enterNum = loadingZeroDTO.getEnterNum(); |
|
|
|
|
String orderCode = loadingZeroDTO.getOrderCode(); |
|
|
|
|
loadingZero(loadId, warehouseId, waybillNo, orderCode, trayCode, enterNum, "整托正常装车"); |
|
|
|
|
loadingZero(loadId, warehouseId, waybillNo, orderCode, trayCode, enterNum, "整托正常装车",null); |
|
|
|
|
zeroNum = zeroNum + enterNum; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -6966,6 +7070,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
|
|
|
|
|
//查询已装车的零担
|
|
|
|
|
List<LoadZeroListVO> zeroList = trunklineCarsOrderService.findZeroList(loadId, warehouseId); |
|
|
|
|
zeroList.forEach(loadZeroListVO -> { |
|
|
|
|
String waybillNo = loadZeroListVO.getWaybillNo(); |
|
|
|
|
List<JSONObject> zeroPackageList = distributionParcelListClient.findPackageGoodsListByWaybillNo(waybillNo); |
|
|
|
|
List<ZeroPackageVO> ls = new ArrayList<>(); |
|
|
|
|
zeroPackageList.forEach(jsonObject -> { |
|
|
|
|
ls.add(jsonObject.toJavaObject(ZeroPackageVO.class)); |
|
|
|
|
}); |
|
|
|
|
loadZeroListVO.setZeroPackageList(ls); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询异常列表
|
|
|
|
|
QueryWrapper<TrunklineCarsLoadScanEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|