/// <summary> /// 添加隐患整改通知单 /// </summary> /// <param name="rectifyNotices"></param> public static void AddRectifyNotices(Model.Check_RectifyNotices rectifyNotices) { Model.Check_RectifyNotices newRectifyNotices = new Model.Check_RectifyNotices { RectifyNoticesId = rectifyNotices.RectifyNoticesId, ProjectId = rectifyNotices.ProjectId, RectifyNoticesCode = rectifyNotices.RectifyNoticesCode, UnitId = rectifyNotices.UnitId, WorkAreaId = rectifyNotices.WorkAreaId, CheckedDate = rectifyNotices.CheckedDate, WrongContent = rectifyNotices.WrongContent, SignPerson = rectifyNotices.SignPerson, SignDate = rectifyNotices.SignDate, CompleteStatus = rectifyNotices.CompleteStatus, DutyPerson = rectifyNotices.DutyPerson, DutyPersonId = rectifyNotices.DutyPersonId, CompleteDate = rectifyNotices.CompleteDate, IsRectify = rectifyNotices.IsRectify, CheckPerson = rectifyNotices.CheckPerson, ReCheckDate = rectifyNotices.ReCheckDate, Isprint = "0", Isprintf = "0" }; db.Check_RectifyNotices.InsertOnSubmit(newRectifyNotices); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectRectifyNoticeMenuId, rectifyNotices.ProjectId, rectifyNotices.UnitId, rectifyNotices.RectifyNoticesId, rectifyNotices.CompleteDate); }
/// <summary> /// 根据主键删除隐患整改通知单 /// </summary> /// <param name="rectifyNoticesId"></param> public static void DeleteRectifyNoticesById(string rectifyNoticesId) { Model.SUBHSSEDB db = Funs.DB; Model.Check_RectifyNotices rectifyNotices = db.Check_RectifyNotices.FirstOrDefault(e => e.RectifyNoticesId == rectifyNoticesId); if (rectifyNotices != null) { CodeRecordsService.DeleteCodeRecordsByDataId(rectifyNoticesId); UploadFileService.DeleteFile(Funs.RootPath, rectifyNotices.AttachUrl); CommonService.DeleteAttachFileById(rectifyNoticesId); var getCheck_RectifyNoticesItem = from x in db.Check_RectifyNoticesItem where x.RectifyNoticesId == rectifyNoticesId select x; if (getCheck_RectifyNoticesItem.Count() > 0) { db.Check_RectifyNoticesItem.DeleteAllOnSubmit(getCheck_RectifyNoticesItem); db.SubmitChanges(); } var getRectifyNoticesFlowOperate = from x in db.Check_RectifyNoticesFlowOperate where x.RectifyNoticesId == rectifyNoticesId select x; if (getRectifyNoticesFlowOperate.Count() > 0) { db.Check_RectifyNoticesFlowOperate.DeleteAllOnSubmit(getRectifyNoticesFlowOperate); db.SubmitChanges(); } db.Check_RectifyNotices.DeleteOnSubmit(rectifyNotices); db.SubmitChanges(); } }
/// <summary> /// 保存数据 /// </summary> /// <param name="p"></param> private void SaveData(bool isColse) { Model.Check_RectifyNotices rectifyNotices = new Model.Check_RectifyNotices { ProjectId = this.ProjectId, RectifyNoticesCode = this.txtRectifyNoticesCode.Text.Trim(), CheckedDate = Funs.GetNewDateTime(this.txtCheckedDate.Text.Trim()), WrongContent = HttpUtility.HtmlEncode(this.txtWrongContent.Text.Trim()), SignDate = Funs.GetNewDateTime(this.txtSignDate.Text.Trim()), CompleteStatus = HttpUtility.HtmlEncode(this.txtCompleteStatus.Text.Trim()), DutyPerson = this.txtDutyPerson.Text.Trim(), CompleteDate = Funs.GetNewDateTime(this.txtCompleteDate.Text.Trim()), IsRectify = Convert.ToBoolean(this.drpIsRectify.SelectedValue), ReCheckDate = Funs.GetNewDateTime(this.txtReCheckDate.Text.Trim()), }; if (this.drpUnitId.SelectedValue != BLL.Const._Null) { rectifyNotices.UnitId = this.drpUnitId.SelectedValue; } if (this.drpDutyPerson.SelectedValue != BLL.Const._Null) { rectifyNotices.DutyPersonId = this.drpDutyPerson.SelectedValue; } if (this.drpWorkAreaId.SelectedValue != BLL.Const._Null) { rectifyNotices.WorkAreaId = this.drpWorkAreaId.SelectedValue; } if (this.drpSignPerson.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpSignPerson.SelectedValue)) { rectifyNotices.SignPerson = this.drpSignPerson.SelectedValue; } if (!string.IsNullOrEmpty(this.drpCheckPerson.SelectedValue) && this.drpCheckPerson.SelectedValue != BLL.Const._Null) { rectifyNotices.CheckPerson = this.drpCheckPerson.SelectedValue; } if (!string.IsNullOrEmpty(this.RectifyNoticeId)) { rectifyNotices.RectifyNoticesId = this.RectifyNoticeId; BLL.RectifyNoticesService.UpdateRectifyNotices(rectifyNotices); BLL.LogService.AddSys_Log(this.CurrUser, rectifyNotices.RectifyNoticesCode, rectifyNotices.RectifyNoticesId, BLL.Const.ProjectRectifyNoticeMenuId, BLL.Const.BtnModify); } else { this.RectifyNoticeId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNotices)); rectifyNotices.RectifyNoticesId = this.RectifyNoticeId; BLL.RectifyNoticesService.AddRectifyNotices(rectifyNotices); BLL.LogService.AddSys_Log(this.CurrUser, rectifyNotices.RectifyNoticesCode, rectifyNotices.RectifyNoticesId, BLL.Const.ProjectRectifyNoticeMenuId, BLL.Const.BtnAdd); ///写入工程师日志 BLL.HSSELogService.CollectHSSELog(rectifyNotices.ProjectId, rectifyNotices.SignPerson, rectifyNotices.SignDate, "22", rectifyNotices.WrongContent, Const.BtnAdd, 1); } if (isColse) { PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } }
/// <summary> /// 生成隐患整改单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnMenuRectify_Click(object sender, EventArgs e) { if (Grid1.SelectedRowIndexArray.Length == 0) { Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); return; } string rectifyNoticeCode = string.Empty; string CheckColligationId = Grid1.SelectedRowID.Split(',')[0]; var checkColligation = BLL.Check_CheckColligationService.GetCheckColligationByCheckColligationId(CheckColligationId); if (checkColligation.States == BLL.Const.State_2) { string CheckColligationDetailId = Grid1.SelectedRowID.Split(',')[1]; Model.Check_CheckColligationDetail detail = BLL.Check_CheckColligationDetailService.GetCheckColligationDetailByCheckColligationDetailId(CheckColligationDetailId); if (string.IsNullOrEmpty(detail.RectifyNoticeId)) { Model.Check_RectifyNotices rectifyNotice = new Model.Check_RectifyNotices { RectifyNoticesId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNotice)), ProjectId = checkColligation.ProjectId, UnitId = detail.UnitId, CheckedDate = checkColligation.CheckTime, RectifyNoticesCode = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectRectifyNoticeMenuId, checkColligation.ProjectId, detail.UnitId), WrongContent = "开展了综合检查,发现问题及隐患:" + detail.Unqualified + "\n" + detail.Suggestions, SignPerson = this.CurrUser.UserId, SignDate = DateTime.Now, }; var workArea = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.ProjectId == checkColligation.ProjectId && x.WorkAreaName == detail.WorkArea); if (workArea != null) { rectifyNotice.WorkAreaId = workArea.WorkAreaId; } BLL.RectifyNoticesService.AddRectifyNotices(rectifyNotice); rectifyNoticeCode = rectifyNotice.RectifyNoticesCode; detail.RectifyNoticeId = rectifyNotice.RectifyNoticesId; BLL.Check_CheckColligationDetailService.UpdateCheckColligationDetail(detail); ///写入工程师日志 BLL.HSSELogService.CollectHSSELog(rectifyNotice.ProjectId, rectifyNotice.SignPerson, rectifyNotice.SignDate, "22", rectifyNotice.WrongContent, Const.BtnAdd, 1); } if (!string.IsNullOrEmpty(rectifyNoticeCode)) { Alert.ShowInTop("已生成隐患整改通知单:" + rectifyNoticeCode + "!", MessageBoxIcon.Success); } else { Alert.ShowInTop("隐患整改通知单已存在,请到对应模块进行处理!", MessageBoxIcon.Warning); } } else { Alert.ShowInTop("该记录尚未审批完成,无法进行操作!", MessageBoxIcon.Warning); return; } }
/// <summary> /// /// </summary> private void EditData(string rectifyNoticeId) { bool flag = false; Model.Check_RectifyNotices RectifyNotices = RectifyNoticesService.GetRectifyNoticesById(Grid1.SelectedRowID); if (RectifyNotices.States == "0" || RectifyNotices.States == "1") { if (this.CurrUser.UserId == RectifyNotices.CompleteManId || this.CurrUser.UserId == RectifyNotices.SignPerson) { flag = true; PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RectifyNoticesEdit.aspx?RectifyNoticesId={0}", rectifyNoticeId, "编辑 - "))); } } else if (RectifyNotices.States == "2") { if (this.CurrUser.UserId == RectifyNotices.DutyPersonId) { flag = true; PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RectifyNoticesEdit.aspx?RectifyNoticesId={0}", rectifyNoticeId, "编辑 - "))); } } else if (RectifyNotices.States == "3") { if (this.CurrUser.UserId == RectifyNotices.UnitHeadManId) { flag = true; PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RectifyNoticesEdit.aspx?RectifyNoticesId={0}", rectifyNoticeId, "编辑 - "))); } } else if (RectifyNotices.States == "4") { if (this.CurrUser.UserId == RectifyNotices.CheckPerson) { flag = true; PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RectifyNoticesEdit.aspx?RectifyNoticesId={0}", rectifyNoticeId, "编辑 - "))); } } else { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RectifyNoticesView.aspx?RectifyNoticesId={0}", rectifyNoticeId, "查看 - "))); } if (!flag) { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RectifyNoticesView.aspx?RectifyNoticesId={0}", rectifyNoticeId, "查看 - "))); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { txtProjectName.Text = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectName; ////自动生成编码 this.txtRectifyNoticesCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectRectifyNoticesMenuId, this.CurrUser.LoginProjectId, this.CurrUser.UnitId); //受检单位 BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, false); //区域 BLL.WorkAreaService.InitWorkAreaDropDownList(this.drpWorkAreaId, this.CurrUser.LoginProjectId, true); ///检察人员 BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpCheckPerson, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true); RectifyNoticesId = Request.Params["RectifyNoticesId"]; if (!string.IsNullOrEmpty(RectifyNoticesId)) { Model.Check_RectifyNotices RectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId); if (!string.IsNullOrEmpty(RectifyNotices.UnitId)) { this.drpUnitId.SelectedValue = RectifyNotices.UnitId; } if (!string.IsNullOrEmpty(RectifyNotices.WorkAreaId)) { this.drpWorkAreaId.SelectedValue = RectifyNotices.WorkAreaId; } if (!string.IsNullOrEmpty(RectifyNotices.CheckManIds)) { this.drpCheckPerson.SelectedValueArray = RectifyNotices.CheckManIds.Split(','); } this.txtRectifyNoticesCode.Text = RectifyNotices.RectifyNoticesCode; this.txtCompleteDate.Text = RectifyNotices.CompleteDate.ToString(); if (!string.IsNullOrEmpty(RectifyNotices.HiddenHazardType)) { this.drpHiddenHazardType.SelectedValue = RectifyNotices.HiddenHazardType; } this.txtReCheckOpinion.Text = RectifyNotices.ReCheckOpinion; BindGrid1(); BindGrid(); } } }
/// <summary> /// 修改隐患整改通知单 /// </summary> /// <param name="rectifyNotices"></param> public static void UpdateRectifyNotices(Model.Check_RectifyNotices rectifyNotices) { Model.Check_RectifyNotices newRectifyNotices = db.Check_RectifyNotices.FirstOrDefault(e => e.RectifyNoticesId == rectifyNotices.RectifyNoticesId); if (newRectifyNotices != null) { newRectifyNotices.ProjectId = rectifyNotices.ProjectId; newRectifyNotices.RectifyNoticesCode = rectifyNotices.RectifyNoticesCode; newRectifyNotices.UnitId = rectifyNotices.UnitId; newRectifyNotices.WorkAreaId = rectifyNotices.WorkAreaId; newRectifyNotices.CheckedDate = rectifyNotices.CheckedDate; newRectifyNotices.WrongContent = rectifyNotices.WrongContent; newRectifyNotices.SignPerson = rectifyNotices.SignPerson; newRectifyNotices.SignDate = rectifyNotices.SignDate; newRectifyNotices.CompleteStatus = rectifyNotices.CompleteStatus; newRectifyNotices.DutyPerson = rectifyNotices.DutyPerson; newRectifyNotices.CompleteDate = rectifyNotices.CompleteDate; newRectifyNotices.IsRectify = rectifyNotices.IsRectify; newRectifyNotices.CheckPerson = rectifyNotices.CheckPerson; newRectifyNotices.DutyPersonId = rectifyNotices.DutyPersonId; newRectifyNotices.ReCheckDate = rectifyNotices.ReCheckDate; db.SubmitChanges(); } }
/// <summary> /// 保存RectifyNotices /// </summary> /// <param name="userInfo"></param> /// <returns></returns> public static void SaveRectifyNotices(Model.RectifyNoticesItem rectifyNotices) { using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString)) { bool insertRectifyNoticesItemItem = false; Model.Check_RectifyNotices newRectifyNotices = new Model.Check_RectifyNotices { RectifyNoticesId = rectifyNotices.RectifyNoticesId, ProjectId = rectifyNotices.ProjectId, RectifyNoticesCode = rectifyNotices.RectifyNoticesCode, UnitId = rectifyNotices.UnitId, CheckManNames = rectifyNotices.CheckManNames, CheckManIds = rectifyNotices.CheckManIds, CheckedDate = Funs.GetNewDateTime(rectifyNotices.CheckedDate), HiddenHazardType = rectifyNotices.HiddenHazardType, States = rectifyNotices.States, }; if (!string.IsNullOrEmpty(rectifyNotices.WorkAreaId)) { newRectifyNotices.WorkAreaId = rectifyNotices.WorkAreaId; } if (!string.IsNullOrEmpty(rectifyNotices.CompleteManId)) { newRectifyNotices.CompleteManId = rectifyNotices.CompleteManId; } if (newRectifyNotices.States == Const.State_1) { newRectifyNotices.SignPerson = rectifyNotices.SignPersonId; } //// 新增整改单 var isUpdate = db.Check_RectifyNotices.FirstOrDefault(x => x.RectifyNoticesId == newRectifyNotices.RectifyNoticesId); if (isUpdate == null) { newRectifyNotices.RectifyNoticesId = SQLHelper.GetNewID(); newRectifyNotices.Isprint = "0"; newRectifyNotices.Isprintf = "0"; newRectifyNotices.RectifyNoticesCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId); db.Check_RectifyNotices.InsertOnSubmit(newRectifyNotices); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId, newRectifyNotices.RectifyNoticesId, newRectifyNotices.CheckedDate); //// 整改单附件 if (!string.IsNullOrEmpty(rectifyNotices.BeAttachUrl)) { APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId + "#0", rectifyNotices.BeAttachUrl, "0"); } //// 反馈单附件 if (!string.IsNullOrEmpty(rectifyNotices.AfAttachUrl)) { APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId + "#1", rectifyNotices.AfAttachUrl, "0"); } //// 整个单据附件 if (!string.IsNullOrEmpty(rectifyNotices.AttachUrl)) { APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId, rectifyNotices.AttachUrl, "0"); } insertRectifyNoticesItemItem = true; //// 回写巡检记录表 if (!string.IsNullOrEmpty(rectifyNotices.HazardRegisterId)) { List <string> listIds = Funs.GetStrListByStr(rectifyNotices.HazardRegisterId, ','); foreach (var item in listIds) { var getHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == item); if (getHazardRegister != null) { getHazardRegister.States = "3"; getHazardRegister.HandleIdea += "已升级为隐患整改单:" + newRectifyNotices.RectifyNoticesCode; getHazardRegister.ResultId = newRectifyNotices.RectifyNoticesId; getHazardRegister.ResultType = "1"; db.SubmitChanges(); } } } //// 回写专项检查明细表 if (!string.IsNullOrEmpty(rectifyNotices.CheckSpecialDetailId)) { List <string> listIds = Funs.GetStrListByStr(rectifyNotices.CheckSpecialDetailId, ','); foreach (var item in listIds) { var getCheckSpecialDetail = db.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == item); if (getCheckSpecialDetail != null) { getCheckSpecialDetail.DataType = "1"; getCheckSpecialDetail.DataId = newRectifyNotices.RectifyNoticesId; db.SubmitChanges(); } } } } else { newRectifyNotices.RectifyNoticesId = isUpdate.RectifyNoticesId; isUpdate.States = rectifyNotices.States; if (newRectifyNotices.States == "0" || newRectifyNotices.States == "1") ////编制人 修改或提交 { isUpdate.UnitId = rectifyNotices.UnitId; isUpdate.WorkAreaId = rectifyNotices.WorkAreaId; isUpdate.CheckManNames = rectifyNotices.CheckManNames; isUpdate.CheckManIds = rectifyNotices.CheckManIds; isUpdate.CheckedDate = Funs.GetNewDateTime(rectifyNotices.CheckedDate); isUpdate.HiddenHazardType = rectifyNotices.HiddenHazardType; if (newRectifyNotices.States == "1" && !string.IsNullOrEmpty(rectifyNotices.SignPersonId)) { isUpdate.SignPerson = rectifyNotices.SignPersonId; } else { newRectifyNotices.States = isUpdate.States = "0"; } db.SubmitChanges(); //// 删除明细表 var deleteItem = from x in db.Check_RectifyNoticesItem where x.RectifyNoticesId == isUpdate.RectifyNoticesId select x; if (deleteItem.Count() > 0) { foreach (var cdeleteItem in deleteItem) { CommonService.DeleteAttachFileById(cdeleteItem.RectifyNoticesItemId); } db.Check_RectifyNoticesItem.DeleteAllOnSubmit(deleteItem); } insertRectifyNoticesItemItem = true; } else if (newRectifyNotices.States == "2") ////总包单位项目安全经理 审核 { /// 不同意 打回 同意抄送专业工程师、施工经理、项目经理 并下发分包接收人(也就是施工单位项目安全经理) if (rectifyNotices.IsAgree == false) { newRectifyNotices.States = isUpdate.States = "0"; } else { if (!string.IsNullOrEmpty(rectifyNotices.ProfessionalEngineerId)) { isUpdate.ProfessionalEngineerId = rectifyNotices.ProfessionalEngineerId; } if (!string.IsNullOrEmpty(rectifyNotices.ConstructionManagerId)) { isUpdate.ConstructionManagerId = rectifyNotices.ConstructionManagerId; } if (!string.IsNullOrEmpty(rectifyNotices.ProjectManagerId)) { isUpdate.ProjectManagerId = rectifyNotices.ProjectManagerId; } if (!string.IsNullOrEmpty(rectifyNotices.DutyPersonId)) { isUpdate.DutyPersonId = rectifyNotices.DutyPersonId; isUpdate.SignDate = DateTime.Now; } else { newRectifyNotices.States = isUpdate.States = "1"; } } db.SubmitChanges(); } else if (newRectifyNotices.States == "3") /// 施工单位项目安全经理 整改 提交施工单位项目负责人 { //// 整改明细反馈 if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0) { foreach (var rItem in rectifyNotices.RectifyNoticesItemItem) { var getUpdateItem = db.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId); if (getUpdateItem != null) { getUpdateItem.RectifyResults = rItem.RectifyResults; if (getUpdateItem.IsRectify != true) { getUpdateItem.IsRectify = null; } db.SubmitChanges(); } if (!string.IsNullOrEmpty(rItem.PhotoAfterUrl)) { APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, rItem.RectifyNoticesItemId + "#2", rItem.PhotoAfterUrl, "0"); } } } if (!string.IsNullOrEmpty(rectifyNotices.UnitHeadManId)) { isUpdate.UnitHeadManId = rectifyNotices.UnitHeadManId; isUpdate.CompleteDate = DateTime.Now; } else { newRectifyNotices.States = isUpdate.States = "2"; } db.SubmitChanges(); } else if (newRectifyNotices.States == "4") { /// 施工单位项目负责人不同意 打回施工单位项目安全经理,同意提交安全经理/安全工程师复查 if (rectifyNotices.IsAgree == false) { newRectifyNotices.States = isUpdate.States = "2"; isUpdate.CompleteDate = null; } else { if (!string.IsNullOrEmpty(rectifyNotices.CheckPersonId)) { isUpdate.UnitHeadManDate = DateTime.Now; isUpdate.CheckPerson = rectifyNotices.CheckPersonId; } else { newRectifyNotices.States = isUpdate.States = "3"; } } db.SubmitChanges(); } else if (newRectifyNotices.States == "5") { //// 整改明细反馈 复查 是否合格 if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0) { foreach (var rItem in rectifyNotices.RectifyNoticesItemItem) { var getUpdateItem = db.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId); if (getUpdateItem != null) { getUpdateItem.IsRectify = rItem.IsRectify; db.SubmitChanges(); //// 存在不合格 意见自动不同意 if (!getUpdateItem.IsRectify.HasValue || getUpdateItem.IsRectify == false) { rectifyNotices.IsAgree = false; } } } } ////安全经理/安全工程师 同意关闭,不同意打回施工单位项目安全经理 isUpdate.ReCheckOpinion = rectifyNotices.ReCheckOpinion; if (rectifyNotices.IsAgree == false) { newRectifyNotices.States = isUpdate.States = "2"; isUpdate.UnitHeadManDate = null; isUpdate.CompleteDate = null; isUpdate.ProfessionalEngineerTime2 = null; isUpdate.ConstructionManagerTime2 = null; isUpdate.ProjectManagerTime2 = null; } else { isUpdate.ReCheckDate = DateTime.Now; //// 回写专项检查明细表 var getcheck = from x in db.Check_CheckSpecialDetail where x.DataId == isUpdate.RectifyNoticesId select x; if (getcheck.Count() > 0) { foreach (var item in getcheck) { item.CompleteStatus = true; item.CompletedDate = DateTime.Now; db.SubmitChanges(); } } } db.SubmitChanges(); } } if (insertRectifyNoticesItemItem) { //// 新增明细 if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0) { foreach (var rItem in rectifyNotices.RectifyNoticesItemItem) { Model.Check_RectifyNoticesItem newItem = new Model.Check_RectifyNoticesItem { RectifyNoticesItemId = SQLHelper.GetNewID(), RectifyNoticesId = newRectifyNotices.RectifyNoticesId, WrongContent = rItem.WrongContent, Requirement = rItem.Requirement, LimitTime = Funs.GetNewDateTime(rItem.LimitTime), RectifyResults = null, IsRectify = null, }; db.Check_RectifyNoticesItem.InsertOnSubmit(newItem); db.SubmitChanges(); if (!string.IsNullOrEmpty(rItem.PhotoBeforeUrl)) { APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newItem.RectifyNoticesItemId + "#1", rItem.PhotoBeforeUrl, "0"); } } } } //// 增加审核记录 if (rectifyNotices.RectifyNoticesFlowOperateItem != null && rectifyNotices.RectifyNoticesFlowOperateItem.Count() > 0) { var getOperate = rectifyNotices.RectifyNoticesFlowOperateItem.FirstOrDefault(); if (getOperate != null && !string.IsNullOrEmpty(getOperate.OperateManId)) { Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate { FlowOperateId = SQLHelper.GetNewID(), RectifyNoticesId = newRectifyNotices.RectifyNoticesId, OperateName = getOperate.OperateName, OperateManId = getOperate.OperateManId, OperateTime = DateTime.Now, IsAgree = getOperate.IsAgree, Opinion = getOperate.Opinion, }; db.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem); db.SubmitChanges(); } } if (newRectifyNotices.States == Const.State_1) { APICommonService.SendSubscribeMessage(newRectifyNotices.SignPerson, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您签发", rectifyNotices.CheckManNames, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now)); } else if (newRectifyNotices.States == Const.State_2) { APICommonService.SendSubscribeMessage(newRectifyNotices.DutyPersonId, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您整改", rectifyNotices.SignPersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now)); } else if (newRectifyNotices.States == Const.State_3) { APICommonService.SendSubscribeMessage(newRectifyNotices.UnitHeadManId, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您审核", rectifyNotices.DutyPersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now)); } else if (newRectifyNotices.States == Const.State_4) { APICommonService.SendSubscribeMessage(newRectifyNotices.CheckPerson, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您复查", rectifyNotices.UnitHeadManName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now)); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ////自动生成编码 this.txtRectifyNoticesCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectRectifyNoticesMenuId, this.ProjectId, this.CurrUser.UnitId); //受检单位 BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, false); //区域 BLL.WorkAreaService.InitWorkAreaDropDownList(this.drpWorkAreaId, this.CurrUser.LoginProjectId, true); ///安全经理 BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpSignPerson, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true); ///检察人员 BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpCheckPerson, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true); RectifyNoticesId = Request.Params["RectifyNoticesId"]; if (!string.IsNullOrEmpty(RectifyNoticesId)) { this.hdRectifyNoticesId.Text = RectifyNoticesId; Model.Check_RectifyNotices RectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId); if (!string.IsNullOrEmpty(RectifyNotices.UnitId)) { this.drpUnitId.SelectedValue = RectifyNotices.UnitId; } if (!string.IsNullOrEmpty(RectifyNotices.WorkAreaId)) { this.drpWorkAreaId.SelectedValue = RectifyNotices.WorkAreaId; } if (!string.IsNullOrEmpty(RectifyNotices.CheckManIds)) { this.drpCheckPerson.SelectedValueArray = RectifyNotices.CheckManIds.Split(','); } this.txtRectifyNoticesCode.Text = RectifyNotices.RectifyNoticesCode; this.txtCompleteDate.Text = RectifyNotices.CompleteDate.ToString(); if (!string.IsNullOrEmpty(RectifyNotices.HiddenHazardType)) { this.drpHiddenHazardType.SelectedValue = RectifyNotices.HiddenHazardType; } if (!string.IsNullOrEmpty(RectifyNotices.States)) { State = RectifyNotices.States; } else { State = "0"; this.next1.Hidden = true; this.next2.Hidden = true; this.next3.Hidden = true; this.next4.Hidden = true; } if (State == "0") { this.next1.Hidden = true; this.next2.Hidden = true; this.next3.Hidden = true; this.next4.Hidden = true; } if (State == "1") { this.next.Hidden = true; this.next2.Hidden = true; this.next3.Hidden = true; this.next4.Hidden = true; this.Itemcontent.Hidden = true; this.btnSure.Hidden = true; BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.drpDutyPerson, this.CurrUser.LoginProjectId, this.drpUnitId.SelectedValue, true); //接收人 BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpProfessionalEngineer, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true); //专业工程师 BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpConstructionManager, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true); //施工经理 BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpProjectManager, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true); //项目经理 } else if (State == "2") { this.next.Hidden = true; this.next1.Hidden = true; this.next3.Hidden = true; this.next4.Hidden = true; this.after.Hidden = false; this.txtWrongContent.Readonly = true; this.txtRequirement.Readonly = true; this.txtLimitTime.Readonly = true; BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.drpUnitHeadManId, this.CurrUser.LoginProjectId, this.drpUnitId.SelectedValue, true);//施工单位负责人 } else if (State == "3") { this.next.Hidden = true; this.next1.Hidden = true; this.next2.Hidden = true; this.next4.Hidden = true; this.Itemcontent.Hidden = true; this.btnSure.Hidden = true; BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.drpSignPerson1, this.CurrUser.LoginProjectId, this.drpUnitId.SelectedValue, true);//复查人 } else if (State == "4") { this.next.Hidden = true; this.next1.Hidden = true; this.next2.Hidden = true; this.next3.Hidden = true; this.end.Hidden = false; this.after.Hidden = false; this.txtWrongContent.Readonly = true; this.txtRequirement.Readonly = true; this.txtLimitTime.Readonly = true; this.txtRectifyResults.Readonly = true; Funs.FineUIPleaseSelect(drpIsRectify); } else if (State == "5") { this.next.Hidden = true; this.next1.Hidden = true; this.next2.Hidden = true; this.next3.Hidden = true; this.Itemcontent.Hidden = true; } } else { this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); State = "0"; this.next1.Hidden = true; this.next2.Hidden = true; this.next3.Hidden = true; this.next3.Hidden = true; this.next4.Hidden = true; } BindGrid(); } }
/// <summary> /// 保存方法 /// </summary> /// <param name="saveType"></param> private void SavePauseNotice(string saveType) { Model.Check_RectifyNotices Notices = new Model.Check_RectifyNotices(); Notices.RectifyNoticesCode = this.txtRectifyNoticesCode.Text.Trim(); Notices.ProjectId = this.CurrUser.LoginProjectId; if (this.drpUnitId.SelectedValue != BLL.Const._Null) { Notices.UnitId = this.drpUnitId.SelectedValue; } if (this.drpWorkAreaId.SelectedValue != BLL.Const._Null) { Notices.WorkAreaId = this.drpWorkAreaId.SelectedValue; } if (this.drpCheckPerson.SelectedValue != BLL.Const._Null) { string str = GetStringByArray(this.drpCheckPerson.SelectedValueArray); string UserName = string.Empty; if (!string.IsNullOrEmpty(str)) { string[] seeUsers = str.Split(','); foreach (var seeUser in seeUsers) { if (!string.IsNullOrEmpty(seeUser)) { UserName += BLL.UserService.getUserNamesUserIds(seeUser) + ","; } } if (!string.IsNullOrEmpty(UserName)) { UserName = UserName.Substring(0, UserName.LastIndexOf(",")); } } Notices.CheckManNames = UserName; Notices.CheckManIds = str; } if (this.drpSignPerson.SelectedValue != BLL.Const._Null) { Notices.SignPerson = this.drpSignPerson.SelectedValue; } if (!string.IsNullOrEmpty(this.txtCompleteDate.Text.Trim())) { Notices.CheckedDate = Convert.ToDateTime(this.txtCompleteDate.Text.Trim()); } if (this.drpHiddenHazardType.SelectedValue != BLL.Const._Null) { Notices.HiddenHazardType = this.drpHiddenHazardType.SelectedValue; } if (saveType == "submit") { Notices.States = Convert.ToInt32(Convert.ToInt32(State) + 1).ToString(); } else { var isUpdate = Funs.DB.Check_RectifyNotices.FirstOrDefault(x => x.RectifyNoticesId == RectifyNoticesId); if (isUpdate != null) { if (string.IsNullOrEmpty(Notices.States)) { Notices.States = State; } else { Notices.States = isUpdate.States; } } else { Notices.States = State; } } if (!string.IsNullOrEmpty(RectifyNoticesId)) { Model.Check_RectifyNotices isUpdate = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId); if (Notices.States == "0" || Notices.States == "1") ////编制人 修改或提交 { isUpdate.UnitId = this.drpUnitId.SelectedValue; isUpdate.WorkAreaId = this.drpWorkAreaId.SelectedValue; isUpdate.CheckManNames = BLL.UserService.GetUserNameByUserId(this.CurrUser.UserId); isUpdate.CheckManIds = this.CurrUser.UserId; isUpdate.CheckedDate = Funs.GetNewDateTime(this.txtCompleteDate.Text.Trim()); isUpdate.HiddenHazardType = this.drpHiddenHazardType.SelectedValue; if (Notices.States == "1" && !string.IsNullOrEmpty(Notices.SignPerson)) { isUpdate.SignPerson = Notices.SignPerson; isUpdate.States = "1"; } BLL.Funs.DB.SubmitChanges(); Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate { FlowOperateId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNoticesFlowOperate)), RectifyNoticesId = isUpdate.RectifyNoticesId, OperateName = "检查人员下发整改单", OperateManId = CurrUser.UserId, OperateTime = DateTime.Now, }; BLL.Funs.DB.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem); BLL.Funs.DB.SubmitChanges(); } else if (Notices.States == "2") ////总包单位项目安全经理 审核 { /// 不同意 打回 同意抄送专业工程师、施工经理、项目经理 并下发分包接收人(也就是施工单位项目安全经理) if (this.rdbIsAgree.SelectedValue.Equals("false")) { Notices.States = isUpdate.States = "0"; } else { if (this.drpProfessionalEngineer.SelectedValue != BLL.Const._Null) { isUpdate.ProfessionalEngineerId = this.drpProfessionalEngineer.SelectedValue; } if (this.drpConstructionManager.SelectedValue != BLL.Const._Null) { isUpdate.ConstructionManagerId = this.drpConstructionManager.SelectedValue; } if (this.drpProjectManager.SelectedValue != BLL.Const._Null) { isUpdate.ProjectManagerId = this.drpProjectManager.SelectedValue; } if (this.drpDutyPerson.SelectedValue != BLL.Const._Null) { isUpdate.DutyPersonId = this.drpDutyPerson.SelectedValue; isUpdate.DutyPerson = this.drpDutyPerson.SelectedValue; isUpdate.SignDate = DateTime.Now; isUpdate.DutyPersonTime = DateTime.Now; } Notices.States = isUpdate.States = "2"; BLL.Funs.DB.SubmitChanges(); } Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate { FlowOperateId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNoticesFlowOperate)), RectifyNoticesId = isUpdate.RectifyNoticesId, OperateName = "总包单位项目安全经理签发", OperateManId = CurrUser.UserId, Opinion = reason.Text, IsAgree = Convert.ToBoolean(this.rdbIsAgree.SelectedValue), OperateTime = DateTime.Now, }; BLL.Funs.DB.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem); BLL.Funs.DB.SubmitChanges(); } else if (Notices.States == "3") /// 施工单位项目安全经理 整改 提交施工单位项目负责人 { //// 整改明细反馈 var getViewList = this.CollectGridInfo(); if (getViewList != null && getViewList.Count() > 0) { foreach (var rItem in getViewList) { var getUpdateItem = Funs.DB.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId); if (getUpdateItem != null) { getUpdateItem.RectifyResults = rItem.RectifyResults; //if (getUpdateItem.IsRectify != true) //{ // getUpdateItem.IsRectify = null; //} Funs.DB.SubmitChanges(); } } } if (this.drpUnitHeadManId.SelectedValue != BLL.Const._Null) { isUpdate.UnitHeadManId = this.drpUnitHeadManId.SelectedValue; isUpdate.CompleteDate = DateTime.Now; Notices.States = isUpdate.States = "3"; } Funs.DB.SubmitChanges(); Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate { FlowOperateId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNoticesFlowOperate)), RectifyNoticesId = isUpdate.RectifyNoticesId, OperateName = "责任人整改", OperateManId = CurrUser.UserId, OperateTime = DateTime.Now, }; BLL.Funs.DB.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem); BLL.Funs.DB.SubmitChanges(); } else if (Notices.States == "4") { /// 施工单位项目负责人不同意 打回施工单位项目安全经理,同意提交安全经理/安全工程师复查 if (this.rdbUnitHeadManAgree.SelectedValue.Equals("false")) { Notices.States = isUpdate.States = "2"; isUpdate.CompleteDate = null; } else { if (drpSignPerson1.SelectedValue != BLL.Const._Null) { isUpdate.UnitHeadManDate = DateTime.Now; isUpdate.CheckPerson = drpSignPerson1.SelectedValue; Notices.States = isUpdate.States = "4"; } Funs.DB.SubmitChanges(); } Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate { FlowOperateId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNoticesFlowOperate)), RectifyNoticesId = isUpdate.RectifyNoticesId, OperateName = "施工单位项目负责人审核", OperateManId = CurrUser.UserId, Opinion = this.reason1.Text, IsAgree = Convert.ToBoolean(this.rdbUnitHeadManAgree.SelectedValue), OperateTime = DateTime.Now, }; BLL.Funs.DB.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem); BLL.Funs.DB.SubmitChanges(); } else if (Notices.States == "5") { ////安全经理/安全工程师 同意关闭,不同意打回施工单位项目安全经理 isUpdate.ReCheckOpinion = drpReCheckOpinion.SelectedValue; if (this.drpReCheckOpinion.SelectedValue.Equals("false")) { Notices.States = isUpdate.States = "2"; isUpdate.UnitHeadManDate = null; isUpdate.CompleteDate = null; isUpdate.ProfessionalEngineerTime2 = null; isUpdate.ConstructionManagerTime2 = null; isUpdate.ProjectManagerTime2 = null; } else { isUpdate.ReCheckDate = DateTime.Now; Notices.States = isUpdate.States = "5"; } Funs.DB.SubmitChanges(); //// 整改明细反馈 var getViewList = this.CollectGridInfo(); if (getViewList != null && getViewList.Count() > 0) { foreach (var rItem in getViewList) { var getUpdateItem = Funs.DB.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId); if (getUpdateItem != null) { if (this.drpReCheckOpinion.SelectedValue.Equals("false")) { getUpdateItem.IsRectify = false; } else { getUpdateItem.IsRectify = true; } Funs.DB.SubmitChanges(); } } } bool flag = false; if (this.drpReCheckOpinion.SelectedValue == "整改通过") { flag = true; } Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate { FlowOperateId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNoticesFlowOperate)), RectifyNoticesId = isUpdate.RectifyNoticesId, OperateName = "总包单位安全经理/安全工程师复查", OperateManId = CurrUser.UserId, Opinion = this.drpReCheckOpinion.SelectedValue, IsAgree = flag, OperateTime = DateTime.Now, }; BLL.Funs.DB.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem); BLL.Funs.DB.SubmitChanges(); } } else { if (!string.IsNullOrEmpty(this.hdRectifyNoticesId.Text)) { Notices.RectifyNoticesId = this.hdRectifyNoticesId.Text; } else { Notices.RectifyNoticesId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNotices)); } Notices.CompleteManId = this.CurrUser.UserId; Notices.CompleteDate = DateTime.Now; Notices.Isprint = "0"; Notices.Isprintf = "0"; Notices.SignPerson = this.drpSignPerson.SelectedValue; RectifyNoticesService.AddRectifyNotices(Notices); RectifyNoticesId = Notices.RectifyNoticesId; Model.Check_RectifyNotices Notices1 = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId); Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate { FlowOperateId = SQLHelper.GetNewID(typeof(Model.Check_RectifyNoticesFlowOperate)), RectifyNoticesId = Notices1.RectifyNoticesId, OperateName = "检查人员下发整改单", OperateManId = this.CurrUser.UserId, OperateTime = DateTime.Now, }; BLL.Funs.DB.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem); BLL.Funs.DB.SubmitChanges(); var getViewList = this.CollectGridInfo(); var getRectifyNoticesItem = from x in getViewList select new Model.Check_RectifyNoticesItem { RectifyNoticesItemId = x.RectifyNoticesItemId, RectifyNoticesId = Notices1.RectifyNoticesId, WrongContent = x.WrongContent, Requirement = x.Requirement, LimitTime = x.LimitTime, }; if (getRectifyNoticesItem.Count() > 0) { Funs.DB.Check_RectifyNoticesItem.InsertAllOnSubmit(getRectifyNoticesItem); Funs.DB.SubmitChanges(); } } ShowNotify("提交成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }