|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Volo.Abp.Caching;
|
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts;
|
|
|
|
using Win_in.Sfs.Basedata.Domain;
|
|
|
|
using Win_in.Sfs.Basedata.Domain.Shared;
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Basedata.Application;
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
[Route($"{BasedataConsts.RootPath}purchase-price-sheet")]
|
|
|
|
|
|
|
|
public class PurchasePriceSheetAppService : SfsBaseDataAppServiceBase<PurchasePriceSheet, PurchasePriceSheetDTO, SfsBaseDataRequestInputBase, PurchasePriceSheetEditInput, PurchasePriceSheetImportInput>, IPurchasePriceSheetAppService
|
|
|
|
{
|
|
|
|
private readonly IPurchasePriceSheetRepository _purchasePriceSheetRepository;
|
|
|
|
public PurchasePriceSheetAppService(IPurchasePriceSheetRepository repository, IDistributedCache<PurchasePriceSheetDTO> cache) : base(repository, cache)
|
|
|
|
{
|
|
|
|
_purchasePriceSheetRepository= repository;
|
|
|
|
base.CreatePolicyName = PurchasePriceSheetPermissions.Create;
|
|
|
|
base.UpdatePolicyName = PurchasePriceSheetPermissions.Update;
|
|
|
|
base.DeletePolicyName = PurchasePriceSheetPermissions.Delete;
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 根据供应零件号查询
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="supplierCode"></param>
|
|
|
|
/// <param name="itemCode"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet("by-item-code")]
|
|
|
|
public virtual async Task<PurchasePriceSheetDTO> GetByItemCodeAsync(string itemCode)
|
|
|
|
{
|
|
|
|
var entity = await _purchasePriceSheetRepository.FindAsync(p => p.ItemCode== itemCode).ConfigureAwait(false);
|
|
|
|
var dto = ObjectMapper.Map<PurchasePriceSheet, PurchasePriceSheetDTO>(entity);
|
|
|
|
return dto;
|
|
|
|
}
|
|
|
|
}
|