diff --git a/SGGL/BLL/Person/Person_PersonsService.cs b/SGGL/BLL/Person/Person_PersonsService.cs index 3ceef2f9..2961fc0f 100644 --- a/SGGL/BLL/Person/Person_PersonsService.cs +++ b/SGGL/BLL/Person/Person_PersonsService.cs @@ -1288,10 +1288,10 @@ namespace BLL { info += "输入的身份证号码人员库已存在!"; } - if (person.UnitId != CommonService.GetThisUnitId() && (string.IsNullOrEmpty(person.PhotoUrl) || person.PhotoUrl == "~/res/images/blank.png")) + /* if (person.UnitId != CommonService.GetThisUnitId() && (string.IsNullOrEmpty(person.PhotoUrl) || person.PhotoUrl == "~/res/images/blank.png")) { info += "照片不能为空!"; - } + }*/ //if (string.IsNullOrEmpty(person.WorkPostId)) //{ // info += "请选择所属岗位!"; diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs index 90de9de9..3662ac71 100644 --- a/SGGL/BLL/ProjectData/ProjectService.cs +++ b/SGGL/BLL/ProjectData/ProjectService.cs @@ -353,29 +353,8 @@ { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - IQueryable getProjects = null; - getProjects = from x in db.Base_Project - where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1 - select x; - - if (userId != Const.sysglyId && userId != Const.hfnbdId && userId != Const.sedinId) - { - var getUser = Person_PersonsService.GetPerson_PersonsById(userId); - if (getUser != null && !string.IsNullOrEmpty(getUser.Account)) - { - //List roleidList = Funs.GetStrListByStr(getUser.RoleIds, ','); - ///// 获取角色类型 - //var getRoleP = db.Sys_RolePower.FirstOrDefault(x => roleidList.Contains(x.RoleId) && x.IsOffice == false); - if (getUser.IsOffice != true) - { - var getProjectIdList = db.SitePerson_Person.Where(x => x.PersonId == userId && x.RoleIds != null).Select(x => x.ProjectId); - if (getProjectIdList.Count() > 0) - { - getProjects = getProjects.Where(x => getProjectIdList.Contains(x.ProjectId)); - } - } - } - } + var getProjects = GetIndexProjectScope(db, userId) + .Where(x => x.ProjectState == null || x.ProjectState == Const.ProjectState_1); var pcount = (from x in db.Sys_Log where x.ProjectId != null && x.OperationTime > DateTime.Now.AddDays(-1) @@ -383,22 +362,49 @@ select new { g.First().ProjectId, count = g.Count() }).Distinct(); - if (getProjects.Count() > 0) - { - var getList = (from x in getProjects - join y in pcount on x.ProjectId equals y.ProjectId into PP - from p in PP.DefaultIfEmpty() - orderby p.count descending - select x); - return getList.ToList(); - } - else - { - return null; - } + return (from x in getProjects + join y in pcount on x.ProjectId equals y.ProjectId into PP + from p in PP.DefaultIfEmpty() + orderby p.count descending + select x).ToList(); } } + public static Model.Base_Project GetIndexProjectById(string userId, string projectId) + { + if (string.IsNullOrEmpty(projectId)) return null; + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + return GetIndexProjectScope(db, userId).FirstOrDefault(x => x.ProjectId == projectId); + } + } + + private static IQueryable GetIndexProjectScope(Model.SGGLDB db, string userId) + { + var projects = from project in db.Base_Project + join unit in db.Base_Unit on project.UnitId equals unit.UnitId + select project; + if (userId == Const.sysglyId || userId == Const.hfnbdId || userId == Const.sedinId) return projects; + + var user = db.Person_Persons.FirstOrDefault(x => x.PersonId == userId); + if (user == null) return projects.Where(x => false); + + bool isOffice = user.IsOffice == true; + string unitId = user.UnitId; + if (isOffice) + { + string mainUnitId = CommonService.GetThisUnitId(); + if (!string.IsNullOrEmpty(mainUnitId) && string.Equals(unitId, mainUnitId, StringComparison.OrdinalIgnoreCase)) return projects; + if (db.Base_Unit.Any(x => x.UnitId == unitId && x.IsBranch == true)) return projects.Where(x => x.UnitId == unitId); + } + + // 项目用户管理通过清空现场人员角色来撤销项目关联。 + var assignedProjectIds = db.SitePerson_Person + .Where(x => x.PersonId == userId && x.RoleIds != null && x.RoleIds != "") + .Select(x => x.ProjectId); + return projects.Where(x => (isOffice && x.UnitId == unitId) || assignedProjectIds.Contains(x.ProjectId)); + } + #region /// /// 项目表下拉框 diff --git a/SGGL/BLL/SysManage/SysConstSetService.cs b/SGGL/BLL/SysManage/SysConstSetService.cs index 3e77630c..97616f2c 100644 --- a/SGGL/BLL/SysManage/SysConstSetService.cs +++ b/SGGL/BLL/SysManage/SysConstSetService.cs @@ -5,6 +5,20 @@ public static class SysConstSetService { + public const string CompanyDashboardTitleSetting = "公司级看板标题"; + + public static string CompanyDashboardTitle + { + get + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + return db.Sys_Const.Where(x => x.ConstText == CompanyDashboardTitleSetting) + .Select(x => x.ConstValue).FirstOrDefault(); + } + } + } + public static bool IsMultiLanguageEnabled { get diff --git a/SGGL/BLL/SysManage/SysMenuService.cs b/SGGL/BLL/SysManage/SysMenuService.cs index b497e973..4b0675db 100644 --- a/SGGL/BLL/SysManage/SysMenuService.cs +++ b/SGGL/BLL/SysManage/SysMenuService.cs @@ -1,10 +1,162 @@ using System.Collections.Generic; +using System; +using System.Data; using System.Linq; +using System.Xml; namespace BLL { public static class SysMenuService { + private const string NavigationChangeGroup = "MenuNavigationChanges"; + + public static bool IsRemovedCompanySection(string menuType) + { + return string.Equals(menuType, Const.Menu_DigData, StringComparison.OrdinalIgnoreCase) || + string.Equals(menuType, Const.Menu_SmartSite, StringComparison.OrdinalIgnoreCase) || + string.Equals(menuType, Const.Menu_TeamWork, StringComparison.OrdinalIgnoreCase) || + string.Equals(menuType, Const.Menu_Notice, StringComparison.OrdinalIgnoreCase); + } + + public static void TrackNavigationChanges(Model.SGGLDB db, string menuType, List menuIds) + { + var trackedIds = new HashSet(db.Sys_Const + .Where(x => x.GroupId == NavigationChangeGroup && x.ConstValue == menuType) + .Select(x => x.ConstText).ToList(), StringComparer.OrdinalIgnoreCase); + foreach (var id in menuIds.Where(id => !trackedIds.Contains(id))) + { + db.Sys_Const.InsertOnSubmit(new Model.Sys_Const + { + ID = SQLHelper.GetNewID(), + GroupId = NavigationChangeGroup, + ConstText = id, + ConstValue = menuType + }); + } + } + + public static bool MoveMenu(string menuId, string sourceType, string targetType, string targetParent, bool isOffice) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + db.Connection.Open(); + using (var transaction = db.Connection.BeginTransaction(IsolationLevel.Serializable)) + { + db.Transaction = transaction; + var source = db.Sys_Menu.Where(x => x.MenuType == sourceType).ToList(); + var menu = source.Find(x => string.Equals(x.MenuId, menuId, StringComparison.OrdinalIgnoreCase)); + if (menu == null || (targetParent != "0" && + !db.Sys_Menu.Any(x => x.MenuId == targetParent && x.MenuType == targetType && x.IsEnd != true))) + { + return false; + } + + var children = source.ToLookup(x => x.SuperMenu, StringComparer.OrdinalIgnoreCase); + var subtree = new List { menu }; + for (int i = 0; i < subtree.Count; i++) + { + subtree.AddRange(children[subtree[i].MenuId]); + } + var ids = subtree.Select(x => x.MenuId).ToList(); + if (ids.Contains(targetParent, StringComparer.OrdinalIgnoreCase)) + { + return false; + } + + menu.SuperMenu = targetParent; + if (sourceType != targetType) + { + foreach (var item in subtree) + { + item.MenuType = targetType; + item.IsOffice = isOffice; + } + foreach (var power in db.Sys_RolePower.Where(x => ids.Contains(x.MenuId))) + { + power.MenuType = targetType; + power.IsOffice = isOffice; + } + TrackNavigationChanges(db, targetType, ids); + } + TrackNavigationChanges(db, sourceType, sourceType == targetType ? new List { menuId } : ids); + db.SubmitChanges(); + transaction.Commit(); + return true; + } + } + } + + public static void ApplyNavigationChanges(XmlDocument document, string menuType) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + // 仅叠加通过设置页保存的菜单,保留现有 XML 中其他菜单的显示和顺序。 + var changedIds = db.Sys_Const.Where(x => x.GroupId == NavigationChangeGroup && x.ConstValue == menuType) + .Select(x => x.ConstText).ToList(); + if (changedIds.Count == 0) return; + + var menus = db.Sys_Menu.Where(x => x.MenuType == menuType).ToList(); + ApplyNavigationChanges(document, changedIds, menus); + } + } + + internal static void ApplyNavigationChanges(XmlDocument document, List changedIds, List menus) + { + var changed = new HashSet(changedIds, StringComparer.OrdinalIgnoreCase); + var byId = menus.ToDictionary(x => x.MenuId, StringComparer.OrdinalIgnoreCase); + var nodes = document.SelectNodes("//TreeNode[@id]").Cast() + .ToLookup(x => x.GetAttribute("id"), StringComparer.OrdinalIgnoreCase); + var placed = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (var group in nodes) + { + if (changed.Contains(group.Key)) + { + foreach (var node in group) node.ParentNode.RemoveChild(node); + } + else + { + placed.Add(group.Key, group.First()); + } + } + + foreach (var menu in menus.Where(x => changed.Contains(x.MenuId) && x.IsUsed == true).OrderBy(x => x.SortIndex)) + { + PlaceNavigationNode(document, menu, byId, nodes, placed); + } + } + + private static XmlElement PlaceNavigationNode(XmlDocument document, Model.Sys_Menu menu, + Dictionary menus, ILookup originalNodes, + Dictionary placed) + { + XmlElement node; + if (placed.TryGetValue(menu.MenuId, out node)) return node; + if (menu.IsUsed != true) return null; + + XmlElement parent = document.DocumentElement; + if (menu.SuperMenu != "0" && !placed.TryGetValue(menu.SuperMenu ?? "", out parent)) + { + Model.Sys_Menu parentMenu; + if (!menus.TryGetValue(menu.SuperMenu ?? "", out parentMenu)) return null; + parent = PlaceNavigationNode(document, parentMenu, menus, originalNodes, placed); + } + if (parent == null) return null; + + node = originalNodes[menu.MenuId].FirstOrDefault() ?? document.CreateElement("TreeNode"); + node.SetAttribute("id", menu.MenuId); + node.SetAttribute("Text", menu.MenuName); + node.SetAttribute("NavigateUrl", menu.Url); + var next = parent.ChildNodes.OfType().FirstOrDefault(sibling => + { + Model.Sys_Menu siblingMenu; + return menus.TryGetValue(sibling.GetAttribute("id"), out siblingMenu) && + (siblingMenu.SortIndex ?? int.MinValue) > (menu.SortIndex ?? int.MinValue); + }); + parent.InsertBefore(node, next); + placed.Add(menu.MenuId, node); + return node; + } + /// diff --git a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs index dbaa0afd..1a8f431e 100644 --- a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs @@ -13,7 +13,11 @@ namespace BLL public static class HJGLData_HJGLService { public static SGGLDB db = Funs.DB; - public static List BeUnderConstructionList = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList(); + private static IQueryable UnderConstructionProjects => Funs.DB.Base_Project + .Where(x => x.ProjectState == null || x.ProjectState == Const.ProjectState_1); + private static IQueryable UnderConstructionProjectIds => UnderConstructionProjects.Select(x => x.ProjectId); + public static IQueryable CompanyDashboardProjects => UnderConstructionProjects + .Where(x => x.ProjectId != Const.Project_TestProjectId); #region 获取列表 @@ -309,6 +313,109 @@ namespace BLL return responeData; } + public static HJGLDataItem GetCompanyWeldingSummary() + { + return SummarizeWeldingData(GetWelderNum().Count, GetDineInfo(), GetCHCheckItem()); + } + + public static CompanyWeldingDashboard GetCompanyWeldingDashboard(DateTime date) + { + var monthStart = new DateTime(date.Year, date.Month, 1); + var firstMonth = monthStart.AddMonths(-5); + var endDate = date.Date.AddDays(1); + var projects = CompanyDashboardProjects.Select(x => new CompanyWeldingProject + { + ProjectId = x.ProjectId, + ProjectName = x.ShortName == null || x.ShortName.Trim() == "" ? x.ProjectName : x.ShortName.Trim(), + ProjectAddress = x.ProjectAddress, + StartDate = x.StartDate, EndDate = x.EndDate, MapCoordinates = x.MapCoordinates + }).ToList(); + var projectIds = CompanyDashboardProjects.Select(x => x.ProjectId); + var welds = QueryWeldsWithDaily(); + + // 近六个月的月份各不相同。区间外和没有日报的记录归入 0,只参与累计统计。 + var dine = (from weld in welds + where projectIds.Contains(weld.ProjectId) + group weld by new { weld.ProjectId, Month = weld.WeldingDate >= firstMonth && weld.WeldingDate < endDate + ? weld.WeldingDate.Value.Month : 0 } into g + select new + { + g.Key.ProjectId, g.Key.Month, + Total = g.Sum(x => x.Size) ?? 0m, + Completed = g.Sum(x => x.DailyId != null ? x.Size : 0m) ?? 0m + }).ToLookup(x => x.ProjectId, StringComparer.OrdinalIgnoreCase); + + // 报告已筛选在建项目,关联焊口时核对同一项目即可,避免重复筛选导致焊口表被反复扫描。 + // 只计已点口的初检底片,按焊接日报日期归月。 + var films = (from inspection in QueryReportedItems(projectIds) + join trust in Funs.DB.HJGL_Batch_BatchTrustItem on inspection.Item.TrustBatchItemId equals trust.TrustBatchItemId + join point in Funs.DB.HJGL_Batch_PointBatchItem on trust.PointBatchItemId equals point.PointBatchItemId + join weld in welds on new { inspection.Report.ProjectId, trust.WeldJointId } equals new { weld.ProjectId, weld.WeldJointId } + where point.PointDate != null && point.PointState == "1" && trust.RepairRecordId == null + group inspection.Item by new { weld.ProjectId, Month = weld.WeldingDate >= firstMonth && weld.WeldingDate < endDate + ? weld.WeldingDate.Value.Month : 0 } into g + select new + { + g.Key.ProjectId, g.Key.Month, + Total = g.Sum(x => (long?)x.TotalFilm) ?? 0L, + Passed = g.Sum(x => (long?)x.PassFilm) ?? 0L + }).ToLookup(x => x.ProjectId, StringComparer.OrdinalIgnoreCase); + + var months = Enumerable.Range(0, 6) + .Select(i => new CompanyWeldingMonth { Month = firstMonth.AddMonths(i) }).ToList(); + var monthsByNumber = months.ToDictionary(x => x.Month.Month); + long totalFilms = 0, passedFilms = 0; + foreach (var project in projects) + { + project.CurrentMonth.Month = monthStart; + foreach (var row in dine[project.ProjectId]) + { + project.TotalDine += row.Total; + project.CompletedDine += row.Completed; + if (row.Month != 0) monthsByNumber[row.Month].CompletedDine += row.Completed; + if (row.Month == monthStart.Month) project.CurrentMonth.CompletedDine = row.Completed; + } + foreach (var row in films[project.ProjectId]) + { + totalFilms += row.Total; + passedFilms += row.Passed; + if (row.Month == 0) continue; + var month = monthsByNumber[row.Month]; + month.TotalFilms += row.Total; + month.PassedFilms += row.Passed; + if (row.Month == monthStart.Month) + { + project.CurrentMonth.TotalFilms = row.Total; + project.CurrentMonth.PassedFilms = row.Passed; + } + } + } + + return new CompanyWeldingDashboard + { + Projects = projects, Months = months, + TotalDine = projects.Sum(x => x.TotalDine), + CompletedDine = projects.Sum(x => x.CompletedDine), + MonthCompletedDine = months.Last().CompletedDine, + FirstPassRate = totalFilms > 0 ? (decimal?)passedFilms / totalFilms : null, + MonthFirstPassRate = months.Last().FirstPassRate, + WelderCount = QueryWelders(projectIds).Select(x => x.PersonId).Distinct().Count() + }; + } + + private static HJGLDataItem SummarizeWeldingData(int welderCount, IEnumerable dineInfo, + IEnumerable checkItems) + { + return new HJGLDataItem + { + WelderNum = welderCount, + TotalDineNum = Convert.ToInt32(dineInfo.Sum(x => x.Size)), + CompleteDineNum = Convert.ToInt32(dineInfo.Sum(x => x.DoneDin)), + TotalFilmNum = Convert.ToInt32(checkItems.Sum(x => x.CHT_TotalFilm)), + OKFilmNum = Convert.ToInt32(checkItems.Sum(x => x.CHT_PassFilm)) + }; + } + public static async Task StatisticalDataAsync() { var data = new HJGLData(); @@ -333,7 +440,7 @@ namespace BLL var welderNum = await welderNumTask; var dineInfoList = await dineInfoListTask; var chCheckItemList = await chCheckItemListTask; - + var summary = SummarizeWeldingData(welderNum.Count, dineInfoList, chCheckItemList); var table = new HJGLData_HJGL { @@ -341,19 +448,19 @@ namespace BLL CollCropCode = baseUnit.CollCropCode, UnitName = baseUnit.UnitName, ReportDate = DateTime.Now.Date, - WelderNum = welderNum.Count(), - TotalDineNum = Convert.ToInt32(dineInfoList.Sum(x => x.Size)), - CompleteDineNum = Convert.ToInt32(dineInfoList.Sum(x => x.DoneDin)), - TotalFilmNum = Convert.ToInt32(chCheckItemList.Sum(x => x.CHT_TotalFilm)), - OKFilmNum = Convert.ToInt32(chCheckItemList.Sum(x => x.CHT_PassFilm)), + WelderNum = summary.WelderNum, + TotalDineNum = summary.TotalDineNum, + CompleteDineNum = summary.CompleteDineNum, + TotalFilmNum = summary.TotalFilmNum, + OKFilmNum = summary.OKFilmNum, CreateMan = Const.sysglyId, CreateDate = DateTime.Now }; Project_HJGLData_HJGLService.DeleteProject_HJGLData_HJGLByDate(DateTime.Now.Date); + var projectIds = UnderConstructionProjectIds.ToList(); // 预先对 dineInfoList 和 chCheckItemList 按 ProjectId 进行分组 var dineInfoDict = dineInfoList - .Where(x => BeUnderConstructionList.Contains(x.ProjectId)) .GroupBy(x => x.ProjectId) .ToDictionary(g => g.Key, g => new { @@ -362,7 +469,6 @@ namespace BLL }); var chCheckItemDict = chCheckItemList - .Where(x => BeUnderConstructionList.Contains(x.ProjectId)) .GroupBy(x => x.ProjectId) .ToDictionary(g => g.Key, g => new { @@ -370,7 +476,7 @@ namespace BLL OKFilmNum = g.Sum(x => x.CHT_PassFilm) }); - foreach (var projectid in BeUnderConstructionList) + foreach (var projectid in projectIds) { // 获取焊工数量 int welderCount = welderNum.Count(x => x.ProjectId == projectid); @@ -469,8 +575,7 @@ namespace BLL /// public static List GetWelderNum() { - var result = (from x in Funs.DB.SitePerson_Person - where BeUnderConstructionList.Contains(x.ProjectId) && x.WorkPostId == Const.WorkPost_Welder && x.States == "1" + var result = (from x in QueryWelders(UnderConstructionProjectIds) select new Model.WelderOutput() { ProjectId = x.ProjectId, @@ -481,6 +586,12 @@ namespace BLL }).ToList(); return result; } + + private static IQueryable QueryWelders(IQueryable projectIds) + { + return Funs.DB.SitePerson_Person.Where(x => projectIds.Contains(x.ProjectId) + && x.WorkPostId == Const.WorkPost_Welder && x.States == Const.ProjectPersonStates_1); + } /// /// 获取焊工总数(异步) /// @@ -496,17 +607,40 @@ namespace BLL /// public static IEnumerable GetDineInfo() { - var result = (from x in Funs.DB.HJGL_WeldJoint - where BeUnderConstructionList.Contains(x.ProjectId) + var projectIds = UnderConstructionProjectIds; + var result = (from x in QueryWeldsWithDaily() + where projectIds.Contains(x.ProjectId) group x by x.ProjectId into g select new Model.WeldDineOutput() { ProjectId = g.Key, Size = g.Sum(x => x.Size), - DoneDin = g.Sum(x => x.Dia) - }); + DoneDin = g.Sum(x => x.DailyId != null ? x.Size : 0m) + }).ToList(); return result; } + + private sealed class WeldWithDaily + { + public string ProjectId { get; set; } + public string WeldJointId { get; set; } + public decimal? Size { get; set; } + public string DailyId { get; set; } + public DateTime? WeldingDate { get; set; } + } + + private static IQueryable QueryWeldsWithDaily() + { + return from weld in Funs.DB.HJGL_WeldJoint + join daily in Funs.DB.HJGL_WeldingDaily + on new { weld.ProjectId, weld.WeldingDailyId } equals new { daily.ProjectId, daily.WeldingDailyId } into records + from daily in records.DefaultIfEmpty() + select new WeldWithDaily + { + ProjectId = weld.ProjectId, WeldJointId = weld.WeldJointId, Size = weld.Size, + DailyId = daily.WeldingDailyId, WeldingDate = daily.WeldingDate + }; + } public static async Task> GetDineInfoAsync() { return await Task.Run(GetDineInfo); @@ -517,9 +651,9 @@ namespace BLL /// public static List GetCHCheckItem() { - var result = (from x in Funs.DB.HJGL_Batch_NDEItem - join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID - where BeUnderConstructionList.Contains(y.ProjectId) + var result = (from inspection in QueryReportedItems(UnderConstructionProjectIds) + let x = inspection.Item + let y = inspection.Report select new Model.CHCheckItemOutput() { Id = x.NDEItemID, @@ -531,6 +665,20 @@ namespace BLL }).ToList(); return result; } + + private sealed class ReportedItem + { + public HJGL_Batch_NDEItem Item { get; set; } + public HJGL_Batch_NDE Report { get; set; } + } + + private static IQueryable QueryReportedItems(IQueryable projectIds) + { + return from item in Funs.DB.HJGL_Batch_NDEItem + join report in Funs.DB.HJGL_Batch_NDE on item.NDEID equals report.NDEID + where projectIds.Contains(report.ProjectId) + select new ReportedItem { Item = item, Report = report }; + } /// /// 获取焊接检查信息(异步) /// @@ -540,4 +688,4 @@ namespace BLL return await Task.Run(GetCHCheckItem); } } -} \ No newline at end of file +} diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx index 1346ca21..beb0d22d 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx @@ -471,6 +471,12 @@ + + + + + @@ -487,6 +493,25 @@ + @@ -501,11 +526,74 @@ Target="Parent" EnableResize="false" runat="server" IsModal="true" OnClose="Window2_Close" Width="800px" Height="600px"> + + + + + + diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs index cd9bd005..ec0efff8 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs @@ -20,7 +20,8 @@ namespace FineUIPro.Web.SysManage /// protected void Page_Load(object sender, EventArgs e) { - this.TabAdminDashboard.Hidden = this.CurrUser.PersonId != Const.hfnbdId; + bool isAdmin = this.CurrUser?.PersonId == Const.hfnbdId; + this.TabAdminDashboard.Hidden = this.TabMenuSettings.Hidden = !isAdmin; if (!IsPostBack) { /// TAB1加载页面方法 @@ -30,9 +31,11 @@ namespace FineUIPro.Web.SysManage this.LoadTab2Data(); /// TAB2加载页面方法 this.LoadTab3Data(); - if (this.CurrUser.PersonId == Const.hfnbdId) + if (isAdmin) { this.ckLoadMultiLanguage.Checked = UiLanguage.IsEnabled; + this.txtCompanyDashboardTitle.Text = SysConstSetService.CompanyDashboardTitle; + LoadMenuSettingsTypes(); this.btnReport.Hidden = false; this.TabHttpLog.Hidden = false; } @@ -471,9 +474,11 @@ namespace FineUIPro.Web.SysManage protected void btnAdminSave_Click(object sender, EventArgs e) { - if (this.CurrUser.PersonId != Const.hfnbdId) + RequireDashboardAdmin(); + string title = txtCompanyDashboardTitle.Text.Trim(); + if (title.Length > 50 || title.Any(char.IsControl)) { - Alert.ShowInTop(BLL.UiText.Message("您没有权限!"), MessageBoxIcon.Warning); + Alert.Show(UiText.Message("请输入不超过 50 个字符的单行标题。"), MessageBoxIcon.Warning); return; } using (var db = new Model.SGGLDB(Funs.ConnString)) @@ -489,12 +494,202 @@ namespace FineUIPro.Web.SysManage db.Sys_Const.InsertOnSubmit(setting); } setting.ConstValue = this.ckLoadMultiLanguage.Checked ? "1" : "0"; + + var titleSetting = db.Sys_Const.FirstOrDefault(x => x.ConstText == SysConstSetService.CompanyDashboardTitleSetting); + if (titleSetting == null) + { + titleSetting = new Model.Sys_Const + { + ID = SQLHelper.GetNewID(), + ConstText = SysConstSetService.CompanyDashboardTitleSetting + }; + db.Sys_Const.InsertOnSubmit(titleSetting); + } + titleSetting.ConstValue = title; db.SubmitChanges(); } - BLL.LogService.AddSys_Log(this.CurrUser, "修改管理员看板多语言设置!", string.Empty, Const.SysConstSetMenuId, Const.BtnModify); + BLL.LogService.AddSys_Log(this.CurrUser, "修改管理员看板设置!", string.Empty, Const.SysConstSetMenuId, Const.BtnModify); PageContext.RegisterStartupScript("top.location.reload();"); } + #region 菜单设置 + private void RequireDashboardAdmin() + { + if (CurrUser?.PersonId != Const.hfnbdId) throw new HttpException(403, "您没有权限!"); + } + + private void LoadMenuSettingsTypes() + { + var types = ConstValue.drpConstItemList(ConstValue.Group_MenuType_S) + .Concat(ConstValue.drpConstItemList(ConstValue.Group_MenuType_P)); + var definedTypes = Funs.DB.Sys_Menu.Select(x => x.MenuType).Distinct().ToList(); + foreach (var type in types.Where(x => definedTypes.Contains(x.ConstValue, StringComparer.OrdinalIgnoreCase))) + { + string scope = type.GroupId == ConstValue.Group_MenuType_S + ? UiText.Get("T_公司级") : UiText.Get("T_项目级"); + string label = scope + " · " + UiText.Get(type.ConstText); + drpMenuSourceType.Items.Add(new ListItem(label, type.ConstValue)); + if (!SysMenuService.IsRemovedCompanySection(type.ConstValue)) + { + drpMenuTargetType.Items.Add(new ListItem(label, type.ConstValue)); + } + } + drpMenuSourceType.SelectedValue = Const.Menu_SysSet; + BindMenuSettingsTree(treeMenuSettings, drpMenuSourceType.SelectedValue, false); + } + + private void BindMenuSettingsTree(Tree tree, string menuType, bool foldersOnly) + { + tree.Nodes.Clear(); + var root = new TreeNode { NodeID = "0", Text = UiText.Get("T_菜单根目录"), Expanded = true, Selectable = foldersOnly }; + tree.Nodes.Add(root); + var menus = SysMenuService.GetMenuListByMenuType(menuType) + .Where(x => !foldersOnly || x.IsEnd != true) + .ToLookup(x => x.SuperMenu, StringComparer.OrdinalIgnoreCase); + AddMenuSettingsNodes(root, menus); + } + + private static void AddMenuSettingsNodes(TreeNode parent, ILookup menus) + { + foreach (var menu in menus[parent.NodeID]) + { + var node = new TreeNode + { + NodeID = menu.MenuId, + Text = HttpUtility.HtmlEncode(menu.MenuName) + (menu.IsUsed == true ? "" : " (" + UiText.Get("T_停用") + ")"), + Leaf = menu.IsEnd == true, + Expanded = parent.NodeID == "0" + }; + parent.Nodes.Add(node); + AddMenuSettingsNodes(node, menus); + } + } + + protected void drpMenuSourceType_SelectedIndexChanged(object sender, EventArgs e) + { + RequireDashboardAdmin(); + BindMenuSettingsTree(treeMenuSettings, drpMenuSourceType.SelectedValue, false); + } + + private Sys_Menu GetSelectedMenuForMaintenance() + { + RequireDashboardAdmin(); + string id = treeMenuSettings.SelectedNodeID; + string type = drpMenuSourceType.SelectedValue; + var menu = Funs.DB.Sys_Menu.FirstOrDefault(x => x.MenuId == id && x.MenuType == type); + if (menu == null) + { + Alert.Show(UiText.Message("请选择要维护的菜单。"), MessageBoxIcon.Warning); + return null; + } + ViewState["MaintainedMenuId"] = menu.MenuId; + ViewState["MaintainedMenuType"] = menu.MenuType; + return menu; + } + + protected void btnOpenMenuEdit_Click(object sender, EventArgs e) + { + var menu = GetSelectedMenuForMaintenance(); + if (menu == null) return; + txtMenuName.Text = menu.MenuName; + txtMenuUrl.Text = menu.Url; + txtMenuSortIndex.Text = menu.SortIndex?.ToString() ?? ""; + ckMenuIsUsed.Checked = menu.IsUsed == true; + PageContext.RegisterStartupScript(windowMenuEdit.GetShowReference()); + } + + protected void btnSaveMenuEdit_Click(object sender, EventArgs e) + { + RequireDashboardAdmin(); + string name = txtMenuName.Text.Trim(); + string url = txtMenuUrl.Text.Trim(); + string sortText = txtMenuSortIndex.Text.Trim(); + int sortIndex = 0; + if (name.Length == 0 || name.Length > 50 || name.Any(char.IsControl) || + (sortText.Length != 0 && !int.TryParse(sortText, out sortIndex))) + { + Alert.Show(UiText.Message("请填写有效的菜单名称和整数排序。"), MessageBoxIcon.Warning); + return; + } + if (url.Length > 200 || (url.Length != 0 && + (url.StartsWith("/") || url.Contains("\\") || url.Any(char.IsControl) || + !Uri.IsWellFormedUriString(url, UriKind.Relative) || url.Split('?', '#')[0].Contains(":")))) + { + Alert.Show(UiText.Message("菜单地址须为站内相对地址,且不超过 200 个字符。"), MessageBoxIcon.Warning); + return; + } + + string id = (string)ViewState["MaintainedMenuId"]; + string type = (string)ViewState["MaintainedMenuType"]; + using (var db = new SGGLDB(Funs.ConnString)) + { + db.Connection.Open(); + using (var transaction = db.Connection.BeginTransaction(IsolationLevel.Serializable)) + { + db.Transaction = transaction; + var menu = db.Sys_Menu.FirstOrDefault(x => x.MenuId == id && x.MenuType == type); + if (menu == null) + { + Alert.Show(UiText.Message("菜单已变更,请重新选择。"), MessageBoxIcon.Warning); + return; + } + menu.MenuName = name; + menu.Url = url; + menu.SortIndex = sortText.Length == 0 ? (int?)null : sortIndex; + menu.IsUsed = ckMenuIsUsed.Checked; + SysMenuService.TrackNavigationChanges(db, menu.MenuType, new List { menu.MenuId }); + db.SubmitChanges(); + transaction.Commit(); + } + } + BLL.LogService.AddSys_Log(CurrUser, "编辑菜单", id, Const.SysConstSetMenuId, Const.BtnModify); + BindMenuSettingsTree(treeMenuSettings, drpMenuSourceType.SelectedValue, false); + PageContext.RegisterStartupScript(windowMenuEdit.GetHideReference()); + ShowNotify("保存成功!刷新首页后生效。", MessageBoxIcon.Success); + } + + protected void btnOpenMenuMove_Click(object sender, EventArgs e) + { + var menu = GetSelectedMenuForMaintenance(); + if (menu == null) return; + drpMenuTargetType.SelectedValue = SysMenuService.IsRemovedCompanySection(menu.MenuType) ? Const.Menu_SysSet : menu.MenuType; + BindMenuSettingsTree(treeMenuTarget, drpMenuTargetType.SelectedValue, true); + PageContext.RegisterStartupScript(windowMenuMove.GetShowReference()); + } + + protected void drpMenuTargetType_SelectedIndexChanged(object sender, EventArgs e) + { + RequireDashboardAdmin(); + BindMenuSettingsTree(treeMenuTarget, drpMenuTargetType.SelectedValue, true); + } + + protected void btnSaveMenuMove_Click(object sender, EventArgs e) + { + RequireDashboardAdmin(); + string targetType = drpMenuTargetType.SelectedValue; + string targetParent = treeMenuTarget.SelectedNodeID; + string id = (string)ViewState["MaintainedMenuId"]; + string sourceType = (string)ViewState["MaintainedMenuType"]; + if (string.IsNullOrEmpty(targetType) || string.IsNullOrEmpty(targetParent) || + !drpMenuTargetType.Items.Cast().Any(x => x.Value == targetType)) + { + Alert.Show(UiText.Message("请选择目标菜单类型和目录。"), MessageBoxIcon.Warning); + return; + } + bool isOffice = ConstValue.drpConstItemList(ConstValue.Group_MenuType_S).Any(x => x.ConstValue == targetType); + if (!SysMenuService.MoveMenu(id, sourceType, targetType, targetParent, isOffice)) + { + Alert.Show(UiText.Message("目标目录无效,或位于所选菜单及其子菜单内。"), MessageBoxIcon.Warning); + return; + } + BLL.LogService.AddSys_Log(CurrUser, "迁移菜单", id, Const.SysConstSetMenuId, Const.BtnModify); + drpMenuSourceType.SelectedValue = targetType; + BindMenuSettingsTree(treeMenuSettings, targetType, false); + PageContext.RegisterStartupScript(windowMenuMove.GetHideReference()); + ShowNotify("保存成功!刷新首页后生效。", MessageBoxIcon.Success); + } + #endregion + #region TAB2加载页面方法 /// /// TAB2加载页面方法 diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs index 9277c557..2d7597a3 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs @@ -1000,9 +1000,23 @@ namespace FineUIPro.Web.SysManage { protected global::FineUIPro.Tab TabAdminDashboard; protected global::FineUIPro.Form FormAdminDashboard; + protected global::FineUIPro.TextBox txtCompanyDashboardTitle; protected global::FineUIPro.CheckBox ckLoadMultiLanguage; protected global::FineUIPro.Toolbar ToolbarAdminDashboard; protected global::FineUIPro.Button btnAdminSave; + + protected global::FineUIPro.Tab TabMenuSettings; + protected global::FineUIPro.DropDownList drpMenuSourceType; + protected global::FineUIPro.Tree treeMenuSettings; + protected global::FineUIPro.Window windowMenuEdit; + protected global::FineUIPro.TextBox txtMenuName; + protected global::FineUIPro.TextBox txtMenuUrl; + protected global::FineUIPro.NumberBox txtMenuSortIndex; + protected global::FineUIPro.CheckBox ckMenuIsUsed; + protected global::FineUIPro.Window windowMenuMove; + protected global::FineUIPro.DropDownList drpMenuTargetType; + protected global::FineUIPro.Tree treeMenuTarget; + protected global::FineUIPro.Menu menuSettingsActions; /// /// TabHttpLog 控件。 diff --git a/SGGL/FineUIPro.Web/SysManage/UserList.aspx.cs b/SGGL/FineUIPro.Web/SysManage/UserList.aspx.cs index 7e6bbf4f..a4ff8184 100644 --- a/SGGL/FineUIPro.Web/SysManage/UserList.aspx.cs +++ b/SGGL/FineUIPro.Web/SysManage/UserList.aspx.cs @@ -42,7 +42,7 @@ From Person_Persons AS person LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=person.UnitId LEFT JOIN Base_Depart AS Depart ON Depart.DepartId=person.DepartId - WHERE RoleIds IS NOT NULL AND RoleIds != '' AND Account IS NOT NULL AND Account !='' + WHERE person.Account IS NOT NULL AND person.Account != '' AND person.PersonId !='" + Const.sysglyId + "' AND person.PersonId !='" + Const.hfnbdId + "' AND person.PersonId !='" + Const.sedinId + "'"; List listStr = new List(); //if (rbUnit.SelectedValue == "0") @@ -82,7 +82,9 @@ } if (!string.IsNullOrEmpty(this.txtRoleName.Text.Trim())) { - strSql += " AND Roles.RoleName LIKE @RoleName"; + strSql += @" AND EXISTS (SELECT 1 FROM Sys_Role AS role + WHERE role.RoleName LIKE @RoleName + AND CHARINDEX(',' + role.RoleId + ',', ',' + person.RoleIds + ',') > 0)"; listStr.Add(new SqlParameter("@RoleName", "%" + this.txtRoleName.Text.Trim() + "%")); } //if (this.ckIsOutSideEmploy.Checked) diff --git a/SGGL/FineUIPro.Web/common/main.aspx b/SGGL/FineUIPro.Web/common/main.aspx index 8f72b128..b7d87a1b 100644 --- a/SGGL/FineUIPro.Web/common/main.aspx +++ b/SGGL/FineUIPro.Web/common/main.aspx @@ -1,954 +1,126 @@ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main.aspx.cs" Inherits="FineUIPro.Web.common.main" %> - +<%@ Import Namespace="System.Globalization" %> - - - + + <asp:Literal runat="server" Mode="Encode" Text="<%$ Resources:UiText, T_首页 %>" /> - - - + -
-
-
-
-
-
-
-
-
-
-
- -
-
0
-
-
-
- -
-
0
-
-
-
- -
-
-
+
+
+
+

<%: TextFor("焊接工作量") %>

+
+
+
<%: TextFor("当月完成焊接达因数") %>
+
<%: Dine(Welding.MonthCompletedDine) %> + <% if (Welding.TotalDine > 0) { %> + + <% } %>
+
+
+
<%: TextFor("累计完成焊接达因数") %>
+
<%: Dine(Welding.CompletedDine) %> + <% if (Welding.TotalDine > 0) { %> + + <% } %>
+
+
+
<%: TextFor("总焊接达因数") %>
+
<%: Dine(Welding.TotalDine) %>
+
+
+
+
+

<%: TextFor("焊接进度") %>

+
+
+ <%: TextFor("已完成") %> + <%: TextFor("剩余") %> + <%: TextFor("单位_达因") %> +
+
<%: TextFor("项目_累计工作量") %><%: TextFor("本月完成") %>
+
+ <% foreach (var project in ProgressProjects) { %> + + <%: project.ProjectName %><%: Dine(project.CurrentMonth.CompletedDine) %> + + <%: TextFor("已完成") %> <%: Dine(project.CompletedDine) %><%: TextFor("剩余") %> <%: Dine(project.RemainingDine) %> + + <% } %> + <% if (ProgressProjects.Count == 0) { %>

<%: TextFor("暂无在建项目") %>

<% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
0
-
-
-
-
-
-
-
--
-
-
-
-
-
-
-
--
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0 -
-
-
-
- - -
-
-
- - -
-
-
-
-
-
-
-
-
-
-
- -
- - 2020-10-10 12:40:26 -
-
-
-
-
6
-
-
-
-
4
-
-
-
-
-
-
-
+
-
+
+
+

<%: TextFor("在建项目分布") %>

+
<%: TextFor("在建项目数量") %> <%: Welding.Projects.Count %>
+
+ +
+
+

<%: TextFor("近六月焊接趋势") %>

+
<%: string.Format(TextFor("截至某日"), AsOfDate.ToString("M", CultureInfo.CurrentUICulture)) %>
+ +
+
+
+
+

<%: TextFor("焊接质量与人员") %>

+
+
+
<%: TextFor("当月一次焊接合格率") %>
+
<%: Rate(Welding.MonthFirstPassRate) %>
+
+
+
<%: TextFor("累计一次焊接合格率") %>
+
<%: Rate(Welding.FirstPassRate) %>
+
+
+
<%: TextFor("焊工人数") %>
+
<%: Welding.WelderCount.ToString("#,0") %>
+
+
+
+
+

<%: TextFor("项目焊接合格率") %>

+
+
<%: TextFor("公司当月一次合格率") %> <%: Rate(Welding.MonthFirstPassRate) %>
+
+ + + + <% foreach (var project in QualityProjects) { var month = project.CurrentMonth; %> + + + + + + <% } %> + <% if (QualityProjects.Count == 0) { %><% } %> + +
<%: TextFor("项目") %><%: TextFor("一次合格率") %><%: TextFor("合格片数_总片数") %>
<%: project.ProjectName %>"><%: month.FirstPassRate.HasValue ? Rate(month.FirstPassRate) : TextFor("暂无检测") %><%: month.TotalFilms > 0 ? string.Format("{0:#,0} / {1:#,0}", month.PassedFilms, month.TotalFilms) : "—" %>
<%: TextFor("暂无在建项目") %>
+
+ <% if (Welding.MonthFirstPassRate.HasValue) { %><% } %> +
+
+
+ + + + + + - - - - - - - - - - diff --git a/SGGL/FineUIPro.Web/common/main.aspx.cs b/SGGL/FineUIPro.Web/common/main.aspx.cs index 2e3c42cb..521b3030 100644 --- a/SGGL/FineUIPro.Web/common/main.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main.aspx.cs @@ -2,225 +2,79 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; +using System.Web; namespace FineUIPro.Web.common { public partial class main : PageBase { + protected Model.CompanyWeldingDashboard Welding; + protected List ProgressProjects, QualityProjects; + protected decimal LargestProjectDine; + protected DateTime AsOfDate; + protected string ChartsJson; + protected void Page_Load(object sender, EventArgs e) { - if (!IsPostBack) + AsOfDate = DateTime.Today; + Welding = HJGLData_HJGLService.GetCompanyWeldingDashboard(AsOfDate); + ProgressProjects = Welding.Projects.OrderByDescending(x => x.RemainingDine).ThenBy(x => x.ProjectName).ToList(); + QualityProjects = Welding.Projects.OrderBy(x => !x.CurrentMonth.FirstPassRate.HasValue) + .ThenBy(x => x.CurrentMonth.FirstPassRate).ThenBy(x => x.ProjectName).ToList(); + LargestProjectDine = Welding.Projects.Select(x => x.TotalDine).DefaultIfEmpty().Max(); + + var points = new List(); + string tooltipFormat = GetGlobalResourceObject("UiText", "T_项目名称") + ":{0}\n" + + GetGlobalResourceObject("UiText", "T_开工日期") + ":{1:yyyy-MM-dd}\n" + + GetGlobalResourceObject("UiText", "T_竣工日期") + ":{2:yyyy-MM-dd}\n" + + GetGlobalResourceObject("UiText", "T_项目地址") + ":{3}"; + foreach (var project in Welding.Projects.Where(x => !string.IsNullOrWhiteSpace(x.MapCoordinates))) { - ////项目信息 - var getProjectLists = getProjectInfo(); - ///劳务统计 - getSitePerson(); - /// 获取质量问题 - getCQMSProblem(); - /// 获取施工产值 - getOutputValue(getProjectLists); + var coordinates = project.MapCoordinates.Split(','); + decimal longitude, latitude; + if (coordinates.Length != 2 + || !decimal.TryParse(coordinates[0], NumberStyles.Float, CultureInfo.InvariantCulture, out longitude) + || !decimal.TryParse(coordinates[1], NumberStyles.Float, CultureInfo.InvariantCulture, out latitude) + || Math.Abs(longitude) > 180 || Math.Abs(latitude) > 90) + continue; + + points.Add(new + { + name = project.ProjectName, + value = new[] { longitude, latitude }, + tooltipText = string.Format(tooltipFormat, project.ProjectName, project.StartDate, project.EndDate, project.ProjectAddress), + url = ProjectUrl(project.ProjectId) + }); } + ChartsJson = JsonConvert.SerializeObject(new + { + points, + months = Welding.Months.Select(x => new + { + label = x.Month.ToString(UiLanguage.Current == "en" ? "MMM" : "M月", CultureInfo.CurrentUICulture), + dine = x.CompletedDine, + rate = x.FirstPassRate * 100m + }), + quality = QualityProjects.Where(x => x.CurrentMonth.TotalFilms > 0).Select(x => new + { + name = x.ProjectName, rate = x.CurrentMonth.FirstPassRate * 100m, url = ProjectUrl(x.ProjectId) + }), + companyRate = Welding.MonthFirstPassRate * 100m, + labels = new + { + volume = TextFor("完成焊接量_万达因"), rate = TextFor("焊接一次合格率"), + dine = TextFor("达因") + } + }, new JsonSerializerSettings { StringEscapeHandling = StringEscapeHandling.EscapeHtml }); } - - #region 项目信息 - protected string ProjectInfo; - /// - /// 项目信息 - /// - private List getProjectInfo() - { - ProjectInfo = "[]"; - var getProjects = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && x.ProjectId != Const.Project_TestProjectId); - this.divProjectNum.InnerHtml = getProjects.Count().ToString(); - var getProjectMap = getProjects.Where(x => x.MapCoordinates.Length > 0); - if (getProjectMap.Count() > 0) - { - List list = new List(); - foreach (var item in getProjectMap) - { - Model.SingleSerie newS = new Model.SingleSerie - { - name = "【项目名称】:" + item.ProjectName - //+ "
【项目状态】:" + GetProjectState(item.ProjectId) - + "
【开工时间】:" + string.Format("{0:yyyy-MM-dd}", item.StartDate) - + "
【竣工时间】:" + string.Format("{0:yyyy-MM-dd}", item.EndDate) - + "
【项目地址】:" + item.ProjectAddress, - url = "indexProject.aspx?projectId=" + item.ProjectId, - cityname = "中国" - }; - var strMap = Funs.GetStrListByStr(item.MapCoordinates, ','); - if (strMap.Count > 1) - { - newS.value = new[] { Funs.GetNewDecimalOrZero(strMap[0]), Funs.GetNewDecimalOrZero(strMap[1]) }; - list.Add(newS); - } - } - ProjectInfo = JsonConvert.SerializeObject(list); - } - - return getProjects.ToList(); - } - #endregion - - #region 劳务统计 - protected double OnDutyRate; - /// - /// 劳务统计 - /// - private void getSitePerson() - { - OnDutyRate = 0; - int AllCount = 0; - int MCount = 0; - var getallin = APIPageDataService.getPersonInOutAllNum(DateTime.Now.AddDays(-1)); - AllCount = getallin.Count(); - if (AllCount > 0) - { - MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count(); - /////管理人数 - this.divGLPerson.InnerHtml = MCount.ToString(); - /////作业人数 - this.divZYPerson.InnerHtml = (AllCount - MCount).ToString(); - int getPersonCount = Funs.DB.SitePerson_Person.Where(x => x.States == Const.State_1 && x.CardNo.Length > 1).Count(); - if (getPersonCount > 0) - { - OnDutyRate = Math.Round(AllCount * 1.0 / getPersonCount * 100, 1); - } - } - } - #endregion - - #region 获取质量问题 - protected double CRectificationRate; - protected double CQualifiedRate; - /// - /// 获取质量问题 - /// - private void getCQMSProblem() - { - ///整改率 - CRectificationRate = 0; - ///合格率 - CQualifiedRate = 0; - var getCheckControl = from x in Funs.DB.Check_CheckControl select x; - ///问题总数 - int AllCount = getCheckControl.Count(); - this.divCQMSAllNum.InnerHtml = AllCount.ToString(); - if (AllCount > 0) - { - ///问题完成数 - var getCOk = getCheckControl.Where(x => x.State == "7").Count(); - int CCount = getCOk; - if (CCount > 0) - { - CRectificationRate = Math.Round(CCount * 1.0 / AllCount * 100, 1); - } - } - - var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail - join y in Funs.DB.WBS_ControlItemAndCycle on x.ControlItemAndCycleId equals y.ControlItemAndCycleId - where y.ControlPoint != "C" && y.ControlPoint != "CR" && x.IsOK != null - select x; - int AllSpotCount = getSpotCheckDetail.Count(); - if (AllSpotCount > 0) - { - int okSpotCount = getSpotCheckDetail.Where(x => x.IsOK == true).Count(); - if (okSpotCount > 0) - { - CQualifiedRate = Math.Round(okSpotCount * 1.0 / AllSpotCount * 100, 1); - } - } - } - #endregion - - /// - /// 进度 - /// - protected string projectJDHtml; - /// - /// 月施工计划产值 - /// - protected string MonthPlanOutPutValue; - /// - /// 月施工实际产值 - /// - protected string MonthActualOutPutValue; - /// - /// 获取当年施工产值 - /// - private void getOutputValue(List getProjectLists) - { - MonthPlanOutPutValue = "[0,0,0,0,0,0,0,0,0,0,0,0]"; - MonthActualOutPutValue = "[0,0,0,0,0,0,0,0,0,0,0,0]"; - projectJDHtml = ""; - - DateTime nowdate = DateTime.Now; - var getOutputValue = Funs.DB.Sys_OutputValueProject.Where(x => x.Year == nowdate.Year); - if (getOutputValue.Count() > 0) - { - var getPV = Math.Round(getOutputValue.Sum(x => x.PlanOutPutValue ?? 0) / 10000, 2); - var getAV = Math.Round(getOutputValue.Sum(x => x.ActualOutPutValue ?? 0) / 10000, 2); - this.divYearPlanOutPutValue.InnerHtml = getPV.ToString(); - this.divYearActualOutPutValue.InnerHtml = getAV.ToString(); - } - - DateTime date = DateTime.Now.AddMonths(-11); - var getOutputValueA = Funs.DB.Sys_OutputValueProject.Where(x => x.Year > date.Year || (x.Year == date.Year && x.Month >= date.Month)); - - - decimal[] monthValues = new decimal[12]; - decimal[] monthValues2 = new decimal[12]; - // var getOutYearValues = Funs.DB.Sys_OutputValueProject.Where(x => x.Year == DateTime.Now.Year); - if (getOutputValueA.Count() > 0) - { - for (int i = 0; i < 12; i++) - { - monthValues[i] = 0; - monthValues2[i] = 0; - var getOutMI = getOutputValueA.Where(x => x.Month == (i + 1)); - if (getOutMI.Count() > 0) - { - monthValues[i] = getOutMI.Sum(x => x.PlanOutPutValue ?? 0); - monthValues2[i] = getOutMI.Sum(x => x.ActualOutPutValue ?? 0); - } - } - - MonthPlanOutPutValue = JsonConvert.SerializeObject(monthValues); - MonthActualOutPutValue = JsonConvert.SerializeObject(monthValues2); - if (getProjectLists.Count() > 0) - { - foreach (var item in getProjectLists) - { - string shortName = item.ShortName; - string jdRate = "0%"; - var getOutProjectV = getOutputValueA.Where(x => x.ProjectId == item.ProjectId); - if (getOutProjectV.Count() > 0) - { - decimal sumPlan = getOutProjectV.Sum(x => x.PlanOutPutValue ?? 0); - if (sumPlan > 0) - { - decimal sumActual = getOutProjectV.Sum(x => x.ActualOutPutValue ?? 0); - jdRate = Math.Round(sumActual * 100 / sumPlan, 1).ToString() + "%"; - } - } - projectJDHtml += @"
【在建】" + shortName + "
"; - } - } - } - else - { - if (getProjectLists.Count() > 0) - { - foreach (var item in getProjectLists) - { - string shortName = item.ShortName; - string jdRate = "0%"; - projectJDHtml += @"
【在建】" + shortName + "
"; - } - } - } - } + protected string TextFor(string key) => (string)GetGlobalResourceObject("UiText", "T_" + key); + protected string ProjectUrl(string id) => ResolveUrl("~/indexProject.aspx?projectId=" + HttpUtility.UrlEncode(id)); + protected static string Dine(decimal value) => value.ToString("#,0.############################"); + protected static string Rate(decimal? value) => value?.ToString("0.00%") ?? "--"; + protected static string Width(decimal part, decimal total) => + (total > 0 ? part / total : 0m).ToString("0.####%", CultureInfo.InvariantCulture); } } diff --git a/SGGL/FineUIPro.Web/common/main.aspx.designer.cs b/SGGL/FineUIPro.Web/common/main.aspx.designer.cs index c7038339..a4b4c6a3 100644 --- a/SGGL/FineUIPro.Web/common/main.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/common/main.aspx.designer.cs @@ -20,59 +20,5 @@ namespace FineUIPro.Web.common { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlHead Head1; - - /// - /// divGLPerson 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divGLPerson; - - /// - /// divZYPerson 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divZYPerson; - - /// - /// divProjectNum 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divProjectNum; - - /// - /// divYearPlanOutPutValue 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divYearPlanOutPutValue; - - /// - /// divYearActualOutPutValue 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divYearActualOutPutValue; - - /// - /// divCQMSAllNum 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divCQMSAllNum; } } diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx b/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx index 4b37840a..e0bd7605 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx @@ -146,8 +146,6 @@
  • - <%--
  • 单位工程
  • -
  • 材质类别
  • --%>
@@ -197,12 +195,6 @@ ////////////////////焊工业绩分析 var dataE06_Type01 = JSON.parse('<%=E06_Type01 %>'); var dataE06_Values01 = JSON.parse('<%=E06_Values01 %>'); - // 单位工程 - var dataE06_Type02 = JSON.parse('<%=E06_Type02 %>'); - var dataE06_Values02 = JSON.parse('<%=E06_Values02 %>'); - // 材料类别 - var dataE06_Type03 = JSON.parse('<%=E06_Type03 %>'); - var dataE06_Values03 = JSON.parse('<%=E06_Values03 %>'); @@ -210,17 +202,6 @@ ///一次合格率 // 施工分包商 - $('.sub-section-02 ul li').click(function () { - var value = $(this).text() - var type = $(this).attr('data-type') - $(this).parent('ul').siblings('.sub-select-name').find('.sub-select-value').text(value) - <%-- if (type == '1') { - initEchart02({ canvasId: 'echarts02', y: <%=Dy1 %>, n: <%=Dy2 %> }) - } else if (type == '2') { - initEchart02({ canvasId: 'echarts02', y: <%=HK1 %>, n: <%=HK2 %> }) - }--%> - <%-- initEchart02({ canvasId: 'echarts02', y: <%=PipeRate1 %>, n: <%=PipeRate2 %> })--%> - }) $('.sub-section-03 ul li').click(function () { var value = $(this).text() var type = $(this).attr('data-type') @@ -240,8 +221,6 @@ } else if (type == '3') { initEchart03({ name: SGGLI18n.t("T_按材质类别"), value: [50, 150, 70, 160, 75, 5], indicator: indicator }) } - // initEchart02({ canvasId: 'echarts03', y: <%=PipeRate1 %>, n: <%=PipeRate2 %> }) - }) $('.sub-section-04 ul li').click(function () { var type = $(this).attr('data-type') @@ -290,12 +269,6 @@ if (type == 'fbs') { // 分包商 initEchart06(dataE06_Type01, dataE06_Values01) - } else if (type == 'dwgc') { - // 单位工程 - initEchart06(dataE06_Type02, dataE06_Values02) - } else if (type == 'czlb') { - // 材质类别 - initEchart06(dataE06_Type03, dataE06_Values03) } }) @@ -771,9 +744,6 @@ myChart.resize(); }); } - // initEchart02({ canvasId: 'echarts01', y: <%=GCRate1 %>, n: <%=GCRate2 %> }) - // initEchart02({ canvasId: 'echarts02', y: <%=XCRate1 %>, n: <%=XCRate2 %> }) - <%-- initEchart02({ canvasId: 'echarts02', y: <%=PipeRate1 %>, n: <%=PipeRate2 %> })--%> // 03的数值 var indicator = [ { text: SGGLI18n.t("T_问题1"), max: 150, }, diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx.cs index f0fa6d15..2636f6b0 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL.aspx.cs @@ -1,4 +1,4 @@ -using BLL; +using BLL; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -10,298 +10,29 @@ namespace FineUIPro.Web { public partial class mainMenu_HJGL : PageBase { - #region 定义集合 - /// - /// 项目单位集合 - /// - protected static List getProjectUnitList = new List(); - /// - /// 所有焊口集合 - /// - protected static List getAllJotList = new List(); - /// - /// 所有管线集合 - /// - protected static List getAllJIsoInfoList = new List(); - /// - /// 所有焊接焊口集合 - /// - protected static List getFinishedJotList = new List(); - /// - /// 当日焊接焊口集合 - /// - protected static List getNowJotList = new List(); - /// - /// 焊接检测单明细集合 - /// - protected static List getCH_CheckItemList = new List(); - /// - /// 所有焊工集合 - /// - protected static IQueryable getAllWelderList; - /// - /// 项目ID - /// - public string ProjectId - { - get - { - return (string)ViewState["ProjectId"]; - } - set - { - ViewState["ProjectId"] = value; - } - } - #endregion - - #region 工厂预制进度 - public decimal GCRate1 - { - get - { - return (decimal)ViewState["GCRate"]; - } - set - { - ViewState["GCRate"] = value; - } - } - public decimal GCRate2 - { - get - { - return (decimal)ViewState["GCRate2"]; - } - set - { - ViewState["GCRate2"] = value; - } - } - #endregion - #region 现场施工进度 - public decimal XCRate1 - { - get - { - return (decimal)ViewState["XCRate1"]; - } - set - { - ViewState["XCRate1"] = value; - } - } - public decimal XCRate2 - { - get - { - return (decimal)ViewState["XCRate2"]; - } - set - { - ViewState["XCRate2"] = value; - } - } - #endregion - #region 管道实时预制率 - - public decimal PipeRate1 - { - get - { - return BLL.HJGL_WeldingReportService.GetPipeRate_finished(this.CurrUser.LoginProjectId); - } - - } - public decimal PipeRate2 - { - get - { - return BLL.HJGL_WeldingReportService.GetPipeRate_unfinished(this.CurrUser.LoginProjectId); - } - - } - #endregion - #region 项目焊接工程量统计 - public decimal Dy1 - { - get - { - return (decimal)ViewState["Dy1"]; - } - set - { - ViewState["Dy1"] = value; - } - } - public decimal Dy2 - { - get - { - return (decimal)ViewState["Dy2"]; - } - set - { - ViewState["Dy2"] = value; - } - } - public int HK1 - { - get - { - return (int)ViewState["HK1"]; - } - set - { - ViewState["HK1"] = value; - } - } - public int HK2 - { - get - { - return (int)ViewState["HK2"]; - } - set - { - ViewState["HK2"] = value; - } - } - #endregion - - /// - /// - /// - /// - /// protected void Page_Load(object sender, EventArgs e) { - this.ProjectId = this.CurrUser.LoginProjectId; - string unitId = this.CurrUser.UnitId; - var getWeldReportMain = from x in Funs.DB.HJGL_WeldingDaily - where x.ProjectId == this.ProjectId - select x; - getProjectUnitList = (from x in Funs.DB.Project_ProjectUnit - where x.ProjectId == this.ProjectId && (x.UnitType == Const.ProjectUnitType_1 || x.UnitType == Const.ProjectUnitType_2) - select x).ToList(); - ////管线集合 - getAllJIsoInfoList = (from x in Funs.DB.HJGL_Pipeline - where x.ProjectId == this.ProjectId - select x).ToList(); - ////总焊口 - getAllJotList = (from x in Funs.DB.HJGL_WeldJoint - where x.ProjectId == this.ProjectId - select x).ToList(); - ////完成焊口 - getFinishedJotList = (from x in getAllJotList - where x.WeldingDailyId != null - select x).ToList(); - ////当日焊接 - getNowJotList = (from x in getFinishedJotList - join y in getWeldReportMain on x.WeldingDailyId equals y.WeldingDailyId - where y.WeldingDate.Value.Year == DateTime.Now.Year && y.WeldingDate.Value.Month == DateTime.Now.Month && y.WeldingDate.Value.Day == DateTime.Now.Day - select x).ToList(); - - ////焊接检测单明细 - getCH_CheckItemList = (from x in Funs.DB.HJGL_Batch_NDEItem - join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId - join z in Funs.DB.View_HJGL_WeldJoint on y.WeldJointId equals z.WeldJointId - join line in Funs.DB.HJGL_Pipeline on z.PipelineId equals line.PipelineId - where z.ProjectId == this.ProjectId - select new Model.sp_index_HJGLItem - { - ProjectId = line.ProjectId, - ID = x.NDEItemID, - UnitId = line.UnitId, ///重定义单位 - UnitName = z.UnitName, - WorkAreaId = line.UnitId, /// 重定义区域 - MaterialId = line.UnitWorkId, ///重定义材质 - CHT_TotalFilm = x.TotalFilm, - CHT_PassFilm = x.PassFilm, - Specification = z.Specification, - WeldTypeCode = z.WeldTypeCode, - JointAttribute = z.JointAttribute, - UnitWorkName = z.UnitWorkName, - MaterialCode = z.MaterialCode - }).ToList(); - ////总焊工 - getAllWelderList = from x in Funs.DB.SitePerson_Person - where x.ProjectId == this.ProjectId && x.WorkPostId == "19B8F2A9-28D3-4F20-867A-1B2237C2E228" - select x; - - this.getrate(this.ProjectId, unitId); - this.getWeld(this.ProjectId, unitId); - this.SetWorkNum(this.ProjectId, unitId); - getecharts04(); - getecharts05(); - getecharts06(); - this.divWelderEfficacyNum.InnerText = BLL.HJGL_WeldingReportService.GetWelderEfficacy(this.CurrUser.LoginProjectId).ToString(); - if (PipeRate1 + PipeRate2 == 0) - { - this.echarts02Value.InnerText = "0"; - } - else - { - this.echarts02Value.InnerText = Math.Floor(Math.Round(decimal.Parse((PipeRate1 / (PipeRate1 + PipeRate2)).ToString("0.000")), 2) * 100).ToString(); - - } + string projectId = this.CurrUser.LoginProjectId; + this.getWeld(projectId, this.CurrUser.UnitId); + getecharts04(projectId); + getecharts05(projectId); + getecharts06(projectId); + this.divWelderEfficacyNum.InnerText = HJGL_WeldingReportService.GetWelderEfficacy(projectId).ToString(); + var pipeStats = (from x in Funs.DB.HJGL_WeldJoint + where x.ProjectId == projectId + group x by x.ProjectId into g + select new + { + TotalDin = g.Sum(x => x.Size ?? 0m), + FinishedDin = g.Sum(x => x.WeldingDailyId != null && x.JointAttribute == "预制口" ? x.Size ?? 0m : 0m) + }).SingleOrDefault(); + this.echarts02Value.InnerText = pipeStats == null || pipeStats.TotalDin == 0 + ? "0" + : Math.Floor(Math.Round(decimal.Parse((pipeStats.FinishedDin / pipeStats.TotalDin).ToString("0.000")), 2) * 100).ToString(); } - private void getrate(string projectId, string unitId) - { - this.GCRate1 = 0; - this.GCRate2 = 0; - this.XCRate1 = 0; - this.XCRate2 = 0; - - decimal allGC = 0; - decimal allXC = 0; - var getWelds = Funs.DB.HJGL_WeldJoint.Where(x => x.ProjectId == projectId); - if (!string.IsNullOrEmpty(this.CurrUser.UnitId)) - { - //getWelds = from x in getWelds - // join y in Funs.DB.HJGL_Pipeline on x.PipelineId equals y.PipelineId - // where y.UnitId == unitId - // select x; - } - if (getWelds.Count() > 0) - { - decimal allDy = getWelds.Sum(x => x.Size ?? 0); //项目总达因数 - - if (getWelds.Where(x => x.JointAttribute == "预制口").Count() > 0) - { - allGC = getWelds.Where(x => x.JointAttribute == "预制口").Sum(x => x.Size ?? 0); - } - if (getWelds.Where(x => x.JointAttribute == "安装口").Count() > 0) - { - allXC = getWelds.Where(x => x.JointAttribute == "安装口").Sum(x => x.Size ?? 0); - } - var getWeldsOk = getWelds.Where(x => x.WeldingDailyId != null); - if (getWeldsOk.Count() > 0) - { - var GCModel = getWeldsOk.Where(x => x.JointAttribute == "预制口"); - if (GCModel.Count() > 0) - { - GCRate1 = GCModel.Sum(x => x.Size ?? 0); - // PipeRate1 = GCRate1; - - } - var XCModel = getWeldsOk.Where(x => x.JointAttribute == "安装口"); - if (XCModel.Count() > 0) - { - XCRate1 = XCModel.Sum(x => x.Size ?? 0); - - } - } - GCRate2 = allGC - GCRate1; - XCRate2 = allXC - XCRate1; - // PipeRate2 = allDy - PipeRate1; - - } - - } #region 焊工现场统计 /// /// 焊工现场统计 @@ -347,38 +78,6 @@ namespace FineUIPro.Web } #endregion - #region 项目焊接工程量统计 - private void SetWorkNum(string projectId, string unitId) - { - this.Dy1 = 0; - this.Dy2 = 0; - this.HK1 = 0; - this.HK2 = 0; - var getWelds = Funs.DB.HJGL_WeldJoint.Where(x => x.ProjectId == projectId); - if (!string.IsNullOrEmpty(this.CurrUser.UnitId) && unitId != CommonService.GetThisUnitId()) - { - getWelds = from x in getWelds - join y in Funs.DB.HJGL_Pipeline on x.PipelineId equals y.PipelineId - where y.UnitId == unitId - select x; - } - if (getWelds.Count() > 0) - { - decimal allDy = getWelds.Sum(x => x.Size ?? 0); - int allHk = getWelds.Count(); - - var getWeldsOk = getWelds.Where(x => x.WeldingDailyId != null); - HK1 = getWeldsOk.Count(); - HK2 = allHk - HK1; - if (HK1 > 0) - { - Dy1 = getWeldsOk.Sum(x => x.Size ?? 0); - } - Dy2 = allDy - Dy1; - } - } - #endregion - #region 焊接一次合格率 protected string E04_Type01; protected string E04_Values01; @@ -392,7 +91,7 @@ namespace FineUIPro.Web protected string E04_Values05; protected string E04_Type06; protected string E04_Values06; - protected void getecharts04() + private void getecharts04(string projectId) { E04_Type01 = "[]"; E04_Values01 = "[]"; @@ -409,17 +108,34 @@ namespace FineUIPro.Web E04_Type06 = "[]"; E04_Values06 = "[]"; + var inspectionItems = (from x in Funs.DB.HJGL_Batch_NDEItem + join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId + join z in Funs.DB.View_HJGL_WeldJoint on y.WeldJointId equals z.WeldJointId + join line in Funs.DB.HJGL_Pipeline on z.PipelineId equals line.PipelineId + where z.ProjectId == projectId + select new + { + x.TotalFilm, + x.PassFilm, + z.UnitName, + z.UnitWorkName, + z.MaterialCode, + z.Specification, + z.WeldTypeCode, + z.JointAttribute + }).ToList(); + double PassRate = 0; int current_pass_film = 0; int cht_totalfilm = 0; //// 按单位 List type01List = new List(); List count011List = new List(); - var tb_type01 = getCH_CheckItemList.GroupBy(x => x.UnitName).Select(x => new + var tb_type01 = inspectionItems.GroupBy(x => x.UnitName).Select(x => new { UnitName = x.Key, - Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0, - Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0 + Current_pass_film = x.Sum(m => m.PassFilm) ?? 0, + Cht_totalfilm = x.Sum(m => m.TotalFilm) ?? 0 }); foreach (var item in tb_type01) { @@ -442,11 +158,11 @@ namespace FineUIPro.Web ///按单位工程 List type02List = new List(); List count021List = new List(); - var tb_type02 = getCH_CheckItemList.GroupBy(x => x.UnitWorkName).Select(x => new + var tb_type02 = inspectionItems.GroupBy(x => x.UnitWorkName).Select(x => new { UnitWorkName = x.Key, - Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0, - Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0 + Current_pass_film = x.Sum(m => m.PassFilm) ?? 0, + Cht_totalfilm = x.Sum(m => m.TotalFilm) ?? 0 }); foreach (var item in tb_type02) { @@ -470,11 +186,11 @@ namespace FineUIPro.Web ///按材质类别 List type03List = new List(); List count031List = new List(); - var tb_type03 = getCH_CheckItemList.GroupBy(x => x.MaterialCode).Select(x => new + var tb_type03 = inspectionItems.GroupBy(x => x.MaterialCode).Select(x => new { MaterialCode = x.Key, - Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0, - Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0 + Current_pass_film = x.Sum(m => m.PassFilm) ?? 0, + Cht_totalfilm = x.Sum(m => m.TotalFilm) ?? 0 }); foreach (var item in tb_type03) { @@ -496,11 +212,11 @@ namespace FineUIPro.Web //焊缝规格 List type04List = new List(); List count041List = new List(); - var tb_type04 = getCH_CheckItemList.GroupBy(x => x.Specification).Select(x => new + var tb_type04 = inspectionItems.GroupBy(x => x.Specification).Select(x => new { Specification = x.Key, - Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0, - Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0 + Current_pass_film = x.Sum(m => m.PassFilm) ?? 0, + Cht_totalfilm = x.Sum(m => m.TotalFilm) ?? 0 }); foreach (var item in tb_type04) { @@ -522,11 +238,11 @@ namespace FineUIPro.Web //焊缝类型 List type05List = new List(); List count051List = new List(); - var tb_type05 = getCH_CheckItemList.GroupBy(x => x.WeldTypeCode).Select(x => new + var tb_type05 = inspectionItems.GroupBy(x => x.WeldTypeCode).Select(x => new { WeldTypeCode = x.Key, - Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0, - Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0 + Current_pass_film = x.Sum(m => m.PassFilm) ?? 0, + Cht_totalfilm = x.Sum(m => m.TotalFilm) ?? 0 }); foreach (var item in tb_type05) { @@ -548,11 +264,11 @@ namespace FineUIPro.Web //焊缝属性 List type06List = new List(); List count061List = new List(); - var tb_type06 = getCH_CheckItemList.GroupBy(x => x.JointAttribute).Select(x => new + var tb_type06 = inspectionItems.GroupBy(x => x.JointAttribute).Select(x => new { JointAttribute = x.Key, - Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0, - Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0 + Current_pass_film = x.Sum(m => m.PassFilm) ?? 0, + Cht_totalfilm = x.Sum(m => m.TotalFilm) ?? 0 }); foreach (var item in tb_type06) { @@ -584,317 +300,80 @@ namespace FineUIPro.Web protected string E05_Values03; protected string E05_Type04; protected string E05_Values04; - protected void getecharts05() - { - E05_Type01 = "[]"; - E05_Values01 = "[]"; - E05_Type02 = "[]"; - E05_Values02 = "[]"; - E05_Type03 = "[]"; - E05_Values03 = "[]"; - E05_Type04 = "[]"; - E05_Values04 = "[]"; - var alllist = from x in Funs.DB.HJGL_Batch_NDEItem - join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID - join z in Funs.DB.View_Batch_NDEItem on x.NDEID equals z.NDEID - join m in Funs.DB.View_HJGL_Pipeline on z.PipelineCode equals m.PipelineCode - join n in Funs.DB.View_HJGL_WeldJoint on z.WeldJointId equals n.WeldJointId - where x.CheckDefects != null && x.CheckDefects != "" && y.ProjectId == this.CurrUser.LoginProjectId - select new - { - x.CheckDefects, - m.MaterialCode, - n.Specification, - n.WeldTypeCode, - n.JointAttribute, - }; - ///按材质类别 - List type01List = new List(); - List count011List = new List(); - var tb_type01 = alllist.GroupBy(x => x.MaterialCode).Select(x => new - { - MaterialCode = x.Key, - Defect = x.Count() - }); - foreach (var item in tb_type01) - { - type01List.Add(item.MaterialCode); - count011List.Add(item.Defect); - } - if (type01List.Count() > 0) - { - E05_Type01 = JsonConvert.SerializeObject(type01List); - E05_Values01 = JsonConvert.SerializeObject(count011List); - } - //焊缝规格 - List type02List = new List(); - List count021List = new List(); - var tb_type02 = alllist.GroupBy(x => x.Specification).Select(x => new - { - Specification = x.Key, - Defect = x.Count() - }); - foreach (var item in tb_type02) - { - type02List.Add(item.Specification); - count021List.Add(item.Defect); - } - if (type02List.Count() > 0) - { - E05_Type02 = JsonConvert.SerializeObject(type02List); - E05_Values02 = JsonConvert.SerializeObject(count021List); - } - //焊缝类型 - List type03List = new List(); - List count031List = new List(); - var tb_type03 = alllist.GroupBy(x => x.WeldTypeCode).Select(x => new - { - WeldTypeCode = x.Key, - Defect = x.Count() - }); - foreach (var item in tb_type03) - { - type03List.Add(item.WeldTypeCode); - count031List.Add(item.Defect); - } - if (type03List.Count() > 0) - { - E05_Type03 = JsonConvert.SerializeObject(type03List); - E05_Values03 = JsonConvert.SerializeObject(count031List); - } - //焊缝属性 - List type04List = new List(); - List count041List = new List(); - var tb_type04 = alllist.GroupBy(x => x.JointAttribute).Select(x => new - { - JointAttribute = x.Key, - Defect = x.Count() - }); - foreach (var item in tb_type04) - { - type04List.Add(item.JointAttribute); - count041List.Add(item.Defect); - } - if (type04List.Count() > 0) - { - E05_Type04 = JsonConvert.SerializeObject(type04List); - E05_Values04 = JsonConvert.SerializeObject(count041List); - } + private sealed class DefectChartPoint + { + public int Series { get; set; } + public string Category { get; set; } + public int DefectCount { get; set; } + } + + private void getecharts05(string projectId) + { + // 同一报告下的缺陷明细先计数,再按原关联口径汇总四个维度。 + const string sql = @" +WITH DefectsByReport AS ( + SELECT item.NDEID, COUNT(*) AS DefectCount + FROM dbo.HJGL_Batch_NDEItem item + INNER JOIN dbo.HJGL_Batch_NDE report ON report.NDEID = item.NDEID + WHERE report.ProjectId = {0} AND item.CheckDefects IS NOT NULL AND item.CheckDefects <> '' + GROUP BY item.NDEID +) +SELECT CASE WHEN GROUPING(pipe.MaterialCode) = 0 THEN 1 + WHEN GROUPING(weld.Specification) = 0 THEN 2 + WHEN GROUPING(weld.WeldTypeCode) = 0 THEN 3 ELSE 4 END AS Series, + CASE WHEN GROUPING(pipe.MaterialCode) = 0 THEN pipe.MaterialCode + WHEN GROUPING(weld.Specification) = 0 THEN weld.Specification + WHEN GROUPING(weld.WeldTypeCode) = 0 THEN weld.WeldTypeCode ELSE weld.JointAttribute END AS Category, + SUM(defects.DefectCount) AS DefectCount +FROM DefectsByReport defects +INNER JOIN dbo.View_Batch_NDEItem item ON item.NDEID = defects.NDEID +INNER JOIN dbo.View_HJGL_Pipeline pipe ON pipe.PipelineCode = item.PipelineCode +INNER JOIN dbo.View_HJGL_WeldJoint weld ON weld.WeldJointId = item.WeldJointId +GROUP BY GROUPING SETS ((pipe.MaterialCode), (weld.Specification), (weld.WeldTypeCode), (weld.JointAttribute))"; + + var series = Funs.DB.ExecuteQuery(sql, projectId).ToLookup(x => x.Series); + E05_Type01 = JsonConvert.SerializeObject(series[1].Select(x => x.Category)); + E05_Values01 = JsonConvert.SerializeObject(series[1].Select(x => x.DefectCount)); + E05_Type02 = JsonConvert.SerializeObject(series[2].Select(x => x.Category)); + E05_Values02 = JsonConvert.SerializeObject(series[2].Select(x => x.DefectCount)); + E05_Type03 = JsonConvert.SerializeObject(series[3].Select(x => x.Category)); + E05_Values03 = JsonConvert.SerializeObject(series[3].Select(x => x.DefectCount)); + E05_Type04 = JsonConvert.SerializeObject(series[4].Select(x => x.Category)); + E05_Values04 = JsonConvert.SerializeObject(series[4].Select(x => x.DefectCount)); } #endregion #region 焊工业绩分析 protected string E06_Type01; protected string E06_Values01; - protected string E06_Type02; - protected string E06_Values02; - protected string E06_Type03; - protected string E06_Values03; - /// - /// 焊工业绩分析 - /// - protected void getecharts06() + + private void getecharts06(string projectId) { - E06_Type01 = "[]"; - E06_Values01 = "[]"; - E06_Type02 = "[]"; - E06_Values02 = "[]"; - E06_Type03 = "[]"; - E06_Values03 = "[]"; - decimal TotalDin = 0; - var allwelderEfficacy = from x in Funs.DB.SitePerson_Person - join y in Funs.DB.HJGL_WeldJoint on x.PersonId equals y.CoverWelderId - join z in Funs.DB.HJGL_WeldingDaily on y.WeldingDailyId equals z.WeldingDailyId - join m in Funs.DB.HJGL_Pipeline on y.PipelineId equals m.PipelineId - where x.WorkPostId == "19B8F2A9-28D3-4F20-867A-1B2237C2E228" - group new { x, y, z, m } by new { x.UnitId, z.UnitWorkId, m.MaterialId, y.Size } into tt - select new - { - Size = (tt.Sum(x => x.y.Size) == null) ? 0 : tt.Sum(x => x.y.Size), - UnitId = tt.Key.UnitId, - MaterialId = tt.Key.MaterialId, - UnitWorkId = tt.Key.UnitWorkId, - }; + var projectUnits = Funs.DB.Project_ProjectUnit.Where(x => x.ProjectId == projectId + && (x.UnitType == Const.ProjectUnitType_1 || x.UnitType == Const.ProjectUnitType_2)); - //// 按单位 - List type01List = new List(); - List count011List = new List(); - foreach (var itemUnit in getProjectUnitList) - { - string unitName = UnitService.GetUnitNameByUnitId(itemUnit.UnitId); - type01List.Add(unitName); - var getUJots = from x in allwelderEfficacy - where x.UnitId == itemUnit.UnitId - select x; - TotalDin = getUJots.Sum(x => x.Size) ?? 0; + var welderTotals = from person in Funs.DB.SitePerson_Person + join weld in Funs.DB.HJGL_WeldJoint on person.PersonId equals weld.CoverWelderId + join daily in Funs.DB.HJGL_WeldingDaily on weld.WeldingDailyId equals daily.WeldingDailyId + join pipe in Funs.DB.HJGL_Pipeline on weld.PipelineId equals pipe.PipelineId + where person.WorkPostId == Const.WorkPost_Welder && projectUnits.Any(x => x.UnitId == person.UnitId) + group weld by person.UnitId into g + select new { UnitId = g.Key, TotalDin = g.Sum(x => x.Size) }; - count011List.Add(TotalDin); - } - if (type01List.Count() > 0) - { - E06_Type01 = JsonConvert.SerializeObject(type01List); - E06_Values01 = JsonConvert.SerializeObject(count011List); - } - ///按单位工程 - List type02List = new List(); - List count021List = new List(); - var getWorkAreas = from x in Funs.DB.WBS_UnitWork - where x.ProjectId == this.ProjectId - select x; - foreach (var itemWorkArea in getWorkAreas) - { - type02List.Add(itemWorkArea.UnitWorkName); - var getUJots = from x in allwelderEfficacy - where x.UnitWorkId == itemWorkArea.UnitWorkId - select x; - TotalDin = getUJots.Sum(x => x.Size) ?? 0; - - count021List.Add(TotalDin); - } - if (type02List.Count() > 0) - { - E06_Type02 = JsonConvert.SerializeObject(type02List); - E06_Values02 = JsonConvert.SerializeObject(count021List); - } - - ///按材质类别 - List type03List = new List(); - List count031List = new List(); - var getMaterials = (from x in Funs.DB.Base_Material - join y in Funs.DB.HJGL_Pipeline on x.MaterialId equals y.MaterialId - where y.ProjectId == this.ProjectId - select x).ToList().Distinct(); - var q = (from x in getMaterials - join y in allwelderEfficacy on x.MaterialId equals y.MaterialId - group new { x, y } by new { x.MaterialCode, y.Size } into g - select new - { - MaterialCode = g.Key.MaterialCode, - TotalDin = g.Sum(x => x.y.Size) - - }).GroupBy(x => x.MaterialCode).Select(x => - new - { - MaterialCode = x.Key, - TotalDin = x.Sum(m => m.TotalDin) - }); - foreach (var itemMaterial in q) - { - string code = itemMaterial.MaterialCode; - - type03List.Add(code); - count031List.Add((decimal)itemMaterial.TotalDin); - } - if (type03List.Count() > 0) - { - E06_Type03 = JsonConvert.SerializeObject(type03List); - E06_Values03 = JsonConvert.SerializeObject(count031List); - } + var rows = (from projectUnit in projectUnits + join baseUnit in Funs.DB.Base_Unit on projectUnit.UnitId equals baseUnit.UnitId into units + from unit in units.DefaultIfEmpty() + join welderTotal in welderTotals on projectUnit.UnitId equals welderTotal.UnitId into totals + from total in totals.DefaultIfEmpty() + select new + { + UnitName = unit == null ? string.Empty : unit.UnitName, + TotalDin = total.TotalDin ?? 0m + }).ToList(); + E06_Type01 = JsonConvert.SerializeObject(rows.Select(x => x.UnitName)); + E06_Values01 = JsonConvert.SerializeObject(rows.Select(x => x.TotalDin)); } - - #endregion - - #region 进度分析 - /// - /// 焊接进度分析 - /// - //protected void getecharts05() - //{ - // E05_Type01 = "[]"; - // E05_Values01_1 = "[]"; - // E05_Values01_2 = "[]"; - // E05_Type02 = "[]"; - // E05_Values02_1 = "[]"; - // E05_Values02_2 = "[]"; - - // E05_Type03 = "[]"; - // E05_Values03_1 = "[]"; - // E05_Values03_2 = "[]"; - - // //// 按单位 - // List type01List = new List(); - // List count011List = new List(); - // List count012List = new List(); - // foreach (var itemUnit in getProjectUnitList) - // { - // string unitName = UnitService.GetUnitNameByUnitId(itemUnit.UnitId); - // type01List.Add(unitName); - // var getUJots = from x in getAllJotList - // join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId - // where y.UnitId == itemUnit.UnitId - // select x; - // count011List.Add(getUJots.Count()); - // var getUCJots = from x in getFinishedJotList - // join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId - // where y.UnitId == itemUnit.UnitId - // select x; - // count012List.Add(getUCJots.Count()); - // } - // if (type01List.Count() > 0) - // { - // E05_Type01 = JsonConvert.SerializeObject(type01List); - // E05_Values01_1 = JsonConvert.SerializeObject(count011List); - // E05_Values01_2 = JsonConvert.SerializeObject(count012List); - // } - // ///按单位工程 - // List type02List = new List(); - // List count021List = new List(); - // List count022List = new List(); - // var getWorkAreas = from x in Funs.DB.WBS_UnitWork - // where x.ProjectId == this.ProjectId - // select x; - // foreach (var itemWorkArea in getWorkAreas) - // { - // type02List.Add(itemWorkArea.UnitWorkName); - // var getWJots = from x in getAllJotList - // join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId - // where y.UnitWorkId == itemWorkArea.UnitWorkId - // select x; - // count021List.Add(getWJots.Count()); - // var getWCJots = from x in getFinishedJotList - // join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId - // where y.UnitWorkId == itemWorkArea.UnitWorkId - // select x; - // count022List.Add(getWCJots.Count()); - // } - // if (type02List.Count() > 0) - // { - // E05_Type02 = JsonConvert.SerializeObject(type02List); - // E05_Values02_1 = JsonConvert.SerializeObject(count021List); - // E05_Values02_2 = JsonConvert.SerializeObject(count022List); - // } - - // ///按材质类别 - // List type03List = new List(); - // List count031List = new List(); - // List count032List = new List(); - // var getMaterials = (from x in Funs.DB.Base_Material - // join y in Funs.DB.HJGL_Pipeline on x.MaterialId equals y.MaterialId - // where y.ProjectId == this.ProjectId - // select x).ToList().Distinct(); - // foreach (var itemMaterial in getMaterials) - // { - // string code = itemMaterial.MaterialCode; - // type03List.Add(code); - // var getWJots = from x in getAllJotList - // join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId - // where y.MaterialId == itemMaterial.MaterialId - // select x; - // count031List.Add(getWJots.Count()); - // var getWCJots = from x in getFinishedJotList - // join y in getAllJIsoInfoList on x.PipelineId equals y.PipelineId - // where y.MaterialId == itemMaterial.MaterialId - // select x; - // count032List.Add(getWCJots.Count()); - // } - // if (type03List.Count() > 0) - // { - // E05_Type03 = JsonConvert.SerializeObject(type03List); - // E05_Values03_1 = JsonConvert.SerializeObject(count031List); - // E05_Values03_2 = JsonConvert.SerializeObject(count032List); - // } - //} #endregion } -} \ No newline at end of file +} diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx b/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx index 347a5e69..1d92b2d5 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx @@ -102,30 +102,30 @@
-
<%=showData(hJGLData_HJGL.WelderNum,"--") %>
+
<%: WeldingSummary.WelderNum %>
-
<%=showData(hJGLData_HJGL.TotalDineNum,"--") %>
+
<%: WeldingSummary.TotalDineNum %>
-
<%=showData(hJGLData_HJGL.CompleteDineNum,"--") %>
+
<%: WeldingSummary.CompleteDineNum %>
-
<%=showData(hJGLData_HJGL.TotalFilmNum,"--") %>
+
<%: WeldingSummary.TotalFilmNum %>
-
<%=showData(hJGLData_HJGL.OKFilmNum,"--") %>
+
<%: WeldingSummary.OKFilmNum %>
diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx.cs index 98226b4f..2bd37470 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx.cs @@ -8,7 +8,7 @@ namespace FineUIPro.Web.common public partial class mainMenu_HJGL2 : PageBase { public Model.CQMSData_CQMS cQMSData_CQMS; - public Model.HJGLData_HJGL hJGLData_HJGL; + protected Model.HJGLDataItem WeldingSummary; public string pie; public string dataaq1; public string indicator; @@ -28,12 +28,7 @@ namespace FineUIPro.Web.common cQMSData_CQMS = new Model.CQMSData_CQMS(); } - hJGLData_HJGL = Funs.DB.HJGLData_HJGL.OrderByDescending(x => x.ReportDate).FirstOrDefault(); - if (hJGLData_HJGL == null) - { - hJGLData_HJGL = new Model.HJGLData_HJGL(); - } - + WeldingSummary = HJGLData_HJGLService.GetCompanyWeldingSummary(); if (cQMSData_CQMS.KeyProcessNum.HasValue && cQMSData_CQMS.KeyProcessOKNum.HasValue) { diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs index 30901f81..dce6f5b2 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs @@ -1,4 +1,4 @@ -using BLL; +using BLL; using System; using System.Collections.Generic; using System.Data; @@ -29,8 +29,7 @@ namespace FineUIPro.Web.common #region 加载树装置-单位-工作区 /// - /// 加载树 - /// 优化版本:解决 N+1 查询问题,一次性获取所有管线统计数据 + /// 加载单位工程树及管线数量 /// private void InitTreeMenu() { @@ -50,13 +49,13 @@ namespace FineUIPro.Web.common rootNode2.Expanded = true; this.tvControlItem.Nodes.Add(rootNode2); - // 优化:一次性获取所有管线统计数据,避免 N+1 查询 - var pipelineCountByUnitWork = (from x in Funs.DB.View_HJGL_Pipeline + // 树节点只显示管线数量,避免通过视图计算每条管线的焊口达因数。 + var pipelineCountByUnitWork = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId where x.UnitWorkId != null group x by x.UnitWorkId into g - select new { UnitWorkId = g.Key, Count = g.Count(), TotalDin = g.Sum(x => x.TotalDin) }) - .ToDictionary(x => x.UnitWorkId, x => new { x.Count, x.TotalDin }); + select new { UnitWorkId = g.Key, Count = g.Count() }) + .ToDictionary(x => x.UnitWorkId, x => x.Count); var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList(); // 获取当前用户所在单位 @@ -78,12 +77,11 @@ namespace FineUIPro.Web.common { foreach (var q in unitWork1) { - // 优化:从内存字典中获取管线数量,避免数据库查询 - int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0; + pipelineCountByUnitWork.TryGetValue(q.UnitWorkId, out int pipelineCount); var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn1 = new TreeNode(); tn1.NodeID = q.UnitWorkId; - tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" ; + tn1.Text = q.UnitWorkName + "【" + pipelineCount.ToString() + "】" + "管线"; tn1.ToolTip = BLL.UiText.Message("施工单位:" + unitNamesUnitIds); tn1.EnableClickEvent = true; rootNode1.Nodes.Add(tn1); @@ -93,12 +91,11 @@ namespace FineUIPro.Web.common { foreach (var q in unitWork2) { - // 优化:从内存字典中获取管线数量,避免数据库查询 - int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0; + pipelineCountByUnitWork.TryGetValue(q.UnitWorkId, out int pipelineCount); var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn2 = new TreeNode(); tn2.NodeID = q.UnitWorkId; - tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" ; + tn2.Text = q.UnitWorkName + "【" + pipelineCount.ToString() + "】" + "管线"; tn2.ToolTip = BLL.UiText.Message("施工单位:" + unitNamesUnitIds); tn2.EnableClickEvent = true; rootNode2.Nodes.Add(tn2); diff --git a/SGGL/FineUIPro.Web/index.aspx b/SGGL/FineUIPro.Web/index.aspx index 423935a3..b8f1ef5f 100644 --- a/SGGL/FineUIPro.Web/index.aspx +++ b/SGGL/FineUIPro.Web/index.aspx @@ -22,6 +22,13 @@ background-image: none; } + .company-dashboard-title { + display: block; + max-width: 32vw; + overflow: hidden; + text-overflow: ellipsis; + } + .f-widget-content { border: none; background: none; @@ -159,11 +166,6 @@
-
-
- -
@@ -200,7 +202,7 @@
-
@@ -211,11 +213,6 @@ EnablePostBack="true" EnableDefaultState="true" EnableDefaultCorner="false" OnClientClick="parent.removeActiveTab();"> -
  • - - -
  • @@ -228,21 +225,6 @@ EnablePostBack="true" EnableDefaultState="true" EnableDefaultCorner="false" OnClientClick="parent.removeActiveTab();">
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • diff --git a/SGGL/FineUIPro.Web/index.aspx.cs b/SGGL/FineUIPro.Web/index.aspx.cs index 2af5391a..8efa509e 100644 --- a/SGGL/FineUIPro.Web/index.aspx.cs +++ b/SGGL/FineUIPro.Web/index.aspx.cs @@ -67,7 +67,7 @@ namespace FineUIPro.Web /// /// /// - private Tree InitTreeMenu() + private Tree InitTreeMenu(string menuType) { Tree treeMenu = new Tree { @@ -97,6 +97,7 @@ namespace FineUIPro.Web leftPanel.Items.Add(treeMenu); XmlDocument doc = XmlDataSource1.GetXmlDocument(); + SysMenuService.ApplyNavigationChanges(doc, menuType); ResolveXmlDocument(doc); // 绑定 XML 数据源到树控件 treeMenu.NodeDataBound += treeMenu_NodeDataBound; @@ -187,7 +188,7 @@ namespace FineUIPro.Web { string resourceKey = UiText.Key(e.Node.Text, "Menu_"); // 管理员新增或改名的菜单保留原文字,不显示资源键。 - e.Node.Text = UiText.GetChinese(resourceKey) != e.Node.Text ? UiText.Get(e.Node.Text) : UiText.Get(resourceKey); + e.Node.Text = HttpUtility.HtmlEncode(UiText.GetChinese(resourceKey) != e.Node.Text ? UiText.Get(e.Node.Text) : UiText.Get(resourceKey)); if (GetIsNewHtml(e.XmlNode)) { e.Node.Text = "" + e.Node.Text + ""; @@ -292,6 +293,10 @@ namespace FineUIPro.Web this.liLanguageSwitch.Visible = UiLanguage.IsEnabled; if (!IsPostBack) { + string title = SysConstSetService.CompanyDashboardTitle; + litCompanyDashboardTitle.Text = string.IsNullOrWhiteSpace(title) + ? UiText.Get("T_陕西化建施工管理信息平台") : title; + companyDashboardTitle.Attributes["title"] = litCompanyDashboardTitle.Text; this.MenuSwitchMethod(Request.Params["menuType"]); // this.MenuSwitchMethod(Request.Params["menuType"]); this.InitMenuStyleButton(); @@ -314,12 +319,6 @@ namespace FineUIPro.Web this.Tab1.IFrameUrl = "~/common/main2.aspx"; this.hdHomePage.Text = "2"; } - - var getW = WeatherService.GetWeather(null); - if (getW != null) - { - divWeather.InnerHtml = UiText.Get(getW.WeatherRef) + " " + getW.CurrTem + "°C"; - } } } @@ -387,6 +386,7 @@ namespace FineUIPro.Web /// protected void MenuSwitchMethod(string type) { + if (SysMenuService.IsRemovedCompanySection(type)) type = null; if (!string.IsNullOrEmpty(type)) { if (CommonService.IsHaveSystemPower(this.CurrUser.PersonId, type, this.CurrUser.LoginProjectId) || type == Const.Menu_Personal) @@ -415,7 +415,7 @@ namespace FineUIPro.Web //{ // Person_PersonsService.UpdateLastUserInfo(this.CurrUser.PersonId, type, true, string.Empty); //} - InitTreeMenu(); + InitTreeMenu(string.IsNullOrEmpty(type) ? Const.Menu_Personal : type); } protected void btnHome_Click(object sender, EventArgs e) @@ -442,16 +442,6 @@ namespace FineUIPro.Web this.MenuSwitchMethod(Const.Menu_Person); } - /// - /// 通知 - /// - /// - /// - protected void btnNotice_Click(object sender, EventArgs e) - { - this.MenuSwitchMethod(Const.Menu_Notice); - } - /// /// 项目清单 /// @@ -462,16 +452,6 @@ namespace FineUIPro.Web this.MenuSwitchMethod(Const.Menu_Project); } - /// - /// 大数据中心 - /// - /// - /// - protected void btnDigData_Click(object sender, EventArgs e) - { - this.MenuSwitchMethod(Const.Menu_DigData); - } - /// /// 综合管理 /// @@ -482,26 +462,6 @@ namespace FineUIPro.Web this.MenuSwitchMethod(Const.Menu_ZHGL); } - /// - /// 协同办公 - /// - /// - /// - protected void btnTeamWork_Click(object sender, EventArgs e) - { - this.MenuSwitchMethod(Const.Menu_TeamWork); - } - - /// - /// 智慧工地 - /// - /// - /// - protected void btnSmartSite_Click(object sender, EventArgs e) - { - this.MenuSwitchMethod(Const.Menu_SmartSite); - } - /// /// 个人信息 /// @@ -529,6 +489,7 @@ namespace FineUIPro.Web /// protected void btnRetweet_Click(object sender, EventArgs e) { + if (CurrUser?.PersonId != Const.hfnbdId) throw new HttpException(403, "您没有权限!"); ////设置菜单 CreateMenuXML.getMenuXML(); MenuSwitchMethod(string.Empty); diff --git a/SGGL/FineUIPro.Web/index.aspx.designer.cs b/SGGL/FineUIPro.Web/index.aspx.designer.cs index d94e2157..b692ae30 100644 --- a/SGGL/FineUIPro.Web/index.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/index.aspx.designer.cs @@ -57,15 +57,6 @@ namespace FineUIPro.Web { /// protected global::FineUIPro.ContentPanel ContentPanel1; - /// - /// divWeather 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divWeather; - /// /// spDate 控件。 /// @@ -111,6 +102,9 @@ namespace FineUIPro.Web { /// protected global::FineUIPro.Button btnRetweet; + protected global::System.Web.UI.HtmlControls.HtmlGenericControl companyDashboardTitle; + protected global::System.Web.UI.WebControls.Literal litCompanyDashboardTitle; + /// /// btnHome 控件。 /// @@ -129,15 +123,6 @@ namespace FineUIPro.Web { /// protected global::FineUIPro.Button btnProject; - /// - /// btnDigData 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnDigData; - /// /// btnPerson 控件。 /// @@ -156,33 +141,6 @@ namespace FineUIPro.Web { /// protected global::FineUIPro.Button btnZHGL; - /// - /// btnSmartSite 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnSmartSite; - - /// - /// btnTeamWork 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnTeamWork; - - /// - /// btnNotice 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnNotice; - /// /// leftPanel 控件。 /// diff --git a/SGGL/FineUIPro.Web/indexProject.aspx b/SGGL/FineUIPro.Web/indexProject.aspx index 2f8f5e3f..8bcca8b5 100644 --- a/SGGL/FineUIPro.Web/indexProject.aspx +++ b/SGGL/FineUIPro.Web/indexProject.aspx @@ -160,6 +160,46 @@ border: none !important; } + .project-picker-grid.f-panel, + .project-picker-grid .f-grid-header, + .project-picker-grid .f-grid-body { + background-color: #052747; + } + + .project-picker-grid.f-panel { + border: 1px solid #668ba7 !important; + } + + .project-picker-grid.f-grid .f-grid-colheader, + .project-picker-grid.f-grid .f-grid-cell-inner { + color: #fff; + } + + .project-picker-grid .f-grid-row { + background-color: transparent; + cursor: pointer; + } + + .project-picker-grid .f-grid-row:not(.f-grid-rowgroup).f-state-hover, + .project-picker-grid .f-grid-row.f-grid-row-selected { + background-color: #164b73 !important; + } + + .project-picker-grid .f-grid-row.f-grid-rowgroup { + background-color: #103a5b; + cursor: default; + } + + .project-picker-grid.f-grid .f-grid-rowgroup .f-grid-cell-inner { + color: #b7e6ff; + font-weight: 600; + } + + .project-picker-grid .f-field-textbox { + background-color: #f2f5f7; + color: #16334d; + } + .header { position: relative; } @@ -225,9 +265,37 @@
    - - + + + + +
    @@ -396,6 +464,10 @@