Ejemplo n.º 1
0
        private void btn_updata_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt;
            if (MessageBox.Show("名称:" + tb_suppliesName.Text + "  规格:" + tb_specification.Text + "  高度:" + tb_sort.Text, "确定修改!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                var    db        = new DBAccess_MySql("MySql");
                string outString = "";
                sql = "UPDATE goods_info SET goods_code = '" + tb_specification.Text + "',goods_name = '" + tb_suppliesName.Text + "' WHERE goods_id = " + label7.Text + "";
                db.ExecSql(sql, out outString);
                try
                {
                    sql = "SELECT goods_code,goods_name,goods_style FROM goods_info WHERE goods_id = " + label7.Text + "";
                    var     rlt         = db.QuerySQL_ToTable(sql, out dt, out outString);
                    DataRow dr          = dt.Rows[0];
                    string  goods_code  = dr[0].ToString();
                    string  goods_name  = dr[1].ToString();
                    string  goods_style = dr[2].ToString();

                    sql = "UPDATE house_data SET goods_code = '" + goods_name + "',goods_name = '" + goods_code + "' WHERE house_number = '" + goods_style + "'";
                    db.ExecSql(sql, out outString);
                }
                catch
                {
                }
            }
            update_houseData();
        }
Ejemplo n.º 2
0
        //入库过账
        public void InAccount(int s_FrStand, int s_ToLine, int s_ToGrid, int s_ToTier)
        {
            string houseNumber = "0" + s_ToLine + "0" + s_ToGrid + "0" + s_ToTier;

            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";
            DataTable dt;
            string    sql;

            sql = "SELECT goods_id,goods_code,goods_name FROM goods_info WHERE goods_style = '" + houseNumber + "'";
            var     rlt        = db.QuerySQL_ToTable(sql, out dt, out outString);
            DataRow dr         = dt.Rows[0];
            string  goods_id   = dr[0].ToString();
            string  goods_code = dr[1].ToString();
            string  goods_name = dr[2].ToString();

            //跟新货位状态
            sql = "UPDATE house_info SET house_state = 'O' WHERE house_number = '" + houseNumber + "'";
            db.ExecSql(sql, out outString);

            //更新库存数据
            sql = "INSERT INTO house_data(house_number,goods_code,goods_name,have_number,in_house_time) VALUES('" + houseNumber + "','" + goods_name + "','" + goods_code + "'," + 1 + ",SYSDATE())";
            db.ExecSql(sql, out outString);

            sql = "UPDATE order_info SET order_state = 3 WHERE order_state = 1 LIMIT 1";
            db.ExecSql(sql, out outString);
        }
Ejemplo n.º 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("名称:" + tb_suppliesName.Text + "  规格:" + tb_specification.Text + "  高度:" + tb_sort.Text + "  绑定库位:" + cb_houseNumber.Text, "绑定库位!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                //MessageBox.Show(textBox1.Text);
                //DataTable dt;
                var    db        = new DBAccess_MySql("MySql");
                string outString = "";
                //sql = "SELECT bf_h_to_h,house_number,house_state,house_style FROM house_info WHERE bf_h_to_h = '" + tb_sort.Text+"' AND house_style LIKE '%"+(tb_suppliesName.Text).Substring(1,1)+ "%' AND house_state = 'N'";
                //var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);
                //DataRow dr = dt.Rows[0];
                //string house_number = dr[1].ToString();
                //string house_state = dr[2].ToString();
                //if (cb_houseNumber.Text==house_number)
                //{
                //    sql = "UPDATE goods_info SET goods_style = '"+house_number+"' WHERE goods_id = "+label7.Text+"";
                //    db.ExecSql(sql, out outString);
                //    update_houseData();
                //}
                sql = "UPDATE goods_info SET goods_style = '" + cb_houseNumber.Text + "' WHERE goods_id = " + label7.Text + "";
                db.ExecSql(sql, out outString);
                try
                {
                    sql = "UPDATE house_data SET house_number = '" + cb_houseNumber.Text + "' WHERE goods_name = '" + tb_specification.Text + "'";
                    db.ExecSql(sql, out outString);
                }
                catch
                {
                }

                //修改仓库库存数据

                update_houseData();
            }
        }
Ejemplo n.º 4
0
        //出库过账
        public void OutAccount(int s_FrLine, int s_FrGrids, int s_FrTiers, int s_ToStand)
        {
            string houseNumber = "0" + s_FrLine + "0" + s_FrGrids + "0" + s_FrTiers;

            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";
            DataTable dt;
            string    sql;

            sql = "SELECT goods_id,goods_code,goods_name FROM goods_info WHERE goods_style = '" + houseNumber + "'";
            var     rlt        = db.QuerySQL_ToTable(sql, out dt, out outString);
            DataRow dr         = dt.Rows[0];
            string  goods_id   = dr[0].ToString();
            string  goods_code = dr[1].ToString();
            string  goods_name = dr[2].ToString();

            //跟新货位状态
            sql = "UPDATE house_info SET house_state = 'N' WHERE house_number = '" + houseNumber + "'";
            db.ExecSql(sql, out outString);

            //删除库存表数据
            sql = "DELETE FROM house_data WHERE house_number = '" + houseNumber + "'";
            db.ExecSql(sql, out outString);

            sql = "UPDATE order_info SET order_state = 3 WHERE order_state = 1 LIMIT 1";
            db.ExecSql(sql, out outString);
        }
Ejemplo n.º 5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                string suppliesName  = tb_suppliesName.Text;
                string specification = tb_specification.Text;
                string sort          = tb_sort.Text;
                var    db            = new DBAccess_MySql("MySql");
                dataGridView1.Columns.Clear();
                string outString = "";

                //查询物料表中是否重复物料
                DBAccess_MySql dby = new DBAccess_MySql();
                sql = "SELECT * FROM goods_info WHERE goods_name = '" + suppliesName + "' AND goods_code = '" + specification + "'";
                dby = db.ReturnSQL_String(sql, out outString);
                string goodsName = null;
                string goodsCode = null;
                try
                {
                    while (dby.rec.Read())
                    {
                        goodsName = dby.rec.GetString(1);
                        goodsCode = dby.rec.GetString(2);
                    }
                    dby.connMysql.Close();
                }
                catch
                {
                }
                if (goodsCode == suppliesName && goodsName == specification)
                {
                    update_goodInfo();
                    MessageBox.Show("已录入该物料产品!");
                }
                else
                {
                    if (specification == "" || sort == "")
                    {
                        sql = "INSERT into goods_info(goods_name) VALUES('" + suppliesName + "')";
                        db.ExecSql(sql, out outString);
                    }
                    else
                    {
                        sql = "INSERT into goods_info(goods_name,goods_code,goods_height) VALUES('" + suppliesName + "','" + specification + "','" + sort + "')";
                        var rlt = db.ExecSql(sql, out outString);
                    }
                }
                update_goodInfo();
            }
            catch
            {
                MessageBox.Show("重复操作!");
            }
        }
Ejemplo n.º 6
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (lb_S.Text == "S")
     {
         var    db      = new DBAccess_MySql("MySql");
         string code    = comboBox1.Text;
         string name    = textBox2.Text;
         string paw     = textBox3.Text;
         string pasword = textBox4.Text;
         if (MessageBox.Show("用户名:" + code + "  姓名:" + name + "  密码:" + pasword, "确认添加!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             sql = "INSERT INTO user_info(user_code,user_name,pass_word) VALUES('" + code + "','" + name + "','" + paw + "')";
             db.ExecSql(sql, out outString);
             MessageBox.Show("添加成功!");
             TestCBox();
             return;
         }
         else
         {
             return;
         }
     }
     else
     {
         MessageBox.Show("没有权限!");
     }
 }
Ejemplo n.º 7
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (lb_S.Text == "S")
     {
         var    db      = new DBAccess_MySql("MySql");
         string code    = comboBox1.Text;
         string name    = textBox2.Text;
         string paw     = textBox3.Text;
         string pasword = textBox4.Text;
         if (MessageBox.Show("用户名:" + code + "  姓名:" + name + "  密码:" + pasword, "确认删除!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             sql = "DELETE FROM user_info WHERE id = '" + int.Parse(lab_id.Text) + "'";
             db.ExecSql(sql, out outString);
             MessageBox.Show("删除成功!");
             TestCBox();
             return;
         }
         else
         {
             return;
         }
     }
     else
     {
         MessageBox.Show("没有权限");
     }
 }
Ejemplo n.º 8
0
 private void btnAlter_Click(object sender, EventArgs e)
 {
     if (lb_S.Text == "S")
     {
         var    db      = new DBAccess_MySql("MySql");
         string code    = comboBox1.Text;
         string name    = textBox2.Text;
         string paw     = textBox3.Text;
         string pasword = textBox4.Text;
         if (MessageBox.Show("用户名:" + code + "  姓名:" + name + "  密码:" + pasword, "确认修改!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             if (paw == pasword)
             {
                 sql = "UPDATE user_info SET user_code = '" + code + "',user_name='" + name + "',pass_word='" + pasword + "' WHERE id = '" + int.Parse(lab_id.Text) + "'";
                 db.ExecSql(sql, out outString);
                 MessageBox.Show("修改成功!");
                 TestCBox();
                 return;
             }
             else
             {
                 MessageBox.Show("确定用户名和密码一致!");
             }
         }
         else
         {
             return;
         }
     }
     else
     {
         MessageBox.Show("没有权限!");
     }
 }
Ejemplo n.º 9
0
        //故障过账
        public void Fault()
        {
            #region 指令过账
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";
            DataTable dt;
            string    sql;
            sql = "SELECT order_user,order_id,order_style FROM order_info WHERE order_state = 1 LIMIT 1";
            var     rlt        = db.QuerySQL_ToTable(sql, out dt, out outString);
            DataRow dr         = dt.Rows[0];
            string  order_user = dr[0].ToString();
            string  orderid    = dr[1].ToString();
            string  orderstyle = dr[2].ToString();

            sql = "SELECT goods_code,goods_name,goods_style FROM goods_info WHERE goods_id = " + int.Parse(order_user) + "";
            var     rlt1        = db.QuerySQL_ToTable(sql, out dt, out outString);
            DataRow dr1         = dt.Rows[0];
            string  goods_code  = dr1[0].ToString();
            string  goods_name  = dr1[1].ToString();
            string  goods_style = dr1[2].ToString();

            if (orderstyle == "1")//入库
            {
                ////跟新货位状态
                sql = "UPDATE house_info SET house_state = 'N' WHERE house_number = '" + goods_style + "'";
                db.ExecSql(sql, out outString);

                sql = "UPDATE order_info SET order_state = 2 WHERE order_id = " + int.Parse(orderid) + "";
                db.ExecSql(sql, out outString);
            }
            if (orderstyle == "2")//出库
            {
                ////跟新货位状态
                sql = "UPDATE house_info SET house_state = 'S' WHERE house_number = '" + goods_style + "'";
                db.ExecSql(sql, out outString);

                //更新库存数据
                sql = "INSERT INTO house_data(house_number,goods_code,goods_name,have_number,in_house_time) VALUES('" + goods_style + "','" + goods_name + "','" + goods_code + "'," + 1 + ",SYSDATE())";
                db.ExecSql(sql, out outString);

                sql = "UPDATE order_info SET order_state = 2 WHERE order_id = " + int.Parse(orderid) + "";
                db.ExecSql(sql, out outString);
            }
            #endregion
        }
Ejemplo n.º 10
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string goodid = tb_goodsid.Text;
         var    db     = new DBAccess_MySql("MySql");
         dataGridView1.Columns.Clear();
         string outString = "";
         sql = "DELETE FROM goods_info WHERE goods_id = " + int.Parse(goodid);
         var rlt = db.ExecSql(sql, out outString);
         update_goodInfo();
     }
     catch
     {
         MessageBox.Show("重复操作!");
     }
 }
Ejemplo n.º 11
0
        private void btnAlter_Click(object sender, EventArgs e)
        {
            try
            {
                int    goodid        = int.Parse(tb_goodsid.Text);
                string suppliesName  = tb_suppliesName.Text;
                string specification = tb_specification.Text;
                string sort          = tb_sort.Text;
                var    db            = new DBAccess_MySql("MySql");
                dataGridView1.Columns.Clear();
                string outString = "";

                sql = "UPDATE goods_info SET goods_name = '" + suppliesName + "',goods_code = '" + specification + "',goods_height = '" + sort + "' WHERE goods_id = " + goodid;
                var rlt = db.ExecSql(sql, out outString);

                update_goodInfo();
            }
            catch
            {
                MessageBox.Show("重复操作!");
            }
        }
Ejemplo n.º 12
0
Archivo: OneOut.cs Proyecto: 13TT/TEST2
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("库位编号:" + tb_sort.Text + "  物料名称:" + tb_suppliesName.Text + "  物料规格:" + tb_specification.Text, "确认出库!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                #region //创建出库预约
                try
                {
                    DataTable dt;
                    var       db = new DBAccess_MySql("MySql");
                    dataGridView1.Columns.Clear();
                    string outString   = "";
                    string houseNumber = "";
                    int    line        = 0;
                    int    list        = 0;
                    int    blank       = 0;
                    int    floor       = 0;
                    sql = "SELECT house_number,line,list,blank,floor FROM house_info WHERE house_number = '" + tb_sort.Text + "'";
                    var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        return;
                    }
                    houseNumber = dt.Rows[0]["house_number"].ToString();
                    line        = int.Parse(dt.Rows[0]["line"].ToString());
                    list        = int.Parse(dt.Rows[0]["list"].ToString());
                    blank       = int.Parse(dt.Rows[0]["blank"].ToString());
                    floor       = int.Parse(dt.Rows[0]["floor"].ToString());

                    //foreach (var s in PLCSystem_SRM.Dic_SRM_Request)
                    //{
                    //    s.Value.s_serial = 1;
                    //    s.Value.s_pattern = 1;

                    //    s.Value.s_FrStand = 0;
                    //    s.Value.s_FrLine = (ushort)list;
                    //    s.Value.s_FrGrid = (ushort)blank;
                    //    s.Value.s_FrTier = (ushort)floor;



                    //    if (tb_suppliesName.Text == "端拾器")
                    //    {
                    //        s.Value.s_ToStand = 1;
                    //    }

                    //    if (tb_suppliesName.Text == "检具")
                    //    {
                    //        s.Value.s_ToStand = 2;
                    //    }

                    //    s.Value.s_ToLine = 0;
                    //    s.Value.s_ToGrid = 0;
                    //    s.Value.s_ToTier = 0;

                    //    s.Value.s_execute_signal = 0;

                    //    //break;
                    //}
                    sql = "SELECT goods_id FROM goods_info WHERE goods_name = '" + tb_suppliesName.Text + "' AND goods_code = '" + tb_specification.Text + "'";
                    db.QuerySQL_ToTable(sql, out dt, out outString);
                    DataRow dd = dt.Rows[0];
                    string  id = dd[0].ToString();

                    sql = "INSERT INTO order_info(order_state,order_style,station_from,station_to,house_from,house_to,order_user,order_time) VALUES(0,2,1,0,'0','" + tb_sort.Text + "'," + int.Parse(id) + ",SYSDATE())";
                    db.ExecSql(sql, out outString);

                    sql = "UPDATE house_info SET house_state = 'O' WHERE house_number = '" + tb_sort.Text + "'";
                    db.ExecSql(sql, out outString);

                    //删除
                    sql = "DELETE FROM house_data WHERE house_number = '" + tb_sort.Text + "'";
                    db.ExecSql(sql, out outString);
                    update_houseInfo();
                }
                catch
                {
                    MessageBox.Show("存在操作错误!");
                }
                #endregion
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 13
0
        private void btn_out_Click(object sender, EventArgs e)
        {
            int    sum         = int.Parse(textBox1.Text) - int.Parse(tb_count.Text);
            string houseNumber = "";
            int    list        = 0;
            int    blank       = 0;
            int    floor       = 0;
            //加料入库
            var    db        = new DBAccess_MySql("MySql");
            string outString = "";

            if (btn_out.Text == "入库")
            {
                if (sum == 0)
                {
                    sql = "UPDATE house_data SET have_number = " + sum + " WHERE house_number = '" + cb_houseNumber.Text + "' AND goods_code = '" + cb_suppliesName.Text + "' AND goods_name = '" + cb_specification.Text + "'";
                    db.ExecSql(sql, out outString);

                    sql = "DELETE FROM house_data WHERE have_number = " + 0;
                    db.ExecSql(sql, out outString);
                    list  = int.Parse((cb_houseNumber.Text).Substring(0, 2));
                    blank = int.Parse((cb_houseNumber.Text).Substring(2, 2));
                    floor = int.Parse((cb_houseNumber.Text).Substring(4, 2));
                    WriteSRM.WriteSrmData(btn_out.Text, 2, list, blank, floor);
                    btn_out.Text          = "出库";
                    cb_houseNumber.Text   = "";
                    cb_specification.Text = "";
                    cb_suppliesName.Text  = "";
                    textBox1.Text         = "";
                }
                else
                {
                    sql = "UPDATE house_data SET have_number = " + sum + " WHERE house_number = '" + cb_houseNumber.Text + "' AND goods_code = '" + cb_suppliesName.Text + "' AND goods_name = '" + cb_specification.Text + "'";
                    var rlt = db.ExecSql(sql, out outString);
                    list  = int.Parse((cb_houseNumber.Text).Substring(0, 2));
                    blank = int.Parse((cb_houseNumber.Text).Substring(2, 2));
                    floor = int.Parse((cb_houseNumber.Text).Substring(4, 2));
                    WriteSRM.WriteSrmData(btn_out.Text, 2, list, blank, floor);
                    btn_out.Text          = "出库";
                    cb_houseNumber.Text   = "";
                    cb_specification.Text = "";
                    cb_suppliesName.Text  = "";
                    textBox1.Text         = "";
                }
            }
            else
            {
                DataTable dt;
                sql = "SELECT house_number,list,blank,floor FROM house_info WHERE house_number = '" + cb_houseNumber.Text + "'";
                var rlt1 = db.QuerySQL_ToTable(sql, out dt, out outString);
                if (dt == null || dt.Rows.Count <= 0)
                {
                    return;
                }
                houseNumber = dt.Rows[0]["house_number"].ToString();
                list        = int.Parse(dt.Rows[0]["list"].ToString());
                blank       = int.Parse(dt.Rows[0]["blank"].ToString());
                floor       = int.Parse(dt.Rows[0]["floor"].ToString());
                WriteSRM.WriteSrmData(btn_out.Text, 2, list, blank, floor);
                btn_out.Text = "入库";
            }
            update_houseData();
        }
Ejemplo n.º 14
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            int sum = 0;

            if (textBox1.Text == "")
            {
                sum = int.Parse("0") + int.Parse(tb_count.Text);
            }
            else
            {
                sum = int.Parse(textBox1.Text) + int.Parse(tb_count.Text);
            }

            string houseNumber = "";
            int    list        = 0;
            int    blank       = 0;
            int    floor       = 0;
            //加料入库
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";
            DataTable dt;

            sql = "SELECT * FROM house_data WHERE house_number = '" + cb_houseNumber.Text + "' AND goods_code = '" + cb_suppliesName.Text + "' AND goods_name = '" + cb_specification.Text + "'";
            var    rlt3 = db.QuerySQL_ToTable(sql, out dt, out outString);
            string str  = "";

            foreach (DataRow dr in dt.Rows)
            {
                str = dr["house_number"].ToString();
            }

            if (str != "")
            {
                if (btn_Add.Text == "入库")
                {
                    sql = "UPDATE house_data SET have_number = " + sum + " WHERE house_number = '" + cb_houseNumber.Text + "' AND goods_code = '" + cb_suppliesName.Text + "' AND goods_name = '" + cb_specification.Text + "'";
                    var rlt = db.ExecSql(sql, out outString);
                    list  = int.Parse((cb_houseNumber.Text).Substring(0, 2));
                    blank = int.Parse((cb_houseNumber.Text).Substring(2, 2));
                    floor = int.Parse((cb_houseNumber.Text).Substring(4, 2));
                    WriteSRM.WriteSrmData(btn_Add.Text, 2, list, blank, floor);
                    btn_Add.Text          = "出库";
                    cb_houseNumber.Text   = "";
                    cb_specification.Text = "";
                    cb_suppliesName.Text  = "";
                    textBox1.Text         = "";
                }
                else
                {
                    sql = "SELECT house_number,list,blank,floor FROM house_info WHERE house_number = '" + cb_houseNumber.Text + "'";
                    var rlt1 = db.QuerySQL_ToTable(sql, out dt, out outString);
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        return;
                    }
                    houseNumber = dt.Rows[0]["house_number"].ToString();
                    list        = int.Parse(dt.Rows[0]["list"].ToString());
                    blank       = int.Parse(dt.Rows[0]["blank"].ToString());
                    floor       = int.Parse(dt.Rows[0]["floor"].ToString());
                    WriteSRM.WriteSrmData(btn_Add.Text, 2, list, blank, floor);
                    btn_Add.Text = "入库";
                }
            }
            else
            {
                if (btn_Add.Text == "入库")
                {
                    //跟新货位状态
                    sql = "INSERT INTO house_data(house_number,goods_name,goods_code,have_number,in_house_time) VALUES('" + cb_houseNumber.Text + "','" + cb_suppliesName.Text + "','" + cb_specification.Text + "'," + int.Parse(tb_count.Text) + ",SYSDATE())";
                    var rlt2 = db.ExecSql(sql, out outString);
                }

                sql = "SELECT house_number,list,blank,floor FROM house_info WHERE house_number = '" + cb_houseNumber.Text + "'";
                var rlt1 = db.QuerySQL_ToTable(sql, out dt, out outString);
                if (dt == null || dt.Rows.Count <= 0)
                {
                    return;
                }
                houseNumber = dt.Rows[0]["house_number"].ToString();
                list        = int.Parse(dt.Rows[0]["list"].ToString());
                blank       = int.Parse(dt.Rows[0]["blank"].ToString());
                floor       = int.Parse(dt.Rows[0]["floor"].ToString());
                WriteSRM.WriteSrmData(btn_Add.Text, 2, list, blank, floor);
                btn_Add.Text = "入库";
            }
            update_houseData();
        }
Ejemplo n.º 15
0
        private void btnAlter_Click(object sender, EventArgs e)
        {
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";
            DataTable dt;

            //执行中不能强制过账
            if (tb_suppliesName.Text == "0")
            {
                //获取数据指令数据
                sql = "SELECT order_id,order_state,order_style,station_from,station_to,house_from,house_to,order_user,order_time FROM order_info WHERE order_id = " + int.Parse(tb_goodsid.Text) + "";
                var     rlt          = db.QuerySQL_ToTable(sql, out dt, out outString);
                DataRow dr           = dt.Rows[0];
                string  order_state  = dr[1].ToString();
                string  order_style  = dr[2].ToString();
                string  station_from = dr[3].ToString();
                string  station_to   = dr[4].ToString();
                string  house_from   = dr[5].ToString();
                string  house_to     = dr[6].ToString();
                string  order_user   = dr[7].ToString();

                //分解物料
                sql = "SELECT goods_code,goods_name,goods_style FROM goods_info WHERE goods_id = " + int.Parse(order_user) + "";
                db.QuerySQL_ToTable(sql, out dt, out outString);
                DataRow dd          = dt.Rows[0];
                string  goods_code  = dd[0].ToString();
                string  goods_name  = dd[1].ToString();
                string  goods_style = dd[2].ToString();

                if (order_style == "1")//入库    order_state = 3 完成   order_state = 2 未完成
                {
                    ////跟新货位状态
                    sql = "UPDATE house_info SET house_state = 'S' WHERE house_number = '" + goods_style + "'";
                    db.ExecSql(sql, out outString);
                    //更新库存数据
                    sql = "INSERT INTO house_data(house_number,goods_code,goods_name,have_number,in_house_time) VALUES('" + goods_style + "','" + goods_name + "','" + goods_code + "'," + 1 + ",SYSDATE())";
                    db.ExecSql(sql, out outString);
                    //修改
                    sql = "UPDATE order_info SET order_state = 3 WHERE order_id = " + int.Parse(tb_goodsid.Text) + "";
                    db.ExecSql(sql, out outString);

                    ////完成后生成历史清单
                    //sql = "INSERT INTO doc_info(doc_id,doc_style,send_user,rec_user,doc_time) VALUES('" + int.Parse(tb_goodsid.Text) + "','" + goods_style + "','完成','入库',SYSDATE())";
                    //db.ExecSql(sql, out outString);
                }
                if (order_style == "2")//出库
                {
                    ////跟新货位状态
                    sql = "UPDATE house_info SET house_state = 'N' WHERE house_number = '" + house_to + "'";
                    db.ExecSql(sql, out outString);

                    //修改
                    sql = "DELETE FROM house_data WHERE house_number = '" + house_to + "'";
                    db.ExecSql(sql, out outString);

                    sql = "UPDATE order_info SET order_state = 3 WHERE order_id = " + int.Parse(tb_goodsid.Text) + "";
                    db.ExecSql(sql, out outString);

                    ////完成后生成历史清单
                    //sql = "INSERT INTO doc_info(doc_id,doc_style,send_user,rec_user,doc_time) VALUES('" + int.Parse(tb_goodsid.Text) + "','" + house_to + "','完成','出库',SYSDATE())";
                    //db.ExecSql(sql, out outString);
                }
            }
            else
            {
                MessageBox.Show("不满足强制过账条件,运行中!");
            }
            update_orderInfo();
        }
Ejemplo n.º 16
0
        //清除过账
        public void ClearAccount()
        {
            try
            {
                string    str       = null;
                var       db        = new DBAccess_MySql("MySql");
                string    outString = "";
                DataTable dt;
                string    sql;
                sql = "SELECT order_user,order_id,order_style FROM order_info WHERE order_state = 1 LIMIT 1";
                var     rlt        = db.QuerySQL_ToTable(sql, out dt, out outString);
                DataRow dr         = dt.Rows[0];
                string  order_user = dr[0].ToString();
                string  orderid    = dr[1].ToString();
                string  orderstyle = dr[2].ToString();
                if (orderstyle == "1")
                {
                    str = "入库";
                }
                if (orderstyle == "2")
                {
                    str = "出库";
                }

                #region 入库过账
                if (str == "入库")
                {
                    sql = "SELECT goods_code,goods_name,goods_style FROM goods_info WHERE goods_id = " + int.Parse(order_user) + "";
                    var     rlt1        = db.QuerySQL_ToTable(sql, out dt, out outString);
                    DataRow dr1         = dt.Rows[0];
                    string  goods_code  = dr1[0].ToString();
                    string  goods_name  = dr1[1].ToString();
                    string  goods_style = dr1[2].ToString();

                    if (orderstyle == "1")//入库
                    {
                        //跟新货位状态
                        sql = "UPDATE house_info SET house_state = 'S' WHERE house_number = '" + goods_style + "'";
                        db.ExecSql(sql, out outString);
                        //修改指令
                        sql = "UPDATE order_info SET order_state = 3 WHERE order_id = " + int.Parse(orderid) + "";
                        db.ExecSql(sql, out outString);
                        //插入数据到库存表
                        sql = "INSERT INTO house_data(house_number,goods_code,goods_name,have_number,in_house_time) VALUES('" + goods_style + "','" + goods_name + "','" + goods_code + "'," + 1 + ",SYSDATE())";
                        db.ExecSql(sql, out outString);
                    }
                    if (orderstyle == "2")//出库
                    {
                        //跟新货位状态
                        sql = "UPDATE house_info SET house_state = 'N' WHERE house_number = '" + goods_style + "'";
                        db.ExecSql(sql, out outString);

                        //删除库存表数据
                        sql = "DELETE FROM house_data WHERE house_number = '" + goods_style + "'";
                        db.ExecSql(sql, out outString);

                        //修改指令状态
                        sql = "UPDATE order_info SET order_state = 3 WHERE order_id = " + int.Parse(orderid) + "";
                        db.ExecSql(sql, out outString);
                    }
                }
                #endregion

                #region 出库过账
                if (str == "出库")
                {
                    sql = "SELECT goods_code,goods_name,goods_style FROM goods_info WHERE goods_id = " + int.Parse(order_user) + "";
                    var     rlt1        = db.QuerySQL_ToTable(sql, out dt, out outString);
                    DataRow dr1         = dt.Rows[0];
                    string  goods_code  = dr1[0].ToString();
                    string  goods_name  = dr1[1].ToString();
                    string  goods_style = dr1[2].ToString();

                    if (orderstyle == "1")//入库
                    {
                        //跟新货位状态
                        sql = "UPDATE house_info SET house_state = 'S' WHERE house_number = '" + goods_style + "'";
                        db.ExecSql(sql, out outString);
                        //更新排队指令
                        sql = "UPDATE order_info SET order_state = 3 WHERE order_id = " + int.Parse(orderid) + "";
                        db.ExecSql(sql, out outString);
                    }
                    if (orderstyle == "2")//出库
                    {
                        //跟新货位状态
                        sql = "UPDATE house_info SET house_state = 'N' WHERE house_number = '" + goods_style + "'";
                        db.ExecSql(sql, out outString);

                        //删除
                        sql = "DELETE FROM house_data WHERE house_number = '" + goods_style + "'";
                        db.ExecSql(sql, out outString);

                        sql = "UPDATE order_info SET order_state = 3 WHERE order_id = " + int.Parse(orderid) + "";
                        db.ExecSql(sql, out outString);
                    }
                }
                #endregion
            }
            catch
            {
            }
        }
Ejemplo n.º 17
0
Archivo: OneIn.cs Proyecto: 13TT/TEST2
        private void button2_Click(object sender, EventArgs e)
        {
            //创建入库预约
            try
            {
                DataTable dt;
                var       db = new DBAccess_MySql("MySql");
                dataGridView1.Columns.Clear();
                string outString   = "";
                string houseNumber = "";
                int    line        = 0;
                int    list        = 0;
                int    blank       = 0;
                int    floor       = 0;
                sql = "SELECT house_number,line,list,blank,floor FROM house_info WHERE house_number = '" + comboBox1.Text + "'";
                var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);
                if (dt == null || dt.Rows.Count <= 0)
                {
                    return;
                }
                houseNumber = dt.Rows[0]["house_number"].ToString();
                line        = int.Parse(dt.Rows[0]["line"].ToString());
                list        = int.Parse(dt.Rows[0]["list"].ToString());
                blank       = int.Parse(dt.Rows[0]["blank"].ToString());
                floor       = int.Parse(dt.Rows[0]["floor"].ToString());

                foreach (var s in PLCSystem_SRM.Dic_SRM_Request)
                {
                    SRM_Respone cr = null;

                    PLCSystem_SRM.Dic_SRM_Res.TryGetValue(s.Key, out cr);

                    //if (button1.Text == "入库")
                    //{
                    //    cr.s_FrPattern = 2;
                    //}
                    //if (button1.Text == "出库")
                    //{
                    //    cr.s_FrPattern = 1;
                    //}

                    //cr.s_ToStand = 0;
                    //cr.s_FrLine = 0;
                    //cr.s_FrGrid = 0;
                    //cr.s_FrTier = 0;

                    //cr.s_FrStand = 2;
                    //cr.s_ToLine = (ushort)list;
                    //cr.s_ToGrid = (ushort)blank;
                    //cr.s_ToTier = (ushort)floor;

                    //cr.s_Execute = 1;
                    //cr.s_Fault = 1;
                    break;
                }
                //跟新货位状态
                sql = "UPDATE house_info SET house_state = 'S' WHERE house_number = '" + houseNumber + "'";
                rlt = db.ExecSql(sql, out outString);
                //更新库存数据
                sql = "INSERT INTO house_data(house_number,goods_code,goods_name,have_number,in_house_time) VALUES('" + houseNumber + "','" + tb_suppliesName.Text + "','" + tb_specification.Text + "'," + int.Parse(textBox1.Text) + ",SYSDATE())";
                rlt = db.ExecSql(sql, out outString);
                update_goodInfo();
                comboBox1.Text = "";
            }
            catch
            {
                MessageBox.Show("操作不正确!");
            }
        }
Ejemplo n.º 18
0
Archivo: OneIn.cs Proyecto: 13TT/TEST2
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("库位编号:" + tb_sort.Text + "  物料名称:" + tb_suppliesName.Text + "  物料规格:" + tb_specification.Text, "确认入库!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                #region //创建入库预约

                try
                {
                    DataTable dt;
                    var       db = new DBAccess_MySql("MySql");
                    dataGridView1.Columns.Clear();
                    string outString   = "";
                    string houseNumber = "";
                    int    line        = 0;
                    int    list        = 0;
                    int    blank       = 0;
                    int    floor       = 0;
                    sql = "SELECT house_number,line,list,blank,floor FROM house_info WHERE house_state = 'N' and house_number = '" + tb_sort.Text + "'";
                    var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        return;
                    }
                    houseNumber = dt.Rows[0]["house_number"].ToString();
                    line        = int.Parse(dt.Rows[0]["line"].ToString());
                    list        = int.Parse(dt.Rows[0]["list"].ToString());
                    blank       = int.Parse(dt.Rows[0]["blank"].ToString());
                    floor       = int.Parse(dt.Rows[0]["floor"].ToString());

                    //foreach (var s in PLCSystem_SRM.Dic_SRM_Request)
                    //{
                    //    s.Value.s_serial = 1;
                    //    s.Value.s_pattern = 2;

                    //    if (tb_suppliesName.Text == "端拾器")
                    //    {
                    //        s.Value.s_FrStand = 1;
                    //    }

                    //    if (tb_suppliesName.Text == "检具")
                    //    {
                    //        s.Value.s_FrStand = 2;
                    //    }

                    //    s.Value.s_FrLine = 0;
                    //    s.Value.s_FrGrid = 0;
                    //    s.Value.s_FrTier = 0;

                    //    s.Value.s_ToStand = 0;
                    //    s.Value.s_ToLine = (ushort)list;
                    //    s.Value.s_ToGrid = (ushort)blank;
                    //    s.Value.s_ToTier = (ushort)floor;

                    //    s.Value.s_execute_signal = 0;

                    //    //break;
                    //}
                    ////跟新货位状态
                    //sql = "UPDATE house_info SET house_state = 'S' WHERE house_number = '" + houseNumber + "'";
                    //rlt = db.ExecSql(sql, out outString);
                    ////更新库存数据
                    //sql = "INSERT INTO house_data(house_number,goods_code,goods_name,have_number,in_house_time) VALUES('" + houseNumber + "','" + tb_suppliesName.Text + "','" + tb_specification.Text + "'," + int.Parse(textBox1.Text) + ",SYSDATE())";
                    //rlt = db.ExecSql(sql, out outString);
                    //update_goodInfo();
                    //comboBox1.Text = "";
                    sql = "INSERT INTO order_info(order_state,order_style,station_from,station_to,house_from,house_to,order_user,order_time) VALUES(0,1,1,0,'" + tb_sort.Text + "','0'," + int.Parse(lbID.Text) + ",SYSDATE())";
                    db.ExecSql(sql, out outString);

                    //string str = @"Server=PLCWMSDBCONNECT;Database=PLCWMSDB;User ID=sa;Password=123456";
                    //SqlConnection conn = new SqlConnection(str);
                    //SqlCommand cmd = conn.CreateCommand();

                    //cmd.CommandText = "INSERT INTO dbo.Filtering(FilLocId) values(@FilLocId)";
                    //cmd.Parameters.Add(new SqlParameter("@FilLocId", LocId));

                    //conn.Open();
                    //cmd.ExecuteNonQuery();

                    //conn.Close();

                    sql = "UPDATE house_info SET house_state = 'I' WHERE house_number = '" + tb_sort.Text + "'";
                    db.ExecSql(sql, out outString);
                }
                catch
                {
                    MessageBox.Show("操作不正确!");
                }
                update_goodInfo();
                #endregion
            }
            else
            {
                return;
            }
        }