@ -87,6 +87,7 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
private final BladeRedis redis ;
private final IWarehouseMappingDataService warehouseMappingDataService ;
private final IBasicdataCategoryClient categoryClient ;
@Transactional ( rollbackFor = Exception . class )
@Override
@ -199,6 +200,105 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
}
}
@Override
public void repairNoOpenOrderOrderInfo ( String orderCode ) {
List < AdvanceEntity > advanceList = advanceClient . getAdvanceList ( orderCode ) ;
Set < String > waybillNos = new HashSet < > ( ) ;
for ( AdvanceEntity advanceEntity : advanceList ) {
Integer advanceId = advanceEntity . getId ( ) ;
String waybillNo = advanceEntity . getWaybillNo ( ) ;
String dealerCode = advanceEntity . getDealerCode ( ) ;
String dealerName = advanceEntity . getDealerName ( ) ;
saveWaybillEntity ( waybillNo ) ;
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient . findByWaybillNo ( waybillNo ) ;
if ( ! Objects . isNull ( warehouseWaybillEntity ) ) {
Long departureWarehouseId = warehouseWaybillEntity . getDepartureWarehouseId ( ) ;
String departureWarehouseName = warehouseWaybillEntity . getDepartureWarehouseName ( ) ;
Long destinationWarehouseId = warehouseWaybillEntity . getDestinationWarehouseId ( ) ;
String destinationWarehouseName = warehouseWaybillEntity . getDestinationWarehouseName ( ) ;
Long waybillId = warehouseWaybillEntity . getId ( ) ;
List < AdvanceDetailEntity > detailEntityList = advanceDetailClient . findListByAdvanceId ( advanceId ) ;
for ( AdvanceDetailEntity advanceDetailEntity : detailEntityList ) {
String orderPackageCode = advanceDetailEntity . getUnitNo ( ) ;
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListClient . getListByOrderPackageCode ( orderPackageCode ) ;
for ( DistributionParcelListEntity parcelListEntity : parcelListEntityList ) {
Long warehouseId = parcelListEntity . getWarehouseId ( ) ;
parcelListEntity . setWaybillId ( waybillId + "" ) ;
parcelListEntity . setWaybillNumber ( waybillNo ) ;
parcelListEntity . setSendWarehouseId ( departureWarehouseId ) ;
parcelListEntity . setSendWarehouseName ( departureWarehouseName ) ;
parcelListEntity . setAcceptWarehouseId ( destinationWarehouseId ) ;
parcelListEntity . setAcceptWarehouseName ( destinationWarehouseName ) ;
parcelListEntity . setDealerCode ( dealerCode ) ;
parcelListEntity . setDealerName ( dealerName ) ;
if ( warehouseId . equals ( destinationWarehouseId ) ) {
parcelListEntity . setIsTransfer ( 0 ) ;
} else {
parcelListEntity . setIsTransfer ( 1 ) ;
}
distributionParcelListClient . update ( parcelListEntity ) ;
}
}
}
waybillNos . add ( waybillNo ) ;
}
String waybillNumber = null ;
String waybillNumberStr = null ;
for ( String waybillNo : waybillNos ) {
if ( StringUtil . isBlank ( waybillNumber ) ) {
waybillNumber = waybillNo ;
}
if ( StringUtil . isBlank ( waybillNumberStr ) ) {
waybillNumberStr = waybillNo ;
} else {
waybillNumberStr = waybillNumberStr + "," + waybillNo ;
}
}
if ( StringUtil . isNotBlank ( waybillNumber ) ) {
WarehouseWaybillEntity newWaybill = warehouseWaybillClient . findByWaybillNo ( waybillNumber ) ;
String consignee = newWaybill . getConsignee ( ) ;
String consigneeName = newWaybill . getConsigneeName ( ) ;
String consigneeMobile = newWaybill . getConsigneeMobile ( ) ;
String consigneeAddress = newWaybill . getConsigneeAddress ( ) ;
BasicdataClientEntity clientEntity = basicdataClientClient . findByName ( consignee ) ;
String consigneeCode = null ;
Long consigneeId = null ;
String peisongType = "1" ; //默认商配
if ( ! Objects . isNull ( clientEntity ) ) {
consigneeId = clientEntity . getId ( ) ;
consigneeCode = clientEntity . getClientCode ( ) ;
consignee = clientEntity . getClientName ( ) ;
peisongType = getPeisongTypeByClientId ( consigneeId ) ;
}
List < DistributionStockArticleEntity > stockArticleEntityList = distributionStockArticleClient . findListByOrderCode ( orderCode ) ;
for ( DistributionStockArticleEntity stockArticleEntity : stockArticleEntityList ) {
stockArticleEntity . setWaybillNumber ( waybillNumberStr ) ;
stockArticleEntity . setConsigneeUnit ( consignee ) ;
stockArticleEntity . setTypeService ( peisongType ) ;
stockArticleEntity . setConsigneePerson ( consigneeName ) ;
stockArticleEntity . setConsigneeMobile ( consigneeMobile ) ;
stockArticleEntity . setConsigneeAddress ( consigneeAddress ) ;
stockArticleEntity . setMallId ( consigneeId ) ;
stockArticleEntity . setMallCode ( consigneeCode ) ;
stockArticleEntity . setMallName ( consignee ) ;
distributionStockArticleClient . saveOrUpdate ( stockArticleEntity ) ;
}
}
}
@ -1677,6 +1777,10 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
String agent = wayBillEntity . getAgent ( ) ;
warehouseWaybill = new WarehouseWaybillEntity ( ) ;
warehouseWaybill . setTenantId ( TenantNum . HUITONGCODE ) ;
warehouseWaybill . setCreateUser ( 1714696768639311873L ) ;
warehouseWaybill . setUpdateUser ( 1714696768639311873L ) ;
warehouseWaybill . setCreateDept ( 1649331096241836033L ) ;
warehouseWaybill . setWaybillNo ( waybillNo ) ;
warehouseWaybill . setOrderNo ( wayBillEntity . getOrderNo ( ) ) ;
warehouseWaybill . setDestinationWarehouseName ( warehouseName ) ;
@ -1766,7 +1870,44 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
warehouseWaybill . setIsDeleted ( 0 ) ;
warehouseWaybill . setCreateTime ( date ) ;
warehouseWaybill . setUpdateTime ( date ) ;
warehouseWaybillClient . addEnntity ( warehouseWaybill ) ;
Long aLong = warehouseWaybillClient . addEnntity ( warehouseWaybill ) ;
if ( aLong ! = 0 ) {
List < WaybillDesEntity > desList = waybillDesClient . getDesList ( waybillNo ) ;
List < WarehouseWayBillDetail > warehouseWayBillDetails = new ArrayList < > ( ) ;
for ( WaybillDesEntity waybillDesEntity : desList ) {
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail ( ) ;
warehouseWayBillDetail . setCreateUser ( 1714696768639311873L ) ;
warehouseWayBillDetail . setUpdateUser ( 1714696768639311873L ) ;
warehouseWayBillDetail . setCreateDept ( 1649331096241836033L ) ;
warehouseWayBillDetail . setWaybillId ( aLong ) ;
warehouseWayBillDetail . setWaybillNo ( waybillNo ) ;
String goodsName = waybillDesEntity . getName ( ) ;
BasicdataCategoryEntity categoryEntity = categoryClient . findByName ( goodsName ) ;
if ( Objects . isNull ( categoryEntity ) ) {
categoryEntity = new BasicdataCategoryEntity ( ) ;
categoryEntity . setName ( goodsName ) ;
categoryEntity . setType ( 1 ) ;
categoryEntity . setTenantId ( TenantNum . HUITONGCODE ) ;
categoryEntity . setCreateUser ( 1714696768639311873L ) ;
categoryEntity . setUpdateUser ( 1714696768639311873L ) ;
categoryEntity . setCreateDept ( 1649331096241836033L ) ;
Long categoryId = categoryClient . addReturnId ( categoryEntity ) ;
warehouseWayBillDetail . setProductId ( categoryId ) ;
} else {
warehouseWayBillDetail . setProductId ( categoryEntity . getId ( ) ) ;
}
warehouseWayBillDetail . setProductName ( goodsName ) ;
warehouseWayBillDetail . setNum ( waybillDesEntity . getNum ( ) ) ;
warehouseWayBillDetail . setPrice ( waybillDesEntity . getPrice ( ) ) ;
warehouseWayBillDetail . setVolume ( waybillDesEntity . getVolume ( ) ) ;
warehouseWayBillDetail . setWeight ( waybillDesEntity . getWeight ( ) ) ;
warehouseWayBillDetail . setSubtotalFreight ( waybillDesEntity . getTotalDesPrice ( ) ) ;
warehouseWayBillDetail . setChargeType ( waybillDesEntity . getPic ( ) ) ;
warehouseWayBillDetails . add ( warehouseWayBillDetail ) ;
}
warehouseWaybillDetailClient . addList ( warehouseWayBillDetails ) ;
}
} else {
// warehouseWaybill.setStockCount(warehouseWaybill.getStockCount() + 1);
warehouseWaybill . setUpdateTime ( new Date ( ) ) ;