| | |
| | | trans?.AddHistory(Request, action); |
| | | return Ok(response); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 清除 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/InStoreOrderNo/Clear")] |
| | | public async Task<IActionResult> InStoreOrderNo_ClearAsync([FromBody] ApiAction action) |
| | | { |
| | | ApiAction response; |
| | | IInStoreOrderNo trans = null; |
| | | try |
| | | { |
| | | if (iBiz.MES.Context.GetTransDic().ContainsKey(action.ID)) |
| | | { |
| | | trans = iBiz.MES.Context.GetTransDic()[action.ID] as IInStoreOrderNo; |
| | | if (!trans.IsFinished) |
| | | { |
| | | if (action.IsAsync) |
| | | { |
| | | response = action.GetResponse(await trans.Clear()); |
| | | } |
| | | else |
| | | { |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.Clear().Result); } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | response = action.GetResponse($"Transaction Error: 入库单事务[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]/InStoreOrderNo/Delete")] |
| | | public async Task<IActionResult> InStoreOrderNo_DeleteAsync([FromBody] ApiAction action) |
| | | { |
| | | ApiAction response; |
| | | IInStoreOrderNo trans = null; |
| | | try |
| | | { |
| | | if (iBiz.MES.Context.GetTransDic().ContainsKey(action.ID)) |
| | | { |
| | | trans = iBiz.MES.Context.GetTransDic()[action.ID] as IInStoreOrderNo; |
| | | if (!trans.IsFinished) |
| | | { |
| | | if (action.IsAsync) |
| | | { |
| | | response = action.GetResponse(await trans.Delete(action.Data?.ToString())); |
| | | } |
| | | else |
| | | { |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.Delete(action.Data?.ToString()).Result); } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | response = action.GetResponse($"Transaction Error: 入库单事务[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); |
| | | } |
| | | } |
| | | } |