//退回操作 protected void btnWithdraw_Click(object sender, EventArgs e) { //退回前先保存 btnSave_Click(null, null); if (detail_info.InnerText != "") { return; } _sql = "SELECT F_PREFLOWNO FROM DMIS_SYS_WORKFLOW WHERE F_PACKNO=" + ViewState["PackNo"] + " AND F_NO=" + ViewState["CurWorkFlowNo"] + " AND F_RECEIVER='" + Session["MemberName"] + "'"; object obj = DBOpt.dbHelper.ExecuteScalar(_sql); if (obj == null) { //Response.Write("<script language=javascript>alert('只有主办人使用');</script>"); return; } if (Convert.ToInt16(obj) < 0) { Response.Write("<script language=javascript>alert('" + GetGlobalResourceObject("WebGlobalResource", "WkFirstStepNoWithdraw").ToString() + "');</script>"); //流程的开始步骤不允许退回 return; } //判断分支节点能否退回。 if (!WebWorkFlow.IsCanWithdraw(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]))) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkHasNextWorkingStepNoWithdraw").ToString()); //"还有下级任务在处理,不允许退回" return; } string paras; paras = "PackTypeNo=" + ViewState["PackTypeNo"] + "&CurLinkNo=" + ViewState["CurLinkNo"] + "&PackNo=" + ViewState["PackNo"] + "&CurWorkFlowNo=" + ViewState["CurWorkFlowNo"] + "&PreCurWorkFlowNo=" + obj.ToString(); Response.Write("<script language=javascript>"); Response.Write("window.open('../SYS_WorkFlow/InstanceWithdrawPopMessage.aspx?" + paras + "','退回'" + ",'height=200,width=440,top=100,left=100,scrollbars=no,resizable=yes');"); Response.Write("</script>"); }
protected void btnSend_Click(object sender, EventArgs e) { if (((DataTable)ViewState["result"]).Rows.Count < 1) { tdErrorMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkMustSelectOneTache").ToString();//至少要选择一个发送的环节! return; } string sReceive = ""; bool bCreated = false; int iWorkFlowNo = Convert.ToInt32(ViewState["CurWorkFlowNo"]); DataTable result = (DataTable)ViewState["result"]; for (int i = 0; i < result.Rows.Count; i++) { if (result.Rows[i]["CJRY"] != null && result.Rows[i]["CJRY"].ToString().Trim() != "") { sReceive = result.Rows[i]["CJRY"].ToString(); } iWorkFlowNo = Convert.ToInt32(ViewState["CurWorkFlowNo"]); bCreated = WebWorkFlow.CreateFlow(Convert.ToInt32(ViewState["PackNo"]), ref iWorkFlowNo, Session["MemberName"].ToString(), Convert.ToInt32(result.Rows[i]["FlowID"]), sReceive, result.Rows[i]["FZR"].ToString(), txtMessage.Text, ViewState["RecNo"].ToString()); if (!bCreated) { tdErrorMessage.InnerText = "发送到环节:" + result.Rows[i]["FlowName"].ToString() + " 出错!"; return; } sReceive = ""; //统计实际工作时间 WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); } Session["sended"] = 1; ViewState["CurWorkFlowNo"] = iWorkFlowNo; Response.Write(webfun.CloseWin("refreshPage")); }
protected void grvList_RowCommand(object sender, GridViewCommandEventArgs e) { int row; if (!int.TryParse(e.CommandArgument.ToString(), out row)) { return; } int PackNo; //业务编号 PackNo = Convert.ToInt16(grvList.DataKeys[row].Values[0]); if (e.CommandName == "FlowTable") //流程 { Session["Oper"] = 0; Session["sended"] = "0"; Response.Redirect("FlowTable.aspx?InstanceID=" + PackNo + @"&BackUrl=" + Page.Request.RawUrl); } else if (e.CommandName == "Del") //删除 { WebWorkFlow.DeletePack(PackNo, Session["MemberName"].ToString()); GridViewBind(); } }
protected void btnSend_Click(object sender, EventArgs e) { //提交前先保存 btnSave_Click(null, null); if (tdMessage.InnerText != "") { return; } string returnString = ""; //发送前条件判断 returnString = WebWorkFlow.TacheSendCondition(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } string sMainer = ""; object obj; obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { sMainer = obj.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) { int iFno = WebWorkFlow.EndFlow(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString()); if (iFno == -1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkFinishFailMessage").ToString());//此业务归档失败,请联系统管理员! return; } else { //JScript.Alert("此业务归档成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } } else { string paras; //发送岗位时,派工环节,弹出发送窗口 if (WebWorkFlow.IsAssignTache(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]))) { paras = "PackTypeNo=" + ViewState["PackTypeNo"] + "&CurLinkNo=" + ViewState["CurLinkNo"] + "&PackNo=" + ViewState["PackNo"] + "&CurWorkFlowNo=" + ViewState["CurWorkFlowNo"] + "&TableName=" + ViewState["TableName"].ToString() + "&RecNo=" + ViewState["RecNo"].ToString(); Session["sended"] = 0; JScript.OpenWindow("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=670,height=500,top=20,left=100"); //Response.Write(webfun.OpenWin("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=480,top=20,left=100")); } else //非派工环节,直接发送即可 { int curTaskID = Convert.ToInt16(ViewState["CurWorkFlowNo"]); if (WebWorkFlow.DirectCreateFlow(Convert.ToInt16(ViewState["PackNo"]), ref curTaskID, Session["MemberName"].ToString())) { //两种统计时间的方法,看用户用何种 //1、根据工作流的相关表DMIS_SYS_WORKFLOW DMIS_SYS_MEMBERSTATUS来统计实际工作时间 //WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), // ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); //2、根据业务表保存的人名来统计实际工作时间 string[] members = new string[4]; if (!txtXT_JDR.ReadOnly) //统计系统人员工作时间 { members[0] = txtXT_JDR.Text; members[1] = txtXT_JDR2.Text; members[2] = txtXT_JDR3.Text; members[3] = txtXT_JDR4.Text; WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["PackNo"].ToString(), "24", ViewState["TableName"].ToString(), ViewState["RecNo"].ToString(), "否", members); } else if (!txtYD_JDR.ReadOnly) //统计远动人员工作时间 { members[0] = txtYD_JDR.Text; members[1] = txtYD_JDR2.Text; members[2] = txtYD_JDR3.Text; members[3] = txtYD_JDR4.Text; WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["PackNo"].ToString(), "25", ViewState["TableName"].ToString(), ViewState["RecNo"].ToString(), "是", members); } Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString());//"此任务发送失败,请联系统管理员!" return; } } } } else { //从办人员提交,只是结束其办理状态 if (WebWorkFlow.EndMemberStatus(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString())) { //JScript.Alert("提交成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString()); //更新状态失败! } } }
protected void btnSave_Click(object sender, EventArgs e) { string re; //系统管理员只修改所有文档对就的业务表的数据,但不产生新的记录。 //2009-3-25 用户要求修改缺陷单的级别时,同时要修改业务流任务的描述。 if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) { DataTable doc = DBOpt.dbHelper.GetDataTable("select distinct f_tablename,f_recno from dmis_sys_doc where f_packno=" + ViewState["PackNo"].ToString()); for (int i = 0; i < doc.Rows.Count; i++) { re = ControlWebValidator.Validate(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } else { //2009-3-25 修改业务流任务的描述 int packNO; if (ViewState["PackNo"] != null && int.TryParse(ViewState["PackNo"].ToString(), out packNO)) { string station = ""; string planStarttime = wdlDD_DATEM.getTime().ToString("dd-MM-yyyy HH:mm"); double planHours = 0; if (ddlDD_TYPE.SelectedItem.Text == "Commonly") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Commonly"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Importance") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Importance"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Urgency") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Urgency"]); } string desc = "(" + ddlDD_TYPE.SelectedItem.Text + txtDD_PH.Text + ")" + txtDD_FAULT.Text.Trim(); //任务描述 desc = desc.Replace('\'', '‘'); desc = desc.Replace('"', '“'); string planEndtime = wdlDD_DATEM.getTime().AddHours(planHours).ToString("dd-MM-yyyy HH:mm"); if (ddlDD_STATION.SelectedItem != null) { station = ddlDD_STATION.SelectedItem.Text; } _sql = "update DMIS_SYS_PACK set f_desc='" + desc + "',plan_endtime='" + planEndtime + "' where f_no=" + packNO; DBOpt.dbHelper.ExecuteSql(_sql); } tdMessage.InnerText = ""; } } return; } //其它人员处理业务时保存 bool isAdd = false; if (txtTID.Text == "") { isAdd = true; //判断是否是新增的,保存之后,txtTID会有值,故在此判断 } re = ControlWebValidator.Validate(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } tdMessage.InnerText = ""; //第一次保存时,生成工作流数据 if (isAdd) { uint packNo = 0; string station = ""; string planStarttime = wdlDD_DATEM.getTime().ToString("dd-MM-yyyy HH:mm"); double planHours = 0; if (ddlDD_TYPE.SelectedItem.Text == "Commonly") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Commonly"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Importance") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Importance"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Urgency") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Urgency"]); } string desc = "(" + ddlDD_TYPE.SelectedItem.Text + txtDD_PH.Text + ")" + txtDD_FAULT.Text.Trim(); //任务描述 string planEndtime = wdlDD_DATEM.getTime().AddHours(planHours).ToString("dd-MM-yyyy HH:mm"); if (ddlDD_STATION.SelectedItem != null) { station = ddlDD_STATION.SelectedItem.Text; } if (WebWorkFlow.CreatePack(Convert.ToInt32(ViewState["PackTypeNo"]), desc, Session["MemberName"].ToString(), ref packNo, station, planStarttime, planEndtime) < 0) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString()); //创建业务数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString(); return; } int iFirstFlowNo = -1; int iWorkFlowNo = -1; iFirstFlowNo = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar("select F_NO from DMIS_SYS_FLOWLINK where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_FLOWCAT=0")); bool bCreated = WebWorkFlow.CreateFlow(Convert.ToInt16(packNo), ref iWorkFlowNo, Session["MemberName"].ToString(), iFirstFlowNo, "", Session["MemberName"].ToString(), "", txtTID.Text); //第一次新建流程时,传接从办人的姓名列表 if (!bCreated) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString());//创建工作流数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString(); return; } ViewState["PackNo"] = packNo; ViewState["CurWorkFlowNo"] = iWorkFlowNo; ViewState["CurLinkNo"] = iFirstFlowNo; ViewState["RecNo"] = txtTID.Text; //增加PACK_NO值 _sql = "update " + ViewState["TableName"].ToString() + " set PACK_NO=" + packNo + " where TID=" + txtTID.Text; DBOpt.dbHelper.ExecuteSql(_sql); } //只有用户保存了,确认它接收此任务了。 //修改已经接收的状态,使此业务不能抽回 if (ViewState["CurWorkFlowNo"] != null && Convert.ToInt16(ViewState["CurWorkFlowNo"]) > 0) { object obj = DBOpt.dbHelper.ExecuteScalar("select f_working from dmis_sys_workflow where f_no=" + ViewState["CurWorkFlowNo"]); if (obj == null || Convert.ToInt16(obj) == 0) //已经接收的,允许再接收 { _sql = "update dmis_sys_workflow set f_working=1,f_receiver='" + Session["MemberName"].ToString() + "',f_receivedate='" + DateTime.Now.ToString("dd-MM-yyyy HH:mm") + "' where f_no=" + ViewState["CurWorkFlowNo"]; DBOpt.dbHelper.ExecuteSql(_sql); } } }
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 btnSend_Click(object sender, EventArgs e) { //提交前先保存 btnSave_Click(null, null); if (tdMessage.InnerText != "") { return; } string returnString = ""; object obj; //发送前判断汇集环节的所有分支是否都到达此节点 obj = DBOpt.dbHelper.ExecuteScalar("select f_nodetype from dmis_sys_flowlink where f_no=" + ViewState["CurLinkNo"].ToString()); if (obj != null && Convert.ToInt16(obj) == 2) { returnString = WebWorkFlow.InfluxTacheSendCondition(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"])); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } } //发送前条件判断 returnString = WebWorkFlow.TacheSendCondition(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } string sMainer = ""; obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { sMainer = obj.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) { int iFno = WebWorkFlow.EndFlow(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString()); if (iFno == -1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkFinishFailMessage").ToString());//此业务归档失败,请联系统管理员! return; } else { //JScript.Alert("此业务归档成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } } else { string paras; //发送岗位时,派工环节,弹出发送窗口 if (WebWorkFlow.IsAssignTache(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]))) { paras = "PackTypeNo=" + ViewState["PackTypeNo"] + "&CurLinkNo=" + ViewState["CurLinkNo"] + "&PackNo=" + ViewState["PackNo"] + "&CurWorkFlowNo=" + ViewState["CurWorkFlowNo"] + "&TableName=" + ViewState["TableName"].ToString() + "&RecNo=" + ViewState["RecNo"].ToString(); Session["sended"] = 0; JScript.OpenWindow("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=500,top=20,left=100"); //Response.Write(webfun.OpenWin("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=480,top=20,left=100")); } else //非派工环节,直接发送即可 { int curTaskID = Convert.ToInt16(ViewState["CurWorkFlowNo"]); if (WebWorkFlow.DirectCreateFlow(Convert.ToInt16(ViewState["PackNo"]), ref curTaskID, Session["MemberName"].ToString())) { //统计实际工作时间 //1、根据工作流的相关表DMIS_SYS_WORKFLOW DMIS_SYS_MEMBERSTATUS来统计实际工作时间 WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString());//"此任务发送失败,请联系统管理员!" return; } } } } else { //结束从办人员的办理状态 if (WebWorkFlow.EndMemberStatus(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString())) { //JScript.Alert("提交成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString()); //更新状态失败! } } }
protected override void btnSave_Click(object sender, EventArgs e) { string re; //系统管理员只修改所有文档对就的业务表的数据,但不产生新的记录 if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) { DataTable doc = DBOpt.dbHelper.GetDataTable("select distinct f_tablename,f_recno from dmis_sys_doc where f_packno=" + ViewState["PackNo"].ToString()); for (int i = 0; i < doc.Rows.Count; i++) { re = ControlWebValidator.Validate(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } tdMessage.InnerText = ""; } return; } bool isAdd = false; if (txtTID.Text == "") { isAdd = true; //判断是否是新增的,保存之后,txtTID会有值,故在此判断 } re = ControlWebValidator.Validate(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } tdMessage.InnerText = ""; //第一次保存时,生成工作流数据 if (isAdd) { uint packNo = 0; string station = ""; //if (hcb厂站.SelectedItem != null) station = hcb厂站.SelectedItem.Text; station = hcbSTATION.SelectedText; // string planStarttime = wdlSTARTDATE.getTime().ToString("dd-MM-yyyy HH:mm"); string planEndtime = wdlENDDATE.getTime().ToString("dd-MM-yyyy HH:mm"); if (WebWorkFlow.CreatePack(Convert.ToInt32(ViewState["PackTypeNo"]), "(" + txtPH.Text + ")" + txtDEVICE_NAME.Text, Session["MemberName"].ToString(), ref packNo, station, planStarttime, planEndtime) < 0) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString()); //创建业务数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString(); return; } int iFirstFlowNo = -1; int iWorkFlowNo = -1; iFirstFlowNo = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar("select F_NO from DMIS_SYS_FLOWLINK where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_FLOWCAT=0")); bool bCreated = WebWorkFlow.CreateFlow(Convert.ToInt16(packNo), ref iWorkFlowNo, Session["MemberName"].ToString(), iFirstFlowNo, "", Session["MemberName"].ToString(), "", txtTID.Text); //第一次新建流程时,传接从办人的姓名列表 if (!bCreated) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString());//创建工作流数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString(); return; } ViewState["PackNo"] = packNo; ViewState["CurWorkFlowNo"] = iWorkFlowNo; ViewState["CurLinkNo"] = iFirstFlowNo; ViewState["RecNo"] = txtTID.Text; //增加PACK_NO值 _sql = "update " + ViewState["TableName"].ToString() + " set PACK_NO=" + packNo + " where TID=" + txtTID.Text; DBOpt.dbHelper.ExecuteSql(_sql); } //只有用户保存了,确认它接收此任务了。 //修改已经接收的状态,使此业务不能抽回 if (ViewState["CurWorkFlowNo"] != null && Convert.ToInt16(ViewState["CurWorkFlowNo"]) > 0) { object obj = DBOpt.dbHelper.ExecuteScalar("select f_working from dmis_sys_workflow where f_no=" + ViewState["CurWorkFlowNo"]); if (obj == null || Convert.ToInt16(obj) == 0) //已经接收的,允许再接收 { _sql = "update dmis_sys_workflow set f_working=1,f_receiver='" + Session["MemberName"].ToString() + "',f_receivedate='" + DateTime.Now.ToString("dd-MM-yyyy HH:mm") + "' where f_no=" + ViewState["CurWorkFlowNo"]; DBOpt.dbHelper.ExecuteSql(_sql); } } }
protected void btnSave_Click(object sender, EventArgs e) { string re = ""; //系统管理员只修改所有文档对就的业务表的数据,但不产生新的记录 if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) { DataTable doc = DBOpt.dbHelper.GetDataTable("select distinct f_tablename,f_recno from dmis_sys_doc where f_packno=" + ViewState["PackNo"].ToString()); for (int i = 0; i < doc.Rows.Count; i++) { if (doc.Rows[i][0].ToString() == "T_BZ_TASK_DISPOSE" && txtDISPOSE_TID.Text == "") { continue; } if (doc.Rows[i][0].ToString() == "T_BZ_TASK" && txtTID.Text == "") { continue; } if (doc.Rows[i][0].ToString() == "T_BZ_TASK_CHEECK" && txtCHECK_TID.Text == "") { continue; } re = ControlWebValidator.Validate(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } tdMessage.InnerText = ""; } return; } bool isAdd = false; bool isStartLink = false; //是否起始环节 object obj; TextBox txtPrimaryField = null; Control con; //此业务对应的所有数据库表,一个环节只能保存一个数据库表 DataTable tables = DBOpt.dbHelper.GetDataTable("select f_tablename from dmis_sys_doctype where f_doccat='业务表' and f_packtypeno=" + ViewState["PackTypeNo"].ToString()); for (int i = 0; i < tables.Rows.Count; i++) { if (tables.Rows[i][0].ToString() == ViewState["TableName"].ToString()) { con = Page.FindControl(DBOpt.dbHelper.ExecuteScalar("select a.custom_control_name from DMIS_SYS_COLUMNS a,DMIS_SYS_TABLES b where isprimary=1 and a.table_id=b.id and b.name='" + ViewState["TableName"].ToString() + "'").ToString()); if (con == null) { //JScript.Alert("对不起!无法找到表" + ViewState["TableName"].ToString() + "的主键对应的控件!"); //tdMessage.InnerText = "对不起!无法找到表" + ViewState["TableName"].ToString() + "的主键对应的控件!"; return; } txtPrimaryField = (TextBox)con; break; } } if (txtPrimaryField.Text == "") { isAdd = true; } //保存业务表的数据 re = ControlWebValidator.Validate(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } tdMessage.InnerText = ""; re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } tdMessage.InnerText = ""; _sql = "select f_flowcat from dmis_sys_flowlink where f_no=" + ViewState["CurLinkNo"].ToString(); obj = DBOpt.dbHelper.ExecuteScalar(_sql); if (obj != null && obj.ToString() == "0") { isStartLink = true; } //新建业务数据并且是起始环节时,创建工作流数据 if (isAdd && isStartLink) { uint packNo = 0; string station = ""; string startTime, endTime; startTime = ""; endTime = ""; station = hcbSTATION.SelectedText; if (wdlSTARTTIME.getTime().ToString("yyyy-MM-dd") != "1900-01-01" && wdlENDTIME.getTime().ToString("yyyy-MM-dd") != "1900-01-01") { startTime = wdlSTARTTIME.getTime().ToString("dd-MM-yyyy HH:mm"); endTime = wdlENDTIME.getTime().ToString("dd-MM-yyyy HH:mm"); } if (WebWorkFlow.CreatePack(Convert.ToInt32(ViewState["PackTypeNo"]), txtCONTENT.Text, Session["MemberName"].ToString(), ref packNo, station, startTime, endTime) < 0) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString()); //创建业务数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString(); return; } tdMessage.InnerText = ""; int iFirstFlowNo = -1; int iWorkFlowNo = -1; iFirstFlowNo = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar("select F_NO from DMIS_SYS_FLOWLINK where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_FLOWCAT=0")); bool bCreated = WebWorkFlow.CreateFlow(Convert.ToInt16(packNo), ref iWorkFlowNo, Session["MemberName"].ToString(), iFirstFlowNo, "", Session["MemberName"].ToString(), "", txtPrimaryField.Text); if (!bCreated) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString());//创建工作流数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString(); return; } tdMessage.InnerText = ""; ViewState["PackNo"] = packNo; ViewState["CurWorkFlowNo"] = iWorkFlowNo; ViewState["CurLinkNo"] = iFirstFlowNo; ViewState["RecNo"] = txtPrimaryField.Text; //增加PACK_NO值 //_sql = "update " + ViewState["TableName"].ToString() + " set PACK_NO=" + packNo + " where TID=" + txtPrimaryField.Text; //DBOpt.dbHelper.ExecuteSql(_sql); } //if (isAdd) //增加总结验收时的情况。 //{ //2009-3-6所有步骤都要更新业务表中的PACK_NO,故保存时,都保存一下当前业务表中相应的业务号. _sql = "update " + ViewState["TableName"].ToString() + " set PACK_NO=" + ViewState["PackNo"].ToString() + " where TID=" + txtPrimaryField.Text; DBOpt.dbHelper.ExecuteSql(_sql); //} //只有用户保存了,确认它接收此任务了。 //修改已经接收的状态,使此业务不能抽回 if (ViewState["CurWorkFlowNo"] != null && Convert.ToInt16(ViewState["CurWorkFlowNo"]) > 0) { obj = DBOpt.dbHelper.ExecuteScalar("select f_working from dmis_sys_workflow where f_no=" + ViewState["CurWorkFlowNo"]); if (obj == null || Convert.ToInt16(obj) == 0) //已经接收的,允许再接收 { _sql = "update dmis_sys_workflow set f_working=1,f_receiver='" + Session["MemberName"].ToString() + "',f_receivedate='" + DateTime.Now.ToString("dd-MM-yyyy HH:mm") + "' where f_no=" + ViewState["CurWorkFlowNo"]; DBOpt.dbHelper.ExecuteSql(_sql); } } }
protected void grvList_RowCommand(object sender, GridViewCommandEventArgs e) { int row; if (!int.TryParse(e.CommandArgument.ToString(), out row)) { return; } if (e.CommandName == "FlowTable") //流程 { Response.Redirect("FlowTable.aspx?InstanceID=" + grvList.DataKeys[row].Value.ToString() + @"&BackUrl=" + Page.Request.RawUrl); } else if (e.CommandName == "Deal") //办理 { object obj; int RecNo; //记录编号 int DocTypeNo; //文档类型号 int PackTypeNo; //业务类型编号 int CurLinkNo; //当前环节号 int PackNo; //当前业务号 int CurWorkFlowNo; //工作流编号 dmis_sys_workflow表中的f_no值 PackTypeNo = Convert.ToInt16(grvList.DataKeys[row].Values[2]); PackNo = Convert.ToInt16(grvList.DataKeys[row].Value); CurLinkNo = Convert.ToInt16(grvList.DataKeys[row].Values[1]); CurWorkFlowNo = Convert.ToInt16(grvList.DataKeys[row].Values[3]); _sql = "select f_recno from DMIS_SYS_DOC where F_PACKNO=" + PackNo + " and F_LINKNO=" + CurLinkNo; obj = DBOpt.dbHelper.ExecuteScalar(_sql); if (obj == null) { RecNo = -1; } else { RecNo = Convert.ToInt16(obj); } DataTable docType = DBOpt.dbHelper.GetDataTable("select a.f_no,a.f_formfile,a.f_tablename,a.f_target from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and b.f_packtypeno=" + PackTypeNo + " and b.F_LINKNO=" + CurLinkNo); if (docType == null || docType.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "GridViewSqlErrorMessage").ToString()); return; } DocTypeNo = Convert.ToInt16(docType.Rows[0][0]); DataTable rights = WebWorkFlow.DocTypeRights(DocTypeNo, Session["RoleIDs"].ToString());; if (rights != null && rights.Rows.Count > 0) { if (grvList.Rows[row].Cells[6].Text == Session["MemberName"].ToString()) //是主办人,可以修改 { Session["Oper"] = 1; } else { Session["Oper"] = 0; //从办人员,不能修改。 } Session["sended"] = "0"; Response.Redirect(docType.Rows[0][1].ToString() + "?RecNo=" + RecNo + @"&BackUrl=" + Page.Request.RawUrl + "&PackTypeNo=" + PackTypeNo + "&CurLinkNo=" + CurLinkNo + "&PackNo=" + PackNo + "&CurWorkFlowNo=" + CurWorkFlowNo); } else { Response.Write("<script language=javascript>alert('" + GetGlobalResourceObject("WebGlobalResource", "WkNoRightToRead").ToString() + "')</script>"); //对不起!你无权操作本文档 } } }
protected void grvList_RowCommand(object sender, GridViewCommandEventArgs e) { int row; if (!int.TryParse(e.CommandArgument.ToString(), out row)) { return; } if (e.CommandName == "FlowTable") //流程 { Response.Redirect("FlowTable.aspx?InstanceID=" + grvList.DataKeys[row].Value.ToString() + @"&BackUrl=" + Page.Request.RawUrl); } else if (e.CommandName == "Deal") //办理 { object obj; int RecNo; //记录编号 int DocTypeNo; //文档类型号 int PackTypeNo; //业务类型编号 int CurLinkNo; //当前环节号 int PackNo; //当前业务号 int CurWorkFlowNo; //工作流编号 dmis_sys_workflow表中的f_no值 PackTypeNo = Convert.ToInt16(grvList.DataKeys[row].Values[2]); PackNo = Convert.ToInt16(grvList.DataKeys[row].Value); CurLinkNo = Convert.ToInt16(grvList.DataKeys[row].Values[1]); CurWorkFlowNo = Convert.ToInt16(grvList.DataKeys[row].Values[3]); _sql = "select f_recno from DMIS_SYS_DOC where F_PACKNO=" + PackNo + " and F_LINKNO=" + CurLinkNo; obj = DBOpt.dbHelper.ExecuteScalar(_sql); if (obj == null) { RecNo = -1; } else { RecNo = Convert.ToInt16(obj); } DataTable docType = DBOpt.dbHelper.GetDataTable("select a.f_no,a.f_formfile,a.f_tablename,a.f_target from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and b.f_packtypeno=" + PackTypeNo + " and b.F_LINKNO=" + CurLinkNo); if (docType == null || docType.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); return; } DocTypeNo = Convert.ToInt16(docType.Rows[0][0]); DataTable rights = WebWorkFlow.DocTypeRights(DocTypeNo, Session["RoleIDs"].ToString());; if (rights != null && rights.Rows.Count > 0) { Session["Oper"] = 0; //待办状态只能读,不能修改,故下述代码注消 //for (int i = 0; i < rights.Rows.Count; i++) //{ // if (rights.Rows[i][0].ToString()[2] == '1' || rights.Rows[i][0].ToString()[3] == '1') // { // Session["Oper"] = 1; // break; // } //} Session["sended"] = "0"; Response.Redirect(docType.Rows[0][1].ToString() + "?RecNo=" + RecNo + @"&BackUrl=" + Page.Request.RawUrl + "&PackTypeNo=" + PackTypeNo + "&CurLinkNo=" + CurLinkNo + "&PackNo=" + PackNo + "&CurWorkFlowNo=" + CurWorkFlowNo); } else { Response.Write("<script language=javascript>alert('" + GetGlobalResourceObject("WebGlobalResource", "WkNoRightToRead").ToString() + "')</script>"); //对不起!你无权操作本文档 } } else if (e.CommandName == "Accept") // 接单 { string CurWorkFlowNo; //工作流编号 dmis_sys_workflow表中的f_no值 int CurLinkNo = Convert.ToInt16(grvList.DataKeys[row].Values[1]); CurWorkFlowNo = Convert.ToString(grvList.DataKeys[row].Values[3]); object obj = DBOpt.dbHelper.ExecuteScalar("select f_planday from dmis_sys_flowlink where f_no=" + CurLinkNo); string finishedTime = ""; if (obj != null) { finishedTime = WebWorkFlow.GetLastTime(DateTime.Now, Convert.ToUInt32(obj)); } if (Session["MemberName"].ToString() == grvList.Rows[row].Cells[7].Text || grvList.Rows[row].Cells[7].Text == " ") //如果没有主办人,则相同岗位的人都可以接收。 { _sql = "update dmis_sys_workflow set f_working=1,f_receiver='" + Session["MemberName"].ToString() + "',f_receivedate='" + DateTime.Now.ToString("dd-MM-yyyy HH:mm") + "',F_LAST_FINISHED_TIME='" + finishedTime + "' where f_no=" + CurWorkFlowNo; DBOpt.dbHelper.ExecuteSql(_sql); GridViewBind(); } else { //JScript.Alert("只有主办人才可以接单!"); return; } } }
protected void btnSave_Click(object sender, EventArgs e) { string re; //系统管理员只修改所有文档对就的业务表的数据,但不产生新的记录。 //2009-3-25 用户要求修改缺陷单的级别时,同时要修改业务流任务的描述。 if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) { DataTable doc = DBOpt.dbHelper.GetDataTable("select distinct f_tablename,f_recno from dmis_sys_doc where f_packno=" + ViewState["PackNo"].ToString()); for (int i = 0; i < doc.Rows.Count; i++) { re = ControlWebValidator.Validate(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); detail_info.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); detail_info.InnerText = re; return; } else { detail_info.InnerText = ""; } } return; } re = ControlWebValidator.Validate(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); detail_info.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); detail_info.InnerText = re; return; } detail_info.InnerText = ""; //第一次保存时,生成工作流数据 if (txtPACK_NO.Text.Trim() == "") //这才是判断标准 { uint packNo = 0; string station = hcbSTATION.SelectedText; string planStarttime = wdlDATEM.getTime().ToString("dd-MM-yyyy HH:mm"); double planHours = 0; string desc = "(" + txtPH.Text + ")" + txtCOMMAND_CONTENT.Text.Trim(); //任务描述 string planEndtime = wdlDATEM.getTime().AddHours(planHours).ToString("dd-MM-yyyy HH:mm"); if (WebWorkFlow.CreatePack(Convert.ToInt32(ViewState["PackTypeNo"]), desc, Session["MemberName"].ToString(), ref packNo, station, planStarttime, planEndtime) < 0) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString()); //创建业务数据失败! detail_info.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString(); return; } int iFirstFlowNo = -1; int iWorkFlowNo = -1; iFirstFlowNo = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar("select F_NO from DMIS_SYS_FLOWLINK where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_FLOWCAT=0")); bool bCreated = WebWorkFlow.CreateFlow(Convert.ToInt16(packNo), ref iWorkFlowNo, Session["MemberName"].ToString(), iFirstFlowNo, "", Session["MemberName"].ToString(), "", txtTID.Text); //第一次新建流程时,传接从办人的姓名列表 if (!bCreated) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString());//创建工作流数据失败! detail_info.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString(); return; } ViewState["PackNo"] = packNo; ViewState["CurWorkFlowNo"] = iWorkFlowNo; ViewState["CurLinkNo"] = iFirstFlowNo; ViewState["RecNo"] = txtTID.Text; //增加PACK_NO值 _sql = "update " + ViewState["TableName"].ToString() + " set PACK_NO=" + packNo + " where TID=" + txtTID.Text; if (DBOpt.dbHelper.ExecuteSql(_sql) > 0) { txtPACK_NO.Text = packNo.ToString(); } } //只有用户保存了,确认它接收此任务了。 //修改已经接收的状态,使此业务不能抽回 if (ViewState["CurWorkFlowNo"] != null && Convert.ToInt16(ViewState["CurWorkFlowNo"]) > 0) { object obj = DBOpt.dbHelper.ExecuteScalar("select f_working from dmis_sys_workflow where f_no=" + ViewState["CurWorkFlowNo"]); if (obj == null || Convert.ToInt16(obj) == 0) //已经接收的,允许再接收 { _sql = "update dmis_sys_workflow set f_working=1,f_receiver='" + Session["MemberName"].ToString() + "',f_receivedate='" + DateTime.Now.ToString("dd-MM-yyyy HH:mm") + "' where f_no=" + ViewState["CurWorkFlowNo"]; DBOpt.dbHelper.ExecuteSql(_sql); } } }
protected void grvList_RowCommand(object sender, GridViewCommandEventArgs e) { int row; if (!int.TryParse(e.CommandArgument.ToString(), out row)) { return; } object obj; int PackNo; //业务编号 int RecNo; //记录编号 int DocTypeNo; //文档类型号 int PackTypeNo; //业务类型编号 int CurLinkNo; //当前环节号 string sRight = ""; //文档权限编码 int CurWorkFlowNo; //工作流编号 dmis_sys_workflow表中的f_no值 PackNo = Convert.ToInt16(grvList.DataKeys[row].Values[0]); PackTypeNo = Convert.ToInt16(grvList.DataKeys[row].Values[2]); CurLinkNo = Convert.ToInt16(grvList.DataKeys[row].Values[1]); CurWorkFlowNo = Convert.ToInt16(grvList.DataKeys[row].Values[3]); _sql = "select f_recno from DMIS_SYS_DOC where F_PACKNO=" + PackNo + " and F_LINKNO=" + CurLinkNo; obj = DBOpt.dbHelper.ExecuteScalar(_sql); if (obj == null) { RecNo = -1; } else { RecNo = Convert.ToInt16(obj); } DataTable docType = DBOpt.dbHelper.GetDataTable("select a.f_no,a.f_formfile,a.f_tablename,a.f_target from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and b.f_packtypeno=" + PackTypeNo + " and b.F_LINKNO=" + CurLinkNo); if (docType == null || docType.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); return; } DocTypeNo = Convert.ToInt16(docType.Rows[0][0]); if (e.CommandName == "FlowTable") //流程 { Session["Oper"] = 0; Session["sended"] = "0"; Response.Redirect("FlowTable.aspx?InstanceID=" + PackNo + @"&BackUrl=" + Page.Request.RawUrl); } else if (e.CommandName == "Deal") //详细 { Session["Oper"] = 0; Session["sended"] = "0"; Response.Redirect(docType.Rows[0][1].ToString() + "?RecNo=" + RecNo + @"&BackUrl=" + Page.Request.RawUrl + "&PackTypeNo=" + PackTypeNo + "&CurLinkNo=" + CurLinkNo + "&PackNo=" + PackNo + "&CurWorkFlowNo=" + CurWorkFlowNo); } else if (e.CommandName == "Retake") //抽回 { //找回自己刚完成任务时的工作流编号 dmis_sys_workflow表中的f_no值 obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_PREFLOWNO FROM DMIS_SYS_WORKFLOW WHERE F_PACKNO=" + PackNo + " AND F_STATUS='1' AND F_WORKING=0 AND F_SENDER='" + Session["MemberName"] + "'"); if (obj == null) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoFindWorkFlow").ToString()); //无法找到工作流编号! return; } string preWorkFlowNo = Convert.ToString(obj); if (WebWorkFlow.Retake(preWorkFlowNo, Session["MemberName"].ToString())) { GridViewBind(); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkFailToWithdrawTaskMessage").ToString()); //抽回任务失败,请联系管理员! return; } } }
private void initTache() { DataTable dt; //任务名称 obj = DBOpt.dbHelper.ExecuteScalar("select f_desc from DMIS_SYS_PACK where F_NO=" + ViewState["PackNo"].ToString()); if (obj != null) { tdPackName.InnerText = obj.ToString(); } //当前环节 obj = DBOpt.dbHelper.ExecuteScalar("select f_flowname from dmis_sys_workflow where f_packno=" + ViewState["PackNo"].ToString() + " and f_flowno=" + ViewState["CurLinkNo"].ToString()); if (obj != null) { tdCurrentTacheName.InnerText = obj.ToString(); } //列出本环节下面的所有步骤, //如果是退回的情况下,有的环节发送了,故只显示还没有发送(即退回分支的环节) _sql = "select F_NO,F_NAME from DMIS_SYS_FLOWLINK where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_NO IN (" + "select F_ENDNO from DMIS_SYS_FLOWLINE where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_STARTNO=" + ViewState["CurLinkNo"] + ")"; dt = DBOpt.dbHelper.GetDataTable(_sql); DataColumn[] key1 = new DataColumn[1]; key1[0] = dt.Columns["F_NO"]; dt.PrimaryKey = key1; //显示已经发送的环节. _sql = "select f_flowno,f_flowname from dmis_sys_workflow where f_packno=" + ViewState["PackNo"].ToString() + " and (f_status='1' or f_status='2') " + " and f_flowno in (select F_ENDNO from DMIS_SYS_FLOWLINE where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_STARTNO=" + ViewState["CurLinkNo"] + ")"; DataTable haveSendTache = DBOpt.dbHelper.GetDataTable(_sql); //去掉已经发送的分支 DataRow row; for (int i = 0; i < haveSendTache.Rows.Count; i++) { row = dt.Rows.Find(haveSendTache.Rows[i][0]); if (row != null) { dt.Rows.Remove(row); } } //找出满足条件的环节 string LinkNo; DataTable target = dt.Clone(); for (int i = 0; i < dt.Rows.Count; i++) { LinkNo = DBOpt.dbHelper.ExecuteScalar("select f_no from dmis_sys_flowline where F_STARTNO=" + ViewState["CurLinkNo"] + " and F_ENDNO=" + dt.Rows[i]["F_NO"].ToString()).ToString(); if (WebWorkFlow.LinkGetCondition(ViewState["PackTypeNo"].ToString(), LinkNo, ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString())) { DataRow row2 = target.NewRow(); row2[0] = dt.Rows[i]["F_NO"]; row2[1] = dt.Rows[i]["F_NAME"]; target.Rows.Add(row2); } } //再绑定 if (target.Rows.Count > 0) { rblTache.DataTextField = "F_NAME"; rblTache.DataValueField = "F_NO"; rblTache.DataSource = target; rblTache.DataBind(); rblTache.SelectedIndex = 0; rblTache_SelectedIndexChanged(null, null); } }
public void openPage(System.Web.UI.Page pg, string sFileName, int iEdit) { DataTable oleRd; string sFile; if (sFileName != "") { Session["FormFile"] = sFileName; } else { if (!(Session["DocNo"] == null)) { if (FieldToValue.FieldToInt(Session["DocNo"]) > -1) { sSql = "SELECT F_DOCTYPENO,F_RECNO,F_TABLENAME FROM DMIS_SYS_DOC WHERE F_NO=" + Session["DocNo"]; oleRd = DBOpt.dbHelper.GetDataTable(sSql); if (oleRd.Rows.Count > 0) { Session["DocTypeNo"] = oleRd.Rows[0][0].ToString(); Session["RecNo"] = oleRd.Rows[0][1].ToString(); Session["TableName"] = oleRd.Rows[0][2].ToString(); } } } if (FieldToValue.FieldToInt(Session["DocTypeNo"]) == -2) { sFile = DBOpt.dbHelper.ExecuteScalar("SELECT F_FILENAME FROM DMIS_SYS_FILE WHERE F_NO=" + Session["RecNo"]).ToString(); if (sFile != "") { sFile = sFile.Replace("\\", "/"); sFile = sFile.Substring(sFile.LastIndexOf("/") + 1); } Session["FormFile"] = Server.MapPath("..\\upload\\") + sFile; } else { sSql = "SELECT F_FORMFILE FROM DMIS_SYS_DOCTYPE WHERE F_NO=" + Session["DocTypeNo"]; Session["FormFile"] = FieldToValue.FieldToString(DBOpt.dbHelper.ExecuteScalar(sSql)) + "?TID=" + Session["RecNo"]; Session["oper"] = -1; if (iEdit > 0) { string sRight = WebWorkFlow.sDocTypeRight(Convert.ToInt32(Session["DocTypeNo"]), Session["RoleIDs"].ToString()); if (sRight.Length == 7) { if (sRight.Substring(2, 1) == "1" | sRight.Substring(3, 1) == "1") { Session["oper"] = 1; } } } } } if (Session["FormFile"].ToString() != "") { oleRd = DBOpt.dbHelper.GetDataTable("select F_STYLE,F_TARGET from DMIS_SYS_filestyle where F_FILENAME='" + Session["FormFile"] + "'"); string sTyle = ""; string starget = ""; if (oleRd.Rows.Count > 0) { sTyle = FieldToValue.FieldToString(oleRd.Rows[0][0].ToString()); starget = FieldToValue.FieldToString(oleRd.Rows[0][1].ToString()); } if (starget == "") { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script language=javascript>\r\n"); if (sTyle == "") { sb.Append("window.open('" + Session["FormFile"] + "');\r\n"); } else { sb.Append("window.open('" + Session["FormFile"] + "','','" + sTyle + "');\r\n"); } sb.Append("</script>"); pg.Response.Write(sb.ToString()); } else { pg.Response.Redirect(Session["FormFile"].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"); 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 btnSend_Click(object sender, EventArgs e) { //提交前先保存 btnSave_Click(null, null); if (tdMessage.InnerText != "") { return; } string returnString = ""; object obj; //发送前判断汇集环节的所有分支是否都到达此节点 obj = DBOpt.dbHelper.ExecuteScalar("select f_nodetype from dmis_sys_flowlink where f_no=" + ViewState["CurLinkNo"].ToString()); if (obj != null && Convert.ToInt16(obj) == 2) { returnString = WebWorkFlow.InfluxTacheSendCondition(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"])); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } } //发送前条件判断 returnString = WebWorkFlow.TacheSendCondition(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } string sMainer = ""; obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { sMainer = obj.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) { int iFno = WebWorkFlow.EndFlow(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString()); if (iFno == -1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkFinishFailMessage").ToString());//此业务归档失败,请联系统管理员! return; } //2010-04-26,出现分支节点有退回的情况时,一个任务退回到分支节点,另一任务到了验收环节, //在任务没有结束时,也可以原先的程序也可以归档,故修改WebWorkFlow.EndFlow()的代码,提示一下 //还有任务没有完成,不允许归档 else if (iFno == -2) { JScript.Alert("-2");//此业务还有未完成的任务,请在流程图中查询未完成的任务! return; } else { //JScript.Alert("此业务归档成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } } else { string paras; //发送岗位时,派工环节,弹出发送窗口 if (WebWorkFlow.IsAssignTache(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]))) { paras = "PackTypeNo=" + ViewState["PackTypeNo"] + "&CurLinkNo=" + ViewState["CurLinkNo"] + "&PackNo=" + ViewState["PackNo"] + "&CurWorkFlowNo=" + ViewState["CurWorkFlowNo"] + "&TableName=" + ViewState["TableName"].ToString() + "&RecNo=" + ViewState["RecNo"].ToString(); Session["sended"] = 0; JScript.OpenWindow("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=500,top=20,left=100"); //Response.Write(webfun.OpenWin("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=480,top=20,left=100")); } else //非派工环节,直接发送即可 { int curTaskID = Convert.ToInt16(ViewState["CurWorkFlowNo"]); if (WebWorkFlow.DirectCreateFlow(Convert.ToInt16(ViewState["PackNo"]), ref curTaskID, Session["MemberName"].ToString())) { //统计实际工作时间 //1、根据工作流的相关表DMIS_SYS_WORKFLOW DMIS_SYS_MEMBERSTATUS来统计实际工作时间 //WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), // ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); //2、根据业务表保存的人名来统计实际工作时间 string[] members = new string[4]; members[0] = txtFZR.Text; members[1] = txtJDR1.Text; members[2] = txtJDR2.Text; members[3] = txtJDR3.Text; if (ViewState["CurLinkNo"].ToString() == "49" || ViewState["CurLinkNo"].ToString() == "50") { WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString(), "否", members); } else if (ViewState["CurLinkNo"].ToString() == "47" || ViewState["CurLinkNo"].ToString() == "48") //远动的才统计下站补助 { WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString(), "是", members); } Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString());//"此任务发送失败,请联系统管理员!" return; } } } } else { //结束从办人员的办理状态 if (WebWorkFlow.EndMemberStatus(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString())) { //JScript.Alert("提交成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").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) { 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); } } }