|
|
|
@ -852,6 +852,167 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
return R.data(nodeVos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param distrilbutionloadingscanDTO |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R signforZeroPC(DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) { |
|
|
|
|
String method = "#############DistributionSignforServiceImpl.signforZeroPC"; |
|
|
|
|
if (Func.isEmpty(distrilbutionloadingscanDTO.getZeroPackageIds())){ |
|
|
|
|
log.error(method+"参数异常,zeroPackageIds为空"); |
|
|
|
|
return R.fail("请联系管理员"); |
|
|
|
|
} |
|
|
|
|
if (Func.isEmpty(distrilbutionloadingscanDTO.getReservationId())){ |
|
|
|
|
log.error(method+"参数异常,ReservationId为空"); |
|
|
|
|
return R.fail("请联系管理员"); |
|
|
|
|
} |
|
|
|
|
String zeroPackageIds = distrilbutionloadingscanDTO.getZeroPackageIds(); |
|
|
|
|
Long reservationId = distrilbutionloadingscanDTO.getReservationId(); |
|
|
|
|
List<Long> list = Func.toLongList(zeroPackageIds); |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
//查询零担计划
|
|
|
|
|
List<DistributionReservationZeroPackageEntity> reservationZeroPackageEntities = distributionReservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getReservationId, reservationId) |
|
|
|
|
.in(DistributionReservationZeroPackageEntity::getParcelListId, list) |
|
|
|
|
.ne(DistributionReservationZeroPackageEntity::getParcelListId, ReservationPackageStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (Func.isEmpty(reservationZeroPackageEntities)){ |
|
|
|
|
log.error(method+"预约单异常reservationId:{}",reservationId); |
|
|
|
|
return R.fail("请联系管理员"); |
|
|
|
|
} |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
if (Func.isEmpty(deliveryListEntity)){ |
|
|
|
|
log.error(method+"配送单异常deliveryId:{}",distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
return R.fail("请联系管理员"); |
|
|
|
|
} |
|
|
|
|
String driverName = ""; |
|
|
|
|
String driverPhone = ""; |
|
|
|
|
String vehicleNub = ""; |
|
|
|
|
Long loadingId = null; |
|
|
|
|
//查询该车次负责司机
|
|
|
|
|
if ("1".equals(deliveryListEntity.getKind())){ |
|
|
|
|
//自主配送
|
|
|
|
|
List<DistributionDeliverySelfVO> deliverySelfInfo = distributionDeliverySelfMapper.getDeliverySelfInfo(deliveryListEntity.getId()); |
|
|
|
|
driverPhone = deliverySelfInfo.stream().filter(f -> 2 == f.getIsMaster()).map(DistributionDeliverySelfVO::getDriverPhone).collect(Collectors.joining(",")); |
|
|
|
|
driverName = deliverySelfInfo.stream().filter(f -> 2 == f.getIsMaster()).map(DistributionDeliverySelfVO::getDriverName).collect(Collectors.joining(",")); |
|
|
|
|
vehicleNub = deliverySelfInfo.stream().filter(f -> 2 == f.getIsMaster()).map(DistributionDeliverySelfVO::getVehicleNub).collect(Collectors.joining(",")); |
|
|
|
|
List<Long> collect = deliverySelfInfo.stream().filter(f -> 2 == f.getIsMaster()).map(DistributionDeliverySelfVO::getId).collect(Collectors.toList()); |
|
|
|
|
loadingId = collect.get(0); |
|
|
|
|
}else if ("2".equals(deliveryListEntity.getKind())){ |
|
|
|
|
//外协
|
|
|
|
|
}else { |
|
|
|
|
log.error(method+"配送司机异常:{}",distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
return R.fail("请联系管理员"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (DistributionReservationZeroPackageEntity reservationZeroPackageEntity : reservationZeroPackageEntities) { |
|
|
|
|
//查询订单
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(reservationZeroPackageEntity.getStockArticleId()); |
|
|
|
|
//查询零担包件详情
|
|
|
|
|
DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.<DistributionParcelNumberEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelNumberEntity::getParcelListId, reservationZeroPackageEntity.getParcelListId()) |
|
|
|
|
); |
|
|
|
|
//在库数
|
|
|
|
|
int a =0; |
|
|
|
|
//签收数
|
|
|
|
|
int b =0; |
|
|
|
|
//出库数
|
|
|
|
|
int c =0; |
|
|
|
|
//冻结数
|
|
|
|
|
int d =0; |
|
|
|
|
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getReservationId, reservationId) |
|
|
|
|
.in(DistributionLoadscanEntity::getPackageId, list) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (Func.isEmpty(loadscanEntity)){ |
|
|
|
|
a = distributionParcelNumberEntity.getHandQuantity() - reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
b = distributionParcelNumberEntity.getSigninQuantity() + reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
c = distributionParcelNumberEntity.getOutboundQuantity() + reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
d = distributionParcelNumberEntity.getDeliveryQuantity() - reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
//未进行装车操作
|
|
|
|
|
DistributionLoadscanEntity unLoadscanEntity = new DistributionLoadscanEntity(); |
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss"); |
|
|
|
|
unLoadscanEntity.setScanStatus(LoadingStatusConstant.buluzhuangche.getValue()); |
|
|
|
|
unLoadscanEntity.setIsInsert(2); |
|
|
|
|
unLoadscanEntity.setLoadingId(loadingId.toString()); |
|
|
|
|
unLoadscanEntity.setOrderId(reservationZeroPackageEntity.getStockArticleId()); |
|
|
|
|
unLoadscanEntity.setPackageId(reservationZeroPackageEntity.getParcelListId()); |
|
|
|
|
unLoadscanEntity.setReservationId(reservationId); |
|
|
|
|
unLoadscanEntity.setIsSignfor(1); |
|
|
|
|
unLoadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
unLoadscanEntity.setScanUser(user.getNickName()); |
|
|
|
|
unLoadscanEntity.setIsAbnormalSigning(1); |
|
|
|
|
unLoadscanEntity.setIsAbnormalLoading(1); |
|
|
|
|
unLoadscanEntity.setIsZero(1); |
|
|
|
|
unLoadscanEntity.setTrainNumber(deliveryListEntity.getTrainNumber()); |
|
|
|
|
unLoadscanEntity.setVehicleId(deliveryListEntity.getVehicleId()); |
|
|
|
|
unLoadscanEntity.setVehicleName(vehicleNub); |
|
|
|
|
unLoadscanEntity.setDriverId(deliveryListEntity.getDriverId()); |
|
|
|
|
unLoadscanEntity.setDriverName(driverName); |
|
|
|
|
unLoadscanEntity.setDriverPhone(driverPhone); |
|
|
|
|
unLoadscanEntity.setLoadingId(driverPhone); |
|
|
|
|
unLoadscanEntity.setScanType(LoadingStatusConstant.buluzhuangche.getValue()); |
|
|
|
|
unLoadscanEntity.setScanTime(simpleDateFormat.format(new Date())); |
|
|
|
|
unLoadscanEntity.setSigningTime(simpleDateFormat.format(new Date(System.currentTimeMillis() + (6 * 1000)))); |
|
|
|
|
unLoadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); |
|
|
|
|
unLoadscanEntity.setSigningUserId(user.getUserId()); |
|
|
|
|
unLoadscanEntity.setSigningUser(user.getNickName()); |
|
|
|
|
unLoadscanEntity.setIsSignfor(2); |
|
|
|
|
unLoadscanEntity.setSignforState(2); |
|
|
|
|
// loadscanEntity.setSigningTime(new Date().toString());
|
|
|
|
|
unLoadscanEntity.setReceivedQuantity(reservationZeroPackageEntity.getQuantity()); |
|
|
|
|
unLoadscanEntity.setLoadedNub(reservationZeroPackageEntity.getQuantity()); |
|
|
|
|
unLoadscanEntity.setPackageNub(reservationZeroPackageEntity.getQuantity()); |
|
|
|
|
unLoadscanEntity.setOneClick(1); |
|
|
|
|
unLoadscanEntity.setOneQclick(1); |
|
|
|
|
unLoadscanEntity.setMsg("文员进行零担订单装车和签收补录"); |
|
|
|
|
distributionLoadscanService.save(unLoadscanEntity); |
|
|
|
|
//更新装车和签收数量
|
|
|
|
|
Integer i = distributionSignforMapper.updateSignforByReservationId(unLoadscanEntity.getDeliveryId(), unLoadscanEntity.getReservationId(), unLoadscanEntity.getReceivedQuantity()); |
|
|
|
|
//更新装车时间
|
|
|
|
|
Integer j = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//更新零担包件的数量
|
|
|
|
|
distributionParcelNumberEntity.setHandQuantity(a); |
|
|
|
|
distributionParcelNumberEntity.setSigninQuantity(b); |
|
|
|
|
distributionParcelNumberEntity.setOutboundQuantity(c); |
|
|
|
|
distributionParcelNumberEntity.setDeliveryQuantity(d); |
|
|
|
|
}else { |
|
|
|
|
a = distributionParcelNumberEntity.getHandQuantity() + loadscanEntity.getLoadedNub() - reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
b = distributionParcelNumberEntity.getSigninQuantity() - loadscanEntity.getReceivedQuantity() + reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
c = distributionParcelNumberEntity.getOutboundQuantity() - loadscanEntity.getReceivedQuantity() + reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
d = distributionParcelNumberEntity.getDeliveryQuantity() + loadscanEntity.getReceivedQuantity() - reservationZeroPackageEntity.getQuantity(); |
|
|
|
|
//存在装车操作
|
|
|
|
|
loadscanEntity.setSigningUser(user.getNickName()); |
|
|
|
|
loadscanEntity.setIsSignfor(2); |
|
|
|
|
loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); |
|
|
|
|
// loadscanEntity.setSigningTime(new Date().toString());
|
|
|
|
|
loadscanEntity.setReceivedQuantity(reservationZeroPackageEntity.getQuantity()); |
|
|
|
|
loadscanEntity.setLoadedNub(reservationZeroPackageEntity.getQuantity()); |
|
|
|
|
loadscanEntity.setPackageNub(reservationZeroPackageEntity.getQuantity()); |
|
|
|
|
loadscanEntity.setMsg("文员进行签收补录"); |
|
|
|
|
distributionLoadscanService.updateById(loadscanEntity); |
|
|
|
|
distributionParcelNumberEntity.setHandQuantity(a); |
|
|
|
|
distributionParcelNumberEntity.setSigninQuantity(b); |
|
|
|
|
distributionParcelNumberEntity.setOutboundQuantity(c); |
|
|
|
|
distributionParcelNumberEntity.setDeliveryQuantity(d); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
distributionParcelListService.maintenanceZeroPackageInfo(distributionParcelNumberEntity.getParcelListId(),stockArticleEntity.getWarehouseId()); |
|
|
|
|
|
|
|
|
|
distributionParcelNumberService.updateById(distributionParcelNumberEntity); |
|
|
|
|
//维护订单
|
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(stockArticleEntity.getOrderCode(),stockArticleEntity.getWarehouseId()); |
|
|
|
|
} |
|
|
|
|
//维护配送单信息
|
|
|
|
|
deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); |
|
|
|
|
distributionDeliveryListService.updateById(deliveryListEntity); |
|
|
|
|
|
|
|
|
|
//查询计划和是否进行装车
|
|
|
|
|
return R.success("操作成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<DeliveryNodeVo> handleStockUp(DistributionStockupEntity distributionStockupEntity) { |
|
|
|
|
List<DeliveryNodeVo> nodeVos = new ArrayList<>(); |
|
|
|
|
try { |
|
|
|
@ -2617,8 +2778,13 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
// stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + distributionLoadscaninvnEntity.getPackageNub());
|
|
|
|
|
// distributionStockListService.updateById(stockListEntity);
|
|
|
|
|
// distributionAsyncService.checkSignStatus(null, distributionLoadscaninvnEntity.getReservationId(),distributionLoadscaninvnEntity.getDeliveryId());
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//进行库存品包件状态维护
|
|
|
|
|
DisStockListDetailEntity disStockListDetailEntity = new DisStockListDetailEntity(); |
|
|
|
|
disStockListDetailEntity.setId(inventory.get(0).getId()); |
|
|
|
|
disStockListDetailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); |
|
|
|
|
disStockListDetailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue()); |
|
|
|
|
disStockListDetailService.updateById(disStockListDetailEntity); |
|
|
|
|
} else if (inventory.isEmpty()) { |
|
|
|
|
//这里就需要查询整个配送计划是否存在该码值的库存品包件
|
|
|
|
|
List<DisStockListDetailEntity> listDetailEntities = distributionDeliveryListMapper.selectInventoryListByDeliveryListId(distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|