diff --git a/DataBase/版本日志/SUBQHSE_V2026-07-07-xiaj(数据治理分析表补充字段).sql b/DataBase/版本日志/SUBQHSE_V2026-07-07-xiaj(数据治理分析表补充字段).sql new file mode 100644 index 0000000..e2b06c0 --- /dev/null +++ b/DataBase/版本日志/SUBQHSE_V2026-07-07-xiaj(数据治理分析表补充字段).sql @@ -0,0 +1,94 @@ + +truncate table Project_MasterDataAnalysis +GO + + + + + --ɾѹĿдԭ +delete from Project_MasterDataUsage +where pro_id in (select distinct MasterSysId from Base_Project) +GO + +--ֶܱΣ +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_MasterDataAnalysis' AND COLUMN_NAME = 'TianBao') +BEGIN + ALTER TABLE Project_MasterDataAnalysis ADD TianBao int; + EXEC sp_addextendedproperty 'MS_Description', N'Ŀ','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'TianBao'; +END +GO +--ֶܱΣĿ +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_MasterDataAnalysis' AND COLUMN_NAME = 'YiShangXian') +BEGIN + ALTER TABLE Project_MasterDataAnalysis ADD YiShangXian int; + EXEC sp_addextendedproperty 'MS_Description', N'ߣѹ+Ԥ','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'YiShangXian'; +END +GO + +--ֶܱΣĿ +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_MasterDataAnalysis' AND COLUMN_NAME = 'OnlineRate') +BEGIN + ALTER TABLE Project_MasterDataAnalysis ADD OnlineRate decimal(18, 2); + EXEC sp_addextendedproperty 'MS_Description', N'Ŀʡѹ+Ԥ/+Ԥ-깤-ͣ','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'OnlineRate'; +END +GO + +--ֶܱΣ벻깤벻ͣ벻 +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_MasterDataAnalysis' AND COLUMN_NAME = 'BuYongYiWanGong') +BEGIN + ALTER TABLE Project_MasterDataAnalysis ADD BuYongYiWanGong int; + EXEC sp_addextendedproperty 'MS_Description', N'벻-깤','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'BuYongYiWanGong'; + ALTER TABLE Project_MasterDataAnalysis ADD BuYongTingHuanJian int; + EXEC sp_addextendedproperty 'MS_Description', N'벻-ͣ','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'BuYongTingHuanJian'; + ALTER TABLE Project_MasterDataAnalysis ADD BuYongTJShouXian int; + EXEC sp_addextendedproperty 'MS_Description', N'벻-','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'BuYongTJShouXian'; +END +GO + + +--ֶܱΣϵͳԾûվԾ +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_MasterDataAnalysis' AND COLUMN_NAME = 'ThisMonActiveUserNum') +BEGIN + ALTER TABLE Project_MasterDataAnalysis ADD ThisMonActiveUserNum int; + EXEC sp_addextendedproperty 'MS_Description', N'ϵͳԾû','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'ThisMonActiveUserNum'; + ALTER TABLE Project_MasterDataAnalysis ADD DailyAvg decimal(18, 2); + EXEC sp_addextendedproperty 'MS_Description', N'վԾ','SCHEMA', N'dbo','TABLE', N'Project_MasterDataAnalysis','COLUMN', N'DailyAvg'; +END +GO + +--ͳָ +IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'DataGovernance_MetricData') AND type = N'U') +BEGIN +CREATE TABLE [dbo].[DataGovernance_MetricData]( + [Id] [nvarchar](50) NOT NULL, + [Name] [nvarchar](100) NOT NULL, + [Field] [nvarchar](100) NOT NULL, + [Frequency] [int] NOT NULL, + [IsKeyMetric] [bit] NOT NULL, + [Type] [nvarchar](10) NOT NULL, + [Remark] [nvarchar](200) NULL, + [CreateDate] [datetime] NOT NULL, + [CreateUser] [nvarchar](50) NOT NULL, + CONSTRAINT [PK_DataGovernance_MetricData] PRIMARY KEY CLUSTERED +( + [Id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] +ALTER TABLE [dbo].[DataGovernance_MetricData] ADD CONSTRAINT [DF_DataGovernance_MetricData_Frequency] DEFAULT ((1)) FOR [Frequency] +ALTER TABLE [dbo].[DataGovernance_MetricData] ADD CONSTRAINT [DF_DataGovernance_MetricData_IsKeyMetric] DEFAULT ((0)) FOR [IsKeyMetric] +ALTER TABLE [dbo].[DataGovernance_MetricData] ADD CONSTRAINT [DF_DataGovernance_MetricData_CreateDate] DEFAULT (getdate()) FOR [CreateDate] + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'Id' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ָ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'Name' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ֶָ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'Field' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ָƵΣ1ÿգ3ÿ죬7ÿܣ30ÿ£90ÿȣ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'Frequency' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ƿصעָ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'IsKeyMetric' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ͣHSEȫQMSHJӣ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'Type' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ע' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'Remark' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'CreateDate' +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataGovernance_MetricData', @level2type=N'COLUMN',@level2name=N'CreateUser' +END + +GO + + diff --git a/DataBase/版本日志/SUBQHSE_V2026-07-08-xiaj(View_Project_MasterDataAnalysis).sql b/DataBase/版本日志/SUBQHSE_V2026-07-08-xiaj(View_Project_MasterDataAnalysis).sql new file mode 100644 index 0000000..c66044a --- /dev/null +++ b/DataBase/版本日志/SUBQHSE_V2026-07-08-xiaj(View_Project_MasterDataAnalysis).sql @@ -0,0 +1,22 @@ + + +DROP VIEW [dbo].[View_Project_MasterDataAnalysis] +GO + + +CREATE VIEW [dbo].[View_Project_MasterDataAnalysis] AS +WITH LastData AS ( + SELECT ReportDate, MAX(DataDate) AS LatestDate + FROM dbo.Project_MasterDataAnalysis AS tba + GROUP BY tba.ReportDate +),RankedData AS ( + SELECT tbb.* + FROM dbo.Project_MasterDataAnalysis tbb + INNER JOIN LastData AS ld ON tbb.DataDate = ld.LatestDate +) +SELECT + rd.* +FROM RankedData AS rd + +GO + diff --git a/SUBQHSE/BLL/BLL.csproj b/SUBQHSE/BLL/BLL.csproj index 1af08be..8b1155d 100644 --- a/SUBQHSE/BLL/BLL.csproj +++ b/SUBQHSE/BLL/BLL.csproj @@ -470,6 +470,7 @@ + diff --git a/SUBQHSE/BLL/DataGovernance/DataGovernanceService.cs b/SUBQHSE/BLL/DataGovernance/DataGovernanceService.cs new file mode 100644 index 0000000..7d7b491 --- /dev/null +++ b/SUBQHSE/BLL/DataGovernance/DataGovernanceService.cs @@ -0,0 +1,87 @@ +using Model; +using Newtonsoft.Json.Linq; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + /// + /// 数据治理服务 + /// + public static class DataGovernanceService + { + /// + /// 获取集团数据治理统计分析指标 + /// + /// + public static Model.ResponeData GetDataGovernanceMetricData() + { + var responeData = new Model.ResponeData(); + try + { + //string unitId = CommonService.GetThisUnitId(); + string baseurl = $"{SysConstSetService.CNCECPath}/api/DataGovernance/GetDataGovernanceMetricData"; + string contenttype = "application/json;charset=unicode"; + Hashtable newToken = new Hashtable + { + { "token", ServerService.GetToken().Token } + }; + var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null); + if (!string.IsNullOrEmpty(strJosn)) + { + JObject obj = JObject.Parse(strJosn); + responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString()); + responeData.message = obj["message"].ToString(); + if (responeData.code == 1) + { + JArray getData = JArray.Parse(obj["data"].ToString()); + if (getData.Count() > 0) + { + using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) + { + List metrics = new List(); + foreach (var item in getData) + { + Model.DataGovernance_MetricData newModel = new Model.DataGovernance_MetricData + { + Id = item["Id"].ToString(), + Name = item["Name"].ToString(), + Field = item["Field"].ToString(), + Frequency = int.Parse(item["Frequency"].ToString()), + IsKeyMetric = item["IsKeyMetric"].ToString().ToUpper() == "TRUE", + Type = item["Type"].ToString(), + Remark = item["Remark"].ToString(), + CreateUser = item["CreateUser"].ToString(), + //CreateDate = Convert.ToDateTime(item["CreateDate"].ToString()), + CreateDate = DateTime.Now + }; + metrics.Add(newModel); + } + if (metrics.Any()) + { + var olds = from x in db.DataGovernance_MetricData select x; + db.DataGovernance_MetricData.DeleteAllOnSubmit(olds); + db.SubmitChanges(); + db.DataGovernance_MetricData.InsertAllOnSubmit(metrics); + db.SubmitChanges(); + } + } + } + responeData.message = "获取成功:集团数据治理统计分析指标" + getData.Count().ToString() + "条"; + } + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = "获取失败:" + ex.Message; + ErrLogInfo.WriteLog("获取集团数据治理统计分析指标!", ex); + } + + return responeData; + } + + } +} \ No newline at end of file diff --git a/SUBQHSE/BLL/ProjectData/ProjectMasterDataAnalysisService.cs b/SUBQHSE/BLL/ProjectData/ProjectMasterDataAnalysisService.cs index c05a898..ab587dd 100644 --- a/SUBQHSE/BLL/ProjectData/ProjectMasterDataAnalysisService.cs +++ b/SUBQHSE/BLL/ProjectData/ProjectMasterDataAnalysisService.cs @@ -1,5 +1,4 @@ - -using Model; +using Model; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -55,6 +54,8 @@ namespace BLL Id = model.Id, CollCropCode = model.CollCropCode, UnitId = model.UnitId, + YiShangXian = model.YiShangXian, + OnlineRate = model.OnlineRate, ReportDate = model.ReportDate, DataDate = model.DataDate, Total = model.Total, @@ -63,9 +64,15 @@ namespace BLL ZhengChang = model.ZhengChang, DaiJian = model.DaiJian, BuYong = model.BuYong, + BuYongYiWanGong = model.BuYongYiWanGong, + BuYongTingHuanJian = model.BuYongTingHuanJian, + BuYongTJShouXian = model.BuYongTJShouXian, YuLiXiang = model.YuLiXiang, //ZiJian = model.ZiJian, CreateUser = model.CreateUser, + ThisMonActiveUserNum = model.ThisMonActiveUserNum, + DailyAvg = model.DailyAvg, + TianBao = model.TianBao, }; db.Project_MasterDataAnalysis.InsertOnSubmit(newModel); db.SubmitChanges(); @@ -86,14 +93,22 @@ namespace BLL //newModel.UnitId = model.UnitId; //newModel.ReportDate = model.ReportDate; //newModel.DataDate = model.DataDate; + newModel.YiShangXian = model.YiShangXian; + newModel.OnlineRate = model.OnlineRate; newModel.Total = model.Total; newModel.MasterTotal = model.MasterTotal; newModel.QHSETotal = model.QHSETotal; newModel.ZhengChang = model.ZhengChang; newModel.DaiJian = model.DaiJian; newModel.BuYong = model.BuYong; + newModel.BuYongYiWanGong = model.BuYongYiWanGong; + newModel.BuYongTingHuanJian = model.BuYongTingHuanJian; + newModel.BuYongTJShouXian = model.BuYongTJShouXian; newModel.YuLiXiang = model.YuLiXiang; //newModel.ZiJian = model.ZiJian; + newModel.ThisMonActiveUserNum = model.ThisMonActiveUserNum; + newModel.DailyAvg = model.DailyAvg; + newModel.TianBao = model.TianBao; db.SubmitChanges(); } } @@ -134,7 +149,7 @@ namespace BLL /// /// /// - public static string ReportProjectMasterDataAnalysis(string userName,ref string message) + public static string ReportProjectMasterDataAnalysis(string userName, ref string message) { string code = "0"; using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) @@ -149,7 +164,7 @@ namespace BLL int masterTotal = masterProDatas.Count(); int qhseTotal = projects.Count(); - //1、正常 + //1、已关联 int zhengChang = (from x in masterProDatas join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup from pro in proGroup.DefaultIfEmpty() @@ -165,18 +180,56 @@ namespace BLL where pro == null && (use == null || (use != null && (use.Reason == null || use.Reason == ""))) select x).Count(); //3、申请不用 - int buYong = (from x in masterProDatas - join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup - from pro in proGroup.DefaultIfEmpty() - join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup - from use in useGroup.DefaultIfEmpty() - where pro == null && use != null && use.Reason != null && use.Reason != "" - select x).Count(); + var buYongList = (from x in masterProDatas + join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup + from pro in proGroup.DefaultIfEmpty() + join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup + from use in useGroup.DefaultIfEmpty() + where pro == null && use != null && use.Is_use == false && use.Reason != null && use.Reason != "" + select new { reason = use.Reason, reasonType = use.ReasonType }).ToList(); + //申请不用总数 + int buYong = buYongList.Count(); + //申请不用——已完工 + int buYongYiWanGong = buYongList.Where(x => x.reasonType == "已完工").Count(); + //申请不用——停缓建 + int buYongTingHuanJian = buYongList.Where(x => x.reasonType == "停缓建").Count(); + //申请不用——条件受限(其他) + int buYongTJShouXian = buYong - buYongYiWanGong - buYongTingHuanJian; + //4、预立项 int yuLiXiang = (from x in projects where x.MasterSysId == null select x).Count(); - var thisUnit = CommonService.GetIsThisUnit(); + //应使用项目数=主数据项目+预立项-已完工-停缓建 + int beUsedProNum = masterTotal + yuLiXiang - buYongYiWanGong - buYongTingHuanJian; + //已上线项目=已关联+预立项; + int yiShangXian = zhengChang + yuLiXiang; + //上线率=100*已上线/应使用项目数 + var onlineRate = (decimal)Math.Round((100.0 * yiShangXian / beUsedProNum), 2); + onlineRate = onlineRate > 100 ? 100 : onlineRate; + var now = DateTime.Now; + + #region 统计系统近三个月用户使用情况、日活 + + ////本月第一天 + //var firstDayOfMonth = new DateTime(now.Year, now.Month, 1); + //本月第一天 + var firstDayOfMonth = now.AddMonths(-3); + //本月系统活跃用户 + var thisMonActiveUserList = (from x in db.Sys_Log + where x.OperationTime > firstDayOfMonth + select new + { + DateStr = ((DateTime)x.OperationTime).ToShortDateString(), + UserId = x.UserId + }).ToList(); + //var ssss = JsonConvert.SerializeObject(thisMonActiveUserList); + int thisMonActiveUserNum = thisMonActiveUserList.Distinct().Count(); + var dailyAvg = (decimal)Math.Round((1.0 * thisMonActiveUserNum / 30), 2); + + #endregion + + var thisUnit = CommonService.GetIsThisUnit(); //保存汇总数据 Model.Project_MasterDataAnalysis analysis = new Project_MasterDataAnalysis { @@ -185,14 +238,21 @@ namespace BLL UnitId = thisUnit.UnitId, ReportDate = now.Date, DataDate = now, - Total = zhengChang + daiJian + yuLiXiang, + YiShangXian= yiShangXian, + OnlineRate = onlineRate, + Total = beUsedProNum, MasterTotal = masterTotal, QHSETotal = qhseTotal, ZhengChang = zhengChang, DaiJian = daiJian, BuYong = buYong, + BuYongYiWanGong = buYongYiWanGong, + BuYongTingHuanJian = buYongTingHuanJian, + BuYongTJShouXian = buYongTJShouXian, YuLiXiang = yuLiXiang, - CreateUser = userName + CreateUser = userName, + ThisMonActiveUserNum = thisMonActiveUserNum, + DailyAvg = dailyAvg, }; #endregion diff --git a/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj b/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj index 8502077..4b300fc 100644 --- a/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj @@ -1168,6 +1168,7 @@ + @@ -12684,6 +12685,8 @@ MasterProjectDataAnalysis.aspx + + MasterProjectDataUsage.aspx ASPXCodeBehind diff --git a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectData.aspx.cs b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectData.aspx.cs index 106bfc6..7d5bd85 100644 --- a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectData.aspx.cs +++ b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectData.aspx.cs @@ -425,7 +425,7 @@ namespace FineUIPro.Web.ProjectData ProjectId = x.ProjectId, ReportDate = x.ReportDate, //DataMetricsSum = (x.JoinConstructionPersonNum ?? 0) + (x.GeneralClosedNum ?? 0) + (x.GeneralNotClosedNum ?? 0) + (x.SafeWorkingHour ?? 0) - DataMetricsSum = (x.JoinConstructionPersonNum ?? 0) + (x.GeneralClosedNum ?? 0) + (x.GeneralNotClosedNum ?? 0) + (x.SafeWorkingHour ?? 0) + (x.LicensesNum ?? 0) + (x.SpecialTrainNum ?? 0) + DataMetricsSum = (x.JoinConstructionPersonNum ?? 0) + (x.GeneralClosedNum ?? 0) + (x.GeneralNotClosedNum ?? 0) + (x.SafeWorkingHour ?? 0) + (x.LicensesNum ?? 0) + (x.SpecialTrainNum ?? 0) + (x.SpecialOperationTrainNum ?? 0) + (x.ProjectSafetyLeadingGroupMeetingNum ?? 0) + (x.ProjectSafetyMeetingNum ?? 0) + (x.GeneralRiskNum ?? 0) + (x.LowRiskNum ?? 0) + (x.MediumRiskNum ?? 0) + (x.HighRiskNum ?? 0) + (x.TrainPersonNum ?? 0) + (x.SuperTrainPersonNum ?? 0) + (x.OperativesNum ?? 0) + (x.SuperOperativesNum ?? 0) + (x.ProjectDrillPersonNum ?? 0) diff --git a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx index f66137c..423b562 100644 --- a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx +++ b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx @@ -32,9 +32,75 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -226,6 +232,9 @@ + + @@ -241,7 +250,7 @@ - + @@ -252,67 +261,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + + + <%-- + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - <%-- + - - --%> - - - - - - - - - + + + + + + + + diff --git a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.cs b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.cs index e9c6111..757d477 100644 --- a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.cs +++ b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; +using System.Web.UI.DataVisualization.Charting; using AspNet = System.Web.UI.WebControls; namespace FineUIPro.Web.ProjectData @@ -49,29 +50,29 @@ namespace FineUIPro.Web.ProjectData { if (TabStrip1.ActiveTabIndex == 0) { - this.Panel1.Title = "已关联"; - this.BindGrid(); + this.Panel1.Title = "未使用项目"; + this.BindGrid2(); } else if (TabStrip1.ActiveTabIndex == 1) { - this.Panel1.Title = "待建"; - this.BindGrid2(); + this.Panel1.Title = "已使用项目"; + this.BindGrid(); } else if (TabStrip1.ActiveTabIndex == 2) { - this.Panel1.Title = "申请不用"; + this.Panel1.Title = "申请不用项目"; this.BindGrid3(); } else if (TabStrip1.ActiveTabIndex == 3) - { - this.Panel1.Title = "预立项"; - this.BindGrid4(); - } - else if (TabStrip1.ActiveTabIndex == 4) { this.Panel1.Title = "数据汇总"; this.BindGrid9(); } + //else if (TabStrip1.ActiveTabIndex == 3) + //{ + // this.Panel1.Title = "预立项"; + // this.BindGrid4(); + //} //else if (TabStrip1.ActiveTabIndex == 4) //{ // this.Panel1.Title = "自建"; @@ -81,7 +82,152 @@ namespace FineUIPro.Web.ProjectData #endregion - #region 已关联数据 + /// + /// 合同额(亿) + /// + /// 合同含税金额原始存档(元) + /// 增补合同本币含税金额(元) + /// + protected string ConvertAmount(decimal? Ori_amt, decimal? Amt_add) + { + string result = string.Empty; + Ori_amt = Ori_amt == null ? 0 : Ori_amt; + Amt_add = Amt_add == null ? 0 : Amt_add; + decimal? all = Amt_add + Ori_amt; + if (all != null) + { + double amount = all == null ? 0 : (Math.Round((double)(all / 100000000m), 2)); + result = amount.ToString(); + } + return result; + } + + #region 未使用项目——待建数据 + + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid2() + { + var list = new List(); + var db = Funs.DB; + var query = (from x in masterProDatas + join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup + from pro in proGroup.DefaultIfEmpty() + join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup + from use in useGroup.DefaultIfEmpty() + where pro == null && (use == null || (use != null && (use.Reason == null || use.Reason == ""))) + select new MasterProjectDataInfo + { + //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}|{(use != null ? use.Id : "")}", + //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}", + Pid = x.Pro_id, + Pro_id = x.Pro_id, + Pro_Classify = "待建", + Pro_name = x.Pro_name, + Pro_code = x.Pro_code, + Start_date = x.Start_date, + Con_mode_desc = x.Con_mode_desc, + Pro_nature = x.Pro_nature, + Pro_status = x.Pro_status, + Org_name = x.Org_name, + Amount = ConvertAmount(x.Ori_amt_sum_vat_fc, x.Amt_add_sum_vat_fc_local) + }).ToList(); + + string startDate = this.txtStartTime2.Text.Trim(); + string endDate = this.txtEndTime2.Text.Trim(); + if (!string.IsNullOrWhiteSpace(startDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) >= Funs.GetNewDateTime(startDate)).ToList(); + } + if (!string.IsNullOrWhiteSpace(endDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) <= Funs.GetNewDateTime(endDate)).ToList(); + } + query = query.OrderByDescending(x => x.StartDate).ToList(); + list.AddRange(query); + + string proName = this.txtProName2.Text.Trim(); + string proCode = this.txtProCode2.Text.Trim(); + + if (!string.IsNullOrEmpty(proName)) + { + list = list.Where(x => x.Pro_name.Contains(proName)).ToList(); + } + if (!string.IsNullOrEmpty(proCode)) + { + list = list.Where(x => x.Pro_code.Contains(proCode)).ToList(); + } + + DataTable tb = Funs.LINQToDataTable(list); + Grid2.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid2, tb); + Grid2.DataSource = table; + Grid2.DataBind(); + + int totalNum = list.Count(); + JObject summary = new JObject(); + summary.Add("tfPageIndex", "合计"); + summary.Add("Pro_Classify", totalNum); + summary.Add("Pro_name", $"待建:{totalNum}"); + + Grid2.SummaryData = summary; + } + + #endregion + + #region Grid + + protected void TextBox2_TextChanged(object sender, EventArgs e) + { + this.BindGrid2(); + } + + /// + /// + /// + /// + /// + protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e) + { + this.BindGrid2(); + } + + + protected void Grid2_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + this.BindGrid2(); + } + #endregion + + #region 导出按钮 + + /// + /// 导出按钮 + /// + /// + /// + protected void btnOut2_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(未使用项目)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid2.PageSize = this.Grid2.RecordCount; + this.BindGrid2(); + Response.Write(GetGridMultiHeaderTableHtml2(Grid2)); + //Response.Write(GetGridTableHtml(Grid2)); + Response.End(); + } + #endregion + + #endregion + + + #region 已使用项目——已关联和预立项项目 #region 绑定数据 @@ -97,13 +243,14 @@ namespace FineUIPro.Web.ProjectData from pro in proGroup.DefaultIfEmpty() //join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup //from use in useGroup.DefaultIfEmpty() - where pro != null && pro.MasterSysId != null + where pro != null && pro.MasterSysId != null //&& pro.ProjectState == Const.ProjectState_1 select new MasterProjectDataInfo { //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}|{(use != null ? use.Id : "")}", Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}", Pro_id = x.Pro_id, + Pro_Classify = "已关联", Pro_name = x.Pro_name, Pro_code = x.Pro_code, Start_date = x.Start_date, @@ -121,52 +268,37 @@ namespace FineUIPro.Web.ProjectData RelateName = pro != null && pro.MasterSysId != null ? "已关联" : "未关联", }).ToList(); + query = query.OrderByDescending(x => x.StartDate).ToList(); + list.AddRange(query); + + var projects = ProjectService.GetProjectWorkList(); + var listYulixiang = (from x in projects + where x.MasterSysId == null + select new MasterProjectDataInfo + { + Pid = x.ProjectId, + ProjectId = x.ProjectId, + Pro_Classify = "预立项", + ProjectName = x.ProjectName, + ProjectCode = x.ProjectCode, + StartDate = x.StartDate, + ProjectState = x.ProjectState, + }).ToList(); + listYulixiang = listYulixiang.OrderByDescending(x => x.StartDate).ToList(); + list.AddRange(listYulixiang); + string startDate = this.txtStartTime.Text.Trim(); string endDate = this.txtEndTime.Text.Trim(); if (!string.IsNullOrWhiteSpace(startDate)) { - query = query.Where(x => Funs.GetNewDateTime(x.Start_date) >= Funs.GetNewDateTime(startDate)).ToList(); + list = list.Where(x => Funs.GetNewDateTime(x.Start_date) >= Funs.GetNewDateTime(startDate)).ToList(); } if (!string.IsNullOrWhiteSpace(endDate)) { - query = query.Where(x => Funs.GetNewDateTime(x.Start_date) <= Funs.GetNewDateTime(endDate)).ToList(); + list = list.Where(x => Funs.GetNewDateTime(x.Start_date) <= Funs.GetNewDateTime(endDate)).ToList(); } - query = query.OrderByDescending(x => x.StartDate).ToList(); - list.AddRange(query); - ////// 获取施工中的项目 - //getProjects = getProjects.Where(x => x.MasterSysId == null).OrderByDescending(x => x.StartDate).ToList(); - //foreach (var pro in getProjects) - //{ - // list.Add(new MasterProjectDataInfo - // { - // Pid = $"|{pro.ProjectId}", - // Pro_id = "", - // Pro_name = "", - // Pro_code = "", - // Start_date = "", - // Con_mode_desc = "", - // Pro_nature = "", - // Pro_status = "", - // Org_name = "", - // Amount = "", - // ProjectId = pro != null ? pro.ProjectId : null, - // ProjectName = pro != null ? pro.ProjectName : "", - // ProjectCode = pro != null ? pro.ProjectCode : "", - // StartDate = pro != null ? pro.StartDate : null, - // ProjectState = pro != null ? pro.ProjectState : "", - // Relate = 3, - // RelateName = "未对应", - // UseId = null, - // //Use = use == null ? "" : (use != null && use.Is_use == true) ? "已使用" : "未使用", - // ReasonType = "", - // Reason = "", - // //Situation = use != null ? use.Situation : "", - // //Remark = use != null ? use.Remark : "", - // }); - //} - string proName = this.txtProName.Text.Trim(); string proCode = this.txtProCode.Text.Trim(); string projectName = this.txtProjectName.Text.Trim(); @@ -194,6 +326,9 @@ namespace FineUIPro.Web.ProjectData // list = list.Where(x => x.Relate == relate).ToList(); //} + int yiGuanLianNum = list.Where(x => x.Pro_Classify == "已关联").Count(); + int yuLiXiangNum = list.Where(x => x.Pro_Classify == "预立项").Count(); + DataTable tb = Funs.LINQToDataTable(list); Grid1.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid1, tb); @@ -203,31 +338,12 @@ namespace FineUIPro.Web.ProjectData int totalNum = list.Count(); JObject summary = new JObject(); summary.Add("tfNumber", "合计"); - summary.Add("Pro_name", totalNum); + summary.Add("Pro_Classify", totalNum); + summary.Add("Pro_name", $"已关联:{yiGuanLianNum};预立项:{yuLiXiangNum}"); Grid1.SummaryData = summary; } - /// - /// 合同额(亿) - /// - /// 合同含税金额原始存档(元) - /// 增补合同本币含税金额(元) - /// - protected string ConvertAmount(decimal? Ori_amt, decimal? Amt_add) - { - string result = string.Empty; - Ori_amt = Ori_amt == null ? 0 : Ori_amt; - Amt_add = Amt_add == null ? 0 : Amt_add; - decimal? all = Amt_add + Ori_amt; - if (all != null) - { - double amount = all == null ? 0 : (Math.Round((double)(all / 100000000m), 2)); - result = amount.ToString(); - } - return result; - } - /// /// 项目状态 /// @@ -279,7 +395,7 @@ namespace FineUIPro.Web.ProjectData { Response.ClearContent(); string filename = Funs.GetNewFileName(); - Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(正常)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(已使用项目)" + filename, System.Text.Encoding.UTF8) + ".xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; this.Grid1.PageSize = this.Grid1.RecordCount; @@ -292,128 +408,6 @@ namespace FineUIPro.Web.ProjectData #endregion - #region 待建数据 - - - #region 绑定数据 - /// - /// 绑定数据 - /// - private void BindGrid2() - { - var list = new List(); - var db = Funs.DB; - var query = (from x in masterProDatas - join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup - from pro in proGroup.DefaultIfEmpty() - join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup - from use in useGroup.DefaultIfEmpty() - where pro == null && (use == null || (use != null && (use.Reason == null || use.Reason == ""))) - select new MasterProjectDataInfo - { - //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}|{(use != null ? use.Id : "")}", - //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}", - Pid = x.Pro_id, - Pro_id = x.Pro_id, - Pro_name = x.Pro_name, - Pro_code = x.Pro_code, - Start_date = x.Start_date, - Con_mode_desc = x.Con_mode_desc, - Pro_nature = x.Pro_nature, - Pro_status = x.Pro_status, - Org_name = x.Org_name, - Amount = ConvertAmount(x.Ori_amt_sum_vat_fc, x.Amt_add_sum_vat_fc_local) - }).ToList(); - - string startDate = this.txtStartTime2.Text.Trim(); - string endDate = this.txtEndTime2.Text.Trim(); - if (!string.IsNullOrWhiteSpace(startDate)) - { - query = query.Where(x => Funs.GetNewDateTime(x.Start_date) >= Funs.GetNewDateTime(startDate)).ToList(); - } - if (!string.IsNullOrWhiteSpace(endDate)) - { - query = query.Where(x => Funs.GetNewDateTime(x.Start_date) <= Funs.GetNewDateTime(endDate)).ToList(); - } - query = query.OrderByDescending(x => x.StartDate).ToList(); - list.AddRange(query); - - string proName = this.txtProName2.Text.Trim(); - string proCode = this.txtProCode2.Text.Trim(); - - if (!string.IsNullOrEmpty(proName)) - { - list = list.Where(x => x.Pro_name.Contains(proName)).ToList(); - } - if (!string.IsNullOrEmpty(proCode)) - { - list = list.Where(x => x.Pro_code.Contains(proCode)).ToList(); - } - - DataTable tb = Funs.LINQToDataTable(list); - Grid2.RecordCount = tb.Rows.Count; - var table = this.GetPagedDataTable(Grid2, tb); - Grid2.DataSource = table; - Grid2.DataBind(); - - int totalNum = list.Count(); - JObject summary = new JObject(); - summary.Add("tfPageIndex", "合计"); - summary.Add("Pro_name", totalNum); - - Grid2.SummaryData = summary; - } - - #endregion - - #region Grid - - protected void TextBox2_TextChanged(object sender, EventArgs e) - { - this.BindGrid2(); - } - - /// - /// - /// - /// - /// - protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e) - { - this.BindGrid2(); - } - - - protected void Grid2_Sort(object sender, FineUIPro.GridSortEventArgs e) - { - this.BindGrid2(); - } - #endregion - - #region 导出按钮 - - /// - /// 导出按钮 - /// - /// - /// - protected void btnOut2_Click(object sender, EventArgs e) - { - Response.ClearContent(); - string filename = Funs.GetNewFileName(); - Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(待建)" + filename, System.Text.Encoding.UTF8) + ".xls"); - Response.ContentType = "application/excel"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - this.Grid2.PageSize = this.Grid2.RecordCount; - this.BindGrid2(); - Response.Write(GetGridMultiHeaderTableHtml2(Grid2)); - //Response.Write(GetGridTableHtml(Grid2)); - Response.End(); - } - #endregion - - #endregion - #region 申请不用数据 @@ -430,13 +424,14 @@ namespace FineUIPro.Web.ProjectData from pro in proGroup.DefaultIfEmpty() join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup from use in useGroup.DefaultIfEmpty() - where pro == null && use != null && use.Reason != null && use.Reason != "" + where pro == null && use != null && use.Is_use == false && use.Reason != null && use.Reason != "" select new MasterProjectDataInfo { //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}|{(use != null ? use.Id : "")}", //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}", Pid = x.Pro_id, Pro_id = x.Pro_id, + Pro_Classify = use != null ? (use.ReasonType == "已完工" ? "已完工" : use.ReasonType == "停缓建" ? "停缓建" : "条件受限") : "", Pro_name = x.Pro_name, Pro_code = x.Pro_code, Start_date = x.Start_date, @@ -474,6 +469,10 @@ namespace FineUIPro.Web.ProjectData list = list.Where(x => x.Pro_code.Contains(proCode)).ToList(); } + int yiWanGongNum = list.Where(x => x.Pro_Classify == "已完工").Count(); + int tingHuanJianNum = list.Where(x => x.Pro_Classify == "停缓建").Count(); + int tiaoJianShouXianNum = list.Where(x => x.Pro_Classify == "条件受限").Count(); + DataTable tb = Funs.LINQToDataTable(list); Grid3.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid3, tb); @@ -483,7 +482,8 @@ namespace FineUIPro.Web.ProjectData int totalNum = list.Count(); JObject summary = new JObject(); summary.Add("tfPageNo", "合计"); - summary.Add("Pro_name", totalNum); + summary.Add("Pro_Classify", totalNum); + summary.Add("Pro_name", $"已完工:{yiWanGongNum};停缓建:{tingHuanJianNum};条件受限:{tiaoJianShouXianNum}"); Grid3.SummaryData = summary; } @@ -525,7 +525,7 @@ namespace FineUIPro.Web.ProjectData { Response.ClearContent(); string filename = Funs.GetNewFileName(); - Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(申请不用)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(申请不用项目)" + filename, System.Text.Encoding.UTF8) + ".xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; this.Grid3.PageSize = this.Grid3.RecordCount; @@ -538,115 +538,6 @@ namespace FineUIPro.Web.ProjectData #endregion - #region 预立项数据 - - #region 绑定数据 - /// - /// 绑定数据 - /// - private void BindGrid4() - { - //var list = new List(); - var db = Funs.DB; - var projects = ProjectService.GetProjectWorkList(); - var list = (from x in projects - where x.MasterSysId == null - select new MasterProjectDataInfo - { - Pid = x.ProjectId, - ProjectId = x.ProjectId, - ProjectName = x.ProjectName, - ProjectCode = x.ProjectCode, - StartDate = x.StartDate, - ProjectState = x.ProjectState, - }).ToList(); - - string projectName = this.txtProjectName4.Text.Trim(); - string projectCode = this.txtProjectCode4.Text.Trim(); - if (!string.IsNullOrEmpty(projectName)) - { - list = list.Where(x => x.ProjectName.Contains(projectName)).ToList(); - } - if (!string.IsNullOrEmpty(projectCode)) - { - list = list.Where(x => x.ProjectCode.Contains(projectCode)).ToList(); - } - string startDate = this.txtStartTime4.Text.Trim(); - string endDate = this.txtEndTime4.Text.Trim(); - if (!string.IsNullOrWhiteSpace(startDate)) - { - list = list.Where(x => x.StartDate >= Funs.GetNewDateTime(startDate)).ToList(); - } - if (!string.IsNullOrWhiteSpace(endDate)) - { - list = list.Where(x => x.StartDate <= Funs.GetNewDateTime(endDate)).ToList(); - } - //list = list.OrderByDescending(x => x.StartDate).ToList(); - //list.AddRange(query); - - DataTable tb = Funs.LINQToDataTable(list); - Grid4.RecordCount = tb.Rows.Count; - var table = this.GetPagedDataTable(Grid4, tb); - Grid4.DataSource = table; - Grid4.DataBind(); - - int totalNum = list.Count(); - JObject summary = new JObject(); - summary.Add("tfPageNum", "合计"); - summary.Add("ProjectCode", totalNum); - - Grid4.SummaryData = summary; - } - - #endregion - - #region Grid - - protected void TextBox4_TextChanged(object sender, EventArgs e) - { - this.BindGrid4(); - } - - /// - /// - /// - /// - /// - protected void Grid4_PageIndexChange(object sender, GridPageEventArgs e) - { - this.BindGrid4(); - } - - - protected void Grid4_Sort(object sender, FineUIPro.GridSortEventArgs e) - { - this.BindGrid4(); - } - #endregion - - #region 导出按钮 - - /// - /// 导出按钮 - /// - /// - /// - protected void btnOut4_Click(object sender, EventArgs e) - { - Response.ClearContent(); - string filename = Funs.GetNewFileName(); - Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(预立项)" + filename, System.Text.Encoding.UTF8) + ".xls"); - Response.ContentType = "application/excel"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - this.Grid4.PageSize = this.Grid4.RecordCount; - this.BindGrid4(); - Response.Write(GetGridMultiHeaderTableHtml2(Grid4)); - //Response.Write(GetGridTableHtml(Grid4)); - Response.End(); - } - #endregion - - #endregion #region 数据汇总 @@ -657,8 +548,8 @@ namespace FineUIPro.Web.ProjectData private void BindGrid9() { var db = Funs.DB; - var list = (from x in db.Project_MasterDataAnalysis - orderby x.ReportDate descending,x.DataDate descending + var list = (from x in db.View_Project_MasterDataAnalysis + orderby x.ReportDate descending select x).ToList().Take(30); string startDate = this.txtStartTime9.Text.Trim(); @@ -746,7 +637,7 @@ namespace FineUIPro.Web.ProjectData else { string message = string.Empty; - string code = ProjectMasterDataAnalysisService.ReportProjectMasterDataAnalysis(this.CurrUser.UserName,ref message); + string code = ProjectMasterDataAnalysisService.ReportProjectMasterDataAnalysis(this.CurrUser.UserName, ref message); if (code == "1") { this.BindGrid9(); diff --git a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.designer.cs index b62f413..31afe1d 100644 --- a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.designer.cs +++ b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysis.aspx.designer.cs @@ -50,6 +50,87 @@ namespace FineUIPro.Web.ProjectData /// protected global::FineUIPro.TabStrip TabStrip1; + /// + /// Grid2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid2; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtProCode2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProCode2; + + /// + /// txtProName2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProName2; + + /// + /// txtStartTime2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartTime2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// txtEndTime2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndTime2; + + /// + /// btnOut2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut2; + + /// + /// lblPageIndex 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblPageIndex; + /// /// Grid1 控件。 /// @@ -167,87 +248,6 @@ namespace FineUIPro.Web.ProjectData /// protected global::System.Web.UI.WebControls.Label lblState; - /// - /// Grid2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Grid Grid2; - - /// - /// Toolbar3 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Toolbar Toolbar3; - - /// - /// txtProCode2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtProCode2; - - /// - /// txtProName2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtProName2; - - /// - /// txtStartTime2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DatePicker txtStartTime2; - - /// - /// Label1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Label Label1; - - /// - /// txtEndTime2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DatePicker txtEndTime2; - - /// - /// btnOut2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnOut2; - - /// - /// lblPageIndex 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.WebControls.Label lblPageIndex; - /// /// Grid3 控件。 /// @@ -329,96 +329,6 @@ namespace FineUIPro.Web.ProjectData /// protected global::System.Web.UI.WebControls.Label lblPageNo; - /// - /// Grid4 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Grid Grid4; - - /// - /// Toolbar5 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Toolbar Toolbar5; - - /// - /// txtProjectCode4 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtProjectCode4; - - /// - /// txtProjectName4 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtProjectName4; - - /// - /// txtStartTime4 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DatePicker txtStartTime4; - - /// - /// Label3 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Label Label3; - - /// - /// txtEndTime4 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DatePicker txtEndTime4; - - /// - /// btnOut4 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnOut4; - - /// - /// lblPageNum 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.WebControls.Label lblPageNum; - - /// - /// lblProState 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.WebControls.Label lblProState; - /// /// Grid9 控件。 /// diff --git a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx new file mode 100644 index 0000000..af41f16 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx @@ -0,0 +1,393 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MasterProjectDataAnalysisOld.aspx.cs" Inherits="FineUIPro.Web.ProjectData.MasterProjectDataAnalysisOld" %> + + + + + + 集团在建项目清单 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx.cs b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx.cs new file mode 100644 index 0000000..b7044c1 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx.cs @@ -0,0 +1,857 @@ +using BLL; +using Model; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.ProjectData +{ + public partial class MasterProjectDataAnalysisOld : PageBase + { + /// + /// 集团在建主数据 + /// + public static List masterProDatas = new List(); + ///// + ///// QHSE施工中项目集合 + ///// + //public static List getProjects = new List(); + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + //获取集团在建主数据 + masterProDatas = ProjectService.GetMasterProjectDataInfos(); + ////获取QHSE施工中项目集合 + //getProjects = ProjectService.GetProjectWorkList(); + + TabStrip1_TabIndexChanged(null, null); + } + } + + /// + /// 页签切换事件 + /// + /// + /// + protected void TabStrip1_TabIndexChanged(object sender, EventArgs e) + { + if (TabStrip1.ActiveTabIndex == 0) + { + this.Panel1.Title = "已关联"; + this.BindGrid(); + } + else if (TabStrip1.ActiveTabIndex == 1) + { + this.Panel1.Title = "待建"; + this.BindGrid2(); + } + else if (TabStrip1.ActiveTabIndex == 2) + { + this.Panel1.Title = "申请不用"; + this.BindGrid3(); + } + else if (TabStrip1.ActiveTabIndex == 3) + { + this.Panel1.Title = "预立项"; + this.BindGrid4(); + } + else if (TabStrip1.ActiveTabIndex == 4) + { + this.Panel1.Title = "数据汇总"; + this.BindGrid9(); + } + //else if (TabStrip1.ActiveTabIndex == 4) + //{ + // this.Panel1.Title = "自建"; + // //this.BindGrid5(); + //} + } + + #endregion + + #region 已关联数据 + + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + var list = new List(); + var db = Funs.DB; + var query = (from x in masterProDatas + join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup + from pro in proGroup.DefaultIfEmpty() + //join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup + //from use in useGroup.DefaultIfEmpty() + where pro != null && pro.MasterSysId != null + //&& pro.ProjectState == Const.ProjectState_1 + select new MasterProjectDataInfo + { + //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}|{(use != null ? use.Id : "")}", + Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}", + Pro_id = x.Pro_id, + Pro_name = x.Pro_name, + Pro_code = x.Pro_code, + Start_date = x.Start_date, + Con_mode_desc = x.Con_mode_desc, + Pro_nature = x.Pro_nature, + Pro_status = x.Pro_status, + Org_name = x.Org_name, + Amount = ConvertAmount(x.Ori_amt_sum_vat_fc, x.Amt_add_sum_vat_fc_local), + ProjectId = pro != null ? pro.ProjectId : null, + ProjectName = pro != null ? pro.ProjectName : "", + ProjectCode = pro != null ? pro.ProjectCode : "", + StartDate = pro != null ? pro.StartDate : null, + ProjectState = pro != null ? pro.ProjectState : "", + Relate = pro != null && pro.MasterSysId != null ? 1 : 2, + RelateName = pro != null && pro.MasterSysId != null ? "已关联" : "未关联", + }).ToList(); + + string startDate = this.txtStartTime.Text.Trim(); + string endDate = this.txtEndTime.Text.Trim(); + if (!string.IsNullOrWhiteSpace(startDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) >= Funs.GetNewDateTime(startDate)).ToList(); + } + if (!string.IsNullOrWhiteSpace(endDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) <= Funs.GetNewDateTime(endDate)).ToList(); + } + query = query.OrderByDescending(x => x.StartDate).ToList(); + list.AddRange(query); + + + ////// 获取施工中的项目 + //getProjects = getProjects.Where(x => x.MasterSysId == null).OrderByDescending(x => x.StartDate).ToList(); + //foreach (var pro in getProjects) + //{ + // list.Add(new MasterProjectDataInfo + // { + // Pid = $"|{pro.ProjectId}", + // Pro_id = "", + // Pro_name = "", + // Pro_code = "", + // Start_date = "", + // Con_mode_desc = "", + // Pro_nature = "", + // Pro_status = "", + // Org_name = "", + // Amount = "", + // ProjectId = pro != null ? pro.ProjectId : null, + // ProjectName = pro != null ? pro.ProjectName : "", + // ProjectCode = pro != null ? pro.ProjectCode : "", + // StartDate = pro != null ? pro.StartDate : null, + // ProjectState = pro != null ? pro.ProjectState : "", + // Relate = 3, + // RelateName = "未对应", + // UseId = null, + // //Use = use == null ? "" : (use != null && use.Is_use == true) ? "已使用" : "未使用", + // ReasonType = "", + // Reason = "", + // //Situation = use != null ? use.Situation : "", + // //Remark = use != null ? use.Remark : "", + // }); + //} + + string proName = this.txtProName.Text.Trim(); + string proCode = this.txtProCode.Text.Trim(); + string projectName = this.txtProjectName.Text.Trim(); + string projectCode = this.txtProjectCode.Text.Trim(); + //int relate = int.Parse(this.rblIsRelate.SelectedValue); + + if (!string.IsNullOrEmpty(proName)) + { + list = list.Where(x => x.Pro_name.Contains(proName)).ToList(); + } + if (!string.IsNullOrEmpty(proCode)) + { + list = list.Where(x => x.Pro_code.Contains(proCode)).ToList(); + } + if (!string.IsNullOrEmpty(projectName)) + { + list = list.Where(x => x.ProjectName.Contains(projectName)).ToList(); + } + if (!string.IsNullOrEmpty(projectCode)) + { + list = list.Where(x => x.ProjectCode.Contains(projectCode)).ToList(); + } + //if (relate > 0) + //{ + // list = list.Where(x => x.Relate == relate).ToList(); + //} + + DataTable tb = Funs.LINQToDataTable(list); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + + int totalNum = list.Count(); + JObject summary = new JObject(); + summary.Add("tfNumber", "合计"); + summary.Add("Pro_name", totalNum); + + Grid1.SummaryData = summary; + } + + /// + /// 合同额(亿) + /// + /// 合同含税金额原始存档(元) + /// 增补合同本币含税金额(元) + /// + protected string ConvertAmount(decimal? Ori_amt, decimal? Amt_add) + { + string result = string.Empty; + Ori_amt = Ori_amt == null ? 0 : Ori_amt; + Amt_add = Amt_add == null ? 0 : Amt_add; + decimal? all = Amt_add + Ori_amt; + if (all != null) + { + double amount = all == null ? 0 : (Math.Round((double)(all / 100000000m), 2)); + result = amount.ToString(); + } + return result; + } + + /// + /// 项目状态 + /// + /// + /// + protected string ConvertProjectState(object state) + { + string result = string.Empty; + string stateStr = state.ToString(); + if (state != null && !string.IsNullOrWhiteSpace(stateStr)) + { + result = stateStr == "2" ? "暂停中" : stateStr == "3" ? "已完工" : "施工中"; + } + return result; + } + #endregion + + #region Grid + + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + /// + /// + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + this.BindGrid(); + } + + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 导出按钮 + + /// + /// 导出按钮 + /// + /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(正常)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = this.Grid1.RecordCount; + this.BindGrid(); + Response.Write(GetGridMultiHeaderTableHtml2(Grid1)); + //Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + #endregion + + #endregion + + #region 待建数据 + + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid2() + { + var list = new List(); + var db = Funs.DB; + var query = (from x in masterProDatas + join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup + from pro in proGroup.DefaultIfEmpty() + join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup + from use in useGroup.DefaultIfEmpty() + where pro == null && (use == null || (use != null && (use.Reason == null || use.Reason == ""))) + select new MasterProjectDataInfo + { + //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}|{(use != null ? use.Id : "")}", + //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}", + Pid = x.Pro_id, + Pro_id = x.Pro_id, + Pro_name = x.Pro_name, + Pro_code = x.Pro_code, + Start_date = x.Start_date, + Con_mode_desc = x.Con_mode_desc, + Pro_nature = x.Pro_nature, + Pro_status = x.Pro_status, + Org_name = x.Org_name, + Amount = ConvertAmount(x.Ori_amt_sum_vat_fc, x.Amt_add_sum_vat_fc_local) + }).ToList(); + + string startDate = this.txtStartTime2.Text.Trim(); + string endDate = this.txtEndTime2.Text.Trim(); + if (!string.IsNullOrWhiteSpace(startDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) >= Funs.GetNewDateTime(startDate)).ToList(); + } + if (!string.IsNullOrWhiteSpace(endDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) <= Funs.GetNewDateTime(endDate)).ToList(); + } + query = query.OrderByDescending(x => x.StartDate).ToList(); + list.AddRange(query); + + string proName = this.txtProName2.Text.Trim(); + string proCode = this.txtProCode2.Text.Trim(); + + if (!string.IsNullOrEmpty(proName)) + { + list = list.Where(x => x.Pro_name.Contains(proName)).ToList(); + } + if (!string.IsNullOrEmpty(proCode)) + { + list = list.Where(x => x.Pro_code.Contains(proCode)).ToList(); + } + + DataTable tb = Funs.LINQToDataTable(list); + Grid2.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid2, tb); + Grid2.DataSource = table; + Grid2.DataBind(); + + int totalNum = list.Count(); + JObject summary = new JObject(); + summary.Add("tfPageIndex", "合计"); + summary.Add("Pro_name", totalNum); + + Grid2.SummaryData = summary; + } + + #endregion + + #region Grid + + protected void TextBox2_TextChanged(object sender, EventArgs e) + { + this.BindGrid2(); + } + + /// + /// + /// + /// + /// + protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e) + { + this.BindGrid2(); + } + + + protected void Grid2_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + this.BindGrid2(); + } + #endregion + + #region 导出按钮 + + /// + /// 导出按钮 + /// + /// + /// + protected void btnOut2_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(待建)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid2.PageSize = this.Grid2.RecordCount; + this.BindGrid2(); + Response.Write(GetGridMultiHeaderTableHtml2(Grid2)); + //Response.Write(GetGridTableHtml(Grid2)); + Response.End(); + } + #endregion + + #endregion + + #region 申请不用数据 + + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid3() + { + var list = new List(); + var db = Funs.DB; + var query = (from x in masterProDatas + join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup + from pro in proGroup.DefaultIfEmpty() + join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup + from use in useGroup.DefaultIfEmpty() + where pro == null && use != null && use.Reason != null && use.Reason != "" + select new MasterProjectDataInfo + { + //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}|{(use != null ? use.Id : "")}", + //Pid = $"{x.Pro_id}|{(pro != null ? $"{pro.ProjectId}" : "")}", + Pid = x.Pro_id, + Pro_id = x.Pro_id, + Pro_name = x.Pro_name, + Pro_code = x.Pro_code, + Start_date = x.Start_date, + Con_mode_desc = x.Con_mode_desc, + Pro_nature = x.Pro_nature, + Pro_status = x.Pro_status, + Org_name = x.Org_name, + Amount = ConvertAmount(x.Ori_amt_sum_vat_fc, x.Amt_add_sum_vat_fc_local), + ReasonType = use != null ? use.ReasonType : "", + Reason = use != null ? use.Reason : "", + }).ToList(); + + string startDate = this.txtStartTime3.Text.Trim(); + string endDate = this.txtEndTime3.Text.Trim(); + if (!string.IsNullOrWhiteSpace(startDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) >= Funs.GetNewDateTime(startDate)).ToList(); + } + if (!string.IsNullOrWhiteSpace(endDate)) + { + query = query.Where(x => Funs.GetNewDateTime(x.Start_date) <= Funs.GetNewDateTime(endDate)).ToList(); + } + //query = query.OrderByDescending(x => x.StartDate).ToList(); + list.AddRange(query); + + string proName = this.txtProName3.Text.Trim(); + string proCode = this.txtProCode3.Text.Trim(); + + if (!string.IsNullOrEmpty(proName)) + { + list = list.Where(x => x.Pro_name.Contains(proName)).ToList(); + } + if (!string.IsNullOrEmpty(proCode)) + { + list = list.Where(x => x.Pro_code.Contains(proCode)).ToList(); + } + + DataTable tb = Funs.LINQToDataTable(list); + Grid3.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid3, tb); + Grid3.DataSource = table; + Grid3.DataBind(); + + int totalNum = list.Count(); + JObject summary = new JObject(); + summary.Add("tfPageNo", "合计"); + summary.Add("Pro_name", totalNum); + + Grid3.SummaryData = summary; + } + + #endregion + + #region Grid + + protected void TextBox3_TextChanged(object sender, EventArgs e) + { + this.BindGrid3(); + } + + /// + /// + /// + /// + /// + protected void Grid3_PageIndexChange(object sender, GridPageEventArgs e) + { + this.BindGrid3(); + } + + + protected void Grid3_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + this.BindGrid3(); + } + #endregion + + #region 导出按钮 + + /// + /// 导出按钮 + /// + /// + /// + protected void btnOut3_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(申请不用)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid3.PageSize = this.Grid3.RecordCount; + this.BindGrid3(); + Response.Write(GetGridMultiHeaderTableHtml2(Grid3)); + //Response.Write(GetGridTableHtml(Grid3)); + Response.End(); + } + #endregion + + #endregion + + #region 预立项数据 + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid4() + { + //var list = new List(); + var db = Funs.DB; + var projects = ProjectService.GetProjectWorkList(); + var list = (from x in projects + where x.MasterSysId == null + select new MasterProjectDataInfo + { + Pid = x.ProjectId, + ProjectId = x.ProjectId, + ProjectName = x.ProjectName, + ProjectCode = x.ProjectCode, + StartDate = x.StartDate, + ProjectState = x.ProjectState, + }).ToList(); + + string projectName = this.txtProjectName4.Text.Trim(); + string projectCode = this.txtProjectCode4.Text.Trim(); + if (!string.IsNullOrEmpty(projectName)) + { + list = list.Where(x => x.ProjectName.Contains(projectName)).ToList(); + } + if (!string.IsNullOrEmpty(projectCode)) + { + list = list.Where(x => x.ProjectCode.Contains(projectCode)).ToList(); + } + string startDate = this.txtStartTime4.Text.Trim(); + string endDate = this.txtEndTime4.Text.Trim(); + if (!string.IsNullOrWhiteSpace(startDate)) + { + list = list.Where(x => x.StartDate >= Funs.GetNewDateTime(startDate)).ToList(); + } + if (!string.IsNullOrWhiteSpace(endDate)) + { + list = list.Where(x => x.StartDate <= Funs.GetNewDateTime(endDate)).ToList(); + } + //list = list.OrderByDescending(x => x.StartDate).ToList(); + //list.AddRange(query); + + DataTable tb = Funs.LINQToDataTable(list); + Grid4.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid4, tb); + Grid4.DataSource = table; + Grid4.DataBind(); + + int totalNum = list.Count(); + JObject summary = new JObject(); + summary.Add("tfPageNum", "合计"); + summary.Add("ProjectCode", totalNum); + + Grid4.SummaryData = summary; + } + + #endregion + + #region Grid + + protected void TextBox4_TextChanged(object sender, EventArgs e) + { + this.BindGrid4(); + } + + /// + /// + /// + /// + /// + protected void Grid4_PageIndexChange(object sender, GridPageEventArgs e) + { + this.BindGrid4(); + } + + + protected void Grid4_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + this.BindGrid4(); + } + #endregion + + #region 导出按钮 + + /// + /// 导出按钮 + /// + /// + /// + protected void btnOut4_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(预立项)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid4.PageSize = this.Grid4.RecordCount; + this.BindGrid4(); + Response.Write(GetGridMultiHeaderTableHtml2(Grid4)); + //Response.Write(GetGridTableHtml(Grid4)); + Response.End(); + } + #endregion + + #endregion + + #region 数据汇总 + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid9() + { + var db = Funs.DB; + var list = (from x in db.Project_MasterDataAnalysis + orderby x.ReportDate descending,x.DataDate descending + select x).ToList().Take(30); + + string startDate = this.txtStartTime9.Text.Trim(); + string endDate = this.txtEndTime9.Text.Trim(); + if (!string.IsNullOrWhiteSpace(startDate)) + { + list = list.Where(x => x.ReportDate >= Funs.GetNewDateTime(startDate)).ToList(); + } + if (!string.IsNullOrWhiteSpace(endDate)) + { + list = list.Where(x => x.ReportDate <= Funs.GetNewDateTime(endDate)).ToList(); + } + + DataTable tb = Funs.LINQToDataTable(list); + Grid9.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid9, tb); + Grid9.DataSource = table; + Grid9.DataBind(); + } + + #endregion + + #region Grid + + protected void TextBox9_TextChanged(object sender, EventArgs e) + { + this.BindGrid9(); + } + + /// + /// + /// + /// + /// + protected void Grid9_PageIndexChange(object sender, GridPageEventArgs e) + { + this.BindGrid9(); + } + + + protected void Grid9_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + this.BindGrid9(); + } + #endregion + + #region 导出按钮 + + /// + /// 导出按钮 + /// + /// + /// + protected void btnOut9_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目数据分析(数据汇总)" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid9.PageSize = this.Grid9.RecordCount; + this.BindGrid9(); + Response.Write(GetGridMultiHeaderTableHtml2(Grid9)); + //Response.Write(GetGridTableHtml(Grid9)); + Response.End(); + } + #endregion + + + #region 汇总上报 + + /// + /// 汇总上报 + /// + /// + /// + protected void btnReport_Click(object sender, EventArgs e) + { + var reportList = ProjectMasterDataAnalysisService.GetRecentHourAnalysisReportList(); + if (reportList.Any()) + { + Alert.ShowInTop("近一小时内已汇总上报,请勿频繁上报!", MessageBoxIcon.Warning); + return; + } + else + { + string message = string.Empty; + string code = ProjectMasterDataAnalysisService.ReportProjectMasterDataAnalysis(this.CurrUser.UserName,ref message); + if (code == "1") + { + this.BindGrid9(); + ShowNotify(message, MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + return; + } + else + { + Alert.ShowInParent(message, MessageBoxIcon.Error); + } + } + } + + #endregion + + #endregion + + #region 多表头导出方法 + /// + /// 多表头导出方法 + /// + /// + /// + public string GetGridMultiHeaderTableHtml2(Grid grid) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + MultiHeaderTable mht = new MultiHeaderTable(); + mht.ResolveMultiHeaderTable(grid.Columns); + + foreach (List rows in mht.MultiTable) + { + sb.Append(""); + foreach (object[] cell in rows) + { + int rowspan = Convert.ToInt32(cell[0]); + int colspan = Convert.ToInt32(cell[1]); + GridColumn column = cell[2] as GridColumn; + if (column.Hidden == false) + { + sb.AppendFormat("{3}", + rowspan != 1 ? " rowspan=\"" + rowspan + "\"" : "", + colspan != 1 ? " colspan=\"" + colspan + "\"" : "", + colspan != 1 ? " style=\"text-align:center;\"" : "", + column.HeaderText); + } + } + sb.Append(""); + } + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + //if (row.Grid.gr.Hidden == false) { + foreach (GridColumn column in mht.Columns) + { + if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "Punish" && column.ColumnID != "Del") + { + string html = row.Values[column.ColumnIndex].ToString(); + if (column.ColumnID == "tfNumber") + { + html = (row.FindControl("lblNumber") as AspNet.Label).Text; + } + else if (column.ColumnID == "tfPageIndex") + { + html = (row.FindControl("lblPageIndex") as AspNet.Label).Text; + } + else if (column.ColumnID == "tfPageNo") + { + html = (row.FindControl("lblPageNo") as AspNet.Label).Text; + } + else if (column.ColumnID == "tfPageNum") + { + html = (row.FindControl("lblPageNum") as AspNet.Label).Text; + } + else if (column.ColumnID == "tfNum") + { + html = (row.FindControl("lblNum") as AspNet.Label).Text; + } + else if (column.ColumnID == "tfState") + { + html = (row.FindControl("lblState") as AspNet.Label).Text; + } + else if (column.ColumnID == "tfProState") + { + html = (row.FindControl("lblProState") as AspNet.Label).Text; + } + else if (column.ColumnID == "tfStatus") + { + html = (row.FindControl("lblStatus") as AspNet.Label).Text; + } + sb.AppendFormat("", html); + } + } + //} + sb.Append(""); + } + + sb.Append("
{0}
"); + + return sb.ToString(); + } + + + #endregion + } +} \ No newline at end of file diff --git a/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx.designer.cs new file mode 100644 index 0000000..c1044fe --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/ProjectData/MasterProjectDataAnalysisOld.aspx.designer.cs @@ -0,0 +1,494 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.ProjectData +{ + + + public partial class MasterProjectDataAnalysisOld + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// TabStrip1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TabStrip TabStrip1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// txtProCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProCode; + + /// + /// txtProName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProName; + + /// + /// txtStartTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartTime; + + /// + /// Label5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label5; + + /// + /// txtEndTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndTime; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtProjectCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProjectCode; + + /// + /// txtProjectName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProjectName; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// lblState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblState; + + /// + /// Grid2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid2; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtProCode2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProCode2; + + /// + /// txtProName2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProName2; + + /// + /// txtStartTime2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartTime2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// txtEndTime2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndTime2; + + /// + /// btnOut2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut2; + + /// + /// lblPageIndex 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblPageIndex; + + /// + /// Grid3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid3; + + /// + /// Toolbar4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar4; + + /// + /// txtProCode3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProCode3; + + /// + /// txtProName3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProName3; + + /// + /// txtStartTime3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartTime3; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label2; + + /// + /// txtEndTime3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndTime3; + + /// + /// btnOut3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut3; + + /// + /// lblPageNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblPageNo; + + /// + /// Grid4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid4; + + /// + /// Toolbar5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar5; + + /// + /// txtProjectCode4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProjectCode4; + + /// + /// txtProjectName4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProjectName4; + + /// + /// txtStartTime4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartTime4; + + /// + /// Label3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label3; + + /// + /// txtEndTime4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndTime4; + + /// + /// btnOut4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut4; + + /// + /// lblPageNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblPageNum; + + /// + /// lblProState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblProState; + + /// + /// Grid9 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid9; + + /// + /// Toolbar6 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar6; + + /// + /// txtStartTime9 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartTime9; + + /// + /// Label4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label4; + + /// + /// txtEndTime9 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndTime9; + + /// + /// btnReport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnReport; + + /// + /// btnOut9 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut9; + + /// + /// lblNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNum; + } +} diff --git a/SUBQHSE/Model/APIItem/CNCEC/Ads_pms_pro_info_build.cs b/SUBQHSE/Model/APIItem/CNCEC/Ads_pms_pro_info_build.cs index 5ff0050..4780bdf 100644 --- a/SUBQHSE/Model/APIItem/CNCEC/Ads_pms_pro_info_build.cs +++ b/SUBQHSE/Model/APIItem/CNCEC/Ads_pms_pro_info_build.cs @@ -111,6 +111,10 @@ namespace Model /// public string Pro_id { get; set; } /// + /// 分类 + /// + public string Pro_Classify { get; set; } + /// /// 项目编码 /// public string Pro_code { get; set; } diff --git a/SUBQHSE/Model/Model.cs b/SUBQHSE/Model/Model.cs index f2c817a..4c0053a 100644 --- a/SUBQHSE/Model/Model.cs +++ b/SUBQHSE/Model/Model.cs @@ -830,6 +830,9 @@ namespace Model partial void InsertDataBase_StartWorkReport(DataBase_StartWorkReport instance); partial void UpdateDataBase_StartWorkReport(DataBase_StartWorkReport instance); partial void DeleteDataBase_StartWorkReport(DataBase_StartWorkReport instance); + partial void InsertDataGovernance_MetricData(DataGovernance_MetricData instance); + partial void UpdateDataGovernance_MetricData(DataGovernance_MetricData instance); + partial void DeleteDataGovernance_MetricData(DataGovernance_MetricData instance); partial void InsertDataIdMove(DataIdMove instance); partial void UpdateDataIdMove(DataIdMove instance); partial void DeleteDataIdMove(DataIdMove instance); @@ -5188,6 +5191,14 @@ namespace Model } } + public System.Data.Linq.Table DataGovernance_MetricData + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table DataIdMove { get @@ -11532,6 +11543,14 @@ namespace Model } } + public System.Data.Linq.Table View_Project_MasterDataAnalysis + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table View_ProjectAccident_AccidentAnalysis { get @@ -141198,6 +141217,260 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.DataGovernance_MetricData")] + public partial class DataGovernance_MetricData : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _Id; + + private string _Name; + + private string _Field; + + private int _Frequency; + + private bool _IsKeyMetric; + + private string _Type; + + private string _Remark; + + private System.DateTime _CreateDate; + + private string _CreateUser; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnIdChanging(string value); + partial void OnIdChanged(); + partial void OnNameChanging(string value); + partial void OnNameChanged(); + partial void OnFieldChanging(string value); + partial void OnFieldChanged(); + partial void OnFrequencyChanging(int value); + partial void OnFrequencyChanged(); + partial void OnIsKeyMetricChanging(bool value); + partial void OnIsKeyMetricChanged(); + partial void OnTypeChanging(string value); + partial void OnTypeChanged(); + partial void OnRemarkChanging(string value); + partial void OnRemarkChanged(); + partial void OnCreateDateChanging(System.DateTime value); + partial void OnCreateDateChanged(); + partial void OnCreateUserChanging(string value); + partial void OnCreateUserChanged(); + #endregion + + public DataGovernance_MetricData() + { + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string Id + { + get + { + return this._Id; + } + set + { + if ((this._Id != value)) + { + this.OnIdChanging(value); + this.SendPropertyChanging(); + this._Id = value; + this.SendPropertyChanged("Id"); + this.OnIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(100) NOT NULL", CanBeNull=false)] + public string Name + { + get + { + return this._Name; + } + set + { + if ((this._Name != value)) + { + this.OnNameChanging(value); + this.SendPropertyChanging(); + this._Name = value; + this.SendPropertyChanged("Name"); + this.OnNameChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Field", DbType="NVarChar(100) NOT NULL", CanBeNull=false)] + public string Field + { + get + { + return this._Field; + } + set + { + if ((this._Field != value)) + { + this.OnFieldChanging(value); + this.SendPropertyChanging(); + this._Field = value; + this.SendPropertyChanged("Field"); + this.OnFieldChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Frequency", DbType="Int NOT NULL")] + public int Frequency + { + get + { + return this._Frequency; + } + set + { + if ((this._Frequency != value)) + { + this.OnFrequencyChanging(value); + this.SendPropertyChanging(); + this._Frequency = value; + this.SendPropertyChanged("Frequency"); + this.OnFrequencyChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsKeyMetric", DbType="Bit NOT NULL")] + public bool IsKeyMetric + { + get + { + return this._IsKeyMetric; + } + set + { + if ((this._IsKeyMetric != value)) + { + this.OnIsKeyMetricChanging(value); + this.SendPropertyChanging(); + this._IsKeyMetric = value; + this.SendPropertyChanged("IsKeyMetric"); + this.OnIsKeyMetricChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Type", DbType="NVarChar(10) NOT NULL", CanBeNull=false)] + public string Type + { + get + { + return this._Type; + } + set + { + if ((this._Type != value)) + { + this.OnTypeChanging(value); + this.SendPropertyChanging(); + this._Type = value; + this.SendPropertyChanged("Type"); + this.OnTypeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Remark", DbType="NVarChar(200)")] + public string Remark + { + get + { + return this._Remark; + } + set + { + if ((this._Remark != value)) + { + this.OnRemarkChanging(value); + this.SendPropertyChanging(); + this._Remark = value; + this.SendPropertyChanged("Remark"); + this.OnRemarkChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateDate", DbType="DateTime NOT NULL")] + public System.DateTime CreateDate + { + get + { + return this._CreateDate; + } + set + { + if ((this._CreateDate != value)) + { + this.OnCreateDateChanging(value); + this.SendPropertyChanging(); + this._CreateDate = value; + this.SendPropertyChanged("CreateDate"); + this.OnCreateDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateUser", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string CreateUser + { + get + { + return this._CreateUser; + } + set + { + if ((this._CreateUser != value)) + { + this.OnCreateUserChanging(value); + this.SendPropertyChanging(); + this._CreateUser = value; + this.SendPropertyChanged("CreateUser"); + this.OnCreateUserChanged(); + } + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.DataIdMove")] public partial class DataIdMove : INotifyPropertyChanging, INotifyPropertyChanged { @@ -327969,6 +328242,22 @@ namespace Model private string _CreateUser; + private System.Nullable _TianBao; + + private System.Nullable _YiShangXian; + + private System.Nullable _OnlineRate; + + private System.Nullable _BuYongYiWanGong; + + private System.Nullable _BuYongTingHuanJian; + + private System.Nullable _BuYongTJShouXian; + + private System.Nullable _ThisMonActiveUserNum; + + private System.Nullable _DailyAvg; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -327999,6 +328288,22 @@ namespace Model partial void OnYuLiXiangChanged(); partial void OnCreateUserChanging(string value); partial void OnCreateUserChanged(); + partial void OnTianBaoChanging(System.Nullable value); + partial void OnTianBaoChanged(); + partial void OnYiShangXianChanging(System.Nullable value); + partial void OnYiShangXianChanged(); + partial void OnOnlineRateChanging(System.Nullable value); + partial void OnOnlineRateChanged(); + partial void OnBuYongYiWanGongChanging(System.Nullable value); + partial void OnBuYongYiWanGongChanged(); + partial void OnBuYongTingHuanJianChanging(System.Nullable value); + partial void OnBuYongTingHuanJianChanged(); + partial void OnBuYongTJShouXianChanging(System.Nullable value); + partial void OnBuYongTJShouXianChanged(); + partial void OnThisMonActiveUserNumChanging(System.Nullable value); + partial void OnThisMonActiveUserNumChanged(); + partial void OnDailyAvgChanging(System.Nullable value); + partial void OnDailyAvgChanged(); #endregion public Project_MasterDataAnalysis() @@ -328266,6 +328571,166 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TianBao", DbType="Int")] + public System.Nullable TianBao + { + get + { + return this._TianBao; + } + set + { + if ((this._TianBao != value)) + { + this.OnTianBaoChanging(value); + this.SendPropertyChanging(); + this._TianBao = value; + this.SendPropertyChanged("TianBao"); + this.OnTianBaoChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YiShangXian", DbType="Int")] + public System.Nullable YiShangXian + { + get + { + return this._YiShangXian; + } + set + { + if ((this._YiShangXian != value)) + { + this.OnYiShangXianChanging(value); + this.SendPropertyChanging(); + this._YiShangXian = value; + this.SendPropertyChanged("YiShangXian"); + this.OnYiShangXianChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OnlineRate", DbType="Decimal(18,2)")] + public System.Nullable OnlineRate + { + get + { + return this._OnlineRate; + } + set + { + if ((this._OnlineRate != value)) + { + this.OnOnlineRateChanging(value); + this.SendPropertyChanging(); + this._OnlineRate = value; + this.SendPropertyChanged("OnlineRate"); + this.OnOnlineRateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuYongYiWanGong", DbType="Int")] + public System.Nullable BuYongYiWanGong + { + get + { + return this._BuYongYiWanGong; + } + set + { + if ((this._BuYongYiWanGong != value)) + { + this.OnBuYongYiWanGongChanging(value); + this.SendPropertyChanging(); + this._BuYongYiWanGong = value; + this.SendPropertyChanged("BuYongYiWanGong"); + this.OnBuYongYiWanGongChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuYongTingHuanJian", DbType="Int")] + public System.Nullable BuYongTingHuanJian + { + get + { + return this._BuYongTingHuanJian; + } + set + { + if ((this._BuYongTingHuanJian != value)) + { + this.OnBuYongTingHuanJianChanging(value); + this.SendPropertyChanging(); + this._BuYongTingHuanJian = value; + this.SendPropertyChanged("BuYongTingHuanJian"); + this.OnBuYongTingHuanJianChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuYongTJShouXian", DbType="Int")] + public System.Nullable BuYongTJShouXian + { + get + { + return this._BuYongTJShouXian; + } + set + { + if ((this._BuYongTJShouXian != value)) + { + this.OnBuYongTJShouXianChanging(value); + this.SendPropertyChanging(); + this._BuYongTJShouXian = value; + this.SendPropertyChanged("BuYongTJShouXian"); + this.OnBuYongTJShouXianChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ThisMonActiveUserNum", DbType="Int")] + public System.Nullable ThisMonActiveUserNum + { + get + { + return this._ThisMonActiveUserNum; + } + set + { + if ((this._ThisMonActiveUserNum != value)) + { + this.OnThisMonActiveUserNumChanging(value); + this.SendPropertyChanging(); + this._ThisMonActiveUserNum = value; + this.SendPropertyChanged("ThisMonActiveUserNum"); + this.OnThisMonActiveUserNumChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DailyAvg", DbType="Decimal(18,2)")] + public System.Nullable DailyAvg + { + get + { + return this._DailyAvg; + } + set + { + if ((this._DailyAvg != value)) + { + this.OnDailyAvgChanging(value); + this.SendPropertyChanging(); + this._DailyAvg = value; + this.SendPropertyChanged("DailyAvg"); + this.OnDailyAvgChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -506185,6 +506650,393 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_Project_MasterDataAnalysis")] + public partial class View_Project_MasterDataAnalysis + { + + private string _Id; + + private string _CollCropCode; + + private string _UnitId; + + private System.DateTime _ReportDate; + + private System.DateTime _DataDate; + + private int _Total; + + private int _MasterTotal; + + private int _QHSETotal; + + private int _ZhengChang; + + private int _DaiJian; + + private int _BuYong; + + private int _YuLiXiang; + + private string _CreateUser; + + private System.Nullable _TianBao; + + private System.Nullable _YiShangXian; + + private System.Nullable _OnlineRate; + + private System.Nullable _BuYongYiWanGong; + + private System.Nullable _BuYongTingHuanJian; + + private System.Nullable _BuYongTJShouXian; + + private System.Nullable _ThisMonActiveUserNum; + + private System.Nullable _DailyAvg; + + public View_Project_MasterDataAnalysis() + { + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string Id + { + get + { + return this._Id; + } + set + { + if ((this._Id != value)) + { + this._Id = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CollCropCode", DbType="NVarChar(100) NOT NULL", CanBeNull=false)] + public string CollCropCode + { + get + { + return this._CollCropCode; + } + set + { + if ((this._CollCropCode != value)) + { + this._CollCropCode = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string UnitId + { + get + { + return this._UnitId; + } + set + { + if ((this._UnitId != value)) + { + this._UnitId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReportDate", DbType="DateTime NOT NULL")] + public System.DateTime ReportDate + { + get + { + return this._ReportDate; + } + set + { + if ((this._ReportDate != value)) + { + this._ReportDate = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DataDate", DbType="DateTime NOT NULL")] + public System.DateTime DataDate + { + get + { + return this._DataDate; + } + set + { + if ((this._DataDate != value)) + { + this._DataDate = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Total", DbType="Int NOT NULL")] + public int Total + { + get + { + return this._Total; + } + set + { + if ((this._Total != value)) + { + this._Total = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MasterTotal", DbType="Int NOT NULL")] + public int MasterTotal + { + get + { + return this._MasterTotal; + } + set + { + if ((this._MasterTotal != value)) + { + this._MasterTotal = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_QHSETotal", DbType="Int NOT NULL")] + public int QHSETotal + { + get + { + return this._QHSETotal; + } + set + { + if ((this._QHSETotal != value)) + { + this._QHSETotal = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ZhengChang", DbType="Int NOT NULL")] + public int ZhengChang + { + get + { + return this._ZhengChang; + } + set + { + if ((this._ZhengChang != value)) + { + this._ZhengChang = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DaiJian", DbType="Int NOT NULL")] + public int DaiJian + { + get + { + return this._DaiJian; + } + set + { + if ((this._DaiJian != value)) + { + this._DaiJian = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuYong", DbType="Int NOT NULL")] + public int BuYong + { + get + { + return this._BuYong; + } + set + { + if ((this._BuYong != value)) + { + this._BuYong = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YuLiXiang", DbType="Int NOT NULL")] + public int YuLiXiang + { + get + { + return this._YuLiXiang; + } + set + { + if ((this._YuLiXiang != value)) + { + this._YuLiXiang = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateUser", DbType="NVarChar(200) NOT NULL", CanBeNull=false)] + public string CreateUser + { + get + { + return this._CreateUser; + } + set + { + if ((this._CreateUser != value)) + { + this._CreateUser = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TianBao", DbType="Int")] + public System.Nullable TianBao + { + get + { + return this._TianBao; + } + set + { + if ((this._TianBao != value)) + { + this._TianBao = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YiShangXian", DbType="Int")] + public System.Nullable YiShangXian + { + get + { + return this._YiShangXian; + } + set + { + if ((this._YiShangXian != value)) + { + this._YiShangXian = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OnlineRate", DbType="Decimal(18,2)")] + public System.Nullable OnlineRate + { + get + { + return this._OnlineRate; + } + set + { + if ((this._OnlineRate != value)) + { + this._OnlineRate = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuYongYiWanGong", DbType="Int")] + public System.Nullable BuYongYiWanGong + { + get + { + return this._BuYongYiWanGong; + } + set + { + if ((this._BuYongYiWanGong != value)) + { + this._BuYongYiWanGong = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuYongTingHuanJian", DbType="Int")] + public System.Nullable BuYongTingHuanJian + { + get + { + return this._BuYongTingHuanJian; + } + set + { + if ((this._BuYongTingHuanJian != value)) + { + this._BuYongTingHuanJian = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BuYongTJShouXian", DbType="Int")] + public System.Nullable BuYongTJShouXian + { + get + { + return this._BuYongTJShouXian; + } + set + { + if ((this._BuYongTJShouXian != value)) + { + this._BuYongTJShouXian = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ThisMonActiveUserNum", DbType="Int")] + public System.Nullable ThisMonActiveUserNum + { + get + { + return this._ThisMonActiveUserNum; + } + set + { + if ((this._ThisMonActiveUserNum != value)) + { + this._ThisMonActiveUserNum = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DailyAvg", DbType="Decimal(18,2)")] + public System.Nullable DailyAvg + { + get + { + return this._DailyAvg; + } + set + { + if ((this._DailyAvg != value)) + { + this._DailyAvg = value; + } + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_ProjectAccident_AccidentAnalysis")] public partial class View_ProjectAccident_AccidentAnalysis { diff --git a/SUBQHSE/WebAPI/Controllers/DataGovernance/DataGovernanceController.cs b/SUBQHSE/WebAPI/Controllers/DataGovernance/DataGovernanceController.cs new file mode 100644 index 0000000..02eb08e --- /dev/null +++ b/SUBQHSE/WebAPI/Controllers/DataGovernance/DataGovernanceController.cs @@ -0,0 +1,38 @@ +using BLL; +using Model; +using Newtonsoft.Json; +using System; +using System.Collections.Concurrent; +using System.Diagnostics; +using System.Web.Http; +namespace WebAPI.Controllers +{ + /// + /// 数据治理接口 + /// + public class DataGovernanceController : ApiController + { + #region 获取集团数据治理统计分析指标 + + /// + /// 获取数据治理统计指标 + /// + /// + public Model.ResponeData GetDataGovernanceMetricData() + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = DataGovernanceService.GetDataGovernanceMetricData(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + #endregion + } +} diff --git a/SUBQHSE/WebAPI/WebAPI.csproj b/SUBQHSE/WebAPI/WebAPI.csproj index 7b0339a..753f076 100644 --- a/SUBQHSE/WebAPI/WebAPI.csproj +++ b/SUBQHSE/WebAPI/WebAPI.csproj @@ -180,6 +180,7 @@ +