public void Add(ClassRecepcion datos, Boolean message, int StatusTableName) { string TableName = ""; if (StatusTableName == 1) { // select tabla recepciones. TableName = R.SQL.QUERY_SQL.RECEPCIONES.SQL_QUERY_INSERT_DOCS_RECEPCIONES; } else if (StatusTableName == 2) { // select iniciales de masters TableName = R.SQL.QUERY_SQL.RECEPCIONES.SQL_QUERY_INSERT_INICIALES_MASTERS; } else if (StatusTableName == 3) { // select iniciales de hojas TableName = R.SQL.QUERY_SQL.RECEPCIONES.SQL_QUERY_INSERT_INICIALES_HOJAS; } else if (StatusTableName == 4) { // select iniciales de graphics TableName = R.SQL.QUERY_SQL.RECEPCIONES.SQL_QUERY_INSERT_INICIALES_GRAPHICS; } CommandSqlGeneric(R.SQL.DATABASE.NAME, TableName, SetParametersAdd(datos), R.ERROR_MESSAGES.MODULO_RECEPCIONES.MESSAGE_INSERT_RECEPCIONES_OK, R.ERROR_MESSAGES.MODULO_RECEPCIONES.MESSAGE_INSERT_RECEPCIONES_FAIL, message); }
public List <ClassRecepcion> DownloadDataMateriaPrimaTxtMovil() { string path = R.PATH_FILES.FILE_TXT_MATERIA_PRIMA; List <ClassRecepcion> lista = new List <ClassRecepcion>(); if (File.Exists(path)) { try { using (StreamReader sr = new StreamReader(path)) { while (sr.Peek() >= 0) { try { string str; string[] strArray; str = sr.ReadLine(); strArray = str.Split(','); string strWidth = strArray[2]; string strLenght = strArray[3]; int lenWidth = strWidth.Length; int lenLenght = strLenght.Length; strWidth = strWidth.Substring(1, lenWidth - 1); strLenght = strLenght.Substring(1, lenLenght - 1); double WidthValue = double.Parse(strWidth, CultureInfo.InvariantCulture); double LenghtValue = double.Parse(strLenght, CultureInfo.InvariantCulture); ClassRecepcion recepcion = new ClassRecepcion { Orden = strArray[0], Part_Number = strArray[1], ProductName = SearchProductName(strArray[1]), Tipo = SearchTipoProduct(strArray[1]), Width = WidthValue, Lenght = LenghtValue, Roll_ID = (strArray[4]) }; lista.Add(recepcion); } catch (Exception ex) { MessageBox.Show("error al leer la data y convertir el archivo txt de recepciones en la pc: " + ex); } } } } catch (Exception ex) { MessageBox.Show("error al tratar de crear el txt de materia prima" + ex); lista = null; return(lista); } } else { } return(lista); }
private void SAVEDATA_GRAPHICS() { //if (!VALIDAR_NUMERO_CONSECUTIVO()) //{ // return; //} int ord = 1; foreach (DataGridViewRow row in GRID_IMPORT.Rows) { ClassRecepcion data = new ClassRecepcion { Orden = ord.ToString(), Embarque = "grainic", Fecha_recepcion = DBNull.Value.Equals(row.Cells["F7"].Value) ? DateTime.Today : Convert.ToDateTime(row.Cells["F7"].Value), Fecha_produccion = DateTime.Today, Fecha_reg = DateTime.Today, Hora_reg = DateTime.Now.ToShortTimeString(), Roll_ID = Convert.ToString(row.Cells["F3"].Value), Supply_Id = "999", SupplyName = "", Part_Number = Convert.ToString(row.Cells["F1"].Value), ProductName = "", Master = false, Resma = false, Graphics = true, Palet_number = Convert.ToString(row.Cells["F8"].Value).Length > 10 ? Convert.ToString(row.Cells["F8"].Value).Substring(0, 9):Convert.ToString(row.Cells["F8"].Value), Palet_cant = 1, Palet_paginas = 1, Width = Convert.ToDouble(row.Cells["F4"].Value), Lenght = Convert.ToDouble(row.Cells["F5"].Value), Width_metros = 0, Lenght_metros = 0, Splice = 0, Core = 0, Ubicacion = "", Tipo = "", Unidad = "", Anulado = false, Disponible = true }; ord++; lista.Add(data); } foreach (ClassRecepcion item in lista) { manager.Add(item, false, 4); } MessageBox.Show("Se enviaron los datos correctamente al servidor..."); }
private void SAVEDATA_HOJAS() { //if (!VALIDAR_NUMERO_CONSECUTIVO()) //{ // return; //} int ord = 1; foreach (DataGridViewRow row in GRID_IMPORT.Rows) { ClassRecepcion data = new ClassRecepcion { Orden = ord.ToString(), Embarque = "inihoj", Fecha_recepcion = DateTime.Today, Fecha_produccion = DateTime.Today, Fecha_reg = DateTime.Today, Hora_reg = DateTime.Now.ToShortTimeString(), Roll_ID = Convert.ToString(row.Cells["F3"].Value), Supply_Id = "999", SupplyName = "", Part_Number = Convert.ToString(row.Cells["F1"].Value), ProductName = Convert.ToString(row.Cells["F2"].Value), Master = false, Resma = true, Graphics = false, Palet_number = Convert.ToString(row.Cells["F9"].Value).Substring(0, 9), Palet_cant = Convert.ToDecimal(row.Cells["F4"].Value), Palet_paginas = Int32.Parse(Convert.ToString(row.Cells["F7"].Value), System.Globalization.NumberStyles.Any), Width = Convert.ToDouble(row.Cells["F5"].Value), Lenght = Convert.ToDouble(row.Cells["F6"].Value), Width_metros = 0, Lenght_metros = 0, Splice = 0, Core = 0, Ubicacion = "", Tipo = "", Unidad = "", Anulado = false, Disponible = true }; ord++; lista.Add(data); } foreach (ClassRecepcion item in lista) { manager.Add(item, false, 3); } MessageBox.Show("Se enviaron los datos correctamente al servidor..."); }
private void SAVEDATA_MASTERS() { int ord = 1; foreach (DataGridViewRow row in GRID_IMPORT.Rows) { ClassRecepcion data = new ClassRecepcion { Orden = ord.ToString(), Embarque = "inimas", Fecha_recepcion = DateTime.Today, Fecha_produccion = DateTime.Today, Fecha_reg = DateTime.Today, Hora_reg = DateTime.Now.ToShortTimeString(), Roll_ID = Convert.ToString(row.Cells["F3"].Value), Supply_Id = "999", Part_Number = Convert.ToString(row.Cells["F1"].Value), Master = true, Resma = false, Graphics = false, Palet_number = "0", Palet_cant = 0, Palet_paginas = 0, Width = double.Parse(Convert.ToString(row.Cells["F4"].Value), System.Globalization.NumberStyles.AllowDecimalPoint), Lenght = Convert.ToDouble(row.Cells["F5"].Value), Width_metros = Convert.ToDouble(row.Cells["F4"].Value) * R.CONSTANTES.FACTOR_PULGADAS_METROS, Lenght_metros = Convert.ToDouble(row.Cells["F5"].Value) * R.CONSTANTES.FACTOR_PIES_METROS, Splice = Convert.ToInt16(row.Cells["F6"].Value), Core = 0, Ubicacion = "", Anulado = false, Disponible = true }; ord++; lista.Add(data); } foreach (ClassRecepcion item in lista) { manager.Add(item, false, 2); } MessageBox.Show("Se enviaron los datos correctamente..."); }
public ClassRecepcion GetDataGraphicsByID(string id) { ClassRecepcion data = new ClassRecepcion(); try { micomm.Conectar(R.SQL.DATABASE.NAME); SqlCommand comando = new SqlCommand { Connection = micomm.cnn, CommandType = CommandType.Text, CommandText = R.SQL.QUERY_SQL.RECEPCIONES.SQL_QUERY_SELECT_GETDATABYID_GRAPHICS }; SqlParameter p1 = new SqlParameter("@p1", id); comando.Parameters.Add(p1); SqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { data.Part_Number = reader.GetString(1); data.ProductName = reader.GetString(2); data.Width = Convert.ToDouble(reader["width"]); data.Lenght = Convert.ToDouble(reader["lenght"]); data.Roll_ID = reader.GetString(5); data.Palet_number = Convert.ToString(reader["palet_num"]); data.Palet_paginas = Convert.ToInt32(reader["palet_pag"]); data.Embarque = Convert.ToString(reader["palet_pag"]); data.Embarque = Convert.ToString(reader["palet_pag"]); data.Tipo = reader.GetString(10); data.cant_despacho = 0; } comando.Dispose(); micomm.Desconectar(); return(data); } catch (SqlException ex) { MessageBox.Show("error al tratar de leer la data de materia prima graphics. consulta por id..." + ex); return(data); } }
public List <SqlParameter> SetParametersUpdate(ClassRecepcion datos) { List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter() { ParameterName = "@p1", SqlDbType = SqlDbType.NVarChar, Value = datos.Orden }, new SqlParameter() { ParameterName = "@p2", SqlDbType = SqlDbType.DateTime, Value = datos.Fecha_produccion }, new SqlParameter() { ParameterName = "@p3", SqlDbType = SqlDbType.NVarChar, Value = datos.Embarque }, new SqlParameter() { ParameterName = "@p4", SqlDbType = SqlDbType.NVarChar, Value = datos.Roll_ID }, new SqlParameter() { ParameterName = "@p5", SqlDbType = SqlDbType.Bit, Value = datos.Anulado }, new SqlParameter() { ParameterName = "@p6", SqlDbType = SqlDbType.NVarChar, Value = datos.Ubicacion }, new SqlParameter() { ParameterName = "@p7", SqlDbType = SqlDbType.NVarChar, Value = datos.Supply_Id }, new SqlParameter() { ParameterName = "@p8", SqlDbType = SqlDbType.Decimal, Value = datos.Width }, new SqlParameter() { ParameterName = "@p9", SqlDbType = SqlDbType.Decimal, Value = datos.Lenght }, new SqlParameter() { ParameterName = "@p10", SqlDbType = SqlDbType.Decimal, Value = datos.Splice }, new SqlParameter() { ParameterName = "@p11", SqlDbType = SqlDbType.Decimal, Value = datos.Core }, new SqlParameter() { ParameterName = "@p12", SqlDbType = SqlDbType.Decimal, Value = datos.Width_metros }, new SqlParameter() { ParameterName = "@p13", SqlDbType = SqlDbType.Decimal, Value = datos.Lenght_metros }, new SqlParameter() { ParameterName = "@p14", SqlDbType = SqlDbType.DateTime, Value = datos.Fecha_recepcion } }; return(sp); }
public List <SqlParameter> SetParametersAdd(ClassRecepcion datos) { List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter() { ParameterName = "@p1", SqlDbType = SqlDbType.NVarChar, Value = datos.Orden }, new SqlParameter() { ParameterName = "@p2", SqlDbType = SqlDbType.NVarChar, Value = datos.Part_Number }, new SqlParameter() { ParameterName = "@p3", SqlDbType = SqlDbType.Decimal, Value = datos.Width }, new SqlParameter() { ParameterName = "@p4", SqlDbType = SqlDbType.Decimal, Value = datos.Lenght }, new SqlParameter() { ParameterName = "@p5", SqlDbType = SqlDbType.NVarChar, Value = datos.Roll_ID }, new SqlParameter() { ParameterName = "@p6", SqlDbType = SqlDbType.NVarChar, Value = datos.Supply_Id }, new SqlParameter() { ParameterName = "@p7", SqlDbType = SqlDbType.NVarChar, Value = datos.Ubicacion }, new SqlParameter() { ParameterName = "@p8", SqlDbType = SqlDbType.Decimal, Value = datos.Core }, new SqlParameter() { ParameterName = "@p9", SqlDbType = SqlDbType.Decimal, Value = datos.Splice }, new SqlParameter() { ParameterName = "@p10", SqlDbType = SqlDbType.Bit, Value = datos.Anulado }, new SqlParameter() { ParameterName = "@p11", SqlDbType = SqlDbType.DateTime, Value = datos.Fecha_reg }, new SqlParameter() { ParameterName = "@p12", SqlDbType = SqlDbType.NVarChar, Value = datos.Hora_reg }, new SqlParameter() { ParameterName = "@p13", SqlDbType = SqlDbType.DateTime, Value = datos.Fecha_produccion }, new SqlParameter() { ParameterName = "@p14", SqlDbType = SqlDbType.Bit, Value = datos.Master }, new SqlParameter() { ParameterName = "@p15", SqlDbType = SqlDbType.Bit, Value = datos.Resma }, new SqlParameter() { ParameterName = "@p16", SqlDbType = SqlDbType.Bit, Value = datos.Graphics }, new SqlParameter() { ParameterName = "@p17", SqlDbType = SqlDbType.NVarChar, Value = datos.Embarque }, new SqlParameter() { ParameterName = "@p18", SqlDbType = SqlDbType.NVarChar, Value = datos.Palet_number }, new SqlParameter() { ParameterName = "@p19", SqlDbType = SqlDbType.Int, Value = datos.Palet_cant }, new SqlParameter() { ParameterName = "@p20", SqlDbType = SqlDbType.Int, Value = datos.Palet_paginas }, new SqlParameter() { ParameterName = "@p21", SqlDbType = SqlDbType.Int, Value = datos.Num_sincro }, new SqlParameter() { ParameterName = "@p22", SqlDbType = SqlDbType.Bit, Value = datos.Registro_movil }, new SqlParameter() { ParameterName = "@p23", SqlDbType = SqlDbType.Bit, Value = datos.Disponible }, new SqlParameter() { ParameterName = "@p24", SqlDbType = SqlDbType.Decimal, Value = datos.Width_metros }, new SqlParameter() { ParameterName = "@p25", SqlDbType = SqlDbType.Decimal, Value = datos.Lenght_metros }, new SqlParameter() { ParameterName = "@p26", SqlDbType = SqlDbType.DateTime, Value = datos.Fecha_recepcion } }; return(sp); }
public void Update(ClassRecepcion datos, bool msg_onoff) { CommandSqlGeneric(R.SQL.DATABASE.NAME, R.SQL.QUERY_SQL.RECEPCIONES.SQL_QUERY_UPDATE_ORDEN_RECEPCION, SetParametersUpdate(datos), R.ERROR_MESSAGES.MODULO_RECEPCIONES.MESSAGE_UPDATE_RECEPCIONES_OK, R.ERROR_MESSAGES.MODULO_RECEPCIONES.MESSAGE_UPDATE_RECEPCIONES_FAIL, msg_onoff); }
private void SAVEDATA_PACKING() { foreach (DataGridViewRow row in GRID_IMPORT.Rows) { if (Convert.ToString(row.Cells["F2"].Value) == "1") { //master. ClassRecepcion data = new ClassRecepcion { Orden = Convert.ToString(manager.MaxConsecOrden()), Embarque = Convert.ToString(row.Cells["F5"].Value), Fecha_recepcion = Convert.ToDateTime(row.Cells["F6"].Value), Fecha_produccion = Convert.ToDateTime(row.Cells["F7"].Value), Fecha_reg = DateTime.Today, Hora_reg = DateTime.Now.ToShortTimeString(), Roll_ID = Convert.ToString(row.Cells["F8"].Value), Supply_Id = Convert.ToString(row.Cells["F9"].Value), Part_Number = Convert.ToString(row.Cells["F11"].Value), Master = true, Resma = false, Graphics = false, Palet_number = "0", Palet_cant = 0, Palet_paginas = 0, Width = double.Parse(Convert.ToString(row.Cells["F13"].Value), System.Globalization.NumberStyles.AllowDecimalPoint), Lenght = Convert.ToDouble(row.Cells["F14"].Value), Width_metros = Convert.ToDouble(row.Cells["F13"].Value) * R.CONSTANTES.FACTOR_PULGADAS_METROS, Lenght_metros = Convert.ToDouble(row.Cells["F14"].Value) * R.CONSTANTES.FACTOR_PIES_METROS, Splice = Convert.ToInt16(row.Cells["F15"].Value), Core = Convert.ToDecimal(row.Cells["F16"].Value), Ubicacion = Convert.ToString(row.Cells["F17"].Value), Anulado = false, Disponible = true }; manager.Add(data, false, 1); } if (Convert.ToString(row.Cells["F3"].Value) == "1") { //hojas. ClassRecepcion data = new ClassRecepcion { Orden = Convert.ToString(manager.MaxConsecOrden()), Embarque = Convert.ToString(row.Cells["F5"].Value), Fecha_recepcion = Convert.ToDateTime(row.Cells["F6"].Value), Fecha_produccion = Convert.ToDateTime(row.Cells["F7"].Value), Fecha_reg = DateTime.Today, Hora_reg = DateTime.Now.ToShortTimeString(), Roll_ID = Convert.ToString(row.Cells["F18"].Value), Supply_Id = Convert.ToString(row.Cells["F9"].Value), SupplyName = "", Part_Number = Convert.ToString(row.Cells["F11"].Value), Master = false, Resma = true, Graphics = false, Palet_number = Convert.ToString(row.Cells["F21"].Value), Palet_cant = Convert.ToDecimal(row.Cells["F19"].Value), Palet_paginas = Int32.Parse(Convert.ToString(row.Cells["F20"].Value), System.Globalization.NumberStyles.Any), Width = Convert.ToDouble(row.Cells["F22"].Value), Lenght = Convert.ToDouble(row.Cells["F23"].Value), Width_metros = 0, Lenght_metros = 0, Splice = 0, Core = 0, Ubicacion = Convert.ToString(row.Cells["F17"].Value), Tipo = "", Unidad = "", Anulado = false, Disponible = true }; manager.Add(data, false, 1); } if (Convert.ToString(row.Cells["F4"].Value) == "1") { //graphics. ClassRecepcion data = new ClassRecepcion { Orden = Convert.ToString(manager.MaxConsecOrden()), Embarque = Convert.ToString(row.Cells["F5"].Value), Fecha_recepcion = Convert.ToDateTime(row.Cells["F6"].Value), Fecha_produccion = Convert.ToDateTime(row.Cells["F7"].Value), Fecha_reg = DateTime.Today, Hora_reg = DateTime.Now.ToShortTimeString(), Roll_ID = Convert.ToString(row.Cells["F24"].Value), Supply_Id = Convert.ToString(row.Cells["F9"].Value), SupplyName = "", Part_Number = Convert.ToString(row.Cells["F11"].Value), Master = false, Resma = false, Graphics = true, Palet_number = Convert.ToString(row.Cells["F27"].Value), Palet_cant = 0, Palet_paginas = 0, Width = Convert.ToDouble(row.Cells["F25"].Value), Lenght = Convert.ToDouble(row.Cells["F26"].Value), Width_metros = 0, Lenght_metros = 0, Splice = 0, Core = 0, Ubicacion = Convert.ToString(row.Cells["F17"].Value), Tipo = "", Unidad = "", Anulado = false, Disponible = true }; manager.Add(data, false, 1); } } MessageBox.Show("Se enviaron los datos correctamentes al servidor..."); }
private void Bot_tranferir_data_Click(object sender, EventArgs e) { Boolean sincrook = false; int numsincro = Convert.ToInt32(configmanager.GetParameterControl("LSR")) + 1; //SAVE DATA RECEPCIONES foreach (DataGridViewRow row in grid_item.Rows) { if (Convert.ToBoolean(row.Cells["total_ok"].Value)) { ClassRecepcion data = new ClassRecepcion { Orden = Convert.ToString(row.Cells["orden"].Value), Fecha_reg = DateTime.Now, Hora_reg = DateTime.Now.ToString(), Part_Number = Convert.ToString(row.Cells["id_product"].Value), ProductName = Convert.ToString(row.Cells["product_name"].Value) }; ; data.Supply_Id = Convert.ToString(row.Cells["proveedor_id"].Value);; data.SupplyName = Convert.ToString(row.Cells["proveedor_name"].Value);; data.Width = Convert.ToDouble(row.Cells["width"].Value);; data.Lenght = Convert.ToDouble(row.Cells["lenght"].Value); data.Roll_ID = Convert.ToString(row.Cells["rollid"].Value); data.Ubicacion = ""; data.Splice = 0; data.Core = 0; data.Anulado = false; data.Fecha_produccion = DateTime.Today; data.Master = true; data.Resma = false; data.Graphics = false; data.Embarque = ""; data.Palet_number = ""; data.Palet_cant = 0; data.Palet_paginas = 0; data.Num_sincro = numsincro; data.Registro_movil = true; data.Disponible = true; recepmanager.Add(data, false, 1); sincrook = true; } } configmanager.SetParametersControl(numsincro.ToString(), "LSR"); if (sincrook) { MessageBox.Show("Se guardaron los datos correctamente."); } //borra el archivo try { if (File.Exists(R.PATH_FILES.FILE_TXT_MATERIA_PRIMA)) { File.Delete(R.PATH_FILES.FILE_TXT_MATERIA_PRIMA); } } catch (Exception ex) { MessageBox.Show("error al tratar de eliminar el txt de recepciones materia prima" + ex); } Lista.Clear(); grid_item.DataSource = ""; }
public void Add(ClassRecepcion datos, Boolean message) { CommandSqlGeneric(R.SQL.DATABASE.NAME, R.SQL.QUERY_SQL.RECEPCIONES.SQL_QUERY_INSERT_DOCS_RECEPCIONES, SetParametersAdd(datos), R.ERROR_MESSAGES.MODULO_RECEPCIONES.MESSAGE_INSERT_RECEPCIONES_OK, R.ERROR_MESSAGES.MODULO_RECEPCIONES.MESSAGE_INSERT_RECEPCIONES_FAIL, message); }