| | |
| | | { |
| | | if (action.IsAsync) |
| | | { |
| | | response = action.GetResponse(await trans.ScanItem(action.Data)); |
| | | response = action.GetResponse(await trans.Scan(action.Data)); |
| | | } |
| | | else |
| | | { |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.ScanItem(action.Data).Result); } |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.Scan(action.Data).Result); } |
| | | } |
| | | } |
| | | else |
| | |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/Out_Default/ScanShelf")] |
| | | public async Task<IActionResult> Out_Default_ScanShelfAsync([FromBody] ApiAction action) |
| | | { |
| | | ApiAction response; |
| | | IOut_Default trans = null; |
| | | try |
| | | { |
| | | if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID)) |
| | | { |
| | | trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IOut_Default; |
| | | if (!trans.IsFinished) |
| | | { |
| | | if (action.IsAsync) |
| | | { |
| | | response = action.GetResponse(await trans.ScanShelf(action.Data?.ToString())); |
| | | } |
| | | else |
| | | { |
| | | lock (trans.TransLock) { response = action.GetResponse(trans.ScanShelf(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); |
| | | } |
| | | //[HttpPost] |
| | | //[Route("api/[controller]/Out_Default/ScanShelf")] |
| | | //public async Task<IActionResult> Out_Default_ScanShelfAsync([FromBody] ApiAction action) |
| | | //{ |
| | | // ApiAction response; |
| | | // IOut_Default trans = null; |
| | | // try |
| | | // { |
| | | // if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID)) |
| | | // { |
| | | // trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IOut_Default; |
| | | // if (!trans.IsFinished) |
| | | // { |
| | | // if (action.IsAsync) |
| | | // { |
| | | // response = action.GetResponse(await trans.ScanShelf(action.Data?.ToString())); |
| | | // } |
| | | // else |
| | | // { |
| | | // lock (trans.TransLock) { response = action.GetResponse(trans.ScanShelf(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); |
| | | //} |
| | | |
| | | } |
| | | } |