@ -127,6 +127,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
private final IAftersalesWorkOrderClient aftersalesWorkOrderClient ;
private final ITrunklineWaybillTrackService waybillTrackService ;
private final ITrunklineScanZeroDetailService scanZeroDetailService ;
private final ITrunklineCarsLoadLinePhotoService carsLoadLinePhotoService ;
@Override
public IPage < TrunklineCarsLoadVO > loadCarsPageList ( LoadCarsDTO loadCarsDTO ) {
@ -239,6 +240,20 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log . warn ( "#############startCarByLoadId: 未有权限进行该操作 nowWarehouseId={} warehouseId={}" , nowWarehouseId , warehouseId ) ;
throw new CustomerException ( 400 , "未有权限进行该操作" ) ;
}
//查询当前登录人仓库的节点
TrunklineCarsLoadLineEntity currentCarsLoadLineEntity = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , warehouseId ) ;
if ( Objects . isNull ( currentCarsLoadLineEntity ) ) {
log . warn ( "#############startCarByLoadId: 配载计划节点信息不存在 nowWarehouseId={} warehouseId={}" , nowWarehouseId , warehouseId ) ;
throw new CustomerException ( 400 , "配载计划节点信息不存在" ) ;
}
//限制发车之前上传图片
// Integer isStartPhoto = currentCarsLoadLineEntity.getIsStartPhoto();
// if(NumberUtil.equals(isStartPhoto, 0)){
// log.warn("#############startCarByLoadId: 节点还未上传发车前图片 nowWarehouseId={} warehouseId={}", nowWarehouseId, warehouseId);
// throw new CustomerException(400, "节点还未上传发车前图片");
// }
if ( StringUtil . isNotBlank ( fullLoadRate ) ) {
carsLoadEntity . setFullLoadRate ( new BigDecimal ( fullLoadRate ) ) ;
}
@ -304,11 +319,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
// throw new CustomerException(405,"终点仓数据不存在");
// }
//查询当前登录人仓库的节点
TrunklineCarsLoadLineEntity currentCarsLoadLineEntity = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , warehouseId ) ;
if ( Objects . isNull ( currentCarsLoadLineEntity ) ) {
log . warn ( "#############startCarByLoadId: 未有权限进行该操作 loadId={} nodeId={}" , loadId , warehouseId ) ;
throw new CustomerException ( 405 , "未有权限进行该操作" ) ;
}
// TrunklineCarsLoadLineEntity currentCarsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId);
// if (Objects.isNull(currentCarsLoadLineEntity)) {
// log.warn( "#############startCarByLoadId: 未有权限进行该操作 loadId={} nodeId={}", loadId, warehouseId);
// throw new CustomerException(405, "未有权限进行该操作");
// }
// if(endCarsLoadLineEntity.getId().equals(currentCarsLoadLineEntity.getId())){
// log.warn("#############startCarByLoadId: 终点仓不能发车 loadId={}",loadId);
// throw new CustomerException(405,"终点仓不能发车");
@ -1805,11 +1820,586 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Integer loadingNum = custmoerUnloadNumVO . getLoadingNum ( ) ;
Integer unloadNum = custmoerUnloadNumVO . getUnloadNum ( ) ;
Map < String , Object > map = new HashMap < > ( ) ;
if ( NumberUtil . equals ( loadingNum , unloadNum ) ) {
return R . status ( true ) ;
map . put ( "status" , 1 ) ;
return R . data ( map ) ;
} else {
return R . status ( false ) ;
map . put ( "status" , 0 ) ;
return R . data ( map ) ;
}
}
@Override
public R uploadLoadingPhoto ( LoadCarsDTO loadCarsDTO ) {
Long loadId = loadCarsDTO . getLoadId ( ) ;
Long warehouseId = loadCarsDTO . getWarehouseId ( ) ;
TrunklineCarsLoadLineEntity carsLoadLine = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , warehouseId ) ;
if ( Objects . isNull ( carsLoadLine ) ) {
log . warn ( "###############uploadLoadingPhoto: 节点信息不存在 loadId={} warehouseId={}" , loadId , warehouseId ) ;
return R . fail ( 405 , "节点信息不存在" ) ;
}
String nodeStatus = carsLoadLine . getNodeStatus ( ) ;
Long carsLoadLineId = carsLoadLine . getId ( ) ;
if ( "0" . equals ( nodeStatus ) ) {
log . warn ( "###############uploadLoadingPhoto: 车辆还未到达当前节点 loadId={} warehouseId={} nodeStatus={}" , loadId , warehouseId , nodeStatus ) ;
return R . fail ( 405 , "车辆还未到达当前节点" ) ;
}
if ( "20" . equals ( nodeStatus ) ) {
log . warn ( "###############uploadLoadingPhoto: 当前节点已发车 loadId={} warehouseId={} nodeStatus={}" , loadId , warehouseId , nodeStatus ) ;
return R . fail ( 405 , "当前节点已发车" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > addUrlList = loadCarsDTO . getAddUrlList ( ) ;
List < Long > removeUrlList = loadCarsDTO . getRemoveUrlList ( ) ;
if ( CollUtil . isNotEmpty ( removeUrlList ) ) {
carsLoadLinePhotoService . deleteLogic ( removeUrlList ) ;
}
if ( CollUtil . isNotEmpty ( addUrlList ) ) {
//批量新增
addUrlList . forEach ( carsLoadLinePhoto - > {
carsLoadLinePhoto . setLoadId ( loadId ) ;
carsLoadLinePhoto . setWarehouseId ( warehouseId ) ;
carsLoadLinePhoto . setLoadLineId ( carsLoadLineId ) ;
} ) ;
carsLoadLinePhotoService . saveBatch ( addUrlList ) ;
}
Integer num = carsLoadLinePhotoService . findNumByLoadIdAndNodeIdAndTypeAndPosition ( loadId , carsLoadLineId , 10 , 2 ) ;
TrunklineCarsLoadLineEntity updateEntity = new TrunklineCarsLoadLineEntity ( ) ;
updateEntity . setId ( carsLoadLineId ) ;
if ( NumberUtil . equals ( 0 , num ) ) {
updateEntity . setIsLoadingPhoto ( 0 ) ;
} else {
updateEntity . setIsLoadingPhoto ( 1 ) ;
}
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
@Override
public R findLoadingPhoto ( LoadCarsDTO loadCarsDTO ) {
Long loadId = loadCarsDTO . getLoadId ( ) ;
Long warehouseId = loadCarsDTO . getWarehouseId ( ) ;
Map < String , Object > map = new HashMap < > ( ) ;
List < TrunklineCarsLoadLinePhotoEntity > ls = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 10 , 2 ) ;
//把qualityList通过position进行分组
// List<TrunklineCarsLoadLinePhotoEntity> listQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> listHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> listZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> listYou = new ArrayList<>();
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> listMap = ls.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// listMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> trunklineCarsLoadLinePhotoEntities = listMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// listQian.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(2,key)){//后
// listHou.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(3,key)){
// listZuo.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(4,key)){
// listYou.addAll(trunklineCarsLoadLinePhotoEntities);
// }
// });
//
// map.put("listQian",listQian);
// map.put("listHou",listHou);
// map.put("listZuo",listZuo);
// map.put("listYou",listYou);
// Map<String,Object> loadingObject = new HashMap<>();
// loadingObject.put("loadingList",ls);
return R . data ( ls ) ;
}
@Override
public R uploadStartPhoto ( LoadCarsDTO loadCarsDTO ) {
Long loadId = loadCarsDTO . getLoadId ( ) ;
Long warehouseId = loadCarsDTO . getWarehouseId ( ) ;
TrunklineCarsLoadLineEntity carsLoadLine = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , warehouseId ) ;
if ( Objects . isNull ( carsLoadLine ) ) {
log . warn ( "###############uploadStartPhoto: 节点信息不存在 loadId={} warehouseId={}" , loadId , warehouseId ) ;
return R . fail ( 405 , "节点信息不存在" ) ;
}
String nodeStatus = carsLoadLine . getNodeStatus ( ) ;
Long carsLoadLineId = carsLoadLine . getId ( ) ;
if ( "0" . equals ( nodeStatus ) ) {
log . warn ( "###############uploadStartPhoto: 车辆还未到达当前节点 loadId={} warehouseId={} nodeStatus={}" , loadId , warehouseId , nodeStatus ) ;
return R . fail ( 405 , "节点信息不存在" ) ;
}
if ( "20" . equals ( nodeStatus ) ) {
log . warn ( "###############uploadStartPhoto: 当前节点已发车 loadId={} warehouseId={} nodeStatus={}" , loadId , warehouseId , nodeStatus ) ;
return R . fail ( 405 , "当前节点已发车" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > addUrlList = loadCarsDTO . getAddUrlList ( ) ;
List < Long > removeUrlList = loadCarsDTO . getRemoveUrlList ( ) ;
if ( CollUtil . isNotEmpty ( removeUrlList ) ) {
carsLoadLinePhotoService . deleteLogic ( removeUrlList ) ;
}
if ( CollUtil . isNotEmpty ( addUrlList ) ) {
//批量新增
addUrlList . forEach ( carsLoadLinePhoto - > {
carsLoadLinePhoto . setLoadId ( loadId ) ;
carsLoadLinePhoto . setWarehouseId ( warehouseId ) ;
carsLoadLinePhoto . setLoadLineId ( carsLoadLineId ) ;
} ) ;
carsLoadLinePhotoService . saveBatch ( addUrlList ) ;
}
TrunklineCarsLoadLineEntity updateEntity = new TrunklineCarsLoadLineEntity ( ) ;
updateEntity . setId ( carsLoadLineId ) ;
List < TrunklineCarsLoadLinePhotoEntity > qualityList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 20 , null ) ;
//把qualityList通过position=2进行过滤生成新的list
List < TrunklineCarsLoadLinePhotoEntity > qualityListHou = qualityList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 2 ) ) . collect ( Collectors . toList ( ) ) ;
if ( qualityListHou . size ( ) = = 0 ) {
updateEntity . setIsStartPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > qualityListZuo = qualityList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 3 ) ) . collect ( Collectors . toList ( ) ) ;
if ( qualityListZuo . size ( ) = = 0 ) {
updateEntity . setIsStartPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > qualityListYou = qualityList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 4 ) ) . collect ( Collectors . toList ( ) ) ;
if ( qualityListYou . size ( ) = = 0 ) {
updateEntity . setIsStartPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > yubuList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 21 , null ) ;
//把qualityList通过position=2进行过滤生成新的list
List < TrunklineCarsLoadLinePhotoEntity > yubuListHou = yubuList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 2 ) ) . collect ( Collectors . toList ( ) ) ;
if ( yubuListHou . size ( ) = = 0 ) {
updateEntity . setIsStartPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > yubuListZuo = yubuList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 3 ) ) . collect ( Collectors . toList ( ) ) ;
if ( yubuListZuo . size ( ) = = 0 ) {
updateEntity . setIsStartPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > yubuListYou = yubuList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 4 ) ) . collect ( Collectors . toList ( ) ) ;
if ( yubuListYou . size ( ) = = 0 ) {
updateEntity . setIsStartPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
updateEntity . setIsStartPhoto ( 1 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
@Override
public R findStartPhoto ( LoadCarsDTO loadCarsDTO ) {
Long loadId = loadCarsDTO . getLoadId ( ) ;
Long warehouseId = loadCarsDTO . getWarehouseId ( ) ;
// Map<String,Object> qualityMap = new HashMap<>();
List < TrunklineCarsLoadLinePhotoEntity > ls = new ArrayList < > ( ) ;
List < TrunklineCarsLoadLinePhotoEntity > qualityList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 20 , null ) ;
//把qualityList通过position进行分组
// List<TrunklineCarsLoadLinePhotoEntity> qualityListQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListYou = new ArrayList<>();
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> qualityListMap = qualityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// qualityListMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> trunklineCarsLoadLinePhotoEntities = qualityListMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// qualityListQian.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(2,key)){//后
// qualityListHou.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(3,key)){
// qualityListZuo.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(4,key)){
// qualityListYou.addAll(trunklineCarsLoadLinePhotoEntities);
// }
// });
//
// qualityMap.put("qualityListQian",qualityListQian);
// qualityMap.put("qualityListHou",qualityListHou);
// qualityMap.put("qualityListZuo",qualityListZuo);
// qualityMap.put("qualityListYou",qualityListYou);
// Map<String,Object> yubuMap = new HashMap<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListYou = new ArrayList<>();
List < TrunklineCarsLoadLinePhotoEntity > yubuList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 21 , null ) ;
//把qualityList通过position进行分组
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> yubuListMap = yubuList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// yubuListMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> trunklineCarsLoadLinePhotoEntities = yubuListMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// yubuListQian.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(2,key)){//后
// yubuListHou.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(3,key)){
// yubuListZuo.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(4,key)){
// yubuListYou.addAll(trunklineCarsLoadLinePhotoEntities);
// }
// });
//
// yubuMap.put("yubuListQian",yubuListQian);
// yubuMap.put("yubuListHou",yubuListHou);
// yubuMap.put("yubuListZuo",yubuListZuo);
// yubuMap.put("yubuListYou",yubuListYou);
// Map<String,Object> map = new HashMap<>();
// map.put("qualityList",qualityList);
// map.put("yubuList",yubuList);
ls . addAll ( qualityList ) ;
ls . addAll ( yubuList ) ;
return R . data ( ls ) ;
}
@Override
public R uploadUnloadPhoto ( LoadCarsDTO loadCarsDTO ) {
Long loadId = loadCarsDTO . getLoadId ( ) ;
Long warehouseId = loadCarsDTO . getWarehouseId ( ) ;
TrunklineCarsLoadLineEntity carsLoadLine = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , warehouseId ) ;
if ( Objects . isNull ( carsLoadLine ) ) {
log . warn ( "###############uploadUnloadPhoto: 节点信息不存在 loadId={} warehouseId={}" , loadId , warehouseId ) ;
return R . fail ( 405 , "节点信息不存在" ) ;
}
String nodeStatus = carsLoadLine . getNodeStatus ( ) ;
Long carsLoadLineId = carsLoadLine . getId ( ) ;
if ( "0" . equals ( nodeStatus ) ) {
log . warn ( "###############uploadUnloadPhoto: 车辆还未到达当前节点 loadId={} warehouseId={} nodeStatus={}" , loadId , warehouseId , nodeStatus ) ;
return R . fail ( 405 , "节点信息不存在" ) ;
}
if ( "20" . equals ( nodeStatus ) ) {
log . warn ( "###############uploadUnloadPhoto: 当前节点已发车 loadId={} warehouseId={} nodeStatus={}" , loadId , warehouseId , nodeStatus ) ;
return R . fail ( 405 , "当前节点已发车" ) ;
}
String unloadStatus = carsLoadLine . getUnloadStatus ( ) ;
if ( ! "0" . equals ( unloadStatus ) ) {
log . warn ( "###############uploadUnloadPhoto: 当前节点已卸车确认 loadId={} warehouseId={} unloadStatus={}" , loadId , warehouseId , unloadStatus ) ;
return R . fail ( 405 , "当前节点已卸车确认" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > addUrlList = loadCarsDTO . getAddUrlList ( ) ;
List < Long > removeUrlList = loadCarsDTO . getRemoveUrlList ( ) ;
if ( CollUtil . isNotEmpty ( removeUrlList ) ) {
carsLoadLinePhotoService . deleteLogic ( removeUrlList ) ;
}
if ( CollUtil . isNotEmpty ( addUrlList ) ) {
//批量新增
addUrlList . forEach ( carsLoadLinePhoto - > {
carsLoadLinePhoto . setLoadId ( loadId ) ;
carsLoadLinePhoto . setWarehouseId ( warehouseId ) ;
carsLoadLinePhoto . setLoadLineId ( carsLoadLineId ) ;
} ) ;
carsLoadLinePhotoService . saveBatch ( addUrlList ) ;
}
TrunklineCarsLoadLineEntity updateEntity = new TrunklineCarsLoadLineEntity ( ) ;
updateEntity . setId ( carsLoadLineId ) ;
List < TrunklineCarsLoadLinePhotoEntity > qualityList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 30 , null ) ;
//把qualityList通过position=2进行过滤生成新的list
List < TrunklineCarsLoadLinePhotoEntity > qualityListHou = qualityList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 2 ) ) . collect ( Collectors . toList ( ) ) ;
if ( qualityListHou . size ( ) = = 0 ) {
updateEntity . setIsUnloadPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > qualityListZuo = qualityList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 3 ) ) . collect ( Collectors . toList ( ) ) ;
if ( qualityListZuo . size ( ) = = 0 ) {
updateEntity . setIsUnloadPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > qualityListYou = qualityList . stream ( ) . filter ( item - > item . getPosition ( ) . equals ( 4 ) ) . collect ( Collectors . toList ( ) ) ;
if ( qualityListYou . size ( ) = = 0 ) {
updateEntity . setIsUnloadPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
List < TrunklineCarsLoadLinePhotoEntity > protectionList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 31 , 2 ) ;
if ( protectionList . size ( ) = = 0 ) {
updateEntity . setIsUnloadPhoto ( 0 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
updateEntity . setIsUnloadPhoto ( 1 ) ;
trunklineCarsLoadLineService . updateById ( updateEntity ) ;
return R . success ( "上传成功" ) ;
}
@Override
public R findUnloadPhoto ( LoadCarsDTO loadCarsDTO ) {
Long loadId = loadCarsDTO . getLoadId ( ) ;
Long warehouseId = loadCarsDTO . getWarehouseId ( ) ;
Map < String , Object > qualityMap = new HashMap < > ( ) ;
List < TrunklineCarsLoadLinePhotoEntity > ls = new ArrayList < > ( ) ;
List < TrunklineCarsLoadLinePhotoEntity > qualityList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 30 , null ) ;
//把qualityList通过position进行分组
// List<TrunklineCarsLoadLinePhotoEntity> qualityListQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListYou = new ArrayList<>();
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> qualityListMap = qualityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// qualityListMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> trunklineCarsLoadLinePhotoEntities = qualityListMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// qualityListQian.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(2,key)){//后
// qualityListHou.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(3,key)){
// qualityListZuo.addAll(trunklineCarsLoadLinePhotoEntities);
// }else if(NumberUtil.equals(4,key)){
// qualityListYou.addAll(trunklineCarsLoadLinePhotoEntities);
// }
// });
//
// qualityMap.put("qualityListQian",qualityListQian);
// qualityMap.put("qualityListHou",qualityListHou);
// qualityMap.put("qualityListZuo",qualityListZuo);
// qualityMap.put("qualityListYou",qualityListYou);
//
//
// Map<String,Object> protectionMap = new HashMap<>();
List < TrunklineCarsLoadLinePhotoEntity > protectionList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , warehouseId , 31 , null ) ;
// protectionMap.put("protectionList",protectionList);
// Map<String,Object> map = new HashMap<>();
// map.put("unloadQualityList",qualityList);
// map.put("protectionList",protectionList);
ls . addAll ( qualityList ) ;
ls . addAll ( protectionList ) ;
return R . data ( ls ) ;
}
@Override
public R findLinePhoto ( LoadCarsDTO loadCarsDTO ) {
Long loadId = loadCarsDTO . getLoadId ( ) ;
List < Map < String , Object > > resultList = new ArrayList < > ( ) ;
List < TrunklineCarsLoadLinePhotoEntity > linePhotoEntityList = carsLoadLinePhotoService . findListByLoadIdAndWarehouseId ( loadId , null , null , null ) ;
//把linePhotoEntityList中所有元素的loadLineId放入一个Set集合
Set < Long > loadLineIdSet = linePhotoEntityList . stream ( ) . map ( TrunklineCarsLoadLinePhotoEntity : : getLoadLineId ) . collect ( Collectors . toSet ( ) ) ;
if ( CollUtil . isNotEmpty ( loadLineIdSet ) ) {
QueryWrapper < TrunklineCarsLoadLineEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . in ( "id" , loadLineIdSet ) ;
List < TrunklineCarsLoadLineEntity > carsLoadLineList = trunklineCarsLoadLineService . list ( queryWrapper ) ;
//把carsLoadLineList转化为以id为key的map
Map < Long , TrunklineCarsLoadLineEntity > carsLoadLineMap = carsLoadLineList . stream ( ) . collect ( Collectors . toMap ( TrunklineCarsLoadLineEntity : : getId , Function . identity ( ) ) ) ;
//把linePhotoEntityList中所有元素以loadLineId进行分组
Map < Long , List < TrunklineCarsLoadLinePhotoEntity > > linePhotoMap = linePhotoEntityList . stream ( ) . collect ( Collectors . groupingBy ( TrunklineCarsLoadLinePhotoEntity : : getLoadLineId ) ) ;
linePhotoMap . keySet ( ) . forEach ( loadLineId - > {
Map < String , Object > map = new HashMap < > ( ) ;
List < TrunklineCarsLoadLinePhotoEntity > trunklineCarsLoadLinePhotoEntities = linePhotoMap . get ( loadLineId ) ;
TrunklineCarsLoadLineEntity trunklineCarsLoadLineEntity = carsLoadLineMap . get ( loadLineId ) ;
map . put ( "carsLoadLineEntity" , trunklineCarsLoadLineEntity ) ;
Map < String , Object > loadingMap = new HashMap < > ( ) ;
//把trunklineCarsLoadLinePhotoEntities通过type=10进行过滤
List < TrunklineCarsLoadLinePhotoEntity > ls = trunklineCarsLoadLinePhotoEntities . stream ( ) . filter ( item - > item . getType ( ) . equals ( 10 ) ) . collect ( Collectors . toList ( ) ) ;
//把qualityList通过position进行分组
// List<TrunklineCarsLoadLinePhotoEntity> listQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> listHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> listZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> listYou = new ArrayList<>();
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> listMap = ls.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// listMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> list = listMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// listQian.addAll(list);
// }else if(NumberUtil.equals(2,key)){//后
// listHou.addAll(list);
// }else if(NumberUtil.equals(3,key)){
// listZuo.addAll(list);
// }else if(NumberUtil.equals(4,key)){
// listYou.addAll(list);
// }
// });
//
// loadingMap.put("listQian",listQian);
// loadingMap.put("listHou",listHou);
// loadingMap.put("listZuo",listZuo);
// loadingMap.put("listYou",listYou);
// Map<String,Object> loadingObject = new HashMap<>();
// loadingObject.put("loadingList",ls);
map . put ( "loadingObject" , ls ) ;
//发车
// Map<String,Object> qualityMap = new HashMap<>();
List < TrunklineCarsLoadLinePhotoEntity > qualityList = trunklineCarsLoadLinePhotoEntities . stream ( ) . filter ( item - > item . getType ( ) . equals ( 20 ) ) . collect ( Collectors . toList ( ) ) ;
//把qualityList通过position进行分组
// List<TrunklineCarsLoadLinePhotoEntity> qualityListQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> qualityListYou = new ArrayList<>();
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> qualityListMap = qualityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// qualityListMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> list = qualityListMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// qualityListQian.addAll(list);
// }else if(NumberUtil.equals(2,key)){//后
// qualityListHou.addAll(list);
// }else if(NumberUtil.equals(3,key)){
// qualityListZuo.addAll(list);
// }else if(NumberUtil.equals(4,key)){
// qualityListYou.addAll(list);
// }
// });
//
// qualityMap.put("qualityListQian",qualityListQian);
// qualityMap.put("qualityListHou",qualityListHou);
// qualityMap.put("qualityListZuo",qualityListZuo);
// qualityMap.put("qualityListYou",qualityListYou);
// Map<String,Object> yubuMap = new HashMap<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> yubuListYou = new ArrayList<>();
List < TrunklineCarsLoadLinePhotoEntity > yubuList = trunklineCarsLoadLinePhotoEntities . stream ( ) . filter ( item - > item . getType ( ) . equals ( 21 ) ) . collect ( Collectors . toList ( ) ) ;
//把qualityList通过position进行分组
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> yubuListMap = yubuList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// yubuListMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> list = yubuListMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// yubuListQian.addAll(list);
// }else if(NumberUtil.equals(2,key)){//后
// yubuListHou.addAll(list);
// }else if(NumberUtil.equals(3,key)){
// yubuListZuo.addAll(list);
// }else if(NumberUtil.equals(4,key)){
// yubuListYou.addAll(list);
// }
// });
//
// yubuMap.put("yubuListQian",yubuListQian);
// yubuMap.put("yubuListHou",yubuListHou);
// yubuMap.put("yubuListZuo",yubuListZuo);
// yubuMap.put("yubuListYou",yubuListYou);
// Map<String,Object> startObject = new HashMap<>();
// startObject.put("qualityList",qualityList);
// startObject.put("yubuList",yubuList);
map . put ( "startObject" , qualityList . addAll ( yubuList ) ) ;
//卸车
Map < String , Object > unloadQualityMap = new HashMap < > ( ) ;
List < TrunklineCarsLoadLinePhotoEntity > unloadQualityList = trunklineCarsLoadLinePhotoEntities . stream ( ) . filter ( item - > item . getType ( ) . equals ( 30 ) ) . collect ( Collectors . toList ( ) ) ;
//把qualityList通过position进行分组
// List<TrunklineCarsLoadLinePhotoEntity> unloadQualityListQian = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> unloadQualityListHou = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> unloadQualityListZuo = new ArrayList<>();
// List<TrunklineCarsLoadLinePhotoEntity> unloadQualityListYou = new ArrayList<>();
// Map<Integer, List<TrunklineCarsLoadLinePhotoEntity>> unloadQualityListMap = unloadQualityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getPosition));
// qualityListMap.keySet().forEach(key -> {
// List<TrunklineCarsLoadLinePhotoEntity> list = unloadQualityListMap.get(key);
// if(NumberUtil.equals(1,key)){//后
// unloadQualityListQian.addAll(list);
// }else if(NumberUtil.equals(2,key)){//后
// unloadQualityListHou.addAll(list);
// }else if(NumberUtil.equals(3,key)){
// unloadQualityListZuo.addAll(list);
// }else if(NumberUtil.equals(4,key)){
// unloadQualityListYou.addAll(list);
// }
// });
//
// unloadQualityMap.put("unloadQualityListQian",unloadQualityListQian);
// unloadQualityMap.put("unloadQualityListHou",unloadQualityListHou);
// unloadQualityMap.put("unloadQualityListZuo",unloadQualityListZuo);
// unloadQualityMap.put("unloadQualityListYou",unloadQualityListYou);
// Map<String,Object> protectionMap = new HashMap<>();
List < TrunklineCarsLoadLinePhotoEntity > protectionList = trunklineCarsLoadLinePhotoEntities . stream ( ) . filter ( item - > item . getType ( ) . equals ( 31 ) ) . collect ( Collectors . toList ( ) ) ;
// protectionMap.put("protectionList",protectionList);
// Map<String,Object> unloadObject = new HashMap<>();
// unloadObject.put("unloadQualityList",unloadQualityList);
// unloadObject.put("protectionList",protectionList);
map . put ( "unloadObject" , unloadQualityList . addAll ( protectionList ) ) ;
resultList . add ( map ) ;
} ) ;
}
return R . data ( resultList ) ;
}
@ -2834,6 +3424,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R . fail ( 405 , "节点不是到车状态" ) ;
}
//限制装车之前上传图片
// Integer isLoadingPhoto = carsLoadLineEntity.getIsLoadingPhoto();
// if(NumberUtil.equals(isLoadingPhoto,0)){
// log.warn("##############loadingScan: 当前节点还未上传装车前照片 isLoadingPhoto={}", isLoadingPhoto);
// return R.fail(405, "当前节点还未上传装车前照片");
// }
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( warehouseId ) ;
if ( Objects . isNull ( basicdataWarehouseEntity ) ) {
log . warn ( "##################loadingScan: 仓库信息不存在 warehouseId={}" , warehouseId ) ;
@ -3178,6 +3775,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R . fail ( 405 , "节点不是到车状态" ) ;
}
//限制装车之前上传图片
// Integer isLoadingPhoto = carsLoadLineEntity.getIsLoadingPhoto();
// if(NumberUtil.equals(isLoadingPhoto,0)){
// log.warn("##############loadingZero: 当前节点还未上传装车前照片 isLoadingPhoto={}", isLoadingPhoto);
// return R.fail(405, "当前节点还未上传装车前照片");
// }
Long trayId = null ;
String trayName = null ;
if ( ! StringUtil . isBlank ( trayCode ) ) {
@ -6356,6 +6960,19 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R . fail ( 405 , "车辆不在当前仓" ) ;
}
TrunklineCarsLoadLineEntity loadLineEntity = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , warehouseId ) ;
if ( Objects . isNull ( loadLineEntity ) ) {
log . warn ( "##############manualLoading: 配载计划节点信息不存在 loadId={} warehouseId={}" , loadId , warehouseId ) ;
return R . fail ( 405 , "配载计划节点信息不存在" ) ;
}
//限制装车之前上传图片
// Integer isLoadingPhoto = loadLineEntity.getIsLoadingPhoto();
// if(NumberUtil.equals(isLoadingPhoto,0)){
// log.warn("##############manualLoading: 当前节点还未上传装车前照片 isLoadingPhoto={}", isLoadingPhoto);
// return R.fail(405, "当前节点还未上传装车前照片");
// }
String tenantId = AuthUtil . getTenantId ( ) ;
Long userId = AuthUtil . getUserId ( ) ;
Long deptId = Func . firstLong ( AuthUtil . getDeptId ( ) ) ;
@ -7425,6 +8042,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R . fail ( 405 , "节点不是到车状态" ) ;
}
//限制装车之前上传图片
// Integer isLoadingPhoto = carsLoadLineEntity.getIsLoadingPhoto();
// if(NumberUtil.equals(isLoadingPhoto,0)){
// log.warn("##############loadingTray: 当前节点还未上传装车前照片 isLoadingPhoto={}", isLoadingPhoto);
// return R.fail(405, "当前节点还未上传装车前照片");
// }
Integer pacakagNum = 0 ;
Integer zeroNum = 0 ;
for ( LoadingPackageDTO loadingPackageDTO : packageList ) {