示例#1
0
    private void initCode()
    {
        //初始化下拉列表
        string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        SqlCode1.SelectCommand = sql;
        SqlCode1.DataBind();
        SqlCode2.SelectCommand = sql;
        SqlCode2.DataBind();
        //txtPCode.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
        //txtPCode1.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
        //txtPCode2.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;

        string Sql2 = "  select pt_part from copy_pt_mstr order by pt_part";

        SqlICode.SelectCommand = Sql2;
        SqlICode.DataBind();

        string    Sql3 = "select DETECT_NAME from code_detect where pline_code in ( SELECT PLINE_ID FROM VW_USER_ROLE_PROGRAM WHERE USER_ID='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "')  ";
        DataTable dt3  = dc.GetTable(Sql3);

        ASPxListBoxUnused.DataSource = dt3;
        ASPxListBoxUnused.DataBind();
    }
示例#2
0
        //是点击按钮的时候才执行吗?
        //callback方式刷新gridview
        //protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        //{
        //    //ASPxGridView1.JSProperties.Add("cpCallbackValue", ".txt");
        //    string s = e.Parameters;
        //    string[] s1 = s.Split('|');
        //    if (s1.Length > 1)
        //    {
        //        if (s1[0] == "XLS")
        //        {
        //            //try
        //            //{
        //                //创建一个新的excel文档
        //                Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
        //                Workbooks wbks = excel.Workbooks;
        //                //若打开已有excel,把“true”替换成该excel的文件路径;
        //                //注:若新建一个excel文档,“xxx”替换成true即可;不过这里新建的excel文档默认只有一个sheet。
        //                _Workbook _wbk = wbks.Add(true);

        //                //取得sheet
        //                Sheets shs = _wbk.Sheets;
        //                //i是要取得的sheet的index
        //                _Worksheet _wsh = (_Worksheet)shs.get_Item(1);

        //                //_wsh.Cells[1, 1] = "
        //                //添加行
        //                //((Range)_wsh.Rows[11, Missing.Value]).Insert(Missing.Value, XlInsertFormatOrigin.xlFormatFromLeftOrAbove);
        //                //添加列
        //                //_wsh.get_Range(_wsh.Cells[1, 1], Missing.Value).Insert(Missing.Value, XlInsertShiftDirection.xlShiftToRight);
        //                //_wsh.get_Range(_wsh.Cells[1, 1], _wsh.Cells[_wsh.Rows.Count, 1]).Insert(Missing.Value, XlInsertShiftDirection.xlShiftToRight);
        //                //设置单元格颜色
        //                //((Range)_wsh.Rows[1, Missing.Value]).Interior.ColorIndex = 3;

        //                _wsh.Cells[1, 1] = "流水号";
        //                _wsh.Cells[1, 2] = "零件号";
        //                _wsh.Cells[1, 3] = "零件名称";
        //                _wsh.Cells[1, 4] = "数量";
        //                _wsh.Cells[1, 5] = "工序";
        //                _wsh.Cells[1, 6] = "工位";
        //                _wsh.Cells[1, 7] = "计划号";
        //                _wsh.Cells[1, 8] = "SO";
        //                _wsh.Cells[1, 9] = "地点";
        //                _wsh.Cells[1, 10] = "供应商";
        //                _wsh.Cells[1, 11] = "类型";
        //                _wsh.Cells[1, 12] = "保管员";

        //                for (int i = 0; i < ASPxGridView1.VisibleRowCount; i++)
        //                {
        //                    //添加行
        //                    //object a = ASPxGridView1.GetRow(i);
        //                    _wsh.Cells[i + 2, 1] = ASPxGridView1.GetRowValues(i, "GHTM");
        //                    _wsh.Cells[i + 2, 2] = ASPxGridView1.GetRowValues(i, "ABOM_COMP");
        //                    _wsh.Cells[i + 2, 3] = ASPxGridView1.GetRowValues(i, "ABOM_DESC");
        //                    _wsh.Cells[i + 2, 4] = ASPxGridView1.GetRowValues(i, "ABOM_QTY");
        //                    _wsh.Cells[i + 2, 5] = ASPxGridView1.GetRowValues(i, "ABOM_OP");
        //                    _wsh.Cells[i + 2, 6] = ASPxGridView1.GetRowValues(i, "ABOM_WKCTR");
        //                    _wsh.Cells[i + 2, 7] = ASPxGridView1.GetRowValues(i, "ABOM_JHDM");
        //                    _wsh.Cells[i + 2, 8] = ASPxGridView1.GetRowValues(i, "ABOM_SO");
        //                    _wsh.Cells[i + 2, 9] = ASPxGridView1.GetRowValues(i, "GZDD");
        //                    _wsh.Cells[i + 2, 10] = ASPxGridView1.GetRowValues(i, "ABOM_GYS");
        //                    _wsh.Cells[i + 2, 11] = ASPxGridView1.GetRowValues(i, "COMP_FLAG");
        //                    _wsh.Cells[i + 2, 12] = ASPxGridView1.GetRowValues(i, "BGY");
        //                    string compFlag = ASPxGridView1.GetRowValues(i, "COMP_FLAG").ToString();
        //                    switch (compFlag)
        //                    {
        //                        case "0":
        //                            //2代表白色
        //                            ((Range)_wsh.Rows[i + 2, Missing.Value]).Interior.ColorIndex = 2;
        //                            break;
        //                        case "1":
        //                            //3代表红色
        //                            ((Range)_wsh.Rows[i + 2, Missing.Value]).Interior.ColorIndex = 3;
        //                            break;
        //                        case "2":
        //                            //10代表不刺眼的绿色
        //                            ((Range)_wsh.Rows[i + 2, Missing.Value]).Interior.ColorIndex = 10;
        //                            break;
        //                        default:
        //                            return;
        //                    }
        //                }

        //                //如果目录不存在则创建目录
        //                //if (!Directory.Exists("C:\\tranlist\\Storage"))
        //                //{
        //                //    Directory.CreateDirectory("C:\\tranlist\\Storage");
        //                //}

        //                //屏蔽掉系统跳出的覆盖文件Alert
        //                excel.DisplayAlerts = false;
        //                _wbk.Saved = true;
        //                //保存到指定目录
        //                //替换点否会报错
        //                string theWriteFile = "Restruct" + System.DateTime.Now.ToString("yyyyMMddHHmmss");
        //                _wbk.SaveAs("C:\\tranlist\\" + theWriteFile + ".xls",
        //                Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value,
        //                Missing.Value, Missing.Value);
        //                //_wbk.SaveCopyAs("C:\\tranlist\\" + theWriteFile + ".xls");
        //                //用@的方法只是不会报错,但\显示不出来
        //                //showAlert(this, @"文件已保存至C:\excel\改制差异清单明细信息导出.xls");
        //                //加一个中文的双引号就不会有什么问题
        //                //showAlert(this, "文件已成功保存!");
        //                //设置回默认值
        //                excel.DisplayAlerts = true;

        //                excel.Quit();

        //                //释放掉多余的excel进程
        //                //??释放有问题,关闭电脑的时候会提示--将这些资源依次释放再设置为空,最后回收内存就不会再有问题
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)wbks);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)_wbk);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)shs);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)_wsh);

        //                _wsh = null;
        //                shs = null;
        //                _wbk = null;
        //                wbks = null;
        //                excel = null;

        //                GC.Collect(0);

        //                try
        //                {
        //                    ASPxGridView1.JSProperties.Add("cpCallbackValue", theWriteFile + ".xls");
        //                }
        //                catch { }
        //            //}
        //            //catch
        //            //{
        //            //    showAlert(this, "导出失败!");
        //            //    return;
        //            //}
        //        }
        //    }
        //    else
        //    {
        //        //string theWriteFile = "";
        //        ASPxGridView1.JSProperties.Add("cpCallbackValue", ".xls");

        //    }

        //    setCondition();
        //}

        //初始化生产线
        private void initPlineCode()
        {
            string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

            SqlCode.SelectCommand = sql;
            SqlCode.DataBind();
        }
    protected void btnCodeFilter_Click(object sender, EventArgs e)
    {
        if (Session["user"] == null || Session["access"] != "ADMIN")
        {
            Response.Redirect("../index.aspx");
        }


        string codeType = CodeTypeSearch.SelectedValue.Trim();
        string codeId   = CodeIdSearch.SelectedValue.Trim();

        if (codeType == "%" && codeId == "%")
        {
            Session["codemainselect"] = "SELECT *  FROM [CODE] ORDER BY [CODE_TYPE], [CODE_ID]";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            gvCode.DataBind();
        }
        else if (codeType != "%" && codeId == "%")
        {
            Session["codemainselect"] = "SELECT * FROM [CODE] WHERE CODE_TYPE = '" + codeType + "' ORDER BY CODE_TYPE, CODE_ID";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            gvCode.DataBind();
        }
        else if (codeType != "%" && codeId != "%")
        {
            Session["codemainselect"] = "SELECT * FROM [CODE] WHERE CODE_TYPE = '" + codeType + "' AND CODE_ID = '" + codeId + "' ORDER BY CODE_TYPE, CODE_ID";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            SqlCode.DataBind();
            gvCode.DataBind();
        }
    }
示例#4
0
    private void initCode()
    {
        //初始化用户下拉列表
        string sql = "SELECT PLINE_CODE,PLINE_NAME FROM CODE_PRODUCT_LINE WHERE COMPANY_CODE = '" + theCompanyCode + "' ORDER BY PLINE_CODE";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
示例#5
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select pline_code,pline_name from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
示例#6
0
    private void initCode()
    {
        //初始化工位下拉列表
        string sql = "SELECT distinct STATION_NAME  LOCATION_NAME FROM CODE_STATION WHERE COMPANY_CODE = '" + theCompanyCode + "' and pline_code in ((select pline_id from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "')) ORDER BY LOCATION_NAME";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
示例#7
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select a.depotid pline_code,a.depotname pline_name from dp_dmdepot a left join REL_USER_DMDEPOT b on a.depotid=b.depotid where b.user_code='" + theUserCode + "' and b.PROGRAM_CODE='INV9700'  ";

        //string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";
        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
示例#8
0
    private void initCode()
    {
        //初始化下拉列表
        string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        //txtPCode.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
    }
示例#9
0
        private void initCode()
        {
            //初始化下拉列表
            string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

            SqlCode.SelectCommand = sql;
            SqlCode.DataBind();
            //string sql2 = "select distinct a.plan_code  from data_plan where ";
            //SqlPlanCode.SelectCommand = sql2;
            //SqlPlanCode.DataBind();
        }
示例#10
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        //txtPCode.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
        string sql2 = "select STATION_CODE,STATION_NAME from CODE_STATION where pline_code in(select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "') order by STATION_NAME";

        StationCode.SelectCommand = sql2;
        StationCode.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] == null || Session["access"] != "ADMIN")
        {
            Response.Redirect("../index.aspx");
        }

        if (!IsPostBack)
        {
            Session["codemainselect"] = "SELECT *  FROM [CODE] ORDER BY [CODE_TYPE], [CODE_ID]";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            SqlCode.DataBind();
        }
        if (IsPostBack)
        {
            SqlCode.SelectCommand = (string)Session["codemainselect"];
            SqlCode.DataBind();
        }
    }
示例#12
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select distinct a.pline_code,b.pline_name,a.pline_id from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        DataTable dt   = dc.GetTable(sql);
        string    sql2 = "";

        if (dt.Rows.Count > 0)
        {
            sql2 = "select distinct location_code from code_location where pline_code ='" + dt.Rows[0][2].ToString() + "' ORDER BY LOCATION_CODE";
        }
        else
        {
            sql2 = "select distinct location_code from code_location where pline_code in (select pline_id from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "') ORDER BY LOCATION_CODE";
        }
        SqlRLocation.SelectCommand = sql2;
        SqlRLocation.DataBind();
    }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            theProgramCode = "rept3200";
            userManager theUserManager = (userManager)Session["theUserManager"];

            theCompanyCode = theUserManager.getCompanyCode();
            theUserId      = theUserManager.getUserId();

            string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

            SqlCode.SelectCommand = sql;
            SqlCode.DataBind();
            SqlCode1.SelectCommand = sql;
            SqlCode1.DataBind();

            if (!IsPostBack)
            {
                //第一次进入页面默认取东区
                txtPCode.SelectedIndex = 0;

                //第一次进入页面取不到生产线,用这种方式给ASPxGridView1增加数据
                //string plineSql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a "
                //+ " left join code_product_line b on a.pline_code=b.pline_code where a.user_id='"
                //+ theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";
                //DataTable dt1 = dc.GetTable(plineSql);
                ////注意此处用rows才能取到,用columns取不到
                //string pline = dt1.Rows[0]["PLINE_CODE"].ToString();
                //string inSqlTemp = "";
                //inSqlTemp = " SELECT DISTINCT SN FROM DATA_STORE WHERE PLINE_CODE = '" + pline + "' ";

                //DataTable dt = dc.GetTable(inSqlTemp);
                //ASPxGridView1.DataSource = dt;
                //ASPxGridView1.DataBind();
            }
            //initPlineCode();
            //放在pageload里,模糊查询,分页等功能才能正常使用,因为这些事件都会来后台处理数据,所以要查询的相关数据必须要放在pageload里,否则
            //无法实现正常功能
            setCondition1();
            setCondition();
        }
示例#14
0
        //private void initPlanCode()
        //{
        //    //初始化计划下拉列表(物料确认过的计划,且未参与过物流计算的计划)
        //    string sql = "select  plan_code from ms_single_plan where gzdd in (select pline_code from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "') order by online_time desc ";
        //    sqlPlanCode.SelectCommand = sql;
        //    sqlPlanCode.DataBind();
        //}
        private void initPlineCode()
        {
            //初始化生产线下拉列表

            string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

            SqlCode.SelectCommand = sql;
            SqlCode.DataBind();
            DataTable dt   = dc.GetTable(sql);
            string    sql2 = "";

            if (dt.Rows.Count > 0)
            {
                sql2 = "select  plan_code from ms_single_plan where gzdd ='" + dt.Rows[0][0].ToString() + "' order by online_time desc ";
            }
            else
            {
                sql = "select  plan_code from ms_single_plan where gzdd in (select pline_code from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "') order by online_time desc ";
            }
            sqlPlanCode.SelectCommand = sql2;
            sqlPlanCode.DataBind();
        }
示例#15
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select distinct a.pline_code,b.pline_name,a.pline_id from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        //txtPCode.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
        DataTable dt   = dc.GetTable(sql);
        string    sql2 = "";

        if (dt.Rows.Count > 0)
        {
            sql2 = "select STATION_CODE,STATION_NAME from CODE_STATION where pline_code ='" + dt.Rows[0][2].ToString() + "'order by STATION_NAME";
        }
        else
        {
            sql2 = "select STATION_CODE,STATION_NAME from CODE_STATION where pline_code in(select distinct a.pline_id from vw_user_role_program a  where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "') order by STATION_NAME";
        }
        StationCode.SelectCommand = sql2;
        StationCode.DataBind();
    }