| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// Reset(ApiAction) |
| | | /// 重置工序操作 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/PackingNode/Reset")] |
| | | public async Task<IActionResult> PackingNode_ResetAsync([FromBody] ApiAction action) |
| | | { |
| | | ApiAction response; |
| | | IPackingNode trans = null; |
| | | try |
| | | { |
| | | if (iBiz.MES.Context.GetTransDic().ContainsKey(action.ID)) |
| | | { |
| | | trans = iBiz.MES.Context.GetTransDic()[action.ID] as IPackingNode; |
| | | 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); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// SelectWO(ApiAction(Data:{WoInput})) |
| | | /// 包装工序:选择工单 |
| | | /// </summary> |
| | |
| | | |
| | | /// <summary> |
| | | /// Submit(ApiAction(Data:{SubmitInput})) |
| | | /// 测试工序:提交操作数据 |
| | | /// 包装工序:提交操作数据 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | |
| | | return Ok(response); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// CompletePkg(ApiAction) |
| | | /// 包装工序:手动结束包装 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/PackingNode/CompletePkg")] |
| | | public async Task<IActionResult> PackingNode_CompletePkgAsync([FromBody] ApiAction action) |
| | | { |
| | | ApiAction response; |
| | | IPackingNode trans = null; |
| | | try |
| | | { |
| | | if (iBiz.MES.Context.GetTransDic().ContainsKey(action.ID)) |
| | | { |
| | | trans = iBiz.MES.Context.GetTransDic()[action.ID] as IPackingNode; |
| | | if (!trans.IsFinished) |
| | | { |
| | | if (action.IsAsync) |
| | | { |
| | | response = action.GetResponse(await trans.CompletePkg(action)); |
| | | } |
| | | else |
| | | { |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.CompletePkg(action).Result); } |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | } |