Browse Source

库存初始化导入验证,验证库位、物品、库存状态、箱码

dev_DY_CC
周红军 10 months ago
parent
commit
319bd45137
  1. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InventoryInitialNotes/Inputs/InventoryInitialNoteImportInput.cs
  2. 51
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InventoryInitialNotes/Inputs/InventoryInitialNoteImportInput.cs

@ -43,8 +43,7 @@ public class InventoryInitialNoteImportInput : SfsStoreImportInputBase, IHasQty,
/// <summary>
/// 批次
/// </summary>
[Display(Name = "批次")]
[Required(ErrorMessage = "{0}是必填项")]
[Display(Name = "批次")]
public string Lot { get; set; }
/// <summary>

51
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs

@ -77,6 +77,21 @@ public class InventoryInitialNoteAppService :
return dictionary;
}
/// <summary>
/// 验证导入数据
/// </summary>
/// <param name="importInput"></param>
/// <param name="validationRresult"></param>
/// <returns></returns>
protected override async Task ValidateImportModelAsync(InventoryInitialNoteImportInput importInput, List<ValidationResult> validationRresult)
{
await CheckItemBasicAsync(importInput, validationRresult).ConfigureAwait(false);
await CheckLocationAsync(importInput, validationRresult).ConfigureAwait(false);
await CheckStatusAsync(importInput, validationRresult).ConfigureAwait(false);
await CheckPackingAsync(importInput, validationRresult).ConfigureAwait(false);
}
private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, string itemCode)
{
if (itemcBasicDto == null)
@ -121,14 +136,25 @@ public class InventoryInitialNoteAppService :
{
if (string.IsNullOrWhiteSpace(importInput.PackingCode))
{
return;
if(!string.IsNullOrWhiteSpace(importInput.Lot))
{
validationRresult.Add("箱码", $"箱码和批次应该都为空");
}
}
var label = await _inventoryLabelService.GetByCodeAsync(importInput.PackingCode).ConfigureAwait(false);
if (label == null)
else
{
validationRresult.Add("标签码", $"标签码{importInput.PackingCode}不存在");
if (string.IsNullOrWhiteSpace(importInput.Lot))
{
validationRresult.Add("批次", $"箱码不为空,批次也不能为空");
}
var label = await _inventoryLabelService.GetByCodeAsync(importInput.PackingCode).ConfigureAwait(false);
if (label == null)
{
validationRresult.Add("箱码", $"箱码{importInput.PackingCode}不存在");
}
}
}
private static async Task CheckStatusAsync(InventoryInitialNoteImportInput importInput, List<ValidationResult> validationRresult)
@ -156,6 +182,21 @@ public class InventoryInitialNoteAppService :
{
validationRresult.Add("库位代码", $"库位代码{importInput.LocationCode}不存在");
}
else
{
if(location.Type == EnumLocationType.RAW)
{
if (string.IsNullOrWhiteSpace(importInput.PackingCode))
{
validationRresult.Add("箱码", $"库位代码{importInput.LocationCode}为原料库,箱码不能为空");
}
if (string.IsNullOrWhiteSpace(importInput.Lot))
{
validationRresult.Add("批次", $"库位代码{importInput.LocationCode}为原料库,批次不能为空");
}
}
}
}
}

Loading…
Cancel
Save