using Rhea.Common; using Microsoft.AspNetCore.Mvc; using System; using Tiger.IBusiness; using System.Linq; using System.Threading.Tasks; using Tiger.Api.DbCache; namespace Tiger.Api.Controllers.Base { public partial class CacheController : ControllerBase { /// /// GetMesDefect(ApiAction(Data:PARAM_CODE)) /// 根据不良代码返回不良代码对象 /// /// /// [HttpPost("[action]")] public async Task GetMesDefect([FromBody] ApiAction action) { ApiAction response; try { response = action.GetResponse(Cache.MesDefect[action.Data?.ToString() ?? ""]); } catch (System.Exception ex) { response = action.GetResponse().CatchExceptionWithLog(ex); } return Ok(response); } /// /// GetMesDefectGroup(ApiAction(Data:DFTG_CODE)) /// 根据不良代码组代码返回不良代码组对象 /// /// /// [HttpPost("[action]")] public async Task GetMesDefectGroup([FromBody] ApiAction action) { ApiAction response; try { response = action.GetResponse(Cache.MesDefect.Groups.FirstOrDefault(q => q.DFTG_CODE == (action.Data?.ToString() ?? ""))); } catch (Exception ex) { response = action.GetResponse().CatchExceptionWithLog(ex); } return Ok(response); } } }