|
@ -7,6 +7,7 @@ using Win_in.Sfs.Wms.DataExchange.Domain; |
|
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; |
|
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; |
|
|
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; |
|
|
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; |
|
|
using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseReceipt; |
|
|
using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseReceipt; |
|
|
|
|
|
using Win_in.Sfs.Wms.DataExchange.WMS.PutawayNote; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent; |
|
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent; |
|
@ -18,6 +19,7 @@ public class ArriveConverter : IOutgoingConverter |
|
|
private readonly ISupplierAsnAppService _supplierAsnAppService; |
|
|
private readonly ISupplierAsnAppService _supplierAsnAppService; |
|
|
private readonly IObjectMapper _objectMapper; |
|
|
private readonly IObjectMapper _objectMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ArriveConverter( |
|
|
public ArriveConverter( |
|
|
IOutgoingFromWmsManager outgoingFromWmsManager |
|
|
IOutgoingFromWmsManager outgoingFromWmsManager |
|
|
, IOutgoingToExternalManager outgoingToExternalManager |
|
|
, IOutgoingToExternalManager outgoingToExternalManager |
|
@ -35,11 +37,11 @@ public class ArriveConverter : IOutgoingConverter |
|
|
{ |
|
|
{ |
|
|
var outgoingToExternalList = new List<OutgoingToExternal>(); |
|
|
var outgoingToExternalList = new List<OutgoingToExternal>(); |
|
|
|
|
|
|
|
|
var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.PurchaseReceipt, EnumSystemType.EOS).ConfigureAwait(false); |
|
|
var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.Putaway, EnumSystemType.EOS).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
foreach (var outgoingFromWms in outgoingFromWmsList) |
|
|
foreach (var outgoingFromWms in outgoingFromWmsList) |
|
|
{ |
|
|
{ |
|
|
var wmsReceipt = JsonSerializer.Deserialize<PurchaseReceiptNoteDTO>(outgoingFromWms.DataContent); |
|
|
var wmsReceipt = JsonSerializer.Deserialize<PutawayNoteDTO>(outgoingFromWms.DataContent); |
|
|
foreach (var detail in wmsReceipt.Details) |
|
|
foreach (var detail in wmsReceipt.Details) |
|
|
{ |
|
|
{ |
|
|
var outgoingToExternal = new OutgoingToExternal() |
|
|
var outgoingToExternal = new OutgoingToExternal() |
|
@ -49,14 +51,14 @@ public class ArriveConverter : IOutgoingConverter |
|
|
SourceSystem = EnumSystemType.WMS.ToString(), |
|
|
SourceSystem = EnumSystemType.WMS.ToString(), |
|
|
SourceDataId = detail.Id.ToString(), |
|
|
SourceDataId = detail.Id.ToString(), |
|
|
SourceDataGroupCode = wmsReceipt.Number, |
|
|
SourceDataGroupCode = wmsReceipt.Number, |
|
|
SourceDataDetailCode = detail.PackingCode, |
|
|
SourceDataDetailCode = detail.ToPackingCode, |
|
|
Writer = nameof(EosOutgoingBackgroundWorker), |
|
|
Writer = nameof(EosOutgoingBackgroundWorker), |
|
|
DestinationSystem = EnumSystemType.SCP.ToString(), |
|
|
DestinationSystem = EnumSystemType.EOS.ToString(), |
|
|
DestinationDataId = "", |
|
|
DestinationDataId = "", |
|
|
}; |
|
|
}; |
|
|
outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); |
|
|
outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); |
|
|
|
|
|
|
|
|
var exchangeReceipt = await BuildPurchaseReceiptExchangeDtoAsync(wmsReceipt, detail).ConfigureAwait(false); |
|
|
var exchangeReceipt = await BuildPutawayExchangeDtoAsync(wmsReceipt, detail).ConfigureAwait(false); |
|
|
outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceipt); |
|
|
outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceipt); |
|
|
var arrive = BuildArrive(exchangeReceipt); |
|
|
var arrive = BuildArrive(exchangeReceipt); |
|
|
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); |
|
|
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); |
|
@ -71,25 +73,25 @@ public class ArriveConverter : IOutgoingConverter |
|
|
return outgoingToExternalList; |
|
|
return outgoingToExternalList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static ArriveNote BuildArrive(PurchaseReceiptNoteExchangeDto exchangeReceipt) |
|
|
private ArriveNote BuildArrive(PutawayNoteExchangeDto exchangeReceipt) |
|
|
{ |
|
|
{ |
|
|
var detail = exchangeReceipt.Detail; |
|
|
var detail = exchangeReceipt.Detail; |
|
|
var arrive = new ArriveNote() |
|
|
var arrive = new ArriveNote() |
|
|
{ |
|
|
{ |
|
|
PlanBillNo = exchangeReceipt.PoNumber, |
|
|
PlanBillNo = detail.PoNumber, |
|
|
ShipBillNo = exchangeReceipt.AsnNumber, |
|
|
ShipBillNo = detail.AsnNumber, |
|
|
DocNo = exchangeReceipt.Number, |
|
|
DocNo = exchangeReceipt.Number, |
|
|
DetailMatNo = detail.PackingCode, |
|
|
DetailMatNo = detail.ToPackingCode, |
|
|
ERP = detail.ItemCode, |
|
|
ERP = detail.ItemCode, |
|
|
Qty = detail.Qty, |
|
|
Qty = detail.ShippedQty, |
|
|
HgQty = detail.Qty, |
|
|
HgQty = detail.Qty, |
|
|
ProductDate = detail.ProduceDate, |
|
|
ProductDate = detail.ProduceDate, |
|
|
ProductBatch = detail.Lot, |
|
|
ProductBatch = detail.ToLot, |
|
|
Loc = detail.LocationErpCode, |
|
|
Loc = detail.ToLocationErpCode, |
|
|
ShipDate = exchangeReceipt.ShipDate, |
|
|
ShipDate = detail.ShipDate, |
|
|
ShipBillState = 0, |
|
|
ShipBillState = 0, |
|
|
SupplierCode = exchangeReceipt.SupplierCode, |
|
|
SupplierCode = detail.SupplierCode, |
|
|
PlanUserCode = exchangeReceipt.ContactName, |
|
|
PlanUserCode = detail.PlanUserCode,//筹措员
|
|
|
EosState = 0, |
|
|
EosState = 0, |
|
|
// EosDate = DateTime.MinValue,
|
|
|
// EosDate = DateTime.MinValue,
|
|
|
WmsDate = DateTime.Now, |
|
|
WmsDate = DateTime.Now, |
|
@ -98,14 +100,11 @@ public class ArriveConverter : IOutgoingConverter |
|
|
return arrive; |
|
|
return arrive; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task<PurchaseReceiptNoteExchangeDto> BuildPurchaseReceiptExchangeDtoAsync(PurchaseReceiptNoteDTO wmsReceipt, PurchaseReceiptNoteDetailDTO wmsReceiptDetail) |
|
|
private Task<PutawayNoteExchangeDto> BuildPutawayExchangeDtoAsync(PutawayNoteDTO wmsReceipt, PutawayNoteDetailDTO wmsReceiptDetail) |
|
|
{ |
|
|
{ |
|
|
var exchangeReceipt = _objectMapper.Map<PurchaseReceiptNoteDTO, PurchaseReceiptNoteExchangeDto>(wmsReceipt); |
|
|
var exchangeReceipt = _objectMapper.Map<PutawayNoteDTO, PutawayNoteExchangeDto>(wmsReceipt); |
|
|
var exchangeReceiptDetail = _objectMapper.Map<PurchaseReceiptNoteDetailDTO, PurchaseReceiptNoteDetailExchangeDto>(wmsReceiptDetail); |
|
|
var exchangeReceiptDetail = _objectMapper.Map<PutawayNoteDetailDTO, PutawayNoteDetailExchangeDto>(wmsReceiptDetail); |
|
|
var asn = await _supplierAsnAppService.GetByNumberAsync(exchangeReceipt.AsnNumber).ConfigureAwait(false); |
|
|
|
|
|
exchangeReceipt.ShipDate = asn?.ShipDate; |
|
|
|
|
|
exchangeReceipt.ContactName = asn == null ? "" : asn.ContactName; |
|
|
|
|
|
exchangeReceipt.Detail = exchangeReceiptDetail; |
|
|
exchangeReceipt.Detail = exchangeReceiptDetail; |
|
|
return exchangeReceipt; |
|
|
return Task.FromResult(exchangeReceipt); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|