diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs index 6aaab4364..5eecd553e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs @@ -19,6 +19,7 @@ using Volo.Abp; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Wms.Inventory.Domain.Acl.ErpLocationItem; /// /// 库存初始化记录 @@ -32,17 +33,20 @@ public class InventoryInitialNoteAppService : private readonly IInventoryInitialNoteManager _inventoryInitialNoteManager; private readonly IInventoryLabelAppService _inventoryLabelService; private readonly IItemBasicAppService _itemBasicAppService; + private readonly IErpLocationItemAclService _erpLocationItemAclService; public InventoryInitialNoteAppService( IInventoryInitialNoteRepository repository , IInventoryInitialNoteManager inventoryInitialNoteManager , IInventoryLabelAppService inventoryLabelService, + IErpLocationItemAclService erpLocationItemAclService, IItemBasicAppService itemBasicAppService ) : base(repository) { _inventoryInitialNoteManager = inventoryInitialNoteManager; _inventoryLabelService = inventoryLabelService; _itemBasicAppService = itemBasicAppService; + _erpLocationItemAclService= erpLocationItemAclService; } /// /// 数据加工 @@ -88,8 +92,8 @@ public class InventoryInitialNoteAppService : await CheckItemBasicAsync(importInput, validationRresult).ConfigureAwait(false); await CheckLocationAsync(importInput, validationRresult).ConfigureAwait(false); await CheckStatusAsync(importInput, validationRresult).ConfigureAwait(false); - await CheckPackingAsync(importInput, validationRresult).ConfigureAwait(false); - + await CheckPackingAsync(importInput, validationRresult).ConfigureAwait(false); + await CheckErpLocationItemAsync(importInput, validationRresult).ConfigureAwait(false); } private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, string itemCode) @@ -130,6 +134,7 @@ public class InventoryInitialNoteAppService : await CheckLocationAsync(importInput, validationRresult).ConfigureAwait(false); await CheckStatusAsync(importInput, validationRresult).ConfigureAwait(false); await CheckPackingAsync(importInput, validationRresult).ConfigureAwait(false); + } private async Task CheckPackingAsync(InventoryInitialNoteImportInput importInput, List validationRresult) @@ -175,6 +180,23 @@ public class InventoryInitialNoteAppService : } } + /// + /// 校验开账信息 + /// + /// + /// + /// + /// + private async Task CheckErpLocationItemAsync(InventoryInitialNoteImportInput importInput, List validationRresult) + { + var erpLocationItem = await _erpLocationItemAclService.GetFirstAsync(importInput.ItemCode, importInput.LocationErpCode).ConfigureAwait(false); + + if (erpLocationItem == null) + { + validationRresult.Add("ERP料号", $"未找到物品【{importInput.ItemCode}】与ERP储位【{importInput.LocationErpCode}】的开账信息"); + } + } + protected async Task CheckLocationAsync(InventoryInitialNoteImportInput importInput, List validationRresult) { var location = await LocationAclService.GetByCodeAsync(importInput.LocationCode).ConfigureAwait(false);