@ -583,21 +583,20 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Transactional ( isolation = Isolation . READ_COMMITTED , rollbackFor = Exception . class )
// synchronized
public R loadingscan ( DistrilbutionloadingscanDTO distrilbutionloadingscanDTO ) {
try {
//查询该包件是否能够从库存品包件表中查到
String now = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) . format ( new Date ( ) ) ;
//查询该包件是否能够从库存品包件表中查到
String now = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) . format ( new Date ( ) ) ;
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient . getMyCurrentWarehouse ( ) ;
if ( Objects . isNull ( myCurrentWarehouse ) ) {
throw new CustomerException ( 403 , "仓库信息不能为空" ) ;
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient . getMyCurrentWarehouse ( ) ;
if ( Objects . isNull ( myCurrentWarehouse ) ) {
throw new CustomerException ( 403 , "仓库信息不能为空" ) ;
}
if ( Func . isNotEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
DistributionReservationEntity distributionReservation = distributionReservationService . getById ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
if ( ReservationStatusConstant . yiquexiao . getValue ( ) . equals ( distributionReservation . getReservationStatus ( ) ) ) {
throw new CustomerException ( 403 , "预约单已取消" ) ;
}
if ( Func . isNotEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
DistributionReservationEntity distributionReservation = distributionReservationService . getById ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
if ( ReservationStatusConstant . yiquexiao . getValue ( ) . equals ( distributionReservation . getReservationStatus ( ) ) ) {
throw new CustomerException ( 403 , "预约单已取消" ) ;
}
}
// -----------------------------------2023-09-25 签收调整----------------------------------------------------------------
@ -606,463 +605,425 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// 如果属于该客户则进行装车扫描
//
//获取当前用户司机
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper . selectById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//获取当前用户司机
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper . selectById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//异步确认包条扫描信息
//异步确认包条扫描信息
// distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode());
List < Long > packageLockIds = new ArrayList < > ( ) ;
List < JSONObject > jsonObjects = new ArrayList < > ( ) ;
List < JSONObject > aaa = new ArrayList < > ( ) ;
List < String > orderPackageCodes = new ArrayList < > ( ) ;
List < Long > packageLockIds = new ArrayList < > ( ) ;
List < JSONObject > jsonObjects = new ArrayList < > ( ) ;
List < JSONObject > aaa = new ArrayList < > ( ) ;
List < String > orderPackageCodes = new ArrayList < > ( ) ;
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity ( ) ;
if ( "1" . equals ( distributionDeliveryListEntity . getKind ( ) ) ) {
if ( ! Objects . isNull ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
if ( Func . isEmpty ( distributionDeliverySelfEntity ) ) {
//通过装车扫描传递的车次ID发生变化,提示文员进行计划变更
return Resp . scanFail ( 13000 , null , null , null ) ;
}
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity ( ) ;
if ( "1" . equals ( distributionDeliveryListEntity . getKind ( ) ) ) {
if ( ! Objects . isNull ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
if ( Func . isEmpty ( distributionDeliverySelfEntity ) ) {
//通过装车扫描传递的车次ID发生变化,提示文员进行计划变更
return Resp . scanFail ( 13000 , null , null , null ) ;
}
} else {
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
BeanUtils . copyProperties ( distributionDeliveryTripartiteEntity , distributionDeliverySelfEntity ) ;
}
List < DistributionParcelListEntity > pushList = new ArrayList < > ( ) ;
if ( distrilbutionloadingscanDTO . getType ( ) = = 1 ) {
List < DisStockListDetailEntity > list = disStockListDetailService . list ( Wrappers . < DisStockListDetailEntity > query ( ) . lambda ( )
. eq ( DisStockListDetailEntity : : getStockPackageCode , distrilbutionloadingscanDTO . getBarcode ( ) )
. ne ( DisStockListDetailEntity : : getStockPackageStatus , ReservationPackageStatusConstant . quxiao . getValue ( ) )
) ;
if ( Func . isNotEmpty ( list ) ) {
//满足条件此码必定为库存品
//判断该库存品是否属于当前客户
List < DisStockListDetailEntity > collect = list . stream ( ) . filter ( l - > l . getReservationId ( ) . equals ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isNotEmpty ( collect ) ) {
return Resp . scanFail ( "请在库存品页面扫描此码" , "请在库存品页面扫描此码" ) ;
}
return Resp . scanFail ( "此码不是订制品" , "此码不是订制品" ) ;
}
//查询当前扫描的包件是否进行了装车
DistributionParcelListEntity parcelList = distributionParcelListService . selectByOrderPackageCode ( distrilbutionloadingscanDTO . getBarcode ( ) , myCurrentWarehouse . getId ( ) ) ;
if ( Func . isEmpty ( parcelList ) ) {
return Resp . scanFail ( "系统无编码" , "系统无编码" ) ;
} else {
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
BeanUtils . copyProperties ( distributionDeliveryTripartiteEntity , distributionDeliverySelfEntity ) ;
}
List < DistributionParcelListEntity > pushList = new ArrayList < > ( ) ;
if ( distrilbutionloadingscanDTO . getType ( ) = = 1 ) {
List < DisStockListDetailEntity > list = disStockListDetailService . list ( Wrappers . < DisStockListDetailEntity > query ( ) . lambda ( )
. eq ( DisStockListDetailEntity : : getStockPackageCode , distrilbutionloadingscanDTO . getBarcode ( ) )
. ne ( DisStockListDetailEntity : : getStockPackageStatus , ReservationPackageStatusConstant . quxiao . getValue ( ) )
) ;
if ( Func . isNotEmpty ( list ) ) {
//满足条件此码必定为库存品
//判断该库存品是否属于当前客户
List < DisStockListDetailEntity > collect = list . stream ( ) . filter ( l - > l . getReservationId ( ) . equals ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isNotEmpty ( collect ) ) {
return Resp . scanFail ( "请在库存品页面扫描此码" , "请在库存品页面扫描此码" ) ;
}
if ( ! Objects . isNull ( parcelList ) ) {
if ( OrderPackageStatusConstant . yiqianshou . getValue ( ) . equals ( parcelList . getOrderPackageStatus ( ) ) ) {
return Resp . scanFail ( "包件已签收" , "包件已签收" ) ;
}
return Resp . scanFail ( "此码不是订制品" , "此码不是订制品" ) ;
}
//查询当前扫描的包件是否进行了装车
DistributionParcelListEntity parcelList = distributionParcelListService . selectByOrderPackageCode ( distrilbutionloadingscanDTO . getBarcode ( ) , myCurrentWarehouse . getId ( ) ) ;
if ( Func . isEmpty ( parcelList ) ) {
return Resp . scanFail ( "系统无编码" , "系统无编码" ) ;
}
if ( ! Objects . isNull ( parcelList ) ) {
if ( OrderPackageStatusConstant . yiqianshou . getValue ( ) . equals ( parcelList . getOrderPackageStatus ( ) ) ) {
return Resp . scanFail ( "包件已签收" , "包件已签收" ) ;
}
if ( ! Objects . isNull ( parcelList ) ) {
if ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) . equals ( parcelList . getOrderPackageLoadingStatus ( ) ) ) {
return Resp . scanFail ( "包件已装车" , "包件已装车" ) ;
}
}
if ( ! Objects . isNull ( parcelList ) ) {
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 ( ) )
) ;
List < DistributionLoadscanAbnormalEntity > abnormalEntities = distributionLoadscanAbnormalService . list ( Wrappers . < DistributionLoadscanAbnormalEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscanAbnormalEntity : : getPackageCode , distrilbutionloadingscanDTO . getBarcode ( ) )
. eq ( DistributionLoadscanAbnormalEntity : : getPackageId , parcelList . getId ( ) )
) ;
if ( ! abnormalEntities . isEmpty ( ) ) {
//判断异常是否属于自身
boolean flag = abnormalEntities . stream ( ) . allMatch ( a - > ! distributionDeliveryListEntity . getId ( ) . equals ( a . getDeliveryListId ( ) ) | | ! distrilbutionloadingscanDTO . getReservationId ( ) . equals ( a . getReservationId ( ) ) ) ;
if ( flag ) {
//该异常属于其他车次
String collect = abnormalEntities . stream ( ) . map ( DistributionLoadscanAbnormalEntity : : getTrainNumber ) . collect ( Collectors . joining ( "," ) ) ;
log . info ( "包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}" , distributionDeliveryListEntity . getTrainNumber ( ) , collect ) ;
return Resp . scanFail ( "包件已在其他车次存在异常" , "包件已在其他车次存在异常" ) ;
}
if ( ! abnormalEntities . isEmpty ( ) ) {
//判断异常是否属于自身
boolean flag = abnormalEntities . stream ( ) . allMatch ( a - > ! distributionDeliveryListEntity . getId ( ) . equals ( a . getDeliveryListId ( ) ) | | ! distrilbutionloadingscanDTO . getReservationId ( ) . equals ( a . getReservationId ( ) ) ) ;
if ( flag ) {
//该异常属于其他车次
String collect = abnormalEntities . stream ( ) . map ( DistributionLoadscanAbnormalEntity : : getTrainNumber ) . collect ( Collectors . joining ( "," ) ) ;
log . info ( "包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}" , distributionDeliveryListEntity . getTrainNumber ( ) , collect ) ;
return Resp . scanFail ( "包件已在其他车次存在异常" , "包件已在其他车次存在异常" ) ;
}
}
List < DistributionParcelListEntity > distributionParcelListEntities = distributionDeliveryListMapper . selectPackageListByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
if ( Func . isNotEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
//在客户列表进行装车
distributionParcelListEntities = distributionReservationMapper . selectPackageListByReservationId ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
List < DistributionParcelListEntity > distributionParcelListEntities = distributionDeliveryListMapper . selectPackageListByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
if ( Func . isNotEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
//在客户列表进行装车
distributionParcelListEntities = distributionReservationMapper . selectPackageListByReservationId ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
}
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListEntities . stream ( ) . filter ( p - > Func . equals ( p . getOrderPackageCode ( ) , distrilbutionloadingscanDTO . getBarcode ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( parcelListEntityList . size ( ) = = 1 ) {
//在配送任务中存在该包件的计划
List < DistributionLoadscanEntity > distributionLoadscanEntitiesflag = distributionLoadscanMapper . selectList ( new QueryWrapper < DistributionLoadscanEntity > ( ) . lambda ( ) . eq ( DistributionLoadscanEntity : : getDeliveryId , distrilbutionloadingscanDTO . getDeliveryId ( ) ) . eq ( DistributionLoadscanEntity : : getOrderPackageCode , distrilbutionloadingscanDTO . getBarcode ( ) ) . ne ( DistributionLoadscanEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) ) ) ;
if ( Func . isNotEmpty ( distributionLoadscanEntitiesflag ) & & distributionLoadscanEntitiesflag . size ( ) = = 1 ) {
return Resp . scanFail ( "重复扫码" , "重复扫码" ) ;
}
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListEntities . stream ( ) . filter ( p - > Func . equals ( p . getOrderPackageCode ( ) , distrilbutionloadingscanDTO . getBarcode ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( parcelListEntityList . size ( ) = = 1 ) {
//在配送任务中存在该包件的计划
List < DistributionLoadscanEntity > distributionLoadscanEntitiesflag = distributionLoadscanMapper . selectList ( new QueryWrapper < DistributionLoadscanEntity > ( ) . lambda ( ) . eq ( DistributionLoadscanEntity : : getDeliveryId , distrilbutionloadingscanDTO . getDeliveryId ( ) ) . eq ( DistributionLoadscanEntity : : getOrderPackageCode , distrilbutionloadingscanDTO . getBarcode ( ) ) . ne ( DistributionLoadscanEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) ) ) ;
if ( Func . isNotEmpty ( distributionLoadscanEntitiesflag ) & & distributionLoadscanEntitiesflag . size ( ) = = 1 ) {
return Resp . scanFail ( "重复扫码" , "重复扫码" ) ;
}
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity ( ) ;
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDeliveryId ( ) ) ) {
loadscanEntity . setDriverId ( distributionDeliverySelfEntity . getDriverId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverName ( ) ) ) {
loadscanEntity . setDriverName ( distributionDeliverySelfEntity . getDriverName ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ) {
loadscanEntity . setVehicleName ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleId ( ) ) ) {
loadscanEntity . setVehicleId ( distributionDeliverySelfEntity . getVehicleId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ) {
loadscanEntity . setDriverPhone ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ;
}
DistributionParcelListEntity parcelListEntity = parcelListEntityList . get ( 0 ) ;
//添加车次号
loadscanEntity . setTrainNumber ( distributionDeliveryListEntity . getTrainNumber ( ) ) ;
loadscanEntity . setScanStatus ( LoadingStatusConstant . saomiao . getValue ( ) ) ;
loadscanEntity . setScanType ( "1" ) ;
loadscanEntity . setOneClick ( 1 ) ;
loadscanEntity . setWarehouseId ( myCurrentWarehouse . getId ( ) ) ;
loadscanEntity . setWarehouseName ( myCurrentWarehouse . getName ( ) ) ;
loadscanEntity . setPackageId ( parcelListEntity . getId ( ) ) ;
loadscanEntity . setOrderPackageCode ( parcelListEntity . getOrderPackageCode ( ) ) ;
loadscanEntity . setPackageNub ( parcelListEntity . getQuantity ( ) ) ;
DistributionReservationEntity reservationEntity = distributionDeliveryListMapper . selectReservationByPackageAndDeliveryId ( parcelListEntity . getOrderPackageCode ( ) , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
loadscanEntity . setReservationId ( reservationEntity . getId ( ) ) ;
loadscanEntity . setDeliveryId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
loadscanEntity . setOrderId ( parcelListEntity . getStockArticleId ( ) ) ;
loadscanEntity . setScanTime ( now ) ;
BladeUser user = AuthUtil . getUser ( ) ;
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity ( ) ;
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDeliveryId ( ) ) ) {
loadscanEntity . setDriverId ( distributionDeliverySelfEntity . getDriverId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverName ( ) ) ) {
loadscanEntity . setDriverName ( distributionDeliverySelfEntity . getDriverName ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ) {
loadscanEntity . setVehicleName ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleId ( ) ) ) {
loadscanEntity . setVehicleId ( distributionDeliverySelfEntity . getVehicleId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ) {
loadscanEntity . setDriverPhone ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ;
}
DistributionParcelListEntity parcelListEntity = parcelListEntityList . get ( 0 ) ;
//添加车次号
loadscanEntity . setTrainNumber ( distributionDeliveryListEntity . getTrainNumber ( ) ) ;
loadscanEntity . setScanStatus ( LoadingStatusConstant . saomiao . getValue ( ) ) ;
loadscanEntity . setScanType ( "1" ) ;
loadscanEntity . setOneClick ( 1 ) ;
loadscanEntity . setWarehouseId ( myCurrentWarehouse . getId ( ) ) ;
loadscanEntity . setWarehouseName ( myCurrentWarehouse . getName ( ) ) ;
loadscanEntity . setPackageId ( parcelListEntity . getId ( ) ) ;
loadscanEntity . setOrderPackageCode ( parcelListEntity . getOrderPackageCode ( ) ) ;
loadscanEntity . setPackageNub ( parcelListEntity . getQuantity ( ) ) ;
DistributionReservationEntity reservationEntity = distributionDeliveryListMapper . selectReservationByPackageAndDeliveryId ( parcelListEntity . getOrderPackageCode ( ) , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
loadscanEntity . setReservationId ( reservationEntity . getId ( ) ) ;
loadscanEntity . setDeliveryId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
loadscanEntity . setOrderId ( parcelListEntity . getStockArticleId ( ) ) ;
loadscanEntity . setScanTime ( now ) ;
BladeUser user = AuthUtil . getUser ( ) ;
// loadscanEntity.setScanUser(user.getUserName());
loadscanEntity . setScanUser ( user . getNickName ( ) ) ;
loadscanEntity . setLoadingId ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
loadscanEntity . setIsAbnormalLoading ( 1 ) ;
loadscanEntity . setLoadedNub ( parcelListEntity . getQuantity ( ) ) ;
distributionLoadscanService . save ( loadscanEntity ) ;
//更新包件装车状态
packageLockIds . add ( loadscanEntity . getPackageId ( ) ) ;
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
parcelListEntity . setOrderPackageGroundingStatus ( OrderPackageGroundingStatusConstant . daishangjia . getValue ( ) ) ;
parcelListEntity . setOrderPackageStatus ( OrderPackageStatusConstant . yichuku . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
//更新装车时间
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
loadscanEntity . setScanUser ( user . getNickName ( ) ) ;
loadscanEntity . setLoadingId ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
loadscanEntity . setIsAbnormalLoading ( 1 ) ;
loadscanEntity . setLoadedNub ( parcelListEntity . getQuantity ( ) ) ;
distributionLoadscanService . save ( loadscanEntity ) ;
//更新包件装车状态
packageLockIds . add ( loadscanEntity . getPackageId ( ) ) ;
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
parcelListEntity . setOrderPackageGroundingStatus ( OrderPackageGroundingStatusConstant . daishangjia . getValue ( ) ) ;
parcelListEntity . setOrderPackageStatus ( OrderPackageStatusConstant . yichuku . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
//更新装车时间
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//更新签收表的装车数量
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
//进行解托操作
Map < String , Object > info = new HashMap < > ( ) ;
info . put ( "orderPackageCode" , parcelListEntity . getOrderPackageCode ( ) ) ;
info . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
warehouseUpdownTypeClient . downPackageAndDelTrayAndIsUpdate ( parcelListEntity . getOrderPackageCode ( ) , myCurrentWarehouse . getId ( ) , "扫描装车进行下架、解托" , false ) ;
Map < String , Object > map = new HashMap ( ) ;
String distrilbutionloadingscanDTOJson = JSONObject . toJSONString ( distrilbutionloadingscanDTO ) ;
map . put ( "distrilbutionloadingscanDTO" , distrilbutionloadingscanDTOJson ) ;
String parcelListEntityJson = JSONObject . toJSONString ( parcelListEntity ) ;
map . put ( "parcelListEntity" , parcelListEntityJson ) ;
map . put ( "myCurrentWarehouseId" , myCurrentWarehouse . getId ( ) ) ;
String reservationEntityJson = JSONObject . toJSONString ( reservationEntity ) ;
map . put ( "reservationEntity" , reservationEntityJson ) ;
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "code" , loadscanEntity . getOrderPackageCode ( ) ) ;
jsonObject . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
jsonObject . put ( "taskId" , loadscanEntity . getReservationId ( ) ) ;
jsonObject . put ( "type" , 1 ) ;
jsonObject . put ( "num" , 1 ) ;
jsonObject . put ( "remark" , "装车下架" ) ;
jsonObjects . add ( jsonObject ) ;
log . info ( ">>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态" ) ;
rabbitTemplate . convertAndSend ( RabbitConstant . ORDER_PACKAGE_STATUS_INFO_EXCHANGE , RabbitConstant . ORDER_PACKAGE_STATUS_INFO_ROUTING , map , message - > {
message . getMessageProperties ( )
. setHeader ( "x-delay" , 3000 ) ;
return message ;
} ) ;
JSONObject trunklinePackageTrackLog = new JSONObject ( ) ;
try {
String content = "包件在" + myCurrentWarehouse . getName ( ) + "由" + loadscanEntity . getScanUser ( ) + "扫描装车,配送车次号:" + distributionDeliveryListEntity . getTrainNumber ( ) + "预约任务号:" + reservationEntity . getReservationCode ( ) ;
trunklinePackageTrackLog . put ( "tenantId" , loadscanEntity . getTenantId ( ) ) ;
trunklinePackageTrackLog . put ( "createTime" , loadscanEntity . getCreateTime ( ) ) ;
trunklinePackageTrackLog . put ( "createUser" , loadscanEntity . getCreateUser ( ) ) ;
trunklinePackageTrackLog . put ( "updateUser" , loadscanEntity . getUpdateUser ( ) ) ;
trunklinePackageTrackLog . put ( "updateTime" , loadscanEntity . getUpdateTime ( ) ) ;
trunklinePackageTrackLog . put ( "isDeleted" , loadscanEntity . getIsDeleted ( ) ) ;
trunklinePackageTrackLog . put ( "status" , loadscanEntity . getStatus ( ) ) ;
trunklinePackageTrackLog . put ( "createDept" , loadscanEntity . getCreateDept ( ) ) ;
trunklinePackageTrackLog . put ( "orderPackageCode" , loadscanEntity . getOrderPackageCode ( ) ) ;
trunklinePackageTrackLog . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
trunklinePackageTrackLog . put ( "warehouseName" , myCurrentWarehouse . getName ( ) ) ;
trunklinePackageTrackLog . put ( "workNode" , WorkNodeEnums . DISTRIBUTION_LOADING . getCode ( ) ) ;
trunklinePackageTrackLog . put ( "content" , content ) ;
trunklinePackageTrackLog . put ( "operator" , loadscanEntity . getScanUser ( ) ) ;
} catch ( Exception e ) {
log . error ( "装车日志数据错误" , e ) ;
}
aaa . add ( trunklinePackageTrackLog ) ;
orderPackageCodes . add ( loadscanEntity . getOrderPackageCode ( ) ) ;
//更新签收表的装车数量
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
//进行解托操作
Map < String , Object > info = new HashMap < > ( ) ;
info . put ( "orderPackageCode" , parcelListEntity . getOrderPackageCode ( ) ) ;
info . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
warehouseUpdownTypeClient . downPackageAndDelTrayAndIsUpdate ( parcelListEntity . getOrderPackageCode ( ) , myCurrentWarehouse . getId ( ) , "扫描装车进行下架、解托" , false ) ;
Map < String , Object > map = new HashMap ( ) ;
String distrilbutionloadingscanDTOJson = JSONObject . toJSONString ( distrilbutionloadingscanDTO ) ;
map . put ( "distrilbutionloadingscanDTO" , distrilbutionloadingscanDTOJson ) ;
String parcelListEntityJson = JSONObject . toJSONString ( parcelListEntity ) ;
map . put ( "parcelListEntity" , parcelListEntityJson ) ;
map . put ( "myCurrentWarehouseId" , myCurrentWarehouse . getId ( ) ) ;
String reservationEntityJson = JSONObject . toJSONString ( reservationEntity ) ;
map . put ( "reservationEntity" , reservationEntityJson ) ;
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "code" , loadscanEntity . getOrderPackageCode ( ) ) ;
jsonObject . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
jsonObject . put ( "taskId" , loadscanEntity . getReservationId ( ) ) ;
jsonObject . put ( "type" , 1 ) ;
jsonObject . put ( "num" , 1 ) ;
jsonObject . put ( "remark" , "装车下架" ) ;
jsonObjects . add ( jsonObject ) ;
log . info ( ">>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态" ) ;
rabbitTemplate . convertAndSend ( RabbitConstant . ORDER_PACKAGE_STATUS_INFO_EXCHANGE , RabbitConstant . ORDER_PACKAGE_STATUS_INFO_ROUTING , map , message - > {
message . getMessageProperties ( )
. setHeader ( "x-delay" , 3000 ) ;
return message ;
} ) ;
String content = "包件在" + myCurrentWarehouse . getName ( ) + "由" + loadscanEntity . getScanUser ( ) + "扫描装车,配送车次号:" + distributionDeliveryListEntity . getTrainNumber ( ) + "预约任务号:" + reservationEntity . getReservationCode ( ) ;
JSONObject trunklinePackageTrackLog = handleLogJSONObject ( myCurrentWarehouse , AuthUtil . getUser ( ) , parcelListEntity . getOrderPackageCode ( ) , content , WorkNodeEnums . DISTRIBUTION_LOADING . getCode ( ) ) ;
aaa . add ( trunklinePackageTrackLog ) ;
orderPackageCodes . add ( loadscanEntity . getOrderPackageCode ( ) ) ;
pushList . add ( parcelListEntity ) ;
pushList . add ( parcelListEntity ) ;
//extracteOrderPackageStatus(distrilbutionloadingscanDTO, parcelListEntity, myCurrentWarehouse, reservationEntity);
//extracteOrderPackageStatus(distrilbutionloadingscanDTO, parcelListEntity, myCurrentWarehouse, reservationEntity);
} else if ( parcelListEntityList . isEmpty ( ) ) {
//查找出该包件信息
DistributionParcelListEntity parcelListEntity = distributionParcelListService . getOne ( Wrappers . < DistributionParcelListEntity > query ( ) . lambda ( ) . eq ( DistributionParcelListEntity : : getOrderPackageCode , distrilbutionloadingscanDTO . getBarcode ( ) ) . eq ( DistributionParcelListEntity : : getWarehouseId , myCurrentWarehouse . getId ( ) ) ) ;
List < DistributionReservationEntity > reservationEntityList = distributionDeliveryListMapper . selectReservationByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
boolean shangpeiFlag = reservationEntityList . stream ( ) . allMatch ( r - > r . getDeliveryType ( ) . equals ( DistributionTypeConstant . shipie . getValue ( ) ) ) ;
if ( Func . isEmpty ( parcelListEntity ) ) {
return Resp . scanFail ( "无包件信息" , "无包件信息" ) ;
}
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleMapper . selectById ( parcelListEntity . getStockArticleId ( ) ) ;
if ( shangpeiFlag ) {
List < DistributionReservationEntity > reservationEntities = reservationEntityList . stream ( ) . filter ( r - > Func . isNotEmpty ( r . getConsignee ( ) ) & & r . getConsignee ( ) . equals ( stockArticleEntity . getCustomerName ( ) ) & & r . getDeliveryAddress ( ) . equals ( stockArticleEntity . getCustomerAddress ( ) ) & & r . getDeliveryPhone ( ) . equals ( stockArticleEntity . getCustomerTelephone ( ) ) & & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) . collect ( Collectors . toList ( ) ) ;
//查看是否存在满足条件的预约单
//存在多个,操作人指定具体客户即可
if ( ! reservationEntities . isEmpty ( ) ) {
if ( Func . isEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
log . info ( "异常装车未指定客户" ) ;
return Resp . scanFail ( "请指定客户进行异常装车" , "请指定客户进行异常装车" ) ;
}
return R . fail ( 5000 , "异常装车" ) ;
// return Resp.scanFail("装车失败","程序出错,请联系彪桑");
} else {
if ( parcelListEntity . getConditions ( ) = = 2 ) {
return Resp . scanFail ( "此包件不是订制品" , "此包件不是订制品" ) ;
} else if ( parcelListEntityList . isEmpty ( ) ) {
//查找出该包件信息
DistributionParcelListEntity parcelListEntity = distributionParcelListService . getOne ( Wrappers . < DistributionParcelListEntity > query ( ) . lambda ( ) . eq ( DistributionParcelListEntity : : getOrderPackageCode , distrilbutionloadingscanDTO . getBarcode ( ) ) . eq ( DistributionParcelListEntity : : getWarehouseId , myCurrentWarehouse . getId ( ) ) ) ;
List < DistributionReservationEntity > reservationEntityList = distributionDeliveryListMapper . selectReservationByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
boolean shangpeiFlag = reservationEntityList . stream ( ) . allMatch ( r - > r . getDeliveryType ( ) . equals ( DistributionTypeConstant . shipie . getValue ( ) ) ) ;
if ( Func . isEmpty ( parcelListEntity ) ) {
return Resp . scanFail ( "无包件信息" , "无包件信息" ) ;
} else {
return Resp . scanFail ( "窜货" , "窜货" ) ;
}
}
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleMapper . selectById ( parcelListEntity . getStockArticleId ( ) ) ;
} else {
shangpeiFlag = reservationEntityList . stream ( ) . allMatch ( r - > r . getDeliveryType ( ) . equals ( DistributionTypeConstant . shangpei . getValue ( ) ) ) ;
if ( shangpeiFlag ) {
List < DistributionReservationEntity > reservationEntities = reservationEntityList . stream ( ) . filter ( r - > Func . isNotEmpty ( r . getConsignee ( ) ) & & r . getConsignee ( ) . equals ( stockArticleEntity . getCustomerName ( ) ) & & r . getDeliveryAddress ( ) . equals ( stockArticleEntity . getCustomerAddress ( ) ) & & r . getDeliveryPhone ( ) . equals ( stockArticleEntity . getCustomerTelephone ( ) ) & & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) . collect ( Collectors . toList ( ) ) ;
//查看是否存在满足条件的预约单
//存在多个,操作人指定具体客户即可
if ( ! reservationEntities . isEmpty ( ) ) {
List < DistributionReservationEntity > reservationEntities = reservationEntityList . stream ( ) . filter ( r - > r . getReceivingUnit ( ) . equals ( stockArticleEntity . getConsigneeUnit ( ) ) & & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) . collect ( Collectors . toList ( ) ) ;
//查询是否满足商配异常装车
boolean flag = reservationEntityList . stream ( ) . anyMatch ( r - > r . getReceivingUnit ( ) . equals ( stockArticleEntity . getConsigneeUnit ( ) ) & & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) ;
if ( reservationEntities . size ( ) = = 1 ) {
if ( Func . isEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
log . info ( "异常装车未指定客户" ) ;
return Resp . scanFail ( "请指定客户进行异常装车" , "请指定客户进行异常装车" ) ;
}
return R . fail ( 5000 , "异常装车" ) ;
// return Resp.scanFail("装车失败","程序出错,请联系彪桑");
} else {
if ( parcelListEntity . getConditions ( ) = = 2 ) {
return Resp . scanFail ( "此包件不是订制品" , "此包件不是订制品" ) ;
} else {
return Resp . scanFail ( "窜货" , "窜货" ) ;
}
return Resp . scanFail ( "窜货" , "窜货" ) ;
}
} else {
shangpeiFlag = reservationEntityList . stream ( ) . allMatch ( r - > r . getDeliveryType ( ) . equals ( DistributionTypeConstant . shangpei . getValue ( ) ) ) ;
if ( shangpeiFlag ) {
List < DistributionReservationEntity > reservationEntities = reservationEntityList . stream ( ) . filter ( r - > r . getReceivingUnit ( ) . equals ( stockArticleEntity . getConsigneeUnit ( ) ) & & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) . collect ( Collectors . toList ( ) ) ;
//查询是否满足商配异常装车
boolean flag = reservationEntityList . stream ( ) . anyMatch ( r - > r . getReceivingUnit ( ) . equals ( stockArticleEntity . getConsigneeUnit ( ) ) & & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) ;
if ( reservationEntities . size ( ) = = 1 ) {
if ( Func . isEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
log . info ( "异常装车未指定客户" ) ;
return Resp . scanFail ( "请指定客户进行异常装车" , "请指定客户进行异常装车" ) ;
}
return R . fail ( 5000 , "异常装车" ) ;
} else {
return Resp . scanFail ( "窜货" , "窜货" ) ;
}
} else {
log . error ( "配送计划预约类型错误:{}" , reservationEntityList ) ;
}
log . error ( "配送计划预约类型错误:{}" , reservationEntityList ) ;
}
log . info ( "异常装车判定成功>>>>>>packageCode:{},reservationId:{}" , distrilbutionloadingscanDTO . getBarcode ( ) , distrilbutionloadingscanDTO . getReservationId ( ) ) ;
}
} else if ( distrilbutionloadingscanDTO . getType ( ) = = 2 ) {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 000000000 type={}" , distrilbutionloadingscanDTO . getType ( ) ) ;
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeClient . selectListByTrayCode ( distrilbutionloadingscanDTO . getBarcode ( ) ) ;
if ( Func . isNotEmpty ( trayTypeDataVO ) ) {
List < WarehouseTrayGoodsEntity > voGoodsLsit = trayTypeDataVO . getGoodsLsit ( ) ;
boolean isAllProducts = voGoodsLsit . stream ( ) . allMatch ( t - > "3" . equals ( t . getAssociationType ( ) ) ) ;
if ( isAllProducts ) {
//该托盘商全部都是订制品
List < Long > trayGoodIds = voGoodsLsit . stream ( ) . filter ( v - > "3" . equals ( v . getAssociationType ( ) ) ) . map ( WarehouseTrayGoodsEntity : : getAssociationId ) . collect ( Collectors . toList ( ) ) ;
List < DistributionParcelListEntity > parcelListEntities = distributionParcelListService . listByIds ( trayGoodIds ) ;
if ( trayGoodIds . size ( ) ! = parcelListEntities . size ( ) ) {
return Resp . scanFail ( "托盘存在其他货物" , "托盘存在其他货物" ) ;
log . info ( "异常装车判定成功>>>>>>packageCode:{},reservationId:{}" , distrilbutionloadingscanDTO . getBarcode ( ) , distrilbutionloadingscanDTO . getReservationId ( ) ) ;
}
} else if ( distrilbutionloadingscanDTO . getType ( ) = = 2 ) {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 000000000 type={}" , distrilbutionloadingscanDTO . getType ( ) ) ;
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeClient . selectListByTrayCode ( distrilbutionloadingscanDTO . getBarcode ( ) ) ;
if ( Func . isNotEmpty ( trayTypeDataVO ) ) {
List < WarehouseTrayGoodsEntity > voGoodsLsit = trayTypeDataVO . getGoodsLsit ( ) ;
boolean isAllProducts = voGoodsLsit . stream ( ) . allMatch ( t - > "3" . equals ( t . getAssociationType ( ) ) ) ;
if ( isAllProducts ) {
//该托盘商全部都是订制品
List < Long > trayGoodIds = voGoodsLsit . stream ( ) . filter ( v - > "3" . equals ( v . getAssociationType ( ) ) ) . map ( WarehouseTrayGoodsEntity : : getAssociationId ) . collect ( Collectors . toList ( ) ) ;
List < DistributionParcelListEntity > parcelListEntities = distributionParcelListService . listByIds ( trayGoodIds ) ;
if ( trayGoodIds . size ( ) ! = parcelListEntities . size ( ) ) {
return Resp . scanFail ( "托盘存在其他货物" , "托盘存在其他货物" ) ;
}
//判断该货物都属于同一客户才能进行装车
List < DistributionParcelListEntity > parcelListEntityList = distributionReservationMapper . selectPackageListByReservationId ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
boolean isBelongToReservation = parcelListEntities . stream ( ) . allMatch ( tp - > parcelListEntityList . stream ( ) . map ( DistributionParcelListEntity : : getId ) . collect ( Collectors . toList ( ) ) . contains ( tp . getId ( ) ) ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 111111111 isBelongToReservation={}" , isBelongToReservation ) ;
if ( isBelongToReservation ) {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 222222222" ) ;
List < DistributionLoadscanEntity > loadscanEntityList = distributionLoadscanService . list ( Wrappers . < DistributionLoadscanEntity > query ( ) . lambda ( ) . eq ( DistributionLoadscanEntity : : getDeliveryId , distrilbutionloadingscanDTO . getDeliveryId ( ) ) . ne ( DistributionLoadscanEntity : : getScanStatus , 1 ) . eq ( DistributionLoadscanEntity : : getTrayNo , distrilbutionloadingscanDTO . getBarcode ( ) ) ) ;
boolean trayLoadingStatus = parcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 333333333 trayLoadingStatus={} loadscanEntityList={}" , trayLoadingStatus , loadscanEntityList ) ;
if ( Func . isNotEmpty ( loadscanEntityList ) & & ! loadscanEntityList . isEmpty ( ) & & trayLoadingStatus ) {
return Resp . scanFail ( "重复扫描" , "重复扫描" ) ;
}
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 444444444 parcelListEntities={}" , parcelListEntities ) ;
if ( Func . isEmpty ( parcelListEntities ) | | parcelListEntities . size ( ) < = 0 ) {
return Resp . scanFail ( "该托盘上无货物信息" , "该托盘上无货物信息" ) ;
}
//判断该货物都属于同一客户才能进行装车
List < DistributionParcelListEntity > parcelListEntityList = distributionReservationMapper . selectPackageListByReservationId ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
boolean isBelongToReservation = parcelListEntities . stream ( ) . allMatch ( tp - > parcelListEntityList . stream ( ) . map ( DistributionParcelListEntity : : getId ) . collect ( Collectors . toList ( ) ) . contains ( tp . getId ( ) ) ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 111111111 isBelongToReservation={}" , isBelongToReservation ) ;
if ( isBelongToReservation ) {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 222222222" ) ;
List < DistributionLoadscanEntity > loadscanEntityList = distributionLoadscanService . list ( Wrappers . < DistributionLoadscanEntity > query ( ) . lambda ( ) . eq ( DistributionLoadscanEntity : : getDeliveryId , distrilbutionloadingscanDTO . getDeliveryId ( ) ) . ne ( DistributionLoadscanEntity : : getScanStatus , 1 ) . eq ( DistributionLoadscanEntity : : getTrayNo , distrilbutionloadingscanDTO . getBarcode ( ) ) ) ;
boolean trayLoadingStatus = parcelListEntities . stream ( ) . allMatch ( p - > p . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 333333333 trayLoadingStatus={} loadscanEntityList={}" , trayLoadingStatus , loadscanEntityList ) ;
if ( Func . isNotEmpty ( loadscanEntityList ) & & ! loadscanEntityList . isEmpty ( ) & & trayLoadingStatus ) {
return Resp . scanFail ( "重复扫描" , "重复扫描" ) ;
}
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 444444444 parcelListEntities={}" , parcelListEntities ) ;
if ( Func . isEmpty ( parcelListEntities ) | | parcelListEntities . size ( ) < = 0 ) {
return Resp . scanFail ( "该托盘上无货物信息" , "该托盘上无货物信息" ) ;
}
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 55555555555 distrilbutionloadingscanDTO={}" , distrilbutionloadingscanDTO ) ;
if ( Func . isNotEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
//存在客户 这里就是针对客户进行的整托装车
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 55555555555 distrilbutionloadingscanDTO={}" , distrilbutionloadingscanDTO ) ;
if ( Func . isNotEmpty ( distrilbutionloadingscanDTO . getReservationId ( ) ) ) {
//存在客户 这里就是针对客户进行的整托装车
// List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
Map < Long , DistributionParcelListEntity > parcelListEntityMap = parcelListEntityList . stream ( ) . collect ( Collectors . toMap ( DistributionParcelListEntity : : getId , Function . identity ( ) , ( k1 , k2 ) - > k2 ) ) ;
boolean reservationFlag = parcelListEntities . stream ( ) . allMatch ( p - > Func . isNotEmpty ( parcelListEntityMap . get ( p . getId ( ) ) ) ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 6666666666 reservationFlag={}" , reservationFlag ) ;
if ( reservationFlag ) {
try {
warehouseUpdownTypeClient . downTray ( distrilbutionloadingscanDTO . getBarcode ( ) , myCurrentWarehouse . getId ( ) ) ;
} catch ( Exception e ) {
log . error ( "#################货物下架错误:{}" , distrilbutionloadingscanDTO . getBarcode ( ) ) ;
Map < Long , DistributionParcelListEntity > parcelListEntityMap = parcelListEntityList . stream ( ) . collect ( Collectors . toMap ( DistributionParcelListEntity : : getId , Function . identity ( ) , ( k1 , k2 ) - > k2 ) ) ;
boolean reservationFlag = parcelListEntities . stream ( ) . allMatch ( p - > Func . isNotEmpty ( parcelListEntityMap . get ( p . getId ( ) ) ) ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 6666666666 reservationFlag={}" , reservationFlag ) ;
if ( reservationFlag ) {
try {
warehouseUpdownTypeClient . downTray ( distrilbutionloadingscanDTO . getBarcode ( ) , myCurrentWarehouse . getId ( ) ) ;
} catch ( Exception e ) {
log . error ( "#################货物下架错误:{}" , distrilbutionloadingscanDTO . getBarcode ( ) ) ;
// return Resp.scanFail("装车失败", "装车失败");
}
DistributionReservationEntity reservationEntity = distributionReservationService . getById ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
List < DistributionLoadscanEntity > reservationLoadscanEntities = new ArrayList < > ( ) ;
List < String > orderCodes = new ArrayList < > ( ) ;
for ( DistributionParcelListEntity parcelListEntity : parcelListEntities ) {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 88888888888 parcelListEntities={}" , parcelListEntities ) ;
if ( parcelListEntity . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) {
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
parcelListEntity . setOrderPackageStatus ( OrderPackageStatusConstant . yichuku . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity ( ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 77777777777 distributionDeliverySelfEntity={}" , distributionDeliverySelfEntity ) ;
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDeliveryId ( ) ) ) {
loadscanEntity . setDriverId ( distributionDeliverySelfEntity . getDriverId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverName ( ) ) ) {
loadscanEntity . setDriverName ( distributionDeliverySelfEntity . getDriverName ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ) {
loadscanEntity . setVehicleName ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleId ( ) ) ) {
loadscanEntity . setVehicleId ( distributionDeliverySelfEntity . getVehicleId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ) {
loadscanEntity . setDriverPhone ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ;
}
loadscanEntity . setScanTime ( now ) ;
loadscanEntity . setOrderId ( parcelListEntity . getStockArticleId ( ) ) ;
loadscanEntity . setOrderPackageCode ( parcelListEntity . getOrderPackageCode ( ) ) ;
loadscanEntity . setReservationId ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
loadscanEntity . setDeliveryId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
loadscanEntity . setTrainNumber ( distributionDeliveryListEntity . getTrainNumber ( ) ) ;
loadscanEntity . setPackageNub ( parcelListEntity . getQuantity ( ) ) ;
loadscanEntity . setPackageId ( parcelListEntity . getId ( ) ) ;
BladeUser user = AuthUtil . getUser ( ) ;
// loadscanEntity.setScanUser(user.getUserName());
loadscanEntity . setScanUser ( user . getNickName ( ) ) ;
loadscanEntity . setLoadingId ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
loadscanEntity . setOneClick ( 1 ) ;
loadscanEntity . setScanType ( "2" ) ;
loadscanEntity . setScanStatus ( "2" ) ;
loadscanEntity . setIsInsert ( 1 ) ;
loadscanEntity . setMsg ( "司机整托装车" ) ;
loadscanEntity . setTrayNo ( trayTypeDataVO . getTrayCode ( ) ) ;
reservationLoadscanEntities . add ( loadscanEntity ) ;
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//更新签收表的装车数量
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
//扣减订单的在库数量
orderCodes . add ( parcelListEntity . getOrderCode ( ) ) ;
//修改包件为装车状态
orderPackageCodes . add ( parcelListEntity . getOrderPackageCode ( ) ) ;
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
packageLockIds . add ( loadscanEntity . getPackageId ( ) ) ;
String content = "包件在" + myCurrentWarehouse . getName ( ) + "由" + loadscanEntity . getScanUser ( ) + "扫描托盘:" + loadscanEntity . getTrayNo ( ) + "装车,配送车次号:" + distributionDeliveryListEntity . getTrainNumber ( ) + "预约任务号:" + reservationEntity . getReservationCode ( ) ;
JSONObject trunklinePackageTrackLog = new JSONObject ( ) ;
trunklinePackageTrackLog . put ( "tenantId" , loadscanEntity . getTenantId ( ) ) ;
trunklinePackageTrackLog . put ( "createTime" , loadscanEntity . getCreateTime ( ) ) ;
trunklinePackageTrackLog . put ( "createUser" , loadscanEntity . getCreateUser ( ) ) ;
trunklinePackageTrackLog . put ( "updateUser" , loadscanEntity . getUpdateUser ( ) ) ;
trunklinePackageTrackLog . put ( "updateTime" , loadscanEntity . getUpdateTime ( ) ) ;
trunklinePackageTrackLog . put ( "isDeleted" , loadscanEntity . getIsDeleted ( ) ) ;
trunklinePackageTrackLog . put ( "status" , loadscanEntity . getStatus ( ) ) ;
trunklinePackageTrackLog . put ( "createDept" , loadscanEntity . getCreateDept ( ) ) ;
trunklinePackageTrackLog . put ( "orderPackageCode" , loadscanEntity . getOrderPackageCode ( ) ) ;
trunklinePackageTrackLog . put ( "warehouseId" , loadscanEntity . getWarehouseId ( ) = = null ? myCurrentWarehouse . getId ( ) : loadscanEntity . getWarehouseId ( ) ) ;
trunklinePackageTrackLog . put ( "warehouseName" , loadscanEntity . getWarehouseName ( ) = = null ? myCurrentWarehouse . getName ( ) : loadscanEntity . getWarehouseName ( ) ) ;
trunklinePackageTrackLog . put ( "workNode" , WorkNodeEnums . DISTRIBUTION_LOADING . getCode ( ) ) ;
trunklinePackageTrackLog . put ( "content" , content ) ;
trunklinePackageTrackLog . put ( "operator" , loadscanEntity . getScanUser ( ) ) ;
aaa . add ( trunklinePackageTrackLog ) ;
orderPackageCodes . add ( loadscanEntity . getOrderPackageCode ( ) ) ;
pushList . add ( parcelListEntity ) ;
}
DistributionReservationEntity reservationEntity = distributionReservationService . getById ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
List < DistributionLoadscanEntity > reservationLoadscanEntities = new ArrayList < > ( ) ;
List < String > orderCodes = new ArrayList < > ( ) ;
for ( DistributionParcelListEntity parcelListEntity : parcelListEntities ) {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 88888888888 parcelListEntities={}" , parcelListEntities ) ;
if ( parcelListEntity . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . weizhuancghe . getValue ( ) ) ) {
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
parcelListEntity . setOrderPackageStatus ( OrderPackageStatusConstant . yichuku . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity ( ) ;
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 77777777777 distributionDeliverySelfEntity={}" , distributionDeliverySelfEntity ) ;
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDeliveryId ( ) ) ) {
loadscanEntity . setDriverId ( distributionDeliverySelfEntity . getDriverId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverName ( ) ) ) {
loadscanEntity . setDriverName ( distributionDeliverySelfEntity . getDriverName ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ) {
loadscanEntity . setVehicleName ( distributionDeliverySelfEntity . getVehicleNub ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getVehicleId ( ) ) ) {
loadscanEntity . setVehicleId ( distributionDeliverySelfEntity . getVehicleId ( ) ) ;
}
if ( Func . isNotEmpty ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ) {
loadscanEntity . setDriverPhone ( distributionDeliverySelfEntity . getDriverPhone ( ) ) ;
}
loadscanEntity . setScanTime ( now ) ;
loadscanEntity . setOrderId ( parcelListEntity . getStockArticleId ( ) ) ;
loadscanEntity . setOrderPackageCode ( parcelListEntity . getOrderPackageCode ( ) ) ;
loadscanEntity . setReservationId ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
loadscanEntity . setDeliveryId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
loadscanEntity . setTrainNumber ( distributionDeliveryListEntity . getTrainNumber ( ) ) ;
loadscanEntity . setPackageNub ( parcelListEntity . getQuantity ( ) ) ;
loadscanEntity . setPackageId ( parcelListEntity . getId ( ) ) ;
BladeUser user = AuthUtil . getUser ( ) ;
// loadscanEntity.setScanUser(user.getUserName());
loadscanEntity . setScanUser ( user . getNickName ( ) ) ;
loadscanEntity . setLoadingId ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
loadscanEntity . setOneClick ( 1 ) ;
loadscanEntity . setScanType ( "2" ) ;
loadscanEntity . setScanStatus ( "2" ) ;
loadscanEntity . setIsInsert ( 1 ) ;
loadscanEntity . setMsg ( "司机整托装车" ) ;
loadscanEntity . setTrayNo ( trayTypeDataVO . getTrayCode ( ) ) ;
reservationLoadscanEntities . add ( loadscanEntity ) ;
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//更新签收表的装车数量
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
//扣减订单的在库数量
orderCodes . add ( parcelListEntity . getOrderCode ( ) ) ;
//修改包件为装车状态
orderPackageCodes . add ( parcelListEntity . getOrderPackageCode ( ) ) ;
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
packageLockIds . add ( loadscanEntity . getPackageId ( ) ) ;
String content = "包件在" + myCurrentWarehouse . getName ( ) + "由" + loadscanEntity . getScanUser ( ) + "扫描托盘:" + loadscanEntity . getTrayNo ( ) + "装车,配送车次号:" + distributionDeliveryListEntity . getTrainNumber ( ) + "预约任务号:" + reservationEntity . getReservationCode ( ) ;
JSONObject trunklinePackageTrackLog = handleLogJSONObject ( myCurrentWarehouse , AuthUtil . getUser ( ) , parcelListEntity . getOrderPackageCode ( ) , content , WorkNodeEnums . DISTRIBUTION_LOADING . getCode ( ) ) ;
aaa . add ( trunklinePackageTrackLog ) ;
orderPackageCodes . add ( loadscanEntity . getOrderPackageCode ( ) ) ;
pushList . add ( parcelListEntity ) ;
}
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "code" , trayTypeDataVO . getTrayCode ( ) ) ;
jsonObject . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
jsonObject . put ( "taskId" , distrilbutionloadingscanDTO . getReservationId ( ) ) ;
jsonObject . put ( "type" , 1 ) ;
jsonObject . put ( "num" , 1 ) ;
jsonObject . put ( "remark" , "装车下架" ) ;
jsonObjects . add ( jsonObject ) ;
distributionLoadscanService . saveBatch ( reservationLoadscanEntities ) ;
//这里则进行整托装车的数据构建
//维护订单的信息
if ( Func . isNotEmpty ( orderCodes ) ) {
String orderCode = orderCodes . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
distributionStockArticleService . maintenanceOrderInfo ( orderCode , myCurrentWarehouse . getId ( ) ) ;
}
if ( Func . isNotEmpty ( orderPackageCodes ) ) {
String orderPackages = orderPackageCodes . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "orderPackageCode" , orderPackages ) ;
map . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
warehouseUpdownTypeClient . downDeliveryPackage ( map ) ;
}
//维护预约的信息
distributionReservationService . maintenanceReservationInfo ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
//维护配送任务信息
distributionDeliveryListService . maintenanceDeliveryInfo ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
} else {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物" ) ;
return Resp . scanFail ( "整托装车失败" , "存在其他客户货物" ) ;
}
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "code" , trayTypeDataVO . getTrayCode ( ) ) ;
jsonObject . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
jsonObject . put ( "taskId" , distrilbutionloadingscanDTO . getReservationId ( ) ) ;
jsonObject . put ( "type" , 1 ) ;
jsonObject . put ( "num" , 1 ) ;
jsonObject . put ( "remark" , "装车下架" ) ;
jsonObjects . add ( jsonObject ) ;
distributionLoadscanService . saveBatch ( reservationLoadscanEntities ) ;
//这里则进行整托装车的数据构建
//维护订单的信息
if ( Func . isNotEmpty ( orderCodes ) ) {
String orderCode = orderCodes . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
distributionStockArticleService . maintenanceOrderInfo ( orderCode , myCurrentWarehouse . getId ( ) ) ;
}
if ( Func . isNotEmpty ( orderPackageCodes ) ) {
String orderPackages = orderPackageCodes . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "orderPackageCode" , orderPackages ) ;
map . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
warehouseUpdownTypeClient . downDeliveryPackage ( map ) ;
}
//维护预约的信息
distributionReservationService . maintenanceReservationInfo ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
//维护配送任务信息
distributionDeliveryListService . maintenanceDeliveryInfo ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
} else {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物" ) ;
return Resp . scanFail ( "整托装车失败" , "存在其他客户货物" ) ;
}
} else {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物" ) ;
return Resp . scanFail ( "整托装车失败" , "存在其他客户货物" ) ;
}
} else {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物" ) ;
return Resp . scanFail ( "整托装车失败" , "存在其他客户货物" ) ;
}
} else {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 101010101010 查询托盘货物失败" ) ;
return Resp . scanFail ( "查询托盘货物失败" , "查询托盘货物失败" ) ;
}
}
if ( CollUtil . isNotEmpty ( pushList ) ) {
for ( DistributionParcelListEntity parcelListEntity : pushList ) {
List < Object > contents = new ArrayList < > ( ) ;
PushData pushData = PushData . builder ( )
. packageCode ( parcelListEntity . getOrderPackageCode ( ) )
. orderCode ( parcelListEntity . getOrderCode ( ) )
. warehouseName ( myCurrentWarehouse . getName ( ) )
. waybillNumber ( parcelListEntity . getWaybillNumber ( ) ) . build ( ) ;
contents . add ( pushData ) ;
NodePushMsg msg = new NodePushMsg ( ) ;
msg . setNode ( WorkNodeEnums . DISTRIBUTION_LOADING ) ;
msg . setBrand ( BrandEnums . getByValue ( parcelListEntity . getBrandName ( ) ) ) ;
msg . setOperator ( AuthUtil . getNickName ( ) ) ;
msg . setOperatorTime ( new Date ( ) ) ;
msg . setContent ( contents ) ;
log . info ( "推送工厂数据:{}" , JSONUtil . toJsonStr ( msg ) ) ;
factoryDataMessageSender . sendNodeDataByBrand ( msg ) ;
}
}
//添加缓存
if ( ! packageLockIds . isEmpty ( ) ) {
List < Long > a = bladeRedis . get ( "warehouseId:" + myCurrentWarehouse . getId ( ) + "trainNumber:" + distributionDeliveryListEntity . getTrainNumber ( ) + "orderPackageCode:" ) ;
if ( Func . isNotEmpty ( a ) ) {
boolean flag = a . stream ( ) . anyMatch ( any - > packageLockIds . contains ( any ) ) ;
if ( flag ) {
//正在操作,请稍后重试
throw new RuntimeException ( "该包件正在被操作,请稍后再试!!!" ) ;
} else {
packageLockIds . addAll ( a ) ;
bladeRedis . setEx ( "warehouseId:" + myCurrentWarehouse . getId ( ) + "trainNumber:" + distributionDeliveryListEntity . getTrainNumber ( ) + "orderPackageCode:" , packageLockIds , 60L ) ;
}
} else {
log . info ( "#########!!!!!!!!!!!!!!!!!--------- 101010101010 查询托盘货物失败" ) ;
return Resp . scanFail ( "查询托盘货物失败" , "查询托盘货物失败" ) ;
}
}
if ( CollUtil . isNotEmpty ( pushList ) ) {
for ( DistributionParcelListEntity parcelListEntity : pushList ) {
List < Object > contents = new ArrayList < > ( ) ;
PushData pushData = PushData . builder ( )
. packageCode ( parcelListEntity . getOrderPackageCode ( ) )
. orderCode ( parcelListEntity . getOrderCode ( ) )
. warehouseName ( myCurrentWarehouse . getName ( ) )
. waybillNumber ( parcelListEntity . getWaybillNumber ( ) ) . build ( ) ;
contents . add ( pushData ) ;
NodePushMsg msg = new NodePushMsg ( ) ;
msg . setNode ( WorkNodeEnums . DISTRIBUTION_LOADING ) ;
msg . setBrand ( BrandEnums . getByValue ( parcelListEntity . getBrandName ( ) ) ) ;
msg . setOperator ( AuthUtil . getNickName ( ) ) ;
msg . setOperatorTime ( new Date ( ) ) ;
msg . setContent ( contents ) ;
log . info ( "推送工厂数据:{}" , JSONUtil . toJsonStr ( msg ) ) ;
factoryDataMessageSender . sendNodeDataByBrand ( msg ) ;
}
}
//添加缓存
if ( ! packageLockIds . isEmpty ( ) ) {
List < Long > a = bladeRedis . get ( "warehouseId:" + myCurrentWarehouse . getId ( ) + "trainNumber:" + distributionDeliveryListEntity . getTrainNumber ( ) + "orderPackageCode:" ) ;
if ( Func . isNotEmpty ( a ) ) {
boolean flag = a . stream ( ) . anyMatch ( any - > packageLockIds . contains ( any ) ) ;
if ( flag ) {
//正在操作,请稍后重试
throw new RuntimeException ( "该包件正在被操作,请稍后再试!!!" ) ;
} else {
bladeRedis . setEx ( "warehouseId:" + myCurrentWarehouse . getId ( ) + "trainNumber:" + distributionDeliveryListEntity . getTrainNumber ( ) + "orderPackageCode:" , packageLockIds , 60L ) ;
packageLockIds . addAll ( a ) ;
bladeRedis . setEx ( "warehouseId:" + myCurrentWarehouse . getId ( ) + "trainNumber:" + distributionDeliveryListEntity . getTrainNumber ( ) + "orderPackageCode:" , packageLockIds , 60L ) ;
}
} else {
bladeRedis . setEx ( "warehouseId:" + myCurrentWarehouse . getId ( ) + "trainNumber:" + distributionDeliveryListEntity . getTrainNumber ( ) + "orderPackageCode:" , packageLockIds , 60L ) ;
}
//备货库位下架
log . info ( "备货库位下架>>>>>>>>>>>>>>>>>>>>>>jsonObjects:{}" , jsonObjects ) ;
warehouseUpdownStockUpAreaClient . downStockUpShelf ( jsonObjects ) ;
//查询已装车件数
// String str = getLoadingMsg(distrilbutionloadingscanDTO);
trunklinePackageTrackLogClient . addPackageTrackLog ( aaa ) ;
Integer carLaodNum = getCarLaodNum ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
return Resp . scanSuccessWithData ( "装车成功" , carLaodNum + "件" , carLaodNum ) ;
} catch ( Exception e ) {
log . error ( "装车扫码错误" , e ) ;
throw new CustomerException ( e . getMessage ( ) ) ;
}
//备货库位下架
log . info ( "备货库位下架>>>>>>>>>>>>>>>>>>>>>>jsonObjects:{}" , jsonObjects ) ;
warehouseUpdownStockUpAreaClient . downStockUpShelf ( jsonObjects ) ;
//查询已装车件数
// String str = getLoadingMsg(distrilbutionloadingscanDTO);
trunklinePackageTrackLogClient . addPackageTrackLog ( aaa ) ;
Integer carLaodNum = getCarLaodNum ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
return Resp . scanSuccessWithData ( "装车成功" , carLaodNum + "件" , carLaodNum ) ;
}
private void extracteOrderPackageStatus ( DistrilbutionloadingscanDTO distrilbutionloadingscanDTO , DistributionParcelListEntity parcelListEntity , BasicdataWarehouseEntity myCurrentWarehouse , DistributionReservationEntity reservationEntity ) {
@ -5507,25 +5468,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
orderPackageCodes . add ( loadscanEntity . getOrderPackageCode ( ) ) ;
String content = "包件在" + myCurrentWarehouse . getName ( ) + "由" + loadscanEntity . getScanUser ( ) + "扫描异常装车,配送车次号:" + deliveryListEntity . getTrainNumber ( ) + "预约任务号:" + reservationEntity . getReservationCode ( ) ;
JSONObject trunklinePackageTrackLog = new JSONObject ( ) ;
try {
trunklinePackageTrackLog . put ( "tenantId" , loadscanEntity . getTenantId ( ) ) ;
trunklinePackageTrackLog . put ( "createTime" , loadscanEntity . getCreateTime ( ) ) ;
trunklinePackageTrackLog . put ( "createUser" , loadscanEntity . getCreateUser ( ) ) ;
trunklinePackageTrackLog . put ( "updateUser" , loadscanEntity . getUpdateUser ( ) ) ;
trunklinePackageTrackLog . put ( "updateTime" , loadscanEntity . getUpdateTime ( ) ) ;
trunklinePackageTrackLog . put ( "isDeleted" , loadscanEntity . getIsDeleted ( ) ) ;
trunklinePackageTrackLog . put ( "status" , loadscanEntity . getStatus ( ) ) ;
trunklinePackageTrackLog . put ( "createDept" , loadscanEntity . getCreateDept ( ) ) ;
trunklinePackageTrackLog . put ( "orderPackageCode" , loadscanEntity . getOrderPackageCode ( ) ) ;
trunklinePackageTrackLog . put ( "warehouseId" , myCurrentWarehouse . getId ( ) ) ;
trunklinePackageTrackLog . put ( "warehouseName" , myCurrentWarehouse . getName ( ) ) ;
trunklinePackageTrackLog . put ( "workNode" , WorkNodeEnums . DISTRIBUTION_ABNORMAL_LOADING . getCode ( ) ) ;
trunklinePackageTrackLog . put ( "content" , content ) ;
trunklinePackageTrackLog . put ( "operator" , loadscanEntity . getScanUser ( ) ) ;
} catch ( Exception e ) {
log . info ( "异常装车日志数据错误>>>>>>>>>>>>>>>>>>>data:{}" , trunklinePackageTrackLog ) ;
}
JSONObject trunklinePackageTrackLog = handleLogJSONObject ( myCurrentWarehouse , AuthUtil . getUser ( ) , parcelListEntity . getOrderPackageCode ( ) , content , WorkNodeEnums . DISTRIBUTION_ABNORMAL_LOADING . getCode ( ) ) ;
aaa . add ( trunklinePackageTrackLog ) ;
orderPackageCodes . add ( loadscanEntity . getOrderPackageCode ( ) ) ;
@ -7387,4 +7330,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
this . updateById ( deliveryListEntity ) ;
}
private JSONObject handleLogJSONObject ( BasicdataWarehouseEntity warehouse , BladeUser user , String orderPackageCode , String content , Integer node ) {
JSONObject trunklinePackageTrackLog = new JSONObject ( ) ;
trunklinePackageTrackLog . put ( "tenantId" , user . getTenantId ( ) ) ;
trunklinePackageTrackLog . put ( "createTime" , new Date ( ) ) ;
trunklinePackageTrackLog . put ( "createUser" , user . getUserId ( ) ) ;
trunklinePackageTrackLog . put ( "updateUser" , user . getUserId ( ) ) ;
trunklinePackageTrackLog . put ( "updateTime" , new Date ( ) ) ;
trunklinePackageTrackLog . put ( "isDeleted" , 0 ) ;
trunklinePackageTrackLog . put ( "status" , 1 ) ;
trunklinePackageTrackLog . put ( "createDept" , warehouse . getDepartment ( ) ) ;
trunklinePackageTrackLog . put ( "orderPackageCode" , orderPackageCode ) ;
trunklinePackageTrackLog . put ( "warehouseId" , warehouse . getId ( ) ) ;
trunklinePackageTrackLog . put ( "warehouseName" , warehouse . getName ( ) ) ;
trunklinePackageTrackLog . put ( "workNode" , node ) ;
trunklinePackageTrackLog . put ( "content" , content ) ;
trunklinePackageTrackLog . put ( "operator" , user . getNickName ( ) ) ;
return trunklinePackageTrackLog ;
}
}