You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.3 KiB
61 lines
2.3 KiB
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Linq.Dynamic.Core;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
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}customer-item")]
|
|
|
|
public class CustomerItemAppService : SfsBaseDataAppServiceBase<CustomerItem, CustomerItemDTO, SfsBaseDataRequestInputBase, CustomerItemEditInput, CustomerItemImportInput>, ICustomerItemAppService
|
|
{
|
|
private new readonly ICustomerItemRepository _repository;
|
|
private readonly ICustomerAppService _customerAppService;
|
|
private readonly ICustomerItemManager _manager;
|
|
|
|
public CustomerItemAppService(
|
|
ICustomerItemRepository repository
|
|
, IDistributedCache<CustomerItemDTO> cache
|
|
, ICustomerAppService customerAppService
|
|
, ICustomerItemManager manager
|
|
) : base(repository, cache)
|
|
{
|
|
_repository = repository;
|
|
_manager = manager;
|
|
|
|
base.CreatePolicyName = CustomerItemPermissions.Create;
|
|
base.UpdatePolicyName = CustomerItemPermissions.Update;
|
|
base.DeletePolicyName = CustomerItemPermissions.Delete;
|
|
_customerAppService = customerAppService;
|
|
}
|
|
|
|
[HttpPost("upsert")]
|
|
public virtual async Task UpsertAsync(CustomerItemEditInput input)
|
|
{
|
|
var entity = ObjectMapper.Map<CustomerItemEditInput, CustomerItem>(input);
|
|
await _repository.UpsertAsync(entity).ConfigureAwait(false);
|
|
}
|
|
|
|
protected override async Task ValidateImportModelAsync(CustomerItemImportInput importInput, List<ValidationResult> validationRresult)
|
|
{
|
|
await base.CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false);
|
|
await base.CheckCustomerCodeAsync(importInput.CustomerCode, validationRresult).ConfigureAwait(false);
|
|
}
|
|
[HttpPost("get-part-list")]
|
|
public virtual async Task<List<CustomerItem>> GetListByPartsAsync(List<string> inputs)
|
|
{
|
|
return await _repository.WithDetails().Where(p => inputs.Contains(p.ItemCode)).ToListAsync().ConfigureAwait(false);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|