예제 #1
0
 private void dgv_list12_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgv_list12.CurrentCell.RowIndex >= 0 && dgv_list12.CurrentCell.RowIndex < dgv_list12.RowCount && dgv_list12.CurrentCell.ColumnIndex < dgv_list12.ColumnCount && dgv_list12.CurrentCell.ColumnIndex > 0)
     {
         int       floorIndex = dgv_list12.CurrentCell.ColumnIndex;
         int       blankIndex = dgv_list12.CurrentCell.RowIndex + 1;
         var       db         = new DBAccess_MySql("MySql");
         string    outString  = "";
         DataTable dt;
         string    sql = "SELECT house_state,before_change FROM house_info WHERE (house_state='N' or house_state='S' or house_state='X') and line=" + 1 + " and list =2 and blank =" + blankIndex + " and floor =" + floorIndex + "";
         var       rlt = db.QuerySQL_ToTable(sql, out dt, out outString);
         if (dt.Rows.Count != 0)//没有预约计划的仓库
         {
             if (dt.Rows[0].ItemArray[0].ToString().Trim() == "X")
             {
                 //当前是处于禁止使用的状态,那么把该值放到数据库的静止使用表儿里面
                 //更新物品存放表儿里面的数据
                 sql = "UPDATE house_info SET house_state ='" + dt.Rows[0].ItemArray[1].ToString() + "' WHERE line=" + 1 + " and list =2 and blank =" + blankIndex + " and floor =" + floorIndex + "";
                 var rlt2 = db.QuerySQL_ToTable(sql, out dt, out outString);
             }
             else if (dt.Rows[0].ItemArray[0].ToString().Trim() == "N" || dt.Rows[0].ItemArray[0].ToString().Trim() == "S")
             {
                 sql = "UPDATE house_info SET house_state ='X',before_change = '" + dt.Rows[0].ItemArray[0].ToString() + "' WHERE line=" + 1 + " and list =2 and blank =" + blankIndex + " and floor =" + floorIndex + "";
                 var rlt3 = db.QuerySQL_ToTable(sql, out dt, out outString);
             }
             this.DataGridLoad();
         }
         else
         {
             MessageBox.Show("仅适合使用于空储位N、库存储位S、禁用库位X");
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 检测输送机任务完成(查找改巷到-1的 指令改为0)
        /// </summary>
        public bool ActivateOrderInfo(string line, string stn, string tuid, out string outString)
        {
            bool r = false;

            outString = "";
            var db = new DBAccess_MySql("MySql");

            try
            {
                db.StartTran();
                DataTable dt = GetCMD_NoSend(db, line, stn, tuid, out outString);
                if (dt == null)
                {
                    return(false);
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var    dr  = dt.Rows[i];
                    string sql = string.Format(ConfigurationManager.AppSettings["SQL_ActiveCMD"].Replace('\n', ' '), dr["order_id"].ToString());
                    var    dbr = db.ExecSql(sql, out outString);
                    r = dbr == DBExeResult.Successed;
                }

                db.CommitTran();
                return(r);
            }
            catch (Exception ex)
            {
                r = false;
                db.RollBack();
            }
            return(r);
        }
예제 #3
0
        /// <summary>
        /// 创建库存
        /// </summary>
        /// <param name="outString"></param>
        /// <returns></returns>
        public bool CreateStock(DBAccess_MySql db, string houseNumber, BarcodeInfo info, out string outString)
        {
            outString = "";
            string sql = string.Format(ConfigurationManager.AppSettings["SQL_CreateStock"].Replace('\n', ' '), houseNumber, info.ProductCode, info.BatchNo, info.UnitQty, info.VendorCode, info.PacketSeqNo, info.Barcode);
            var    rlt = db.ExecSql(sql, out outString);

            return(rlt == DBExeResult.Successed);
        }
예제 #4
0
        /// <summary>
        /// 取消分配
        /// </summary>
        /// <param name="houseNumber"></param>
        /// <param name="outString"></param>
        /// <returns></returns>
        public bool CancelAllocationLoc(DBAccess_MySql db, string houseNumber, out string outString)
        {
            outString = "";
            //取消预定
            string sql = string.Format(ConfigurationManager.AppSettings["SQL_UnBookingLoc"].Replace('\n', ' '), houseNumber);
            var    rlt = db.ExecSql(sql, out outString);

            return(rlt == DBExeResult.Successed);
        }
예제 #5
0
        public bool CreateOrderInfo_Out_T(DBAccess_MySql db, string barcode, string FromLoc, string ToLoc, out string outString)
        {
            outString = "";
            string sql = ConfigurationManager.AppSettings["SQL_CreateOrder_Out_T"].Replace('\n', ' ');

            sql = string.Format(sql, FromLoc, ToLoc, barcode);
            var rlt = db.ExecSql(sql, out outString);

            return(rlt == DBExeResult.Successed);
        }
예제 #6
0
        public DataTable GetCMD_Doing(DBAccess_MySql db, string line, out string outString)
        {
            DataTable dt = null;

            outString = "";
            string sql = string.Format(ConfigurationManager.AppSettings["SQL_GetCMD_Doing"].Replace('\n', ' '), line);
            var    rlt = db.QuerySQL_ToTable(sql, out dt, out outString);

            return(dt);
        }
예제 #7
0
        /// <summary>
        /// 取得可出库货位列表
        /// </summary>
        /// <param name="outString"></param>
        /// <returns></returns>
        public DataTable GetAllocationLoc(DBAccess_MySql db, out string outString)
        {
            DataTable dt;

            outString = "";

            string sql = ConfigurationManager.AppSettings["SQL_GetAllocationLoc"].Replace('\n', ' ');
            var    rlt = db.QuerySQL_ToTable(sql, out dt, out outString);

            return(dt);
        }
예제 #8
0
        private void update_dgv(DataGridView dgv, int line, int list)
        {
            ////查询sql
            string    outString = null;
            var       db        = new DBAccess_MySql("MySql");
            string    sql       = string.Format("SELECT blank, floor, house_state FROM house_info WHERE list = {0} and line={1} ORDER BY blank ASC,floor ASC", list, line);
            DataTable dt        = db.QueryDataTable(sql, out outString);

            if (dt.Rows.Count == dgv.RowCount * (dgv.ColumnCount - 1))
            {
                for (int blankIndex = 0; blankIndex < dgv.RowCount; blankIndex++)
                {
                    for (int floorIndex = 0; floorIndex < dgv.ColumnCount - 1; floorIndex++)
                    {
                        if (dt.Rows[blankIndex * (dgv.ColumnCount - 1) + floorIndex].ItemArray[2].ToString().Trim() == "N")
                        {
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Value           = ' ';
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Style.BackColor = Color.White;
                        }
                        else if (dt.Rows[blankIndex * (dgv.ColumnCount - 1) + floorIndex].ItemArray[2].ToString().Trim() == "S")
                        {
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Value           = 'S';
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Style.BackColor = Color.Yellow;
                        }
                        else if (dt.Rows[blankIndex * (dgv.ColumnCount - 1) + floorIndex].ItemArray[2].ToString().Trim() == "I")
                        {
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Value           = 'I';
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Style.BackColor = Color.MediumSlateBlue;
                        }
                        else if (dt.Rows[blankIndex * (dgv.ColumnCount - 1) + floorIndex].ItemArray[2].ToString().Trim() == "O")
                        {
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Value           = 'O';
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Style.BackColor = Color.LimeGreen;
                        }
                        else if (dt.Rows[blankIndex * (dgv.ColumnCount - 1) + floorIndex].ItemArray[2].ToString().Trim() == "E")
                        {
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Value           = 'E';
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Style.BackColor = Color.PaleVioletRed;
                        }
                        else if (dt.Rows[blankIndex * (dgv.ColumnCount - 1) + floorIndex].ItemArray[2].ToString().Trim() == "C")
                        {
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Value           = 'C';
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Style.BackColor = Color.Green;
                        }
                        else if (dt.Rows[blankIndex * (dgv.ColumnCount - 1) + floorIndex].ItemArray[2].ToString().Trim() == "X")
                        {
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Value           = 'X';
                            dgv.Rows[blankIndex].Cells[floorIndex + 1].Style.BackColor = Color.Red;
                        }
                    }
                }
            }
        }
예제 #9
0
파일: frmLogin.cs 프로젝트: 13TT/TEST2
        private void frmLogin_Load(object sender, EventArgs e)
        {
            DataTable dt;
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";

            groupBox1.BackColor = Color.Transparent;
            groupBox1.Parent    = panel1;

            sql = "SELECT user_code FROM user_info LIMIT 1,2";
            var     rlt1 = db.QuerySQL_ToTable(sql, out dt, out outString);
            DataRow dr   = dt.Rows[0];

            tb_userName.Text = dr[0].ToString();
        }
예제 #10
0
        /// <summary>
        /// 判断重复指令
        /// </summary>
        /// <returns></returns>
        public bool IsRepeatPallet(string barcode, out string outString)
        {
            outString = "";
            var db = new DBAccess_MySql("MySql");

            try
            {
                string sql = string.Format(ConfigurationManager.AppSettings["SQL_IsRepeatPallet"].Replace('\n', ' '), barcode);
                var    obj = db.QuerySQL_GetValue(sql, out outString);
                return(obj != null);
            }
            catch (Exception ex)
            {
                outString = ex.Message;
                return(false);
            }
        }
예제 #11
0
파일: FRM_CC.cs 프로젝트: 13TT/TEST2
        private void timer_SRM_Tick(object sender, EventArgs e)
        {
            try
            {
                var       db        = new DBAccess_MySql("MySql");
                string    outString = "";
                DataTable dt;
                string    sql;
                sql = "SELECT order_user,order_style FROM order_info WHERE order_state = 0 or order_state = 1 LIMIT 1";
                var     rlt         = db.QuerySQL_ToTable(sql, out dt, out outString);
                DataRow dr          = dt.Rows[0];
                string  order_state = dr[0].ToString();
                string  order_style = dr[1].ToString();

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

                if (styles == "端拾器")
                {
                    lab_zhanhao.Text = "1";
                }
                if (styles == "检具")
                {
                    lab_zhanhao.Text = "2";
                }
                if (order_style == "2")
                {
                    lab_leixing.Text = "出库";
                }
                if (order_style == "1")
                {
                    lab_leixing.Text = "入库";
                }
            }
            catch
            {
                lab_name.Text    = "";
                lab_house.Text   = "";
                lab_zhanhao.Text = "";
                lab_leixing.Text = "";
            }
        }
예제 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt;
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";

            sql = "SELECT * FROM user_info WHERE user_code = '" + tb_userName.Text + "' AND pass_word = '" + tb_userPassword.Text + "'";
            var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);

            if (dt.Rows.Count == 1)
            {
                int    i  = dt.Rows.Count;
                FRM_CC fc = new FRM_CC();
                this.Visible = false;
                fc.Show();
            }
            else
            {
                int i = dt.Rows.Count;
                MessageBox.Show("请检查用户名和密码是否正确!");
            }
        }
예제 #13
0
파일: frmLogin.cs 프로젝트: 13TT/TEST2
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt;
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";

            sql = "SELECT * FROM user_info WHERE user_code = '" + tb_userName.Text + "' AND pass_word = '" + tb_userPassword.Text + "'";
            var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);

            if (dt.Rows.Count == 1)
            {
                int    i  = dt.Rows.Count;
                FRM_CC fc = new FRM_CC();
                this.Visible = false;
                fc.Show();
            }
            else
            {
                int i = dt.Rows.Count;
                MessageBox.Show("请检查用户名和密码是否正确!");
            }

            sql = "SELECT use_pl_new_pallet FROM user_info WHERE user_code = '" + tb_userName.Text + "'";
            var rlt1 = db.QuerySQL_ToTable(sql, out dt, out outString);

            try
            {
                DataRow dr = dt.Rows[0];
                string  s  = dr[0].ToString();

                sql = "UPDATE config_unit SET table_name = '" + tb_userName.Text + "',unit_name = '" + s + "'";
                db.ExecSql(sql, out outString);
            }
            catch
            {
            }
        }
예제 #14
0
        /// <summary>
        /// 分配货位
        /// </summary>
        /// <param name="barcode"></param>
        /// <param name="outString"></param>
        /// <returns></returns>
        public bool AllocationLoc(DBAccess_MySql db, string barcode, out string Loc, out string outString)
        {
            Loc = "";
            BarcodeInfo bi = new BarcodeInfo(barcode);

            outString = "";
            //找到空格位最少的巷道
            //找到该巷道货位 按 层,列,排  升序排序的 的一个货位
            //预定货位-将状态设置为入库预定I
            //返货预定储位
            DataTable dt = GetAllocationLoc(db, out outString);

            if (dt == null || dt.Rows.Count <= 0)
            {
                return(false);
            }
            Loc = dt.Rows[0]["house_number"].ToString();
            string sql = ConfigurationManager.AppSettings["SQL_BookingLoc"].Replace('\n', ' ');

            sql = string.Format(sql, Loc);
            var rlt = db.ExecSql(sql, out outString);

            return(rlt == DBExeResult.Successed);
        }
예제 #15
0
        public bool CreateStock(string houseNumber, BarcodeInfo info, out string outString)
        {
            var db = new DBAccess_MySql("MySql");

            return(CreateStock(db, houseNumber, info, out outString));
        }
예제 #16
0
        /// <summary>
        /// 指定位置出库(用于紧急出库)
        /// </summary>
        /// <param name="HouseNumber"></param>
        /// <param name="outString"></param>
        /// <returns></returns>
        public bool OutStore_AssignLoction(string HouseNumber, int j, out string outString)
        {
            bool r = false;

            outString = "";
            var            db  = new DBAccess_MySql("MySql");
            DBAccess_MySql dby = new DBAccess_MySql();

            try
            {
                //查找出HouseNumber内所有库存,更新其库存计划出库量(参考WMS-Client的里的出库相关业务的“确认”按钮内的代码)
                string sql = string.Format(ConfigurationManager.AppSettings["SQL_AssignGoods"].Replace('\n', ' '), HouseNumber);
                dby = db.ReturnSQL_String(sql, out outString);
                try
                {
                    string a = null;
                    string b = null;
                    string c = null;
                    int    d = 0;
                    string e = null;
                    while (dby.rec.Read())
                    {
                        a = dby.rec.GetString(0);
                        b = dby.rec.GetString(1);
                        c = dby.rec.GetString(2);
                        d = dby.rec.GetInt32(3);
                        e = dby.rec.GetString(4);
                    }
                    dby.connMysql.Close();
                    dby.rec.Close();
                    if (a != "")
                    {
                        string sql1 = string.Format(ConfigurationManager.AppSettings["SQL_UpdateGoods"].Replace('\n', ' '), d, a, b);
                        var    rlt1 = db.ExecSql(sql1, out outString);

                        //改变库位状态
                        string sql2 = string.Format(ConfigurationManager.AppSettings["SQL_OutStateGoods"].Replace('\n', ' '), a);
                        var    rlt2 = db.ExecSql(sql2, out outString);

                        //改变储位状态
                        string sql3 = string.Format(ConfigurationManager.AppSettings["SQL_OutDataGoods"].Replace('\n', ' '), a, b);
                        var    rlt3 = db.ExecSql(sql3, out outString);

                        //判断是不是全部物品出库,如果是全部都出库了,那么是出库命令2.否则是减料出库3
                        string sql4 = string.Format(ConfigurationManager.AppSettings["SQL_OutSelectNull"].Replace('\n', ' '), a);
                        var    obj4 = db.QuerySQL_GetValue(sql4, out outString);
                        if (obj4 == null)
                        {
                            //创建出库指令(order_info)
                            int    i    = int.Parse(a.Substring(1, 1));
                            string sql5 = string.Format(ConfigurationManager.AppSettings["SQL_AddOutOrder"].Replace('\n', ' '), a, i, e, j);
                            var    rlt5 = db.ExecSql(sql5, out outString);
                        }
                        else
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                }
                return(!r);
            }
            catch (Exception ex)
            {
                outString = ex.Message;
                return(r);
            }
        }
예제 #17
0
        /// <summary>
        ///入库申请
        /// </summary>
        /// <param name="barcode"></param>
        /// <param name="RequestLoc"></param>
        /// <param name="fromStn"></param>
        /// <param name="outString"></param>
        /// <returns></returns>
        public bool RequestInStock(string barcode, string RequestLoc, out string fromStn, out string outString)
        {
            string newHouseNumber = "";
            string Line           = "";
            bool   r = false;

            fromStn   = "";
            outString = "";
            //1判断是否重复申请
            //2.创建库存
            //3.分配货位
            //4.获取巷到对应EP点
            //5.创建入库执行
            var db = new DBAccess_MySql("MySql");

            try
            {
                db.StartTran();
                r = IsRepeatPallet(barcode, out outString);
                if (r)
                {
                    throw new ApplicationException(string.Format("[{0}]重复的入库申请!{1}", barcode, outString));
                }
                r = AllocationLoc(db, barcode, out newHouseNumber, out outString);
                if (!r)
                {
                    throw new ApplicationException(string.Format("[{0}]分配货位失败!{1}", barcode, outString));
                }
                BarcodeInfo bi = new BarcodeInfo(barcode);
                r = CreateStock(db, newHouseNumber, bi, out outString);
                if (!r)
                {
                    throw new ApplicationException(string.Format("[{0}]创建库存失败{!1}", barcode, outString));
                }
                Line    = PLCSystem_SRM.GetLineByhouseNumber(newHouseNumber).ToString();
                fromStn = PLCSystem_SRM.SysSRMMaping.GetConNodeID(Line, PLCSystem_SRM.InStnNo, eStationType.EP);
                if (Line == "" || fromStn == "")
                {
                    throw new ApplicationException(string.Format("[{0}]获取匹配巷道及入库站点失败!{1}", barcode, outString));
                }
                r = CreateOrderInfo_In(db, barcode, PLCSystem_SRM.InStnNo, newHouseNumber, Line, out outString);
                if (!r)
                {
                    throw new ApplicationException(string.Format("[{0}]创建入库指令失败!{1}", barcode, outString));
                }
                db.CommitTran();
            }
            catch (Exception ex)
            {
                outString = ex.Message;
                Program.Log_Agent_BUS.WriteLog(Enum_LogType.LogType_Error,
                                               Enum_LogGrade.LogGrade_Nin,
                                               Enum_LogMessageType.LogMsgType_Exception,
                                               "RequestInStocke",
                                               ex.Message,
                                               ex.StackTrace);
                r = false;
                db.RollBack();
            }
            return(r);
        }
예제 #18
0
        public DataTable GetCMD_Doing(string line, out string outString)
        {
            var db = new DBAccess_MySql("MySql");

            return(GetCMD_Doing(db, line, out outString));
        }