@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper ;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils ;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils ;
import com.baomidou.mybatisplus.core.toolkit.StringUtils ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.fasterxml.jackson.core.JsonProcessingException ;
import com.fasterxml.jackson.core.JsonProcessingException ;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity ;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity ;
@ -180,7 +181,6 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
private final IDistributionPrintService distributionPrintService ;
private final IDistributionPrintService distributionPrintService ;
// private final
// private final
@Override
@Override
@ -1600,11 +1600,8 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
ouPaiFactoryClinet . newSystemHandleStatusData ( orderStatusDTO ) ;
ouPaiFactoryClinet . newSystemHandleStatusData ( orderStatusDTO ) ;
log . info ( ">>>>>>>>>>>>>>>>>进入newSystemHandleStatusData orderStatusDTO值 :{}" , orderStatusDTO ) ;
log . info ( ">>>>>>>>>>>>>>>>>进入newSystemHandleStatusData orderStatusDTO值 :{}" , orderStatusDTO ) ;
}
}
}
}
// orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO);
// orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO);
}
}
if ( Func . isNotEmpty ( brand . get ( "志邦" ) ) ) {
if ( Func . isNotEmpty ( brand . get ( "志邦" ) ) ) {
@ -1636,7 +1633,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
for ( MtReceiveContentDTO mtReceiveContentDTO : zb ) {
for ( MtReceiveContentDTO mtReceiveContentDTO : zb ) {
try {
try {
// 发送入库消息
// 发送入库消息
com . logpm . distribution . dto . OrderStatusDTO orderStatusDTO = new com . logpm . distribution . dto . OrderStatusDTO ( ) ;
OrderStatusDTO orderStatusDTO = new OrderStatusDTO ( ) ;
// 通过包件id 查询包件
// 通过包件id 查询包件
orderStatusDTO . setUnitNo ( mtReceiveContentDTO . getUnitNo ( ) ) ;
orderStatusDTO . setUnitNo ( mtReceiveContentDTO . getUnitNo ( ) ) ;
orderStatusDTO . setOrderNo ( mtReceiveContentDTO . getOrderCode ( ) ) ;
orderStatusDTO . setOrderNo ( mtReceiveContentDTO . getOrderCode ( ) ) ;
@ -2908,6 +2905,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
}
}
return null ;
return null ;
}
}
@ChangeAsync ( )
@ChangeAsync ( )
@Override
@Override
public void saveOtherDataBaseNew ( String tenantId , List < DistributionBusinessPreOrderEntity > dataResult , String mallName ) {
public void saveOtherDataBaseNew ( String tenantId , List < DistributionBusinessPreOrderEntity > dataResult , String mallName ) {
@ -3058,7 +3056,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
}
}
@Override
@Override
public void sendFactorySignforInfo ( String s ) {
public void sendFactorySignforInfo ( String s , BasicdataWarehouseEntity warehouse , BladeUser user ) {
try {
try {
MtReceiveDTO mtReceiveDTO = new MtReceiveDTO ( ) ;
MtReceiveDTO mtReceiveDTO = new MtReceiveDTO ( ) ;
List < DistrilbutionBillStockEntity > list = distrilbutionBillStockService . list ( Wrappers . < DistrilbutionBillStockEntity > query ( ) . lambda ( )
List < DistrilbutionBillStockEntity > list = distrilbutionBillStockService . list ( Wrappers . < DistrilbutionBillStockEntity > query ( ) . lambda ( )
@ -3067,16 +3065,65 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
) ;
) ;
List < MtReceiveContentDTO > mtReceiveContentDTOList = new ArrayList < > ( ) ;
List < MtReceiveContentDTO > mtReceiveContentDTOList = new ArrayList < > ( ) ;
List < String > consigneePerson = new ArrayList < > ( ) ;
List < String > consigneePerson = new ArrayList < > ( ) ;
for ( DistrilbutionBillStockEntity distrilbutionBillStock : list ) {
if ( ! list . isEmpty ( ) ) {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService . getById ( distrilbutionBillStock . getStockArticleId ( ) ) ;
List < Long > orderIds = list . stream ( ) . map ( DistrilbutionBillStockEntity : : getStockArticleId ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
List < MtReceiveContentDTO > mtReceiveContentDTOS = handlePushFactorySignforInfo ( stockArticleEntity , s ) ;
handlePushFactoryOrderIds ( orderIds , s , warehouse , user ) ;
if ( ! mtReceiveContentDTOS . isEmpty ( ) ) {
}
mtReceiveContentDTOList . addAll ( mtReceiveContentDTOS ) ;
} catch ( Exception e ) {
log . error ( "回传工厂数据失败" , e ) ;
}
}
private void handlePushFactoryOrderIds ( List < Long > orderIds , String s , BasicdataWarehouseEntity warehouse , BladeUser user ) {
if ( ! orderIds . isEmpty ( ) ) {
List < DistributionStockArticleEntity > distributionStockArticleEntities = distributionStockArticleService . list ( Wrappers . < DistributionStockArticleEntity > query ( ) . lambda ( )
. eq ( DistributionStockArticleEntity : : getWarehouseId , warehouse . getId ( ) )
. in ( DistributionStockArticleEntity : : getId , orderIds )
) ;
if ( ! distributionStockArticleEntities . isEmpty ( ) ) {
List < DistributionStockArticleEntity > orderList1 = distributionStockArticleEntities . stream ( ) . filter ( f - > ! StringUtils . isBlank ( f . getBrand ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( ! orderList1 . isEmpty ( ) ) {
Map < String , List < DistributionStockArticleEntity > > orderMap = orderList1 . stream ( ) . collect ( Collectors . groupingBy ( DistributionStockArticleEntity : : getBrand ) ) ;
orderMap . forEach ( ( k , v ) - > {
try {
if ( k . equals ( "梦天" ) ) {
MtReceiveDTO mtReceiveDTO = new MtReceiveDTO ( ) ;
//目前处理梦天
List < DistributionStockArticleEntity > orderList2 = orderMap . get ( k ) ;
//查询此订单所有签收信息
List < DistributionBillLadingScanEntity > ladingScanEntities = distributionBillLadingScanMapper . selectList ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. eq ( DistributionBillLadingScanEntity : : getBillLadingId , Long . parseLong ( s ) )
. eq ( DistributionBillLadingScanEntity : : getStockArticleId , orderList2 . stream ( ) . map ( DistributionStockArticleEntity : : getId ) . collect ( Collectors . toList ( ) ) )
) ;
Map < Long , List < DistributionStockArticleEntity > > mtOrderMap = orderList2 . stream ( ) . collect ( Collectors . groupingBy ( DistributionStockArticleEntity : : getId ) ) ;
//处理数据构建
SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.sss" ) ;
List < MtReceiveContentDTO > mtReceiveContentDTOList = new ArrayList < > ( ) ;
if ( ! ladingScanEntities . isEmpty ( ) ) {
for ( DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities ) {
List < DistributionStockArticleEntity > orderInfo = mtOrderMap . get ( ladingScanEntity . getStockArticleId ( ) ) ;
if ( orderInfo . isEmpty ( ) ) {
log . error ( ">>>>>>>>>>>>>>>>自提查询订单信息失败:{}" , s ) ;
continue ;
}
if ( orderInfo . size ( ) > 1 ) {
log . error ( ">>>>>>>>>>>>>>>>自提查询订单出现多个订单信息:{}" , s ) ;
continue ;
}
MtReceiveContentDTO mtReceiveContentDTO = new MtReceiveContentDTO ( ) ;
mtReceiveContentDTO . setWarehouse ( orderInfo . get ( 0 ) . getWarehouse ( ) + "" ) ;
mtReceiveContentDTO . setOrderCode ( orderInfo . get ( 0 ) . getOrderCode ( ) ) ;
mtReceiveContentDTO . setUnitNo ( ladingScanEntity . getPacketBarCode ( ) ) ;
mtReceiveContentDTO . setOperateDate ( simpleDateFormat . format ( ladingScanEntity . getCreateTime ( ) ) ) ;
mtReceiveContentDTO . setWaybillNumber ( orderInfo . get ( 0 ) . getWaybillNumber ( ) ) ;
mtReceiveContentDTOList . add ( mtReceiveContentDTO ) ;
}
}
consigneePerson . add ( stockArticleEntity . getConsigneePerson ( ) ) ;
}
}
mtReceiveDTO . setSendTaskId ( s ) ;
mtReceiveDTO . setSendTaskId ( s ) ;
mtReceiveDTO . setReceiver ( consigneePerson . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ) ;
mtReceiveDTO . setReceiver ( orderList2 . stream ( ) . map ( DistributionStockArticleEntity : : getConsigneePerson ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ) ;
mtReceiveDTO . setReceiveContentList ( mtReceiveContentDTOList ) ;
mtReceiveDTO . setReceiveContentList ( mtReceiveContentDTOList ) ;
List < MtReceiveImagesDTO > mtReceiveImagesDTOS = new ArrayList < > ( ) ;
List < MtReceiveImagesDTO > mtReceiveImagesDTOS = new ArrayList < > ( ) ;
List < DistributionPrintEntity > list1 = distributionPrintService . list ( Wrappers . < DistributionPrintEntity > query ( ) . lambda ( )
List < DistributionPrintEntity > list1 = distributionPrintService . list ( Wrappers . < DistributionPrintEntity > query ( ) . lambda ( )
@ -3090,9 +3137,121 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
}
}
}
}
orderMainClinet . sendReceiveInfoByNewSystem ( mtReceiveDTO ) ;
orderMainClinet . sendReceiveInfoByNewSystem ( mtReceiveDTO ) ;
}
if ( k . equals ( "欧派" ) ) {
//查询此订单所有签收信息
List < DistributionStockArticleEntity > orderList3 = orderMap . get ( k ) ;
List < DistributionBillLadingScanEntity > ladingScanEntities = distributionBillLadingScanMapper . selectList ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. eq ( DistributionBillLadingScanEntity : : getBillLadingId , Long . parseLong ( s ) )
. eq ( DistributionBillLadingScanEntity : : getStockArticleId , orderList3 . stream ( ) . map ( DistributionStockArticleEntity : : getId ) . collect ( Collectors . toList ( ) ) )
) ;
if ( ! ladingScanEntities . isEmpty ( ) ) {
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.sss" ) ;
for ( DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities ) {
OrderStatusDTO orderStatusDTO = new OrderStatusDTO ( ) ;
orderStatusDTO . setUnitNo ( ladingScanEntity . getPacketBarCode ( ) ) ; //单号
orderStatusDTO . setUsername ( ladingScanEntity . getScanUser ( ) ) ; //操作人名称
orderStatusDTO . setStatus ( "7" ) ;
orderStatusDTO . setOperationTime ( sdf . format ( ladingScanEntity . getCreateTime ( ) ) ) ; //时间
ouPaiFactoryClinet . newSystemHandleStatusData ( orderStatusDTO ) ;
}
}
}
if ( k . equals ( "皮阿诺" ) ) {
List < DistributionStockArticleEntity > orderList3 = orderMap . get ( k ) ;
List < DistributionBillLadingScanEntity > ladingScanEntities = distributionBillLadingScanMapper . selectList ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. eq ( DistributionBillLadingScanEntity : : getBillLadingId , Long . parseLong ( s ) )
. eq ( DistributionBillLadingScanEntity : : getStockArticleId , orderList3 . stream ( ) . map ( DistributionStockArticleEntity : : getId ) . collect ( Collectors . toList ( ) ) )
) ;
if ( ! ladingScanEntities . isEmpty ( ) ) {
for ( DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities ) {
OrderStatusDTO orderStatusDTO = new OrderStatusDTO ( ) ;
// 通过包件id 查询包件
orderStatusDTO . setUnitNo ( ladingScanEntity . getPacketBarCode ( ) ) ;
orderStatusDTO . setOrderNo ( ladingScanEntity . getOrderSelfNumbering ( ) ) ;
orderStatusDTO . setStatus ( "7" ) ;
orderStatusDTO . setOperationTime ( DateUtil . now ( ) ) ;
orderStatusDTO . setCurrentWarehouse ( warehouse . getId ( ) . toString ( ) ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "messageData" , JSONUtil . toJsonStr ( orderStatusDTO ) ) ;
rabbitTemplate . convertAndSend ( RabbitConstant . HWY_ORDER_STATUS_EXCHANGE , RabbitConstant . HWY_ORDER_STATUS_ROUTING , map ) ;
}
}
}
if ( k . equals ( "我乐" ) ) {
List < DistributionStockArticleEntity > orderList3 = orderMap . get ( k ) ;
List < DistributionBillLadingScanEntity > ladingScanEntities = distributionBillLadingScanMapper . selectList ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. eq ( DistributionBillLadingScanEntity : : getBillLadingId , Long . parseLong ( s ) )
. eq ( DistributionBillLadingScanEntity : : getStockArticleId , orderList3 . stream ( ) . map ( DistributionStockArticleEntity : : getId ) . collect ( Collectors . toList ( ) ) )
) ;
List < Object > contents = new ArrayList < > ( ) ;
if ( ! ladingScanEntities . isEmpty ( ) ) {
Map < String , List < DistributionStockArticleEntity > > listMap = orderList3 . stream ( ) . collect ( Collectors . groupingBy ( DistributionStockArticleEntity : : getOrderCode ) ) ;
for ( DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities ) {
PushData pushData = PushData . builder ( )
. packageCode ( ladingScanEntity . getPacketBarCode ( ) )
. orderCode ( ladingScanEntity . getOrderSelfNumbering ( ) )
. warehouseName ( warehouse . getName ( ) )
. waybillNumber ( listMap . get ( ladingScanEntity . getOrderSelfNumbering ( ) ) . get ( 0 ) . getWaybillNumber ( ) ) . build ( ) ;
contents . add ( pushData ) ;
}
}
NodePushMsg msg = new NodePushMsg ( ) ;
msg . setNode ( WorkNodeEnums . CLERK_REVIEW ) ;
msg . setBrand ( BrandEnums . OLO ) ;
msg . setOperator ( user . getNickName ( ) ) ;
msg . setOperatorTime ( new Date ( ) ) ;
msg . setContent ( contents ) ;
log . info ( "推送工厂数据:{}" , JSONUtil . toJsonStr ( msg ) ) ;
factoryDataMessageSender . sendNodeDataByBrand ( msg ) ;
}
if ( k . equals ( "志邦" ) ) {
List < DistributionStockArticleEntity > orderList3 = orderMap . get ( k ) ;
List < DistributionBillLadingScanEntity > ladingScanEntities = distributionBillLadingScanMapper . selectList ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. eq ( DistributionBillLadingScanEntity : : getBillLadingId , Long . parseLong ( s ) )
. eq ( DistributionBillLadingScanEntity : : getStockArticleId , orderList3 . stream ( ) . map ( DistributionStockArticleEntity : : getId ) . collect ( Collectors . toList ( ) ) )
) ;
List < Object > contents = new ArrayList < > ( ) ;
if ( ! ladingScanEntities . isEmpty ( ) ) {
for ( DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities ) {
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "packageCode" , ladingScanEntity . getPacketBarCode ( ) ) ;
contents . add ( jsonObject ) ;
}
}
NodePushMsg msg = new NodePushMsg ( ) ;
msg . setNode ( WorkNodeEnums . CLERK_REVIEW ) ;
msg . setBrand ( BrandEnums . ZB ) ;
msg . setOperator ( user . getNickName ( ) ) ;
msg . setOperatorTime ( new Date ( ) ) ;
msg . setContent ( contents ) ;
log . info ( "推送工厂数据:{}" , JSONUtil . toJsonStr ( msg ) ) ;
factoryDataMessageSender . sendNodeDataByBrand ( msg ) ;
}
} catch ( Exception e ) {
} catch ( Exception e ) {
log . error ( "回传工厂数据失败" , e ) ;
log . error ( "推送工厂数据错误,当前工厂:{},异常:{}" , k , e ) ;
}
} ) ;
}
}
}
}
}
}
private List < MtReceiveContentDTO > handlePushFactorySignforInfo ( DistributionStockArticleEntity stockArticleEntity , String s ) {
private List < MtReceiveContentDTO > handlePushFactorySignforInfo ( DistributionStockArticleEntity stockArticleEntity , String s ) {