2023-10-26 15:38:13 +08:00
|
|
|
|
using BLL;
|
2023-11-06 15:45:52 +08:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
2023-10-26 15:38:13 +08:00
|
|
|
|
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 TaskContentEdit : 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region CustomClass
|
|
|
|
|
|
|
|
|
|
public class CustomClass
|
|
|
|
|
{
|
|
|
|
|
private string _id;
|
|
|
|
|
|
|
|
|
|
public string ID
|
|
|
|
|
{
|
|
|
|
|
get { return _id; }
|
|
|
|
|
set { _id = value; }
|
|
|
|
|
}
|
|
|
|
|
private string _name;
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return _name; }
|
|
|
|
|
set { _name = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CustomClass(string id, string name)
|
|
|
|
|
{
|
|
|
|
|
_id = id;
|
|
|
|
|
_name = name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页面加载
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
|
|
|
{
|
|
|
|
|
//主键
|
|
|
|
|
PerformanceGid = Request.Params["PerformanceGid"];
|
|
|
|
|
CreateDateMonth = Request.Params["CreateDateMonth"];
|
|
|
|
|
//根据主键获取周
|
|
|
|
|
var CreateDateWeek = db.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid).CreateDateMonth;
|
|
|
|
|
|
|
|
|
|
var datesConfig = Convert.ToDateTime(CreateDateMonth);
|
2023-10-31 15:22:02 +08:00
|
|
|
|
var Year = datesConfig.Year;
|
2023-10-26 15:38:13 +08:00
|
|
|
|
var Month = 1;
|
|
|
|
|
if (datesConfig.Month != 12)
|
|
|
|
|
{
|
|
|
|
|
Month = datesConfig.Month + 1;
|
|
|
|
|
}
|
2023-10-31 15:22:02 +08:00
|
|
|
|
else {
|
|
|
|
|
Year += 1;
|
|
|
|
|
}
|
2023-10-26 15:38:13 +08:00
|
|
|
|
//按照日期查询是否有设置
|
2023-10-31 15:22:02 +08:00
|
|
|
|
var modelConfig = Funs.DB.CQMS_Performance_SetUp.FirstOrDefault(x => x.CreateYear == Year.ToString() && x.SortIndex == Month);
|
2023-10-26 15:38:13 +08:00
|
|
|
|
List<CustomClass> myList = new List<CustomClass>();
|
|
|
|
|
myList.Add(new CustomClass("1", "第一周"));
|
|
|
|
|
myList.Add(new CustomClass("2", "第二周"));
|
|
|
|
|
myList.Add(new CustomClass("3", "第三周"));
|
|
|
|
|
myList.Add(new CustomClass("4", "第四周"));
|
|
|
|
|
if (modelConfig.SetUpWeek == 5)
|
|
|
|
|
{
|
|
|
|
|
myList.Add(new CustomClass("5", "第五周"));
|
|
|
|
|
}
|
|
|
|
|
ddlNowWeek.DataTextField = "Name";
|
|
|
|
|
ddlNowWeek.DataValueField = "ID";
|
|
|
|
|
ddlNowWeek.DataSource = myList;
|
|
|
|
|
ddlNowWeek.DataBind();
|
|
|
|
|
|
|
|
|
|
//加载数据
|
|
|
|
|
BindText();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据周加载数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BindText() {
|
|
|
|
|
//默认加载第一周的各项数据,倒序
|
|
|
|
|
var child2List = Funs.DB.CQMS_Performance_Child2.Where(x => x.PerformanceGid == PerformanceGid && x.NowWeek == Convert.ToInt32(ddlNowWeek.SelectedValue)).OrderByDescending(x => x.SortIndex).ToList();
|
|
|
|
|
if (child2List.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
txtTaskContentJf.Text = child2List[0].TaskContent;
|
|
|
|
|
txtTaskContentGjsx.Text = child2List[1].TaskContent;
|
|
|
|
|
txtTaskContentTz.Text = child2List[2].TaskContent;
|
|
|
|
|
txtTaskContentZl.Text = child2List[3].TaskContent;
|
|
|
|
|
txtTaskContentHse.Text = child2List[4].TaskContent;
|
|
|
|
|
|
2023-11-06 15:45:52 +08:00
|
|
|
|
//加载grid
|
|
|
|
|
var Sgcount = Funs.DB.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid).SgCount;
|
|
|
|
|
var list = (from x in Funs.DB.CQMS_Performance_Child2
|
|
|
|
|
where x.PerformanceGid == PerformanceGid
|
|
|
|
|
&& x.NowWeek == Convert.ToInt32(ddlNowWeek.SelectedValue) && x.SortIndex <= Sgcount
|
|
|
|
|
orderby x.SortIndex select x)
|
|
|
|
|
.ToList();
|
|
|
|
|
Grid1.DataSource = list;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
|
|
|
|
////如果数量是6 就按顺序来,7 8 则是多2条数据
|
|
|
|
|
//if (child2List.Count == 6)
|
|
|
|
|
//{
|
|
|
|
|
// txtTaskContent1.Text = child2List[5].TaskContent;
|
|
|
|
|
// txtProjectQuantity1.Text = child2List[5].ProjectQuantity;
|
|
|
|
|
// txtDemandPlan1.Text = child2List[5].DemandPlan;
|
|
|
|
|
// fr1.Hidden = true;
|
|
|
|
|
// fr2.Hidden = true;
|
|
|
|
|
//}
|
|
|
|
|
//else if (child2List.Count == 7)
|
|
|
|
|
//{
|
|
|
|
|
// txtTaskContent2.Text = child2List[5].TaskContent;
|
|
|
|
|
// txtProjectQuantity2.Text = child2List[5].ProjectQuantity;
|
|
|
|
|
// txtDemandPlan2.Text = child2List[5].DemandPlan;
|
|
|
|
|
|
|
|
|
|
// txtTaskContent1.Text = child2List[6].TaskContent;
|
|
|
|
|
// txtProjectQuantity1.Text = child2List[6].ProjectQuantity;
|
|
|
|
|
// txtDemandPlan1.Text = child2List[6].DemandPlan;
|
|
|
|
|
// fr2.Hidden = true;
|
|
|
|
|
//}
|
|
|
|
|
//else if (child2List.Count == 8)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
// txtTaskContent3.Text = child2List[5].TaskContent;
|
|
|
|
|
// txtProjectQuantity3.Text = child2List[5].ProjectQuantity;
|
|
|
|
|
// txtDemandPlan3.Text = child2List[5].DemandPlan;
|
|
|
|
|
|
|
|
|
|
// txtTaskContent2.Text = child2List[6].TaskContent;
|
|
|
|
|
// txtProjectQuantity2.Text = child2List[6].ProjectQuantity;
|
|
|
|
|
// txtDemandPlan2.Text = child2List[6].DemandPlan;
|
|
|
|
|
|
|
|
|
|
// txtTaskContent1.Text = child2List[7].TaskContent;
|
|
|
|
|
// txtProjectQuantity1.Text = child2List[7].ProjectQuantity;
|
|
|
|
|
// txtDemandPlan1.Text = child2List[7].DemandPlan;
|
|
|
|
|
//}
|
2023-10-26 15:38:13 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("未查询到月节点目标数据,请重新生成。", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据周更改数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void OnddlNowWeekChanged(object sender, EventArgs e) {
|
|
|
|
|
BindText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnEdit_Click(object sender, EventArgs e) {
|
|
|
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
|
|
|
{
|
|
|
|
|
//依次修改各周任务安排
|
|
|
|
|
#region 参数
|
2023-11-06 15:45:52 +08:00
|
|
|
|
//var TaskContent1 = txtTaskContent1.Text.Trim();
|
|
|
|
|
//var ProjectQuantity1 = txtProjectQuantity1.Text.Trim();
|
|
|
|
|
//var DemandPlan1 = txtDemandPlan1.Text.Trim();
|
2023-10-26 15:38:13 +08:00
|
|
|
|
|
2023-11-06 15:45:52 +08:00
|
|
|
|
//var TaskContent2 = txtTaskContent2.Text.Trim();
|
|
|
|
|
//var ProjectQuantity2 = txtProjectQuantity2.Text.Trim();
|
|
|
|
|
//var DemandPlan2 = txtDemandPlan2.Text.Trim();
|
2023-10-26 15:38:13 +08:00
|
|
|
|
|
2023-11-06 15:45:52 +08:00
|
|
|
|
//var TaskContent3 = txtTaskContent3.Text.Trim();
|
|
|
|
|
//var ProjectQuantity3 = txtProjectQuantity3.Text.Trim();
|
|
|
|
|
//var DemandPlan3 = txtDemandPlan3.Text.Trim();
|
2023-10-26 15:38:13 +08:00
|
|
|
|
|
|
|
|
|
var TaskContentHse = txtTaskContentHse.Text.Trim();
|
|
|
|
|
|
|
|
|
|
var TaskContentZl = txtTaskContentZl.Text.Trim();
|
|
|
|
|
|
|
|
|
|
var TaskContentTz = txtTaskContentTz.Text.Trim();
|
|
|
|
|
|
|
|
|
|
var TaskContentGjsx = txtTaskContentGjsx.Text.Trim();
|
|
|
|
|
|
|
|
|
|
var TaskContentJf = txtTaskContentJf.Text.Trim();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var child2List = db.CQMS_Performance_Child2.Where(x => x.NowWeek == Convert.ToInt32(ddlNowWeek.SelectedValue) && x.PerformanceGid == PerformanceGid).
|
|
|
|
|
OrderByDescending(x => x.SortIndex).ToList();
|
|
|
|
|
|
|
|
|
|
var child2Model = child2List[0];
|
|
|
|
|
child2Model.TaskContent = TaskContentJf;
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
child2Model= child2List[1];
|
|
|
|
|
child2Model.TaskContent = TaskContentGjsx;
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
child2Model = child2List[2];
|
|
|
|
|
child2Model.TaskContent = TaskContentTz;
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
child2Model = child2List[3];
|
|
|
|
|
child2Model.TaskContent = TaskContentZl;
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
child2Model = child2List[4];
|
|
|
|
|
child2Model.TaskContent = TaskContentHse;
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 15:45:52 +08:00
|
|
|
|
child2List = db.CQMS_Performance_Child2.Where(x => x.NowWeek == Convert.ToInt32(ddlNowWeek.SelectedValue) && x.PerformanceGid == PerformanceGid).
|
|
|
|
|
OrderBy(x => x.SortIndex).ToList();
|
|
|
|
|
var ji = 0;
|
|
|
|
|
//根据grid 里的进行修改
|
|
|
|
|
JArray teamGroupData = Grid1.GetMergedData();
|
|
|
|
|
foreach (JObject teamGroupRow in teamGroupData)
|
2023-10-26 15:38:13 +08:00
|
|
|
|
{
|
2023-11-06 15:45:52 +08:00
|
|
|
|
JObject values = teamGroupRow.Value<JObject>("values");
|
|
|
|
|
int rowIndex = teamGroupRow.Value<int>("index");
|
|
|
|
|
child2Model = child2List[ji];
|
|
|
|
|
child2Model.TaskContent = values.Value<string>("TaskContent");
|
|
|
|
|
child2Model.ProjectQuantity = values.Value<string>("ProjectQuantity");
|
|
|
|
|
child2Model.DemandPlan = values.Value<string>("DemandPlan");
|
2023-10-26 15:38:13 +08:00
|
|
|
|
db.SubmitChanges();
|
2023-11-06 15:45:52 +08:00
|
|
|
|
ji += 1;
|
2023-10-26 15:38:13 +08:00
|
|
|
|
}
|
2023-11-06 15:45:52 +08:00
|
|
|
|
|
|
|
|
|
//if (child2List.Count == 8)
|
|
|
|
|
//{
|
|
|
|
|
// child2Model = child2List[5];
|
|
|
|
|
// child2Model.TaskContent = TaskContent3;
|
|
|
|
|
// child2Model.ProjectQuantity = ProjectQuantity3;
|
|
|
|
|
// child2Model.DemandPlan = DemandPlan3;
|
|
|
|
|
// db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
// child2Model = child2List[6];
|
|
|
|
|
// child2Model.TaskContent = TaskContent2;
|
|
|
|
|
// child2Model.ProjectQuantity = ProjectQuantity2;
|
|
|
|
|
// child2Model.DemandPlan = DemandPlan2;
|
|
|
|
|
// db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
// child2Model = child2List[7];
|
|
|
|
|
// child2Model.TaskContent = TaskContent1;
|
|
|
|
|
// child2Model.ProjectQuantity = ProjectQuantity1;
|
|
|
|
|
// child2Model.DemandPlan = DemandPlan1;
|
|
|
|
|
// db.SubmitChanges();
|
|
|
|
|
//}
|
|
|
|
|
//else if (child2List.Count==7)
|
|
|
|
|
//{
|
|
|
|
|
// child2Model = child2List[5];
|
|
|
|
|
// child2Model.TaskContent = TaskContent2;
|
|
|
|
|
// child2Model.ProjectQuantity = ProjectQuantity2;
|
|
|
|
|
// child2Model.DemandPlan = DemandPlan2;
|
|
|
|
|
// db.SubmitChanges();
|
|
|
|
|
|
|
|
|
|
// child2Model = child2List[6];
|
|
|
|
|
// child2Model.TaskContent = TaskContent1;
|
|
|
|
|
// child2Model.ProjectQuantity = ProjectQuantity1;
|
|
|
|
|
// child2Model.DemandPlan = DemandPlan1;
|
|
|
|
|
// db.SubmitChanges();
|
|
|
|
|
//}
|
|
|
|
|
//else if (child2List.Count==6)
|
|
|
|
|
//{
|
|
|
|
|
// child2Model = child2List[5];
|
|
|
|
|
// child2Model.TaskContent = TaskContent1;
|
|
|
|
|
// child2Model.ProjectQuantity = ProjectQuantity1;
|
|
|
|
|
// child2Model.DemandPlan = DemandPlan1;
|
|
|
|
|
// db.SubmitChanges();
|
|
|
|
|
//}
|
2023-10-26 15:38:13 +08:00
|
|
|
|
ShowNotify("修改成功。", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|