using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Application.Services; using Win_in.Sfs.Wms.DataExchange.Application.Contracts.Iac.Mes.Mes; using Win_in.Sfs.Wms.DataExchange.Application.Contracts.Iac.Mes.Mes.DTOs; using Win_in.Sfs.Wms.DataExchange.Application.Contracts.Iac.Mes.Mes.Inputs; using Win_in.Sfs.Wms.DataExchange.Domain.Iac.Mes.MesProductL7PartsNotes; namespace Win_in.Sfs.Wms.DataExchange.Application.Iac.Mes.Mes; //[Authorize(IncomingToWmsPermissions.Default)] //[Route("mes-product-part-note")] [Route($"{DataExchangeConsts.RouteRoot}mes-product-part")] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.WmsWebApi)] public class MesProductL7PartsNoteAppService : ApplicationService, IMesProductL7PartsNoteAppService { private readonly IMesProductL7PartsNoteRepository _mesProductL7PartsNoteRepository; public MesProductL7PartsNoteAppService( IMesProductL7PartsNoteRepository mesProductL7PartsNoteRepository) { _mesProductL7PartsNoteRepository = mesProductL7PartsNoteRepository; } /// /// 获取上次最大rowid /// /// [HttpPost("get-maxid")] ////[Authorize(MesProductL7PartsNotePermissions.CreateAsync)] public virtual async Task GetMaxRowID() { return !(await _mesProductL7PartsNoteRepository.GetQueryableAsync().ConfigureAwait(false)).Any() ? 0 : //转到实现,保存【L7级零件关系】 (await _mesProductL7PartsNoteRepository.GetQueryableAsync().ConfigureAwait(false)).Max(p => p.RowID); } /// /// 新增接口 /// /// /// [HttpPost("add-many")] public virtual async Task> AddManyAsync( List inputs) { //createinput 转化为 domain层的实体 var entities = ObjectMapper.Map, List>(inputs); //添加库存信息具体方法,会自动添加或者更新 await _mesProductL7PartsNoteRepository.InsertManyAsync(entities).ConfigureAwait(false); //domain层的实体 转化为 显示DTO var dto = ObjectMapper.Map, List>(entities); return dto; } /// /// 删除接口 /// /// /// /// /// [HttpPost("delete-by-base-info")] public virtual async Task DeleteByBaseInfoAsync(string year, string programCode, string productNo) { //删除对应的实体 await _mesProductL7PartsNoteRepository.DeleteAsync(p => p.Year == year && p.Program == programCode && p.ProductNo == productNo).ConfigureAwait(false); } }