@ -1,6 +1,5 @@
package com.logpm.trunkline.service.impl ;
import com.alibaba.fastjson.JSONArray ;
import com.alibaba.fastjson.JSONObject ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
@ -14,8 +13,12 @@ import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity ;
import com.logpm.distribution.feign.IDistributionParcelListClient ;
import com.logpm.distribution.feign.IDistributionStockArticleClient ;
import com.logpm.trunkline.bean.Resp ;
import com.logpm.trunkline.dto.* ;
import com.logpm.trunkline.entity.* ;
import com.logpm.trunkline.entity.TrunklineCarsLoadEntity ;
import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity ;
import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity ;
import com.logpm.trunkline.entity.TrunklineCarsOrderEntity ;
import com.logpm.trunkline.mapper.TrunklineCarsLoadMapper ;
import com.logpm.trunkline.service.* ;
import com.logpm.trunkline.vo.* ;
@ -1487,6 +1490,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
} else {
String orderPackageStatus = parcelListEntity . getOrderPackageStatus ( ) ;
if ( "60" . equals ( orderPackageStatus ) | | "70" . equals ( orderPackageStatus ) ) {
log . warn ( "##################loadingScan: 包件已出库 orderPackageStatus={}" , orderPackageStatus ) ;
return R . fail ( 405 , "包件已出库" ) ;
}
//有包件所以是有数据的包件扫描
carsLoadScanEntity . setIsData ( 1 ) ;
//补全数据信息
@ -1539,8 +1549,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
distributionParcelListClient . updateOrderPackageCodeById ( packageId , "60" ) ;
distributionStockArticleClient . submitHandleNumByOrderId ( 1 , articleId ) ;
updownTypeClient . downPackageOrDelTray ( orderPackageCode , warehouseId ) ;
if ( StringUtil . isBlank ( trayCode ) ) {
updownTypeClient . downPackageOrDelTray ( orderPackageCode , warehouseId ) ;
}
}
trunklineCarsLoadScanService . save ( carsLoadScanEntity ) ;
loadScanId = carsLoadScanEntity . getId ( ) ;
@ -1666,6 +1677,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity . setTrayName ( trayName ) ;
carsLoadScanEntity . setTrayCode ( trayCode ) ;
carsLoadScanEntity . setRemark ( remark ) ;
carsLoadScanEntity . setFromWarehouseId ( warehouseId ) ;
carsLoadScanEntity . setFinalNodeId ( carsOrderEntity . getFinalNodeId ( ) ) ;
trunklineCarsLoadScanService . save ( carsLoadScanEntity ) ;
loadScanId = carsLoadScanEntity . getId ( ) ;
difficult = enterNum ;
@ -1828,17 +1841,23 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
if ( "1" . equals ( associationType ) ) {
String orderCode = jsonObject . getString ( "associationValue" ) ;
JSONArray plDetail = new JSONArray ( ) ;
List < DistributionParcelListEntity > plList = distributionParcelListClient . findEntityListByOrderCode ( orderCode , warehouseId ) ;
for ( DistributionParcelListEntity parcelListEntity : plList ) {
Integer quantity = parcelListEntity . getQuantity ( ) ;
String firsts = parcelListEntity . getFirsts ( ) ;
JSONObject detail = new JSONObject ( ) ;
detail . put ( "productName" , firsts ) ;
detail . put ( "stockNum" , quantity ) ;
plDetail . add ( detail ) ;
// JSONArray plDetail = new JSONArray();
// List<DistributionParcelListEntity> plList = distributionParcelListClient.findEntityListByOrderCode(orderCode, warehouseId);
// for (DistributionParcelListEntity parcelListEntity : plList) {
// Integer quantity = parcelListEntity.getQuantity();
// String firsts = parcelListEntity.getFirsts();
// JSONObject detail = new JSONObject();
// detail.put("productName",firsts);
// detail.put("stockNum",quantity);
// plDetail.add(detail);
// }
// jsonObject.put("details",plDetail);
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , warehouseId ) ;
if ( ! Objects . isNull ( stockArticleEntity ) ) {
jsonObject . put ( "waybillNo" , stockArticleEntity . getWaybillNumber ( ) ) ;
} else {
jsonObject . put ( "waybillNo" , "" ) ;
}
jsonObject . put ( "details" , plDetail ) ;
zeroList . add ( jsonObject ) ;
}
if ( "3" . equals ( associationType ) ) {
@ -1878,6 +1897,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R . fail ( 405 , "节点不是到车状态" ) ;
}
Integer pacakagNum = 0 ;
Integer zeroNum = 0 ;
for ( LoadingPackageDTO loadingPackageDTO : packageList ) {
String orderPackageCode = loadingPackageDTO . getOrderPackageCode ( ) ;
loadingScan ( loadId , warehouseId , orderPackageCode , trayCode ) ;
@ -1893,7 +1914,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
//下架托盘
updownTypeClient . downTray ( trayCode , warehouseId ) ;
return R . success ( "整托装车成功" ) ;
return Resp . scanS uccess ( "整托装车成功" , "装车成功包件" + pacakagNum + "件,零担" + zeroNum + "件 " ) ;
}
@Override
@ -1986,16 +2007,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Integer type = carsLoadScanEntity . getType ( ) ;
Long fromWarehouseId = carsLoadScanEntity . getFromWarehouseId ( ) ;
if ( isData = = 1 ) {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , fromWarehouseId ) ;
if ( Objects . isNull ( stockArticleEntity ) ) {
log . warn ( "##################removeCarsLoadScan: 订单信息不存在 fromWarehouseId={} orderCode={}" , fromWarehouseId , orderCode ) ;
return R . fail ( 405 , "订单信息不存在" ) ;
}
stockArticleEntity . setHandQuantity ( stockArticleEntity . getHandQuantity ( ) + num ) ;
distributionStockArticleClient . saveOrUpdate ( stockArticleEntity ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( orderCode , fromWarehouseId ) ;
if ( Objects . isNull ( stockArticleEntity ) ) {
log . warn ( "##################removeCarsLoadScan: 订单信息不存在 fromWarehouseId={} orderCode={}" , fromWarehouseId , orderCode ) ;
return R . fail ( 405 , "订单信息不存在" ) ;
}
Long articleId = stockArticleEntity . getId ( ) ;
distributionStockArticleClient . submitHandleNumByOrderId ( - num , articleId ) ;
if ( isData = = 1 ) {
if ( type = = 1 ) {
DistributionParcelListEntity parcelListEntity = distributionParcelListClient . findByPacketBarCodeAndWarehouseId ( scanCode , fromWarehouseId ) ;
if ( Objects . isNull ( parcelListEntity ) ) {
@ -2267,6 +2287,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
updownTypeClient . downPackageOrDelTray ( orderPackageCode , warehouseId ) ;
}
trunklineCarsLoadScanService . updateById ( carsLoadScanEntity ) ;
trunklineCarsUnloadLogService . savaUnloadLog ( warehouseId , warehouseName , loadId , loadCode , waybillId , waybillNo , orderCode , orderPackageCode , 1 ,
1 , 1 , isAbnormal , trayId , trayCode , trayName , fromWarehouseId , loadScanId , remark ) ;