diff --git a/HJGL_DS/FineUIPro.Web/Global.asax.cs b/HJGL_DS/FineUIPro.Web/Global.asax.cs index 9d6b238..6ff033e 100644 --- a/HJGL_DS/FineUIPro.Web/Global.asax.cs +++ b/HJGL_DS/FineUIPro.Web/Global.asax.cs @@ -68,6 +68,20 @@ // 要执行的代码 var welders = from x in Funs.DB.OAM_User where (x.IsSync == null || x.IsSync == false) && x.MID_Code != null && x.MID_Code != string.Empty select x; var quas = from x in Funs.DB.OAM_UesrQualified where (x.IsSync == null || x.IsSync == false) && (x.IsDelete == false || x.IsDelete == null) select x; + var units = (from x in Funs.DB.OAM_User where !x.MID_Unit.Contains("-") select x.MID_Unit).Distinct().ToList(); + var allUnits = from x in Funs.DB.Base_Unit select x; + foreach (var unit in units) + { + if (!allUnits.Any(x => x.UnitId == unit || x.UnitName == unit)) + { + Model.Base_Unit u = new Model.Base_Unit(); + u.UnitId = SQLHelper.GetNewID(); + u.UnitName = unit; + u.IsMain = true; + u.IsSubUnit = false; + BLL.Base_UnitService.AddUnit(u); + } + } foreach (var q in welders) { diff --git a/HJGL_DS/FineUIPro.Web/Welder/WelderManage.aspx.cs b/HJGL_DS/FineUIPro.Web/Welder/WelderManage.aspx.cs index 2cd3d71..a681363 100644 --- a/HJGL_DS/FineUIPro.Web/Welder/WelderManage.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/Welder/WelderManage.aspx.cs @@ -164,6 +164,20 @@ namespace FineUIPro.Web.Welder { var welders = from x in Funs.DB.OAM_User where (x.IsSync == null || x.IsSync == false) && x.MID_Code != null && x.MID_Code != string.Empty select x; var quas = from x in Funs.DB.OAM_UesrQualified where (x.IsSync == null || x.IsSync == false) && (x.IsDelete == false || x.IsDelete == null) select x; + var units = (from x in Funs.DB.OAM_User where !x.MID_Unit.Contains("-") select x.MID_Unit).Distinct().ToList(); + var allUnits = from x in Funs.DB.Base_Unit select x; + foreach (var unit in units) + { + if (!allUnits.Any(x => x.UnitId == unit || x.UnitName == unit)) + { + Model.Base_Unit u = new Model.Base_Unit(); + u.UnitId = SQLHelper.GetNewID(); + u.UnitName = unit; + u.IsMain = true; + u.IsSubUnit = false; + BLL.Base_UnitService.AddUnit(u); + } + } int a = 0; int b = 0; int m = 0;