356 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			356 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| using System.Linq;
 | |
| using System.Web;
 | |
| using System.Web.UI.WebControls;
 | |
| 
 | |
| namespace FineUIPro.Web.ZHGL.Information
 | |
| {
 | |
|     public partial class QuarterlyProjectQuality : PageBase
 | |
|     {
 | |
|         #region 定义变量
 | |
|         /// <summary>
 | |
|         /// 主键
 | |
|         /// </summary>
 | |
|         public string QuarterlyProjectQualityId
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["QuarterlyProjectQualityId"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["QuarterlyProjectQualityId"] = value;
 | |
|             }
 | |
|         }
 | |
| #endregion
 | |
| 
 | |
|         #region 加载页面
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 BLL.ConstValue.InitConstValueDropDownList(this.drpQuarter, ConstValue.Group_0011, false);
 | |
|                 BLL.ConstValue.InitConstValueDropDownList(this.drpYear, ConstValue.Group_0008, false);
 | |
|                 this.drpUnit.DataTextField = "UnitName";
 | |
|                 drpUnit.DataValueField = "UnitId";
 | |
|                 drpUnit.DataSource = BLL.UnitService.GetThisUnitDropDownList();
 | |
|                 drpUnit.DataBind();
 | |
|                 this.drpUnit.Readonly = true;
 | |
|                 DateTime showDate = System.DateTime.Now.AddMonths(-3);
 | |
|                 this.drpQuarter.SelectedValue = Funs.GetNowQuarterlyByTime(showDate).ToString();
 | |
|                 this.drpYear.SelectedValue = showDate.Year.ToString();
 | |
|                 GetValue();
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 清空文本框
 | |
|         private void SetEmpty()
 | |
|         {
 | |
|             this.SimpleForm1.Title = string.Empty;
 | |
|             lbUnitName.Text = string.Empty;
 | |
|             lbResponsiblePerson.Text = string.Empty;
 | |
|             lbCompileMan.Text = string.Empty;
 | |
|             this.lbTel.Text = string.Empty;
 | |
|             this.lbCompileDate.Text = string.Empty;
 | |
|                     }
 | |
|         #endregion
 | |
| 
 | |
|         #region 获取记录值
 | |
|         private void GetValue()
 | |
|         {
 | |
|             int year = Funs.GetNewIntOrZero(drpYear.SelectedValue);
 | |
|             int quarter = Funs.GetNewIntOrZero(drpQuarter.SelectedValue);
 | |
|             this.QuarterlyProjectQualityId = string.Empty;
 | |
|             Model.Information_QuarterlyProjectQuality report = Funs.DB.Information_QuarterlyProjectQuality.FirstOrDefault(e => e.UnitId == drpUnit.SelectedValue && e.Quarter == quarter && e.Year == year);
 | |
|             if (report != null)
 | |
|             {
 | |
|                 string state = string.Empty;
 | |
|                 if (report.UpState == BLL.Const.UpState_3)
 | |
|                 {
 | |
|                     state = "(已上报)";
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     state = "(待上报)";
 | |
|                 }
 | |
|                 this.SimpleForm1.Title = "季度工程项目质量信息表" + state;
 | |
|                 this.QuarterlyProjectQualityId = report.QuarterlyProjectQualityId;
 | |
|                 lbUnitName.Text = "单位:" + BLL.UnitService.GetUnitNameByUnitId(report.UnitId);
 | |
|                 lbResponsiblePerson.Text = "填报单位负责人:" + BLL.UserService.GetUserNameByUserId(report.ResponsiblePerson);
 | |
|                 lbCompileMan.Text = "填报人:" + BLL.UserService.GetUserNameByUserId(report.CompileMan);
 | |
|                 lbTel.Text = "联系电话:" + report.Tel;
 | |
|                 lbCompileDate.Text = report.CompileDate.HasValue ? "填报日期:" + string.Format("{0:yyyy-MM-dd}", report.CompileDate) : "";
 | |
| 
 | |
|                 this.txtQualityManagePersonNum.Text = report.QualityManagePersonNum.HasValue ? report.QualityManagePersonNum.ToString() : "";
 | |
|                 this.txtAdvancedTitlePersonNum.Text = report.AdvancedTitlePersonNum.HasValue ? report.AdvancedTitlePersonNum.ToString() : "";
 | |
|                 this.txtIntermediateTitlePersonNum.Text = report.IntermediateTitlePersonNum.HasValue ? report.IntermediateTitlePersonNum.ToString() : "";
 | |
|                 this.txtBeImplementedProjectNum.Text = report.BeImplementedProjectNum.HasValue ? report.BeImplementedProjectNum.ToString() : "";
 | |
|                 this.txtStartImplementedProjectNum.Text = report.StartImplementedProjectNum.HasValue ? report.StartImplementedProjectNum.ToString() : "";
 | |
|                 this.txtAccumulativeStartImplemented.Text = report.AccumulativeStartImplemented.HasValue ? report.AccumulativeStartImplemented.ToString() : "";
 | |
|                 this.txtCompleteProjectNum.Text = report.CompleteProjectNum.HasValue ? report.CompleteProjectNum.ToString() : "";
 | |
|                 this.txtYearCompleteProjectNum.Text = report.YearCompleteProjectNum.HasValue ? report.YearCompleteProjectNum.ToString() : "";
 | |
|                 this.txtQuarterTotal.Text = report.QuarterTotal.HasValue ? report.QuarterTotal.ToString() : "";
 | |
|                 this.txtQuarterFirstPassNum.Text = report.QuarterFirstPassNum.HasValue ? report.QuarterFirstPassNum.ToString() : "";
 | |
|                 this.txtQuarterFirstPassRate.Text = report.QuarterFirstPassRate.HasValue ? report.QuarterFirstPassRate.ToString() : "";
 | |
|                 this.txtYearTotal.Text = report.YearTotal.HasValue ? report.YearTotal.ToString() : "";
 | |
|                 this.txtYearFirstPassNum.Text = report.YearFirstPassNum.HasValue ? report.YearFirstPassNum.ToString() : "";
 | |
|                 this.txtYearFirstPassRate.Text = report.YearFirstPassRate.HasValue ? report.YearFirstPassRate.ToString() : "";
 | |
|                 this.txtQuaterCheckSuperviseNum.Text = report.QuaterCheckSuperviseNum.HasValue ? report.QuaterCheckSuperviseNum.ToString() : "";
 | |
|                 this.txtQuaterCorrectiveNoticeNum.Text = report.QuaterCorrectiveNoticeNum.HasValue ? report.QuaterCorrectiveNoticeNum.ToString() : "";
 | |
|                 this.txtQuaterQualityProblemNum.Text = report.QuaterQualityProblemNum.HasValue ? report.QuaterQualityProblemNum.ToString() : "";
 | |
|                 this.txtQuaterClosedQualityProblemNum.Text = report.QuaterClosedQualityProblemNum.HasValue ? report.QuaterClosedQualityProblemNum.ToString() : "";
 | |
|                 this.txtYearCheckSuperviseNum.Text = report.YearCheckSuperviseNum.HasValue ? report.YearCheckSuperviseNum.ToString() : "";
 | |
|                 this.txtYearCorrectiveNoticeNum.Text = report.YearCorrectiveNoticeNum.HasValue ? report.YearCorrectiveNoticeNum.ToString() : "";
 | |
|                 this.txtYearQualityProblemNum.Text = report.YearQualityProblemNum.HasValue ? report.YearQualityProblemNum.ToString() : "";
 | |
|                 this.txtYearClosedQualityProblemNum.Text = report.YearClosedQualityProblemNum.HasValue ? report.YearClosedQualityProblemNum.ToString() : "";
 | |
|                 this.txtQuaterQualityAccidentNum.Text = report.QuaterQualityAccidentNum.HasValue ? report.QuaterQualityAccidentNum.ToString() : "";
 | |
|                 this.txtQuaterDirectEconomicLoss.Text = report.QuaterDirectEconomicLoss.HasValue ? report.QuaterDirectEconomicLoss.ToString() : "";
 | |
|                 this.txtYearQualityAccidentNum.Text = report.YearQualityAccidentNum.HasValue ? report.YearQualityAccidentNum.ToString() : "";
 | |
|                 this.txtYearDirectEconomicLoss.Text = report.YearDirectEconomicLoss.HasValue ? report.YearDirectEconomicLoss.ToString() : "";
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 SetEmpty();
 | |
|             }
 | |
|             this.GetButtonPower();
 | |
|         }
 | |
|         #endregion        
 | |
| 
 | |
|         #region 增加、修改、删除、上报按钮事件
 | |
|         /// <summary>
 | |
|         /// Tree增加按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnNew_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QuarterlyProjectQualityEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}", this.CurrUser.UnitId, this.drpYear.SelectedValue, this.drpQuarter.SelectedValue, "编辑 - ")));
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 显示编辑页面
 | |
|         /// </summary>
 | |
|         private void ShowEdit()
 | |
|         {
 | |
|             Model.Information_QuarterlyProjectQuality report = BLL.QuarterlyProjectQualityService.GetQuarterlyProjectQualityByUnitIdAndYearAndQuarter(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue), Funs.GetNewIntOrZero(drpQuarter.SelectedValue));
 | |
|             if (report == null)
 | |
|             {
 | |
|                 Alert.ShowInTop("所选时间无报表记录!", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QuarterlyProjectQualityEdit.aspx?QuarterlyProjectQualityId={0}", report.QuarterlyProjectQualityId, "编辑 - ")));
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Tree编辑按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnEdit_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             ShowEdit();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 上报
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnUpdata_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             ShowEdit();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Tree删除按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnDelete_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             Model.Information_QuarterlyProjectQuality report = BLL.QuarterlyProjectQualityService.GetQuarterlyProjectQualityByUnitIdAndYearAndQuarter(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue), Funs.GetNewIntOrZero(drpQuarter.SelectedValue));
 | |
|             if (report != null)
 | |
|             {
 | |
|                 BLL.LogService.AddSys_Log(this.CurrUser, report.Year.ToString() + "-" + report.Quarter.ToString(),
 | |
|                         report.QuarterlyProjectQualityId, BLL.Const.QuarterlyProjectQualityMenuId, BLL.Const.BtnDelete);
 | |
|                BLL.QuarterlyProjectQualityService.DeleteQuarterlyProjectQualityById(report.QuarterlyProjectQualityId);
 | |
| 
 | |
|                 SetEmpty();
 | |
|                 this.btnNew.Hidden = false;
 | |
|                 ShowNotify("删除数据成功!", MessageBoxIcon.Success);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 ShowNotify("所选时间无报表记录!", MessageBoxIcon.Warning);
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 关闭窗口        
 | |
|         /// <summary>
 | |
|         /// 关闭Grid1弹出窗口
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             GetValue();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 获取按钮权限
 | |
|         /// <summary>
 | |
|         /// 获取按钮权限
 | |
|         /// </summary>
 | |
|         /// <param name="button"></param>
 | |
|         /// <returns></returns>
 | |
|         private void GetButtonPower()
 | |
|         {
 | |
|             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.QuarterlyProjectQualityMenuId);
 | |
|             if (buttonList.Count() > 0)
 | |
|             {
 | |
|                 if (buttonList.Contains(BLL.Const.BtnAdd))
 | |
|                 {
 | |
|                     this.btnNew.Hidden = false;
 | |
|                 }
 | |
|                 if (buttonList.Contains(BLL.Const.BtnModify))
 | |
|                 {
 | |
|                     this.btnEdit.Hidden = false;
 | |
|                 }
 | |
|                 if (buttonList.Contains(BLL.Const.BtnDelete))
 | |
|                 {
 | |
|                     this.btnDelete.Hidden = false;
 | |
|                 }
 | |
|                 int year = Funs.GetNewIntOrZero(this.drpYear.SelectedValue);
 | |
|                 int quarter = Funs.GetNewIntOrZero(this.drpQuarter.SelectedValue);
 | |
|                 var report = BLL.QuarterlyProjectQualityService.GetQuarterlyProjectQualityByUnitIdAndYearAndQuarter(this.drpUnit.SelectedValue, year, quarter);
 | |
|                 this.btnUpdata.Hidden = true;
 | |
|                 if (report != null)
 | |
|                 {
 | |
|                     this.btnNew.Hidden = true;
 | |
|                     this.btnUpdata.Hidden = false;
 | |
| 
 | |
|                     if (report.UpState == BLL.Const.UpState_3)
 | |
|                     {
 | |
|                         this.btnUpdata.Hidden = true;
 | |
|                         this.btnEdit.Hidden = true;
 | |
|                         this.btnDelete.Hidden = true;
 | |
|                     }
 | |
|                     if (report.CompileMan == this.CurrUser.UserId)
 | |
|                     {
 | |
|                         this.btnEdit.Hidden = false;
 | |
|                     }
 | |
|                     else
 | |
|                     {
 | |
|                         this.btnEdit.Hidden = true;
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             if (this.CurrUser.UserId == BLL.Const.sysglyId)
 | |
|             {
 | |
|                 this.btnDelete.Hidden = false;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 单位下拉框联动事件
 | |
|         /// <summary>
 | |
|         /// 单位下拉框联动事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             GetValue();
 | |
|         }
 | |
|         #endregion        
 | |
| 
 | |
|         #region 季度向前/向后
 | |
|         /// <summary>
 | |
|         /// 前一季度
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void BtnBulletLeft_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             SetMonthChange("-");
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 后一季度
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void BulletRight_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             SetMonthChange("+");
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 季度加减变化
 | |
|         /// </summary>
 | |
|         /// <param name="type"></param>
 | |
|         private void SetMonthChange(string type)
 | |
|         {
 | |
|             DateTime? nowDate = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + (Funs.GetNewIntOrZero(this.drpQuarter.SelectedValue) * 3).ToString());
 | |
|             if (nowDate.HasValue)
 | |
|             {
 | |
|                 DateTime showDate = new DateTime();
 | |
|                 if (type == "+")
 | |
|                 {
 | |
|                     showDate = nowDate.Value.AddMonths(3);
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     showDate = nowDate.Value.AddMonths(-3);
 | |
|                 }
 | |
| 
 | |
|                 this.drpYear.SelectedValue = showDate.Year.ToString();
 | |
|                 this.drpQuarter.SelectedValue = Funs.GetNowQuarterlyByTime(showDate).ToString();
 | |
|                 ///值变化
 | |
|                 GetValue();
 | |
|             }
 | |
|         }
 | |
|         #endregion       
 | |
| 
 | |
|         #region 查看未上报的项目
 | |
|         /// <summary>
 | |
|         /// 查看未上报的项目
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnView_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string info = string.Empty;
 | |
|             int year = Convert.ToInt32(this.drpYear.SelectedValue);
 | |
|             int quarter = Convert.ToInt32(this.drpQuarter.SelectedValue);
 | |
|             var projects = (from x in Funs.DB.Base_Project
 | |
|                             where (x.ProjectState == BLL.Const.ProjectState_1 || x.ProjectState == null)
 | |
|                             && x.ProjectAttribute == "GONGCHENG"
 | |
|                             && x.StartDate.Value.Year <= year
 | |
|                             select x).ToList();
 | |
|             foreach (var item in projects)
 | |
|             {
 | |
|                 var report = Funs.DB.InformationProject_QuarterlyProjectQuality.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.Year == year && x.Quarter == quarter);
 | |
|                 if (report == null)
 | |
|                 {
 | |
|                     info += item.ProjectCode + ":" + item.ProjectName + ",未填写报表;</br>";
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             if (!string.IsNullOrEmpty(info))
 | |
|             {
 | |
|                 Alert.ShowInTop(info + "项目报表未上报。", MessageBoxIcon.Warning);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 ShowNotify("项目报表已上报", MessageBoxIcon.Success);
 | |
|             }
 | |
| 
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |