|
|
@ -33,17 +33,8 @@ public class UnplannedReceiptNoteEventHandler |
|
|
|
[UnitOfWork] |
|
|
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<UnplannedReceiptNote>> eventData) |
|
|
|
{ |
|
|
|
var entities = eventData.Entity; |
|
|
|
List<UnplannedReceiptNote> notelist = new List<UnplannedReceiptNote>(); |
|
|
|
foreach (var entity in entities) |
|
|
|
{ |
|
|
|
if (entity.Details != null && entity.Details.Count > 0) |
|
|
|
{ |
|
|
|
var copy = CopyEntity(entity); |
|
|
|
notelist.Add(copy); |
|
|
|
} |
|
|
|
} |
|
|
|
await AddExchangeDataAsync(entities).ConfigureAwait(false); |
|
|
|
var entity = eventData.Entity; |
|
|
|
await AddExchangeDataAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
protected override async Task AddExchangeDataAsync(List<UnplannedReceiptNote> entities) |
|
|
@ -56,19 +47,4 @@ public class UnplannedReceiptNoteEventHandler |
|
|
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); |
|
|
|
await AddManyAsync(exchangeData).ConfigureAwait(false); |
|
|
|
} |
|
|
|
private UnplannedReceiptNote CopyEntity(UnplannedReceiptNote p_note) |
|
|
|
{ |
|
|
|
var json = System.Text.Json.JsonSerializer.Serialize(p_note); |
|
|
|
|
|
|
|
var copy = System.Text.Json.JsonSerializer.Deserialize<UnplannedReceiptNote>(json); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var detail in copy.Details) |
|
|
|
{ |
|
|
|
detail.Qty = detail.Qty != 0 ? -Math.Abs(detail.Qty) : 0; |
|
|
|
detail.HandledQty = detail.HandledQty != 0 ? -Math.Abs(detail.HandledQty) : 0; |
|
|
|
detail.RecommendQty = detail.RecommendQty != 0 ? -Math.Abs(detail.RecommendQty) : 0; |
|
|
|
} |
|
|
|
return copy; |
|
|
|
} |
|
|
|
} |
|
|
|