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.
63 lines
2.2 KiB
63 lines
2.2 KiB
1 year ago
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel.DataAnnotations;
|
||
|
using System.Linq;
|
||
|
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}erplocation-item")]
|
||
|
|
||
|
public class ErpLocationItemAppService
|
||
|
: SfsBaseDataAppServiceBase<ErpLocationItem, ErpLocationItemDTO, SfsBaseDataRequestInputBase, ErpLocationItemEditInput, ErpLocationItemImportInput>
|
||
|
, IErpLocationItemAppService
|
||
|
{
|
||
|
private readonly IErpLocationItemManager _manager;
|
||
|
private new readonly IErpLocationItemRepository _repository;
|
||
|
|
||
|
public ErpLocationItemAppService(
|
||
|
IErpLocationItemRepository repository
|
||
|
, IDistributedCache<ErpLocationItemDTO> cache
|
||
|
, IErpLocationItemManager manager
|
||
|
, IItemBasicAppService itemBasicAppService) : base(repository, cache)
|
||
|
{
|
||
|
base.CreatePolicyName = ErpLocationItemPermissions.Create;
|
||
|
base.UpdatePolicyName = ErpLocationItemPermissions.Update;
|
||
|
base.DeletePolicyName = ErpLocationItemPermissions.Delete;
|
||
|
_repository = repository;
|
||
|
_manager = manager;
|
||
|
}
|
||
|
|
||
|
[HttpPost("upsert")]
|
||
|
public virtual async Task UpsertAsync(ErpLocationItemEditInput input)
|
||
|
{
|
||
|
var entity = ObjectMapper.Map<ErpLocationItemEditInput, ErpLocationItem>(input);
|
||
|
await _repository.UpsertAsync(entity).ConfigureAwait(false);
|
||
|
}
|
||
|
|
||
|
[HttpGet("list/by-item")]
|
||
|
public virtual async Task<List<ErpLocationItemDTO>> GetListByItemCodeAsync(string itemCode)
|
||
|
{
|
||
|
var entities = await _repository.GetListAsync(c => c.ItemCode == itemCode).ConfigureAwait(false);
|
||
|
var dtos = ObjectMapper.Map<List<ErpLocationItem>, List<ErpLocationItemDTO>>(entities);
|
||
|
return dtos;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
protected override async Task ValidateImportModelAsync(ErpLocationItemImportInput importInput, List<ValidationResult> validationRresult)
|
||
|
{
|
||
|
await base.CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|