| | |
| | | using Tiger.IBusiness; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Tiger.Model.Entitys.MES.BizMesWoBatch; |
| | | using Tiger.Model.Entitys.MES.BizMesWo; |
| | | |
| | | namespace Tiger.Business.MES |
| | | { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新工单状态 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | public async Task<ApiAction> UpdateWoStatus(BizMesWoInput input) |
| | | { |
| | | var result = new ApiAction(); |
| | | try |
| | | { |
| | | //保存前的判断,并生成批次号 |
| | | var _wo = await Biz.Db.Queryable<BIZ_MES_WO>().Where(x => x.ORDER_NO == input.WorkOrder).FirstAsync(); |
| | | if (_wo != null) |
| | | { |
| | | _wo.STATUS = input.Status < 0 ? _wo.STATUS : input.Status; |
| | | _wo.ROUTE_STATUS = input.RouteStatus; |
| | | } |
| | | else |
| | | { |
| | | result.IsSuccessed = false; |
| | | result.LocaleMsg = new($"工单[{input.WorkOrder}]不存在"); |
| | | return result; |
| | | } |
| | | |
| | | var db = Biz.Db; |
| | | var dbTran = db.UseTran(() => |
| | | { |
| | | db.Updateable(_wo, input.UserId).ExecuteCommand(); |
| | | }); |
| | | if (!dbTran.IsSuccess) |
| | | { |
| | | result.IsSuccessed = false; |
| | | result.LocaleMsg = new($"更新工单状态异常"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, "更新工单状态异常"); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | | } |