public static DataSet getBoard(string codeName)
        {
            string sql = "select * from boardinfo ";

            if (codeName.Trim().Length > 0)
            {
                sql = sql + " where code like '*"
                      + codeName + "*' + or code like '*" + codeName + "*'";
            }
            return(OleHeper.Query(sql));
        }
Exemplo n.º 2
0
        private void FrmFilePath_Load(object sender, EventArgs e)
        {
            string    sql = "select * from Savepath";
            DataTable dt  = new DataTable();

            dt          = OleHeper.Query(sql).Tables[0];
            jcpath.Text = dt.Rows[1][1].ToString();
            expath.Text = dt.Rows[0][1].ToString();
            bkpath.Text = dt.Rows[2][1].ToString();
            this.jcpath.Select(this.jcpath.TextLength, 0);
        }
Exemplo n.º 3
0
        private void main_Load(object sender, EventArgs e)
        {
            Startjxbtn.BackColor = Color.Silver;
            string sql = "select * from Savepath where id=1";

            _SavePath = OleHeper.Query(sql).Tables[0].Rows[0][1].ToString();
            if (_SavePath.EndsWith(@"\") == false)
            {
                _SavePath = _SavePath + "\\";
            }
        }
Exemplo n.º 4
0
        private void Startjxbtn_Click(object sender, EventArgs e)
        {
            string Orignpath1 = "select * from SavePath where id=2";
            string Savepath1  = "select * from SavePath where id=1";
            string bakpath1   = "select * from SavePath where id=3";

            Orignpath = OleHeper.Query(Orignpath1).Tables[0].Rows[0][1].ToString();
            Savepath  = OleHeper.Query(Savepath1).Tables[0].Rows[0][1].ToString();
            bakpath   = OleHeper.Query(bakpath1).Tables[0].Rows[0][1].ToString();
            if (Orignpath.EndsWith(@"\") == false)
            {
                Orignpath = Orignpath + "\\";
            }
            if (Savepath.EndsWith(@"\") == false)
            {
                Savepath = Savepath + "\\";
            }
            if (bakpath.EndsWith("\\") == false)
            {
                bakpath = bakpath + "\\";
            }
            this.label3.Text = "监测路径:" + Orignpath;
            this.label4.Text = "输出路径:" + Savepath;
            Thread thread = new Thread(jx);

            thread.IsBackground = true;
            if (Startjxbtn.Text == "正在自动转化...")
            {
                Startjxbtn.Text      = "开始监测";
                Startjxbtn.BackColor = Color.Silver;
                jccheak = false;
                thread.Start();
            }
            else
            {
                Startjxbtn.Text      = "正在自动转化...";
                Startjxbtn.BackColor = Color.Red;
                jccheak = true;
                thread.Start();
            }
        }
        //变量
        private string GetParmeteSts(KJLobject kJ)
        {
            string str = "";
            string sql = "select * from Paramss p inner join boardinfo o";

            sql = sql + " on o.id=p.boardid where o.Code= '" + kJ.modelNumber + "'";
            List <KJLobject> Klist = new List <KJLobject>();
            DataTable        dt    = new DataTable();

            dt = OleHeper.Query(sql).Tables[0];
            string    sqlsys = "select * from SysPram";
            DataTable dtsys  = new DataTable();

            dtsys = OleHeper.Query(sqlsys).Tables[0];
            string orderTy;

            orderTy = kJ.OrderType == 1 ? "衣柜" : "橱柜";
            foreach (parameter parm in kJ.parameters)
            {
                foreach (DataRow drs in dtsys.Rows)
                {
                    if (parm.parmName == drs["Kname"].ToString() &&
                        drs["OrderType"].ToString() == orderTy)
                    {
                        str = str + drs["Iname"] + ":=" + parm.parmValue + "|";
                    }
                }
                foreach (DataRow dr in dt.Rows)
                {
                    string Kname = dr["Kname"].ToString();
                    if (parm.parmName == Kname)
                    {
                        str = str + dr["Iname"] + ":=" + parm.parmValue + "|";
                    }
                }
            }
            return(str);
        }
        //判断孔
        //double fx = 0.2;
        private List <KJLobject> getHoleInfo(List <KJLobject> Kobj)
        {
            List <KJLobject> Hboardlist     = new List <KJLobject>(); //水平板
            List <KJLobject> Vboardlist     = new List <KJLobject>(); //垂直板
            List <KJLobject> Otherboardlist = new List <KJLobject>(); //其他
            string           sql            = "select * from boardinfo";
            DataTable        dt             = new DataTable();

            dt = OleHeper.Query(sql).Tables[0];
            foreach (KJLobject kj in Kobj)
            {
                bool flag = false;
                foreach (DataRow dr in dt.Rows)
                {
                    if (kj.modelNumber == dr["Code"].ToString())
                    {
                        flag = true;
                        if (dr["BoardFX"].ToString() == "横向" &&
                            bool.Parse(dr["hole"].ToString()) == true)
                        {
                            Hboardlist.Add(kj);
                        }
                        else if (dr["BoardFX"].ToString() == "竖向" &&
                                 bool.Parse(dr["hole"].ToString()) == true)
                        {
                            Vboardlist.Add(kj);
                        }
                        else
                        {
                            Otherboardlist.Add(kj);
                        }
                    }
                }
                if (flag == false)
                {
                    Otherboardlist.Add(kj);
                }
            }
            List <KJLobject> Allkjl = new List <KJLobject>();

            //先判断横向板件
            addMsg(DateTime.Now.ToString() + ":开始判断横向板件孔位...");
            for (int i = 0; i < Hboardlist.Count; i++)
            {
                string str = getSHoleInfo(Hboardlist[i], Vboardlist);
                Hboardlist[i].newCode = Hboardlist[i].newCode + str;
                Allkjl.Add(Hboardlist[i]);
            }
            addMsg(DateTime.Now.ToString() + ":判断横向板件孔位完成!");
            //再判断竖向板件
            addMsg(DateTime.Now.ToString() + ":开始判断竖向板件孔位...");
            for (int i = 0; i < Vboardlist.Count; i++)
            {
                string str = "";
                str = getCHoleInfo(Vboardlist[i], Hboardlist);
                if (Vboardlist[i].modelNumber.Contains("KSPL"))
                {
                    Vboardlist[i].holeStart = "";
                }
                else if (Vboardlist[i].modelNumber.Contains("KSPR"))
                {
                    Vboardlist[i].holeStart = "";
                }
                //如果竖板有孔,往后调整竖板优先级
                if (str != "")
                {
                    Vboardlist[i].LevelSeq += 2;
                }
                Vboardlist[i].newCode = Vboardlist[i].newCode + str;
                Allkjl.Add(Vboardlist[i]);
            }
            addMsg(DateTime.Now.ToString() + ":判断竖向板件孔位完成!");

            Allkjl.AddRange(Otherboardlist);
            return(Allkjl);
        }
        //配置对象
        private List <KJLobject> getUserkbj(List <KJLobject> kJ)
        {
            addMsg(DateTime.Now.ToString() + ":开始获取数据库配置信息");
            string           sql   = "select * from boardinfo";
            List <KJLobject> Klist = new List <KJLobject>();
            DataTable        dt    = new DataTable();

            dt = OleHeper.Query(sql).Tables[0];
            foreach (KJLobject k in kJ)
            {
                bool flag = false;
                //门板
                if (IsDoor(k) == true)
                {
                    List <KJLobject> lsObj = new List <KJLobject>();
                    List <KJLobject> LSXH  = new List <KJLobject>();
                    lsObj = kJ.Where(l => l.parentid == k.parentid).ToList();
                    lsObj = lsObj.Where(l => l.modelTypeId == 2).ToList();
                    LSXH.AddRange(lsObj);
                    lsObj = kJ.Where(l => l.id == k.parentid).ToList();
                    lsObj = lsObj.Where(l => l.modelTypeId == 2).ToList();
                    LSXH.AddRange(lsObj);
                    lsObj = kJ.Where(l => l.parentid == k.id).ToList();
                    lsObj = lsObj.Where(l => l.modelTypeId == 2).ToList();
                    LSXH.AddRange(lsObj);
                    for (int i = 0; i < LSXH.Count; i++)
                    {
                        parameter parameter = new parameter();
                        parameter.parmName  = "LSXH";
                        parameter.parmValue = LSXH[i].modelNumber;
                        k.parameters.Add(parameter);
                    }
                }
                foreach (DataRow dr in dt.Rows)
                {
                    try
                    {
                        if (k.modelNumber == dr["Code"].ToString())
                        {
                            k.LevelSeq = int.Parse(dr["LevelSeq"].ToString());
                            k.newCode  = k.modelNumber;
                            string holeFx = dr["HoleFx"].ToString();
                            k.holeFx = holeFx == "" ? 0 : k.holeFx = double.Parse(holeFx);
                            Klist.Add(k);
                            flag = true;
                        }
                    }
                    catch (Exception e)
                    {
                        ErrMsg(DateTime.Now.ToString() + ":获取配置信息失败!" +
                               "错误信息为:" + e.ToString());
                    }
                }
                if (flag == false)
                {
                    k.newCode  = k.modelNumber;
                    k.LevelSeq = 100;
                    Klist.Add(k);
                    if (k.modelTypeId != 2)
                    {
                        ErrMsg(k.modelNumber + ":在数据库找不到配置信息!");
                    }
                }
            }
            addMsg(DateTime.Now.ToString() + ":获取数据库配置信息完成!");
            return(Klist);
        }