Browse Source

采购订单导入校验添加

dev_DY_CC
lvzb 11 months ago
parent
commit
c1ed622212
  1. 23
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

23
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

@ -32,6 +32,7 @@ public class PurchaseOrderAppService :
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ILocationAppService _locationAppService;
public readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService;
public readonly ISupplierItemAppService _supplierItemAppService;
public PurchaseOrderAppService(
IPurchaseOrderRepository repository,
@ -39,7 +40,8 @@ public class PurchaseOrderAppService :
ISupplierAppService supplierAppService,
IItemBasicAppService itemBasicAppService
, ILocationAppService locationAppService,
IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository)
IPurchasePriceSheetAppService purchasePriceSheetAppService,
ISupplierItemAppService supplierItemAppService) : base(repository)
{
_repository = repository;
_purchaseOrderManager = purchaseOrderManager;
@ -50,6 +52,7 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository)
base.UpdatePolicyName = PurchaseOrderPermissions.Update;
base.DeletePolicyName = PurchaseOrderPermissions.Delete;
_purchasePriceSheetAppService = purchasePriceSheetAppService;
_supplierItemAppService = supplierItemAppService;
}
#region 东阳使用
@ -126,8 +129,20 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository)
return dictionary;
}
/// <summary>
/// 检验重写
/// </summary>
/// <param name="model"></param>
/// <param name="validationRresult"></param>
/// <returns></returns>
protected override async Task ValidateImportModelAsync(PurchaseOrderImportInput model, List<ValidationResult> validationRresult)
{
var item = await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(model.SupplierCode,model.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"供应商代码【{model.SupplierCode}】与明细-ERP料号【{model.ItemCode}】对应关系不存在"));
}
}
/// <summary>
/// 【创建】采购订单
@ -232,7 +247,7 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository)
var isprice = await _purchasePriceSheetAppService.CheckPurPriceAsync(supplierCode, itemCode).ConfigureAwait(false);
if (isprice)
{
throw new UserFriendlyException($"供应商【{supplierCode}】物品名称【{itemCode}】无采购价格无法执行采购上架!");
throw new UserFriendlyException($"供应商【{supplierCode}】物品名称【{itemCode}】无采购价格无法导入采购订单!");
}
}
private async Task<List<LocationDTO>> CheckErpLocationCodeAsync(List<string> erpLocationCodes)

Loading…
Cancel
Save