@ -42,6 +42,7 @@ import com.logpm.factorydata.vo.PushData;
import com.logpm.trunkline.bean.Resp ;
import com.logpm.trunkline.dto.* ;
import com.logpm.trunkline.entity.* ;
import com.logpm.trunkline.excel.TrunklineCarsLoadExcel ;
import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient ;
import com.logpm.trunkline.mapper.TrunklineCarsLoadMapper ;
import com.logpm.trunkline.service.* ;
@ -3589,6 +3590,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity . setWaybillNo ( trunklineAdvanceDetailEntity . getWaybillNo ( ) ) ;
carsLoadScanEntity . setWaybillId ( trunklineAdvanceDetailEntity . getWaybillId ( ) ) ;
carsLoadScanEntity . setIsData ( 1 ) ;
carsLoadScanEntity . setFromWarehouseId ( trunklineAdvanceDetailEntity . getNowWarehouseId ( ) ) ;
String packageStatus = trunklineAdvanceDetailEntity . getPackageStatus ( ) ;
if ( "0" . equals ( packageStatus ) ) {
//未入库
@ -7705,13 +7707,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
DistributionParcelListEntity parcelListEntity = distributionParcelListClient . findByOrderPackageCodeAndStatus ( scanCode ) ;
if ( ! Objects . isNull ( parcelListEntity ) ) {
Long warehouseId = parcelListEntity . getWarehouseId ( ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , warehouseId ) ;
DistributionStockArticleEntity newStockArticle = new DistributionStockArticleEntity ( ) ;
BeanUtil . copy ( stockArticleEntity , newStockArticle ) ;
newStockArticle . setId ( null ) ;
newStockArticle . setHandQuantity ( 0 ) ;
Long orderId = distributionStockArticleClient . addData ( newStockArticle ) ;
// 判断包件查询出来的入库数据 和当前操作的入库仓 是否一致
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
if ( myCurrentWarehouse = = null ) {
return R . fail ( 405 , "仓库信息不存在 ,请选择入库仓库" ) ;
}
if ( NumberUtil . equals ( myCurrentWarehouse . getId ( ) , warehouseId ) ) {
return R . fail ( 405 , "包件已入库!" ) ;
}
DistributionStockArticleEntity stockArticleEntity = getDistributionStockArticle ( orderCode , warehouseId , myCurrentWarehouse . getName ( ) , scanCode ) ;
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( unloadNodeId ) ;
DistributionParcelListEntity newParcelList = new DistributionParcelListEntity ( ) ;
BeanUtil . copy ( parcelListEntity , newParcelList ) ;
@ -7725,7 +7730,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
newParcelList . setIsTransfer ( 1 ) ;
}
newParcelList . setTrainNumber ( loadCode ) ;
newParcelList . setStockArticleId ( orderId ) ;
newParcelList . setStockArticleId ( stockArticleEntity . getId ( ) ) ;
distributionParcelListClient . add ( newParcelList ) ;
// stockArticleEntity.setHandQuantity(stockArticleEntity.getHandQuantity() - 1);
@ -7747,6 +7752,52 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
}
private DistributionStockArticleEntity getDistributionStockArticle ( String orderCode , Long warehouseId , String warehouseName , String scanCode ) {
DistributionStockArticleEntity stockArticleByOrderCodeAndWarehouseId = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , warehouseId ) ;
if ( Objects . isNull ( stockArticleByOrderCodeAndWarehouseId ) ) {
TrunklineAdvanceDetailEntity entityByOrderPackageCode = trunklineAdvanceDetailService . findEntityByOrderPackageCode ( scanCode ) ;
if ( Objects . isNull ( entityByOrderPackageCode ) ) {
stockArticleByOrderCodeAndWarehouseId = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , entityByOrderPackageCode . getNowWarehouseId ( ) ) ;
if ( Objects . isNull ( stockArticleByOrderCodeAndWarehouseId ) ) {
stockArticleByOrderCodeAndWarehouseId . setId ( null ) ;
stockArticleByOrderCodeAndWarehouseId . setWarehouseId ( warehouseId ) ;
stockArticleByOrderCodeAndWarehouseId . setWarehouseId ( warehouseId ) ;
stockArticleByOrderCodeAndWarehouseId . setWarehouse ( warehouseName ) ;
stockArticleByOrderCodeAndWarehouseId . setGenre ( 1 ) ;
stockArticleByOrderCodeAndWarehouseId . setHandQuantity ( 0 ) ;
stockArticleByOrderCodeAndWarehouseId . setCompleteSet ( 1 ) ;
stockArticleByOrderCodeAndWarehouseId . setStockupStatus ( "10" ) ;
stockArticleByOrderCodeAndWarehouseId . setReservationStatus ( "10" ) ;
stockArticleByOrderCodeAndWarehouseId . setOrderStatus ( "10" ) ;
stockArticleByOrderCodeAndWarehouseId . setGroundingStatus ( "10" ) ;
stockArticleByOrderCodeAndWarehouseId . setOrderReceiveStatus ( "10" ) ;
stockArticleByOrderCodeAndWarehouseId . setFreezeStatus ( "10" ) ;
stockArticleByOrderCodeAndWarehouseId . setSortingQuantity ( 0 ) ;
stockArticleByOrderCodeAndWarehouseId . setDeliveryQuantity ( 0 ) ;
stockArticleByOrderCodeAndWarehouseId . setTransferQuantity ( 0 ) ;
stockArticleByOrderCodeAndWarehouseId . setSigninQuantity ( 0 ) ;
stockArticleByOrderCodeAndWarehouseId . setIncomingNum ( 0 ) ;
stockArticleByOrderCodeAndWarehouseId . setAllocation ( null ) ;
stockArticleByOrderCodeAndWarehouseId . setTrays ( null ) ;
Long orderId = distributionStockArticleClient . addData ( stockArticleByOrderCodeAndWarehouseId ) ;
stockArticleByOrderCodeAndWarehouseId . setId ( orderId ) ;
}
}
}
// 存在就返回
return stockArticleByOrderCodeAndWarehouseId ;
}
@Override
public R transitOrderPageList ( LoadCarsDTO loadCarsDTO ) {
IPage < Object > page = new Page < > ( ) ;
@ -8881,7 +8932,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
//查询包件是否签收
DistributionParcelListEntity signDistributionParcelListEntity = distributionParcelListClient . findOrderPackageCodeAndStatus ( orderPackageCode , "70" ) ;
if ( ! Objects . isNull ( d istributionParcelListEntity) ) {
if ( ! Objects . isNull ( signD istributionParcelListEntity) ) {
log . warn ( "##############unloadPackage: 包件已签收 orderPackageCode={} warehouseId={}" , orderPackageCode , warehouseId ) ;
return R . fail ( 405 , "包件已签收" ) ;
}
@ -9051,6 +9102,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentStockArticleEntity . setId ( null ) ;
currentStockArticleEntity . setWarehouseId ( warehouseId ) ;
currentStockArticleEntity . setWarehouse ( warehouseName ) ;
currentStockArticleEntity . setGenre ( 1 ) ;
currentStockArticleEntity . setHandQuantity ( 0 ) ;
currentStockArticleEntity . setCompleteSet ( 1 ) ;
currentStockArticleEntity . setStockupStatus ( "10" ) ;
@ -9070,6 +9122,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentStockArticleEntity . setId ( currentOrderId ) ;
} else {
currentOrderId = currentStockArticleEntity . getId ( ) ;
currentStockArticleEntity . setGenre ( 1 ) ;
distributionStockArticleClient . updateEntity ( currentStockArticleEntity ) ;
}
//判断包件当前仓是否是目的仓
@ -9248,12 +9302,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentStockArticleEntity . setTransferQuantity ( 0 ) ;
currentStockArticleEntity . setSigninQuantity ( 0 ) ;
currentStockArticleEntity . setIncomingNum ( 0 ) ;
currentStockArticleEntity . setGenre ( 1 ) ;
currentStockArticleEntity . setAllocation ( null ) ;
currentStockArticleEntity . setTrays ( null ) ;
currentOrderId = distributionStockArticleClient . addData ( currentStockArticleEntity ) ;
currentStockArticleEntity . setId ( currentOrderId ) ;
} else {
currentOrderId = currentStockArticleEntity . getId ( ) ;
stockArticleEntity . setGenre ( 1 ) ;
distributionStockArticleClient . updateEntity ( stockArticleEntity ) ;
}
//判断包件当前仓是否是目的仓
@ -9406,6 +9463,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
stockArticleEntity . setId ( currentOrderId ) ;
} else {
currentOrderId = stockArticleEntity . getId ( ) ;
stockArticleEntity . setGenre ( 1 ) ;
distributionStockArticleClient . updateEntity ( stockArticleEntity ) ;
}
//判断包件当前仓是否是目的仓
@ -9639,7 +9698,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
//查询包件是否签收
DistributionParcelListEntity signDistributionParcelListEntity = distributionParcelListClient . findOrderPackageCodeAndStatus ( orderPackageCode , "70" ) ;
if ( ! Objects . isNull ( d istributionParcelListEntity) ) {
if ( ! Objects . isNull ( signD istributionParcelListEntity) ) {
log . warn ( "##############unloadPackage: 包件已签收 orderPackageCode={} warehouseId={}" , orderPackageCode , warehouseId ) ;
return R . fail ( 405 , "包件已签收" ) ;
}
@ -9668,6 +9727,17 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
. eq ( "scan_code" , orderPackageCode )
. eq ( "scan_status" , "1" ) ;
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService . getOne ( loadScanQueryWrapper ) ;
// if(Objects.isNull(carsLoadScanEntity)){
// QueryWrapper<TrunklineCarsLoadScanEntity> loadScanQueryWrapper1 = new QueryWrapper<>();
// loadScanQueryWrapper1.eq("load_id", loadId)
// .eq("scan_code", orderPackageCode)
// .eq("scan_status","2")
// .eq("unload_node_id", warehouseId);
// carsLoadScanEntity = trunklineCarsLoadScanService.getOne(loadScanQueryWrapper);
// }
//判断是否有装车扫描记录
if ( Objects . isNull ( carsLoadScanEntity ) ) {
//没有装车扫码记录
@ -10324,6 +10394,28 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return Resp . scanSuccess ( "卸车成功" , audio . toString ( ) ) ;
}
@Override
public List < TrunklineCarsLoadExcel > exportLoadCarsPageList ( LoadCarsDTO loadCarsDTO ) {
loadCarsDTO . setCreateTimeStart ( CommonUtil . getStartByDateStr ( loadCarsDTO . getCreateTimeStartStr ( ) ) ) ;
loadCarsDTO . setCreateTimeEnd ( CommonUtil . getEndByDateStr ( loadCarsDTO . getCreateTimeEndStr ( ) ) ) ;
loadCarsDTO . setStartTime ( CommonUtil . getStartByDateStr ( loadCarsDTO . getStartDate ( ) ) ) ;
loadCarsDTO . setEndTime ( CommonUtil . getEndByDateStr ( loadCarsDTO . getEndDate ( ) ) ) ;
loadCarsDTO . setArriveTimeStart ( CommonUtil . getStartByDateStr ( loadCarsDTO . getArriveTimeStartStr ( ) ) ) ;
loadCarsDTO . setArriveTimeEnd ( CommonUtil . getEndByDateStr ( loadCarsDTO . getArriveTimeEndStr ( ) ) ) ;
List < Long > idList = null ;
if ( ! Objects . isNull ( loadCarsDTO . getIds ( ) ) ) {
idList = new ArrayList < > ( ) ;
idList . addAll ( Arrays . asList ( Func . toLongArray ( loadCarsDTO . getIds ( ) ) ) ) ;
}
List < TrunklineCarsLoadExcel > pageList = baseMapper . exportLoadCarsList ( loadCarsDTO , idList ) ;
return pageList ;
}
@Override
public R unloadZero ( Long carsLoadScanId , Long loadId , String waybillNo , Integer enterNun , Long warehouseId , Integer unbindTray , String trayCode , String orderCode , String remark , String unloadTrayName , String unloadTrayCode , List < ZeroPackageDTO > zeroPackageList ) {