| | |
| | | return Ok(response); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 雅达装箱工序:打印测试标签 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/YadaPacking/TestPrint")] |
| | | public async Task<IActionResult> YadaPacking_TestPrintAsync([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.TestPrint()); |
| | | } |
| | | else |
| | | { |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.TestPrint().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); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 雅达装箱工序:打印测试标签 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/YadaPacking/GetIsCustomerLabelAndShipQty")] |
| | | public async Task<IActionResult> YadaPacking_GetIsCustomerLabelAndShipQtyAsync([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.GetIsCustomerLabelAndShipQty()); |
| | | } |
| | | else |
| | | { |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.GetIsCustomerLabelAndShipQty().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); |
| | | } |
| | | } |
| | | } |