diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InventoryInitialNotes/Inputs/InventoryInitialNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InventoryInitialNotes/Inputs/InventoryInitialNoteImportInput.cs index 25d037679..147d8747f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InventoryInitialNotes/Inputs/InventoryInitialNoteImportInput.cs +++ b/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, /// /// 批次 /// - [Display(Name = "批次")] - [Required(ErrorMessage = "{0}是必填项")] + [Display(Name = "批次")] public string Lot { get; set; } /// 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 fe2416939..6aaab4364 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 @@ -77,6 +77,21 @@ public class InventoryInitialNoteAppService : return dictionary; } + /// + /// 验证导入数据 + /// + /// + /// + /// + protected override async Task ValidateImportModelAsync(InventoryInitialNoteImportInput importInput, List 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 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}为原料库,批次不能为空"); + } + } + + } } }