|
|
@ -11,6 +11,7 @@ using Win_in.Sfs.Wms.DataExchange.Domain; |
|
|
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; |
|
|
|
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; |
|
|
|
using Win_in.Sfs.Wms.DataExchange.WMS.SuppplierAsn; |
|
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent; |
|
|
|
|
|
|
@ -22,12 +23,14 @@ public class ShipReader : IReader |
|
|
|
private readonly ILogger<ShipReader> _logger; |
|
|
|
private readonly ISupplierItemAppService _supplierItemAppService; |
|
|
|
private readonly ISupplierAppService _supplierAppService; |
|
|
|
private readonly IPurchaseOrderAppService _purchaseOrderAppService; |
|
|
|
public ShipReader( |
|
|
|
IShipManager shipManager |
|
|
|
, IIncomingFromExternalManager incomingFromExternalManager |
|
|
|
, ILogger<ShipReader> logger, |
|
|
|
ISupplierItemAppService supplierItemAppService, |
|
|
|
ISupplierAppService supplierAppService |
|
|
|
ISupplierAppService supplierAppService, |
|
|
|
IPurchaseOrderAppService purchaseOrderAppService |
|
|
|
) |
|
|
|
{ |
|
|
|
_shipManager = shipManager; |
|
|
@ -35,6 +38,7 @@ public class ShipReader : IReader |
|
|
|
_logger = logger; |
|
|
|
_supplierItemAppService = supplierItemAppService; |
|
|
|
_supplierAppService = supplierAppService; |
|
|
|
_purchaseOrderAppService=purchaseOrderAppService; |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
|
|
@ -52,6 +56,13 @@ public class ShipReader : IReader |
|
|
|
{ |
|
|
|
toBeProcessedShips = toBeProcessedShips.Where(r => !shipbillno.Contains(r.ShipBillNo)).ToList(); |
|
|
|
} |
|
|
|
//排除没有订单号的收货单(被排出的下次同步)
|
|
|
|
var pobilllist= toBeProcessedShips.Select(r => r.PlanBillNo).Distinct().ToList(); |
|
|
|
var ponumber =await _purchaseOrderAppService.GetNoPoBillList(pobilllist).ConfigureAwait(false); |
|
|
|
if(ponumber.Count > 0) |
|
|
|
{ |
|
|
|
toBeProcessedShips = toBeProcessedShips.Where(r => !ponumber.Contains(r.PlanBillNo)).ToList(); |
|
|
|
} |
|
|
|
//Ship逐一转换为SupplierAsn
|
|
|
|
var incomingDataList = await BuildIncomingFromExternalFromShipAsync(toBeProcessedShips).ConfigureAwait(false); |
|
|
|
await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); |
|
|
|