Beispiel #1
0
    private void setCondition()
    {
        string chose = "";

        if (txtChose.Text.Trim() != "")
        {
            chose = txtChose.Value.ToString();



            string pmodel = "", so = "", plancode = "", plinecode = "", xl = "", scode = "", pos = "";
            switch (chose)
            {
            case "A":

                string    sql = "SELECT product_model,plan_so,plan_code,pline_code FROM DATA_PRODUCT where sn='" + txtSN.Text.Trim() + "'";
                DataTable dt  = dc.GetTable(sql);
                if (dt.Rows.Count <= 0)
                {
                    return;
                }
                else
                {
                    pmodel    = dt.Rows[0][0].ToString();
                    so        = dt.Rows[0][1].ToString();
                    plancode  = dt.Rows[0][2].ToString();
                    plinecode = dt.Rows[0][3].ToString();
                    string    sql2 = "select xl from copy_engine_property where so='" + so.ToUpper() + "' and rownum=1 ";
                    DataTable dt2  = dc.GetTable(sql2);
                    if (dt2.Rows.Count > 0)
                    {
                        xl = dt2.Rows[0][0].ToString();
                    }
                    if (plinecode == "E")
                    {
                        scode = "ZDE068";
                    }
                    if (plinecode == "W")
                    {
                        scode = "ZD910";
                    }
                    if (plinecode == "R")
                    {
                        scode = "RONE001";
                    }

                    //else
                    //{
                    //    ASPxGridView1.JSProperties.Add("cpCallbackName", "Fail");
                    //    ASPxGridView1.JSProperties.Add("cpCallbackRet", "没有记录!");
                    //}
                    PL_QUERY_BOMZJTS3 sp = new PL_QUERY_BOMZJTS3()
                    {
                        SO1    = so,
                        ZDDM1  = scode,
                        GZDD1  = plinecode,
                        FDJXL1 = xl,
                        JHDM1  = plancode
                    };
                    Procedure.run(sp);
                    PL_UPDATE_BOMZJTS_CRM3 sp2 = new PL_UPDATE_BOMZJTS_CRM3()
                    {
                        SO1   = so,
                        ZDDM1 = scode,
                        JHDM1 = plancode,
                        GZDD1 = plinecode
                    };
                    Procedure.run(sp2);
                    PL_UPDATE_BOMLSHTS3 sp3 = new PL_UPDATE_BOMLSHTS3()
                    {
                        LSH1  = txtSN.Text.Trim(),
                        ZDDM1 = scode
                    };
                    Procedure.run(sp3);
                    PL_UPDATE_BOMSOTHTS3 sp4 = new PL_UPDATE_BOMSOTHTS3()
                    {
                        SO1   = so,
                        JHDM1 = plancode,
                        ZDDM1 = scode
                    };
                    Procedure.run(sp4);
                }
                string    ChSql1 = "select gwmc 工位,comp 零件代码,udesc 描述,qty 数量,gxmc 工序,gysmc 供应商 from rstbomqd_CRM where zddm='" + scode + "' order by gwmc,gxmc";
                DataTable dt1    = dc.GetTable(ChSql1);
                ASPxGridView1.DataSource = dt1;
                ASPxGridView1.DataBind();

                ASPxGridView2.DataSource = null;
                ASPxGridView2.DataBind();

                break;

            case "B":
                //string sql22 = "SELECT ggxhmc,so,jhdm FROM SJSXB WHERE GHTM='" + txtSN.Text.Trim() + "'  ";
                //DataTable dt22 = dc.GetTable(sql22);
                //pmodel = dt22.Rows[0][0].ToString();
                //so = dt22.Rows[0][1].ToString();
                //plancode = dt22.Rows[0][2].ToString();
                string    ChSql2 = " SELECT item_code 零件代码,item_name 零件名称,item_qty 数量,process_code 工序,location_code 工位  FROM vw_data_plan_standard_bom  WHERE plan_code='" + txtPlanCode.Text.Trim() + "' AND plan_so='" + txtSO.Text.Trim() + "' ORDER BY location_code,process_code";
                DataTable dt22   = dc.GetTable(ChSql2);
                ASPxGridView1.DataSource = dt22;
                ASPxGridView1.DataBind();
                string    Csql2 = "SELECT ljdm1,ljdm2,gwmc FROM sjbomsoth WHERE so='" + txtSO.Text.Trim() + "'and jhdm='" + txtPlanCode.Text.Trim() + "' and istrue=1 order by gwmc,ljdm1";
                DataTable dt12  = dc.GetTable(Csql2);
                ASPxGridView2.DataSource = dt12;
                ASPxGridView2.DataBind();
                break;

            case "C":
                //string ChSql3 = "select LOCATION_CODE 工位,ITEM_CODE 零件代码,ITEM_NAME 零件名称,ITEM_CODE 数量,PROCESS_CODE 工序,STATION_CODE 站点,VENDOR_NAME 供应商 from VW_rstlshbomqd where SN='" + txtSN.Text.Trim() + "' order by LOCATION_CODE,PROCESS_CODE";
                //DataTable dt3 = dc.GetTable(ChSql3);
                //ASPxGridView1.DataSource = dt3;
                //ASPxGridView1.DataBind();

                break;

            default:
                ASPxGridView1.JSProperties.Add("cpCallbackName", "Fail");
                ASPxGridView1.JSProperties.Add("cpCallbackRet", "查询方式有误!");
                break;
            }
        }
    }
Beispiel #2
0
    public void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        DateTime DT1 = Convert.ToDateTime(ASPxDateEdit1.Text.Trim());
        DateTime DT2 = Convert.ToDateTime(ASPxDateEdit2.Text.Trim());

        if (DT1.AddDays(31) < DT2)
        {
            ASPxGridView1.JSProperties.Add("cpCallbackName", "Fail");
            ASPxGridView1.JSProperties.Add("cpCallbackRet", "选择日期范围不能超过31天,请重新选择!");
            return;
        }
        else if (ASPxListBoxUsed.Items.Count <= 0)
        {
            ASPxGridView1.JSProperties.Add("cpCallbackName", "Fail");
            ASPxGridView1.JSProperties.Add("cpCallbackRet", " 请选择要查询的零件!");
            return;
        }

        DataTable Table1 = new DataTable();

        //string iteam_code = "";
        Table1.Columns.Add("日期");
        Table1.Columns.Add("SO");
        Table1.Columns.Add("计划");
        for (int a = 0; a < ASPxListBoxUsed.Items.Count; a++)
        {
            string part = ASPxListBoxUsed.Items[a].ToString();
            Table1.Columns.Add(part + "----数量");
            //Table1.Columns.Add(part+'▍↔'+"数量");
        }
        string    plancode = "", PlanSo = "", PlanCode = "", RQbegin = "", plinecode = "", xl = "", scode = "";
        string    snSql = "select lsh,ptime from ATPUDQYQDYB where PTIME>=to_date('" + ASPxDateEdit1.Text.Trim() + "', 'yyyy-mm-dd hh24:mi:ss') and  PTIME<=to_date('" + ASPxDateEdit2.Text.Trim() + "', 'yyyy-mm-dd hh24:mi:ss')  ";
        DataTable sndt  = dc.GetTable(snSql);

        for (int j = 0; j < sndt.Rows.Count; j++)
        {
            RQbegin = sndt.Rows[j][1].ToString();
            string    soSql = "select plan_code from data_plan_sn where sn='" + sndt.Rows[j][0].ToString() + "'";
            DataTable sodt  = dc.GetTable(soSql);
            if (sodt.Rows.Count > 0)
            {
                plancode = sodt.Rows[0][0].ToString();
            }
            string    sql1 = "select distinct begin_date,plan_so from data_plan where pline_code='" + txtPCode.Value.ToString() + "' and plan_code='" + plancode + "' ";
            DataTable dt1  = dc.GetTable(sql1);
            if (dt1.Rows.Count > 0)
            {
                PlanSo = dt1.Rows[0][1].ToString();
                //RQbegin = dt1.Rows[0][0].ToString();
            }
            plinecode = txtPCode.Value.ToString();
            PlanCode  = plancode;
            DataRow dr = Table1.NewRow();
            dr[0] = RQbegin;
            dr[1] = PlanSo;
            dr[2] = PlanCode;
            for (int i = 0; i < ASPxListBoxUsed.Items.Count; i++)
            {
                string part2 = ASPxListBoxUsed.Items[i].ToString();
                //string sql2 = "(select a.item_code,a.item_qty from data_sn_bom a left join data_plan b on a.plan_code=b.plan_code  where a.plan_code='" + PlanCode + "' and b.plan_so='" + PlanSo + "' and a.item_name='" + part2 + "') union "
                //             + "select a.item_code,a.item_qty from data_sn_bom_temp a left join data_plan b on a.plan_code=b.plan_code  where a.plan_code='" + PlanCode + "' and b.plan_so='" + PlanSo + "' and a.item_name='" + part2 + "'";

                //DataTable dt2 = dc.GetTable(sql2);


                string    sql3 = "select xl from copy_engine_property where so='" + PlanSo.ToUpper() + "' and rownum=1 ";
                DataTable dt3  = dc.GetTable(sql3);
                if (dt3.Rows.Count > 0)
                {
                    xl = dt3.Rows[0][0].ToString();
                }
                if (plinecode == "E")
                {
                    scode = "ZF5";
                }
                if (plinecode == "W")
                {
                    scode = "ATPU-T560";
                }
                //if (plinecode == "R")
                //{
                //    scode = "RONE001";
                //}


                PL_QUERY_BOMZJTS3 sp = new PL_QUERY_BOMZJTS3()
                {
                    SO1    = PlanSo,
                    ZDDM1  = scode,
                    GZDD1  = plinecode,
                    FDJXL1 = xl,
                    JHDM1  = PlanCode
                };
                Procedure.run(sp);
                PL_UPDATE_BOMZJTS_CRM3 sp2 = new PL_UPDATE_BOMZJTS_CRM3()
                {
                    SO1   = PlanSo,
                    ZDDM1 = scode,
                    JHDM1 = PlanCode,
                    GZDD1 = plinecode
                };
                Procedure.run(sp2);
                //PL_UPDATE_BOMLSHTS3 sp3 = new PL_UPDATE_BOMLSHTS3()
                //{
                //    LSH1 = txtSN.Text.Trim(),
                //    ZDDM1 = scode

                //};
                //Procedure.run(sp3);
                PL_UPDATE_BOMSOTHTS3 sp4 = new PL_UPDATE_BOMSOTHTS3()
                {
                    SO1   = PlanSo,
                    JHDM1 = PlanCode,
                    ZDDM1 = scode
                };
                Procedure.run(sp4);

                string    ChSql1 = "select comp ,qty  from RSTBOMQD_CRM where udesc='" + part2 + "' and zddm='" + scode + "' ";
                DataTable dt2    = dc.GetTable(ChSql1);

                if (dt2.Rows.Count > 0)
                {
                    string code = dt2.Rows[0][0].ToString();
                    string qty  = dt2.Rows[0][1].ToString();
                    //iteam_code = iteam_code + '#' + code;
                    dr[i + 3] = code + "----" + qty;
                    //dr[i + 4] =  qty;
                }
            }

            Table1.Rows.Add(dr);
        }
        Session["rept3400table"] = Table1;
        ASPxGridView1.DataSource = Table1;
        ASPxGridView1.DataBind();
    }