public bool updateStockList(VOStockList stockList) { MySqlPool pool = MySqlPool.getInstance(); MySqlConnection conn = null; try { conn = pool.getConnection(); //if (stockList.State.Equals("0")) //{ string sql = "update stock_list set stock_length=" + stockList.StockLength + ",stock_width=" + stockList.StockWidth + ",stock_height=" + stockList.StockHeight + ",stock_hor=" + stockList.StockHor + ",stock_ver=" + stockList.StockVer + ",state=" + stockList.State + ",Stock_Hor_correct='" + stockList.Stock_Hor_correct + "',Stock_Ver_correct='" + stockList.Stock_Ver_correct + "' where stock_id=" + stockList.StockID; new MySqlCommand(sql, conn).ExecuteNonQuery(); //} //else if (stockList.State.Equals("1")) //{ // string sql = "update stock_list set eqp_id = 'F1',stock_length=" + stockList.StockLength + ",stock_width=" + stockList.StockWidth + ",stock_height=" + stockList.StockHeight + ",stock_hor=" + stockList.StockHor + ",stock_ver=" + stockList.StockVer + ",state=" + stockList.State + " where stock_id=" + stockList.StockID; // new MySqlCommand(sql, conn).ExecuteNonQuery(); //} } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); return(false); } finally { pool.releaseConnection(conn); } return(true); }
/// <summary> /// /// </summary> /// <param name="row"></param> /// <param name="col"></param> /// <param name="len"></param> /// <returns></returns> public VOStockList stockChecked(int row, int col, int checkqty, int len) { VOStockList stockList = null; //MySqlPool pool = MySqlPool.getInstance(); MySqlConnection conn = null; try { conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["strCon"].ToString());//pool.getConnection(); conn.Open(); string sql = "update stock_list set Check_Length=" + len + ",Check_Quantity=" + checkqty + ",Check_Time=now() where Eqp_ID='" + NEIni.ReadValue("./config.ini", "params", "equipmentid", "F1") + "' and row_no=" + row + " and col_no=" + col; new MySqlCommand(sql, conn).ExecuteNonQuery(); sql = "select ifnull(Check_Quantity,0),ifnull(sum(quantity),0) from stock_list a left join stock_detail b on a.Stock_ID=b.Stock_ID where a.Eqp_ID='" + NEIni.ReadValue("./config.ini", "params", "equipmentid", "F1") + "' and a.row_no=" + row + " and a.col_no=" + col; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { if (dr.GetInt32(0) == dr.GetInt32(1)) { break; } stockList = new VOStockList(); stockList.Quantity = dr.GetString(1); stockList.CheckQuantity = dr.GetString(0); } dr.Close(); } catch (System.Exception ex) { // } finally { //pool.releaseConnection(conn); conn.Close(); } return(stockList); }
public FormEditStock(VOStockList stockList) { InitializeComponent(); this.stockList = stockList; }