@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper ;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.fasterxml.jackson.core.JsonProcessingException ;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity ;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient ;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity ;
@ -20,28 +21,7 @@ import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO ;
import com.logpm.distribution.dto.app.StockupDTO ;
import com.logpm.distribution.dto.app.StockupZeroDTO ;
import com.logpm.distribution.entity.DisStockListDetailEntity ;
import com.logpm.distribution.entity.DistributionBillLadingScanEntity ;
import com.logpm.distribution.entity.DistributionDeliveryDetailsEntity ;
import com.logpm.distribution.entity.DistributionDeliveryListEntity ;
import com.logpm.distribution.entity.DistributionLoadscanEntity ;
import com.logpm.distribution.entity.DistributionLoadscaninvnEntity ;
import com.logpm.distribution.entity.DistributionParcelListEntity ;
import com.logpm.distribution.entity.DistributionParcelNumberEntity ;
import com.logpm.distribution.entity.DistributionReservationEntity ;
import com.logpm.distribution.entity.DistributionReservationPackageEntity ;
import com.logpm.distribution.entity.DistributionReservationStockarticleEntity ;
import com.logpm.distribution.entity.DistributionReservationStocklistEntity ;
import com.logpm.distribution.entity.DistributionReservationZeroPackageEntity ;
import com.logpm.distribution.entity.DistributionSignforEntity ;
import com.logpm.distribution.entity.DistributionStockArticleEntity ;
import com.logpm.distribution.entity.DistributionStockEntity ;
import com.logpm.distribution.entity.DistributionStockListEntity ;
import com.logpm.distribution.entity.DistributionStockupEntity ;
import com.logpm.distribution.entity.DistributionStockupInfoEntity ;
import com.logpm.distribution.entity.DistrilbutionBillLadingEntity ;
import com.logpm.distribution.entity.DistrilbutionBillPackageEntity ;
import com.logpm.distribution.entity.DistrilbutionBillStockEntity ;
import com.logpm.distribution.entity.* ;
import com.logpm.distribution.mapper.DistributionBillLadingScanMapper ;
import com.logpm.distribution.mapper.DistributionDeliveryDetailsMapper ;
import com.logpm.distribution.mapper.DistributionDeliveryListMapper ;
@ -125,13 +105,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation ;
import org.springframework.transaction.annotation.Transactional ;
import java.security.NoSuchAlgorithmException ;
import java.text.SimpleDateFormat ;
import java.util.ArrayList ;
import java.util.Date ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
import java.util.Objects ;
import java.util.* ;
import java.util.concurrent.atomic.AtomicBoolean ;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.concurrent.atomic.AtomicReference ;
@ -200,6 +176,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
private final ISysClient sysClient ;
private final ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient ;
private final IDistributionPrintService distributionPrintService ;
@ -3020,6 +2997,80 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
}
@Override
public void sendFactorySignforInfo ( String s ) {
try {
MtReceiveDTO mtReceiveDTO = new MtReceiveDTO ( ) ;
List < DistrilbutionBillStockEntity > list = distrilbutionBillStockService . list ( Wrappers . < DistrilbutionBillStockEntity > query ( ) . lambda ( )
. eq ( DistrilbutionBillStockEntity : : getBillLadingId , s )
. apply ( "order_status in ( '1' , '3')" )
) ;
List < MtReceiveContentDTO > mtReceiveContentDTOList = new ArrayList < > ( ) ;
List < String > consigneePerson = new ArrayList < > ( ) ;
for ( DistrilbutionBillStockEntity distrilbutionBillStock : list ) {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService . getById ( distrilbutionBillStock . getStockArticleId ( ) ) ;
List < MtReceiveContentDTO > mtReceiveContentDTOS = handlePushFactorySignforInfo ( stockArticleEntity , s ) ;
if ( ! mtReceiveContentDTOS . isEmpty ( ) ) {
mtReceiveContentDTOList . addAll ( mtReceiveContentDTOS ) ;
}
consigneePerson . add ( stockArticleEntity . getConsigneePerson ( ) ) ;
}
mtReceiveDTO . setSendTaskId ( s ) ;
mtReceiveDTO . setReceiver ( consigneePerson . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ) ;
mtReceiveDTO . setReceiveContentList ( mtReceiveContentDTOList ) ;
List < MtReceiveImagesDTO > mtReceiveImagesDTOS = new ArrayList < > ( ) ;
List < DistributionPrintEntity > list1 = distributionPrintService . list ( Wrappers . < DistributionPrintEntity > query ( ) . lambda ( )
. eq ( DistributionPrintEntity : : getBillLadingId , s )
) ;
for ( DistributionPrintEntity distributionPrintEntity : list1 ) {
MtReceiveImagesDTO mtReceiveImagesDTO = new MtReceiveImagesDTO ( ) ;
if ( ! distributionPrintEntity . getSite ( ) . contains ( "blob" ) ) {
mtReceiveImagesDTO . setImage ( distributionPrintEntity . getSite ( ) ) ;
mtReceiveImagesDTOS . add ( mtReceiveImagesDTO ) ;
}
}
orderMainClinet . sendReceiveInfoByNewSystem ( mtReceiveDTO ) ;
} catch ( Exception e ) {
log . error ( "回传工厂数据失败" , e ) ;
}
}
private List < MtReceiveContentDTO > handlePushFactorySignforInfo ( DistributionStockArticleEntity stockArticleEntity , String s ) {
//其他品牌用","拼接
String brand = "梦天" ;
List < String > list = Arrays . asList ( brand . split ( "," ) ) ;
List < MtReceiveContentDTO > mtReceiveContentDTOS = new ArrayList < > ( ) ;
if ( list . isEmpty ( ) ) {
Iterator < String > iterator = list . iterator ( ) ;
while ( iterator . hasNext ( ) ) {
String next = iterator . next ( ) ;
if ( stockArticleEntity . getBrand ( ) . contains ( next ) ) {
//查询此订单所有签收信息
List < DistributionBillLadingScanEntity > ladingScanEntities = distributionBillLadingScanMapper . selectList ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. eq ( DistributionBillLadingScanEntity : : getBillLadingId , s )
. eq ( DistributionBillLadingScanEntity : : getStockArticleId , stockArticleEntity . getId ( ) )
) ;
//处理数据构建
SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.sss" ) ;
if ( ! ladingScanEntities . isEmpty ( ) ) {
for ( DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities ) {
MtReceiveContentDTO mtReceiveContentDTO = new MtReceiveContentDTO ( ) ;
mtReceiveContentDTO . setWarehouse ( stockArticleEntity . getWarehouse ( ) + "" ) ;
mtReceiveContentDTO . setOrderCode ( stockArticleEntity . getOrderCode ( ) ) ;
mtReceiveContentDTO . setUnitNo ( ladingScanEntity . getPacketBarCode ( ) ) ;
mtReceiveContentDTO . setOperateDate ( simpleDateFormat . format ( ladingScanEntity . getCreateTime ( ) ) ) ;
mtReceiveContentDTO . setWaybillNumber ( stockArticleEntity . getWaybillNumber ( ) ) ;
}
}
}
}
}
return mtReceiveContentDTOS ;
}
private JSONObject handleLogJSONObject ( BasicdataWarehouseEntity warehouse , BladeUser user , String orderPackageCode , String content , Integer node ) {
JSONObject trunklinePackageTrackLog = new JSONObject ( ) ;
trunklinePackageTrackLog . put ( "tenantId" , user . getTenantId ( ) ) ;