|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Volo.Abp.Guids; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Win_in.Sfs.Basedata.Application; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
|
|
@ -23,6 +24,7 @@ public class ItemBasicReader : IReader |
|
|
|
private readonly ILogger<ItemBasicReader> _logger; |
|
|
|
private readonly IGuidGenerator _guidGenerator; |
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
private readonly IItemPackAppService _itemPackAppService; |
|
|
|
private readonly IObjectMapper _objectMapper; |
|
|
|
public ItemBasicReader( |
|
|
|
IProductManager productManager |
|
|
@ -31,7 +33,7 @@ public class ItemBasicReader : IReader |
|
|
|
, ILogger<ItemBasicReader> logger |
|
|
|
, IItemBasicAppService itemBasicAppService |
|
|
|
, IObjectMapper objectMapper |
|
|
|
) |
|
|
|
, IItemPackAppService itemPackAppService) |
|
|
|
{ |
|
|
|
_guidGenerator = guidGenerator; |
|
|
|
_productManager = productManager; |
|
|
@ -39,6 +41,7 @@ public class ItemBasicReader : IReader |
|
|
|
_logger = logger; |
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
|
_objectMapper = objectMapper; |
|
|
|
_itemPackAppService = itemPackAppService; |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
|
|
@ -53,7 +56,7 @@ public class ItemBasicReader : IReader |
|
|
|
List<ItemBasicExchangeDto> eosToItemBasicExchangeDtos = new List<ItemBasicExchangeDto>(); |
|
|
|
foreach (var toBeProcessedPart in toBeProcessedParts) |
|
|
|
{ |
|
|
|
var itemBasic = BuildItemBasicToExchangeDto(toBeProcessedPart); |
|
|
|
var itemBasic =await BuildItemBasicToExchangeDto(toBeProcessedPart).ConfigureAwait(false); |
|
|
|
eosToItemBasicExchangeDtos.Add(itemBasic); |
|
|
|
} |
|
|
|
//和wms和eos数据进行比较,获取需要处理得数据
|
|
|
@ -107,8 +110,17 @@ public class ItemBasicReader : IReader |
|
|
|
return incomingData; |
|
|
|
} |
|
|
|
|
|
|
|
private static ItemBasicExchangeDto BuildItemBasicToExchangeDto(mes_product product) |
|
|
|
private async Task<ItemBasicExchangeDto> BuildItemBasicToExchangeDto(mes_product product) |
|
|
|
{ |
|
|
|
decimal packqty = 1; |
|
|
|
try |
|
|
|
{ |
|
|
|
var itempack = await _itemPackAppService.GetListByItemCodeAsync(product.mes_product_part).ConfigureAwait(false); |
|
|
|
if (itempack.Count > 0) packqty = itempack[0].Qty; |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
} |
|
|
|
string type = ""; |
|
|
|
switch (product.mes_product_code) |
|
|
|
{ |
|
|
@ -149,6 +161,7 @@ public class ItemBasicReader : IReader |
|
|
|
Configuration = product.mes_product_spec, |
|
|
|
BasicUom = product.mes_product_unit, |
|
|
|
AbcClass = "", |
|
|
|
StdPackQty = packqty, |
|
|
|
}; |
|
|
|
return itemBasicRequest; |
|
|
|
} |
|
|
|