protected void Page_Load(object sender, EventArgs e) { if (Session["sended"] != null) { if (Session["sended"].ToString() == "1" && ViewState["BackUrl"] != null) { Response.Redirect(ViewState["BackUrl"].ToString()); } } if (!IsPostBack) { PageControlLocalizationText pl = new PageControlLocalizationText(this); pl.SetListPageControlLocalizationText(); lblFuncName.Text = GetLocalResourceObject("PageResource1.Title").ToString(); btnDelFile.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "DeleteBeforeConfirm").ToString() + "');"); if (Request["BackUrl"] != null) { ViewState["BackUrl"] = Request["BackUrl"]; } else { ViewState["BackUrl"] = null; } object obj = null; if (Request["PackTypeNo"] != null && Request["CurLinkNo"] != null) //从工作流界面打开,肯定有PackTypeNo和CurLinkNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["CurLinkNo"] = Request["CurLinkNo"]; if (Request["PackNo"] != null) { ViewState["PackNo"] = Request["PackNo"]; _sql = "select f_recno from DMIS_SYS_DOC where f_packno=" + Request["PackNo"] + " and f_linkno=" + Request["CurLinkNo"]; ViewState["RecNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["RecNo"] == null) { //JScript.Alert("业务表的记录号,请联系管理员!"); return; } } else { ViewState["RecNo"] = -1; } if (Request["CurWorkFlowNo"] != null) { ViewState["CurWorkFlowNo"] = Request["CurWorkFlowNo"]; } } else //从业务表查询界面打开,有PackTypeNo、TableName、RecNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["TableName"] = Request["TableName"]; ViewState["RecNo"] = Request["RecNo"]; _sql = "select F_PACKNO from DMIS_SYS_DOC where f_tablename='" + Request["TableName"].ToString() + "' and f_recno=" + ViewState["RecNo"].ToString(); ViewState["PackNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["PackNo"] == null) { //JScript.Alert("未找到业务号!"); return; } obj = DBOpt.dbHelper.ExecuteScalar("select f_no from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='在办'"); if (obj != null) //在办的业务 { ViewState["CurWorkFlowNo"] = obj; } else { _sql = "select max(f_no) from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='完成'"; //归档的业务,最后的环节 ViewState["CurWorkFlowNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); } ViewState["CurLinkNo"] = DBOpt.dbHelper.ExecuteScalar("select f_flowno from DMIS_SYS_WORKFLOW where f_no=" + ViewState["CurWorkFlowNo"].ToString()); } //找当前环节对应的文档 _sql = "select a.f_no,a.f_name,a.f_tablename,a.f_reportfile from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and b.f_packtypeno=" + ViewState["PackTypeNo"].ToString() + " and b.F_LINKNO=" + ViewState["CurLinkNo"].ToString(); DataTable temp = DBOpt.dbHelper.GetDataTable(_sql); if (temp == null || temp.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); //"没有找到对应的文档!" return; } else { ViewState["DocTypeNo"] = temp.Rows[0][0]; //文档编号 ViewState["DocTypeName"] = temp.Rows[0][1]; //文档名称 ViewState["TableName"] = temp.Rows[0][2]; //文档对应的数据库表名称 ViewState["REPORT_ID"] = temp.Rows[0][3]; //报表编号 } int counts; btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; btnWithdraw.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmWithdraw").ToString() + "');"); //确定要退回到上一步? btnAccept.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmAccept").ToString() + "');"); //确定要接单? if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) //管理员开放修改业务的数据的权限,但不能发送、回退。不参与流转的处理 { btnSave.Enabled = true; btnSaveClose.Enabled = true; WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), "T_BZ_TASK"); WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), "T_BZ_TASK_CHEECK"); WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), "T_BZ_TASK_DISPOSE"); } else { if (Session["Oper"] != null) { if (Convert.ToInt16(Session["Oper"]) > 0) //有权限修改 { WebWorkFlow.SetWebControlRight(this.Page, Session["RoleIDs"].ToString(), Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), ViewState["TableName"].ToString()); btnSave.Enabled = true; btnSaveClose.Enabled = true; btnSend.Enabled = true; btnWithdraw.Enabled = true; //判断文件上传删除的权限,只要能修改委托书基本资料,则可以 if (hcbSTATION.Enabled) { btnAddFile.Enabled = true; btnDelFile.Enabled = true; } //如果是最后一步,则弹出是否要归档的窗口 string sMainer = ""; if (ViewState["CurWorkFlowNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); } if (obj != null) { sMainer = obj.ToString(); } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');"); //确定要提交到下一步?(新建业务时。) } if (sMainer == Session["MemberName"].ToString()) { int iCat = -1; obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } if (iCat == 2) { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmFinish").ToString() + "');");//该项目已办理完成,是否要归档? } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');");//确定要提交到下一步 } } } else //待办的状态下处理接单按钮 { int flag = -1; //判断是否接单 obj = DBOpt.dbHelper.ExecuteScalar("select f_working from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { flag = Convert.ToInt16(obj); } if (flag == 0) //待办状态 { string zbr = ""; obj = DBOpt.dbHelper.ExecuteScalar("select f_receiver from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { zbr = obj.ToString().Trim(); } if (zbr == "" || zbr == Session["MemberName"].ToString()) { btnAccept.Enabled = true; } } else if (flag == 1) //从办人员点击进入状态,只能提交 { if (WebWorkFlow.IsCongBanRen(ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), Session["MemberName"].ToString())) { btnSend.Enabled = true; } } else { btnAccept.Enabled = false; } } } } FillDropDownList.FillHtmlCombxByTable(ref hcbSTATION, "DMIS_SYS_STATION", "NAME", "TID"); initFile(); //显示上传的文件 string tid; if (ViewState["PackNo"] != null) { //任务单内容,只有一条,故用PACK查找 if (DBOpt.dbHelper.IsExist("T_BZ_TASK", "PACK_NO=" + ViewState["PackNo"].ToString())) { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_BZ_TASK", "PACK_NO=" + ViewState["PackNo"].ToString()); } if (DBOpt.dbHelper.IsExist("T_BZ_TASK_CHEECK", "PACK_NO=" + ViewState["PackNo"].ToString())) { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_BZ_TASK_CHEECK", "PACK_NO=" + ViewState["PackNo"].ToString()); } //任务处理情况,一个业务有多条记录,查找当前处理的步骤对应的文档是否在业务表是存在记录 string tableName = DBOpt.dbHelper.ExecuteScalar("select f_tablename from DMIS_SYS_DOC where f_packno=" + ViewState["PackNo"].ToString() + " and f_linkno=" + ViewState["CurLinkNo"].ToString()).ToString(); tid = DBOpt.dbHelper.ExecuteScalar("select f_recno from DMIS_SYS_DOC where f_packno=" + ViewState["PackNo"].ToString() + " and f_linkno=" + ViewState["CurLinkNo"].ToString()).ToString(); obj = DBOpt.dbHelper.ExecuteScalar("select f_name from dmis_sys_flowlink where f_no=" + ViewState["CurLinkNo"].ToString()); if (tableName == "T_BZ_TASK_DISPOSE") //成员处理环节 { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, tableName, "TID=" + tid); tdCurDispoase.InnerText = obj.ToString(); if (txtF_FLOWNAME.Text == "") { txtF_FLOWNAME.Text = obj.ToString(); } } else //不是处理环节 { tdCurDispoase.InnerText = ""; } //填充已经完成的处理步骤数据 initData(); //2009-3-6 每个业务表保存业务号,故用一个控件来保存就可以了. if (txtPACK_NO.Text.Trim() == "") { txtPACK_NO.Text = ViewState["PackNo"].ToString(); } } //确定当前步骤是否是第一步 obj = DBOpt.dbHelper.ExecuteScalar("select f_flowcat from dmis_sys_flowlink where f_no=" + ViewState["CurLinkNo"].ToString()); if (!obj.ToString().Equals("0")) //不是第一步 { //设置初始人名 if (!SetRight.IsAdminitrator(Session["MemberID"].ToString())) //不是管理员才设置初始人员及日期,否则会把管理员的名称也赋值给相应的控件 { string[] name = { "txtSTARTER", "txtCHECKER", "txtFZR" }; TextBox txt; for (int i = 0; i < name.Length; i++) { txt = (TextBox)Page.FindControl(name[i]); if (txt == null) { continue; } if (!txt.ReadOnly && txt.Text == "") { txt.Text = Session["MemberName"].ToString(); } } //设置初始日期 string[] date = { "wdlSTARTTIME", "wdlCHECK_DATE", "wdlDISPOSE_STARTTIME" }; WebDate wdl; for (int i = 0; i < date.Length; i++) { wdl = (WebDate)Page.FindControl(date[i]); if (wdl == null) { continue; } if (wdl.Enabled && wdl.Text == "") { wdl.setTime(DateTime.Now); } } } //设置从办人员的姓名,这样不用两次输入办理人员的姓名 DataTable memberStatus = DBOpt.dbHelper.GetDataTable("select f_receiver from dmis_sys_memberstatus where f_packno=" + ViewState["PackNo"].ToString() + " and f_workflowno=" + ViewState["CurWorkFlowNo"].ToString()); for (int i = 0; i < memberStatus.Rows.Count; i++) { if (i == 0) { txtJDR1.Text = memberStatus.Rows[i][0].ToString(); } else if (i == 1) { txtJDR2.Text = memberStatus.Rows[i][0].ToString(); } else if (i == 2) { txtJDR3.Text = memberStatus.Rows[i][0].ToString(); } } } else //开始步骤 { tdCurDispoase.InnerText = ""; if (ViewState["RecNo"].ToString() == "-1") //新增任务书的情况 { _sql = "select count(*) from T_BZ_TASK where to_char(STARTTIME,'YYYYMM')='" + DateTime.Now.ToString("yyyyMM") + "'"; counts = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar(_sql)) + 1; txtPH.Text = DateTime.Now.ToString("yyyyMM") + counts.ToString("000"); txtTID.Text = ""; txtSTARTER.Text = Session["MemberName"].ToString(); wdlSTARTTIME.setTime(DateTime.Now); } else //第二次打开任务书,则还是第一步的步骤,则显示任务书的数据 { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_BZ_TASK", "TID=" + ViewState["RecNo"].ToString()); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["sended"] != null) { if (Session["sended"].ToString() == "1" && ViewState["BackUrl"] != null) { Response.Redirect(ViewState["BackUrl"].ToString()); } } if (!IsPostBack) { PageControlLocalizationText pl = new PageControlLocalizationText(this); pl.SetListPageControlLocalizationText(); lblFuncName.Text = GetLocalResourceObject("PageResource1.Title").ToString(); btnDelFile.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "DeleteBeforeConfirm").ToString() + "');"); if (Request["BackUrl"] != null) { ViewState["BackUrl"] = Request["BackUrl"]; } else { ViewState["BackUrl"] = null; } object obj = null; if (Request["PackTypeNo"] != null && Request["CurLinkNo"] != null) //从工作流界面打开,肯定有PackTypeNo和CurLinkNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["CurLinkNo"] = Request["CurLinkNo"]; if (Request["PackNo"] != null) { ViewState["PackNo"] = Request["PackNo"]; _sql = "select f_recno from DMIS_SYS_DOC where f_packno=" + Request["PackNo"] + " and f_linkno=" + Request["CurLinkNo"]; ViewState["RecNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["RecNo"] == null) { //JScript.Alert("业务表的记录号,请联系管理员!"); return; } } else { ViewState["RecNo"] = -1; } if (Request["CurWorkFlowNo"] != null) { ViewState["CurWorkFlowNo"] = Request["CurWorkFlowNo"]; } } else //从业务表查询界面打开,有PackTypeNo、TableName、RecNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["TableName"] = Request["TableName"]; ViewState["RecNo"] = Request["RecNo"]; _sql = "select F_PACKNO from DMIS_SYS_DOC where f_tablename='" + Request["TableName"].ToString() + "' and f_recno=" + ViewState["RecNo"].ToString(); ViewState["PackNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["PackNo"] == null) { //JScript.Alert("未找到业务号!"); return; } obj = DBOpt.dbHelper.ExecuteScalar("select f_no from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='在办'"); if (obj != null) //在办的业务 { ViewState["CurWorkFlowNo"] = obj; } else { _sql = "select max(f_no) from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='完成'"; //归档的业务,最后的环节 ViewState["CurWorkFlowNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); } ViewState["CurLinkNo"] = DBOpt.dbHelper.ExecuteScalar("select f_flowno from DMIS_SYS_WORKFLOW where f_no=" + ViewState["CurWorkFlowNo"].ToString()); } //找当前环节对应的文档 _sql = "select a.f_no,a.f_name,a.f_tablename,a.f_reportfile from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and b.f_packtypeno=" + ViewState["PackTypeNo"].ToString() + " and b.F_LINKNO=" + ViewState["CurLinkNo"].ToString(); DataTable temp = DBOpt.dbHelper.GetDataTable(_sql); if (temp == null || temp.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); //"没有找到对应的文档!" return; } else { ViewState["DocTypeNo"] = temp.Rows[0][0]; //文档编号 ViewState["DocTypeName"] = temp.Rows[0][1]; //文档名称 ViewState["TableName"] = temp.Rows[0][2]; //文档对应的数据库表名称 ViewState["REPORT_ID"] = temp.Rows[0][3]; //报表编号 } int counts; btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; btnWithdraw.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmWithdraw").ToString() + "');"); //确定要退回到上一步? btnAccept.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmAccept").ToString() + "');"); //确定要接单? if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) //管理员开放修改业务的数据的权限,但不能发送、回退。不参与流转的处理 { btnSave.Enabled = true; btnSaveClose.Enabled = true; WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), "T_BZ_TASK"); WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), "T_BZ_TASK_CHEECK"); WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), "T_BZ_TASK_DISPOSE"); } else { if (Session["Oper"] != null) { if (Convert.ToInt16(Session["Oper"]) > 0) //有权限修改 { WebWorkFlow.SetWebControlRight(this.Page, Session["RoleIDs"].ToString(), Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), ViewState["TableName"].ToString()); btnSave.Enabled = true; btnSaveClose.Enabled = true; btnSend.Enabled = true; btnWithdraw.Enabled = true; //判断文件上传删除的权限,只要能修改资料,则可以 if (hcbSTATION.Enabled) { btnAddFile.Enabled = true; btnDelFile.Enabled = true; } //如果是最后一步,则弹出是否要归档的窗口 string sMainer = ""; if (ViewState["CurWorkFlowNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); } if (obj != null) { sMainer = obj.ToString(); } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');"); //确定要提交到下一步?(新建业务时。) } if (sMainer == Session["MemberName"].ToString()) { int iCat = -1; obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } if (iCat == 2) { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmFinish").ToString() + "');");//该项目已办理完成,是否要归档? } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');");//确定要提交到下一步 } } } else //待办的状态下处理接单按钮 { int flag = -1; //判断是否接单 obj = DBOpt.dbHelper.ExecuteScalar("select f_working from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { flag = Convert.ToInt16(obj); } if (flag == 0) //待办状态 { string zbr = ""; obj = DBOpt.dbHelper.ExecuteScalar("select f_receiver from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { zbr = obj.ToString().Trim(); } if (zbr == "" || zbr == Session["MemberName"].ToString()) { btnAccept.Enabled = true; } } else if (flag == 1) //从办人员点击进入状态,只能提交 { if (WebWorkFlow.IsCongBanRen(ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), Session["MemberName"].ToString())) { btnSend.Enabled = true; } } else { btnAccept.Enabled = false; } } } } FillDropDownList.FillHtmlCombxByTable(ref hcbSTATION, "DMIS_SYS_STATION", "NAME", "TID", "ORDER_ID"); //状态 ddlFLAG.Items.Add(new ListItem(GetGlobalResourceObject("WebGlobalResource", "WkStatusNoCheck").ToString(), "0")); ddlFLAG.Items.Add(new ListItem(GetGlobalResourceObject("WebGlobalResource", "WkStatusChecked").ToString(), "1")); ddlFLAG.Items.Add(new ListItem(GetGlobalResourceObject("WebGlobalResource", "WkStatusComplete").ToString(), "2")); ddlFLAG.Items.Add(new ListItem(GetGlobalResourceObject("WebGlobalResource", "WkStatusAbolish").ToString(), "3")); ddlFLAG.SelectedIndex = 0; initFile(); //显示上传的文件 if (Convert.ToInt32(ViewState["RecNo"]) > -1) { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_BH_FIXED_VALUE_SHEET", "TID=" + ViewState["RecNo"].ToString()); if (!SetRight.IsAdminitrator(Session["MemberID"].ToString())) //不是管理员才设置初始人员及日期,否则会把管理员的名称也赋值给相应的控件 { string[] name = { "txtCHECKER", "txtAPPROVER", "txtOPERATOR" }; TextBox txt; for (int i = 0; i < name.Length; i++) { txt = (TextBox)Page.FindControl(name[i]); if (txt == null) { continue; } if (!txt.ReadOnly && txt.Text == "") { txt.Text = Session["MemberName"].ToString(); } } //设置初始日期 string[] date = { "wdlCHECK_TIME", "wdlAPPROVE_TIME", "wdlOPERATE_TIME" }; WebDate wdl; for (int i = 0; i < date.Length; i++) { wdl = (WebDate)Page.FindControl(date[i]); if (wdl == null) { continue; } if (wdl.Enabled && wdl.Text == "") { wdl.setTime(DateTime.Now); } } } } else //开始步骤 { _sql = "select count(*) from T_BH_FIXED_VALUE_SHEET where to_char(WRITE_TIME,'YYYY')='" + DateTime.Now.ToString("yyyy") + "'"; counts = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar(_sql)) + 1; txtPH.Text = DateTime.Now.ToString("yyyy") + counts.ToString("0000"); txtTID.Text = ""; txtWRITER.Text = Session["MemberName"].ToString(); wdlWRITE_TIME.setTime(DateTime.Now); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["sended"] != null) { if (Session["sended"].ToString() == "1" && ViewState["BackUrl"] != null) { Response.Redirect(ViewState["BackUrl"].ToString()); } } if (!IsPostBack) { PageControlLocalizationText pl = new PageControlLocalizationText(this); pl.SetListPageControlLocalizationText(); lblFuncName.Text = GetLocalResourceObject("PageResource1.Title").ToString(); if (Request["BackUrl"] != null) { ViewState["BackUrl"] = Server.UrlDecode(Request["BackUrl"]); } else { ViewState["BackUrl"] = null; } object obj = null; if (Request["PackTypeNo"] != null && Request["CurLinkNo"] != null) //从工作流界面打开,肯定有PackTypeNo和CurLinkNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["CurLinkNo"] = Request["CurLinkNo"]; if (Request["PackNo"] != null) { ViewState["PackNo"] = Request["PackNo"]; _sql = "select f_recno from DMIS_SYS_DOC where f_packno=" + Request["PackNo"] + " and f_linkno=" + Request["CurLinkNo"]; ViewState["RecNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["RecNo"] == null) { //JScript.Alert("业务表的记录号,请联系管理员!"); return; } } else { ViewState["RecNo"] = -1; } if (Request["CurWorkFlowNo"] != null) { ViewState["CurWorkFlowNo"] = Request["CurWorkFlowNo"]; } } else //从业务表查询界面打开,有PackTypeNo、TableName、RecNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["TableName"] = Request["TableName"]; ViewState["RecNo"] = Request["RecNo"]; _sql = "select F_PACKNO from DMIS_SYS_DOC where f_tablename='" + Request["TableName"].ToString() + "' and f_recno=" + ViewState["RecNo"].ToString(); ViewState["PackNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["PackNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select f_no from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='1'"); if (obj != null) //在办的业务 { ViewState["CurWorkFlowNo"] = obj; } else { _sql = "select max(f_no) from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='2'"; //归档的业务,最后的环节 ViewState["CurWorkFlowNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); } ViewState["CurLinkNo"] = DBOpt.dbHelper.ExecuteScalar("select f_flowno from DMIS_SYS_WORKFLOW where f_no=" + ViewState["CurWorkFlowNo"].ToString()); } else //查看历史数据,不能操作任何 { btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_ZDH_DEVICE_FAULT", "TID=" + ViewState["RecNo"].ToString()); return; } } //找当前环节对应的文档 _sql = "select a.f_no,a.f_name,a.f_tablename,a.f_reportfile from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and a.f_packtypedef=1 and b.f_packtypeno=" + ViewState["PackTypeNo"].ToString() + " and b.F_LINKNO=" + ViewState["CurLinkNo"].ToString(); DataTable temp = DBOpt.dbHelper.GetDataTable(_sql); if (temp == null || temp.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); //"没有找到对应的文档!" return; } else { ViewState["DocTypeNo"] = temp.Rows[0][0]; //文档编号 ViewState["DocTypeName"] = temp.Rows[0][1]; //文档名称 ViewState["TableName"] = temp.Rows[0][2]; //文档对应的数据库表名称 ViewState["REPORT_ID"] = temp.Rows[0][3]; //报表编号 } int counts; btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; btnWithdraw.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmWithdraw").ToString() + "');"); //确定要退回到上一步? btnAccept.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmAccept").ToString() + "');"); //确定要接单? if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) //管理员开放本业务类型所涉及的所有业务表修改数据的权限,但不能发送、回退。不参与流转的处理 { btnSave.Enabled = true; btnSaveClose.Enabled = true; _sql = "select f_tablename from dmis_sys_doctype where f_packtypeno=" + ViewState["PackTypeNo"].ToString(); //本业务所涉及到的所有业务表 DataTable AllTables = DBOpt.dbHelper.GetDataTable(_sql); for (int i = 0; i < AllTables.Rows.Count; i++) { WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), AllTables.Rows[i][0].ToString()); } } else { if (Session["Oper"] != null) { if (Convert.ToInt16(Session["Oper"]) > 0) //有权限修改 { WebWorkFlow.SetWebControlRight(this.Page, Session["RoleIDs"].ToString(), Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), ViewState["TableName"].ToString()); btnSave.Enabled = true; btnSaveClose.Enabled = true; btnSend.Enabled = true; btnWithdraw.Enabled = true; //如果是最后一步,则弹出是否要归档的窗口 string sMainer = ""; if (ViewState["CurWorkFlowNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); } if (obj != null) { sMainer = obj.ToString(); } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');"); //确定要提交到下一步?(新建业务时。) } if (sMainer == Session["MemberName"].ToString()) { int iCat = -1; if (ViewState["CurLinkNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } } if (iCat == 2) { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmFinish").ToString() + "');");//该项目已办理完成,是否要归档? } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');");//确定要提交到下一步 } } } else //待办的状态下处理接单按钮 { int flag = -1; //判断是否接单 obj = DBOpt.dbHelper.ExecuteScalar("select f_working from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { flag = Convert.ToInt16(obj); } if (flag == 0) //待办状态 { string zbr = ""; obj = DBOpt.dbHelper.ExecuteScalar("select f_receiver from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { zbr = obj.ToString().Trim(); } if (zbr == "" || zbr == Session["MemberName"].ToString()) { btnAccept.Enabled = true; } } else if (flag == 1) //从办人员点击进入状态,只能提交 { if (WebWorkFlow.IsCongBanRen(ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), Session["MemberName"].ToString())) { btnSend.Enabled = true; } } else { btnAccept.Enabled = false; } } } } FillDropDownList.FillByTable(ref ddlDD_STATION, "DMIS_SYS_STATION", "NAME", "TID"); FillDropDownList.FillByTable(ref ddlXT_TYPE, "T_ZDH_DEVICE_XT_TYPE", "TYPE_NAME", "TID", "ORDER_ID ASC"); FillDropDownList.FillByTable(ref ddlYD_TYPE, "T_ZDH_DEVICE_XT_TYPE", "TYPE_NAME", "TID", "ORDER_ID ASC"); if (Convert.ToInt32(ViewState["RecNo"]) > -1) { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_ZDH_DEVICE_FAULT", "TID=" + ViewState["RecNo"].ToString()); if (!SetRight.IsAdminitrator(Session["MemberID"].ToString())) //不是管理员才设置初始人员及日期,否则会把管理员的名称也赋值给相应的控件 { //设置初始人名,主办人,从办人在后面设置 string[] name = { "txtXT_JDR", "txtYD_JDR", "txtYS_YSR" }; TextBox txt; for (int i = 0; i < name.Length; i++) { txt = (TextBox)Page.FindControl(name[i]); if (txt == null) { continue; } if (!txt.ReadOnly && txt.Text == "") { txt.Text = Session["MemberName"].ToString(); } } //设置初始日期 string[] date = { "wdlXT_XDSJ", "wdlYD_JDSJ", "wdlYS_YSRQ" }; WebDate wdl; for (int i = 0; i < date.Length; i++) { wdl = (WebDate)Page.FindControl(date[i]); if (wdl == null) { continue; } if (wdl.Enabled && wdl.Text == "") { wdl.setTime(DateTime.Now); } } } //设置从办人员的姓名,这样不用两次输入办理人员的姓名 DataTable memberStatus = DBOpt.dbHelper.GetDataTable("select f_receiver from dmis_sys_memberstatus where f_packno=" + ViewState["PackNo"].ToString() + " and f_workflowno=" + ViewState["CurWorkFlowNo"].ToString()); for (int i = 0; i < memberStatus.Rows.Count; i++) { if (!txtXT_JDR.ReadOnly) { if (i == 0) { if (txtXT_JDR2.Text == "") { txtXT_JDR2.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 1) { if (txtXT_JDR3.Text == "") { txtXT_JDR3.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 2) { if (txtXT_JDR4.Text == "") { txtXT_JDR4.Text = memberStatus.Rows[i][0].ToString(); } } } else if (!txtYD_JDR.ReadOnly) { if (i == 0) { if (txtYD_JDR2.Text == "") { txtYD_JDR2.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 1) { if (txtYD_JDR3.Text == "") { txtYD_JDR3.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 2) { if (txtYD_JDR4.Text == "") { txtYD_JDR4.Text = memberStatus.Rows[i][0].ToString(); } } } } } else //新增时,确定缺陷编号 { _sql = "select count(*) from T_ZDH_DEVICE_FAULT where to_char(DD_DATEM,'YYYYMM')='" + DateTime.Now.ToString("yyyyMM") + "'"; counts = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar(_sql)) + 1; txtDD_PH.Text = DateTime.Now.ToString("yyyyMM") + counts.ToString("000"); txtDD_FINDER.Text = Session["MemberName"].ToString(); wdlDD_DATEM.setTime(DateTime.Now); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["sended"] != null) { if (Session["sended"].ToString() == "1" && ViewState["BackUrl"] != null) { Response.Redirect(ViewState["BackUrl"].ToString()); } } if (!IsPostBack) { if (Request["BackUrl"] != null) { ViewState["BackUrl"] = Request["BackUrl"]; } else { ViewState["BackUrl"] = null; } object obj = null; if (Request["PackTypeNo"] != null && Request["CurLinkNo"] != null) //从工作流界面打开,肯定有PackTypeNo和CurLinkNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["CurLinkNo"] = Request["CurLinkNo"]; if (Request["PackNo"] != null) { ViewState["PackNo"] = Request["PackNo"]; _sql = "select f_recno from DMIS_SYS_DOC where f_packno=" + Request["PackNo"] + " and f_linkno=" + Request["CurLinkNo"]; ViewState["RecNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); } else { ViewState["RecNo"] = -1; } if (Request["CurWorkFlowNo"] != null) { ViewState["CurWorkFlowNo"] = Request["CurWorkFlowNo"]; } } else //从业务表查询界面打开,有PackTypeNo、TableName、RecNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["TableName"] = Request["TableName"]; ViewState["RecNo"] = Request["RecNo"]; _sql = "select F_PACKNO from DMIS_SYS_DOC where f_TableName='" + Request["TableName"].ToString() + "' and f_recno=" + ViewState["RecNo"].ToString(); ViewState["PackNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["PackNo"] == null) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoFindPackNo").ToString()); //"没有找到对应的业务号!" return; } obj = DBOpt.dbHelper.ExecuteScalar("select f_no from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='1'"); if (obj != null) //在办的业务 { ViewState["CurWorkFlowNo"] = obj; } else { _sql = "select max(f_no) from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='2'"; //归档的业务,最后的环节 ViewState["CurWorkFlowNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); } ViewState["CurLinkNo"] = DBOpt.dbHelper.ExecuteScalar("select f_flowno from DMIS_SYS_WORKFLOW where f_no=" + ViewState["CurWorkFlowNo"].ToString()); } //找当前环节对应的文档 _sql = "select a.f_no,a.f_name,a.f_tablename,a.f_reportfile from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and a.f_packtypedef=1 and b.f_packtypeno=" + ViewState["PackTypeNo"].ToString() + " and b.F_LINKNO=" + ViewState["CurLinkNo"].ToString(); DataTable temp = DBOpt.dbHelper.GetDataTable(_sql); if (temp == null || temp.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); //"没有找到对应的文档!" return; } else { ViewState["DocTypeNo"] = temp.Rows[0][0]; //文档编号 ViewState["DocTypeName"] = temp.Rows[0][1]; //文档名称 ViewState["TableName"] = temp.Rows[0][2]; //文档对应的数据库表名称 ViewState["REPORT_ID"] = temp.Rows[0][3]; //报表编号 } int counts; btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; btnWithdraw.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmWithdraw").ToString() + "');"); //确定要退回到上一步? btnAccept.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmAccept").ToString() + "');"); //确定要接单? if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) //管理员开放本业务类型所涉及的所有业务表修改数据的权限,但不能发送、回退。不参与流转的处理 { btnSave.Enabled = true; btnSaveClose.Enabled = true; _sql = "select f_tablename from dmis_sys_doctype where f_packtypeno=" + ViewState["PackTypeNo"].ToString(); //本业务所涉及到的所有业务表 DataTable AllTables = DBOpt.dbHelper.GetDataTable(_sql); for (int i = 0; i < AllTables.Rows.Count; i++) { WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), AllTables.Rows[i][0].ToString()); } } else { if (Session["Oper"] != null) { if (Convert.ToInt16(Session["Oper"]) > 0) //有权限修改 { WebWorkFlow.SetWebControlRight(this.Page, Session["RoleIDs"].ToString(), Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), ViewState["TableName"].ToString()); btnSave.Enabled = true; btnSaveClose.Enabled = true; btnSend.Enabled = true; btnWithdraw.Enabled = true; //如果是最后一步,则弹出是否要归档的窗口 string sMainer = ""; if (ViewState["CurWorkFlowNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); } if (obj != null) { sMainer = obj.ToString(); } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');"); //确定要提交到下一步?(新建业务时。) } if (sMainer == Session["MemberName"].ToString()) { int iCat = -1; if (ViewState["CurLinkNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } } if (iCat == 2) { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmFinish").ToString() + "');");//该项目已办理完成,是否要归档? } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');");//确定要提交到下一步 } } } else //待办的状态下处理接单按钮 { int flag = -1; //判断是否接单 obj = DBOpt.dbHelper.ExecuteScalar("select f_working from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { flag = Convert.ToInt16(obj); } if (flag == 0) //待办状态 { string zbr = ""; obj = DBOpt.dbHelper.ExecuteScalar("select f_receiver from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { zbr = obj.ToString().Trim(); } if (zbr == "" || zbr == Session["MemberName"].ToString()) { btnAccept.Enabled = true; } } else if (flag == 1) //从办人员点击进入状态,只能提交 { if (WebWorkFlow.IsCongBanRen(ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), Session["MemberName"].ToString())) { btnSend.Enabled = true; } } else { btnAccept.Enabled = false; } } } } FillDropDownList.FillHtmlCombxByTable(ref hcbSTATION, "DMIS_SYS_STATION", "NAME", "TID", "ORDER_ID"); FillDropDownList.FillHtmlCombxByTable(ref hcbBUILDER, "t_zh_wts_dw_para", "DW_NAME", "TID", "DW_ORDER"); //FillDropDownList.FillHtmlCombxByTable(ref hcb投运单接收登记人, "DMIS_VIEW_DEPART_MEMBER_ROLE", "MEMBER_NAME", "MEMBER_ID", "MEMBER_NAME", "ROLE_ID=1 or ROLE_ID=2 or ROLE_ID=3"); //1:主网调度员;2:配网调度员;3为调度值长 //FillDropDownList.FillHtmlCombxByTable(ref hcb投运调度员, "DMIS_VIEW_DEPART_MEMBER_ROLE", "MEMBER_NAME", "MEMBER_ID", "MEMBER_NAME", "ROLE_ID=1 or ROLE_ID=2 or ROLE_ID=3"); //填充调度员,上面的语句会产生重复 DataTable mem = DBOpt.dbHelper.GetDataTable("select distinct MEMBER_NAME from DMIS_VIEW_DEPART_MEMBER_ROLE where ROLE_ID=1 or ROLE_ID=2 or ROLE_ID=3"); hcbACCEPTER.DataSource = mem; hcbACCEPTER.DataTextField = "MEMBER_NAME"; hcbACCEPTER.DataBind(); hcbDISPATCHER.DataSource = mem; hcbDISPATCHER.DataTextField = "MEMBER_NAME"; hcbDISPATCHER.DataBind(); if (Convert.ToInt32(ViewState["RecNo"]) > -1) { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_DD_RUN_NOTICE", "TID=" + ViewState["RecNo"].ToString()); //设置初始人名 string[] name = { "hcbACCEPTER", "hcbDISPATCHER" }; HtmlComboBox hcb; for (int i = 0; i < name.Length; i++) { hcb = (HtmlComboBox)Page.FindControl(name[i]); if (hcb == null) { continue; } if (hcb.Enabled && hcb.Text == "") { hcb.Text = Session["MemberName"].ToString(); } } //设置初始日期 string[] date = { "wdlSTARTDATE", "wdlRUN_DATE" }; WebDate wdl; for (int i = 0; i < date.Length; i++) { wdl = (WebDate)Page.FindControl(date[i]); if (wdl == null) { continue; } if (wdl.Enabled && wdl.Text == "") { wdl.setTime(DateTime.Now); } } } else //新增时,确定缺陷编号 { _sql = "select max(PH) from T_DD_RUN_NOTICE"; obj = DBOpt.dbHelper.ExecuteScalar(_sql); //没有值时,obj.ToString()取值为System.Object if (obj == null || obj is DBNull) { counts = 1; } else { if (int.TryParse(obj.ToString(), out counts)) { counts = counts + 1; } else { counts = 1; } } txtPH.Text = counts.ToString(); wdlSTARTDATE.setTime(DateTime.Now); } } }