|
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Omu.ValueInjecter; |
|
|
|
using Volo.Abp; |
|
|
|
using Win_in.Sfs.Basedata.Application; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
@ -28,17 +29,20 @@ public class CustomerProductionReturnNoteAppService : |
|
|
|
|
|
|
|
private readonly ICustomerItemAppService _customerItemAppService; |
|
|
|
|
|
|
|
private readonly ISalePriceSheetAppService _salePriceSheetAppService; |
|
|
|
|
|
|
|
public CustomerProductionReturnNoteAppService( |
|
|
|
ICustomerProductionReturnNoteRepository repository |
|
|
|
, ICustomerProductionReturnNoteManager CustomerProductionReturnNoteManager |
|
|
|
, ICustomerItemAppService customerItemAppService |
|
|
|
, ICustomerItemAppService customerItemAppService, |
|
|
|
ISalePriceSheetAppService salePriceSheetAppService |
|
|
|
) : base(repository) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
_customerItemAppService = customerItemAppService; |
|
|
|
|
|
|
|
|
|
|
|
_salePriceSheetAppService = salePriceSheetAppService; |
|
|
|
|
|
|
|
_CustomerProductionReturnNoteManager = CustomerProductionReturnNoteManager; |
|
|
|
} |
|
|
@ -56,13 +60,19 @@ public class CustomerProductionReturnNoteAppService : |
|
|
|
|
|
|
|
var parts= input.Details.Select(itm => itm.ItemCode).Distinct(); |
|
|
|
|
|
|
|
var ls=await IsExistCustomerItemRelationShip(parts.ToList(),input.CustomerCode).ConfigureAwait(false); |
|
|
|
var ls=await IsExistCustomerItemPrice(parts.ToList(),input.CustomerCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (ls.Count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"客户零件关系表中没有查到客户为{input.CustomerCode}零件号为{string.Join(",", ls.ToArray())}的零件"); |
|
|
|
throw new UserFriendlyException($"销售价格表中没有查到客户为{input.CustomerCode}零件号为{string.Join(",", ls.ToArray())}的零件关系和价格"); |
|
|
|
} |
|
|
|
|
|
|
|
var errlist= await CheckCustomerItem(parts.ToList(), input.CustomerCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (errlist.Count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"客户零件关系表中没有查到客户为{input.CustomerCode}零件号为{string.Join(",", ls.ToArray())}的零件关系"); |
|
|
|
} |
|
|
|
|
|
|
|
var custitmDetail = await _customerItemAppService.GetListByPartsAsync(parts.ToList()).ConfigureAwait(false); |
|
|
|
|
|
|
@ -113,12 +123,12 @@ public class CustomerProductionReturnNoteAppService : |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task<List<string>> IsExistCustomerItemRelationShip(List<string> partlist, string customerCode) |
|
|
|
private async Task<List<string>> IsExistCustomerItemPrice(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); |
|
|
|
var result = await _salePriceSheetAppService.GetByItemCodeAndCustomerCode(itm, customerCode).ConfigureAwait(false); |
|
|
|
if (result == null) |
|
|
|
{ |
|
|
|
errorlist.Add(itm); |
|
|
@ -128,6 +138,20 @@ public class CustomerProductionReturnNoteAppService : |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
private async Task<List<string>> CheckCustomerItem(List<string> partlist, string customerCode) |
|
|
|
{ |
|
|
|
List<string> errorlist = new List<string>(); |
|
|
|
foreach (var itm in partlist) |
|
|
|
{ |
|
|
|
var result = await _salePriceSheetAppService.GetByItemCodeAndCustomerCode(itm, customerCode).ConfigureAwait(false); |
|
|
|
if (result == null) |
|
|
|
{ |
|
|
|
errorlist.Add(itm); |
|
|
|
} |
|
|
|
} |
|
|
|
return errorlist; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|