diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index bc97ca30..cda6f7c2 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -2074,8 +2074,6 @@ public partial class CommonServices : BaseServices>, ICommon break; case "F_TrainPlan_Temporary": - case "F_UshioTrainPlan_Temporary": - sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId WHERE A.UserID = {App.User.ID} @@ -2098,7 +2096,6 @@ public partial class CommonServices : BaseServices>, ICommon } break; case "F_TrainPlan_WaitConfirm": - case "F_UshioTrainPlan_WaitConfirm": result.JM_PageControlT1.Toolbar.Insert(0, new Toolbar() { display = true, @@ -2118,6 +2115,121 @@ public partial class CommonServices : BaseServices>, ICommon position = "left" }); break; + + case "F_UshioTrainPlan_Wait": + case "F_UshioTrainPlan_Active": + case "F_UshioTrainPlan_Disable": + case "F_UshioTrainPlan_Temporary": + case "F_UshioTrainPlan_WaitConfirm": + + config = await Db.Queryable().Where(x => x.ConfigCode == "ESS_Recruit_Year_Human_Start_Month").FirstAsync(); + startMonth = config != null ? config.ConfigValue.ObjToInt() : 1; + months = new List(); + numbers = new(); + for (int i = 1; i <= 12; i++) + { + if (i < 10) + months.Add("0" + i); + else + months.Add(i.ObjToString()); + numbers.Add(i); + } + curentYear = DateTime.Now.Year; + curentMonth = DateTime.Now.Month; + // 指定要打头的数字 + startNumber = startMonth; + + + if (curentMonth < startMonth) + curentYear--; + // 创建一个新的列表用于存储重新排序后的结果 + reorderedNumbers = new(); + + sort = result.JM_TableColumnT1.TableColumn.Where(x => x.field == "M1").SingleOrDefault()?.SortNo ?? 5; + name1 = await QueryLangValue("F_ResumeMaintenance_0216", "预算编制数"); + result.JM_TableColumnT1.TableColumn?.ForEach(x => + { + if (months.Where(o => o == x.label).Any()) + x.GroupName = name1; + + if (x.field == "Year") + x.searchColumnDefaultValue = curentYear; + }); + + // 找到指定数字的索引 + index1 = numbers.IndexOf(startNumber); + if (index1 != -1) + { + // 从指定数字开始,按照循环顺序添加数字 + for (int i = 0; i < numbers.Count; i++) + { + int currentIndex = (index1 + i) % numbers.Count; + reorderedNumbers.Add(numbers[currentIndex]); + } + + foreach (var num in reorderedNumbers) + { + result.JM_TableColumnT1.TableColumn?.ForEach(x => + { + if (x.label.ObjToInt() == num) + { + x.SortNo = sort; + x.label = curentYear + "-" + x.label; + } + }); + if (num == 12) + curentYear++; + sort++; + } + } + result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.OrderBy(x => x.SortNo).ToList(); + + if (param.menuName == "F_UshioTrainPlan_WaitConfirm") + { + + result.JM_PageControlT1.Toolbar.Insert(0, new Toolbar() + { + display = true, + fnKey = "TBDDoReject", + fnTitle = await QueryLangValue("F_Training_Demand_ToConfirm_Reject", param.langId, "拒绝"), + fnType = "table", + icon = "ess-icon-reject", + position = "left" + }); + result.JM_PageControlT1.Toolbar.Insert(0, new Toolbar() + { + display = true, + fnKey = "TBDDoAgree", + fnTitle = await QueryLangValue("F_Training_Demand_ToConfirm_Agree", param.langId, "同意"), + fnType = "table", + icon = "ess-icon-approval", + position = "left" + }); + } + else if (param.menuName == "F_UshioTrainPlan_Temporary") + { + sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName + FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId + WHERE A.UserID = {App.User.ID} + AND A.IsEnable = 1 + AND B.IsEnable = 1 + AND B.RoleNo = 'F_TrainPlanTransferToConfirmed'"; + toolbarRoles = DbAccess.QueryList(sql); + if (toolbarRoles != null && toolbarRoles.Any()) + { + index = result.JM_PageControlT1.Toolbar.FindIndex(x => x.fnKey == "NewYN"); + result.JM_PageControlT1.Toolbar.Insert(index + 1, new Toolbar() + { + display = true, + fnKey = "TBDToConfirm", + fnTitle = await QueryLangValue("F_ManReqMaintenTemporary_TransferToConfirmed", param.langId, "转入待确认"), + fnType = "table", + icon = "ghr-icon-user-wait", + position = "left" + }); + } + } + break; } #endregion diff --git a/Tiobon.Core.Services/Ghre/Ghre_UshioPlanServices.cs b/Tiobon.Core.Services/Ghre/Ghre_UshioPlanServices.cs index 76160cc5..bdc06c18 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_UshioPlanServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_UshioPlanServices.cs @@ -1,5 +1,4 @@ -using static Tiobon.Core.Model.Consts; -using Tiobon.Core.Common.DB.Dapper.Extensions; +using Tiobon.Core.IServices; namespace Tiobon.Core.Services; @@ -9,11 +8,13 @@ namespace Tiobon.Core.Services; public class Ghre_UshioPlanServices : BaseServices, IGhre_UshioPlanServices { private readonly IBaseRepository _dal; - public Ghre_UshioPlanServices(ICaching caching, IBaseRepository dal) + private readonly ICommonServices _commonServices; + public Ghre_UshioPlanServices(ICaching caching, IBaseRepository dal, ICommonServices commonServices) { this._dal = dal; base.BaseDal = dal; base._caching = caching; + _commonServices = commonServices; } @@ -21,6 +22,22 @@ public class Ghre_UshioPlanServices : BaseServices(value); + year = jsonParam.columnValue.ObjToInt(); + + } + } + var DT_TableDataT1 = result.result.DT_TableDataT1; var deptIds = DT_TableDataT1.Select(x => x.DeptId).Distinct().ToList(); @@ -51,6 +68,33 @@ public class Ghre_UshioPlanServices : BaseServices x.Id == DT_TableDataT1[i].CourseId).Select(x => x.CourseName).FirstOrDefault(); DT_TableDataT1[i].DeptName = depts.Where(x => x.DeptID == DT_TableDataT1[i].DeptId).Select(x => x.DeptName).FirstOrDefault(); } + + + ModuleParam param = new ModuleParam() + { + langId = filter.langId, + menuName = filter.menuName + }; + var module = await _commonServices.GetModuleInfoAsync(param); + result.result.JM_TableColumnT1 = module.Data.JM_TableColumnT1; + + var yearField = module.Data.JM_TableColumnT1.TableColumn.Where(x => x.field == "Year").SingleOrDefault(); + if (year != yearField?.searchColumnDefaultValue.ObjToInt()) + { + + result.result.JM_TableColumnT1.TableColumn?.ForEach(x => + { + if (x.GroupName == "预算编制数") + { + + int month = x.field.Replace("M", null).Replace("_F", null).ObjToInt(); + x.label = year + "-" + (month < 10 ? "0" + month : month); + if (month == 12) + year++; + } + }); + } + return result; }