服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-12-17 738df70120209daecd85566d0c50dbf56d9e4453
Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
@@ -292,6 +292,9 @@
                        _woBatch.CHANGE_USER = input.UserId;
                        _woBatch.CHANGE_TIME = DateTime.Now;
                    }
                    if (!Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Where(x => x.ORDER_NO == input.WorkOrder && x.STATUS> BIZ_MES_WO_BATCH.STATUSs.Init.GetValue()).Any()) {
                        _wo.STATUS = BIZ_MES_WO.STATUSs.Init.GetValue();
                    }
                }
                else
                {
@@ -311,6 +314,10 @@
                    else
                    {
                        db.Updateable(_woBatch, input.UserId).UpdateColumns(x => new { x.STATUS, x.UPDATE_USER, x.UPDATE_TIME, x.CHANGE_USER, x.CHANGE_TIME }).ExecuteCommand();
                    }
                    if (!_wo.IsNullOrEmpty() && _wo.STATUS == BIZ_MES_WO.STATUSs.Init.GetValue())
                    {
                        db.Updateable(_wo, input.UserId).UpdateColumns(x => new { x.STATUS, x.UPDATE_USER, x.UPDATE_TIME }).ExecuteCommand();
                    }
                });
                if (!dbTran.IsSuccess)
@@ -748,5 +755,28 @@
            }
            return result;
        }
        #region 提交前通用方法
        /// <summary>
        /// 提交前检查是否岗位、工单和不良代码
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public async Task<ApiAction<CheckCodeOutput>> CheckCode(string code)
        {
            var action = new ApiAction<CheckCodeOutput>($"检查条码{code}成功", new CheckCodeOutput());
            try
            {
                action.Data.Position = DbCache.Cache.Position[code];
                action.Data.WorkOrder = await Biz.Db.Queryable<BIZ_MES_WO>().Where(q => q.ORDER_NO == code).FirstAsync();
                action.Data.Defect = DbCache.Cache.Defect[code];
            }
            catch (Exception ex)
            {
                action.CatchExceptionWithLog(ex, $"检查条码{code}异常");
            }
            return action;
        }
        #endregion
    }
}