@ -594,20 +594,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log . warn ( "#############cancelStartCarByLoadId: 配载计划不存在 loadId={}" , loadId ) ;
throw new CustomerException ( 400 , "配载计划不存在" ) ;
}
String loadStatus = carsLoadEntity . getLoadStatus ( ) ;
if ( ! "10" . equals ( loadStatus ) & & ! "30" . equals ( loadStatus ) ) {
log . warn ( "#############cancelStartCarByLoadId: 配载计划暂未发车 loadId={} loadStatus={}" , loadId , loadStatus ) ;
throw new CustomerException ( 400 , "配载计划暂未发车" ) ;
}
Long nowWarehouseId = carsLoadEntity . getNowWarehouseId ( ) ;
if ( ! nowWarehouseId . equals ( warehouseId ) ) {
log . warn ( "#############cancelStartCarByLoadId: 未有权限进行该操作 nowWarehouseId={} warehouseId={}" , nowWarehouseId , warehouseId ) ;
throw new CustomerException ( 400 , "未有权限进行该操作 " ) ;
log . warn ( "#############cancelStartCarByLoadId: 车辆不在当前节点 nowWarehouseId={} warehouseId={}" , nowWarehouseId , warehouseId ) ;
throw new CustomerException ( 400 , "车辆不在当前节点" ) ;
}
//查询当前节点信息
TrunklineCarsLoadLineEntity currentCarsLoadLineEntity = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , nowWarehouseId ) ;
if ( Objects . isNull ( currentCarsLoadLineEntity ) ) {
@ -622,6 +614,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
Integer sort = currentCarsLoadLineEntity . getSort ( ) ;
String loadStatus = carsLoadEntity . getLoadStatus ( ) ;
if ( ! "10" . equals ( loadStatus ) & & ! "30" . equals ( loadStatus ) ) {
log . warn ( "#############cancelStartCarByLoadId: 配载计划暂未发车 loadId={} loadStatus={}" , loadId , loadStatus ) ;
throw new CustomerException ( 400 , "配载计划暂未发车" ) ;
}
//查询下一节点
TrunklineCarsLoadLineEntity nextCarsLoadLineEntity = trunklineCarsLoadLineService . findEntityByLoadIdAndSort ( loadId , sort + 1 ) ;
if ( Objects . isNull ( nextCarsLoadLineEntity ) ) {
@ -897,6 +895,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
@Transactional ( rollbackFor = Exception . class )
@Override
public void unloadByLoadId ( LoadCarsDTO loadCarsDTO ) {
log . info ( "############unloadByLoadId: 卸车确认" ) ;
@ -1014,6 +1013,115 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
throw new CustomerException ( 400 , "未知的卸车确认类型" ) ;
}
QueryWrapper < TrunklineCarsLoadScanEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "load_id" , loadId )
. eq ( "unload_node_id" , warehouseId )
. eq ( "type" , 2 )
. ne ( "scan_status" , "1" ) ;
List < TrunklineCarsLoadScanEntity > carsLoadScanEntityList = trunklineCarsLoadScanService . list ( queryWrapper ) ;
if ( CollUtil . isNotEmpty ( carsLoadScanEntityList ) ) {
//把carsLoadScanEntityList通过orderCode进行分组
Map < String , List < TrunklineCarsLoadScanEntity > > orderCodemap = carsLoadScanEntityList . stream ( ) . collect ( Collectors . groupingBy ( TrunklineCarsLoadScanEntity : : getOrderCode ) ) ;
orderCodemap . keySet ( ) . forEach ( orderCode - > {
List < TrunklineCarsLoadScanEntity > orderCodeList = orderCodemap . get ( orderCode ) ;
//把orderCodeList通过fromWarehouseId进行分组
Map < Long , List < TrunklineCarsLoadScanEntity > > fromWarehouseIdmap = orderCodeList . stream ( ) . collect ( Collectors . groupingBy ( TrunklineCarsLoadScanEntity : : getFromWarehouseId ) ) ;
fromWarehouseIdmap . keySet ( ) . forEach ( fromWarehouseId - > {
TrunklineCarsOrderEntity trunklineCarsOrderEntity = trunklineCarsOrderService . findEntityByLoadIdAndWarehouseIdAndOrderCodeAndWaybillNo ( loadId , fromWarehouseId , orderCode , orderCode ) ;
if ( ! Objects . isNull ( trunklineCarsOrderEntity ) ) {
Integer realNum = trunklineCarsOrderEntity . getRealNum ( ) ;
List < TrunklineCarsLoadScanEntity > fromWarehouseIdList = fromWarehouseIdmap . get ( fromWarehouseId ) ;
//把fromWarehouseIdList中所有元素的unloadNum累加
int unloadNum = fromWarehouseIdList . stream ( ) . mapToInt ( TrunklineCarsLoadScanEntity : : getUnloadNum ) . sum ( ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findZeroByOrderCodeAndWarehouseId ( orderCode , fromWarehouseId ) ;
if ( ! Objects . isNull ( stockArticleEntity ) ) {
Integer handQuantity = stockArticleEntity . getHandQuantity ( ) ;
if ( unloadNum > realNum ) {
//卸车数大于实际装车数
throw new CustomerException ( 405 , "零担订单" + orderCode + "卸车件数已大于实际装车件数,请去调整补录" ) ;
} else {
if ( unloadNum < realNum ) {
distributionStockArticleClient . addHandQuantity ( stockArticleEntity . getId ( ) , realNum - unloadNum ) ;
}
DistributionStockArticleEntity newStockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , warehouseId ) ;
if ( Objects . isNull ( newStockArticleEntity ) ) {
newStockArticleEntity = new DistributionStockArticleEntity ( ) ;
BeanUtil . copy ( stockArticleEntity , newStockArticleEntity ) ;
newStockArticleEntity . setId ( null ) ;
newStockArticleEntity . setOrderReceiveStatus ( "20" ) ;
newStockArticleEntity . setOrderStatus ( "10" ) ;
newStockArticleEntity . setHandQuantity ( unloadNum ) ;
newStockArticleEntity . setIncomingNum ( unloadNum ) ;
newStockArticleEntity . setWarehouse ( warehouseEntity . getName ( ) ) ;
newStockArticleEntity . setWarehouseId ( warehouseEntity . getId ( ) ) ;
newStockArticleEntity . setCarsLoadNum ( 0 ) ;
Long orderId = distributionStockArticleClient . addData ( newStockArticleEntity ) ;
if ( orderId ! = 0 ) {
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListClient . findEntityListByOrderCode ( orderCode , fromWarehouseId ) ;
List < DistributionParcelNumberEntity > ls = new ArrayList < > ( ) ;
for ( DistributionParcelListEntity parcelListEntity : parcelListEntityList ) {
DistributionParcelListEntity newParcelListEntity = new DistributionParcelListEntity ( ) ;
BeanUtil . copy ( parcelListEntity , newParcelListEntity ) ;
newParcelListEntity . setId ( null ) ;
newParcelListEntity . setWarehouseId ( warehouseId ) ;
newParcelListEntity . setWarehouse ( warehouseEntity . getName ( ) ) ;
newParcelListEntity . setStockArticleId ( orderId ) ;
Long acceptWarehouseId = parcelListEntity . getAcceptWarehouseId ( ) ;
if ( warehouseId . equals ( acceptWarehouseId ) ) {
newParcelListEntity . setIsTransfer ( 0 ) ;
} else {
newParcelListEntity . setIsTransfer ( 1 ) ;
}
Long orderPackageId = distributionParcelListClient . addReturnId ( newParcelListEntity ) ;
DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity ( ) ;
parcelNumberEntity . setStockArticleId ( orderId ) ;
parcelNumberEntity . setParcelListId ( orderPackageId ) ;
parcelNumberEntity . setQuantity ( newParcelListEntity . getQuantity ( ) ) ;
parcelNumberEntity . setHandQuantity ( 0 ) ;
parcelNumberEntity . setDeliveryQuantity ( 0 ) ;
parcelNumberEntity . setSigninQuantity ( 0 ) ;
parcelNumberEntity . setOutboundQuantity ( 0 ) ;
parcelNumberEntity . setWarehouseId ( warehouseId ) ;
ls . add ( parcelNumberEntity ) ;
}
distributionParcelNumberClient . addBatch ( ls ) ;
}
} else {
Integer hQuantity = newStockArticleEntity . getHandQuantity ( ) + unloadNum ;
Integer incomingNum = newStockArticleEntity . getIncomingNum ( ) + unloadNum ;
Integer totalNumber = newStockArticleEntity . getTotalNumber ( ) ;
if ( incomingNum . equals ( totalNumber ) ) {
if ( hQuantity . equals ( totalNumber ) ) {
newStockArticleEntity . setOrderStatus ( "20" ) ;
} else {
newStockArticleEntity . setOrderStatus ( "30" ) ;
}
newStockArticleEntity . setOrderReceiveStatus ( "30" ) ;
} else {
if ( incomingNum . equals ( hQuantity ) ) {
newStockArticleEntity . setOrderStatus ( "10" ) ;
} else {
newStockArticleEntity . setOrderStatus ( "30" ) ;
}
newStockArticleEntity . setOrderReceiveStatus ( "20" ) ;
}
newStockArticleEntity . setHandQuantity ( hQuantity ) ;
newStockArticleEntity . setIncomingNum ( incomingNum ) ;
distributionStockArticleClient . saveOrUpdate ( newStockArticleEntity ) ;
}
}
}
}
} ) ;
} ) ;
}
//无装车记录异常日志记录
try {
// carsLoadAsyncService.
@ -1842,6 +1950,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadLineEntity . setStartUserName ( AuthUtil . getUserName ( ) ) ;
trunklineCarsLoadLineService . updateById ( carsLoadLineEntity ) ;
//三方中转发车把异常的数据计划目的仓设置成当前仓
trunklineCarsLoadScanService . updateFinalNodeIdAndFinalNodeNameByLoadIdNoData ( loadId , warehouseId , warehouseEntity . getName ( ) ) ;
carsLoadEntity . setLoadStatus ( "10" ) ;
carsLoadEntity . setStartTime ( date ) ;
updateById ( carsLoadEntity ) ;
@ -2023,6 +2134,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
throw new CustomerException ( 400 , "暂未有权限进行操作" ) ;
}
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( loadId , warehouseId ) ;
if ( Objects . isNull ( carsLoadLineEntity ) ) {
log . warn ( "#############signCars: 三方中转节点不存在 loadId={} carsLoadLineEntity={}" , loadId , carsLoadLineEntity ) ;
throw new CustomerException ( 400 , "三方中转节点不存在" ) ;
}
carsLoadEntity . setSignTime ( new Date ( ) ) ;
carsLoadEntity . setLoadStatus ( "90" ) ;
updateById ( carsLoadEntity ) ;
@ -2030,7 +2147,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
trunklineCarsLoadScanService . updateScanStatusByLoadId ( loadId , "3" , new Date ( ) ) ;
try {
trunklineCarsLoadLogService . saveLog ( carsLoadEntity , null , CarsLoadLogTypeConstant . TRIPARTITE_TRANSFER_SIGN . getValue ( ) ) ;
trunklineCarsLoadLogService . saveLog ( carsLoadEntity , carsLoadLineEntity , CarsLoadLogTypeConstant . TRIPARTITE_TRANSFER_SIGN . getValue ( ) ) ;
List < String > orderPackageCodes = trunklineCarsLoadScanService . findSignListOrderPackageCodes ( loadId ) ;
@ -2954,6 +3071,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadWaybillInfoVO . setWaybillNo ( waybillNo ) ;
if ( ! "--" . equals ( waybillNo ) ) {
if ( ! Objects . isNull ( warehouseWaybillEntity ) ) {
Integer totalCount = warehouseWaybillEntity . getTotalCount ( ) ;
carsLoadWaybillInfoVO . setCreateTime ( warehouseWaybillEntity . getCreateTime ( ) ) ;
carsLoadWaybillInfoVO . setDestination ( warehouseWaybillEntity . getDestination ( ) ) ;
carsLoadWaybillInfoVO . setDestinationWarehouseName ( warehouseWaybillEntity . getDestinationWarehouseName ( ) ) ;
@ -2961,7 +3079,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadWaybillInfoVO . setShipperName ( warehouseWaybillEntity . getShipperName ( ) ) ;
carsLoadWaybillInfoVO . setConsignee ( warehouseWaybillEntity . getConsignee ( ) ) ;
carsLoadWaybillInfoVO . setConsigneeName ( warehouseWaybillEntity . getConsigneeName ( ) ) ;
carsLoadWaybillInfoVO . setWaybillNum ( warehouseWaybillEn tity . getT otalCount( ) ) ;
carsLoadWaybillInfoVO . setWaybillNum ( totalCount ) ;
carsLoadWaybillInfoVO . setWaybillType ( warehouseWaybillEntity . getWaybillType ( ) ) ;
carsLoadWaybillInfoVO . setWaybillId ( warehouseWaybillEntity . getId ( ) ) ;
carsLoadWaybillInfoVO . setRemark ( warehouseWaybillEntity . getRemark ( ) ) ;
@ -2981,6 +3099,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadWaybillInfoVO . setHandlingFee ( handlingFee ) ;
carsLoadWaybillInfoVO . setOtherFee ( otherFee ) ;
carsLoadWaybillInfoVO . setInsuranceFee ( insuranceFee ) ;
carsLoadWaybillInfoVO . setOpenPrice ( totalFreight . divide ( new BigDecimal ( totalCount ) , 2 , RoundingMode . HALF_UP ) . toPlainString ( ) ) ;
carsLoadWaybillInfoVO . setTotalFee ( totalFreight . add ( deliveryFee ) . add ( pickupFee ) . add ( warehouseManagementFee ) . add ( storageFee ) . add ( handlingFee ) . add ( otherFee ) . add ( insuranceFee ) ) ;
TrunklineCostShareRecordEntity costShareRecordEntity = trunklineCostShareRecordService . findTotalUnloadNumByLoadAndWaybillNo ( loadId , waybillNo ) ;
carsLoadWaybillInfoVO . setCostPiece ( costShareRecordEntity . getCostPiece ( ) ) ;
@ -2998,16 +3117,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadOrderInfoVO . setLoadingNum ( carsLoadScanAbnormalVO . getLoadingNum ( ) ) ;
carsLoadOrderInfoVO . setUnloadNum ( carsLoadScanAbnormalVO . getUnloadNum ( ) ) ;
BigDecimal unloadIncome = finalFreightPrice . multiply ( BigDecimal . valueOf ( carsLoadScanAbnormalVO . getUnloadNum ( ) ) ) ;
carsLoadOrderInfoVO . setUnloadIncome ( unloadIncome . setScale ( 2 ) ) ;
carsLoadOrderInfoVO . setUnloadIncome ( unloadIncome . setScale ( 2 , BigDecimal . ROUND_UP ) ) ;
carsLoadOrderInfoVO . setPlanNum ( 0 ) ;
String orderCode = carsLoadScanAbnormalVO . getOrderCode ( ) ;
if ( "--" . equals ( waybillNo ) | | "--" . equals ( orderCode ) ) {
carsLoadOrderInfoVO . setOrderNum ( 0 ) ;
carsLoadOrderInfoVO . setOrderFreight ( BigDecimal . ZERO . setScale ( 2 ) ) ;
carsLoadOrderInfoVO . setOrderFreight ( BigDecimal . ZERO . setScale ( 2 , BigDecimal . ROUND_UP ) ) ;
} else {
Integer num = trunklineWaybillOrderService . findTotalNumByWaybillAndOrderCode ( waybillNo , orderCode ) ;
carsLoadOrderInfoVO . setOrderNum ( num ) ;
carsLoadOrderInfoVO . setOrderFreight ( finalFreightPrice . multiply ( BigDecimal . valueOf ( num ) ) . setScale ( 2 ) ) ;
carsLoadOrderInfoVO . setOrderFreight ( finalFreightPrice . multiply ( new BigDecimal ( num ) ) . setScale ( 2 , BigDecimal . ROUND_UP ) ) ;
}
TrunklineCostShareRecordEntity orderCostShareRecordEntity = trunklineCostShareRecordService . findTotalUnloadNumByLoadAndWaybillNoAndOrderCode ( loadId , waybillNo , orderCode ) ;
carsLoadOrderInfoVO . setCostZhang ( orderCostShareRecordEntity . getCostZhang ( ) ) ;
@ -3501,7 +3620,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
updateNumByLoadId ( loadId ) ;
return R . success ( "卸车成功" ) ;
JSONObject jsonObject = trunklineCarsLoadScanService . findUnloadNumAudio ( loadId , warehouseId ) ;
Integer totalUnloadNum = jsonObject . getInteger ( "totalUnloadNum" ) ;
Integer abnormalUnloadNum = jsonObject . getInteger ( "abnormalUnloadNum" ) ;
return Resp . scanSuccess ( "卸车成功" , "卸车" + totalUnloadNum + "件,异常卸车" + abnormalUnloadNum + "件" ) ;
}
@Override
@ -4243,6 +4366,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity . setLoadingAbnormal ( 1 ) ;
carsLoadScanEntity . setUnloadAbnormal ( 1 ) ;
carsLoadScanEntity . setUnloadNum ( 1 ) ;
carsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setUnloadNodeId ( warehouseId ) ;
carsLoadScanEntity . setUnloadNodeName ( warehouseEntity . getName ( ) ) ;
carsLoadScanEntity . setSignTime ( date ) ;
carsLoadScanEntity . setSignAbnormal ( 1 ) ;
carsLoadScanEntity . setSignUserName ( AuthUtil . getNickName ( ) ) ;
@ -4286,6 +4412,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity . setLoadingAbnormal ( 1 ) ;
carsLoadScanEntity . setUnloadAbnormal ( 1 ) ;
carsLoadScanEntity . setUnloadNum ( 1 ) ;
carsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setUnloadNodeId ( warehouseId ) ;
carsLoadScanEntity . setUnloadNodeName ( warehouseEntity . getName ( ) ) ;
carsLoadScanEntity . setSignTime ( date ) ;
carsLoadScanEntity . setSignAbnormal ( 1 ) ;
carsLoadScanEntity . setSignUserName ( AuthUtil . getNickName ( ) ) ;
@ -4304,6 +4433,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
} else {
String scanStatus = carsLoadScanEntity . getScanStatus ( ) ;
if ( "2" . equals ( scanStatus ) ) {
log . warn ( "##############signScanPackageCode: 包件已卸车 loadId={},orderPackageCode={} scanStatus={}" , loadId , orderPackageCode , scanStatus ) ;
return R . fail ( 405 , "包件已卸车" ) ;
}
if ( "3" . equals ( scanStatus ) ) {
log . warn ( "##############signScanPackageCode: 包件已签收 loadId={},orderPackageCode={} scanStatus={}" , loadId , orderPackageCode , scanStatus ) ;
return R . fail ( 405 , "包件已签收" ) ;
}
Long fromWarehouseId = carsLoadScanEntity . getFromWarehouseId ( ) ;
String waybillNo = carsLoadScanEntity . getWaybillNo ( ) ;
DistributionParcelListEntity parcelListEntity = distributionParcelListClient . findByPacketBarCodeAndWarehouseId ( orderPackageCode , fromWarehouseId ) ;
@ -4337,11 +4478,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity . setSignAbnormal ( 0 ) ;
}
String scanStatus = carsLoadScanEntity . getScanStatus ( ) ;
if ( "2" . equals ( scanStatus ) ) {
log . warn ( "##############signScanPackageCode: 包件已卸车 loadId={},orderPackageCode={} scanStatus={}" , loadId , orderPackageCode , scanStatus ) ;
return R . fail ( 405 , "包件已卸车" ) ;
}
Long wid = carsLoadScanEntity . getWarehouseId ( ) ;
if ( ! wid . equals ( warehouseId ) ) {
log . warn ( "##############signScanPackageCode: 包件不在签收计划中 loadId={},orderPackageCode={} scanStatus={}" , loadId , orderPackageCode , scanStatus ) ;
@ -4353,6 +4489,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity . setSignUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setSignOrderId ( signOrderId ) ;
carsLoadScanEntity . setUnloadTime ( date ) ;
carsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setUnloadNodeId ( warehouseId ) ;
carsLoadScanEntity . setUnloadNodeName ( warehouseEntity . getName ( ) ) ;
trunklineCarsLoadScanService . updateById ( carsLoadScanEntity ) ;
//生成签收记录
@ -4431,6 +4570,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Long loadId = signOrderEntity . getLoadId ( ) ;
Long warehouseId = signOrderEntity . getWarehouseId ( ) ;
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( warehouseId ) ;
if ( Objects . isNull ( warehouseEntity ) ) {
log . warn ( "##############signZeroOrder: 仓库信息不存在 warehouseId={}" , warehouseId ) ;
return R . fail ( 405 , "仓库信息不存在" ) ;
}
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService . getById ( carsLoadScanId ) ;
if ( Objects . isNull ( carsLoadScanEntity ) ) {
log . warn ( "##############signZeroOrder: 装车记录不存在 carsLoadScanId={}" , carsLoadScanId ) ;
@ -4439,10 +4584,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
String scanStatus = carsLoadScanEntity . getScanStatus ( ) ;
if ( "2" . equals ( scanStatus ) ) {
log . warn ( "##############signZeroOrder: 包件 已卸车 carsLoadScanId={} scanStatus={}" , carsLoadScanId , scanStatus ) ;
log . warn ( "##############signZeroOrder: 零担 已卸车 carsLoadScanId={} scanStatus={}" , carsLoadScanId , scanStatus ) ;
return R . fail ( 405 , "零担已卸车" ) ;
}
if ( "3" . equals ( scanStatus ) ) {
log . warn ( "##############signZeroOrder: 零担已签收 carsLoadScanId={} scanStatus={}" , carsLoadScanId , scanStatus ) ;
return R . fail ( 405 , "零担已签收" ) ;
}
Long wid = carsLoadScanEntity . getWarehouseId ( ) ;
if ( ! wid . equals ( warehouseId ) ) {
log . warn ( "##############signScanPackageCode: 包件不在签收计划中 loadId={} scanStatus={}" , loadId , scanStatus ) ;
@ -4452,7 +4603,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity . setScanStatus ( "3" ) ;
carsLoadScanEntity . setUnloadNum ( enterNum ) ;
carsLoadScanEntity . setSignTime ( date ) ;
carsLoadScanEntity . setSignAbnormal ( 0 ) ;
carsLoadScanEntity . setSignUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setUnloadTime ( date ) ;
carsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setUnloadNodeId ( warehouseId ) ;
carsLoadScanEntity . setUnloadNodeName ( warehouseEntity . getName ( ) ) ;
trunklineCarsLoadScanService . updateById ( carsLoadScanEntity ) ;
//生成签收记录
@ -4885,6 +5041,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log . warn ( "############signLoadScanByIds: 车辆配载信息不存在 loadId={}" , loadId ) ;
return R . fail ( 405 , "车辆配载信息不存在" ) ;
}
String loadStatus = carsLoadEntity . getLoadStatus ( ) ;
if ( "0" . equals ( loadStatus ) ) {
log . warn ( "############signLoadScanByIds: 车辆还未发车 loadId={}" , loadId ) ;
return R . fail ( 405 , "车辆还未发车" ) ;
}
Integer realLoadingNumber = carsLoadEntity . getRealLoadingNumber ( ) ;
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( warehouseId ) ;
@ -4894,7 +5056,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
Date date = new Date ( ) ;
trunklineCarsLoadScanService . updateScanStatusAndTime ( loadScanIds , "3" , new Date ( ) , AuthUtil . getNickName ( ) ) ;
trunklineCarsLoadScanService . updateScanStatusAndTime ( loadScanIds , "3" , new Date ( ) , AuthUtil . getNickName ( ) , warehouseId , warehouseEntity . getName ( ) ) ;
List < String > orderPackageCodes = trunklineCarsLoadScanService . findSignListOrderPackageCodesByIds ( loadScanIds ) ;
@ -5133,12 +5295,32 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
@Override
public R uploadSignPhoto ( LoadCarsDTO loadCarsDTO ) {
Long signOrderId = loadCarsDTO . getSignOrderId ( ) ;
Long warehouseId = loadCarsDTO . getWarehouseId ( ) ;
List < TrunklineLoadSignPhotoEntity > signPhotoList = loadCarsDTO . getSignPhotoList ( ) ;
List < TrunklineLoadSignPhotoEntity > oldSignPhotoList = loadSignPhotoService . findBySignPhotoList ( signOrderId ) ;
loadSignPhotoService . removeBatchByIds ( oldSignPhotoList ) ;
loadSignPhotoService . saveBatch ( signPhotoList ) ;
TrunklineLoadSignOrderEntity signOrderEntity = trunklineLoadSignOrderService . getById ( signOrderId ) ;
if ( Objects . isNull ( signOrderEntity ) ) {
TrunklineCarsLoadEntity carsLoadEntity = baseMapper . selectById ( signOrderId ) ;
if ( ! Objects . isNull ( carsLoadEntity ) ) {
//三方中转上传图片
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService . findEntityByLoadIdAndNodeId ( signOrderId , warehouseId ) ;
if ( ! Objects . isNull ( carsLoadLineEntity ) ) {
trunklineCarsLoadLogService . saveLog ( carsLoadEntity , carsLoadLineEntity , CarsLoadLogTypeConstant . TRIPARTITE_TRANSFER_SIGNPHOTO . getValue ( ) ) ;
}
}
} else {
//直发商家签收单
}
return R . success ( "添加成功" ) ;
}
@ -5635,9 +5817,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
page . setSize ( loadCarsDTO . getPageSize ( ) ) ;
Date start = CommonUtil . getStartByDateStr ( loadCarsDTO . getStartDate ( ) ) ;
Date end = CommonUtil . getStart ByDateStr ( loadCarsDTO . getEndDate ( ) ) ;
loadCarsDTO . setStartDate ( CommonUtil . dateToStringGeneral ( start ) ) ;
loadCarsDTO . setEndDate ( CommonUtil . dateToStringGeneral ( end ) ) ;
Date end = CommonUtil . getEnd ByDateStr ( loadCarsDTO . getEndDate ( ) ) ;
loadCarsDTO . setStartTime ( start ) ;
loadCarsDTO . setEndTime ( end ) ;
IPage < TrunklineCarsLoadVO > pageList = baseMapper . arriveUnloadPageList ( page , loadCarsDTO ) ;
@ -5668,6 +5850,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Integer realLoadingNumber = trunklineCarsLoadVO . getRealLoadingNumber ( ) ;
Integer unloadNumber = trunklineCarsLoadVO . getUnloadNumber ( ) ;
trunklineCarsLoadVO . setRealLoadingNumber ( realLoadingNumber - unloadNumber ) ;
trunklineCarsLoadVO . setTotalLoadingNum ( realLoadingNumber ) ;
}
pageList . setRecords ( records ) ;
return R . data ( pageList ) ;
@ -5696,6 +5879,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R . fail ( 405 , "配载计划节点信息不存在" ) ;
}
String unloadStatus = loadLineEntity . getUnloadStatus ( ) ;
Integer unloadNumber = loadLineEntity . getUnloadNumber ( ) ;
if ( ! "0" . equals ( unloadStatus ) ) {
log . warn ( "############unloadPackage: 当前网点已经卸车确认 loadId={} warehouseId={}" , loadId , warehouseId ) ;
return R . fail ( 405 , "当前网点已经卸车确认" ) ;
@ -5726,8 +5910,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
//先判断包件是否在配载计划的装车扫描中
QueryWrapper < TrunklineCarsLoadScanEntity > loadScanQueryWrapper = new QueryWrapper < > ( ) ;
loadScanQueryWrapper . eq ( "load_id" , loadId )
. eq ( "scan_code" , orderPackageCode )
. eq ( "scan_status" , "1" ) ;
. eq ( "scan_code" , orderPackageCode ) ;
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService . getOne ( loadScanQueryWrapper ) ;
//判断是否有装车扫描记录
if ( Objects . isNull ( carsLoadScanEntity ) ) {
@ -5737,45 +5920,80 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Long loadScanId = null ;
if ( Objects . isNull ( parcelListEntity ) ) {
//没有包件数据
TrunklineAdvanceDetailEntity advanceDetailEntity = trunklineAdvanceDetailService . findEntityByOrderPackageCode ( orderPackageCode ) ;
if ( ! Objects . isNull ( advanceDetailEntity ) ) {
String packageStatus = advanceDetailEntity . getPackageStatus ( ) ;
if ( "0" . equals ( packageStatus ) ) {
InComingDTO inComingDTO = new InComingDTO ( ) ;
inComingDTO . setOrderPackageCode ( orderPackageCode ) ;
inComingDTO . setIncomingType ( incomingType ) ;
inComingDTO . setWarehouseId ( warehouseId ) ;
inComingService . incomingPackage ( inComingDTO ) ;
InComingDTO inComingDTO = new InComingDTO ( ) ;
inComingDTO . setOrderPackageCode ( orderPackageCode ) ;
inComingDTO . setIncomingType ( incomingType ) ;
inComingDTO . setWarehouseId ( warehouseId ) ;
inComingService . incomingPackage ( inComingDTO ) ;
// int code = r.getCode();
// if(code != 200){
// log.warn("##############unloadPackage: 包件入库失败");
// }
//需要补装车扫记录
TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity = new TrunklineCarsLoadScanEntity ( ) ;
trunklineCarsLoadScanEntity . setWarehouseId ( warehouseId ) ;
trunklineCarsLoadScanEntity . setWarehouseName ( warehouseName ) ;
trunklineCarsLoadScanEntity . setLoadId ( loadId ) ;
trunklineCarsLoadScanEntity . setLoadCode ( loadCode ) ;
trunklineCarsLoadScanEntity . setScanCode ( orderPackageCode ) ;
trunklineCarsLoadScanEntity . setScanStatus ( "2" ) ;
trunklineCarsLoadScanEntity . setNum ( 1 ) ;
trunklineCarsLoadScanEntity . setType ( 1 ) ;
trunklineCarsLoadScanEntity . setIsData ( 0 ) ;
trunklineCarsLoadScanEntity . setLoadingAbnormal ( 1 ) ;
trunklineCarsLoadScanEntity . setUnloadAbnormal ( 1 ) ;
trunklineCarsLoadScanEntity . setUnloadNodeId ( warehouseId ) ;
trunklineCarsLoadScanEntity . setUnloadNum ( 1 ) ;
trunklineCarsLoadScanEntity . setIsSupple ( 0 ) ;
trunklineCarsLoadScanEntity . setLoadingUserName ( AuthUtil . getNickName ( ) ) ;
trunklineCarsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
trunklineCarsLoadScanEntity . setUnloadTime ( new Date ( ) ) ;
trunklineCarsLoadScanService . save ( trunklineCarsLoadScanEntity ) ;
loadScanId = trunklineCarsLoadScanEntity . getId ( ) ;
trunklineCarsLoadingLogService . savaLoadingLog ( warehouseId , warehouseName , loadId , loadCode , null , null , null , orderPackageCode , 1 ,
1 , 0 , 1 , trayId , trayCode , trayName , null , loadScanId , "无数据,补装车计划,异常装车" ) ;
trunklineCarsUnloadLogService . savaUnloadLog ( warehouseId , warehouseName , loadId , loadCode , null , null , null , orderPackageCode , 1 ,
1 , 0 , 1 , trayId , trayCode , trayName , null , loadScanId , "无数据,异常卸车" ) ;
//需要补装车扫记录
TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity = new TrunklineCarsLoadScanEntity ( ) ;
trunklineCarsLoadScanEntity . setWarehouseId ( warehouseId ) ;
trunklineCarsLoadScanEntity . setWarehouseName ( warehouseName ) ;
trunklineCarsLoadScanEntity . setOrderCode ( advanceDetailEntity . getOrderCode ( ) ) ;
trunklineCarsLoadScanEntity . setWaybillId ( advanceDetailEntity . getWaybillId ( ) ) ;
trunklineCarsLoadScanEntity . setWaybillNo ( advanceDetailEntity . getWaybillNo ( ) ) ;
trunklineCarsLoadScanEntity . setLoadId ( loadId ) ;
trunklineCarsLoadScanEntity . setLoadCode ( loadCode ) ;
trunklineCarsLoadScanEntity . setScanCode ( orderPackageCode ) ;
trunklineCarsLoadScanEntity . setScanStatus ( "2" ) ;
trunklineCarsLoadScanEntity . setNum ( 1 ) ;
trunklineCarsLoadScanEntity . setType ( 1 ) ;
trunklineCarsLoadScanEntity . setIsData ( 1 ) ;
trunklineCarsLoadScanEntity . setLoadingAbnormal ( 1 ) ;
trunklineCarsLoadScanEntity . setUnloadAbnormal ( 1 ) ;
trunklineCarsLoadScanEntity . setUnloadNodeName ( warehouseName ) ;
trunklineCarsLoadScanEntity . setUnloadNodeId ( warehouseId ) ;
trunklineCarsLoadScanEntity . setUnloadNum ( 1 ) ;
trunklineCarsLoadScanEntity . setIsSupple ( 0 ) ;
trunklineCarsLoadScanEntity . setLoadingUserName ( AuthUtil . getNickName ( ) ) ;
trunklineCarsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
trunklineCarsLoadScanEntity . setUnloadTime ( new Date ( ) ) ;
trunklineCarsLoadScanService . save ( trunklineCarsLoadScanEntity ) ;
loadScanId = trunklineCarsLoadScanEntity . getId ( ) ;
trunklineCarsLoadingLogService . savaLoadingLog ( warehouseId , warehouseName , loadId , loadCode , null , null , null , orderPackageCode , 1 ,
1 , 1 , 1 , trayId , trayCode , trayName , null , loadScanId , "有数据,补装车计划,异常装车" ) ;
trunklineCarsUnloadLogService . savaUnloadLog ( warehouseId , warehouseName , loadId , loadCode , null , null , null , orderPackageCode , 1 ,
1 , 1 , 1 , trayId , trayCode , trayName , null , loadScanId , "有数据,异常卸车" ) ;
}
} else {
//需要补装车扫记录
TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity = new TrunklineCarsLoadScanEntity ( ) ;
trunklineCarsLoadScanEntity . setWarehouseId ( warehouseId ) ;
trunklineCarsLoadScanEntity . setWarehouseName ( warehouseName ) ;
trunklineCarsLoadScanEntity . setLoadId ( loadId ) ;
trunklineCarsLoadScanEntity . setLoadCode ( loadCode ) ;
trunklineCarsLoadScanEntity . setOrderCode ( "--" ) ;
trunklineCarsLoadScanEntity . setScanCode ( orderPackageCode ) ;
trunklineCarsLoadScanEntity . setScanStatus ( "2" ) ;
trunklineCarsLoadScanEntity . setNum ( 1 ) ;
trunklineCarsLoadScanEntity . setType ( 1 ) ;
trunklineCarsLoadScanEntity . setIsData ( 0 ) ;
trunklineCarsLoadScanEntity . setLoadingAbnormal ( 1 ) ;
trunklineCarsLoadScanEntity . setUnloadAbnormal ( 1 ) ;
trunklineCarsLoadScanEntity . setUnloadNodeName ( warehouseName ) ;
trunklineCarsLoadScanEntity . setUnloadNodeId ( warehouseId ) ;
trunklineCarsLoadScanEntity . setUnloadNum ( 1 ) ;
trunklineCarsLoadScanEntity . setIsSupple ( 0 ) ;
trunklineCarsLoadScanEntity . setLoadingUserName ( AuthUtil . getNickName ( ) ) ;
trunklineCarsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
trunklineCarsLoadScanEntity . setUnloadTime ( new Date ( ) ) ;
trunklineCarsLoadScanService . save ( trunklineCarsLoadScanEntity ) ;
loadScanId = trunklineCarsLoadScanEntity . getId ( ) ;
trunklineCarsLoadingLogService . savaLoadingLog ( warehouseId , warehouseName , loadId , loadCode , null , null , null , orderPackageCode , 1 ,
1 , 0 , 1 , trayId , trayCode , trayName , null , loadScanId , "无数据,补装车计划,异常装车" ) ;
trunklineCarsUnloadLogService . savaUnloadLog ( warehouseId , warehouseName , loadId , loadCode , null , null , null , orderPackageCode , 1 ,
1 , 0 , 1 , trayId , trayCode , trayName , null , loadScanId , "无数据,异常卸车" ) ;
}
} else {
String waybillNumber = parcelListEntity . getWaybillNumber ( ) ;
orderCode = parcelListEntity . getOrderCode ( ) ;
@ -5918,7 +6136,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
} else {
// carsLoadScanEntity.getS
String scanStatus = carsLoadScanEntity . getScanStatus ( ) ;
if ( ! "1" . equals ( scanStatus ) ) {
log . warn ( "##############unloadPackage: 包件已卸车 orderPackageCode={}" , orderPackageCode ) ;
return R . fail ( 405 , "包件已卸车" ) ;
}
Long finalNodeId = carsLoadScanEntity . getFinalNodeId ( ) ;
Long waybillId = carsLoadScanEntity . getWaybillId ( ) ;
@ -5958,81 +6180,91 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
if ( 1 = = isData ) {
DistributionParcelListEntity parcelListEntity = distributionParcelListClient . findByPacketBarCodeAndWarehouseId ( orderPackageCode , fromWarehouseId ) ;
if ( Objects . isNull ( parcelListEntity ) ) {
log . warn ( "##############unloadPackage: 包件信息不存在 orderPackageCode={} fromWarehouseId={}" , orderPackageCode , fromWarehouseId ) ;
return R . fail ( 405 , "包件信息不存在" ) ;
}
Long currentOrderId = null ;
//查询当前仓库订单信息有没有
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , warehouseId ) ;
if ( Objects . isNull ( stockArticleEntity ) ) {
//查询包件前面仓的订单信息
DistributionStockArticleEntity articleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , fromWarehouseId ) ;
stockArticleEntity = new DistributionStockArticleEntity ( ) ;
BeanUtil . copy ( articleEntity , stockArticleEntity ) ;
stockArticleEntity . setId ( null ) ;
stockArticleEntity . setWarehouseId ( warehouseId ) ;
stockArticleEntity . setWarehouse ( warehouseName ) ;
stockArticleEntity . setHandQuantity ( 0 ) ;
stockArticleEntity . setCompleteSet ( 1 ) ;
stockArticleEntity . setStockupStatus ( "10" ) ;
stockArticleEntity . setReservationStatus ( "10" ) ;
stockArticleEntity . setOrderStatus ( "10" ) ;
stockArticleEntity . setGroundingStatus ( "10" ) ;
stockArticleEntity . setOrderReceiveStatus ( "10" ) ;
stockArticleEntity . setFreezeStatus ( "10" ) ;
stockArticleEntity . setSortingQuantity ( 0 ) ;
stockArticleEntity . setDeliveryQuantity ( 0 ) ;
stockArticleEntity . setTransferQuantity ( 0 ) ;
stockArticleEntity . setSigninQuantity ( 0 ) ;
stockArticleEntity . setIncomingNum ( 0 ) ;
currentOrderId = distributionStockArticleClient . addData ( stockArticleEntity ) ;
stockArticleEntity . setId ( currentOrderId ) ;
} else {
currentOrderId = stockArticleEntity . getId ( ) ;
}
//判断包件当前仓是否是目的仓
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient . findByWaybillNo ( waybillNo ) ;
if ( Objects . isNull ( distributionParcelListEntity ) ) {
distributionParcelListEntity = new DistributionParcelListEntity ( ) ;
BeanUtil . copy ( parcelListEntity , distributionParcelListEntity ) ;
distributionParcelListEntity . setId ( null ) ;
distributionParcelListEntity . setOrderPackageStatus ( "20" ) ;
if ( ! Objects . isNull ( warehouseWaybillEntity ) ) {
Long destinationWarehouseId = warehouseWaybillEntity . getDestinationWarehouseId ( ) ; //目的仓
if ( destinationWarehouseId . equals ( warehouseId ) ) {
distributionParcelListEntity . setIsTransfer ( 0 ) ;
} else {
distributionParcelListEntity . setIsTransfer ( 1 ) ;
}
InComingDTO inComingDTO = new InComingDTO ( ) ;
inComingDTO . setOrderPackageCode ( orderPackageCode ) ;
inComingDTO . setIncomingType ( incomingType ) ;
inComingDTO . setWarehouseId ( warehouseId ) ;
R r = inComingService . incomingPackage ( inComingDTO ) ;
int code = r . getCode ( ) ;
if ( code ! = 200 ) {
log . warn ( "##############unloadPackage: 包件入库失败 orderPackageCode={}" , orderPackageCode ) ;
return R . fail ( 405 , "包件入库失败" ) ;
}
distributionParcelListEntity . setWarehouseId ( warehouseId ) ;
distributionParcelListEntity . setWarehouse ( warehouseName ) ;
distributionParcelListEntity . setTrainNumber ( loadCode ) ;
distributionParcelListEntity . setStockArticleId ( currentOrderId ) ;
distributionParcelListEntity . setOrderPackageFreezeStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageGroundingStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageStockupStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageReservationStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageLoadingStatus ( "10" ) ;
distributionParcelListEntity . setWarehouseEntryTimeEnd ( new Date ( ) ) ;
boolean add = distributionParcelListClient . add ( distributionParcelListEntity ) ;
if ( add ) {
distributionStockArticleClient . addIncomingNum ( currentOrderId , 1 ) ;
// parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
} else {
Long currentOrderId = null ;
//查询当前仓库订单信息有没有
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , warehouseId ) ;
if ( Objects . isNull ( stockArticleEntity ) ) {
//查询包件前面仓的订单信息
DistributionStockArticleEntity articleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , fromWarehouseId ) ;
stockArticleEntity = new DistributionStockArticleEntity ( ) ;
BeanUtil . copy ( articleEntity , stockArticleEntity ) ;
stockArticleEntity . setId ( null ) ;
stockArticleEntity . setWarehouseId ( warehouseId ) ;
stockArticleEntity . setWarehouse ( warehouseName ) ;
stockArticleEntity . setHandQuantity ( 0 ) ;
stockArticleEntity . setCompleteSet ( 1 ) ;
stockArticleEntity . setStockupStatus ( "10" ) ;
stockArticleEntity . setReservationStatus ( "10" ) ;
stockArticleEntity . setOrderStatus ( "10" ) ;
stockArticleEntity . setGroundingStatus ( "10" ) ;
stockArticleEntity . setOrderReceiveStatus ( "10" ) ;
stockArticleEntity . setFreezeStatus ( "10" ) ;
stockArticleEntity . setSortingQuantity ( 0 ) ;
stockArticleEntity . setDeliveryQuantity ( 0 ) ;
stockArticleEntity . setTransferQuantity ( 0 ) ;
stockArticleEntity . setSigninQuantity ( 0 ) ;
stockArticleEntity . setIncomingNum ( 0 ) ;
currentOrderId = distributionStockArticleClient . addData ( stockArticleEntity ) ;
stockArticleEntity . setId ( currentOrderId ) ;
} else {
currentOrderId = stockArticleEntity . getId ( ) ;
}
} else {
if ( ! Objects . isNull ( warehouseWaybillEntity ) ) {
Long destinationWarehouseId = warehouseWaybillEntity . getDestinationWarehouseId ( ) ; //目的仓
if ( destinationWarehouseId . equals ( warehouseId ) ) {
distributionParcelListEntity . setIsTransfer ( 0 ) ;
} else {
distributionParcelListEntity . setIsTransfer ( 1 ) ;
//判断包件当前仓是否是目的仓
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient . findByWaybillNo ( waybillNo ) ;
if ( Objects . isNull ( distributionParcelListEntity ) ) {
distributionParcelListEntity = new DistributionParcelListEntity ( ) ;
BeanUtil . copy ( parcelListEntity , distributionParcelListEntity ) ;
distributionParcelListEntity . setId ( null ) ;
distributionParcelListEntity . setOrderPackageStatus ( "20" ) ;
if ( ! Objects . isNull ( warehouseWaybillEntity ) ) {
Long destinationWarehouseId = warehouseWaybillEntity . getDestinationWarehouseId ( ) ; //目的仓
if ( destinationWarehouseId . equals ( warehouseId ) ) {
distributionParcelListEntity . setIsTransfer ( 0 ) ;
} else {
distributionParcelListEntity . setIsTransfer ( 1 ) ;
}
}
distributionParcelListEntity . setWarehouseId ( warehouseId ) ;
distributionParcelListEntity . setWarehouse ( warehouseName ) ;
distributionParcelListEntity . setTrainNumber ( loadCode ) ;
distributionParcelListEntity . setStockArticleId ( currentOrderId ) ;
distributionParcelListEntity . setOrderPackageFreezeStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageGroundingStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageStockupStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageReservationStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageLoadingStatus ( "10" ) ;
distributionParcelListEntity . setWarehouseEntryTimeEnd ( new Date ( ) ) ;
boolean add = distributionParcelListClient . add ( distributionParcelListEntity ) ;
if ( add ) {
distributionStockArticleClient . addIncomingNum ( currentOrderId , 1 ) ;
}
} else {
if ( ! Objects . isNull ( warehouseWaybillEntity ) ) {
Long destinationWarehouseId = warehouseWaybillEntity . getDestinationWarehouseId ( ) ; //目的仓
if ( destinationWarehouseId . equals ( warehouseId ) ) {
distributionParcelListEntity . setIsTransfer ( 0 ) ;
} else {
distributionParcelListEntity . setIsTransfer ( 1 ) ;
}
}
distributionParcelListClient . update ( distributionParcelListEntity ) ;
}
distributionParcelListClient . update ( distributionParcelListEntity ) ;
}
} else {
//无数据
TrunklineAdvanceDetailEntity advanceDetailEntity = trunklineAdvanceDetailService . findEntityByOrderPackageCode ( orderPackageCode ) ;
@ -6047,13 +6279,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
inComingDTO . setWarehouseId ( warehouseId ) ;
inComingService . incomingPackage ( inComingDTO ) ;
carsLoadScanEntity . setOrderCode ( orderCode ) ;
carsLoadScanEntity . setWaybillNo ( waybillNo1 ) ;
carsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setUnloadTime ( new Date ( ) ) ;
carsLoadScanEntity . setIsData ( 1 ) ;
isData = 1 ;
trunklineCarsLoadScanService . updateById ( carsLoadScanEntity ) ;
} else {
DistributionParcelListEntity parcelListEntity = distributionParcelListClient . findByOrderPackageCodeAndStatus ( orderPackageCode ) ;
if ( ! Objects . isNull ( parcelListEntity ) ) {
@ -6081,6 +6306,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
distributionParcelListClient . add ( newParcelListEntity ) ;
}
}
carsLoadScanEntity . setOrderCode ( orderCode ) ;
carsLoadScanEntity . setWaybillNo ( waybillNo1 ) ;
carsLoadScanEntity . setUnloadUserName ( AuthUtil . getNickName ( ) ) ;
carsLoadScanEntity . setUnloadTime ( new Date ( ) ) ;
carsLoadScanEntity . setIsData ( 1 ) ;
isData = 1 ;
trunklineCarsLoadScanService . updateById ( carsLoadScanEntity ) ;
}
}
}
@ -6127,13 +6361,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log . error ( "入库推送失败:{}" , e ) ;
}
} catch ( Exception e ) {
log . warn ( "#########3 卸车存入日志失败" ) ;
log . warn ( "#########卸车存入日志失败" ) ;
}
JSONObject jsonObject = trunklineCarsLoadScanService . findUnloadNumAudio ( loadId , warehouseId ) ;
Integer totalUnloadNum = jsonObject . getInteger ( "totalUnloadNum" ) ;
Integer abnormalUnloadNum = jsonObject . getInteger ( "abnormalUnloadNum" ) ;
if ( isData = = 0 ) {
return Resp . scanSuccess ( "卸车成功" , "系统无编码" ) ;
}
return R . success ( "卸车成功" ) ;
return Resp . scanS uccess ( "卸车成功" , "卸车" + totalUnloadNum + "件,异常卸车" + abnormalUnloadNum + "件 " ) ;
}
@ -6203,12 +6442,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
if ( enterNun > num ) {
log . warn ( "#############unloadZero: 零担信息卸车数量大于装车件数 enterNun={} num={}" , enterNun , num ) ;
return R . fail ( 405 , "零担信息卸车数量大于装车件数" ) ;
} else {
Integer difficute = num - enterNun ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , fromWarehouseId ) ;
Long orderId = stockArticleEntity . getId ( ) ;
distributionStockArticleClient . addHandQuantity ( orderId , difficute ) ;
}
carsLoadScanEntity . setUnloadNum ( enterNun ) ;
@ -6230,76 +6463,76 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
}
DistributionStockArticleEntity newStockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , warehouseId ) ;
if ( Objects . isNull ( newStockArticleEntity ) ) {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , fromWarehouseId ) ;
newStockArticleEntity = new DistributionStockArticleEntity ( ) ;
BeanUtil . copy ( stockArticleEntity , newStockArticleEntity ) ;
newStockArticleEntity . setId ( null ) ;
newStockArticleEntity . setOrderReceiveStatus ( "20" ) ;
newStockArticleEntity . setOrderStatus ( "10" ) ;
newStockArticleEntity . setHandQuantity ( enterNun ) ;
newStockArticleEntity . setIncomingNum ( enterNun ) ;
newStockArticleEntity . setWarehouse ( basicdataWarehouseEntity . getName ( ) ) ;
newStockArticleEntity . setWarehouseId ( basicdataWarehouseEntity . getId ( ) ) ;
newStockArticleEntity . setCarsLoadNum ( 0 ) ;
Long orderId = distributionStockArticleClient . addData ( newStockArticleEntity ) ;
if ( orderId ! = 0 ) {
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListClient . findEntityListByOrderCode ( orderCode , fromWarehouseId ) ;
List < DistributionParcelNumberEntity > ls = new ArrayList < > ( ) ;
for ( DistributionParcelListEntity parcelListEntity : parcelListEntityList ) {
DistributionParcelListEntity newParcelListEntity = new DistributionParcelListEntity ( ) ;
BeanUtil . copy ( parcelListEntity , newParcelListEntity ) ;
newParcelListEntity . setId ( null ) ;
newParcelListEntity . setWarehouseId ( warehouseId ) ;
newParcelListEntity . setWarehouse ( warehouseName ) ;
newParcelListEntity . setStockArticleId ( orderId ) ;
Long acceptWarehouseId = parcelListEntity . getAcceptWarehouseId ( ) ;
if ( warehouseId . equals ( acceptWarehouseId ) ) {
newParcelListEntity . setIsTransfer ( 0 ) ;
} else {
newParcelListEntity . setIsTransfer ( 1 ) ;
}
Long orderPackageId = distributionParcelListClient . addReturnId ( newParcelListEntity ) ;
DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity ( ) ;
parcelNumberEntity . setStockArticleId ( orderId ) ;
parcelNumberEntity . setParcelListId ( orderPackageId ) ;
parcelNumberEntity . setQuantity ( newParcelListEntity . getQuantity ( ) ) ;
parcelNumberEntity . setHandQuantity ( 0 ) ;
parcelNumberEntity . setDeliveryQuantity ( 0 ) ;
parcelNumberEntity . setSigninQuantity ( 0 ) ;
parcelNumberEntity . setOutboundQuantity ( 0 ) ;
parcelNumberEntity . setWarehouseId ( warehouseId ) ;
ls . add ( parcelNumberEntity ) ;
}
distributionParcelNumberClient . addBatch ( ls ) ;
}
} else {
Integer handQuantity = newStockArticleEntity . getHandQuantity ( ) + enterNun ;
Integer incomingNum = newStockArticleEntity . getIncomingNum ( ) + enterNun ;
Integer totalNumber = newStockArticleEntity . getTotalNumber ( ) ;
if ( incomingNum . equals ( totalNumber ) ) {
if ( handQuantity . equals ( totalNumber ) ) {
newStockArticleEntity . setOrderStatus ( "20" ) ;
} else {
newStockArticleEntity . setOrderStatus ( "30" ) ;
}
newStockArticleEntity . setOrderReceiveStatus ( "30" ) ;
} else {
if ( incomingNum . equals ( handQuantity ) ) {
newStockArticleEntity . setOrderStatus ( "10" ) ;
} else {
newStockArticleEntity . setOrderStatus ( "30" ) ;
}
newStockArticleEntity . setOrderReceiveStatus ( "20" ) ;
}
newStockArticleEntity . setHandQuantity ( handQuantity ) ;
newStockArticleEntity . setIncomingNum ( incomingNum ) ;
distributionStockArticleClient . saveOrUpdate ( newStockArticleEntity ) ;
}
// DistributionStockArticleEntity newStockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
// if (Objects.isNull(newStockArticleEntity)) {
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, fromWarehouseId);
// newStockArticleEntity = new DistributionStockArticleEntity();
// BeanUtil.copy(stockArticleEntity, newStockArticleEntity);
// newStockArticleEntity.setId(null);
// newStockArticleEntity.setOrderReceiveStatus("20");
// newStockArticleEntity.setOrderStatus("10");
// newStockArticleEntity.setHandQuantity(enterNun);
// newStockArticleEntity.setIncomingNum(enterNun);
// newStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName());
// newStockArticleEntity.setWarehouseId(basicdataWarehouseEntity.getId());
// newStockArticleEntity.setCarsLoadNum(0);
// Long orderId = distributionStockArticleClient.addData(newStockArticleEntity);
// if (orderId != 0) {
// List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, fromWarehouseId);
// List<DistributionParcelNumberEntity> ls = new ArrayList<>();
// for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) {
// DistributionParcelListEntity newParcelListEntity = new DistributionParcelListEntity();
// BeanUtil.copy(parcelListEntity, newParcelListEntity);
// newParcelListEntity.setId(null);
// newParcelListEntity.setWarehouseId(warehouseId);
// newParcelListEntity.setWarehouse(warehouseName);
// newParcelListEntity.setStockArticleId(orderId);
// Long acceptWarehouseId = parcelListEntity.getAcceptWarehouseId();
// if(warehouseId.equals(acceptWarehouseId)){
// newParcelListEntity.setIsTransfer(0);
// }else{
// newParcelListEntity.setIsTransfer(1);
// }
// Long orderPackageId = distributionParcelListClient.addReturnId(newParcelListEntity);
//
// DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity();
// parcelNumberEntity.setStockArticleId(orderId);
// parcelNumberEntity.setParcelListId(orderPackageId);
// parcelNumberEntity.setQuantity(newParcelListEntity.getQuantity());
// parcelNumberEntity.setHandQuantity(0);
// parcelNumberEntity.setDeliveryQuantity(0);
// parcelNumberEntity.setSigninQuantity(0);
// parcelNumberEntity.setOutboundQuantity(0);
// parcelNumberEntity.setWarehouseId(warehouseId);
// ls.add(parcelNumberEntity);
// }
// distributionParcelNumberClient.addBatch(ls);
// }
// } else {
// Integer handQuantity = newStockArticleEntity.getHandQuantity() + enterNun;
// Integer incomingNum = newStockArticleEntity.getIncomingNum() + enterNun;
// Integer totalNumber = newStockArticleEntity.getTotalNumber();
//
// if (incomingNum.equals(totalNumber)) {
// if (handQuantity.equals(totalNumber)) {
// newStockArticleEntity.setOrderStatus("20");
// } else {
// newStockArticleEntity.setOrderStatus("30");
// }
// newStockArticleEntity.setOrderReceiveStatus("30");
// } else {
// if (incomingNum.equals(handQuantity)) {
// newStockArticleEntity.setOrderStatus("10");
// } else {
// newStockArticleEntity.setOrderStatus("30");
// }
// newStockArticleEntity.setOrderReceiveStatus("20");
// }
// newStockArticleEntity.setHandQuantity(handQuantity);
// newStockArticleEntity.setIncomingNum(incomingNum);
//
// distributionStockArticleClient.saveOrUpdate(newStockArticleEntity);
// }
updateNumByLoadId ( loadId ) ;
@ -6370,7 +6603,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
//查询已装车的零担
List < UnloadZeroVO > zeroList = trunklineCarsOrder Service . findUnloadZeroList ( loadId , warehouseId ) ;
List < UnloadZeroVO > zeroList = trunklineCarsLoadScan Service . findUnloadZeroList ( loadId , warehouseId ) ;
for ( UnloadZeroVO unloadZeroVO : zeroList ) {
Integer loadingNum = unloadZeroVO . getLoadingNum ( ) ;
String waybillNo = unloadZeroVO . getWaybillNo ( ) ;