예제 #1
0
        internal static String GetLastMySQLInsertedId(String tabla, String Campo)
        {
            String valueFromResponse = "";
            String queryLastInserted = "select max(" + Campo + ") from " + tabla;

            string           ConnectionString = ConfigurationSettings.AppSettings["ConnectToMySQL"];
            MySqlConnection  connection;
            MySqlDataAdapter adapter;
            DataTable        queryTable = new DataTable();

            try
            {
                connection = new MySqlConnection(ConnectionString);
                adapter    = new MySqlDataAdapter(queryLastInserted, connection);

                adapter.Fill(queryTable);
                DataRow dtr = queryTable.Rows[0];

                valueFromResponse = dtr["max(" + Campo + ")"].ToString();

                connection.Close();
            }
            catch (Exception e) { LogThis.LogThisValue(e); }

            return(valueFromResponse);
        }
예제 #2
0
        internal static void InicializarPorFecha(DateTime dtIni, DateTime dtFin)
        {
            String dtInic = dtIni.ToString("yyyyMMdd");
            String dtFinc = dtFin.ToString("yyyyMMdd");

            DataTable iterateValues = SQLDataManager.getTypeData("NULL", dtInic, dtFinc, "NULL");
            List <EntityInitRawMaterial> addAllLinesToList = new List <EntityInitRawMaterial>();

            iterateValuesRows = iterateValues.Rows.Count;

            try
            {
                foreach (DataRow r in iterateValues.Rows)
                {
                    EntityInitRawMaterial eirm = new EntityInitRawMaterial();
                    eirm.Orig_Ubic_Alm = r["ORIG_UBIC_ALM"].ToString();
                    eirm.NumMaterial   = r["NumMaterial"].ToString();
                    eirm.Orig_Cant     = r["ORIG_CANT"].ToString();
                    eirm.Material      = r["Material"].ToString();
                    eirm.Conf_Usuario  = r["CONF_USUARIO"].ToString();
                    eirm.Descripcion   = r["DESCRIPCION"].ToString();
                    eirm.Num_Pallet    = r["NUM_PALLET"].ToString();

                    addAllLinesToList.Add(eirm);
                }
            }
            catch (Exception e) { LogThis.LogThisValue(e); }

            foreach (EntityInitRawMaterial q in addAllLinesToList)
            {
                wsInitRawMaterial(q);
            }
        }
예제 #3
0
        private void tim_Tick_Camx(object sender, EventArgs e)
        {
            Thread tipf = new Thread(InitServiceCAMX);

            tipf.Start();

            LogThis.LogThisValue("##### Tim_Tick - CAMX Reboot ####", "CAMX");
        }
예제 #4
0
        private void tim_Tick_SolicitudMateriales(object sender, EventArgs e)
        {
            Thread tipf = new Thread(InitServiceMatRequest);

            tipf.Start();

            LogThis.LogThisValue("##### Tim_Tick - Material Request - Web Service ####");
        }
예제 #5
0
        private void tim_Tick(object sender, EventArgs e)
        {
            Thread tipf = new Thread(InitService);

            tipf.Start();

            LogThis.LogThisValue("##### Tim_Tick - Init Raw Material Web Service ####");
        }
예제 #6
0
        private void BTNInicializarPorFechaInicializar_Click(object sender, EventArgs e)
        {
            try
            {
                richTextBox3.Text      = "\n Por Fecha Inicializado: " + DateTime.Now;
                btnInitMayor.BackColor = Color.LimeGreen;
                manipulateLabel(lblEstadoServicio, Color.LightYellow, "Procesando INIT WS", btnInitMayor);
                manipulateGroupBoxes(true, GBIniciaServicio, GBInicializaPorFecha);

                Thread tipf = new Thread(InitPorFecha_Thread);
                tipf.Start();
            }
            catch (Exception exception) { LogThis.LogThisValue(exception); manipulateGroupBoxes(false, GBIniciaServicio, GBInicializaPorFecha); manipulateLabel(lblEstadoServicio, Color.LightSkyBlue, "Error en el proceso", btnInitMayor); }
        }
예제 #7
0
        internal static DataTable GetLPNFromInterface()
        {
            String    connectionString = "ConnectToInterfaceDESA";
            String    queryString      = "SELECT * FROM [Traza_material].[dbo].[XXE_WMS_COGISCAN_PEDIDO_LPNS] WHERE STATUS = 'NEW'";
            DataTable queryTable       = new DataTable();

            try
            {
                queryTable = Conectivity.ConnectItAndBringResults(queryString, connectionString);
            }
            catch (Exception e) { queryTable = null; LogThis.LogThisValue(e); }

            return(queryTable);
        }
예제 #8
0
        static public DataSet showData()
        {
            DataSet   db = new DataSet();
            String    connectionString = "ConectCYGNUSDBAP3";
            String    queryString      = "_AC_SP_EXCEL_PRODUCCION_Push";
            DataTable queryTable       = new DataTable();

            try
            {
                queryTable = Conectivity.ConnectItAndExecuteSPAndBringResults(queryString, connectionString);
            }
            catch (Exception e) { db = null; LogThis.LogThisValue(e); }

            return(db);
        }
예제 #9
0
        /*****************************************************************************************************/
        /******************************* SYGNUS DATABASE ******************************************************/
        static public DataTable getTypeData(String idMaterial, String fechaIni, String fechaFin, String ubicacion)
        {
            String queryString = "EXEC [dbo].[_AC_SP_EXCEL_PRODUCCION_Push] @IdUbicacion = " +
                                 ubicacion + ", @FechaDesde = " +
                                 fechaIni + ", @FechaHasta = " +
                                 fechaFin + ", @IdMaterial = " +
                                 idMaterial + "";
            String    connectionString = "ConectCYGNUSDBAP3";
            DataTable queryTable       = new DataTable();

            try
            { queryTable = Conectivity.ConnectItAndBringResults(queryString, connectionString); }
            catch (Exception e) { queryTable = null; LogThis.LogThisValue(e); }

            return(queryTable);
        }
예제 #10
0
        /*****************************************************************************************************/
        /******************************* PIZARRA DATABASE ****************************************************/
        internal static String IAServerInsertionLog(Entity.EntityInitRawMaterial q, string p)
        {
            if (p != null)
            {
                String partNumber   = SQLDataManager.selectValuesFromMateriales(q.NumMaterial);
                String lastInserted = "";

                String connectionStringFromAppConfig = "ConnectToMySQL";
                String insertStringToMateriales      =
                    "INSERT INTO materiales(NumMaterial,Material,Orig_Ubic_Alm,Orig_Cant,Conf_Fecha,Conf_Hora,Conf_Usuario,Descripcion,Cantidad,Num_Pallet,Num_Ord_Transp,TimeStamp) values ('" + q.NumMaterial + "','"
                    + partNumber + "','"
                    + q.Orig_Ubic_Alm + "','"
                    + q.Orig_Cant + "','"
                    + q.Conf_Fecha + "','"
                    + q.Conf_Hora + "','"
                    + q.Conf_Usuario + "','"
                    + q.Descripcion + "','"
                    + q.Cantidad + "','"
                    + q.Num_Pallet + "','"
                    + q.Num_Ord_Transp +
                    "',NOW())";

                DataTable queryTable = new DataTable();

                try
                {
                    Conectivity.ConnectItAndExecuteMYSQL(insertStringToMateriales, connectionStringFromAppConfig);

                    lastInserted = GetLastMySQLInsertedId("materiales", "idMateriales");

                    if (lastInserted == null || lastInserted == "")
                    {
                        lastInserted = "1";
                    }

                    String insertStringToDetMateriales = "INSERT INTO wsmensajeresponse(idMateriales,detalleMensaje) VALUES ('" + lastInserted + "','" + p + "')";
                    Conectivity.ConnectItAndExecuteMYSQL(insertStringToDetMateriales, connectionStringFromAppConfig);
                }
                catch (Exception e) { LogThis.LogThisValue(e); }
                return(p);
            }
            else
            {
                return(null);
            }
        }
예제 #11
0
        private void BTNIniciarServicioPedirMateriales(object sender, EventArgs e)
        {
            MaterialRequestAutomation.StartSendingLowLevelToPizzarra();
            try
            {
                TimerToChangeMatReqState.Enabled = false;
                checkBox4.Enabled                  = false;
                checkedListBox4.Enabled            = false;
                richTextBox3.Text                  = "\n Servicio Inicializado: " + DateTime.Now;
                btnPedidoMaterialesMayor.BackColor = Color.LimeGreen;

                //this.timerThreadController.Enabled = true;
                BTNIniciarServicioSolicMateriales.Enabled = false;
                manipulateLabel(labelEstadoServicioPedidoMateriales, Color.LightYellow, "Procesando Pedido de Materiales", btnPedidoMaterialesMayor);
            }
            catch (Exception exception) { LogThis.LogThisValue(exception); manipulateLabel(labelEstadoServicioPedidoMateriales, Color.LightSkyBlue, "Error en el proceso", btnPedidoMaterialesMayor); }
        }
예제 #12
0
        private void BTNIniciarServicio_Click(object sender, EventArgs e)
        {
            try
            {
                timerToChangeState.Enabled = false;
                checkBox1.Enabled          = false;
                checkedListBox1.Enabled    = false;
                richTextBox3.Text          = "\n Servicio Inicializado: " + DateTime.Now;
                btnInitMayor.BackColor     = Color.LimeGreen;
                manipulateLabel(lblEstadoServicio, Color.LightYellow, "Procesando INIT WS", btnInitMayor);
                manipulateGroupBoxes(true, GBInicializaPorFecha, GBInicializaPorFecha);
                BTNIniciarServicio.Enabled = false;

                this.timerThreadController.Enabled = true;
            }
            catch (Exception exception) { LogThis.LogThisValue(exception); manipulateGroupBoxes(false, GBIniciaServicio, GBInicializaPorFecha); manipulateLabel(lblEstadoServicio, Color.LightSkyBlue, "Error en el proceso", btnInitMayor); }
        }
예제 #13
0
        internal static string selectValuesFromMateriales(string p)
        {
            String    connectionString = "ConectCYGNUSDBAP3";
            String    queryString      = "Select * from Materiales where NumMaterial='" + p + "'";
            DataTable queryTable       = new DataTable();
            String    value            = "";

            try
            {
                queryTable = Conectivity.ConnectItAndBringResults(queryString, connectionString);

                DataRow dtr = queryTable.Rows[0];
                value = dtr["DatosPrivados2"].ToString();
            }
            catch (Exception e) { queryTable = null; LogThis.LogThisValue(e); }

            return(value);
        }
예제 #14
0
        internal static String InitRawMaterial(Entity.EntityInitRawMaterial q)
        {
            String resultReturn = "";

            try
            {
                DataTable queryTable  = new DataTable();
                String    queryString = "select * from materiales where num_pallet='" + q.Num_Pallet + "'";
                String    connectionStringFromAppConfig = "ConnectToMySQL";
                queryTable = Conectivity.ConnectItAndExecuteMYSQL(queryString, connectionStringFromAppConfig);

                if (queryTable.Rows.Count == 0)
                {
                    RPCServicesClient RPC        = new RPCServices_CogiscanManager.RPCServicesClient();
                    String            partNumber = SQLDataManager.selectValuesFromMateriales(q.NumMaterial);

                    executeCommandRequest paramInitRawMat = new executeCommandRequest("initializeRawMaterial", @"
                    <Parameters>
                       <Parameter name=""itemId"">" + q.Num_Pallet + @"</Parameter>
                       <Parameter name=""partNumber"">" + partNumber + @"</Parameter>
                       <Parameter name=""msLevel"">1</Parameter>k
                       <Parameter name=""containerType"">REEL</Parameter>
                       <Parameter name=""supplierId"">Default</Parameter>
                       <Parameter name=""quantity"">" + q.Orig_Cant + @"</Parameter>
                       <Parameter name=""tagId""></Parameter>
                       <Parameter name=""tagModel""></Parameter>
                    </Parameters>");

                    executeCommandResponse res = RPC.executeCommand(paramInitRawMat);
                    LogThis.LogThisValue("Material Inicializado: " + q.Num_Pallet);
                    takeTheThreadFlag(Form1.logRTBInitRaw, true, q.Num_Pallet);

                    resultReturn = CleanInput(res.result);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            { LogThis.LogThisValue(e); return(e.Message); }

            return(resultReturn);
        }
예제 #15
0
        private void BTNIniciarServicioCAMX_Click(object sender, EventArgs e)
        {
            try
            {
                this.Timer4CAMX.Enabled = true;

                //checkBox2.Enabled = false;
                //checkedListBox2.Enabled = false;
                //richTextBox3.Text = "\n Servicio CAMX Inicializado: " + DateTime.Now;
                //btnCAMXMayor.BackColor = Color.LimeGreen;
                //manipulateLabel(labelEstadoServicioCAMX, Color.LightYellow, "Procesando CAMX Reboot", btnCAMXMayor);
                //manipulateGroupBoxes(true, GBCAMXEvents, GBCAMXEvents);
                //BTNIniciarServicioCAMX.Enabled = false;
                //timerToChangeCamxBtn.Enabled = false;

                //this.Timer4CAMX.Enabled = true;
            }
            catch (Exception exception) { LogThis.LogThisValue(exception); manipulateGroupBoxes(false, GBCAMXService, GBCAMXEvents); manipulateLabel(labelEstadoServicioCAMX, Color.LightSkyBlue, "Error en el proceso", btnCAMXMayor); }
        }
예제 #16
0
        internal static DataTable ExecuteSP_HeartBeat()
        {
            String connectionString  = "ConnectToMySQLAutoRequest";
            String hostName          = Dns.GetHostName();
            String queryLastInserted = "INSERT INTO `amr_heartbeat`(`beat`, `host`) VALUES ('1','" + hostName + "')";

            string           ConnectionString = ConfigurationSettings.AppSettings[connectionString];
            MySqlConnection  connection;
            MySqlDataAdapter adapter;
            DataTable        queryTable = new DataTable();

            try
            {
                connection = new MySqlConnection(ConnectionString);
                adapter    = new MySqlDataAdapter(queryLastInserted, connection);
                adapter.Fill(queryTable);

                connection.Close();
            }
            catch (Exception e) { LogThis.LogThisValue(e); }

            return(null);
        }