|
|
@ -39,15 +39,17 @@ public class ProductReceiptNoteConverter : IOutgoingConverter |
|
|
|
foreach (var outgoingFromWms in outgoingFromWmsList) |
|
|
|
{ |
|
|
|
var wmsReceipt = JsonSerializer.Deserialize<ProductReceiptNoteDTO>(outgoingFromWms.DataContent); |
|
|
|
int index=0;//为了处理相同number下存在相同零件号的问题。系统自动在number后添加index,如果只有一条明细就不添加。
|
|
|
|
foreach (var detail in wmsReceipt.Details) |
|
|
|
{ |
|
|
|
string number = index > 0 ? wmsReceipt.Number + index.ToString() : wmsReceipt.Number; |
|
|
|
var outgoingToExternal = new OutgoingToExternal() |
|
|
|
{ |
|
|
|
DataType = outgoingFromWms.DataType, |
|
|
|
DataAction = outgoingFromWms.DataAction, |
|
|
|
SourceSystem = EnumSystemType.WMS.ToString(), |
|
|
|
SourceDataId = detail.Id.ToString(), |
|
|
|
SourceDataGroupCode = wmsReceipt.Number, |
|
|
|
SourceDataGroupCode = number, |
|
|
|
SourceDataDetailCode = detail.PackingCode, |
|
|
|
Writer = nameof(TyrpOutgoingBackgroundWorker), |
|
|
|
DestinationSystem = EnumSystemType.ERP.ToString(), |
|
|
@ -57,10 +59,11 @@ public class ProductReceiptNoteConverter : IOutgoingConverter |
|
|
|
|
|
|
|
var exchangeReceipt = await BuildProductReceiptNoteExchangeDtoAsync(wmsReceipt, detail).ConfigureAwait(false); |
|
|
|
outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceipt); |
|
|
|
var ret = BuildProductReceiptNote(exchangeReceipt); |
|
|
|
var ret = BuildProductReceiptNote(exchangeReceipt, number); |
|
|
|
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(ret); |
|
|
|
|
|
|
|
outgoingToExternalList.Add(outgoingToExternal); |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
//插入到中间表OutgoingToExternal
|
|
|
@ -70,12 +73,12 @@ public class ProductReceiptNoteConverter : IOutgoingConverter |
|
|
|
return outgoingToExternalList; |
|
|
|
} |
|
|
|
|
|
|
|
private ProductReceiptNote BuildProductReceiptNote(ProductReceiptNoteExchangeDto exchangeProductReceiptNote) |
|
|
|
private ProductReceiptNote BuildProductReceiptNote(ProductReceiptNoteExchangeDto exchangeProductReceiptNote,string number) |
|
|
|
{ |
|
|
|
var detail = exchangeProductReceiptNote.Detail; |
|
|
|
var ret = new ProductReceiptNote() |
|
|
|
{ |
|
|
|
mesout_ref_nbr = exchangeProductReceiptNote.Number, |
|
|
|
mesout_ref_nbr = number,//exchangeProductReceiptNote.Number,
|
|
|
|
mesout_id = string.IsNullOrEmpty(detail.RawLocationCode)?"": detail.RawLocationCode, |
|
|
|
mesout_part = detail.ItemCode, |
|
|
|
mesout_date = exchangeProductReceiptNote.ActiveDate.ToString("yyyyMMdd"), |
|
|
|