494 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			494 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL; | |||
|  | using BLL.CQMS.Comprehensive; | |||
|  | using System; | |||
|  | using System.Linq; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.CQMS.Comprehensive | |||
|  | { | |||
|  |     public partial class InspectionMachineEdit : PageBase | |||
|  |     { | |||
|  |         #region 定义变量 | |||
|  |         /// <summary> | |||
|  |         /// 主键 | |||
|  |         /// </summary> | |||
|  |         public string InspectionMachineId | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return (string)ViewState["InspectionMachineId"]; | |||
|  |             } | |||
|  |             set | |||
|  |             { | |||
|  |                 ViewState["InspectionMachineId"] = 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.UnitService.InitUnitDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true); | |||
|  | 
 | |||
|  |                 if (CurrUser.UnitId == null || CurrUser.UserId == Const.sysglyId||CurrUser.UnitId== Const.UnitId_TCC) | |||
|  |                 { | |||
|  |                     this.drpUnitId.Enabled = true; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     drpUnitId.SelectedValue = CurrUser.UnitId; | |||
|  |                     this.drpUnitId.Enabled = false; | |||
|  |                 } | |||
|  |                 BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true); | |||
|  |                 LoadAuditSelect(); | |||
|  |                 this.agree.Hidden = true; | |||
|  |                 this.options.Hidden = true; | |||
|  |                  | |||
|  |                 this.btnSave.Hidden = true; | |||
|  |                 this.btnSubmit.Hidden = true; | |||
|  |                 this.InspectionMachineId = Request.Params["InspectionMachineId"]; | |||
|  |                 Model.Comprehensive_InspectionMachine inspectionMachine = BLL.InspectionMachineService.GetInspectionMachineById(this.InspectionMachineId); | |||
|  |                 if (inspectionMachine != null) | |||
|  |                 { | |||
|  |                     this.InspectionMachineId = inspectionMachine.InspectionMachineId; | |||
|  |                     this.hdAttachUrl.Text = this.InspectionMachineId; | |||
|  |                     if (!string.IsNullOrEmpty(inspectionMachine.UnitId)) | |||
|  |                     { | |||
|  |                         this.drpUnitId.SelectedValue = inspectionMachine.UnitId; | |||
|  |                     } | |||
|  |                     if (!string.IsNullOrEmpty(inspectionMachine.CNProfessionalId)) | |||
|  |                     { | |||
|  |                         this.drpCNProfessionalId.SelectedValue = inspectionMachine.CNProfessionalId; | |||
|  |                     } | |||
|  |                     this.rblInspectionType.SelectedValue = inspectionMachine.InspectionType;                    | |||
|  |                     this.txtInspectionMachineCode.Text = inspectionMachine.InspectionMachineCode; | |||
|  |                     this.txtInspectionMachineName.Text = inspectionMachine.InspectionMachineName; | |||
|  |                     this.txtSpecificationModel.Text = inspectionMachine.SpecificationModel; | |||
|  |                     if (inspectionMachine.NextTestDate != null) | |||
|  |                     { | |||
|  |                         this.txtNextTestDate.Text = string.Format("{0:yyyy-MM-dd}", inspectionMachine.NextTestDate); | |||
|  |                     } | |||
|  |                     this.txtTestCycle.Text = inspectionMachine.TestCycle; | |||
|  |                     this.rblIsVerification.SelectedValue = inspectionMachine.IsVerification.HasValue && inspectionMachine.IsVerification == true ? "true" : "false"; | |||
|  |                     this.rblIsCheckOK.SelectedValue = inspectionMachine.IsCheckOK.HasValue && inspectionMachine.IsCheckOK == true ? "true" : "false"; | |||
|  |                     if (inspectionMachine.InspectionDate != null) | |||
|  |                     { | |||
|  |                         this.txtInspectionDate.Text = string.Format("{0:yyyy-MM-dd}", inspectionMachine.InspectionDate); | |||
|  |                     } | |||
|  |                     this.rblIsOnSite.SelectedValue = inspectionMachine.IsOnSite.HasValue && inspectionMachine.IsOnSite == true ? "true" : "false";    | |||
|  |                     if (inspectionMachine.LeaveDate.HasValue) | |||
|  |                     { | |||
|  |                         this.txtLeaveDate.Text = string.Format("{0:yyyy-MM-dd}", inspectionMachine.LeaveDate); | |||
|  |                     } | |||
|  |                     if (inspectionMachine.UnitsCount.HasValue) | |||
|  |                     { | |||
|  |                         this.txtUnitsCount.Text = inspectionMachine.UnitsCount.ToString(); | |||
|  |                     } | |||
|  |                     if (!string.IsNullOrEmpty(inspectionMachine.AuditMan)) | |||
|  |                     { | |||
|  |                         drpAudit.SelectedValue = inspectionMachine.AuditMan; | |||
|  |                     } | |||
|  |                     var currApprove = InspectionMachineApproveService.GetCurrentApprove(inspectionMachine.InspectionMachineId); | |||
|  |                     if (currApprove != null) | |||
|  |                     {   //重新编制  编制人 可以 显示 提交 保存按钮 | |||
|  |                         this.drpAudit.SelectedValue = currApprove.ApproveMan; | |||
|  |                         if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile && inspectionMachine.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 (inspectionMachine.Status == BLL.Const.Comprehensive_Compile && inspectionMachine.CompileMan == CurrUser.UserId) | |||
|  |                         { | |||
|  |                             this.btnSubmit.Hidden = false; | |||
|  |                             this.btnSave.Hidden = false; | |||
|  |                         } | |||
|  |                     } | |||
|  | 
 | |||
|  | 
 | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     this.txtInspectionDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); | |||
|  |                     this.btnSave.Hidden = false; | |||
|  |                     this.btnSubmit.Hidden = false; | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 禁止编辑 | |||
|  |         /// </summary> | |||
|  |         public void Readonly() | |||
|  |         { | |||
|  |             this.txtInspectionDate.Readonly = true; | |||
|  |             this.drpUnitId.Readonly = true; | |||
|  |             this.drpCNProfessionalId.Readonly = true; | |||
|  |             this.txtInspectionMachineCode.Readonly = true; | |||
|  |             this.txtInspectionMachineName.Readonly = true; | |||
|  |             this.txtLeaveDate.Readonly = true; | |||
|  |             this.txtNextTestDate.Readonly = true; | |||
|  |             this.txtInspectionDate.Readonly = true; | |||
|  |             this.txtSpecificationModel.Readonly = true; | |||
|  |             this.txtTestCycle.Readonly = true; | |||
|  |             this.txtUnitsCount.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.drpUnitId.SelectedValue == BLL.Const._Null) | |||
|  |             { | |||
|  |                 Alert.ShowInTop("请选择报验单位!", MessageBoxIcon.Warning); | |||
|  |                 return; | |||
|  |             } | |||
|  |             Model.Comprehensive_InspectionMachine inspectionMachone = new Model.Comprehensive_InspectionMachine(); | |||
|  |             inspectionMachone.ProjectId = this.CurrUser.LoginProjectId; | |||
|  |             if (this.drpUnitId.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 inspectionMachone.UnitId = this.drpUnitId.SelectedValue; | |||
|  |             } | |||
|  |             if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 inspectionMachone.CNProfessionalId = this.drpCNProfessionalId.SelectedValue; | |||
|  |             } | |||
|  |             inspectionMachone.InspectionType = this.rblInspectionType.SelectedValue; | |||
|  |             inspectionMachone.InspectionMachineCode = this.txtInspectionMachineCode.Text.Trim(); | |||
|  |             inspectionMachone.InspectionMachineName = this.txtInspectionMachineName.Text.Trim(); | |||
|  |             inspectionMachone.SpecificationModel = this.txtSpecificationModel.Text.Trim(); | |||
|  |             inspectionMachone.NextTestDate = Funs.GetNewDateTime(this.txtNextTestDate.Text); | |||
|  |             inspectionMachone.TestCycle = this.txtTestCycle.Text.Trim(); | |||
|  |             inspectionMachone.IsVerification = this.rblIsVerification.SelectedValue == "true" ? true : false; | |||
|  |             inspectionMachone.IsCheckOK = this.rblIsCheckOK.SelectedValue == "true" ? true : false; | |||
|  |             inspectionMachone.InspectionDate = Funs.GetNewDateTime(this.txtInspectionDate.Text); | |||
|  |             inspectionMachone.IsOnSite = this.rblIsOnSite.SelectedValue == "true" ? true : false; | |||
|  |             inspectionMachone.LeaveDate = Funs.GetNewDateTime(this.txtLeaveDate.Text); | |||
|  |             inspectionMachone.UnitsCount = Funs.GetNewInt(this.txtUnitsCount.Text.Trim()); | |||
|  |             if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue)) | |||
|  |             { | |||
|  |                 inspectionMachone.AuditMan = drpAudit.SelectedValue; | |||
|  |             }   //审核人 | |||
|  |             if (string.IsNullOrEmpty(this.InspectionMachineId)) | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(this.hdAttachUrl.Text)) | |||
|  |                 { | |||
|  |                     inspectionMachone.InspectionMachineId = this.hdAttachUrl.Text; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     inspectionMachone.InspectionMachineId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionMachine)); | |||
|  |                     this.hdAttachUrl.Text = inspectionMachone.InspectionMachineId; | |||
|  |                 } | |||
|  | 
 | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == inspectionMachone.InspectionMachineId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 inspectionMachone.CompileMan = this.CurrUser.UserId; | |||
|  |                 inspectionMachone.CompileDate = DateTime.Now; | |||
|  |                 inspectionMachone.Status = BLL.Const.Comprehensive_Compile; | |||
|  |                 BLL.InspectionMachineService.AddInspectionMachine(inspectionMachone); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 inspectionMachone.InspectionMachineId = this.InspectionMachineId; | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.InspectionMachineId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  | 
 | |||
|  |                 var model = Funs.DB.Comprehensive_InspectionMachine.Where(u => u.InspectionMachineId == this.InspectionMachineId).FirstOrDefault(); | |||
|  |                 if (model != null) | |||
|  |                 { | |||
|  | 
 | |||
|  |                     inspectionMachone.Status = model.Status; | |||
|  |                 } | |||
|  | 
 | |||
|  |                 BLL.InspectionMachineService.UpdateInspectionMachine(inspectionMachone); | |||
|  |             }  | |||
|  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         protected void btnSubmit_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (this.drpUnitId.SelectedValue == BLL.Const._Null) | |||
|  |             { | |||
|  |                 Alert.ShowInTop("请选择报验单位!", MessageBoxIcon.Warning); | |||
|  |                 return; | |||
|  |             } | |||
|  |             Model.Comprehensive_InspectionMachine inspectionMachone = new Model.Comprehensive_InspectionMachine(); | |||
|  |             inspectionMachone.ProjectId = this.CurrUser.LoginProjectId; | |||
|  |             if (this.drpUnitId.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 inspectionMachone.UnitId = this.drpUnitId.SelectedValue; | |||
|  |             } | |||
|  |             if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 inspectionMachone.CNProfessionalId = this.drpCNProfessionalId.SelectedValue; | |||
|  |             } | |||
|  |             inspectionMachone.InspectionType = this.rblInspectionType.SelectedValue; | |||
|  |             inspectionMachone.InspectionMachineCode = this.txtInspectionMachineCode.Text.Trim(); | |||
|  |             inspectionMachone.InspectionMachineName = this.txtInspectionMachineName.Text.Trim(); | |||
|  |             inspectionMachone.SpecificationModel = this.txtSpecificationModel.Text.Trim(); | |||
|  |             inspectionMachone.NextTestDate = Funs.GetNewDateTime(this.txtNextTestDate.Text); | |||
|  |             inspectionMachone.TestCycle = this.txtTestCycle.Text.Trim(); | |||
|  |             inspectionMachone.IsVerification = this.rblIsVerification.SelectedValue == "true" ? true : false; | |||
|  |             inspectionMachone.IsCheckOK = this.rblIsCheckOK.SelectedValue == "true" ? true : false; | |||
|  |             inspectionMachone.InspectionDate = Funs.GetNewDateTime(this.txtInspectionDate.Text); | |||
|  |             inspectionMachone.IsOnSite = this.rblIsOnSite.SelectedValue == "true" ? true : false; | |||
|  |             inspectionMachone.LeaveDate = Funs.GetNewDateTime(this.txtLeaveDate.Text); | |||
|  |             inspectionMachone.UnitsCount = Funs.GetNewInt(this.txtUnitsCount.Text.Trim()); | |||
|  |             if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue)) | |||
|  |             { | |||
|  |                 inspectionMachone.AuditMan = drpAudit.SelectedValue; | |||
|  |             }   //审核人 | |||
|  |             if (string.IsNullOrEmpty(this.InspectionMachineId)) | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(this.hdAttachUrl.Text)) | |||
|  |                 { | |||
|  |                     inspectionMachone.InspectionMachineId = this.hdAttachUrl.Text; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     inspectionMachone.InspectionMachineId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionMachine)); | |||
|  |                     this.hdAttachUrl.Text = inspectionMachone.InspectionMachineId; | |||
|  |                 } | |||
|  | 
 | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == inspectionMachone.InspectionMachineId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 inspectionMachone.CompileMan = this.CurrUser.UserId; | |||
|  |                 inspectionMachone.CompileDate = DateTime.Now; | |||
|  |                 inspectionMachone.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                 BLL.InspectionMachineService.AddInspectionMachine(inspectionMachone); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 inspectionMachone.InspectionMachineId = this.InspectionMachineId; | |||
|  |                 var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.InspectionMachineId); | |||
|  |                 if (sour == null || string.IsNullOrEmpty(sour.AttachUrl)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 //BLL.InspectionMachineService.UpdateInspectionMachine(inspectionMachone); | |||
|  | 
 | |||
|  |                 var oldInspectionMachine = Funs.DB.Comprehensive_InspectionMachine.Where(u => u.InspectionMachineId == this.InspectionMachineId).FirstOrDefault(); | |||
|  |                 if (oldInspectionMachine == null) //数据库没有记录 直接点提交 当前状态为 审核状态 | |||
|  |                 { | |||
|  |                     inspectionMachone.CompileMan = this.CurrUser.UserId; | |||
|  |                     inspectionMachone.CompileDate = DateTime.Now; | |||
|  |                     inspectionMachone.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                     BLL.InspectionMachineService.AddInspectionMachine(inspectionMachone); | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     inspectionMachone.CompileMan = oldInspectionMachine.CompileMan; | |||
|  |                     inspectionMachone.CompileDate = oldInspectionMachine.CompileDate; | |||
|  |                     if (oldInspectionMachine.Status == BLL.Const.Comprehensive_Compile)//编制状态提交变审核 | |||
|  |                     { | |||
|  |                         inspectionMachone.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                     } | |||
|  |                     else if (oldInspectionMachine.Status == BLL.Const.Comprehensive_ReCompile)//重新编制状态提交变审核 | |||
|  |                     { | |||
|  |                         inspectionMachone.Status = BLL.Const.Comprehensive_Audit; | |||
|  |                     } | |||
|  |                     else //审核状态  提交 变 完成 或者 重新编制 | |||
|  |                     { | |||
|  |                         if (Convert.ToBoolean(rblIsAgree.SelectedValue)) | |||
|  |                         { | |||
|  |                             inspectionMachone.Status = BLL.Const.Comprehensive_Complete; | |||
|  |                         } | |||
|  |                         else | |||
|  |                         { | |||
|  |                             inspectionMachone.Status = BLL.Const.Comprehensive_ReCompile; | |||
|  |                         } | |||
|  |                     } | |||
|  | 
 | |||
|  |                     BLL.InspectionMachineService.UpdateInspectionMachine(inspectionMachone); | |||
|  | 
 | |||
|  |                 } | |||
|  | 
 | |||
|  |             } | |||
|  |             #region 审核记录 | |||
|  | 
 | |||
|  |             var currApprove = InspectionMachineApproveService.GetCurrentApprove(inspectionMachone.InspectionMachineId); | |||
|  |             if (currApprove == null) //为获取到为 当前编制状态 直接提交 | |||
|  |             { | |||
|  |                 var approve = new Model.Comprehensive_InspectionMachineApprove(); | |||
|  |                 approve.InspectionMachineId = inspectionMachone.InspectionMachineId; | |||
|  |                 approve.ApproveMan = this.CurrUser.UserId; | |||
|  |                 approve.ApproveType = Const.Comprehensive_Compile; | |||
|  |                 approve.ApproveDate = DateTime.Now; | |||
|  |                 InspectionMachineApproveService.EditApprove(approve);  //新增编制记录 | |||
|  | 
 | |||
|  | 
 | |||
|  |                 Model.Comprehensive_InspectionMachineApprove newApprove = new Model.Comprehensive_InspectionMachineApprove(); | |||
|  |                 newApprove.InspectionMachineId = inspectionMachone.InspectionMachineId; | |||
|  |                 newApprove.ApproveMan = this.drpAudit.SelectedValue; | |||
|  |                 newApprove.ApproveType = Const.InspectionManagement_Audit; | |||
|  |                 InspectionMachineApproveService.EditApprove(newApprove); //新增专业工程师审核记录 | |||
|  | 
 | |||
|  |             } | |||
|  |             else if (currApprove.ApproveMan == CurrUser.UserId) | |||
|  |             { | |||
|  |                 if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile) | |||
|  |                 { | |||
|  |                     currApprove.ApproveDate = DateTime.Now; | |||
|  |                     //currApprove.IsAgree = true; | |||
|  |                     InspectionMachineApproveService.EditApprove(currApprove); //新增专业工程师审核记录 | |||
|  |                     Model.Comprehensive_InspectionMachineApprove newApprove = new Model.Comprehensive_InspectionMachineApprove(); | |||
|  |                     newApprove.InspectionMachineId = inspectionMachone.InspectionMachineId; | |||
|  |                     newApprove.ApproveMan = this.drpAudit.SelectedValue; | |||
|  |                     newApprove.ApproveType = Const.InspectionManagement_Audit; | |||
|  |                     InspectionMachineApproveService.EditApprove(newApprove); //新增专业工程师审核记录 | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     currApprove.ApproveDate = DateTime.Now;  //更新审核时间 | |||
|  |                     currApprove.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue); | |||
|  |                     currApprove.ApproveIdea = this.txtidea.Text; | |||
|  |                     InspectionMachineApproveService.EditApprove(currApprove); | |||
|  | 
 | |||
|  |                     if (Convert.ToBoolean(rblIsAgree.SelectedValue))  //同意时 审批完成 | |||
|  |                     { | |||
|  |                         Model.Comprehensive_InspectionMachineApprove reApprove = new Model.Comprehensive_InspectionMachineApprove(); | |||
|  |                         reApprove.InspectionMachineId = currApprove.InspectionMachineId; | |||
|  |                         reApprove.ApproveDate = DateTime.Now.AddSeconds(10); | |||
|  |                         reApprove.ApproveMan = CurrUser.UserId; | |||
|  |                         reApprove.ApproveType = Const.Comprehensive_Complete; | |||
|  |                        // reApprove.ApproveIdea = txtidea.Text; | |||
|  |                         InspectionMachineApproveService.EditApprove(reApprove); | |||
|  |                     } | |||
|  |                     else | |||
|  |                     { | |||
|  |                         Model.Comprehensive_InspectionMachineApprove reApprove = new Model.Comprehensive_InspectionMachineApprove(); | |||
|  |                         reApprove.InspectionMachineId = currApprove.InspectionMachineId; | |||
|  |                         reApprove.ApproveMan = inspectionMachone.CompileMan; | |||
|  |                         reApprove.ApproveType = Const.Comprehensive_ReCompile; | |||
|  |                         InspectionMachineApproveService.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_InspectionMachine)); | |||
|  |             } | |||
|  |             Model.Comprehensive_InspectionMachine inspectionMachine = BLL.InspectionMachineService.GetInspectionMachineById(this.InspectionMachineId); | |||
|  |             if (inspectionMachine == null || ((inspectionMachine.CompileMan == CurrUser.UserId && inspectionMachine.Status == BLL.Const.Comprehensive_Compile) || (inspectionMachine.CompileMan == CurrUser.UserId && inspectionMachine.Status == BLL.Const.Comprehensive_ReCompile))) | |||
|  |             { | |||
|  |                 PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/inspectionMachone&menuId={1}", this.hdAttachUrl.Text, BLL.Const.InspectionMachineMenuId))); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/CQMS/inspectionMachone&menuId={1}", this.hdAttachUrl.Text, BLL.Const.InspectionMachineMenuId))); | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 获取按钮权限 | |||
|  |         /// <summary> | |||
|  |         /// 获取按钮权限 | |||
|  |         /// </summary> | |||
|  |         /// <param name="button"></param> | |||
|  |         /// <returns></returns> | |||
|  |         private void GetButtonPower() | |||
|  |         { | |||
|  |             if (Request.Params["value"] == "0") | |||
|  |             { | |||
|  |                 return; | |||
|  |             } | |||
|  |             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.InspectionMachineMenuId); | |||
|  |             if (buttonList.Count > 0) | |||
|  |             { | |||
|  |                 if (buttonList.Contains(BLL.Const.BtnSave)) | |||
|  |                 { | |||
|  |                     this.btnSave.Hidden = false; | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  |     } | |||
|  | } |