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());
            btnDeleteItem.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "DeleteBeforeConfirm").ToString() + "');");

            if (!btnAppendItem.Enabled)  //没有权限修改,则把步骤的编辑列隐藏
            {
                grvList.Columns[grvList.Columns.Count - 1].Visible = false;
            }

            FillDropDownList.FillByTable(ref ddlSTATION, "DMIS_SYS_STATION", "NAME", "TID", "ORDER_ID");

            if (Request["TID"] != "")
            {
                ViewState["DxpTID"] = Request["TID"];
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, Session["TableName"].ToString(), "TID=" + Request["TID"]);
                initGridView();
            }
            else
            {
                ViewState["DxpTID"] = null;
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        info = detail_info;

        if (!IsPostBack)
        {
            Session["URL"] = Request["URL"];

            PageControlLocalizationText pl = new PageControlLocalizationText(this);
            pl.SetDetailPageControlLocalizationText();
            lblFuncName.Text = Session["FuncName"].ToString();
            SetRight.SetPageRight(this.Page, Session["FuncId"].ToString(), Session["RoleIDs"].ToString());

            if (Request["TID"] == null || Request["TID"] == "")
            {
                txtMODULE_ID.Text = Session["FuncId"].ToString();
                wdlDATEM.setTime(DateTime.Now);
                txtSCR.Text       = Session["MemberName"].ToString();
                txtFILE_PATH.Text = Session["FilePath"].ToString();
            }
            else
            {
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_FILE_SINGLE", "TID=" + Request["TID"]);
                if (txtFILE_NAME.Text.Trim() != "")
                {
                    btnUpload.Enabled = false;                                  //已经有文件的不允许再上传
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        info = detail_info;

        if (!IsPostBack)
        {
            PageControlLocalizationText pl = new PageControlLocalizationText(this);
            pl.SetDetailPageControlLocalizationText();
            object res = GetLocalResourceObject("PageResource1.Title");
            if (res != null)
            {
                lblFuncName.Text = res.ToString();
            }

            SetRight.SetPageRight(this.Page, Session["FuncId"].ToString(), Session["RoleIDs"].ToString());

            if (Request["TID"] != "")
            {
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, Session["TableName"].ToString(), "TID=" + Request["TID"]);
            }
            else
            {
                wdlDATEM.setTime(DateTime.Now);
                txtDEPART_ID.Text = Session["DepartID"].ToString();
            }
        }
    }
Beispiel #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);
            }
        }
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        info = detail_info;
        if (!IsPostBack)
        {
            PageControlLocalizationText pl = new PageControlLocalizationText(this);
            pl.SetDetailPageControlLocalizationText();
            lblFuncName.Text = Session["FuncName"].ToString();
            SetRight.SetPageRight(this.Page, Session["FuncId"].ToString(), Session["RoleIDs"].ToString());

            if (Request["TID"] == null || Request["TID"] == "")
            {
                txtMODULE_ID.Text = Session["FuncId"].ToString();
                wdlNEW_DATE.setTime(DateTime.Now);
                txtMEMBER.Text = Session["MemberName"].ToString();
            }
            else
            {
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_FILE_INFO", "TID=" + Request["TID"]);
                _sql = "select * from T_FILE_ACCESSORIES where FILE_ID=" + Request["TID"];
                _dt  = DBOpt.dbHelper.GetDataTable(_sql);
                grvUpFileList.DataSource = _dt;
                grvUpFileList.DataBind();
            }
        }
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ColumnStyle"] != null)
        {
            if (Session["ColumnStyle"].ToString() == "0")  //二列
            {
                generateControlByTwoColumn();
            }
            else  //一列
            {
                generateControlByOneColumn();
            }
        }

        if (!IsPostBack)
        {
            if (Request["FuncId"] == null)
            {
                return;
            }
            PageControlLocalizationText pl = new PageControlLocalizationText(this);
            pl.SetDetailPageControlLocalizationText();
            _sql = "select * from DMIS_SYS_TREEMENU where ID=" + Request["FuncId"];
            DataTable treeMenu = DBOpt.dbHelper.GetDataTable(_sql);
            if (treeMenu.Rows.Count < 1)
            {
                return;
            }
            if (Session["Culture"] == null || Session["Culture"].ToString() == "zh-CN")
            {
                lblFuncName.Text = treeMenu.Rows[0]["NAME"] == Convert.DBNull ? "" : treeMenu.Rows[0]["NAME"].ToString();
            }
            else
            {
                lblFuncName.Text = treeMenu.Rows[0]["OTHER_LANGUAGE_DESCR"] == Convert.DBNull ? "" : treeMenu.Rows[0]["OTHER_LANGUAGE_DESCR"].ToString();
            }

            //_sql = "select DISPLAY_STYLE from DMIS_SYS_TABLES where ID=" + Session["MainTableId"].ToString();
            //obj = DBOpt.dbHelper.ExecuteScalar(_sql);
            //if (Session["ColumnStyle"] == null || Session["ColumnStyle"].ToString() == "0")  //二列
            //{
            //    Session["ColumnStyle"] = 0;
            //    generateControlByTwoColumn();
            //}
            //else  //一列
            //{
            //    Session["ColumnStyle"] = 1;
            //    generateControlByOneColumn();
            //}

            SetRight.SetPageRight(this.Page, Request["FuncId"].ToString(), Session["RoleIDs"].ToString());

            if (Request["TID"] != "")
            {
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, Session["TableName"].ToString(), "TID=" + Request["TID"]);
            }
        }
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        tdPageMessage = tdMessage;

        if (!IsPostBack)
        {
            SetRight.SetPageRight(this.Page, Session["FuncId"].ToString(), Session["RoleIDs"].ToString());
            FillDropDownList.FillByTable(ref ddl对应业务ID, "DMIS_SYS_PACKTYPE", "F_NAME", "F_NO");
            if (Request["TID"] != "")
            {
                FillDropDownList.FillByTable(ref ddl任务启动人, "DMIS_SYS_MEMBER", "NAME", "ID");
                CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "DMIS_SYS_WK_CYCLE_TASK_PARA", "TID=" + Request["TID"]);
            }
            else
            {
                ddl对应业务ID_SelectedIndexChanged(null, null);
            }
            ddl周期类型_SelectedIndexChanged(null, null);
        }
    }
Beispiel #8
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());
                }
            }
        }
    }
    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);
            }
        }
    }
Beispiel #10
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);
            }
        }
    }
Beispiel #11
0
    protected void btnCurrentShift_Click(object sender, EventArgs e)
    {
        _sql = "select TID from T_STATION_SHIFT where to_char(DATEM,'YYYYMMDD')='" + Session["CurrentShiftDate"].ToString()
               + "' and SHIFT=" + Session["CurrentShift"] + " and STATION_ID=" + Session["DepartID"].ToString();
        object obj = DBOpt.dbHelper.ExecuteScalar(_sql);

        if (obj == null)   //此班次不存在
        {
            btnSave.Enabled    = false;
            MultiView1.Visible = false;
            lblMessage.Text    = (String)GetGlobalResourceObject("WebGlobalResource", "Common003");
        }
        else
        {
            wdlQueryDate.Text           = ViewState["CurrentShiftDate"].ToString();
            ddlQueryShift.SelectedIndex = ddlQueryShift.Items.IndexOf(ddlQueryShift.Items.FindByValue(Session["CurrentShift"].ToString()));
            MultiView1.Visible          = true;
            CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_STATION_SHIFT", "TID=" + obj.ToString());

            /******************权限控制**********/
            //历史班次的数据只允许管理员修改,本班次的记录只能本班次的人修改
            DateTime shiftDate = wdlQueryDate.getTime();
            string   man1, man2, man3, man4;
            man1 = ddlCURRENT_SHIFT_MAN1.Text;
            man2 = ddlCURRENT_SHIFT_MAN2.Text;
            man3 = ddlCURRENT_SHIFT_MAN3.Text;
            man4 = ddlCURRENT_SHIFT_MAN4.Text;
            if (SetRight.IsAdminitrator(Session["MemberID"].ToString()))
            {
                btnSave.Enabled = true;
            }
            else
            {
                //不是当前班
                if (Session["CurrentShiftDate"] == null || Session["CurrentShift"] == null || shiftDate.ToString("yyyyMMdd") != Session["CurrentShiftDate"].ToString() || Session["CurrentShift"].ToString() != ddlQueryShift.SelectedValue)
                {
                    btnSave.Enabled = false;
                }
                else
                {
                    //只允许本班次的人修改当值记录
                    if ((man1 == Session["MemberName"].ToString() || man2 == Session["MemberName"].ToString() ||
                         man3 == Session["MemberName"].ToString() || man4 == Session["MemberName"].ToString()))
                    {
                        btnSave.Enabled = true;
                    }
                    else
                    {
                        btnSave.Enabled = false;
                    }
                }
            }
            //隐藏交接班按钮
            if (txtFLAG.Text == "1" && btnSave.Enabled && !SetRight.IsAdminitrator(Session["MemberID"].ToString()))
            {
                btnJIAOBAN.Visible = true;
            }
            else
            {
                btnJIAOBAN.Visible = false;
            }
        }
    }
Beispiel #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            PageControlLocalizationText pl = new PageControlLocalizationText(this);
            pl.SetListPageControlLocalizationText();
            lblFuncName.Text = Session["FuncName"].ToString();
            SetRight.SetPageRight(this.Page, Session["FuncId"].ToString(), Session["RoleIDs"].ToString());
            btnJIAOBAN.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "Common004").ToString() + "');");
            btnDelete.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "DeleteBeforeConfirm").ToString() + "');");

            object obj;
            //为了突出哪个变电站,功能名要加变电站名称
            if (Session["Culture"] == null || Session["Culture"].ToString() == "zh-CN")
            {
                _sql = "select NAME from DMIS_SYS_DEPART where ID=" + Session["DepartID"].ToString();
            }
            else
            {
                _sql = "select OTHER_LANGUAGE_DESCR from DMIS_SYS_DEPART where ID=" + Session["DepartID"].ToString();
            }
            obj = DBOpt.dbHelper.ExecuteScalar(_sql);
            if (obj != null)
            {
                lblFuncName.Text += "[" + obj.ToString() + "]";
            }

            FillDropDownList.FillByTable(ref ddlWEATHER, "DMIS_SYS_WEATHER", "NAME", "TID");
            FillDDY();
            FillShift();
            if (ddlQueryShift.Items.Count < 1)
            {
                //JScript.Alert("还没有设置调度值班班次信息,请联系系统管理员!");
                return;
            }

            DateTime st;
            //没有权限修改交接班记录的人只能查看数据,不能执行下面查找或生成当前班次的记录。
            if (!SetRight.IsModify(Session["FuncID"].ToString(), "frmSTATION_SHIFT.aspx", "btnSave", Session["MemberID"].ToString()))
            {
                return;
            }

            if (SetRight.IsAdminitrator(Session["MemberID"].ToString()))
            {
                btnAdd.Visible    = true;
                btnDelete.Visible = true;
            }
            int days = 1;                       //没有设置值班天数,则为1
            if (ddlQueryShift.Items.Count == 1) //值班参数表只有一条记录时,则要判断值班天数,多条记录则为1
            {
                obj = DBOpt.dbHelper.ExecuteScalar("select SHIFT_DAYS from T_STATION_SHIFT_PARA where STATION_ID=" + Session["DepartID"].ToString());
                if (obj != null)  //得到值班天数
                {
                    days = Convert.ToInt16(obj);
                }
            }
            else
            {
                days = 1;
            }


            uint tid = 1;

            /***************************************
             * 判断当前班次的规则如下:
             * 1、首先找flag为1(正在当班)的记录,没有找到则以当前日期和第一个班次新建当前班次
             * 2、如果有flag为1(正在当班)的记录,则再判断此当班日期是否在今天以前的days内之内;如果不是,则把此表内条件flag=1(正值)的记录的列flag的值设置为0(已值),再以当前日期和第一个班次新建当前班次;
             * 3、flag为1(正在当班)的记录的当班日期在今天以前的days天之内,则当前班次就是此班次。
             *
             **************************************/
            _sql = "select TID,DATEM,SHIFT from T_STATION_SHIFT where flag=1 and STATION_ID=" + Session["DepartID"].ToString() + " order by DATEM desc";
            DataTable dt = DBOpt.dbHelper.GetDataTable(_sql);
            if (dt.Rows.Count > 0)                                                                                            //找到了当班的记录
            {
                st = (Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))).AddDays(-days);                                //值班天数之前的00:00,用于下列比较
                if ((DateTime)dt.Rows[0]["DATEM"] < st)                                                                       //当前班次在值班天数以前,则新建班次
                {
                    _sql = "update T_STATION_SHIFT set flag=0 where flag=1 and STATION_ID=" + Session["DepartID"].ToString(); //先把当班记录状态设置为已交班
                    DBOpt.dbHelper.ExecuteSql(_sql);
                    //查找当日的第一个班次的记录在数据库中是否存在
                    obj = DBOpt.dbHelper.ExecuteScalar("select count(*) from T_STATION_SHIFT where to_char(DATEM,'YYYYMMDD')='" + DateTime.Now.ToString("yyyyMMdd") + "' and SHIFT=" + ddlQueryShift.Items[0].Value + " and STATION_ID=" + Session["DepartID"].ToString());
                    if (obj == null || Convert.ToInt16(obj) == 0)   //数据库中没有当日的第一个班次的记录
                    {
                        tid  = DBOpt.dbHelper.GetMaxNum("T_STATION_SHIFT", "TID");
                        obj  = DBOpt.dbHelper.ExecuteScalar("select SHIFT_STARTTIME,to_char(SHIFT_STARTTIME,'HH24:MI') ss from T_STATION_SHIFT_PARA where STATION_ID=" + Session["DepartID"].ToString() + " order by ss");
                        st   = (DateTime)obj;
                        _sql = "insert into T_STATION_SHIFT(TID,DATEM,SHIFT,FLAG,STATION_ID) values(" + tid + ",TO_DATE('"
                               + DateTime.Now.ToString("yyyy-MM-dd") + st.ToString(" HH:mm") + "','YYYY-MM-DD HH24:MI')," + ddlQueryShift.Items[0].Value + "," + ddlQueryShift.Items[0].Value + "," + Session["DepartID"].ToString() + ")";
                        if (DBOpt.dbHelper.ExecuteSql(_sql) < 0)
                        {
                            JScript.Alert((String)GetGlobalResourceObject("WebGlobalResource", "Common001"));
                            MultiView1.Visible = false;
                            return;
                        }
                    }
                    else //数据库中有当日的第一个班次的记录,则把状态设置为当班状态(为1)
                    {
                        _sql = "update T_STATION_SHIFT set flag=1 where to_char(DATEM,'YYYYMMDD')='" + DateTime.Now.ToString("yyyyMMdd") + "' and SHIFT=" + ddlQueryShift.Items[0].Value + " and STATION_ID=" + Session["DepartID"].ToString();
                        if (DBOpt.dbHelper.ExecuteSql(_sql) != 1)
                        {
                            JScript.Alert((String)GetGlobalResourceObject("WebGlobalResource", "Common002"));
                            MultiView1.Visible = false;
                            return;
                        }
                        tid = Convert.ToUInt16(DBOpt.dbHelper.ExecuteScalar("select TID from T_STATION_SHIFT where to_char(DATEM,'YYYYMMDD')='" + DateTime.Now.ToString("yyyyMMdd") + "' and SHIFT=" + ddlQueryShift.Items[0].Value + " and STATION_ID=" + Session["DepartID"].ToString()));
                    }
                    Session["CurrentShiftDate"]   = DateTime.Now.ToString("yyyyMMdd");
                    Session["CurrentShift"]       = 1;
                    ViewState["CurrentShiftDate"] = DateTime.Now.ToString("yyyy-MM-dd");
                }
                else  //当前班次是昨天以后,则以此作为当前班次
                {
                    Session["CurrentShiftDate"] = ((DateTime)dt.Rows[0][1]).ToString("yyyyMMdd");
                    Session["CurrentShift"]     = dt.Rows[0][2];
                    tid = Convert.ToUInt16(dt.Rows[0][0]);
                    ViewState["CurrentShiftDate"] = ((DateTime)dt.Rows[0][1]).ToString("yyyy-MM-dd");
                }
            }
            else   //没有当前班次,则以当日的第一个班次新建当前班次
            {
                obj = DBOpt.dbHelper.ExecuteScalar("select count(*) from T_STATION_SHIFT where to_char(DATEM,'YYYYMMDD')='" + DateTime.Now.ToString("yyyyMMdd") + "' and SHIFT=" + ddlQueryShift.Items[0].Value + " and STATION_ID=" + Session["DepartID"].ToString());
                if (obj == null || Convert.ToInt16(obj) == 0)   //数据库中没有当日的第一个班次的记录
                {
                    tid = DBOpt.dbHelper.GetMaxNum("T_STATION_SHIFT", "TID");

                    obj  = DBOpt.dbHelper.ExecuteScalar("select SHIFT_STARTTIME,to_char(SHIFT_STARTTIME,'HH24:MI') ss from T_STATION_SHIFT_PARA where STATION_ID=" + Session["DepartID"].ToString() + " order by ss");
                    st   = (DateTime)obj;
                    _sql = "insert into T_STATION_SHIFT(TID,DATEM,SHIFT,FLAG,STATION_ID,CURRENT_SHIFT_MAN1) values(" + tid + ",TO_DATE('" + DateTime.Now.ToString("yyyy-MM-dd") + st.ToString(" HH:mm") + "','YYYY-MM-DD HH24:MI')"
                           + "," + ddlQueryShift.Items[0].Value + ",1," + Session["DepartID"].ToString() + ",'" + Session["MemberName"].ToString() + "')";
                    if (DBOpt.dbHelper.ExecuteSql(_sql) < 0)
                    {
                        JScript.Alert((String)GetGlobalResourceObject("WebGlobalResource", "Common001"));
                        MultiView1.Visible = false;
                        return;
                    }
                }
                else //数据库中有当日的第一个班次的记录,把其状态改为当值(为1)
                {
                    _sql = "update T_STATION_SHIFT set flag=1 where to_char(DATEM,'YYYYMMDD')='" + DateTime.Now.ToString("yyyyMMdd") + "' and SHIFT=" + ddlQueryShift.Items[0].Value + " and STATION_ID=" + Session["DepartID"].ToString();
                    if (DBOpt.dbHelper.ExecuteSql(_sql) != 1)
                    {
                        JScript.Alert((String)GetGlobalResourceObject("WebGlobalResource", "Common002"));
                        MultiView1.Visible = false;
                        return;
                    }
                    tid = Convert.ToUInt16(DBOpt.dbHelper.ExecuteScalar("select TID from T_STATION_SHIFT where to_char(DATEM,'YYYYMMDD')='" + DateTime.Now.ToString("yyyyMMdd") + "' and SHIFT=" + ddlQueryShift.Items[0].Value + " and STATION_ID=" + Session["DepartID"].ToString()));
                }
                Session["CurrentShiftDate"]   = DateTime.Now.ToString("yyyyMMdd");
                Session["CurrentShift"]       = ddlQueryShift.Items[0].Value;
                ViewState["CurrentShiftDate"] = DateTime.Now.ToString("yyyy-MM-dd");
            }


            CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_STATION_SHIFT", "TID=" + tid);
            wdlQueryDate.setTime(Convert.ToDateTime(ViewState["CurrentShiftDate"]));
            ddlQueryShift.SelectedIndex = ddlQueryShift.Items.IndexOf(ddlQueryShift.Items.FindByValue(Session["CurrentShift"].ToString()));
            btnQuery_Click(null, null);
        }
        else
        {
            //btnQuery_Click(null, 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);
            }
        }
    }
Beispiel #14
0
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        DateTime shiftDate = wdlQueryDate.getTime();

        _sql = "select TID from T_DD_SHIFT where to_char(DATEM,'YYYYMMDD')='" + shiftDate.ToString("yyyyMMdd") + "' and SHIFT=" + ddlQueryShift.SelectedValue;
        object obj = DBOpt.dbHelper.ExecuteScalar(_sql);

        if (obj != null)   //此班次存在
        {
            lblMessage.Text    = "";
            MultiView1.Visible = true;
            CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_DD_SHIFT", "TID=" + obj.ToString());
        }
        else
        {
            wdlDATEM.setNull();
            ddlSHIFT.SelectedIndex = -1;
            btnSave.Enabled        = false;
            MultiView1.Visible     = false;
            lblMessage.Text        = (String)GetGlobalResourceObject("WebGlobalResource", "Common003");
        }

        /******************权限控制**********/
        //历史班次的数据只允许管理员修改,本班次的记录只能本班次的人修改
        string man1, man2, man3, man4;

        man1 = ddlCURRENT_SHIFT_MAN1.Text;
        man2 = ddlCURRENT_SHIFT_MAN2.Text;
        man3 = ddlCURRENT_SHIFT_MAN3.Text;
        man4 = ddlCURRENT_SHIFT_MAN4.Text;
        if (SetRight.IsAdminitrator(Session["MemberID"].ToString()))
        {
            btnSave.Enabled = true;
        }
        else
        {
            //不是当前班
            if (Session["CurrentShiftDate"] == null || Session["CurrentShift"] == null || shiftDate.ToString("yyyyMMdd") != Session["CurrentShiftDate"].ToString() || Session["CurrentShift"].ToString() != ddlQueryShift.SelectedValue)
            {
                btnSave.Enabled = false;
            }
            else
            {
                //只允许本班次的人修改当值记录,或者当班人员全部为空时也可以修改(主要是为了第一次新建班次时,没有人员时所用)
                if ((man1 == Session["MemberName"].ToString() || man2 == Session["MemberName"].ToString() || man3 == Session["MemberName"].ToString() || man4 == Session["MemberName"].ToString()) ||
                    (man1.Trim() == "" && man2.Trim() == "" && man3.Trim() == "" && man4.Trim() == ""))
                {
                    btnSave.Enabled = true;
                }
                else
                {
                    btnSave.Enabled = false;
                }
            }
        }
        //隐藏交接班按钮
        if (txtFLAG.Text == "1" && btnSave.Enabled && !SetRight.IsAdminitrator(Session["MemberID"].ToString()))
        {
            btnJIAOBAN.Visible = true;
        }
        else
        {
            btnJIAOBAN.Visible = false;
        }
    }