Files
CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/CQMS/Performance/WorkPlanEdit.aspx.cs
T
2023-10-26 15:38:13 +08:00

347 lines
20 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 WorkPlanEdit : PageBase
{
//主键
public string PerformanceGid
{
get
{
return (string)ViewState["PerformanceGid"];
}
set
{
ViewState["PerformanceGid"] = value;
}
}
public string CreateDateMonth
{
get
{
return (string)ViewState["CreateDateMonth"];
}
set
{
ViewState["CreateDateMonth"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CreateDateMonth = Request.Params["CreateDateMonth"];
var ObjMoneth = Convert.ToDateTime(CreateDateMonth.ToString()).Year + "-" + Convert.ToDateTime(CreateDateMonth.ToString()).Month;
//如果是当前的月份 那就显示当前
var NowMoneth = DateTime.Now.Year + "-" + DateTime.Now.Month;
if (ObjMoneth == NowMoneth)
{
dpCurrentDate.Text = Convert.ToDateTime(DateTime.Now.ToString()).Date.ToString();
}
else {
dpCurrentDate.Text = Convert.ToDateTime(CreateDateMonth.ToString()).Date.ToString();
}
PerformanceGid = Request.Params["PerformanceGid"];
BindText();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindText()
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
//根据当前日期 和主键id获取当前是第几周
var TodayDate = Convert.ToDateTime(dpCurrentDate.Text).Date;
var childModel3 = db.CQMS_Performance_Child3.FirstOrDefault(x => x.PerformanceGid == PerformanceGid
&& x.CurrentDate == TodayDate);
if (childModel3 == null)
{
ShowNotify("未查询到数据,请重新先生成表单。", MessageBoxIcon.Warning);
return;
}
var Performance_ChildGid2 = childModel3.Performance_ChildGid2;
var NowWeek = db.CQMS_Performance_Child2.FirstOrDefault(x => x.PerformanceGid == PerformanceGid
&& x.Performance_ChildGid2 == Performance_ChildGid2).NowWeek;
//加载数据。
//判断施工管理工作任务安排有几个
var child2List = Funs.DB.CQMS_Performance_Child2.Where(x => x.PerformanceGid == PerformanceGid && x.NowWeek
== NowWeek).OrderBy(x => x.SortIndex).ToList();
var objModel = db.CQMS_Performance_Child3.Where(x => x.PerformanceGid == PerformanceGid
&& x.CurrentDate == TodayDate);
if (child2List.Count == 6)
{
this.SimpleForm2.Title = "1、施工进度管理(本周任务安排:" + child2List[0].TaskContent + "";
this.SimpleForm3.Title = "2、HSE管理(本周任务安排:" + child2List[1].TaskContent + "";
this.SimpleForm4.Title = "3、质量管理情况(本周任务安排:" + child2List[2].TaskContent + "";
this.SimpleForm5.Title = "4、图纸、材料状态跟踪(本周任务安排:" + child2List[3].TaskContent + "";
this.SimpleForm6.Title = "5、关键事项跟踪(本周任务安排:" + child2List[4].TaskContent + "";
this.SimpleForm7.Title = "6、可交付成果(本周任务安排:" + child2List[5].TaskContent + "";
this.txtWorkPlan1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[0].Performance_ChildGid2).WorkPlan;
this.txtCompletStatus1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[0].Performance_ChildGid2).CompletStatus;
this.txtWorkPlan2.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[1].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan3.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[2].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan4.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[3].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan5.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[4].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan6.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[5].Performance_ChildGid2).WorkPlan;
this.txtTaskCompletContent1.Text = child2List[0].TaskCompletContent;
this.txtTaskCompletContent4.Text = child2List[1].TaskCompletContent;
this.txtTaskCompletContent5.Text = child2List[2].TaskCompletContent;
this.txtTaskCompletContent6.Text = child2List[3].TaskCompletContent;
this.txtTaskCompletContent7.Text = child2List[4].TaskCompletContent;
this.txtTaskCompletContent8.Text = child2List[5].TaskCompletContent;
//txtCompletStatus2.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[1].Performance_ChildGid2).CompletStatus;
//txtCompletStatus3.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[2].Performance_ChildGid2).CompletStatus;
//txtCompletStatus4.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[3].Performance_ChildGid2).CompletStatus;
//txtCompletStatus5.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[4].Performance_ChildGid2).CompletStatus;
//txtCompletStatus6.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[5].Performance_ChildGid2).CompletStatus;
}
else if (child2List.Count == 7)
{
this.Form2.Hidden = false;
this.SimpleForm2.Title = "1、施工进度管理(本周任务安排:" + child2List[0].TaskContent + "";
this.Form2.Title = "2、施工进度管理(本周任务安排:" + child2List[1].TaskContent + "";
this.SimpleForm3.Title = "3、HSE管理(本周任务安排:" + child2List[2].TaskContent + "";
this.SimpleForm4.Title = "4、质量管理情况(本周任务安排:" + child2List[3].TaskContent + "";
this.SimpleForm5.Title = "5、图纸、材料状态跟踪(本周任务安排:" + child2List[4].TaskContent + "";
this.SimpleForm6.Title = "6、关键事项跟踪(本周任务安排:" + child2List[5].TaskContent + "";
this.SimpleForm7.Title = "7、可交付成果(本周任务安排:" + child2List[6].TaskContent + "";
this.txtWorkPlan1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[0].Performance_ChildGid2).WorkPlan;
this.txtCompletStatus1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[0].Performance_ChildGid2).CompletStatus;
this.TextBox1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[1].Performance_ChildGid2).WorkPlan;
this.TextBox2.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[1].Performance_ChildGid2).CompletStatus;
this.txtWorkPlan2.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[2].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan3.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[3].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan4.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[4].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan5.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[5].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan6.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[6].Performance_ChildGid2).WorkPlan;
this.txtTaskCompletContent1.Text = child2List[0].TaskCompletContent;
this.txtTaskCompletContent2.Text = child2List[1].TaskCompletContent;
this.txtTaskCompletContent4.Text = child2List[2].TaskCompletContent;
this.txtTaskCompletContent5.Text = child2List[3].TaskCompletContent;
this.txtTaskCompletContent6.Text = child2List[4].TaskCompletContent;
this.txtTaskCompletContent7.Text = child2List[5].TaskCompletContent;
this.txtTaskCompletContent8.Text = child2List[6].TaskCompletContent;
}
else if (child2List.Count == 8)
{
this.Form2.Hidden = false;
this.Form3.Hidden = false;
this.SimpleForm2.Title = "1、施工进度管理(本周任务安排:" + child2List[0].TaskContent + "";
this.Form2.Title = "2、施工进度管理(本周任务安排:" + child2List[1].TaskContent + "";
this.Form3.Title = "3、施工进度管理(本周任务安排:" + child2List[2].TaskContent + "";
this.SimpleForm3.Title = "4、HSE管理(本周任务安排:" + child2List[3].TaskContent + "";
this.SimpleForm4.Title = "5、质量管理情况(本周任务安排:" + child2List[4].TaskContent + "";
this.SimpleForm5.Title = "6、图纸、材料状态跟踪(本周任务安排:" + child2List[5].TaskContent + "";
this.SimpleForm6.Title = "7、关键事项跟踪(本周任务安排:" + child2List[6].TaskContent + "";
this.SimpleForm7.Title = "8、可交付成果(本周任务安排:" + child2List[7].TaskContent + "";
this.txtWorkPlan1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[0].Performance_ChildGid2).WorkPlan;
this.txtCompletStatus1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[0].Performance_ChildGid2).CompletStatus;
this.TextBox1.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[1].Performance_ChildGid2).WorkPlan;
this.TextBox2.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[1].Performance_ChildGid2).CompletStatus;
this.TextBox3.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[2].Performance_ChildGid2).WorkPlan;
this.TextBox4.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[2].Performance_ChildGid2).CompletStatus;
this.txtWorkPlan2.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[3].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan3.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[4].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan4.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[5].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan5.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[6].Performance_ChildGid2).WorkPlan;
this.txtWorkPlan6.Text = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[7].Performance_ChildGid2).WorkPlan;
this.txtTaskCompletContent1.Text = child2List[0].TaskCompletContent;
this.txtTaskCompletContent2.Text = child2List[1].TaskCompletContent;
this.txtTaskCompletContent3.Text = child2List[2].TaskCompletContent;
this.txtTaskCompletContent4.Text = child2List[3].TaskCompletContent;
this.txtTaskCompletContent5.Text = child2List[4].TaskCompletContent;
this.txtTaskCompletContent6.Text = child2List[5].TaskCompletContent;
this.txtTaskCompletContent7.Text = child2List[6].TaskCompletContent;
this.txtTaskCompletContent8.Text = child2List[7].TaskCompletContent;
}
}
}
protected void DatePicker1_TextChanged(object sender, EventArgs e)
{
BindText();
}
/// <summary>
/// 确认操作
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnEdit_Click(object sender, EventArgs e)
{
this.SubmitWorkPlan();
}
private void SubmitWorkPlan() {
var a = this.txtTaskCompletContent8.Text.Trim();
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
//根据当前日期 和主键id获取当前是第几周
var TodayDate = Convert.ToDateTime(dpCurrentDate.Text).Date;
var childModel3 = db.CQMS_Performance_Child3.FirstOrDefault(x => x.PerformanceGid == PerformanceGid
&& x.CurrentDate == TodayDate);
if (childModel3 == null)
{
ShowNotify("未查询到数据,请重新先生成表单。", MessageBoxIcon.Warning);
return;
}
var Performance_ChildGid2 = childModel3.Performance_ChildGid2;
var NowWeek = db.CQMS_Performance_Child2.FirstOrDefault(x => x.PerformanceGid == PerformanceGid
&& x.Performance_ChildGid2 == Performance_ChildGid2).NowWeek;
//加载数据。
//判断施工管理工作任务安排有几个(倒序)
var child2List = Funs.DB.CQMS_Performance_Child2.Where(x => x.PerformanceGid == PerformanceGid && x.NowWeek
== NowWeek).OrderByDescending(x => x.SortIndex).ToList();
var objModel = db.CQMS_Performance_Child3.Where(x => x.PerformanceGid == PerformanceGid
&& x.CurrentDate == TodayDate);
if (child2List != null)
{
//可交付成果
var Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[0].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan6.Text;
db.SubmitChanges();
//周计划
Model.CQMS_Performance_Child2 Child4Model = child2List[0];
var test = this.txtTaskCompletContent8.Text.Trim();
Child4Model.TaskCompletContent = this.txtTaskCompletContent8.Text.Trim();
PerformanceService.UpdateChild2(Child4Model);
//关键事项跟踪
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[1].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan5.Text;
db.SubmitChanges();
Child4Model = child2List[1];
Child4Model.TaskCompletContent = txtTaskCompletContent7.Text;
PerformanceService.UpdateChild2(Child4Model);
//图纸、材料状态跟踪;统计台账
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[2].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan4.Text;
db.SubmitChanges();
Child4Model = child2List[2];
Child4Model.TaskCompletContent = txtTaskCompletContent6.Text;
PerformanceService.UpdateChild2(Child4Model);
//质量管理情况
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[3].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan3.Text;
db.SubmitChanges();
Child4Model = child2List[3];
Child4Model.TaskCompletContent = txtTaskCompletContent5.Text;
PerformanceService.UpdateChild2(Child4Model);
//HSE管理
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[4].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan2.Text;
db.SubmitChanges();
Child4Model = child2List[4];
Child4Model.TaskCompletContent = txtTaskCompletContent4.Text;
PerformanceService.UpdateChild2(Child4Model);
if (child2List.Count == 6)
{
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[5].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan1.Text;
Child3Model.CompletStatus = txtCompletStatus1.Text;
db.SubmitChanges();
Child4Model = child2List[5];
Child4Model.TaskCompletContent = txtTaskCompletContent1.Text;
PerformanceService.UpdateChild2(Child4Model);
}
else if (child2List.Count == 7)
{
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[5].Performance_ChildGid2);
Child3Model.WorkPlan = TextBox1.Text;
Child3Model.CompletStatus = TextBox2.Text;
db.SubmitChanges();
Child4Model = child2List[5];
Child4Model.TaskCompletContent = txtTaskCompletContent2.Text;
PerformanceService.UpdateChild2(Child4Model);
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[6].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan1.Text;
Child3Model.CompletStatus = txtCompletStatus1.Text;
db.SubmitChanges();
Child4Model = child2List[6];
Child4Model.TaskCompletContent = txtTaskCompletContent1.Text;
PerformanceService.UpdateChild2(Child4Model);
}
else if (child2List.Count == 8)
{
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[5].Performance_ChildGid2);
Child3Model.WorkPlan = TextBox3.Text;
Child3Model.CompletStatus = TextBox4.Text;
db.SubmitChanges();
Child4Model = child2List[5];
Child4Model.TaskCompletContent = txtTaskCompletContent3.Text;
PerformanceService.UpdateChild2(Child4Model);
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[6].Performance_ChildGid2);
Child3Model.WorkPlan = TextBox1.Text;
Child3Model.CompletStatus = TextBox2.Text;
db.SubmitChanges();
Child4Model = child2List[6];
Child4Model.TaskCompletContent = txtTaskCompletContent2.Text;
PerformanceService.UpdateChild2(Child4Model);
Child3Model = objModel.FirstOrDefault(x => x.Performance_ChildGid2 == child2List[7].Performance_ChildGid2);
Child3Model.WorkPlan = txtWorkPlan1.Text;
Child3Model.CompletStatus = txtCompletStatus1.Text;
db.SubmitChanges();
Child4Model = child2List[7];
Child4Model.TaskCompletContent = txtTaskCompletContent1.Text;
PerformanceService.UpdateChild2(Child4Model);
}
ShowNotify("修改成功。", MessageBoxIcon.Success);
}
}
}
}
}