Browse Source

up

dev_DY_CC
赵新宇 6 months ago
parent
commit
b46690f788
  1. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs
  2. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs
  3. 74
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs

@ -64,14 +64,14 @@ public class CustomerProductionReturnNoteAppService :
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())}的零件关系");
throw new UserFriendlyException($"客户零件关系表中没有查到客户为{input.CustomerCode}零件号为{string.Join(",", ls.ToArray())}的零件关系");
}
var custitmDetail = await _customerItemAppService.GetListByPartsAsync(parts.ToList()).ConfigureAwait(false);
@ -128,7 +128,7 @@ public class CustomerProductionReturnNoteAppService :
List<string> errorlist = new List<string>();
foreach (var itm in partlist)
{
var result = await _salePriceSheetAppService.GetByItemCodeAndCustomerCode(itm, customerCode).ConfigureAwait(false);
var result = await _customerItemAppService.GetByCustomerAndItemAsync(itm, customerCode).ConfigureAwait(false);
if (result == null)
{
errorlist.Add(itm);

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs

@ -32,6 +32,7 @@ public class DeliverNoteAppService :
private readonly IDeliverNoteManager _deliverNoteManager;
private readonly ICustomerItemAppService _customerItemAppService;
public DeliverNoteAppService(
IDeliverNoteRepository repository,
IDeliverNoteManager deliverNoteManager, ICustomerItemAppService customerItemAppService) : base(repository)

74
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs

@ -37,6 +37,7 @@ public class DeliverRequestFisAppService :
private readonly ITransactionTypeAppService _transactionTypeAppService;
private readonly IBalanceAppService _balanceAppService;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ICustomerItemAppService _customerItemAppService;
private readonly ISalePriceSheetAppService _salePriceSheetAppService;
@ -49,8 +50,8 @@ public class DeliverRequestFisAppService :
ITransactionTypeAppService transactionTypeAppService,
IBalanceAppService balanceAppService,
IItemBasicAppService itemBasicAppService,
ISalePriceSheetAppService salePriceSheetAppService
ISalePriceSheetAppService salePriceSheetAppService,
ICustomerItemAppService customerItemAppService
)
: base(repository, deliverRequestManager)
@ -63,6 +64,7 @@ public class DeliverRequestFisAppService :
_balanceAppService = balanceAppService;
_itemBasicAppService = itemBasicAppService;
_salePriceSheetAppService = salePriceSheetAppService;
_customerItemAppService= customerItemAppService;
}
/// <summary>
/// 删除
@ -113,11 +115,6 @@ public class DeliverRequestFisAppService :
await SetRequestAutoPropertiesAsync(itemTransformRequest).ConfigureAwait(false);
foreach (var detail in itemTransformRequest.Details)
{
//_salePriceSheetAppService.GetByItemCodeAndCustomerCode(detail.ItemCode,itemTransformRequest.CustomerCode)
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detail.ItemCode);
@ -146,11 +143,20 @@ public class DeliverRequestFisAppService :
detail.ItemName = itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
detail.StdPackQty=itemBasicDto.StdPackQty;
// CheckPrice(detail);
}
var itemlist=itemTransformRequest.Details.Select(p => p.ItemCode).Distinct();
var customerCode = itemTransformRequest.CustomerCode;
var errors=await CheckCustomerItem(itemlist.ToList(),customerCode).ConfigureAwait(false);
if (errors.Count > 0)
{
throw new UserFriendlyException($"客户零件关系表中没有查到客户为{customerCode},零件号为{string.Join(",", errors.ToArray())}的零件关系");
}
var priceErrors=await IsExistCustomerItemPrice(itemlist.ToList(), customerCode).ConfigureAwait(false);
if (priceErrors.Count > 0)
{
throw new UserFriendlyException($"销售价格表中没有查到客户为{customerCode},零件号为{string.Join(",", priceErrors.ToArray())}的零件关系和价格");
}
}
return dictionary;
@ -173,12 +179,34 @@ public class DeliverRequestFisAppService :
//private static void CheckPrice(DeliverRequestDetail detail
// )
//{
//}
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 _customerItemAppService.GetByCustomerAndItemAsync(itm, customerCode).ConfigureAwait(false);
if (result == null)
{
errorlist.Add(itm);
}
}
return errorlist;
}
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 _salePriceSheetAppService.GetByItemCodeAndCustomerCode(itm, customerCode).ConfigureAwait(false);
if (result == null)
{
errorlist.Add(itm);
}
}
return errorlist;
}
@ -248,6 +276,20 @@ public class DeliverRequestFisAppService :
{
var entity = ObjectMapper.Map<DeliverRequestEditInput, DeliverRequest>(input);
var itemlist = entity.Details.Select(p => p.ItemCode).Distinct();
var customerCode = entity.CustomerCode;
var errors = await CheckCustomerItem(itemlist.ToList(), customerCode).ConfigureAwait(false);
if (errors.Count > 0)
{
throw new UserFriendlyException($"客户零件关系表中没有查到客户为{customerCode},零件号为{string.Join(",", errors.ToArray())}的零件关系");
}
var priceErrors = await IsExistCustomerItemPrice(itemlist.ToList(), customerCode).ConfigureAwait(false);
if (priceErrors.Count > 0)
{
throw new UserFriendlyException($"销售价格表中没有查到客户为{customerCode},零件号为{string.Join(",", priceErrors.ToArray())}的零件关系和价格");
}
await _deliverRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<DeliverRequest, DeliverRequestDTO>(entity);

Loading…
Cancel
Save