服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
18 小时以前 a960900364d19bbf0ad7923a57989609e7fce798
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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);
        }
 
    }
}