diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-25.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-25.sql
new file mode 100644
index 00000000..cb4274ba
Binary files /dev/null and b/DataBase/版本日志/SGGLDB_WH_2023-10-25.sql differ
diff --git a/SGGL/BLL/API/CQMS/Performance/PerformanceService.cs b/SGGL/BLL/API/CQMS/Performance/PerformanceService.cs
new file mode 100644
index 00000000..a15c8e23
--- /dev/null
+++ b/SGGL/BLL/API/CQMS/Performance/PerformanceService.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BLL
+{
+ public class PerformanceService
+ {
+ ///
+ /// 根据年月删除
+ ///
+ ///
+ public static void Delete(string CreateDateMonth)
+ {
+ Model.SGGLDB db = Funs.DB;
+ List list = db.CQMS_Performance.Where(e => e.CreateDateMonth == CreateDateMonth).ToList();
+ if (list.Count > 0)
+ {
+ ///删除主表记录
+ db.CQMS_Performance.DeleteAllOnSubmit(list);
+
+ //删除子表1数据
+ var child1List = db.CQMS_Performance_Child1.Where(x => x.PerformanceGid == list[0].PerformanceGid).ToList();
+ if (child1List.Count > 0)
+ {
+ //删除子表2数据
+ var child2List = db.CQMS_Performance_Child2.Where(x => x.PerformanceGid == list[0].PerformanceGid).ToList();
+ if (child2List.Count > 0)
+ {
+ //删除子表3数据
+ var child3List = db.CQMS_Performance_Child3.Where(x => x.PerformanceGid == list[0].PerformanceGid).ToList();
+ if (child3List.Count > 0)
+ {
+ db.CQMS_Performance_Child3.DeleteAllOnSubmit(child3List);
+ }
+ db.CQMS_Performance_Child2.DeleteAllOnSubmit(child2List);
+ }
+ db.CQMS_Performance_Child1.DeleteAllOnSubmit(child1List);
+ }
+ db.SubmitChanges();
+ }
+ }
+
+ ///
+ /// 修改每周计划
+ ///
+ ///
+ public static void UpdateChild2(Model.CQMS_Performance_Child2 model)
+ {
+ Model.SGGLDB db = Funs.DB;
+ var NewModel = db.CQMS_Performance_Child2.FirstOrDefault(x => x.Performance_ChildGid2 == model.Performance_ChildGid2);
+ NewModel.TaskCompletContent = model.TaskCompletContent;
+ db.SubmitChanges();
+ }
+
+
+ ///
+ /// 用户下拉框
+ ///
+ /// 下拉框名字
+ /// 项目id
+ /// 是否显示请选择
+ public static void InitUserDropDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease)
+ {
+ dropName.DataValueField = "CreateMan";
+ dropName.DataTextField = "CreateManName";
+ dropName.DataSource = GetProjectUserListByProjectId(projectId);
+ dropName.DataBind();
+ if (isShowPlease)
+ {
+ Funs.FineUIPleaseSelect(dropName);
+ }
+ }
+
+ public class PerformanceUser {
+ public string CreateMan { get; set; }
+
+ public string CreateManName { get; set; }
+ }
+
+ public static List GetProjectUserListByProjectId(string projectId) {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) {
+ var list = (from x in db.CQMS_Performance
+ join y in db.Sys_User on x.CreateMan equals y.UserId
+ where x.ProjectId==projectId && x.States=="1"
+ select new PerformanceUser
+ {
+ CreateMan=x.CreateMan,
+ CreateManName=BLL.UserService.GetUserByUserId(x.CreateMan).UserName
+ }).ToList();
+ return list;
+ }
+ }
+
+ }
+}
diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj
index 81372eff..54226bc7 100644
--- a/SGGL/BLL/BLL.csproj
+++ b/SGGL/BLL/BLL.csproj
@@ -96,6 +96,7 @@
+
diff --git a/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx b/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx
new file mode 100644
index 00000000..27b41993
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx
@@ -0,0 +1,112 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MonthTargetEdit.aspx.cs" Inherits="FineUIPro.Web.CQMS.Performance.MonthTargetEdit" %>
+
+
+
+
+
+
+ 月节点目标修改页面
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx.cs b/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx.cs
new file mode 100644
index 00000000..df2540e1
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx.cs
@@ -0,0 +1,91 @@
+using BLL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace FineUIPro.Web.CQMS.Performance
+{
+ public partial class MonthTargetEdit : PageBase
+ {
+ //主键
+ public string PerformanceGid
+ {
+ get
+ {
+ return (string)ViewState["PerformanceGid"];
+ }
+ set
+ {
+ ViewState["PerformanceGid"] = value;
+ }
+ }
+
+ ///
+ /// 页面加载
+ ///
+ ///
+ ///
+
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ //主键
+ PerformanceGid = Request.Params["PerformanceGid"];
+ //根据主键加载CQMS_Performance_Child1
+ var child1List = Funs.DB.CQMS_Performance_Child1.Where(x => x.PerformanceGid == PerformanceGid).OrderBy(x => x.SortIndex).ToList();
+ if (child1List.Count > 0)
+ {
+ txtWorkArea.Text = child1List[0].WorkArea.ToString();
+ txtMonthTarget1.Text= child1List[0].MonthTarget.ToString();
+
+ txtMonthTarget2.Text = child1List[1].MonthTarget.ToString();
+ txtMonthTarget3.Text = child1List[2].MonthTarget.ToString();
+ txtMonthTarget4.Text = child1List[3].MonthTarget.ToString();
+ txtMonthTarget5.Text = child1List[4].MonthTarget.ToString();
+ txtMonthTarget6.Text = child1List[5].MonthTarget.ToString();
+ }
+ else {
+ ShowNotify("未查询到月节点目标数据,请重新生成。", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ }
+
+ ///
+ /// 确认修改
+ ///
+ ///
+ ///
+ protected void btnEdit_Click(object sender, EventArgs e) {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ //依次修改6个类别的月节点目标
+ var child2Model1 = db.CQMS_Performance_Child1.FirstOrDefault(x => x.PerformanceGid == PerformanceGid && x.SortIndex == 1);
+ child2Model1.WorkArea = txtWorkArea.Text.Trim();
+ child2Model1.MonthTarget = txtMonthTarget1.Text.Trim();
+ db.SubmitChanges();
+ var child2Model2 = db.CQMS_Performance_Child1.FirstOrDefault(x => x.PerformanceGid == PerformanceGid && x.SortIndex == 2);
+ child2Model2.MonthTarget = txtMonthTarget2.Text.Trim();
+ db.SubmitChanges();
+ var child2Model3 = db.CQMS_Performance_Child1.FirstOrDefault(x => x.PerformanceGid == PerformanceGid && x.SortIndex == 3);
+ child2Model3.MonthTarget = txtMonthTarget3.Text.Trim();
+ db.SubmitChanges();
+ var child2Model4 = db.CQMS_Performance_Child1.FirstOrDefault(x => x.PerformanceGid == PerformanceGid && x.SortIndex == 4);
+ child2Model4.MonthTarget = txtMonthTarget4.Text.Trim();
+ db.SubmitChanges();
+ var child2Model5 = db.CQMS_Performance_Child1.FirstOrDefault(x => x.PerformanceGid == PerformanceGid && x.SortIndex == 5);
+ child2Model5.MonthTarget = txtMonthTarget5.Text.Trim();
+ db.SubmitChanges();
+ var child2Model6 = db.CQMS_Performance_Child1.FirstOrDefault(x => x.PerformanceGid == PerformanceGid && x.SortIndex == 6);
+ child2Model6.MonthTarget = txtMonthTarget6.Text.Trim();
+ db.SubmitChanges();
+
+ ShowNotify("修改成功。", MessageBoxIcon.Success);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx.designer.cs
new file mode 100644
index 00000000..5133120a
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/Performance/MonthTargetEdit.aspx.designer.cs
@@ -0,0 +1,179 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace FineUIPro.Web.CQMS.Performance
+{
+
+
+ public partial class MonthTargetEdit
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// PageManager1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.PageManager PageManager1;
+
+ ///
+ /// Window1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Window Window1;
+
+ ///
+ /// SimpleForm2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm2;
+
+ ///
+ /// txtWorkArea 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtWorkArea;
+
+ ///
+ /// txtMonthTarget1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtMonthTarget1;
+
+ ///
+ /// SimpleForm3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm3;
+
+ ///
+ /// txtMonthTarget2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtMonthTarget2;
+
+ ///
+ /// SimpleForm4 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm4;
+
+ ///
+ /// txtMonthTarget3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtMonthTarget3;
+
+ ///
+ /// SimpleForm5 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm5;
+
+ ///
+ /// txtMonthTarget4 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtMonthTarget4;
+
+ ///
+ /// SimpleForm6 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm6;
+
+ ///
+ /// txtMonthTarget5 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtMonthTarget5;
+
+ ///
+ /// SimpleForm7 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm7;
+
+ ///
+ /// txtMonthTarget6 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtMonthTarget6;
+
+ ///
+ /// Toolbar4 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar4;
+
+ ///
+ /// Button2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button Button2;
+ }
+}
diff --git a/SGGL/FineUIPro.Web/CQMS/Performance/Performance.aspx b/SGGL/FineUIPro.Web/CQMS/Performance/Performance.aspx
new file mode 100644
index 00000000..a2040d55
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/Performance/Performance.aspx
@@ -0,0 +1,477 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Performance.aspx.cs" Inherits="FineUIPro.Web.CQMS.Performance.Performance" %>
+
+
+
+
+
+
+ 施工绩效管理
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/CQMS/Performance/Performance.aspx.cs b/SGGL/FineUIPro.Web/CQMS/Performance/Performance.aspx.cs
new file mode 100644
index 00000000..880cce48
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/Performance/Performance.aspx.cs
@@ -0,0 +1,1820 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Web.UI.WebControls;
+using BLL;
+using Model;
+using Newtonsoft.Json.Linq;
+using AspNet = System.Web.UI.WebControls;
+
+namespace FineUIPro.Web.CQMS.Performance
+{
+ public partial class Performance : PageBase
+ {
+ #region 定义项
+ ///
+ /// 主键
+ ///
+ public string PerformanceGid
+ {
+ get
+ {
+ return (string)ViewState["PerformanceGid"];
+ }
+ set
+ {
+ ViewState["PerformanceGid"] = value;
+ }
+ }
+
+ public string CompileDateMonth
+ {
+ get
+ {
+ return (string)ViewState["CompileDateMonth"];
+ }
+ set
+ {
+ ViewState["CompileDateMonth"] = value;
+ }
+ }
+
+ public string CreateUser
+ {
+ get
+ {
+ return (string)ViewState["CreateUser"];
+ }
+ set
+ {
+ ViewState["CreateUser"] = value;
+ }
+ }
+
+
+ #endregion
+
+
+
+
+ ///
+ /// 页面加载
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ CreateUser = CurrUser.UserId;
+ BindGrid();
+
+ OutputSummaryData();
+ }
+ }
+
+ private void OutputSummaryData()
+ {
+ decimal EvaScore = 0;
+ EvaScore = Funs.DB.CQMS_Performance_Child1.Where(x => x.PerformanceGid == PerformanceGid).Sum(x => x.EvaScore) ?? 0;
+
+ JObject summary = new JObject();
+ //summary.Add("Major", "全部合计");
+ summary.Add("EvaScore", EvaScore.ToString("F2"));
+
+
+ Grid1.SummaryData = summary;
+
+ }
+
+ ///
+ /// 加载表头
+ ///
+ protected void Page_Init(object sender, EventArgs e)
+ {
+ CreateUser = CurrUser.UserId;
+ drpCompileDateMonth.Text = DateTime.Now.ToString();
+ if (string.IsNullOrEmpty(CompileDateMonth))
+ {
+ CompileDateMonth = Request.QueryString["CompileDateMonth"];
+ if (!string.IsNullOrEmpty(CompileDateMonth))
+ {
+ drpCompileDateMonth.Text = CompileDateMonth;
+ }
+ }
+ else {
+ drpCompileDateMonth.Text = CompileDateMonth;
+ }
+
+
+ InitGrid();
+
+ }
+
+ #region 加载表头
+ string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
+
+ private void InitGrid()
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var NowDate = Convert.ToDateTime(drpCompileDateMonth.Text.Trim());
+ var Month = 1;
+ if (NowDate.Month != 12)
+ {
+ Month = NowDate.Month + 1;
+ }
+
+ //获取配置
+ var modelConfig = Funs.DB.CQMS_Performance_SetUp.FirstOrDefault(x => x.CreateYear == NowDate.Year.ToString() && x.SortIndex == Month);
+ if (modelConfig != null)
+ {
+ int child3Index = 1;
+ //先加载周,再加载周里面的天数
+ for (int i = 1; i <= modelConfig.SetUpWeek; i++)
+ {
+ #region 第?周任务安排、工程量、人材机资源需求计划
+ BoundField bf = new BoundField();
+ bf.Width = Unit.Pixel(150);
+ bf.DataField = "TaskContent" + i.ToString();
+ bf.ColumnID = "TaskContent" + i.ToString();
+ bf.HeaderText = "第" + i.ToString() + "周施工工作任务安排";
+ bf.TextAlign = TextAlign.Center;
+ Grid1.Columns.Add(bf);
+
+ bf = new BoundField();
+ bf.Width = Unit.Pixel(100);
+ bf.DataField = "ProjectQuantity" + i.ToString();
+ bf.ColumnID = "ProjectQuantity" + i.ToString();
+ bf.HeaderText = "工程量";
+ Grid1.Columns.Add(bf);
+
+ bf = new BoundField();
+ bf.Width = Unit.Pixel(150);
+ bf.DataField = "DemandPlan" + i.ToString();
+ bf.ColumnID = "DemandPlan" + i.ToString();
+ bf.HeaderText = "人材机资源需求计划";
+ Grid1.Columns.Add(bf);
+ #endregion
+
+ var month = Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Year + "-" + Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Month;
+ if (Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Month.ToString().Length == 1)
+ {
+ month = Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Year + "-0" + Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Month;
+ }
+ //1.先获取主表的基础数据
+ var modelCQMS_Performance = db.CQMS_Performance.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId
+ && x.CreateDateMonth == month && x.CreateMan == CreateUser);
+ if (modelCQMS_Performance != null)
+ {
+ PerformanceGid = modelCQMS_Performance.PerformanceGid;
+ }
+ else {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+
+
+ var Child2Model = db.CQMS_Performance_Child2.FirstOrDefault(x => x.NowWeek == i && x.CreateMan == CreateUser && x.PerformanceGid== PerformanceGid);
+ if (Child2Model==null)
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ //获取当前周的gid
+ var Child2Gid = Child2Model.Performance_ChildGid2;
+ //根据周gid获取天数
+ var listChild3 = db.CQMS_Performance_Child3.Where(x => x.Performance_ChildGid2 == Child2Gid
+ && x.CreateMan==CreateUser).OrderBy(x => x.CurrentDate).ToList();
+
+ if (listChild3.Count==0)
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+
+ foreach (var item in listChild3)
+ {
+ var Cdate = Convert.ToDateTime(item.CurrentDate);
+ string week = Day[Convert.ToInt32(Cdate.DayOfWeek.ToString("d"))].ToString();
+ //头部
+ GroupField p = new GroupField();
+ p.Width = Unit.Pixel(200);
+ p.HeaderText = week + "(" + Cdate.Month + "月" + Cdate.Day + "日)";
+ p.TextAlign = TextAlign.Left;
+
+ BoundField gzjh = new BoundField();
+ gzjh.Width = Unit.Pixel(200);
+ gzjh.HeaderText = "本日工作计划";
+ gzjh.DataField = "WorkPlan" + child3Index.ToString();
+ gzjh.ColumnID = "WorkPlan" + child3Index.ToString();
+ gzjh.TextAlign = TextAlign.Center;
+
+ BoundField wcqk = new BoundField();
+ wcqk.Width = Unit.Pixel(200);
+ wcqk.HeaderText = "本日完成情况";
+ wcqk.DataField = "CompletStatus" + child3Index.ToString();
+ wcqk.ColumnID = "CompletStatus" + child3Index.ToString();
+ p.Columns.Add(gzjh);
+ p.Columns.Add(wcqk);
+
+ Grid1.Columns.Add(p);
+ child3Index += 1;
+ }
+ bf = new BoundField();
+ bf.Width = Unit.Pixel(150);
+ bf.DataField = "TaskCompletContent" + i.ToString();
+ bf.ColumnID = "TaskCompletContent" + i.ToString();
+ bf.HeaderText = "本周工作任务完成情况";
+ Grid1.Columns.Add(bf);
+ }
+ }
+ else {
+ ShowNotify("当前日期未设置规则,请前往施工绩效设置页面进行操作。", MessageBoxIcon.Warning);
+ PageContext.RegisterStartupScript("CloseRefresh()");
+ return;
+ }
+
+ }
+
+ }
+ #endregion
+
+ #region 合并单元格定义项
+ ///
+ /// 第一行的gid 为了合并单元格用
+ ///
+ public string OneGid
+ {
+ get
+ {
+ return (string)ViewState["OneGid"];
+ }
+ set
+ {
+ ViewState["OneGid"] = value;
+ }
+ }
+
+ public string Gid2
+ {
+ get
+ {
+ return (string)ViewState["Gid2"];
+ }
+ set
+ {
+ ViewState["Gid2"] = value;
+ }
+ }
+
+ public string Gid3
+ {
+ get
+ {
+ return (string)ViewState["Gid3"];
+ }
+ set
+ {
+ ViewState["Gid3"] = value;
+ }
+ }
+
+ public string Gid4
+ {
+ get
+ {
+ return (string)ViewState["Gid4"];
+ }
+ set
+ {
+ ViewState["Gid4"] = value;
+ }
+ }
+
+ public string Gid5
+ {
+ get
+ {
+ return (string)ViewState["Gid5"];
+ }
+ set
+ {
+ ViewState["Gid5"] = value;
+ }
+ }
+
+ public string Gid6
+ {
+ get
+ {
+ return (string)ViewState["Gid6"];
+ }
+ set
+ {
+ ViewState["Gid6"] = value;
+ }
+ }
+
+ public int child2Count
+ {
+ get
+ {
+ return Convert.ToInt32(ViewState["child2Count"]);
+ }
+ set
+ {
+ ViewState["child2Count"] = value;
+ }
+ }
+ #endregion
+
+ #region 加载表格数据
+ ///
+ /// 加载表格的实体类
+ ///
+ public class GridModels {
+ public string Performance_ChildGid1 { get; set; }
+ public string PerformanceGid { get; set; }
+ public string PType { get; set; }
+
+ public decimal? EvaScore { get; set; }
+ public string Itemize { get; set; }
+ public string WorkArea { get; set; }
+ public string MonthTarget { get; set; }
+
+ public int? SortIndex { get; set; }
+
+ #region 任务安排 下标9;工程量 14;材机资源需求计划 19
+ public string Performance_ChildGid2 { get; set; }
+
+ //任务安排 下标9
+ public string TaskContent1 { get; set; }
+ public string TaskContent2 { get; set; }
+ public string TaskContent3 { get; set; }
+ public string TaskContent4 { get; set; }
+ public string TaskContent5 { get; set; }
+
+ //工程量 14
+ public string ProjectQuantity1 { get; set; }
+ public string ProjectQuantity2 { get; set; }
+ public string ProjectQuantity3 { get; set; }
+ public string ProjectQuantity4 { get; set; }
+ public string ProjectQuantity5 { get; set; }
+
+ //材机资源需求计划 19
+ public string DemandPlan1 { get; set; }
+ public string DemandPlan2 { get; set; }
+ public string DemandPlan3 { get; set; }
+ public string DemandPlan4 { get; set; }
+ public string DemandPlan5 { get; set; }
+
+ //本周工作任务完成情况 24
+ public string TaskCompletContent1 { get; set; }
+ public string TaskCompletContent2 { get; set; }
+ public string TaskCompletContent3 { get; set; }
+ public string TaskCompletContent4 { get; set; }
+ public string TaskCompletContent5 { get; set; }
+ #endregion
+
+ #region 每天任务完成情况 下标29
+ public string WorkPlan1 { get; set; }
+ public string WorkPlan2 { get; set; }
+ public string WorkPlan3 { get; set; }
+ public string WorkPlan4 { get; set; }
+ public string WorkPlan5 { get; set; }
+ public string WorkPlan6 { get; set; }
+ public string WorkPlan7 { get; set; }
+ public string WorkPlan8 { get; set; }
+ public string WorkPlan9 { get; set; }
+ public string WorkPlan10 { get; set; }
+ public string WorkPlan11 { get; set; }
+ public string WorkPlan12 { get; set; }
+ public string WorkPlan13 { get; set; }
+ public string WorkPlan14 { get; set; }
+ public string WorkPlan15 { get; set; }
+ public string WorkPlan16 { get; set; }
+ public string WorkPlan17 { get; set; }
+ public string WorkPlan18 { get; set; }
+ public string WorkPlan19 { get; set; }
+ public string WorkPlan20 { get; set; }
+ public string WorkPlan21 { get; set; }
+ public string WorkPlan22 { get; set; }
+ public string WorkPlan23 { get; set; }
+ public string WorkPlan24 { get; set; }
+ public string WorkPlan25 { get; set; }
+ public string WorkPlan26 { get; set; }
+ public string WorkPlan27 { get; set; }
+ public string WorkPlan28 { get; set; }
+ public string WorkPlan29 { get; set; }
+ public string WorkPlan30 { get; set; }
+ public string WorkPlan31 { get; set; }
+ public string WorkPlan32 { get; set; }
+ public string WorkPlan33 { get; set; }
+ #endregion
+
+ #region 本日完成情况 下标 62
+ public string CompletStatus1 { get; set; }
+ public string CompletStatus2 { get; set; }
+ public string CompletStatus3 { get; set; }
+ public string CompletStatus4 { get; set; }
+ public string CompletStatus5 { get; set; }
+ public string CompletStatus6 { get; set; }
+ public string CompletStatus7 { get; set; }
+ public string CompletStatus8 { get; set; }
+ public string CompletStatus9 { get; set; }
+ public string CompletStatus10 { get; set; }
+ public string CompletStatus11 { get; set; }
+ public string CompletStatus12 { get; set; }
+ public string CompletStatus13 { get; set; }
+ public string CompletStatus14 { get; set; }
+ public string CompletStatus15 { get; set; }
+ public string CompletStatus16 { get; set; }
+ public string CompletStatus17 { get; set; }
+ public string CompletStatus18 { get; set; }
+ public string CompletStatus19 { get; set; }
+ public string CompletStatus20 { get; set; }
+ public string CompletStatus21 { get; set; }
+ public string CompletStatus22 { get; set; }
+ public string CompletStatus23 { get; set; }
+ public string CompletStatus24 { get; set; }
+ public string CompletStatus25 { get; set; }
+ public string CompletStatus26 { get; set; }
+ public string CompletStatus27 { get; set; }
+ public string CompletStatus28 { get; set; }
+ public string CompletStatus29 { get; set; }
+ public string CompletStatus30 { get; set; }
+ public string CompletStatus31 { get; set; }
+ public string CompletStatus32 { get; set; }
+ public string CompletStatus33 { get; set; }
+ #endregion
+
+ #region 定义索引
+ //定义索引器,name 字段的索引值为 0 ,password 字段的索引值为 1
+ public string this[int index]
+ {
+ #region get
+ get
+ {
+ if (index == 0)
+ {
+ return WorkPlan1;
+ }
+ else if (index == 1)
+ {
+ return WorkPlan2;
+ }
+ else if (index == 2)
+ {
+ return WorkPlan3;
+ }
+ else if (index == 3)
+ {
+ return WorkPlan4;
+ }
+ else if (index == 4)
+ {
+ return WorkPlan5;
+ }
+ else if (index == 5)
+ {
+ return WorkPlan6;
+ }
+ else if (index == 6)
+ {
+ return WorkPlan7;
+ }
+ else if (index == 7)
+ {
+ return WorkPlan8;
+ }
+ else if (index == 8)
+ {
+ return WorkPlan9;
+ }
+ else if (index == 9)
+ {
+ return WorkPlan10;
+ }
+ else if (index == 10)
+ {
+ return WorkPlan11;
+ }
+ else if (index == 11)
+ {
+ return WorkPlan12;
+ }
+ else if (index == 12)
+ {
+ return WorkPlan13;
+ }
+ else if (index == 13)
+ {
+ return WorkPlan14;
+ }
+ else if (index == 14)
+ {
+ return WorkPlan15;
+ }
+ else if (index == 15)
+ {
+ return WorkPlan16;
+ }
+ else if (index == 16)
+ {
+ return WorkPlan17;
+ }
+ else if (index == 17)
+ {
+ return WorkPlan18;
+ }
+ else if (index == 18)
+ {
+ return WorkPlan19;
+ }
+ else if (index == 19)
+ {
+ return WorkPlan20;
+ }
+ else if (index == 20)
+ {
+ return WorkPlan21;
+ }
+ else if (index == 21)
+ {
+ return WorkPlan22;
+ }
+ else if (index == 22)
+ {
+ return WorkPlan23;
+ }
+ else if (index == 23)
+ {
+ return WorkPlan24;
+ }
+ else if (index == 24)
+ {
+ return WorkPlan25;
+ }
+ else if (index == 25)
+ {
+ return WorkPlan26;
+ }
+ else if (index == 26)
+ {
+ return WorkPlan27;
+ }
+ else if (index == 27)
+ {
+ return WorkPlan28;
+ }
+ else if (index == 28)
+ {
+ return WorkPlan29;
+ }
+ else if (index == 29)
+ {
+ return WorkPlan30;
+ }
+ else if (index == 30)
+ {
+ return WorkPlan31;
+ }
+ else if (index == 31)
+ {
+ return WorkPlan32;
+ }
+ else if (index == 32)
+ {
+ return CompletStatus1;
+ }
+ else if (index == 33)
+ {
+ return CompletStatus2;
+ }
+ else if (index == 34)
+ {
+ return CompletStatus3;
+ }
+ else if (index == 35)
+ {
+ return CompletStatus4;
+ }
+ else if (index == 36)
+ {
+ return CompletStatus5;
+ }
+ else if (index == 37)
+ {
+ return CompletStatus6;
+ }
+ else if (index == 38)
+ {
+ return CompletStatus7;
+ }
+ else if (index == 39)
+ {
+ return CompletStatus8;
+ }
+ else if (index == 40)
+ {
+ return CompletStatus9;
+ }
+ else if (index == 41)
+ {
+ return CompletStatus10;
+ }
+ else if (index == 42)
+ {
+ return CompletStatus11;
+ }
+ else if (index == 43)
+ {
+ return CompletStatus12;
+ }
+ else if (index == 44)
+ {
+ return CompletStatus13;
+ }
+ else if (index == 45)
+ {
+ return CompletStatus14;
+ }
+ else if (index == 46)
+ {
+ return CompletStatus15;
+ }
+ else if (index == 47)
+ {
+ return CompletStatus16;
+ }
+ else if (index == 48)
+ {
+ return CompletStatus17;
+ }
+ else if (index == 49)
+ {
+ return CompletStatus18;
+ }
+ else if (index == 50)
+ {
+ return CompletStatus19;
+ }
+ else if (index == 51)
+ {
+ return CompletStatus20;
+ }
+ else if (index == 52)
+ {
+ return CompletStatus21;
+ }
+ else if (index == 53)
+ {
+ return CompletStatus22;
+ }
+ else if (index == 54)
+ {
+ return CompletStatus23;
+ }
+ else if (index == 55)
+ {
+ return CompletStatus24;
+ }
+ else if (index == 56)
+ {
+ return CompletStatus25;
+ }
+ else if (index == 57)
+ {
+ return CompletStatus26;
+ }
+ else if (index == 58)
+ {
+ return CompletStatus27;
+ }
+ else if (index == 59)
+ {
+ return CompletStatus28;
+ }
+ else if (index == 60)
+ {
+ return CompletStatus29;
+ }
+ else if (index == 61)
+ {
+ return CompletStatus30;
+ }
+ else if (index == 62)
+ {
+ return CompletStatus31;
+ }
+ else if (index == 63)
+ {
+ return CompletStatus32;
+ }
+
+ else { return null; }
+ #endregion
+
+ }
+ set
+ {
+ if (index == 0)
+ {
+ WorkPlan1 = value;
+ }
+ else if (index == 1)
+ {
+ WorkPlan2 = value;
+ }
+ else if (index == 2)
+ {
+ WorkPlan3 = value;
+ }
+ else if (index == 3)
+ {
+ WorkPlan4 = value;
+ }
+ else if (index == 4)
+ {
+ WorkPlan5 = value;
+ }
+ else if (index == 5)
+ {
+ WorkPlan6 = value;
+ }
+ else if (index == 6)
+ {
+ WorkPlan7 = value;
+ }
+ else if (index == 7)
+ {
+ WorkPlan8 = value;
+ }
+ else if (index == 8)
+ {
+ WorkPlan9 = value;
+ }
+ else if (index == 9)
+ {
+ WorkPlan10 = value;
+ }
+ else if (index == 10)
+ {
+ WorkPlan11 = value;
+ }
+ else if (index == 11)
+ {
+ WorkPlan12 = value;
+ }
+ else if (index == 12)
+ {
+ WorkPlan13 = value;
+ }
+ else if (index == 13)
+ {
+ WorkPlan14 = value;
+ }
+ else if (index == 14)
+ {
+ WorkPlan15 = value;
+ }
+ else if (index == 15)
+ {
+ WorkPlan16 = value;
+ }
+ else if (index == 16)
+ {
+ WorkPlan17 = value;
+ }
+ else if (index == 17)
+ {
+ WorkPlan18 = value;
+ }
+ else if (index == 18)
+ {
+ WorkPlan19 = value;
+ }
+ else if (index == 19)
+ {
+ WorkPlan20 = value;
+ }
+ else if (index == 20)
+ {
+ WorkPlan21 = value;
+ }
+ else if (index == 21)
+ {
+ WorkPlan22 = value;
+ }
+ else if (index == 22)
+ {
+ WorkPlan23 = value;
+ }
+ else if (index == 23)
+ {
+ WorkPlan24 = value;
+ }
+ else if (index == 24)
+ {
+ WorkPlan25 = value;
+ }
+ else if (index == 25)
+ {
+ WorkPlan26 = value;
+ }
+ else if (index == 26)
+ {
+ WorkPlan27 = value;
+ }
+ else if (index == 27)
+ {
+ WorkPlan28 = value;
+ }
+ else if (index == 28)
+ {
+ WorkPlan29 = value;
+ }
+ else if (index == 29)
+ {
+ WorkPlan30 = value;
+ }
+ else if (index == 30)
+ {
+ WorkPlan31 = value;
+ }
+ else if (index == 31)
+ {
+ WorkPlan32 = value;
+ }
+ else if (index == 32)
+ {
+ CompletStatus1 = value;
+ }
+ else if (index == 33)
+ {
+ CompletStatus2 = value;
+ }
+ else if (index == 34)
+ {
+ CompletStatus3 = value;
+ }
+ else if (index == 35)
+ {
+ CompletStatus4 = value;
+ }
+ else if (index == 36)
+ {
+ CompletStatus5 = value;
+ }
+ else if (index == 37)
+ {
+ CompletStatus6 = value;
+ }
+ else if (index == 38)
+ {
+ CompletStatus7 = value;
+ }
+ else if (index == 39)
+ {
+ CompletStatus8 = value;
+ }
+ else if (index == 40)
+ {
+ CompletStatus9 = value;
+ }
+ else if (index == 41)
+ {
+ CompletStatus10 = value;
+ }
+ else if (index == 42)
+ {
+ CompletStatus11 = value;
+ }
+ else if (index == 43)
+ {
+ CompletStatus12 = value;
+ }
+ else if (index == 44)
+ {
+ CompletStatus13 = value;
+ }
+ else if (index == 45)
+ {
+ CompletStatus14 = value;
+ }
+ else if (index == 46)
+ {
+ CompletStatus15 = value;
+ }
+ else if (index == 47)
+ {
+ CompletStatus16 = value;
+ }
+ else if (index == 48)
+ {
+ CompletStatus17 = value;
+ }
+ else if (index == 49)
+ {
+ CompletStatus18 = value;
+ }
+ else if (index == 50)
+ {
+ CompletStatus19 = value;
+ }
+ else if (index == 51)
+ {
+ CompletStatus20 = value;
+ }
+ else if (index == 52)
+ {
+ CompletStatus21 = value;
+ }
+ else if (index == 53)
+ {
+ CompletStatus22 = value;
+ }
+ else if (index == 54)
+ {
+ CompletStatus23 = value;
+ }
+ else if (index == 55)
+ {
+ CompletStatus24 = value;
+ }
+ else if (index == 56)
+ {
+ CompletStatus25 = value;
+ }
+ else if (index == 57)
+ {
+ CompletStatus26 = value;
+ }
+ else if (index == 58)
+ {
+ CompletStatus27 = value;
+ }
+ else if (index == 59)
+ {
+ CompletStatus28 = value;
+ }
+ else if (index == 60)
+ {
+ CompletStatus29 = value;
+ }
+ else if (index == 61)
+ {
+ CompletStatus30 = value;
+ }
+ else if (index == 62)
+ {
+ CompletStatus31 = value;
+ }
+ else if (index == 63)
+ {
+ CompletStatus32 = value;
+ }
+
+ }
+ }
+ #endregion
+
+ }
+
+ private void BindGrid()
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var month = Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Year + "-" + Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Month;
+ if (Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Month.ToString().Length==1)
+ {
+ month = Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Year + "-0" + Convert.ToDateTime(drpCompileDateMonth.Text.Trim()).Month;
+ }
+ //1.先获取主表的基础数据
+ var modelCQMS_Performance = db.CQMS_Performance.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId
+ && x.CreateDateMonth == month && x.CreateMan== CreateUser);
+ if (modelCQMS_Performance != null)
+ {
+
+ Grid1.Title= "五环责任人:" + modelCQMS_Performance.HeadUserid + ";本月完成专业产值:" +
+ modelCQMS_Performance.ProOutputValue + "万元;分包商负责人:" +
+ modelCQMS_Performance.SubUserids + ";分包工程师、班组长:" + modelCQMS_Performance.SubpackageUserids;
+ PerformanceGid = modelCQMS_Performance.PerformanceGid;
+ //根据主键查询CQMS_Performance_Child1
+ var listChild1 = db.CQMS_Performance_Child1.Where(x => x.PerformanceGid == PerformanceGid).OrderBy(x => x.SortIndex)
+ .Select(x=> new GridModels {
+ Performance_ChildGid1=x.Performance_ChildGid1,
+ PerformanceGid=x.PerformanceGid,
+ PType=x.PType,
+ EvaScore=x.EvaScore,
+ Itemize=x.Itemize,
+ WorkArea=x.WorkArea,
+ MonthTarget=x.MonthTarget,
+ SortIndex=x.SortIndex
+ }).ToList();
+ #region 合并单元格参数
+ //获取各行的gid
+ OneGid = listChild1[0].Performance_ChildGid1;
+ Gid2 = listChild1[1].Performance_ChildGid1;
+ Gid3 = listChild1[2].Performance_ChildGid1;
+ Gid4 = listChild1[3].Performance_ChildGid1;
+ Gid5 = listChild1[4].Performance_ChildGid1;
+ Gid6 = listChild1[5].Performance_ChildGid1;
+ //获取CQMS_Performance_Child2 表中的数据
+ int child2Count = db.CQMS_Performance_Child2.Where(x => x.NowWeek == 1 && x.PerformanceGid == PerformanceGid).ToList().Count();
+ #endregion
+
+
+ //加载各周任务、工程量、人材机、完成情况
+
+ //根据gid获取CQMS_Performance_Child2 施工进度管理的子表数据,大于一条,就要多增加数据到List中
+ var ChildSgjdCount = db.CQMS_Performance_Child2.Where(x => x.NowWeek == 1 && x.PerformanceGid == PerformanceGid
+ &&x.Performance_ChildGid1== OneGid).ToList().Count();
+ var addList = db.CQMS_Performance_Child1.Where(x => x.PerformanceGid == PerformanceGid && x.SortIndex==1)
+ .Select(x => new GridModels
+ {
+ Performance_ChildGid1 = x.Performance_ChildGid1,
+ PerformanceGid = x.PerformanceGid,
+ PType = x.PType,
+ EvaScore = x.EvaScore,
+ Itemize = x.Itemize,
+ WorkArea = x.WorkArea,
+ MonthTarget = x.MonthTarget,
+ SortIndex = x.SortIndex
+ }).ToList();
+ if (ChildSgjdCount == 2)
+ {
+ addList[0].Performance_ChildGid1 = addList[0].Performance_ChildGid1 + "one";
+ listChild1.InsertRange(1, addList);
+ }
+ else if (ChildSgjdCount == 3)
+ {
+ var pgid = addList[0].Performance_ChildGid1;
+ addList[0].Performance_ChildGid1 = pgid + "one";
+ listChild1.InsertRange(1, addList);
+ addList[0].Performance_ChildGid1 = pgid + "two";
+ listChild1.InsertRange(2, addList);
+ }
+
+ //循环list给每周任务、工程量、资源需求计划、本周工作任务完成情况 ,每日工作计划、完成情况赋值
+ //获取周数
+ var NowDate = Convert.ToDateTime(drpCompileDateMonth.Text.Trim());
+ var Month = 1;
+ if (NowDate.Month != 12)
+ {
+ Month = NowDate.Month + 1;
+ }
+
+ var modelConfig = Funs.DB.CQMS_Performance_SetUp.FirstOrDefault(x => x.CreateYear == NowDate.Year.ToString() && x.SortIndex == Month);
+
+ for (int i = 0; i < listChild1.Count; i++)
+ {
+ var CompletStatusIndex = 32;
+ var zIndex = 0;
+ //循环周数-
+ for (int y = 0; y < modelConfig.SetUpWeek; y++)
+ {
+ var chilGid = listChild1[i].Performance_ChildGid1;
+ if (chilGid.IndexOf("one")>-1|| chilGid.IndexOf("two") > -1)
+ {
+ chilGid = chilGid.Substring(0, chilGid.Length - 3);
+ }
+
+ //根据周数获取数据
+ var Child2ListNew = db.CQMS_Performance_Child2.FirstOrDefault(x => x.PerformanceGid == listChild1[i].PerformanceGid
+ && x.Performance_ChildGid1 == chilGid && x.NowWeek == (y + 1) && x.SortIndex == (i + 1));
+ //将list中的周数数据插入
+ if (Child2ListNew==null)
+ {
+ ShowNotify("数据有误。请重新生成", MessageBoxIcon.Warning);
+ return;
+ }
+ switch (y)
+ {
+ case 0:
+ listChild1[i].TaskContent1 = Child2ListNew.TaskContent;
+ listChild1[i].ProjectQuantity1 = Child2ListNew.ProjectQuantity;
+ listChild1[i].DemandPlan1 = Child2ListNew.DemandPlan;
+ listChild1[i].TaskCompletContent1= Child2ListNew.TaskCompletContent;
+ break;
+ case 1:
+ listChild1[i].TaskContent2 = Child2ListNew.TaskContent;
+ listChild1[i].ProjectQuantity2 = Child2ListNew.ProjectQuantity;
+ listChild1[i].DemandPlan2 = Child2ListNew.DemandPlan;
+ listChild1[i].TaskCompletContent2 = Child2ListNew.TaskCompletContent;
+ break;
+ case 2:
+ listChild1[i].TaskContent3 = Child2ListNew.TaskContent;
+ listChild1[i].ProjectQuantity3 = Child2ListNew.ProjectQuantity;
+ listChild1[i].DemandPlan3 = Child2ListNew.DemandPlan;
+ listChild1[i].TaskCompletContent3 = Child2ListNew.TaskCompletContent;
+ break;
+ case 3:
+ listChild1[i].TaskContent4 = Child2ListNew.TaskContent;
+ listChild1[i].ProjectQuantity4 = Child2ListNew.ProjectQuantity;
+ listChild1[i].DemandPlan4 = Child2ListNew.DemandPlan;
+ listChild1[i].TaskCompletContent4 = Child2ListNew.TaskCompletContent;
+ break;
+ case 4:
+ listChild1[i].TaskContent5 = Child2ListNew.TaskContent;
+ listChild1[i].ProjectQuantity5 = Child2ListNew.ProjectQuantity;
+ listChild1[i].DemandPlan5 = Child2ListNew.DemandPlan;
+ listChild1[i].TaskCompletContent5 = Child2ListNew.TaskCompletContent;
+ break;
+ }
+
+ #region 根据周id获取日
+ var Child3ListNew = db.CQMS_Performance_Child3.Where(x => x.Performance_ChildGid2 == Child2ListNew.Performance_ChildGid2)
+ .OrderBy(x => x.CurrentDate).ToList();
+
+ for (var z = 0; z < Child3ListNew.Count; z++)
+ {
+ listChild1[i][zIndex] = Child3ListNew[z].WorkPlan;
+ listChild1[i][CompletStatusIndex] = Child3ListNew[z].CompletStatus;
+ CompletStatusIndex += 1;
+ zIndex += 1;
+
+ }
+ #endregion
+ }
+ }
+
+
+ //重新给list设置 序号
+ int sindex = 1;
+ listChild1.ForEach(x =>
+ {
+ x.SortIndex = sindex;
+ sindex += 1;
+ });
+ var table = ToDataTable(listChild1);
+ Grid1.DataSource = table;
+ Grid1.DataBind();
+
+
+ #region 合并单元格
+
+
+
+ var DateIffs = DateDiff(Convert.ToDateTime(modelConfig.SetUpStartDate), Convert.ToDateTime(modelConfig.SetUpEndDate))+1;
+ if (ChildSgjdCount > 1)
+ {
+ //合并单元格方法
+ PageContext.RegisterStartupScript("onGridDataLoad('" + OneGid + "','" + child2Count + "','" + Gid2 + "','"
+ + Gid3 + "','" + Gid4 + "','" + Gid5 + "','" + Gid6 + "','"+ ChildSgjdCount + "','"+ modelConfig.SetUpWeek + "',"+ DateIffs + ")");
+ }
+ else {
+ //合并单元格方法
+ PageContext.RegisterStartupScript("onGridDataLoad('" + OneGid + "','" + child2Count + "','" + Gid2 + "','"
+ + Gid3 + "','" + Gid4 + "','" + Gid5 + "','" + Gid6 + "',0,'" + modelConfig.SetUpWeek + "'," + DateIffs + ")");
+ }
+ #endregion
+
+ }
+ else
+ {
+ if (string.IsNullOrEmpty(CurrUser.LoginProjectId))
+ {
+ ShowNotify("未查询到当前项目,请刷新页面重试。", MessageBoxIcon.Warning);
+
+ }
+ else
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ }
+ }
+ }
+ }
+
+ ///
+ /// 计算日期之间的天数
+ ///
+ ///
+ ///
+ ///
+ private int DateDiff(DateTime dateStart, DateTime dateEnd)
+
+ {
+
+ DateTime start = Convert.ToDateTime(dateStart.ToShortDateString());
+
+ DateTime end = Convert.ToDateTime(dateEnd.ToShortDateString());
+
+ TimeSpan sp = end.Subtract(start);
+
+ return sp.Days;
+ }
+ #endregion
+ ///
+ /// 查询绑定数据
+ ///
+ ///
+ ///
+ protected void btnBindGrid(object sender, EventArgs e)
+ {
+ var Rurl = Request.Url.ToString();
+ if (Rurl.IndexOf("?")>-1)
+ {
+ Rurl = Rurl.Substring(0, Rurl.IndexOf("?"));
+ }
+ //重定向当前页面传值
+ Response.Redirect(Rurl + "?CompileDateMonth="+ drpCompileDateMonth.Text);
+ //BindGrid();
+ }
+
+ ///
+ /// 判断生成操作
+ ///
+ protected void btnNew_Juge(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(this.drpCompileDateMonth.Text.Trim()))
+ {
+ ShowNotify("日期不能为空。", MessageBoxIcon.Warning);
+ PageContext.RegisterStartupScript("CloseRefresh()");
+ return;
+ }
+ var dates = Convert.ToDateTime(drpCompileDateMonth.Text.Trim());
+ var Month = 1;
+ if (dates.Month != 12)
+ {
+ Month = dates.Month + 1;
+ }
+
+ //按照日期查询是否有设置
+ var modelConfig = Funs.DB.CQMS_Performance_SetUp.FirstOrDefault(x => x.CreateYear == dates.Year.ToString() && x.SortIndex == Month);
+ if (modelConfig == null)
+ {
+ ShowNotify("当前日期未设置规则,请前往施工绩效设置页面进行操作。", MessageBoxIcon.Warning);
+ PageContext.RegisterStartupScript("CloseRefresh()");
+ return;
+ }
+ //根据日期查询是否有数据
+ var modelSum = Funs.DB.CQMS_Performance.Where(x => x.CreateDateMonth == drpCompileDateMonth.Text.Trim() && x.ProjectId == CurrUser.LoginProjectId&&x.CreateMan== CreateUser).FirstOrDefault();
+ //查到数据,二次确认
+ if (modelSum != null)
+ {
+ PageContext.RegisterStartupScript(Confirm.GetShowReference("该日期已生成数据,是否确认重新生成?", String.Empty, MessageBoxIcon.Question,
+ PageManager1.GetCustomEventReference("Confirmgd_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
+ //PageContext.RegisterStartupScript("CloseRefresh()");
+ }
+ else
+ {
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PerformanceEdit.aspx?CreateDateMonth=" + drpCompileDateMonth.Text.Trim(), ""),
+ "新增", Unit.Parse("1000px"), Unit.Parse("800px")));
+ }
+
+ }
+
+ ///
+ /// 确认按钮
+ ///
+ ///
+ ///
+ protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
+ {
+ if (e.EventArgument == "Confirmgd_OK")
+ {
+ // 根据日期查询是否有数据
+ var modelSum = Funs.DB.CQMS_Performance.Where(x => x.CreateDateMonth == drpCompileDateMonth.Text.Trim()).FirstOrDefault();
+ if (modelSum != null)
+ {
+ //删除数据
+ PerformanceService.Delete(modelSum.CreateDateMonth);
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PerformanceEdit.aspx?CreateDateMonth="
+ + drpCompileDateMonth.Text.Trim(), ""), "新增", Unit.Parse("1000px"), Unit.Parse("800px")));
+ }
+
+ //BindGrid();
+ //btnNew_Click();
+ }
+ }
+
+ #region list转换datatable
+ ///
+ /// Convert a List{T} to a DataTable.
+ ///
+ private DataTable ToDataTable(List items)
+ {
+ var tb = new DataTable(typeof(T).Name);
+
+ PropertyInfo[] props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
+
+ foreach (PropertyInfo prop in props)
+ {
+ Type t = GetCoreType(prop.PropertyType);
+ tb.Columns.Add(prop.Name, t);
+ }
+
+ foreach (T item in items)
+ {
+ var values = new object[props.Length];
+
+ for (int i = 0; i < props.Length-1; i++)
+ {
+ values[i] = props[i].GetValue(item, null);
+ }
+
+ tb.Rows.Add(values);
+ }
+
+ return tb;
+ }
+
+ ///
+ /// Determine of specified type is nullable
+ ///
+ public static bool IsNullable(Type t)
+ {
+ return !t.IsValueType || (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>));
+ }
+
+ ///
+ /// Return underlying type if type is Nullable otherwise return the type
+ ///
+ public static Type GetCoreType(Type t)
+ {
+ if (t != null && IsNullable(t))
+ {
+ if (!t.IsValueType)
+ {
+ return t;
+ }
+ else
+ {
+ return Nullable.GetUnderlyingType(t);
+ }
+ }
+ else
+ {
+ return t;
+ }
+ }
+ #endregion
+
+ protected void Window1_Close(object sender, EventArgs e)
+ {
+ BindGrid();
+ }
+
+ ///
+ /// 修改月节点目标
+ ///
+ ///
+ ///
+
+ protected void btnMonthTarget(object sender, EventArgs e) {
+ if (string.IsNullOrEmpty(PerformanceGid))
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ else {
+ //查询状态是否是0 不是0的不允许修改
+ var model = Funs.DB.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid);
+ if (model == null)
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ else {
+ if (CurrUser.UserId != Const.sysglyId && CurrUser.UserId != Const.hfnbdId)
+ {
+ if (model.States != "0")
+ {
+ ShowNotify("当前数据已经提交,不允许修改。", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ }
+
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MonthTargetEdit.aspx?PerformanceGid=" + PerformanceGid, ""),
+ "修改月节点目标", Unit.Parse("1000px"), Unit.Parse("800px")));
+ }
+ }
+
+ ///
+ /// 修改各周工作任务
+ ///
+ ///
+ ///
+ protected void btnTaskContent(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(PerformanceGid))
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ else
+ {
+ //查询状态是否是0 不是0的不允许修改
+ var model = Funs.DB.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid);
+ if (model == null)
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ else
+ {
+ if (CurrUser.UserId != Const.sysglyId && CurrUser.UserId != Const.hfnbdId)
+ {
+ if (model.States != "0")
+ {
+ ShowNotify("当前数据已经提交,不允许修改。", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ }
+
+
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TaskContentEdit.aspx?PerformanceGid=" + PerformanceGid+ "&CreateDateMonth="+ drpCompileDateMonth.Text.Trim(), ""),
+ "修改各周工作任务", Unit.Parse("1000px"), Unit.Parse("800px")));
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+
+ protected void btnWorkPlan(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(PerformanceGid))
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ else
+ {
+ //查询状态是否是0 不是0的不允许修改
+ var model = Funs.DB.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid);
+ if (model == null)
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ else
+ {
+ if (CurrUser.UserId != Const.sysglyId && CurrUser.UserId != Const.hfnbdId)
+ {
+ if (model.States != "0")
+ {
+ ShowNotify("当前数据已经提交,不允许修改。", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ }
+
+
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkPlanEdit.aspx?PerformanceGid=" + PerformanceGid + "&CreateDateMonth=" + drpCompileDateMonth.Text.Trim(), ""),
+ "填写每日工作计划", Unit.Parse("1000px"), Unit.Parse("800px")));
+ }
+ }
+
+ ///
+ /// 提交打分
+ ///
+ ///
+ ///
+ protected void btnSubmit(object sender, EventArgs e) {
+ if (string.IsNullOrEmpty(PerformanceGid))
+ {
+ ShowNotify("未查询到数据,请先生成表单。", MessageBoxIcon.Warning);
+ return;
+ }
+ else {
+ var model = Funs.DB.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid);
+ if (model.States == "1")
+ {
+ ShowNotify("无需重复提交。", MessageBoxIcon.Warning);
+ return;
+ }
+ else {
+ model.States = "1";
+ Funs.DB.SubmitChanges();
+ ShowNotify("提交成功,请等待领导打分。", MessageBoxIcon.Success);
+ }
+ }
+ }
+ #region 导出excel
+
+
+ ///
+ /// 格式化html
+ ///
+ ///
+ ///
+ private string GetGridTableHtml(Grid grid)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ MultiHeaderTable mht = new MultiHeaderTable();
+ mht.ResolveMultiHeaderTable(Grid1.Columns);
+
+
+ sb.Append("");
+
+
+ sb.Append("");
+
+ ////列数
+ //var rowCount = "";
+ //var list = Funs.DB.Base_Project.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).OrderBy(x => x.ProjectCode).ToList();
+ //for (int i = 0; i < list.Count; i++)
+ //{
+ // rowCount+="{}"
+ //}
+
+ foreach (List
");
+
+ return sb.ToString();
+ }
+
+
+ public static string MidStrEx(string sourse, string startstr, string endstr)
+ {
+ string result = string.Empty;
+ int startindex, endindex;
+ try
+ {
+ startindex = sourse.IndexOf(startstr);
+ if (startindex == -1)
+ return result;
+ string tmpstr = sourse.Substring(startindex + startstr.Length);
+ endindex = tmpstr.IndexOf(endstr);
+ if (endindex == -1)
+ return result;
+ result = tmpstr.Remove(endindex);
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return result;
+ }
+
+
+ #region 多表头处理
+
+ ///
+ /// 处理多表头的类
+ ///
+ public class MultiHeaderTable
+ {
+ // 包含 rowspan,colspan 的多表头,方便生成 HTML 的 table 标签
+ public List> MultiTable = new List>();
+ // 最终渲染的列数组
+ public List Columns = new List();
+
+
+ public void ResolveMultiHeaderTable(GridColumnCollection columns)
+ {
+ List