关键事项、周进度、月度计划
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -25,6 +28,41 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 本周周号
|
||||
/// </summary>
|
||||
public int ThisWeekNo
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)ViewState["ThisWeekNo"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ThisWeekNo"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 下周周号
|
||||
/// </summary>
|
||||
public int NextWeekNo
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)ViewState["NextWeekNo"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["NextWeekNo"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页面加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
@@ -34,6 +72,12 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
{
|
||||
weekNo = Request.Params["WeekNo"];
|
||||
}
|
||||
this.ThisWeekNo = int.Parse(weekNo);
|
||||
this.NextWeekNo = int.Parse(weekNo) + 1;
|
||||
this.txtWeekNo.Text = this.ThisWeekNo.ToString();
|
||||
this.txtNextWeekNo.Text = this.NextWeekNo.ToString();
|
||||
|
||||
|
||||
UnitWorkService.InitUnitWorkList2(drpUnitWork, this.CurrUser.LoginProjectId, false);
|
||||
CNProfessionalService.InitCNProfessional(drpMajor, false);
|
||||
BLL.ProjectUnitService.InitUnitDropDownList2(drpUnitId, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, false);
|
||||
@@ -42,109 +86,200 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
CNProfessionalService.InitCNProfessional(drpMajor2, false);
|
||||
BLL.ProjectUnitService.InitUnitDropDownList2(drpUnitId2, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, false);
|
||||
UserService.Init(drpDutyPerson2, CurrUser.LoginProjectId, false);
|
||||
this.txtWeekNo.Text = weekNo;
|
||||
var weekPlan = Funs.DB.JDGL_WeekPlan.FirstOrDefault(x => x.WeekNo == this.txtWeekNo.Text);
|
||||
if (weekPlan != null)
|
||||
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
var thisWeek = BLL.WeekItemService.GetWeekItemByProjectIdAndWeekNo(this.CurrUser.LoginProjectId, this.ThisWeekNo);
|
||||
|
||||
var thisWeekPlan = Funs.DB.JDGL_WeekPlan.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.WeekNo == this.ThisWeekNo.ToString());
|
||||
if (thisWeekPlan != null)
|
||||
{
|
||||
if (weekPlan.StartDate != null)
|
||||
{
|
||||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", weekPlan.StartDate);
|
||||
ThisWeekGrid();
|
||||
if (now > ((DateTime)thisWeekPlan.EndDate).AddDays(1))//|| now < ((DateTime)thisWeekPlan.StartDate)
|
||||
{//当前时间大于本周结束时间,禁止维护本周计划
|
||||
this.btnNew2.Hidden = true;
|
||||
this.Grid2.Columns[9].Hidden = true;
|
||||
}
|
||||
if (weekPlan.EndDate != null)
|
||||
{
|
||||
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", weekPlan.EndDate);
|
||||
else if (now > ((DateTime)thisWeekPlan.StartDate))
|
||||
{//当前时间大于本周开始时间,禁止删除本周计划(当前时间处于本周区间,禁止删除本周计划)
|
||||
this.Grid2.Columns[9].Hidden = true;
|
||||
}
|
||||
var lastWeekPlan = (from x in Funs.DB.JDGL_WeekPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.StartDate < weekPlan.StartDate orderby x.StartDate descending select x).FirstOrDefault();
|
||||
if (lastWeekPlan != null)
|
||||
{
|
||||
BindGrid2(lastWeekPlan.WeekNo);
|
||||
if (lastWeekPlan.WeekNo != "0")
|
||||
{
|
||||
this.Toolbar1.Hidden = true;
|
||||
this.Grid2.Columns[9].Hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (now > thisWeek.EndDate.AddDays(1))// || now < thisWeek.StartDate
|
||||
{//当前时间大于本周结束时间,禁止维护本周计划
|
||||
this.btnNew2.Hidden = true;
|
||||
this.Grid2.Columns[9].Hidden = true;
|
||||
}
|
||||
else if (now > thisWeek.StartDate)
|
||||
{//当前时间大于本周开始时间小于本周结束时间,禁止删除本周计划(当前时间处于本周区间,禁止删除本周计划)
|
||||
this.Grid2.Columns[9].Hidden = true;
|
||||
}
|
||||
|
||||
var nextWeek = BLL.WeekItemService.GetWeekItemByProjectIdAndWeekNo(this.CurrUser.LoginProjectId, this.NextWeekNo);
|
||||
var nextWeekPlan = Funs.DB.JDGL_WeekPlan.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.WeekNo == this.NextWeekNo.ToString());
|
||||
if (nextWeekPlan != null)
|
||||
{
|
||||
NextWeekGrid();
|
||||
if (now > ((DateTime)nextWeekPlan.EndDate).AddDays(1))
|
||||
{//当前时间大于下周结束时间,禁止维护下周计划
|
||||
this.Toolbar5.Hidden = true;
|
||||
this.btnNew.Hidden = true;
|
||||
this.btnSelectWeekPlan.Hidden = true;
|
||||
this.Grid1.Columns[9].Hidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Toolbar1.Hidden = false;
|
||||
this.Grid2.Columns[9].Hidden = false;
|
||||
}
|
||||
if (nextWeek != null)
|
||||
{
|
||||
if (now > nextWeek.EndDate.AddDays(1))//|| now < nextWeek.StartDate
|
||||
{//当前时间大于下周结束时间,禁止维护下周计划
|
||||
//this.btnNew2.Hidden = true;
|
||||
//this.Grid2.Columns[9].Hidden = true;
|
||||
this.Toolbar5.Hidden = true;
|
||||
this.btnNew.Hidden = true;
|
||||
this.btnSelectWeekPlan.Hidden = true;
|
||||
this.Grid1.Columns[9].Hidden = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtStartDate.Text = string.Empty;
|
||||
this.txtEndDate.Text = string.Empty;
|
||||
var lastWeekPlan = (from x in Funs.DB.JDGL_WeekPlan where x.ProjectId == this.CurrUser.LoginProjectId orderby x.StartDate descending select x).FirstOrDefault();
|
||||
if (lastWeekPlan != null)
|
||||
#region 判断下周周号是否存在,不存在则新增
|
||||
|
||||
nextWeek = new Model.JDGL_WeekItem
|
||||
{
|
||||
BindGrid2(lastWeekPlan.WeekNo);
|
||||
this.Toolbar1.Hidden = true;
|
||||
this.Grid2.Columns[9].Hidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Toolbar1.Hidden = false;
|
||||
this.Grid2.Columns[9].Hidden = false;
|
||||
}
|
||||
WeekId = SQLHelper.GetNewID(typeof(Model.JDGL_WeekItem)),
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
WeekNo = this.NextWeekNo,
|
||||
StartDate = thisWeek.StartDate.AddDays(7),
|
||||
EndDate = thisWeek.EndDate.AddDays(7),
|
||||
CompileMan = this.CurrUser.UserId,
|
||||
CompileDate = DateTime.Now,
|
||||
};
|
||||
BLL.WeekItemService.AddWeekItem(nextWeek);
|
||||
|
||||
#endregion
|
||||
}
|
||||
BindGrid();
|
||||
|
||||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", thisWeek.StartDate);
|
||||
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", thisWeek.EndDate);
|
||||
this.txtNextStartDate.Text = string.Format("{0:yyyy-MM-dd}", nextWeek.StartDate);
|
||||
this.txtNextEndDate.Text = string.Format("{0:yyyy-MM-dd}", nextWeek.EndDate);
|
||||
|
||||
|
||||
|
||||
//var weekPlan = Funs.DB.JDGL_WeekPlan.FirstOrDefault(x => x.WeekNo == this.txtWeekNo.Text);
|
||||
//if (weekPlan != null)
|
||||
//{
|
||||
// //if (weekPlan.StartDate != null)
|
||||
// //{
|
||||
// // this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", weekPlan.StartDate);
|
||||
// //}
|
||||
// //if (weekPlan.EndDate != null)
|
||||
// //{
|
||||
// // this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", weekPlan.EndDate);
|
||||
// //}
|
||||
// var lastWeekPlan = (from x in Funs.DB.JDGL_WeekPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.StartDate < weekPlan.StartDate orderby x.StartDate descending select x).FirstOrDefault();
|
||||
// if (lastWeekPlan != null)
|
||||
// {
|
||||
// ThisWeekGrid(lastWeekPlan.WeekNo);
|
||||
// if (lastWeekPlan.WeekNo != "0")
|
||||
// {
|
||||
// this.Toolbar1.Hidden = true;
|
||||
// this.Grid2.Columns[9].Hidden = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.Toolbar1.Hidden = false;
|
||||
// this.Grid2.Columns[9].Hidden = false;
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// //this.txtStartDate.Text = string.Empty;
|
||||
// //this.txtEndDate.Text = string.Empty;
|
||||
// var lastWeekPlan = (from x in Funs.DB.JDGL_WeekPlan where x.ProjectId == this.CurrUser.LoginProjectId orderby x.StartDate descending select x).FirstOrDefault();
|
||||
// if (lastWeekPlan != null)
|
||||
// {
|
||||
// ThisWeekGrid(lastWeekPlan.WeekNo);
|
||||
// this.Toolbar1.Hidden = true;
|
||||
// this.Grid2.Columns[9].Hidden = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.Toolbar1.Hidden = false;
|
||||
// this.Grid2.Columns[9].Hidden = false;
|
||||
// }
|
||||
//}
|
||||
//NextWeekGrid(NextWeekNo.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载Grid
|
||||
/// 加载下周计划
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
/// <param name="NextWeekNo">下周周号</param>
|
||||
private void NextWeekGrid()
|
||||
{
|
||||
string weekNo = this.txtWeekNo.Text.Trim();
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Grid1.DataSource = from x in db.JDGL_WeekPlan
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.WeekNo == weekNo
|
||||
orderby x.SortIndex
|
||||
select new
|
||||
{
|
||||
x.WeekPlanId,
|
||||
x.ProjectId,
|
||||
x.WeekNo,
|
||||
x.StartDate,
|
||||
x.EndDate,
|
||||
UnitWork = (from y in db.WBS_UnitWork where y.UnitWorkId == x.UnitWork select y.UnitWorkName).First(),
|
||||
Major = (from y in db.Base_CNProfessional where y.CNProfessionalId == x.Major select y.ProfessionalName).First(),
|
||||
UnitId = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
|
||||
x.WorkContent,
|
||||
x.PlanDate,
|
||||
DutyPerson = (from y in db.Sys_User where y.UserId == x.DutyPerson select y.UserName).First(),
|
||||
IsOK = ConvertIsOK(x.IsOK),
|
||||
x.Remark,
|
||||
};
|
||||
string strSql = @"select wplan.WeekPlanId,wplan.ProjectId,wplan.WeekNo,wplan.StartDate,wplan.EndDate,wplan.WorkContent,wplan.PlanDate,wplan.Remark
|
||||
,case wplan.IsOK when 1 then '已完成' when 0 then '未完成' else '' end as IsOK
|
||||
,uwork.UnitWorkName as UnitWork,major.ProfessionalName as Major,unit.UnitName as UnitId
|
||||
,DutyPerson = STUFF((SELECT ',' + p.UserName FROM dbo.Sys_User as p where PATINDEX('%,' + RTRIM(p.UserId) + ',%', ',' + wplan.DutyPerson + ',') > 0 FOR XML PATH('')), 1, 1,'')
|
||||
from JDGL_WeekPlan as wplan
|
||||
left join WBS_UnitWork as uwork on uwork.UnitWorkId = wplan.UnitWork
|
||||
left join Base_CNProfessional as major on major.CNProfessionalId = wplan.Major
|
||||
left join Base_Unit as unit on unit.UnitId = wplan.UnitId
|
||||
where wplan.ProjectId = @ProjectId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
|
||||
strSql += " and wplan.WeekNo = @weekNo";
|
||||
listStr.Add(new SqlParameter("@weekNo", this.NextWeekNo));
|
||||
strSql += " order by wplan.SortIndex ";
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
Grid1.DataSource = tb;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
private void BindGrid2(string weekNo)
|
||||
/// <summary>
|
||||
/// 本周计划完成情况
|
||||
/// </summary>
|
||||
/// <param name="weekNo">本周周号</param>
|
||||
private void ThisWeekGrid()
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Grid2.DataSource = from x in db.JDGL_WeekPlan
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.WeekNo == weekNo
|
||||
orderby x.SortIndex
|
||||
select new
|
||||
{
|
||||
x.WeekPlanId,
|
||||
x.ProjectId,
|
||||
x.WeekNo,
|
||||
x.StartDate,
|
||||
x.EndDate,
|
||||
UnitWork = (from y in db.WBS_UnitWork where y.UnitWorkId == x.UnitWork select y.UnitWorkName).First(),
|
||||
Major = (from y in db.Base_CNProfessional where y.CNProfessionalId == x.Major select y.ProfessionalName).First(),
|
||||
UnitId = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
|
||||
x.WorkContent,
|
||||
x.PlanDate,
|
||||
DutyPerson = (from y in db.Sys_User where y.UserId == x.DutyPerson select y.UserName).First(),
|
||||
IsOK = ConvertIsOK(x.IsOK),
|
||||
x.Remark,
|
||||
};
|
||||
string strSql = @"select wplan.WeekPlanId,wplan.ProjectId,wplan.WeekNo,wplan.StartDate,wplan.EndDate,wplan.WorkContent,wplan.PlanDate,wplan.Remark
|
||||
,case wplan.IsOK when 1 then '已完成' when 0 then '未完成' else '' end as IsOK
|
||||
,uwork.UnitWorkName as UnitWork,major.ProfessionalName as Major,unit.UnitName as UnitId
|
||||
,DutyPerson = STUFF((SELECT ',' + p.UserName FROM dbo.Sys_User as p where PATINDEX('%,' + RTRIM(p.UserId) + ',%', ',' + wplan.DutyPerson + ',') > 0 FOR XML PATH('')), 1, 1,'')
|
||||
from JDGL_WeekPlan as wplan
|
||||
left join WBS_UnitWork as uwork on uwork.UnitWorkId = wplan.UnitWork
|
||||
left join Base_CNProfessional as major on major.CNProfessionalId = wplan.Major
|
||||
left join Base_Unit as unit on unit.UnitId = wplan.UnitId
|
||||
where wplan.ProjectId = @ProjectId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
//if (!string.IsNullOrEmpty(weekNo))
|
||||
//{
|
||||
// strSql += " and wplan.WeekNo = @weekNo";
|
||||
// listStr.Add(new SqlParameter("@weekNo", weekNo));
|
||||
//}
|
||||
strSql += " and wplan.WeekNo = @weekNo";
|
||||
listStr.Add(new SqlParameter("@weekNo", this.ThisWeekNo));
|
||||
strSql += " order by wplan.SortIndex ";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid2.RecordCount = tb.Rows.Count;
|
||||
Grid2.DataSource = tb;
|
||||
Grid2.DataBind();
|
||||
}
|
||||
|
||||
|
||||
private string ConvertIsOK(bool? isOK)
|
||||
{
|
||||
string str = string.Empty;
|
||||
@@ -162,18 +297,11 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
return str;
|
||||
}
|
||||
|
||||
#region 月份选择事件
|
||||
/// <summary>
|
||||
/// 月份选择事件
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtMonths_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.txtWeekNo.Text))
|
||||
@@ -194,24 +322,100 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
SaveData(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存周计划
|
||||
/// </summary>
|
||||
/// <param name="bl"></param>
|
||||
private void SaveData(bool bl)
|
||||
{
|
||||
string weekNo = this.txtWeekNo.Text.Trim();
|
||||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||||
var list = GetDetails();
|
||||
//选择的周号为本周计划周号
|
||||
string weekNo = this.txtWeekNo.Text.Trim();
|
||||
//下周周号
|
||||
string NextWeekNo = (int.Parse(weekNo) + 1).ToString();
|
||||
|
||||
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var unitWorks = from x in db.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
var cns = from x in db.Base_CNProfessional select x;
|
||||
var units = from x in db.Base_Unit select x;
|
||||
var users = from x in db.Sys_User select x;
|
||||
BLL.WeekPlanService.DeleteAllWeekPlan(this.CurrUser.LoginProjectId, weekNo);
|
||||
|
||||
//清理下周计划
|
||||
BLL.WeekPlanService.DeleteAllWeekPlan(this.CurrUser.LoginProjectId, NextWeekNo);
|
||||
|
||||
#region 下周计划
|
||||
|
||||
int i = 1;
|
||||
var list = GetDetails();
|
||||
foreach (var item in list)
|
||||
{
|
||||
Model.JDGL_WeekPlan WeekPlan = new Model.JDGL_WeekPlan();
|
||||
WeekPlan.WeekPlanId = SQLHelper.GetNewID(typeof(Model.JDGL_WeekPlan));
|
||||
WeekPlan.ProjectId = this.CurrUser.LoginProjectId;
|
||||
WeekPlan.WeekNo = NextWeekNo;
|
||||
WeekPlan.StartDate = startDate.AddDays(7);
|
||||
WeekPlan.EndDate = endDate.AddDays(7);
|
||||
//WeekPlan.WeekNo = weekNo;
|
||||
//WeekPlan.StartDate = startDate;
|
||||
//WeekPlan.EndDate = endDate;
|
||||
if (unitWorks.FirstOrDefault(x => x.UnitWorkName == item.UnitWork) != null)
|
||||
{
|
||||
WeekPlan.UnitWork = unitWorks.FirstOrDefault(x => x.UnitWorkName == item.UnitWork).UnitWorkId;
|
||||
}
|
||||
if (cns.FirstOrDefault(x => x.ProfessionalName == item.Major) != null)
|
||||
{
|
||||
WeekPlan.Major = cns.FirstOrDefault(x => x.ProfessionalName == item.Major).CNProfessionalId;
|
||||
}
|
||||
var unit = units.FirstOrDefault(x => x.UnitName == item.UnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
WeekPlan.UnitId = unit.UnitId;
|
||||
}
|
||||
WeekPlan.WorkContent = item.WorkContent;
|
||||
WeekPlan.PlanDate = item.PlanDate;
|
||||
var dutyPersons = item.DutyPerson.Split(',');
|
||||
string dutyPersonIds = string.Empty;
|
||||
foreach (var dutyPerson in dutyPersons)
|
||||
{
|
||||
var user = users.FirstOrDefault(x => x.UserName == dutyPerson);
|
||||
if (user != null)
|
||||
{
|
||||
dutyPersonIds = !string.IsNullOrWhiteSpace(dutyPersonIds) ? $"{dutyPersonIds},{user.UserId}" : user.UserId;
|
||||
}
|
||||
}
|
||||
WeekPlan.DutyPerson = dutyPersonIds;
|
||||
//var user = users.FirstOrDefault(x => x.UserName == item.DutyPerson);
|
||||
//if (user != null)
|
||||
//{
|
||||
// WeekPlan.DutyPerson = user.UserId;
|
||||
//}
|
||||
WeekPlan.IsOK = item.IsOK;
|
||||
WeekPlan.Remark = item.Remark;
|
||||
WeekPlan.CompileMan = this.CurrUser.UserId;
|
||||
WeekPlan.CompileDate = DateTime.Now;
|
||||
WeekPlan.SortIndex = i;
|
||||
BLL.WeekPlanService.AddWeekPlan(WeekPlan);
|
||||
i++;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 本周计划
|
||||
|
||||
int j = 1;
|
||||
var list2 = GetDetails2();
|
||||
//string lastWeekNo = "0";
|
||||
//string lastWeekNo = this.txtWeekNo.Text.Trim();
|
||||
foreach (var item in list2)
|
||||
{
|
||||
Model.JDGL_WeekPlan WeekPlan = new Model.JDGL_WeekPlan();
|
||||
WeekPlan.WeekPlanId = item.WeekPlanId;
|
||||
WeekPlan.ProjectId = this.CurrUser.LoginProjectId;
|
||||
//WeekPlan.WeekNo = lastWeekNo;
|
||||
//WeekPlan.StartDate = startDate.AddDays(-7);
|
||||
//WeekPlan.EndDate = endDate.AddDays(-7);
|
||||
WeekPlan.WeekNo = weekNo;
|
||||
WeekPlan.StartDate = startDate;
|
||||
WeekPlan.EndDate = endDate;
|
||||
@@ -230,50 +434,22 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
}
|
||||
WeekPlan.WorkContent = item.WorkContent;
|
||||
WeekPlan.PlanDate = item.PlanDate;
|
||||
var user = users.FirstOrDefault(x => x.UserName == item.DutyPerson);
|
||||
if (user != null)
|
||||
var dutyPersons = item.DutyPerson.Split(',');
|
||||
string dutyPersonIds = string.Empty;
|
||||
foreach (var dutyPerson in dutyPersons)
|
||||
{
|
||||
WeekPlan.DutyPerson = user.UserId;
|
||||
}
|
||||
WeekPlan.IsOK = item.IsOK;
|
||||
WeekPlan.Remark = item.Remark;
|
||||
WeekPlan.CompileMan = this.CurrUser.UserId;
|
||||
WeekPlan.CompileDate = DateTime.Now;
|
||||
WeekPlan.SortIndex = i;
|
||||
BLL.WeekPlanService.AddWeekPlan(WeekPlan);
|
||||
i++;
|
||||
}
|
||||
var list2 = GetDetails2();
|
||||
int j = 1;
|
||||
string lastWeekNo = "0";
|
||||
foreach (var item in list2)
|
||||
{
|
||||
Model.JDGL_WeekPlan WeekPlan = new Model.JDGL_WeekPlan();
|
||||
WeekPlan.WeekPlanId = item.WeekPlanId;
|
||||
WeekPlan.ProjectId = this.CurrUser.LoginProjectId;
|
||||
WeekPlan.WeekNo = lastWeekNo;
|
||||
WeekPlan.StartDate = startDate.AddDays(-7);
|
||||
WeekPlan.EndDate = endDate.AddDays(-7);
|
||||
if (unitWorks.FirstOrDefault(x => x.UnitWorkName == item.UnitWork) != null)
|
||||
{
|
||||
WeekPlan.UnitWork = unitWorks.FirstOrDefault(x => x.UnitWorkName == item.UnitWork).UnitWorkId;
|
||||
}
|
||||
if (cns.FirstOrDefault(x => x.ProfessionalName == item.Major) != null)
|
||||
{
|
||||
WeekPlan.Major = cns.FirstOrDefault(x => x.ProfessionalName == item.Major).CNProfessionalId;
|
||||
}
|
||||
var unit = units.FirstOrDefault(x => x.UnitName == item.UnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
WeekPlan.UnitId = unit.UnitId;
|
||||
}
|
||||
WeekPlan.WorkContent = item.WorkContent;
|
||||
WeekPlan.PlanDate = item.PlanDate;
|
||||
var user = users.FirstOrDefault(x => x.UserName == item.DutyPerson);
|
||||
if (user != null)
|
||||
{
|
||||
WeekPlan.DutyPerson = user.UserId;
|
||||
var user = users.FirstOrDefault(x => x.UserName == dutyPerson);
|
||||
if (user != null)
|
||||
{
|
||||
dutyPersonIds = !string.IsNullOrWhiteSpace(dutyPersonIds) ? $"{dutyPersonIds},{user.UserId}" : user.UserId;
|
||||
}
|
||||
}
|
||||
WeekPlan.DutyPerson = dutyPersonIds;
|
||||
//var user = users.FirstOrDefault(x => x.UserName == item.DutyPerson);
|
||||
//if (user != null)
|
||||
//{
|
||||
// WeekPlan.DutyPerson = user.UserId;
|
||||
//}
|
||||
WeekPlan.IsOK = item.IsOK;
|
||||
WeekPlan.Remark = item.Remark;
|
||||
WeekPlan.CompileMan = this.CurrUser.UserId;
|
||||
@@ -290,6 +466,9 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//foreach (JObject mergedRow in Grid2.GetMergedData())
|
||||
//{
|
||||
// JObject values = mergedRow.Value<JObject>("values");
|
||||
@@ -306,9 +485,28 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口关闭事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
NextWeekGrid();
|
||||
}
|
||||
/// <summary>
|
||||
/// 窗口关闭事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window2_Close(object sender, EventArgs e)
|
||||
{
|
||||
ThisWeekGrid();
|
||||
}
|
||||
|
||||
#region 增加按钮事件
|
||||
/// <summary>
|
||||
/// 增加按钮事件
|
||||
/// 增加按钮事件——下周计划
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
@@ -338,8 +536,30 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
};
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加按钮事件
|
||||
/// 选择其他周计划新增到下周计划
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSelectWeekPlan_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeekPlanSelect.aspx?WeekNo={0}", this.NextWeekNo), "选择下周计划"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择其他周计划新增到本周计划
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSelectWeekPlan2_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WeekPlanSelect.aspx?WeekNo={0}", this.ThisWeekNo), "选择本周计划"));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 增加按钮事件——本周计划
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
@@ -369,6 +589,11 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
};
|
||||
Grid2.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下周计划
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<Model.JDGL_WeekPlan> GetDetails()
|
||||
{
|
||||
List<Model.JDGL_WeekPlan> list = new List<Model.JDGL_WeekPlan>();
|
||||
@@ -393,6 +618,11 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 本周计划
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<Model.JDGL_WeekPlan> GetDetails2()
|
||||
{
|
||||
List<Model.JDGL_WeekPlan> list = new List<Model.JDGL_WeekPlan>();
|
||||
|
||||
Reference in New Issue
Block a user