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
|
{
|
/// <summary>
|
/// GetMesDefect(ApiAction(Data:PARAM_CODE))
|
/// 根据不良代码返回不良代码对象
|
/// </summary>
|
/// <param name="action"></param>
|
/// <returns></returns>
|
[HttpPost("[action]")]
|
public async Task<IActionResult> 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);
|
}
|
|
/// <summary>
|
/// GetMesDefectGroup(ApiAction(Data:DFTG_CODE))
|
/// 根据不良代码组代码返回不良代码组对象
|
/// </summary>
|
/// <param name="action"></param>
|
/// <returns></returns>
|
[HttpPost("[action]")]
|
public async Task<IActionResult> 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);
|
}
|
}
|
}
|