public static void Lot_Select(ref List <DB_TBL_LOT> Lot) { conn.Open(); string Lot_All_Select_Sql = "SELECT * FROM TBL_LOT;"; //본인의 DB이름 MySqlCommand Command_Lot_All_Select = new MySqlCommand(Lot_All_Select_Sql, conn); MySqlDataReader Reader_Lot_All_Select = Command_Lot_All_Select.ExecuteReader(); // Sql문 Reader하는 Class while (Reader_Lot_All_Select.Read()) // TBL_MODEL의 컬럼 내용 모두 읽을 때 까지 반복 { DB_TBL_LOT Lott = new DB_TBL_LOT(); Lott.Lot_Id = Reader_Lot_All_Select["lot_id"].ToString(); Lott.Model_Id = Reader_Lot_All_Select["model_id"].ToString(); Lott.Line_Id = Reader_Lot_All_Select["line_id"].ToString(); Lott.Total_Product_Count = Reader_Lot_All_Select["total_product_count"].ToString(); Lott.Product_Speed_Warn = Reader_Lot_All_Select["product_speed_warn"].ToString(); Lott.Product_Fail_Rate_Warn = Reader_Lot_All_Select["product_fail_rate_warn"].ToString(); Lott.Product_Color = Reader_Lot_All_Select["product_color"].ToString(); Lott.Temp_Margin = Reader_Lot_All_Select["temp_margin"].ToString(); Lott.Humid_Margin = Reader_Lot_All_Select["humid_margin"].ToString(); Lott.Oper_Id = Reader_Lot_All_Select["oper_id"].ToString(); Lott.Working_State = Reader_Lot_All_Select["working_state"].ToString(); Lott.Lot_Created_Time = Reader_Lot_All_Select["lot_created_time"].ToString(); Lott.Lot_Start_Time = Reader_Lot_All_Select["lot_start_time"].ToString(); Lott.Lot_End_Time = Reader_Lot_All_Select["lot_end_time"].ToString(); Lot.Add(Lott); //Lot.Add(Reader_Lot_All_Select["lot_id"].ToString() + " " + Reader_Lot_All_Select["model_id"].ToString() + " " + Reader_Lot_All_Select["line_id"].ToString() + " " + Reader_Lot_All_Select["total_product_count"].ToString() + " " + Reader_Lot_All_Select["product_speed_warn"].ToString() + // Reader_Lot_All_Select["product_fail_rate_warn"].ToString() + " " + Reader_Lot_All_Select["product_color"].ToString() + " " + Reader_Lot_All_Select["temp_margin"].ToString() + " " + Reader_Lot_All_Select["humid_margin"].ToString() + " " + Reader_Lot_All_Select["oper_id"].ToString() + // Reader_Lot_All_Select["working_state"].ToString() + " " + Reader_Lot_All_Select["lot_created_time"].ToString() + " " + Reader_Lot_All_Select["lot_start_time"].ToString() + " " + Reader_Lot_All_Select["lot_end_time"].ToString()); // 모든 정보 ArrayList 담기 } }
//// public static void Lot_Insert(ref DB_TBL_LOT lot) // Lot 기본정보 Insert 메서드 { conn.Open(); // Mysql Open string Lot_Insert_Sql = "INSERT INTO TBL_LOT (lot_id, model_id, line_id, total_product_count, product_speed_warn, product_fail_rate_warn, product_color, " + "temp_margin, humid_margin, oper_id, working_state, lot_created_time) VALUES('" + lot.Lot_Id + "'," + lot.Model_Id + ",'" + lot.Line_Id + "'," + lot.Total_Product_Count + "," + lot.Product_Speed_Warn + "," + lot.Product_Fail_Rate_Warn + ", " + "'" + lot.Product_Color + "'," + lot.Temp_Margin + "," + lot.Humid_Margin + ",'" + lot.Oper_Id + "'," + lot.Working_State + ",now());"; // Insert 쿼리문 MySqlCommand Command_Lot_Insert = new MySqlCommand(Lot_Insert_Sql, conn); // Insert Command문 Command_Lot_Insert.ExecuteNonQuery(); // Insert 실행 conn.Close(); // mysql Close }
} // 작업시작 후 model start time 갱신 public void Proc_req_lot_create(string[] receive_data_division, ref NetworkStream stream) { DB_TBL_LOT Lot = new DB_TBL_LOT(receive_data_division[2], receive_data_division[3], receive_data_division[4], receive_data_division[5], receive_data_division[6], receive_data_division[7], receive_data_division[8], receive_data_division[9], receive_data_division[10], receive_data_division[11], receive_data_division[12], "-", "-", "-"); DB_MGR.Lot_Insert(ref Lot); string send_data = "lot생성"; byte[] Response_Data = Encoding.Default.GetBytes(send_data); stream.Write(Response_Data, 0, Response_Data.Length); } // lot 생성