From e8cd6fad8fb953ac787068026fc264d972352445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 6 Nov 2024 09:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerProductionReturnNoteAppService.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs index 145b858b3..165439dc5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; @@ -54,8 +55,22 @@ public class CustomerProductionReturnNoteAppService : var entity = ObjectMapper.Map(input); + + + + + var parts= input.Details.Select(itm => itm.ItemCode).Distinct(); + + var ls=await IsExistCustomerItemRelationShip(parts.ToList(),input.CustomerCode).ConfigureAwait(false); + + if (ls.Count > 0) + { + throw new UserFriendlyException($"客户零件关系表中没有查到客户为{input.CustomerCode}零件为{string.Join(",", ls.ToArray())}的零件号"); + } + + var custitmDetail = await _customerItemAppService.GetListByPartsAsync(parts.ToList()).ConfigureAwait(false); var checkPart= from itm in entity.Details.ToList() @@ -105,5 +120,22 @@ public class CustomerProductionReturnNoteAppService : } + private async Task> IsExistCustomerItemRelationShip(List partlist, string customerCode) + { + List errorlist = new List(); + foreach (var itm in partlist) + { + var result = await _customerItemAppService.GetByCustomerAndItemAsync(itm, customerCode).ConfigureAwait(false); + if (result == null) + { + errorlist.Add(itm); + } + } + return errorlist; + + + } + + }