544 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			544 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL; | |||
|  | using BLL.CQMS.Comprehensive; | |||
|  | using System; | |||
|  | using System.Linq; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.CQMS.Comprehensive | |||
|  | { | |||
|  |     public partial class NCRManagementEdit : PageBase | |||
|  |     { | |||
|  |         #region 定义变量 | |||
|  |         /// <summary> | |||
|  |         /// 主键 | |||
|  |         /// </summary> | |||
|  |         public string NCRManagementId | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return (string)ViewState["NCRManagementId"]; | |||
|  |             } | |||
|  |             set | |||
|  |             { | |||
|  |                 ViewState["NCRManagementId"] = value; | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 加载 | |||
|  |         /// <summary> | |||
|  |         /// 加载页面 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 GetButtonPower(); | |||
|  |                 BLL.UnitWorkService.InitUnitWorkDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, false); | |||
|  |                 BLL.UnitService.InitUnitDownList(this.drpUnitIds, this.CurrUser.LoginProjectId, false); | |||
|  |                 BLL.UnitService.InitUnitDownList(this.drpSendUnit, this.CurrUser.LoginProjectId, true); | |||
|  |                 BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true); | |||
|  |                 LoadAuditSelect(); | |||
|  |                 this.agree.Hidden = true; | |||
|  |                 this.options.Hidden = true; | |||
|  |                  | |||
|  |                 this.btnSave.Hidden = true; | |||
|  |                 this.btnSubmit.Hidden = true; | |||
|  |                 this.NCRManagementId = Request.Params["NCRManagementId"]; | |||
|  |                 Model.Comprehensive_NCRManagement nCRManagement = BLL.NCRManagementService.GetNCRManagementById(this.NCRManagementId); | |||
|  |                 if (nCRManagement != null) | |||
|  |                 { | |||
|  |                     this.NCRManagementId = nCRManagement.NCRManagementId; | |||
|  |                     this.hdAttachUrl.Text = this.NCRManagementId; | |||
|  |                     if (!string.IsNullOrEmpty(nCRManagement.SendUnit)) | |||
|  |                     { | |||
|  |                         this.drpSendUnit.SelectedValue = nCRManagement.SendUnit; | |||
|  |                     } | |||
|  |                     if (!string.IsNullOrEmpty(nCRManagement.CNProfessionalId)) | |||
|  |                     { | |||
|  |                         this.drpCNProfessionalId.SelectedValue = nCRManagement.CNProfessionalId; | |||
|  |                     } | |||
|  |                     this.txtNCRCode.Text = nCRManagement.NCRCode; | |||
|  |                     this.txtContents.Text = nCRManagement.Contents; | |||
|  |                     if (nCRManagement.IssuedDate != null) | |||
|  |                     { | |||
|  |                         this.txtIssuedDate.Text = string.Format("{0:yyyy-MM-dd}", nCRManagement.IssuedDate); | |||
|  |                     } | |||
|  |                     if (!string.IsNullOrEmpty(nCRManagement.UnitWorkId)) | |||
|  |                     { | |||
|  |                         this.drpUnitWorkIds.SelectedValueArray = nCRManagement.UnitWorkId.Split(','); | |||
|  |                     } | |||
|  |                     if (!string.IsNullOrEmpty(nCRManagement.ReceiveUnit)) | |||
|  |                     { | |||
|  |                         this.drpUnitIds.SelectedValueArray = nCRManagement.ReceiveUnit.Split(','); | |||
|  |                     } | |||
|  |                     if (nCRManagement.ClosedDate != null) | |||
|  |                     { | |||
|  |                         this.txtClosedDate.Text = string.Format("{0:yyyy-MM-dd}", nCRManagement.ClosedDate); | |||
|  |                     } | |||
|  |                     if (nCRManagement.CompleteDate != null) | |||
|  |                     { | |||
|  |                         this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", nCRManagement.CompleteDate); | |||
|  |                     } | |||
|  |                     this.txtResponsibleMan.Text = nCRManagement.ResponsibleMan; | |||
|  |                     this.txtImplementationFrontState.Text = nCRManagement.ImplementationFrontState; | |||
|  | 
 | |||
|  | 
 | |||
|  |                     var currApprove = NCRManagementApproveService.GetCurrentApprove(nCRManagement.NCRManagementId); | |||
|  |                     if (currApprove != null) | |||
|  |                     { | |||
|  |                         this.drpAudit.SelectedValue = currApprove.ApproveMan; | |||
|  |                         //重新编制  编制人 可以 显示 提交 保存按钮 | |||
|  |                         if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile && nCRManagement.CompileMan == CurrUser.UserId) | |||
|  |                         { | |||
|  |                             this.btnSubmit.Hidden = false; | |||
|  |                             this.btnSave.Hidden = false; | |||
|  |                         }//审核状态 审核人 可以显示  提交 保存按钮 | |||
|  |                         else if (currApprove.ApproveType == BLL.Const.Comprehensive_Audit && currApprove.ApproveMan == CurrUser.UserId) | |||
|  |                         { | |||
|  |                             //审核状态不可编辑 | |||
|  |                             Readonly(); | |||
|  | 
 | |||
|  |                             this.agree.Hidden = false; | |||
|  |                             this.options.Hidden = false; | |||
|  |                             this.btnSubmit.Hidden = false; | |||
|  |                             this.btnSave.Hidden = false; | |||
|  |                         } | |||
|  |                     }//没有当前审核人,已完成状态 或者 待提交状态 | |||
|  |                     else | |||
|  |                     { | |||
|  |                         if (nCRManagement.Status == BLL.Const.Comprehensive_Compile && nCRManagement.CompileMan == CurrUser.UserId) | |||
|  |                         { | |||
|  |                             this.btnSubmit.Hidden = false; | |||
|  |                             this.btnSave.Hidden = false; | |||
|  |                         } | |||
|  |                     } | |||
|  | 
 | |||
|  | 
 | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     this.txtIssuedDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); | |||
|  |                     this.txtClosedDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); | |||
|  |                     this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); | |||
|  |                     this.btnSave.Hidden = false; | |||
|  |                     this.btnSubmit.Hidden = false; | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 禁止编辑 | |||
|  |         /// </summary> | |||
|  |         public void Readonly() | |||
|  |         { | |||
|  |             this.txtClosedDate.Readonly = true; | |||
|  |             this.txtCompleteDate.Readonly = true; | |||
|  |             this.drpCNProfessionalId.Readonly = true; | |||
|  |             this.txtContents.Readonly = true; | |||
|  |             this.txtImplementationFrontState.Readonly = true; | |||
|  |             this.txtIssuedDate.Readonly = true; | |||
|  |             this.txtNCRCode.Readonly = true; | |||
|  |             this.txtResponsibleMan.Readonly = true; | |||
|  |             this.drpSendUnit.Readonly = true; | |||
|  |             this.drpUnitIds.Readonly = true; | |||
|  |             this.drpUnitWorkIds.Readonly = true; | |||
|  |             this.drpAudit.Readonly = true;  | |||
|  |             //this.btnAttach.Enabled = false;  | |||
|  |             | |||
|  | 
 | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 加载专业工程师 | |||
|  |         /// </summary> | |||
|  |         public void LoadAuditSelect() | |||
|  |         { | |||
|  | 
 | |||
|  |             var db = Funs.DB; | |||
|  |             var userList = from x in db.Sys_User | |||
|  |                            join y in db.Project_ProjectUnit | |||
|  |                            on x.UnitId equals y.UnitId | |||
|  |                            join p in db.Project_ProjectUser | |||
|  |                            on x.UserId equals p.UserId | |||
|  |                            where y.UnitId == Const.UnitId_TCC && p.ProjectId == CurrUser.LoginProjectId && y.ProjectId == CurrUser.LoginProjectId | |||
|  |                            where p.RoleId.Contains(Const.ZBCNEngineer) | |||
|  |                            select new { UserId = x.UserId, UserName = x.UserName }; | |||
|  |             drpAudit.DataValueField = "UserId"; | |||
|  |             drpAudit.DataTextField = "UserName"; | |||
|  |             this.drpAudit.DataSource = userList.ToList(); | |||
|  |             this.drpAudit.DataBind(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 保存 | |||
|  |         /// <summary> | |||
|  |         /// 保存按钮 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSave_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (this.drpSendUnit.SelectedValue==BLL.Const._Null) | |||
|  |             { | |||
|  |                 Alert.ShowInTop("请选择发出单位!", MessageBoxIcon.Warning); | |||
|  |                 return; | |||
|  |             } | |||
|  |             if (drpCNProfessionalId.SelectedValue == BLL.Const._Null) | |||
|  |             { | |||
|  |                 Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning); | |||
|  |                 return; | |||
|  |             } | |||
|  |             Model.Comprehensive_NCRManagement nCRManagement = new Model.Comprehensive_NCRManagement(); | |||
|  |             nCRManagement.ProjectId = this.CurrUser.LoginProjectId; | |||
|  |             if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue)) | |||
|  |             { | |||
|  |                 nCRManagement.AuditMan = drpAudit.SelectedValue; | |||
|  |             }   //审核人 | |||
|  |             if (this.drpSendUnit.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 nCRManagement.SendUnit = this.drpSendUnit.SelectedValue; | |||
|  |             } | |||
|  |             if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 nCRManagement.CNProfessionalId = this.drpCNProfessionalId.SelectedValue; | |||
|  |             } | |||
|  |             nCRManagement.NCRCode = this.txtNCRCode.Text.Trim(); | |||
|  |             nCRManagement.Contents = this.txtContents.Text.Trim(); | |||
|  |             if (!string.IsNullOrEmpty(this.txtIssuedDate.Text)) | |||
|  |             { | |||
|  |                 nCRManagement.IssuedDate = Convert.ToDateTime(this.txtIssuedDate.Text); | |||
|  |             } | |||
|  | 
 | |||
|  |             if (!string.IsNullOrEmpty(this.txtClosedDate.Text)) | |||
|  |             { | |||
|  |                 nCRManagement.ClosedDate = Convert.ToDateTime(this.txtClosedDate.Text); | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(this.txtCompleteDate.Text)) | |||
|  |             { | |||
|  |                 nCRManagement.CompleteDate = Convert.ToDateTime(this.txtCompleteDate.Text); | |||
|  |             } | |||
|  |             nCRManagement.ResponsibleMan = this.txtResponsibleMan.Text.Trim(); | |||
|  |             nCRManagement.ImplementationFrontState = this.txtImplementationFrontState.Text.Trim(); | |||
|  |             string ids = string.Empty; | |||
|  |             var lists = this.drpUnitWorkIds.SelectedValueArray; | |||
|  |             foreach (var item in lists) | |||
|  |             { | |||
|  |                 ids += item + ","; | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(ids)) | |||
|  |             { | |||
|  |                 ids = ids.Substring(0, ids.LastIndexOf(",")); | |||
|  |             } | |||
|  |             nCRManagement.UnitWorkId = ids; | |||
|  | 
 | |||
|  |             string unitIds = string.Empty; | |||
|  |             var unitList = this.drpUnitIds.SelectedValueArray; | |||
|  |             foreach (var item in unitList) | |||
|  |             { | |||
|  |                 unitIds += item + ","; | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(unitIds)) | |||
|  |             { | |||
|  |                 unitIds = unitIds.Substring(0, unitIds.LastIndexOf(",")); | |||
|  |             } | |||
|  |             nCRManagement.ReceiveUnit = unitIds; | |||
|  |             if (string.IsNullOrEmpty(this.NCRManagementId)) | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(this.hdAttachUrl.Text)) | |||
|  |                 { | |||
|  |                     nCRManagement.NCRManagementId = this.hdAttachUrl.Text; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     nCRManagement.NCRManagementId = SQLHelper.GetNewID(typeof(Model.Comprehensive_NCRManagement)); | |||
|  |                     this.hdAttachUrl.Text = nCRManagement.NCRManagementId; | |||
|  |                 } | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == nCRManagement.NCRManagementId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 nCRManagement.CompileMan = this.CurrUser.UserId; | |||
|  |                 nCRManagement.Status = BLL.Const.Comprehensive_Compile; | |||
|  |                 BLL.NCRManagementService.AddNCRManagement(nCRManagement); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 nCRManagement.NCRManagementId = this.NCRManagementId; | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.NCRManagementId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 var model = Funs.DB.Comprehensive_NCRManagement.Where(u => u.NCRManagementId == this.NCRManagementId).FirstOrDefault(); | |||
|  |                 if (model != null) | |||
|  |                 { | |||
|  |                     nCRManagement.Status = model.Status; | |||
|  |                 } | |||
|  |                 BLL.NCRManagementService.UpdateNCRManagement(nCRManagement); | |||
|  |             } | |||
|  |         | |||
|  |               | |||
|  | 
 | |||
|  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         protected void btnSubmit_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (this.drpSendUnit.SelectedValue == BLL.Const._Null) | |||
|  |             { | |||
|  |                 Alert.ShowInTop("请选择发出单位!", MessageBoxIcon.Warning); | |||
|  |                 return; | |||
|  |             } | |||
|  |             if (drpCNProfessionalId.SelectedValue == BLL.Const._Null) | |||
|  |             { | |||
|  |                 Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning); | |||
|  |                 return; | |||
|  |             } | |||
|  |             Model.Comprehensive_NCRManagement nCRManagement = new Model.Comprehensive_NCRManagement(); | |||
|  |             nCRManagement.ProjectId = this.CurrUser.LoginProjectId; | |||
|  |             if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue)) | |||
|  |             { | |||
|  |                 nCRManagement.AuditMan = drpAudit.SelectedValue; | |||
|  |             }   //审核人 | |||
|  |             if (this.drpSendUnit.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 nCRManagement.SendUnit = this.drpSendUnit.SelectedValue; | |||
|  |             } | |||
|  |             if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 nCRManagement.CNProfessionalId = this.drpCNProfessionalId.SelectedValue; | |||
|  |             } | |||
|  |             nCRManagement.NCRCode = this.txtNCRCode.Text.Trim(); | |||
|  |             nCRManagement.Contents = this.txtContents.Text.Trim(); | |||
|  |             if (!string.IsNullOrEmpty(this.txtIssuedDate.Text)) | |||
|  |             { | |||
|  |                 nCRManagement.IssuedDate = Convert.ToDateTime(this.txtIssuedDate.Text); | |||
|  |             } | |||
|  | 
 | |||
|  |             if (!string.IsNullOrEmpty(this.txtClosedDate.Text)) | |||
|  |             { | |||
|  |                 nCRManagement.ClosedDate = Convert.ToDateTime(this.txtClosedDate.Text); | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(this.txtCompleteDate.Text)) | |||
|  |             { | |||
|  |                 nCRManagement.CompleteDate = Convert.ToDateTime(this.txtCompleteDate.Text); | |||
|  |             } | |||
|  |             nCRManagement.ResponsibleMan = this.txtResponsibleMan.Text.Trim(); | |||
|  |             nCRManagement.ImplementationFrontState = this.txtImplementationFrontState.Text.Trim(); | |||
|  |             string ids = string.Empty; | |||
|  |             var lists = this.drpUnitWorkIds.SelectedValueArray; | |||
|  |             foreach (var item in lists) | |||
|  |             { | |||
|  |                 ids += item + ","; | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(ids)) | |||
|  |             { | |||
|  |                 ids = ids.Substring(0, ids.LastIndexOf(",")); | |||
|  |             } | |||
|  |             nCRManagement.UnitWorkId = ids; | |||
|  | 
 | |||
|  |             string unitIds = string.Empty; | |||
|  |             var unitList = this.drpUnitIds.SelectedValueArray; | |||
|  |             foreach (var item in unitList) | |||
|  |             { | |||
|  |                 unitIds += item + ","; | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(unitIds)) | |||
|  |             { | |||
|  |                 unitIds = unitIds.Substring(0, unitIds.LastIndexOf(",")); | |||
|  |             } | |||
|  |             nCRManagement.ReceiveUnit = unitIds; | |||
|  |             if (string.IsNullOrEmpty(this.NCRManagementId)) | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(this.hdAttachUrl.Text)) | |||
|  |                 { | |||
|  |                     nCRManagement.NCRManagementId = this.hdAttachUrl.Text; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     nCRManagement.NCRManagementId = SQLHelper.GetNewID(typeof(Model.Comprehensive_NCRManagement)); | |||
|  |                     this.hdAttachUrl.Text = nCRManagement.NCRManagementId; | |||
|  |                 } | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == nCRManagement.NCRManagementId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 nCRManagement.CompileMan = this.CurrUser.UserId; | |||
|  |                 nCRManagement.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                 BLL.NCRManagementService.AddNCRManagement(nCRManagement); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 nCRManagement.NCRManagementId = this.NCRManagementId; | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.NCRManagementId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 //BLL.NCRManagementService.UpdateNCRManagement(nCRManagement); | |||
|  |                 var oldNCRManagement = Funs.DB.Comprehensive_NCRManagement.Where(u => u.NCRManagementId == this.NCRManagementId).FirstOrDefault(); | |||
|  |                 if (oldNCRManagement == null) //数据库没有记录 直接点提交 当前状态为 审核状态 | |||
|  |                 { | |||
|  |                     nCRManagement.CompileMan = this.CurrUser.UserId;  | |||
|  |                     nCRManagement.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                     BLL.NCRManagementService.AddNCRManagement(nCRManagement); | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     nCRManagement.CompileMan = oldNCRManagement.CompileMan;  | |||
|  |                     if (oldNCRManagement.Status == BLL.Const.Comprehensive_Compile)//编制状态提交变审核 | |||
|  |                     { | |||
|  |                         nCRManagement.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                     } | |||
|  |                     else if (oldNCRManagement.Status == BLL.Const.Comprehensive_ReCompile)//重新编制状态提交变审核 | |||
|  |                     { | |||
|  |                         nCRManagement.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                     } | |||
|  |                     else //审核状态  提交 变 完成 或者 重新编制 | |||
|  |                     { | |||
|  |                         if (Convert.ToBoolean(rblIsAgree.SelectedValue)) | |||
|  |                         { | |||
|  |                             nCRManagement.Status = BLL.Const.Comprehensive_Complete; | |||
|  |                         } | |||
|  |                         else | |||
|  |                         { | |||
|  |                             nCRManagement.Status = BLL.Const.Comprehensive_ReCompile; | |||
|  |                         } | |||
|  |                     } | |||
|  | 
 | |||
|  |                     BLL.NCRManagementService.UpdateNCRManagement(nCRManagement); | |||
|  | 
 | |||
|  |                 } | |||
|  | 
 | |||
|  |             } | |||
|  |             #region 审核记录 | |||
|  | 
 | |||
|  |             var currApprove = NCRManagementApproveService.GetCurrentApprove(nCRManagement.NCRManagementId); | |||
|  |             if (currApprove == null) //为获取到为 当前编制状态 直接提交 | |||
|  |             { | |||
|  |                 var approve = new Model.Comprehensive_NCRManagementApprove(); | |||
|  |                 approve.NCRManagementId = nCRManagement.NCRManagementId; | |||
|  |                 approve.ApproveMan = this.CurrUser.UserId; | |||
|  |                 approve.ApproveType = Const.Comprehensive_Compile; | |||
|  |                 approve.ApproveDate = DateTime.Now; | |||
|  |                 NCRManagementApproveService.EditApprove(approve);  //新增编制记录 | |||
|  | 
 | |||
|  | 
 | |||
|  |                 Model.Comprehensive_NCRManagementApprove newApprove = new Model.Comprehensive_NCRManagementApprove(); | |||
|  |                 newApprove.NCRManagementId = nCRManagement.NCRManagementId; | |||
|  |                 newApprove.ApproveMan = this.drpAudit.SelectedValue; | |||
|  |                 newApprove.ApproveType = Const.InspectionManagement_Audit; | |||
|  |                 NCRManagementApproveService.EditApprove(newApprove); //新增专业工程师审核记录 | |||
|  | 
 | |||
|  |             } | |||
|  |             else if (currApprove.ApproveMan == CurrUser.UserId) | |||
|  |             { | |||
|  |                 if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile) | |||
|  |                 { | |||
|  |                     currApprove.ApproveDate = DateTime.Now; | |||
|  |                     //currApprove.IsAgree = true; | |||
|  |                     NCRManagementApproveService.EditApprove(currApprove); //新增专业工程师审核记录 | |||
|  |                     Model.Comprehensive_NCRManagementApprove newApprove = new Model.Comprehensive_NCRManagementApprove(); | |||
|  |                     newApprove.NCRManagementId = nCRManagement.NCRManagementId; | |||
|  |                     newApprove.ApproveMan = this.drpAudit.SelectedValue; | |||
|  |                     newApprove.ApproveType = Const.InspectionManagement_Audit; | |||
|  |                     NCRManagementApproveService.EditApprove(newApprove); //新增专业工程师审核记录 | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     currApprove.ApproveDate = DateTime.Now;  //更新审核时间 | |||
|  |                     currApprove.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue); | |||
|  |                     currApprove.ApproveIdea = this.txtidea.Text; | |||
|  |                     NCRManagementApproveService.EditApprove(currApprove); | |||
|  | 
 | |||
|  |                     if (Convert.ToBoolean(rblIsAgree.SelectedValue))  //同意时 审批完成 | |||
|  |                     { | |||
|  |                         Model.Comprehensive_NCRManagementApprove reApprove = new Model.Comprehensive_NCRManagementApprove(); | |||
|  |                         reApprove.NCRManagementId = currApprove.NCRManagementId; | |||
|  |                         reApprove.ApproveDate = DateTime.Now.AddSeconds(10); | |||
|  |                         reApprove.ApproveMan = CurrUser.UserId; | |||
|  |                         reApprove.ApproveType = Const.Comprehensive_Complete; | |||
|  |                        // reApprove.ApproveIdea = txtidea.Text; | |||
|  |                         NCRManagementApproveService.EditApprove(reApprove); | |||
|  |                     } | |||
|  |                     else | |||
|  |                     { | |||
|  |                         Model.Comprehensive_NCRManagementApprove reApprove = new Model.Comprehensive_NCRManagementApprove(); | |||
|  |                         reApprove.NCRManagementId = currApprove.NCRManagementId; | |||
|  |                         reApprove.ApproveMan = nCRManagement.CompileMan; | |||
|  |                         reApprove.ApproveType = Const.Comprehensive_ReCompile; | |||
|  |                         NCRManagementApproveService.EditApprove(reApprove); | |||
|  |                     } | |||
|  |                 } | |||
|  |             } | |||
|  | 
 | |||
|  | 
 | |||
|  |             #endregion | |||
|  | 
 | |||
|  | 
 | |||
|  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 附件上传 | |||
|  |         /// <summary> | |||
|  |         /// 附件上传 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnAttach_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (string.IsNullOrEmpty(this.hdAttachUrl.Text))   //新增记录 | |||
|  |             { | |||
|  |                 this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.Comprehensive_NCRManagement)); | |||
|  |             } | |||
|  |             Model.Comprehensive_NCRManagement nCRManagement = BLL.NCRManagementService.GetNCRManagementById(this.NCRManagementId); | |||
|  |             if (nCRManagement == null || ((nCRManagement.CompileMan == CurrUser.UserId && nCRManagement.Status == BLL.Const.Comprehensive_Compile) || (nCRManagement.CompileMan == CurrUser.UserId && nCRManagement.Status == BLL.Const.Comprehensive_ReCompile))) | |||
|  |             { | |||
|  |                 PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/nCRManagement&menuId={1}", this.hdAttachUrl.Text, BLL.Const.NCRManagementMenuId))); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/CQMS/nCRManagement&menuId={1}", this.hdAttachUrl.Text, BLL.Const.NCRManagementMenuId))); | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 获取按钮权限 | |||
|  |         /// <summary> | |||
|  |         /// 获取按钮权限 | |||
|  |         /// </summary> | |||
|  |         /// <param name="button"></param> | |||
|  |         /// <returns></returns> | |||
|  |         private void GetButtonPower() | |||
|  |         { | |||
|  |             if (Request.Params["value"] == BLL.Const._Null) | |||
|  |             { | |||
|  |                 return; | |||
|  |             } | |||
|  |             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.NCRManagementMenuId); | |||
|  |             if (buttonList.Count() > 0) | |||
|  |             { | |||
|  |                 if (buttonList.Contains(BLL.Const.BtnSave)) | |||
|  |                 { | |||
|  |                     this.btnSave.Hidden = false; | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  |     } | |||
|  | } |