using Rhea.Common;
|
using Microsoft.AspNetCore.Mvc;
|
using System;
|
using Tiger.IBusiness;
|
using System.Linq;
|
using System.Threading.Tasks;
|
using Tiger.Model;
|
using System.Linq.Expressions;
|
using Tiger.Api.DbCache;
|
|
namespace Tiger.Api.Controllers.Base
|
{
|
public partial class CacheController : ControllerBase
|
{
|
/// <summary>
|
/// GetMesPosition(ApiAction(Data:POST_CODE))
|
/// 根据岗位代码返回岗位对象
|
/// </summary>
|
/// <param name="action"></param>
|
/// <returns></returns>
|
[HttpPost("[action]")]
|
public async Task<IActionResult> GetMesPosition([FromBody] ApiAction action)
|
{
|
ApiAction response;
|
try
|
{
|
response = action.GetResponse(Cache.MesPosition[action.Data?.ToString() ?? ""]);
|
}
|
catch (System.Exception ex)
|
{
|
response = action.GetResponse().CatchExceptionWithLog(ex);
|
}
|
return Ok(response);
|
}
|
|
/// <summary>
|
/// GetMesPositionByOper(ApiAction(Data:OPER_CODE))
|
/// 根据工序编码返回岗位对象列表
|
/// </summary>
|
/// <param name="action"></param>
|
/// <returns></returns>
|
[HttpPost("[action]")]
|
public async Task<IActionResult> GetMesPositionByOper([FromBody] ApiAction action)
|
{
|
ApiAction response;
|
try
|
{
|
response = action.GetResponse(Cache.MesPosition.Positions.Where(q => q.OPER_CODE == (action.Data?.ToString() ?? "")).ToList());
|
}
|
catch (Exception ex)
|
{
|
response = action.GetResponse().CatchExceptionWithLog(ex);
|
}
|
return Ok(response);
|
}
|
|
}
|
}
|