Browse Source

库存初始化导入增加ERP物料号和库位关系校验

dev_DY_CC
周红军 10 months ago
parent
commit
b7a9185f87
  1. 26
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs

26
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;
/// <summary>
/// 库存初始化记录
@ -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;
}
/// <summary>
/// 数据加工
@ -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<ValidationResult> validationRresult)
@ -175,6 +180,23 @@ public class InventoryInitialNoteAppService :
}
}
/// <summary>
/// 校验开账信息
/// </summary>
/// <param name="importInput"></param>
/// <param name="validationRresult"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
private async Task CheckErpLocationItemAsync(InventoryInitialNoteImportInput importInput, List<ValidationResult> 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<ValidationResult> validationRresult)
{
var location = await LocationAclService.GetByCodeAsync(importInput.LocationCode).ConfigureAwait(false);

Loading…
Cancel
Save