410 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			410 lines
		
	
	
		
			15 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 QualityWorkSummaryReport : PageBase
 | 
						|
    {
 | 
						|
        #region 定义变量
 | 
						|
        /// <summary>
 | 
						|
        /// 主键
 | 
						|
        /// </summary>
 | 
						|
        public string QualityWorkSummaryReportId
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (string)ViewState["QualityWorkSummaryReportId"];
 | 
						|
            }
 | 
						|
            set
 | 
						|
            {
 | 
						|
                ViewState["QualityWorkSummaryReportId"] = value;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 加载页面
 | 
						|
        /// <summary>
 | 
						|
        /// 加载页面
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                this.drpYear.DataTextField = "ConstText";
 | 
						|
                drpYear.DataValueField = "ConstValue";
 | 
						|
                drpYear.DataSource = BLL.ConstValue.drpConstItemList(ConstValue.Group_0008);
 | 
						|
                drpYear.DataBind();
 | 
						|
                this.drpUnit.DataTextField = "UnitName";
 | 
						|
                drpUnit.DataValueField = "UnitId";
 | 
						|
                drpUnit.DataSource = BLL.UnitService.GetThisUnitDropDownList();
 | 
						|
                drpUnit.DataBind();
 | 
						|
                this.drpUnit.Readonly = true;
 | 
						|
                drpYear.SelectedValue = System.DateTime.Now.Year.ToString();
 | 
						|
                GetValue();
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 清空Label
 | 
						|
        /// <summary>
 | 
						|
        /// 清空文本框
 | 
						|
        /// </summary>
 | 
						|
        private void SetEmpty()
 | 
						|
        {
 | 
						|
            this.SimpleForm1.Title = string.Empty;
 | 
						|
            lblUnitName.Text = string.Empty;
 | 
						|
            lblYearId.Text = string.Empty;
 | 
						|
            lblResponsiblePerson.Text = string.Empty;
 | 
						|
            lblResponsiblePersonTel.Text = string.Empty;
 | 
						|
            lblContactPerson.Text = string.Empty;
 | 
						|
            lblContactPersonTel.Text = string.Empty;
 | 
						|
            this.lblReportDate.Text = string.Empty;
 | 
						|
            this.txtValue.Text = HttpUtility.HtmlDecode("无数据");
 | 
						|
            this.SimpleForm1.Title = "质量管理工作总结报告";
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 获取记录值
 | 
						|
        private void GetValue()
 | 
						|
        {
 | 
						|
            this.SetEmpty();
 | 
						|
            int year = Funs.GetNewIntOrZero(drpYear.SelectedValue);
 | 
						|
            Model.Information_QualityWorkSummaryReport report = Funs.DB.Information_QualityWorkSummaryReport.FirstOrDefault(e => e.UnitId == drpUnit.SelectedValue && e.YearId == year);
 | 
						|
            if (report != null)
 | 
						|
            {
 | 
						|
                string upState = string.Empty;
 | 
						|
                if (report.UpState == BLL.Const.UpState_3)
 | 
						|
                {
 | 
						|
                    upState = "(已上报)";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    upState = "(未上报)";
 | 
						|
                }
 | 
						|
                this.SimpleForm1.Title = "质量管理工作总结报告" + upState;
 | 
						|
                if (!string.IsNullOrEmpty(report.UnitId))
 | 
						|
                {
 | 
						|
                    this.lblUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(report.UnitId);
 | 
						|
                }
 | 
						|
                this.lblYearId.Text = report.YearId.ToString();
 | 
						|
 | 
						|
                this.GetTxetValue(report);
 | 
						|
                //if (report.HandleState == BLL.Const.HandleState_1 || report.UpState == BLL.Const.UpState_3)
 | 
						|
                //{
 | 
						|
                //    this.lblHandleMan.Hidden = true;
 | 
						|
                //}
 | 
						|
                //else
 | 
						|
                //{
 | 
						|
                //    if (!string.IsNullOrEmpty(report.HandleMan))
 | 
						|
                //    {
 | 
						|
                //        this.lblHandleMan.Hidden = false;
 | 
						|
                //        this.lblHandleMan.Text = "下一步办理人:" + BLL.UserService.GetUserNameByUserId(report.HandleMan);
 | 
						|
                //    }
 | 
						|
                //}
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                SetEmpty();
 | 
						|
            }
 | 
						|
            this.GetButtonPower();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 得到值
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="report"></param>
 | 
						|
        private void GetTxetValue(Model.Information_QualityWorkSummaryReport report)
 | 
						|
        {
 | 
						|
            this.QualityWorkSummaryReportId = report.QualityWorkSummaryReportId;
 | 
						|
            var unit = BLL.UnitService.GetUnitByUnitId(report.UnitId);
 | 
						|
            string unitTypeName = string.Empty;
 | 
						|
            if (unit != null)
 | 
						|
            {
 | 
						|
                var unitType = BLL.UnitTypeService.GetUnitTypeById(unit.UnitTypeId);
 | 
						|
                if (unitType != null)
 | 
						|
                {
 | 
						|
                    unitTypeName = unitType.UnitTypeName;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            this.lblResponsiblePerson.Text = report.ResponsiblePerson;
 | 
						|
            this.lblResponsiblePersonTel.Text = report.ResponsiblePersonTel;
 | 
						|
            this.lblContactPerson.Text = report.ContactPerson;
 | 
						|
            this.lblContactPersonTel.Text = report.ContactPersonTel;
 | 
						|
            this.lblReportDate.Text = report.ReportDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ReportDate) : "";
 | 
						|
 | 
						|
            string textvalue = string.Empty;
 | 
						|
 | 
						|
            textvalue = "   一、管理绩效\r\n\r\n"
 | 
						|
               + "     1.质量管理绩效(单位工程质量状况等):\r\n" + report.Performance + "\r\n\r\n"
 | 
						|
               + "     2.质量事故情况:\r\n" + report.AccidentSituation + "\r\n\r\n"
 | 
						|
               + "     3.获奖情况:\r\n" + report.Awards + "\r\n\r\n"
 | 
						|
               + "   二、主要工作及亮点\r\n\r\n"
 | 
						|
               + "     1.质量提升行动、质量首件及质量管理重点工作开展情况:\r\n" + report.WorkDevelopment + "\r\n\r\n"
 | 
						|
               + "     2.人员培训情况:\r\n" + report.PersonnelTraining + "\r\n\r\n"
 | 
						|
               + "     3.组织开展质量监督检查情况:\r\n" + report.CheckSituation + "\r\n\r\n"
 | 
						|
               + "     4.质量月等其他管理活动情况:\r\n" + report.ManagementActivity + "\r\n\r\n"
 | 
						|
               + "     5.主要工作经验及亮点:\r\n" + report.WorkExperience + "\r\n\r\n"
 | 
						|
               + "   三、主要问题及应对措施\r\n\r\n"
 | 
						|
               + "     " + report.Countermeasures + "\r\n\r\n"
 | 
						|
               + "   四、下一年度工作计划打算\r\n\r\n"
 | 
						|
               + "     " + report.NextYearWorkPlan + "\r\n\r\n"
 | 
						|
               + "   五、对集团公司的工作建议\r\n\r\n"
 | 
						|
               + "     " + report.JobSuggestion + "\r\n\r\n";
 | 
						|
 | 
						|
            this.txtValue.Text = textvalue;
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 增加、修改、删除、审核、审批、上报
 | 
						|
        /// <summary>
 | 
						|
        /// 增加按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnNew_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QualityWorkSummaryReportEdit.aspx?UnitId={0}&&Year={1}", this.CurrUser.UnitId, this.drpYear.SelectedValue, "编辑 - ")));
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 弹出编辑框
 | 
						|
        /// </summary>
 | 
						|
        private void ShowEdit()
 | 
						|
        {
 | 
						|
            Model.Information_QualityWorkSummaryReport report = BLL.QualityWorkSummaryReportService.GetQualityWorkSummaryReportByUnitIdAndYear(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue));
 | 
						|
            if (report == null)
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("所选时间无报表记录!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QualityWorkSummaryReportEdit.aspx?qualityWorkSummaryReportId={0}", report.QualityWorkSummaryReportId, "编辑 - ")));
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 编辑
 | 
						|
        /// </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 btnAudit1_Click(object sender, EventArgs e)
 | 
						|
        //{
 | 
						|
        //    ShowEdit();
 | 
						|
        //}
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 审批
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        //protected void btnAudit2_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>
 | 
						|
        /// 删除
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnDelete_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            Model.Information_QualityWorkSummaryReport report = BLL.QualityWorkSummaryReportService.GetQualityWorkSummaryReportByUnitIdAndYear(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue));
 | 
						|
            if (report != null)
 | 
						|
            {
 | 
						|
                BLL.LogService.AddSys_Log(this.CurrUser, this.lblYearId.Text, report.QualityWorkSummaryReportId, BLL.Const.QualityWorkSummaryReportMenuId, BLL.Const.BtnDelete);
 | 
						|
 | 
						|
                //BLL.ProjectDataFlowSetService.DeleteFlowSetByDataId(report.QualityWorkSummaryReportId);
 | 
						|
                BLL.QualityWorkSummaryReportService.DeleteQualityWorkSummaryReportById(report.QualityWorkSummaryReportId);
 | 
						|
 | 
						|
                SetEmpty();
 | 
						|
                this.btnNew.Hidden = false;
 | 
						|
                ShowNotify("删除数据成功!(表格数据已重新绑定)", MessageBoxIcon.Success);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                ShowNotify("所选时间无报表记录!", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 关闭弹出窗口
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭编辑弹出窗口
 | 
						|
        /// </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.QualityWorkSummaryReportMenuId);
 | 
						|
            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;
 | 
						|
                }
 | 
						|
                if (buttonList.Contains(BLL.Const.BtnSaveUp))
 | 
						|
                {
 | 
						|
                    this.btnUpdata.Hidden = false;
 | 
						|
                }
 | 
						|
                //if (buttonList.Contains(BLL.Const.BtnIn))
 | 
						|
                //{
 | 
						|
                //    this.btnImport.Hidden = false;
 | 
						|
                //}
 | 
						|
                //if (buttonList.Contains(BLL.Const.BtnPrint))
 | 
						|
                //{
 | 
						|
                //    this.btnPrint.Hidden = false;
 | 
						|
                //}
 | 
						|
                //int year = Funs.GetNewIntOrZero(drpYear.SelectedValue);
 | 
						|
                //int quarter = Funs.GetNewIntOrZero(drpQuarter.SelectedValue);
 | 
						|
                //var report = BLL.QualityWorkSummaryReportService.GetQualityWorkSummaryReportByUnitIdAndYear(this.drpUnit.SelectedValue, year);
 | 
						|
                //this.btnAudit1.Hidden = true;
 | 
						|
                //this.btnAudit2.Hidden = true;
 | 
						|
                //this.btnUpdata.Hidden = true;
 | 
						|
                //if (report != null)
 | 
						|
                //{
 | 
						|
                //    this.btnNew.Hidden = true;
 | 
						|
                //    if (report.HandleMan == this.CurrUser.UserId)   //当前人是下一步办理入
 | 
						|
                //    {
 | 
						|
                //        if (report.HandleState == BLL.Const.HandleState_2)
 | 
						|
                //        {
 | 
						|
                //            this.btnAudit1.Hidden = false;
 | 
						|
                //        }
 | 
						|
                //        else if (report.HandleState == BLL.Const.HandleState_3)
 | 
						|
                //        {
 | 
						|
                //            this.btnAudit2.Hidden = false;
 | 
						|
                //        }
 | 
						|
                //        else if (report.HandleState == BLL.Const.HandleState_4)
 | 
						|
                //        {
 | 
						|
                //            this.btnUpdata.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)
 | 
						|
        {
 | 
						|
            int y = Convert.ToInt32(drpYear.SelectedValue) - 1;
 | 
						|
            drpYear.SelectedValue = y.ToString();
 | 
						|
            GetValue();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 下一年度
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void BtnBulletRight_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            int y = Convert.ToInt32(drpYear.SelectedValue) + 1;
 | 
						|
            drpYear.SelectedValue = y.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 date = Convert.ToInt32(this.drpYear.SelectedValue);
 | 
						|
            var projects = (from x in Funs.DB.Base_Project
 | 
						|
                            where (x.ProjectState == BLL.Const.ProjectState_1 || x.ProjectState == null)
 | 
						|
                           
 | 
						|
                            && x.StartDate.Value.Year <= date
 | 
						|
                            select x).ToList();
 | 
						|
            foreach (var item in projects)
 | 
						|
            {
 | 
						|
                var report = Funs.DB.InformationProject_QualityWorkSummaryReport.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.YearId == date);
 | 
						|
                if (report == null)
 | 
						|
                {
 | 
						|
                    info += item.ProjectCode + ":" + item.ProjectName + ",未填写报表;</br>";
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            if (!string.IsNullOrEmpty(info))
 | 
						|
            {
 | 
						|
                Alert.ShowInTop(info + "项目报表未上报。", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                ShowNotify("项目报表已上报", MessageBoxIcon.Success);
 | 
						|
            }
 | 
						|
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |