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, ICustomerItemAppService { private new readonly ICustomerItemRepository _repository; private readonly ICustomerAppService _customerAppService; private readonly ICustomerItemManager _manager; public CustomerItemAppService( ICustomerItemRepository repository , IDistributedCache 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(input); await _repository.UpsertAsync(entity).ConfigureAwait(false); } protected override async Task ValidateImportModelAsync(CustomerItemImportInput importInput, List 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> GetListByPartsAsync(List inputs) { return await _repository.WithDetails().Where(p => inputs.Contains(p.ItemCode)).ToListAsync().ConfigureAwait(false); } }