服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-09-29 564d1fcca01d3c528e283c9feef3ea1a05140e17
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
using Autofac;
using Microsoft.AspNetCore.Mvc;
using Rhea.Common;
using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml.Linq;
using Tiger.IBusiness;
using Tiger.Model;
using Tiger.Model.Entitys.MES.Position;
 
namespace Tiger.Api.Controllers.MES
{
    public partial class MESController : ControllerBase
    {
        /// <summary>
        /// GetSteps(ApiAction)
        /// 获取当前工序的工步列表
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/Node/GetSteps")]
        public async Task<IActionResult> Node_GetStepsAsync([FromBody] ApiAction action)
        {
            ApiAction response;
            ITestNode trans = null;
            try
            {
                if (iBiz.MES.Context.GetTransDic().ContainsKey(action.ID))
                {
                    trans = iBiz.MES.Context.GetTransDic()[action.ID] as ITestNode;
                    if (!trans.IsFinished)
                    {
                        lock (trans.TransLock) { response = action.GetResponse(trans.Reset()); }
                    }
                    else
                    {
                        response = action.GetResponse($"Transaction Error: 岗位[{trans.PostCode}]的测试工序事务[ID:{action.ID}]已经关闭", false);
                    }
                }
                else
                {
                    response = action.GetResponse($"Transaction Error: 岗位的测试工序事务[ID:{action.ID}]已经被关闭", false);
                }
            }
            catch (System.Exception ex)
            {
                response = action.GetResponse().CatchExceptionWithLog(ex);
            }
            trans?.AddHistory(Request, action);
            return Ok(response);
        }
 
    }//endClass
}