服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-07-25 4eab704b733002d37ad9c097dcd6f4f8c4fb9e36
Tiger.Business.MES/BIZ_MES_WO.cs
@@ -12,6 +12,7 @@
using Tiger.IBusiness;
using Microsoft.AspNetCore.Http;
using Tiger.Model.Entitys.MES.BizMesWoBatch;
using Tiger.Model.Entitys.MES.BizMesWo;
namespace Tiger.Business.MES
{
@@ -156,5 +157,48 @@
            }
            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;
        }
    }
}