Esempio n. 1
0
    protected void grv_RowEditing(object sender, GridViewEditEventArgs e)
    {
        if (sender == null)
        {
            return;
        }

        GridView grv = (GridView)sender;

        grv.EditIndex = e.NewEditIndex;
        grv.EditRowStyle.BackColor = System.Drawing.Color.FromName("#F7CE90");
        GridViewBind();

        int          tableID = Convert.ToInt16(Session["MainTableId"]);
        HtmlComboBox hcb厂站   = (HtmlComboBox)grv.Rows[e.NewEditIndex].FindControl("hcb厂站");
        //HtmlComboBox hcb联系人 = (HtmlComboBox)grv.Rows[e.NewEditIndex].FindControl("hcb联系人");
        DropDownList ddl类别  = (DropDownList)grv.Rows[e.NewEditIndex].FindControl("ddl类别");
        DropDownList ddl记录人 = (DropDownList)grv.Rows[e.NewEditIndex].FindControl("ddl记录人");

        //FillDropDownList.FillHtmlCombxByTable(ref hcb事件来源, "DMIS_SYS_DEPART", "NAME", "ID", "order_id", "TYPE='自动化记事'");
        FillDropDownList.FillHtmlCombxByTable(ref hcb厂站, "T_STATION_TYPE", "NAME", "TID", "NO");
        FillDropDownList.FillByTable(ref ddl类别, "T_ZDH_记事_类别参数", "名称", "TID", "序号");
        FillDropDownList.FillByTable(ref ddl记录人, "DMIS_VIEW_DEPART_MEMBER_ROLE", "MEMBER_NAME", "MEMBER_ID", "MEMBER_NAME", "ROLE_ID=4");

        int tid = Convert.ToInt16(grv.DataKeys[e.NewEditIndex].Value);

        GridViewEdit.GridViewEditing(ref grv, tableID, e.NewEditIndex, tid);
    }
Esempio n. 2
0
    protected void grvList_RowEditing(object sender, GridViewEditEventArgs e)
    {
        grvList.EditIndex = e.NewEditIndex;
        grvList.EditRowStyle.BackColor = System.Drawing.Color.FromName("#F7CE90");
        initGridView();

        _sql = "select * from T_DD_TYPICAL_OPT_BODY where TID=" + grvList.DataKeys[e.NewEditIndex].Value;
        DataTable _dt = DBOpt.dbHelper.GetDataTable(_sql);

        HtmlComboBox hcb = (HtmlComboBox)grvList.Rows[e.NewEditIndex].FindControl("hcbUNIT");

        FillDropDownList.FillHtmlCombxByTable(ref hcb, "DMIS_SYS_STATION", "NAME", "TID", "ORDER_ID");

        if (_dt.Rows[0]["UNIT"] != Convert.DBNull)
        {
            hcb.Text = _dt.Rows[0]["UNIT"].ToString();
        }
        if (grvList.Rows[e.NewEditIndex].FindControl("txtXH") != null)
        {
            TextBox txt = (TextBox)grvList.Rows[e.NewEditIndex].FindControl("txtXH");
            if (_dt.Rows[0]["XH"] != Convert.DBNull)
            {
                txt.Text = _dt.Rows[0]["XH"].ToString();
            }
        }
        if (grvList.Rows[e.NewEditIndex].FindControl("txtCONTENT") != null)
        {
            TextBox txt = (TextBox)grvList.Rows[e.NewEditIndex].FindControl("txtCONTENT");
            if (_dt.Rows[0]["CONTENT"] != Convert.DBNull)
            {
                txt.Text = _dt.Rows[0]["CONTENT"].ToString();
            }
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            PageControlLocalizationText pl = new PageControlLocalizationText(this);
            pl.SetDetailPageControlLocalizationText();
            lblFuncName.Text = Session["FuncName"].ToString();
            SetRight.SetPageRight(this.Page, Session["FuncId"].ToString(), Session["RoleIDs"].ToString());
            FillDropDownList.FillHtmlCombxByTable(ref hcbWeather, "DMIS_SYS_WEATHER", "NAME", "TID", "ORDER_ID asc");
            if (hcbWeather.Items.Count > 0)
            {
                hcbWeather.SelectedIndex = 0;
            }

            if (Request["date"] != null)
            {
                wdlDate.Text = Request["date"];
            }
            else
            {
                wdlDate.setTime(DateTime.Now);
            }

            btnSave_Click(null, null);
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        info = detail_info;
        if (!IsPostBack)
        {
            PageControlLocalizationText pl = new PageControlLocalizationText(this);
            pl.SetDetailPageControlLocalizationText();
            lblFuncName.Text = GetLocalResourceObject("PageResource1.Title").ToString();

            SetRight.SetPageRight(this.Page, Session["FuncId"].ToString(), Session["RoleIDs"].ToString());
            FillDropDownList.FillHtmlCombxByTable(ref hcbWEATHER, "DMIS_SYS_WEATHER", "NAME", "TID", "ORDER_ID");
            FillDropDownList.FillHtmlCombxByTable(ref hcbSTATION, "DMIS_SYS_STATION", "NAME", "TID", "ORDER_ID");

            if (Request["TID"] != "")
            {
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, Session["TableName"].ToString(), "TID=" + Request["TID"]);
            }
            else
            {
                txtDISPATCHER.Text = Session["MemberName"].ToString();
                wdlSTARTTIME.setTime(DateTime.Now);
                wdlENDTIME.setTime(DateTime.Now);
            }
        }
    }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        grvRef        = grvList;
        tdPageMessage = tdMessage;
        txtPageNumber = txtPage;

        if (!IsPostBack)
        {
            if (Request["packTypeID"] != null && Request["packTypeID"] != "")
            {
                ViewState["packTypeID"] = Request["packTypeID"];
            }
            if (Request["linkID"] != null && Request["linkID"] != "")
            {
                ViewState["linkID"] = Request["linkID"];
            }


            wdlStart.setTime(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-") + "01"));
            wdlEnd.setTime(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")));
            FillDropDownList.FillByTable(ref ddlSTATION, "DMIS_SYS_STATION", "NAME");
            FillDropDownList.FillHtmlCombxByTable(ref hcbMember, "dmis_sys_member", "name", "code", "depart_id,order_id");

            ViewState["BaseSql"] = "SELECT distinct A.F_NO,A.F_PACKNAME,A.F_DESC,A.F_CREATEMAN,A.PLAN_STARTTIME,A.PLAN_ENDTIME,A.SUBPACKNO,"
                                   + "B.F_FLOWNAME,B.f_receiver,B.f_receivedate,B.F_SENDER,B.F_SENDDATE,B.F_FLOWNO,A.F_PACKTYPENO,B.F_NO as F_CurWorkFlowNo,A.F_MSG,B.F_LAST_FINISHED_TIME "
                                   + " FROM DMIS_SYS_PACK A,DMIS_SYS_WORKFLOW B ";

            System.Text.StringBuilder BaseCond = new System.Text.StringBuilder();

            BaseCond.Append(" WHERE A.F_NO=B.F_PACKNO and A.F_STATUS='1' AND B.F_STATUS='1' AND B.F_WORKING=1");

            if (ViewState["packTypeID"] != null)
            {
                BaseCond.Append(" and A.f_packtypeno = " + ViewState["packTypeID"].ToString());
            }

            if (ViewState["linkID"] != null)
            {
                BaseCond.Append(" and b.f_flowno = " + ViewState["linkID"].ToString());
            }

            BaseCond.Append(" order by B.f_receivedate desc");

            ViewState["sql"] = ViewState["BaseSql"].ToString() + BaseCond.ToString();

            GridViewBind();
        }
    }
Esempio n. 6
0
    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());
                }
            }
        }
    }
Esempio n. 7
0
    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);
            }
        }
    }
Esempio n. 8
0
    protected void grvList_RowEditing(object sender, GridViewEditEventArgs e)
    {
        grvList.EditIndex = e.NewEditIndex;
        grvList.EditRowStyle.BackColor = System.Drawing.Color.FromName("#F7CE90");
        initGridView();

        _sql = "select * from T_DD_TERMWISE_OPT_BODY where TID=" + grvList.DataKeys[e.NewEditIndex].Value;
        DataTable _dt = DBOpt.dbHelper.GetDataTable(_sql);

        HtmlComboBox hcbUNIT = (HtmlComboBox)grvList.Rows[e.NewEditIndex].FindControl("hcbUNIT");

        FillDropDownList.FillHtmlCombxByTable(ref hcbUNIT, "DMIS_SYS_STATION", "NAME", "TID", "ORDER_ID");
        HtmlComboBox hcbFLR = (HtmlComboBox)grvList.Rows[e.NewEditIndex].FindControl("hcbFLR");

        FillDropDownList.FillHtmlCombxByTable(ref hcbJHR, "dmis_view_depart_member_role", "MEMBER_NAME", "MEMBER_ID", "MEMBER_NAME", "ROLE_ID=5");//调度员
        HtmlComboBox hcbSLR = (HtmlComboBox)grvList.Rows[e.NewEditIndex].FindControl("hcbSLR");

        FillDropDownList.FillHtmlCombxByTable(ref hcbSLR, "dmis_view_depart_member_role", "MEMBER_NAME", "MEMBER_ID", "MEMBER_NAME", "ROLE_ID=5");//调度员

        if (_dt.Rows[0]["UNIT"] != Convert.DBNull)
        {
            hcbUNIT.Text = _dt.Rows[0]["UNIT"].ToString();
        }
        if (_dt.Rows[0]["FLR"] != Convert.DBNull)
        {
            hcbFLR.Text = _dt.Rows[0]["FLR"].ToString();
        }
        if (_dt.Rows[0]["SLR"] != Convert.DBNull)
        {
            hcbSLR.Text = _dt.Rows[0]["SLR"].ToString();
        }

        TextBox txtXH, txtCONTENT, txtFLSJ, txtSLSJ;

        txtXH      = (TextBox)grvList.Rows[e.NewEditIndex].FindControl("txtXH");
        txtCONTENT = (TextBox)grvList.Rows[e.NewEditIndex].FindControl("txtCONTENT");
        txtFLSJ    = (TextBox)grvList.Rows[e.NewEditIndex].FindControl("txtFLSJ");
        txtSLSJ    = (TextBox)grvList.Rows[e.NewEditIndex].FindControl("txtSLSJ");

        if (_dt.Rows[0]["XH"] != Convert.DBNull)
        {
            txtXH.Text = _dt.Rows[0]["XH"].ToString();
        }
        if (_dt.Rows[0]["CONTENT"] != Convert.DBNull)
        {
            txtCONTENT.Text = _dt.Rows[0]["CONTENT"].ToString();
        }

        if (_dt.Rows[0]["FLSJ"] != Convert.DBNull)
        {
            txtFLSJ.Text = _dt.Rows[0]["FLSJ"].ToString();
        }

        if (_dt.Rows[0]["SLSJ"] != Convert.DBNull)
        {
            txtSLSJ.Text = _dt.Rows[0]["SLSJ"].ToString();
        }

        //执行的阶段,只能填写发令人、发令时间 、受令人、汇报时间
        if (txtTASK.Enabled)
        {
            txtXH.Enabled      = true;
            hcbUNIT.Enabled    = true;
            txtCONTENT.Enabled = true;
            txtFLSJ.Enabled    = false;
            hcbSLR.Enabled     = false;
            txtSLSJ.Enabled    = false;
            hcbFLR.Enabled     = false;
        }
        else
        {
            txtXH.Enabled      = false;
            hcbUNIT.Enabled    = false;
            txtCONTENT.Enabled = false;
            txtFLSJ.Enabled    = true;
            hcbSLR.Enabled     = true;
            txtSLSJ.Enabled    = true;
            hcbFLR.Enabled     = true;
        }
    }
Esempio n. 9
0
    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_DD_TERMWISE_OPT_HEAD", "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;
                        }
                    }
                }
            }

            //控制添加操作步骤的权限
            if (!txtTASK.ReadOnly)
            {
                btnAppendItem.Enabled = true;
                btnDeleteItem.Enabled = true;
                btnInsertItem.Enabled = true;
                btnTypicalOpt.Enabled = true;
                grvList.Columns[grvList.Columns.Count - 1].Visible = true;  //编辑隐藏
            }
            else
            {
                grvList.Columns[grvList.Columns.Count - 1].Visible = false;  //编辑隐藏
            }

            FillDropDownList.FillHtmlCombxByTable(ref hcbJHR, "dmis_view_depart_member_role", "MEMBER_NAME", "MEMBER_ID", "MEMBER_NAME", "ROLE_ID=5");//调度员
            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;

            if (Convert.ToInt32(ViewState["RecNo"]) > -1)
            {
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_DD_TERMWISE_OPT_HEAD", "TID=" + ViewState["RecNo"].ToString());
                initGridView();                                               //取操作步骤
                if (!SetRight.IsAdminitrator(Session["MemberID"].ToString())) //不是管理员才设置初始人员及日期,否则会把管理员的名称也赋值给相应的控件
                {
                    //设置初始人名,主办人,从办人在后面设置
                    string[] name = { "txtYPR" };
                    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 = { "wdlDATEM", "wdlZXRQ" };
                    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_DD_TERMWISE_OPT_HEAD where to_char(DATEM,'YYYY')='" + DateTime.Now.ToString("yyyy") + "'";
                counts      = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar(_sql)) + 1;
                txtPH.Text  = DateTime.Now.ToString("yyyy") + counts.ToString("0000");
                txtYPR.Text = Session["MemberName"].ToString();
                wdlDATEM.setTime(DateTime.Now);
            }
        }
        else
        {
            //从典型票窗口生成的
            if (Session["RecNo"] != null)
            {
                ViewState["RecNo"] = Session["RecNo"];
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_DD_TERMWISE_OPT_HEAD", "TID=" + Session["RecNo"].ToString());
                initGridView();//取操作步骤
                Session["RecNo"] = null;
            }
        }
    }
    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);
            }
        }
    }