From f1d23772d88a000879562026fa31ccfd41e93dee Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Wed, 26 Apr 2023 15:53:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Incoming/ProductReader.cs | 2 +- .../Incoming/ItemBasicReader.cs | 19 ++++++++++++++++--- .../Outgoing/CountAdjustNoteConverter.cs | 2 +- .../Outgoing/DeliverNoteConverter.cs | 4 ++-- .../Outgoing/ProductRecycleNoteConverter.cs | 4 ++-- .../Outgoing/UnplannedIssueNoteConverter.cs | 2 +- .../Outgoing/UnplannedReceiptNoteConverter.cs | 2 +- .../IncomingToWmsExtensions.cs | 2 ++ .../WMS/ItemBasic/ItemBasicExchangeDto.cs | 8 ++++++++ .../ProductRecycleNoteDetailExchangeDto.cs | 9 +++++++++ .../UnplannedIssueNoteDetailExchangeDto.cs | 5 +++++ .../UnplannedReceiptNoteDetailExchangeDto.cs | 6 ++++++ ...Wms.DataExchange.Application.Contracts.xml | 5 +++++ ...IArchivedIncomingFromExternalRepository.cs | 1 + .../IncomingFromExternalManager.cs | 2 +- 15 files changed, 61 insertions(+), 12 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs index a0762cda9..c974dae55 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs @@ -36,7 +36,7 @@ public class ProductReader : IReader public virtual async Task> ReadAsync() { //获取上次同步的最大Eos更新时间 - var maxTimeString = await _incomingFromExternalManager.GetDataByMaxEffectiveDate(EnumIncomingDataType.ItemPack.ToString()).ConfigureAwait(false); + var maxTimeString = await _incomingFromExternalManager.GetDataByMaxEffectiveDate(EnumIncomingDataType.ItemPack.ToString()).ConfigureAwait(false); //从EOS读取待处理Product var toBeProcessedProducts = await _productManager.GetToBeProcessedListAsync(maxTimeString).ConfigureAwait(false); if (!toBeProcessedProducts.Any()) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicReader.cs index 9cfadb08d..de94dfad5 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicReader.cs @@ -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 _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 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> ReadAsync() @@ -53,7 +56,7 @@ public class ItemBasicReader : IReader List eosToItemBasicExchangeDtos = new List(); 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 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; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs index ab9fed69e..cc7bf8eb4 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs @@ -47,7 +47,7 @@ public class CountAdjustNoteConverter : IOutgoingConverter var department = await _departmentAppService.GetByUsernameAsync(wmsCountAdjust.Worker).ConfigureAwait(false); var departmentCode = department == null ? "" : department.Code; - var details = wmsCountAdjust.Details.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) }); + var details = wmsCountAdjust.Details.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode }); var detal = details.ToList(); foreach (var detail in detal) { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs index 6f1130c4f..0e2b5e4e6 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs @@ -114,7 +114,7 @@ public class DeliverNoteConverter : IOutgoingConverter wmsoutm_user = exchangeOrder.Worker.Length >= 6 ? exchangeOrder.Worker.Substring(0, 6) : exchangeOrder.Worker, wmsoutm_dept = "", wmsoutm_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), - wmsoutm_cust = exchangeOrder.Customer, + wmsoutm_cust = exchangeOrder.Customer ?? "", wmsoutm_shm_nbr = "", wmsoutm_cust_loc = "", wmsoutm_stock_stat = "", @@ -139,7 +139,7 @@ public class DeliverNoteConverter : IOutgoingConverter { wmsoutd_nbr = exchangeOrder.Number, wmsoutd_part = exchangeDetailOrder.ItemCode, - wmsoutd_loc = exchangeDetailOrder.FromLocationErpCode, + wmsoutd_loc = exchangeDetailOrder.FromLocationErpCode ?? "", wmsoutd_qty = exchangeDetailOrder.Qty, wmsoutd_bcm_code = "", wmsoutd_projt_id = "", diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs index e2fde345b..55a2e97e4 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs @@ -132,8 +132,8 @@ public class ProductRecycleNoteConverter : IOutgoingConverter wmsoutm_shm_nbr = "", wmsoutm_cust_loc = "", wmsoutm_stock_stat = "", - wmsoutm_open_part = exchangeOrder.ItemCode, - wmsoutm_open_loc = exchangeOrder.LocationErpCode, + wmsoutm_open_part = exchangeOrderDetail.ItemCode, + wmsoutm_open_loc = exchangeOrderDetail.LocationErpCode, wmsoutm_open_hours = 1,//无法取到转移工时 目前默认为1 wmsoutm_tyrp_k = "", wmsoutm_id = 0,//明细中最大scmsend_id diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs index 574287fe0..0f55e3a69 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs @@ -144,7 +144,7 @@ public class UnplannedIssueNoteConverter : IOutgoingConverter { wmsoutd_nbr = exchangeOrder.Number, wmsoutd_part = exchangeDetailOrder.ItemCode, - wmsoutd_loc = exchangeDetailOrder.FromLocationErpCode, + wmsoutd_loc = exchangeDetailOrder.LocationErpCode ?? "", wmsoutd_qty = exchangeDetailOrder.Qty, wmsoutd_bcm_code = "",//有问题 wmsoutd_projt_id = "",//有问题 diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs index 60e3d52ed..fbf956e23 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs @@ -144,7 +144,7 @@ public class UnplannedReceiptNoteConverter : IOutgoingConverter { wmsoutd_nbr = exchangeOrder.Number, wmsoutd_part = exchangeDetailOrder.ItemCode, - wmsoutd_loc = exchangeDetailOrder.FromLocationErpCode, + wmsoutd_loc = exchangeDetailOrder.LocationErpCode ?? "", wmsoutd_qty = exchangeDetailOrder.Qty, wmsoutd_bcm_code = "",//有问题 wmsoutd_projt_id = "",//有问题 diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs index 14f5e1a74..e5d108a13 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs @@ -88,7 +88,9 @@ public static class IncomingToWmsExtensions { var itemPack = JsonSerializer.Deserialize(incomingConverted.DataContent); var itemPackAppService = workerContext.ServiceProvider.GetRequiredService(); + var itemBasicAppService = workerContext.ServiceProvider.GetRequiredService(); await itemPackAppService.UpsertAsync(itemPack).ConfigureAwait(false); + await itemBasicAppService.UpsertStdPackQtyAsync(itemPack.ItemCode, itemPack.Qty).ConfigureAwait(false); } public static async Task HandleCustomersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemBasic/ItemBasicExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemBasic/ItemBasicExchangeDto.cs index f2bf0a16c..c6860062c 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemBasic/ItemBasicExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemBasic/ItemBasicExchangeDto.cs @@ -39,6 +39,14 @@ public class ItemBasicExchangeDto [Required(ErrorMessage = "{0}是必填项")] public bool CanBuy { get; set; } + + /// + /// 标包数 + /// + [Display(Name = "标包数")] + public decimal StdPackQty { get; set; } + + /// /// 外包件 /// diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductRecycleNote/ProductRecycleNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductRecycleNote/ProductRecycleNoteDetailExchangeDto.cs index 6ff557eb3..73884c82e 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductRecycleNote/ProductRecycleNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductRecycleNote/ProductRecycleNoteDetailExchangeDto.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Application.Contracts; namespace Win_in.Sfs.Wms.DataExchange.WMS.ProductRecycleNote; @@ -14,6 +15,14 @@ public class ProductRecycleNoteDetailExchangeDto [Display(Name = "物品代码")] public string ItemCode { get; set; } + + /// + /// 库位组 + /// + [Display(Name = "Erp库位")] + + public string LocationErpCode { get; set; } + /// /// 排序批次 /// diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedIssueNote/UnplannedIssueNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedIssueNote/UnplannedIssueNoteDetailExchangeDto.cs index f32e863be..0f1d51105 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedIssueNote/UnplannedIssueNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedIssueNote/UnplannedIssueNoteDetailExchangeDto.cs @@ -22,6 +22,11 @@ public class UnplannedIssueNoteDetailExchangeDto [Display(Name = "来源ERP库位")] public string FromLocationErpCode { get; set; } /// + /// 库位组 + /// + [Display(Name = "Erp库位")] + public string LocationErpCode { get; set; } + /// /// 数量 /// [Display(Name = "数量")] diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedReceiptNote/UnplannedReceiptNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedReceiptNote/UnplannedReceiptNoteDetailExchangeDto.cs index 4006fb4f5..2cff333f6 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedReceiptNote/UnplannedReceiptNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/UnplannedReceiptNote/UnplannedReceiptNoteDetailExchangeDto.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; namespace Win_in.Sfs.Wms.DataExchange.WMS.UnplannedReceiptNote; @@ -22,6 +23,11 @@ public class UnplannedReceiptNoteDetailExchangeDto [Display(Name = "来源ERP库位")] public string FromLocationErpCode { get; set; } /// + /// 库位组 + /// + [Display(Name = "Erp库位")] + public string LocationErpCode { get; set; } + /// /// 数量 /// [Display(Name = "数量")] diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml index 3ef624cd8..c1283a9e2 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml @@ -651,6 +651,11 @@ 代码 + + + 标包数 + + 外包件 diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/ArchivedIncomingFromExternal/IArchivedIncomingFromExternalRepository.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/ArchivedIncomingFromExternal/IArchivedIncomingFromExternalRepository.cs index 469ac6216..f1949f1a4 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/ArchivedIncomingFromExternal/IArchivedIncomingFromExternalRepository.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/ArchivedIncomingFromExternal/IArchivedIncomingFromExternalRepository.cs @@ -5,4 +5,5 @@ namespace Win_in.Sfs.Wms.DataExchange.Domain; public interface IArchivedIncomingFromExternalRepository : ISfsRepositoryBase, ISfsBulkRepositoryBase { + } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/IncomingFromExternal/IncomingFromExternalManager.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/IncomingFromExternal/IncomingFromExternalManager.cs index dcd54ef5c..cf0b6f644 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/IncomingFromExternal/IncomingFromExternalManager.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain/IncomingFromExternal/IncomingFromExternalManager.cs @@ -44,7 +44,7 @@ public class IncomingFromExternalManager : DomainService, IIncomingFromExternalM public virtual async Task GetDataByMaxEffectiveDate(string dataType) { string maxTime = ""; - var list = await _repository.GetListAsync(r => r.DataType == dataType).ConfigureAwait(false); + var list = await _historyRepository.GetListAsync(r => r.DataType == dataType).ConfigureAwait(false); if (list.Count != 0) { maxTime = list.Select(r => r.EffectiveDate).Max().ToString(CultureInfo.InvariantCulture);