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
{
///
/// GetSteps(ApiAction)
/// 获取当前工序的工步列表
///
///
///
[HttpPost]
[Route("api/[controller]/Node/GetSteps")]
public async Task 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
}