From 35afcfe07fef52f74a2079fdb5977a87f88ddbb6 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 17 十二月 2024 20:40:47 +0800 Subject: [PATCH] 提交前检查是否岗位、工单和不良代码 --- Tiger.Controllers.MES/Controllers/MESController.YadaPacking.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/Tiger.Controllers.MES/Controllers/MESController.YadaPacking.cs b/Tiger.Controllers.MES/Controllers/MESController.YadaPacking.cs index b55fbae..dc1176f 100644 --- a/Tiger.Controllers.MES/Controllers/MESController.YadaPacking.cs +++ b/Tiger.Controllers.MES/Controllers/MESController.YadaPacking.cs @@ -366,5 +366,45 @@ trans?.AddHistory(Request, action); return Ok(response); } + + [HttpPost] + [Route("api/[controller]/YadaPacking/CheckCode")] + public async Task<IActionResult> YadaPacking_CheckCodeAsync([FromBody] ApiAction action) + { + ApiAction response; + IYadaPacking trans = null; + try + { + if (iBiz.MES.Context.GetTransDic().ContainsKey(action.ID)) + { + trans = iBiz.MES.Context.GetTransDic()[action.ID] as IYadaPacking; + if (!trans.IsFinished) + { + if (action.IsAsync) + { + response = action.GetResponse(await trans.CheckCode(action.Data?.ToString())); + } + else + { + lock (trans.TransLock) { response = action.GetResponse(trans.CheckCode(action.Data?.ToString()).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); + } } } -- Gitblit v1.9.3