|
|
@ -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<CustomerProductionReturnNoteEditInput, CustomerProductionReturnNote>(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<List<string>> IsExistCustomerItemRelationShip(List<string> partlist, string customerCode) |
|
|
|
{ |
|
|
|
List<string> errorlist = new List<string>(); |
|
|
|
foreach (var itm in partlist) |
|
|
|
{ |
|
|
|
var result = await _customerItemAppService.GetByCustomerAndItemAsync(itm, customerCode).ConfigureAwait(false); |
|
|
|
if (result == null) |
|
|
|
{ |
|
|
|
errorlist.Add(itm); |
|
|
|
} |
|
|
|
} |
|
|
|
return errorlist; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|