From 319bd451377006bfaa97cc4c890b93b247c14f8b Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 28 Jun 2024 13:57:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=AA=8C=E8=AF=81=EF=BC=8C=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=E3=80=81=E7=89=A9=E5=93=81=E3=80=81=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E7=8A=B6=E6=80=81=E3=80=81=E7=AE=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Inputs/InventoryInitialNoteImportInput.cs | 3 +- .../InventoryInitialNoteAppService.cs | 51 +++++++++++++++++-- 2 files changed, 47 insertions(+), 7 deletions(-) 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}为原料库,批次不能为空"); + } + } + + } } }