Exemple #1
0
        internal static DataTable ExecuteSpDefaultStorage(String sp, String parameter, Boolean developerMode)
        {
            String    connectionString = "ConnectToMaidana";
            DataTable dt = new DataTable();

            String queryForWareHouse = @"SELECT * FROM `ins_result` WHERE `id_instruction` = '16' AND `field2` = '" + parameter + "' ORDER BY `field2` DESC";

            dt = Conectivity.ConnectItAndExecuteMYSQL(queryForWareHouse, connectionString);
            return(dt);
        }
Exemple #2
0
        internal static DataTable ExecuteSp(String sp, String parameter, Boolean developerMode)
        {
            string    call             = "CALL ";
            String    spName           = call + sp + "('" + parameter + @"');";
            String    connectionString = "ConnectToMySQLAutoRequest";
            DataTable dt = new DataTable();

            dt = Conectivity.ConnectItAndExecuteSPAndBringResultsMySQL(spName, connectionString);
            return(dt);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }
Exemple #5
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", "ConnectToMySQL");

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

                    String insertStringToDetMateriales = "INSERT INTO wsmensajeresponse(idMateriales,detalleMensaje) VALUES ('" + lastInserted + "','" + p + "')";
                    Conectivity.ConnectItAndExecuteMYSQL(insertStringToDetMateriales, connectionStringFromAppConfig);
                }
                catch (Exception e)
                { System.Console.WriteLine(e.Message); }

                return(p);
            }
            else
            {
                return(null);
            }
        }
Exemple #6
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);
        }
Exemple #7
0
        private static DataTable getTheOPERATION_SEQ(string OP)
        {
            String    connectionString = "ConnectToInterfaceDESA";
            String    queryString      = @"SELECT [OPERATION_SEQ_NUM]
                  FROM [Traza_material].[dbo].[XXE_WMS_COGISCAN_WIP]
                  where OP_NUMBER ='" + OP + "'";
            DataTable queryTable       = new DataTable();

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

            return(queryTable);
        }
Exemple #8
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);
        }
Exemple #9
0
        public static String getTheQty(Entity.EntityMaterialRequest material)
        {
            int       valueqtyPerASSYFinal = 0;
            String    connectionString     = "ConnectToInterfaceDESA";
            String    queryString          = @"SELECT [QUANTITY_PER_ASSEMBLY]
                  FROM [Traza_material].[dbo].[XXE_WMS_COGISCAN_WIP]
                  where MATERIAL ='" + material.partNumber + "' and OP_NUMBER= '" + material.batchId + "'";
            DataTable queryTable           = new DataTable();
            string    valueqtyPerASSY      = "";
            string    valueqtyPerASSYOT    = "";
            string    qtyMath = "";

            String    queryStringOT = @"SELECT [START_QUANTITY] ,[QUANTITY_COMPLETED] FROM [Traza_material].[dbo].[XXE_WIP_OT]
                  where WIP_ENTITY_NAME ='" + material.batchId + "'";
            DataTable queryTableOT  = new DataTable();

            try
            {
                queryTable = Conectivity.ConnectItAndBringResults(queryString, connectionString);
                DataRow qtyPerASSYRow = queryTable.Rows[0];
                valueqtyPerASSY = qtyPerASSYRow[0].ToString();

                queryTableOT = Conectivity.ConnectItAndBringResults(queryStringOT, connectionString);
                DataRow qtyPerASSYRowOT = queryTableOT.Rows[0];
                valueqtyPerASSYOT = qtyPerASSYRowOT[0].ToString();
                string value1 = qtyPerASSYRowOT[0].ToString();
                string value2 = qtyPerASSYRowOT[1].ToString();

                int valueqtyPerASSYOTNum  = Int32.Parse(value1) - Int32.Parse(value2);
                int valueqtyPerASSYRowNum = Int32.Parse(qtyPerASSYRow[0].ToString());
                valueqtyPerASSYFinal = valueqtyPerASSYOTNum * valueqtyPerASSYRowNum;

                int valueqtyPerASSYDelta = Int32.Parse(valueqtyPerASSY) * Int32.Parse(material.remainingBoards);

                /*
                 * TIEMPO DE PEDIDO SETEADO A 200 Minutos
                 */

                int time4Request = 200;

                /*
                 */

                int InTime = Int32.Parse(material.minutos);

                valueqtyPerASSYFinal = (time4Request * valueqtyPerASSYDelta) / InTime;
                qtyMath = "(" + time4Request + "*" + valueqtyPerASSYDelta + ")/" + InTime + "--" + Int32.Parse(valueqtyPerASSY) + "*" + Int32.Parse(material.remainingBoards);
            }
            catch (Exception e) { queryTable = null; }

            /*
             * Evaluate Delta Monitoring
             */

            string queryDeltaMonitorToSearch = @"SELECT `rawMaterialId` FROM `amr_deltamonitor` 
                    WHERE `batchId` LIKE '" + material.batchId + "' AND `idMaquina` LIKE '" + material.idMaquina + "' AND `laneNumber` LIKE '" + material.laneNumber + "' AND `location` LIKE '" + material.location + "' AND `partNumber` LIKE '" + material.partNumber + "' AND `productPartNumber` LIKE '" + material.productPartNumber + "' AND `rawMaterialId` LIKE '" + material.rawMaterialId + "' AND `remainingBoards` LIKE '" + material.remainingBoards + "' AND `valueqtyPerASSYFinal` LIKE '" + valueqtyPerASSYFinal + "'";

            DataTable dtqueryDeltaMonitorToSearch = Conectivity.ConnectItAndExecuteSPAndBringResultsMySQL(queryDeltaMonitorToSearch, "ConnectToMySQLAutoRequest");

            if (dtqueryDeltaMonitorToSearch.Rows.Count == 15)
            {
                foreach (DataRow dtrDelta in dtqueryDeltaMonitorToSearch.Rows)
                {
                    String dtrDeltaValue = dtrDelta[0].ToString();


                    int qtyPerASSY      = Int32.Parse(valueqtyPerASSY);
                    int remainingBoards = Int32.Parse(material.remainingBoards);
                    int minutesLeft     = Int32.Parse(material.minutos);
                }

                string valueFinal = valueqtyPerASSYFinal.ToString();
                return(valueFinal);
            }
            else
            {
                string queryDeltaMonitor = @"
                INSERT INTO `amr_deltamonitor`(`batchId`, `idMaquina`, `laneNumber`, `location`, `minutos`, `partNumber`, `productPartNumber`, `rawMaterialId`, `remainingBoards`, `timeStampRegistro`, `valueqtyPerASSYFinal`, `qtyMath`) 
                VALUES 
                ('" + material.batchId + "','" + material.idMaquina + "','" + material.laneNumber + "','" + material.location + "','" + material.minutos + "','" + material.partNumber + "','" + material.productPartNumber + "','" + material.rawMaterialId + "','" + material.remainingBoards + "','" + material.timeStampRegistro + "','" + valueqtyPerASSYFinal + "','" + qtyMath + "')";

                Conectivity.ConnectItAndExecuteSPAndBringResultsMySQL(queryDeltaMonitor, "ConnectToMySQLAutoRequest");

                string valueFinal = valueqtyPerASSYFinal.ToString();
                return(valueFinal + " - WAIT");
            }
        }
Exemple #10
0
        internal static string ExecuteSP_InsertIntoMaterialRequest(string sp, Entity.EntityMaterialRequest emrunity, bool p_2, string statusUbic)
        {
            string    valueOPERATION_SEQ = "";
            DataTable dt = new DataTable();
            List <Entity.EntityInsertion> listaInsercion = new List <Entity.EntityInsertion>();

            /*
             * get te OPERATION_SEQ that belongs to each material per OP
             */
            try
            {
                DataTable OPERATION_SEQ    = getTheOPERATION_SEQ(emrunity.batchId);
                DataRow   OPERATION_SEQRow = OPERATION_SEQ.Rows[0];
                valueOPERATION_SEQ = OPERATION_SEQRow[0].ToString();
            }
            catch (Exception e)
            {
                System.Console.WriteLine("ERROR-7501 - ERROR EN OBTENER [OPERATION_SEQ_NUM]: " + e.Message);
            }

            string qtyToRequest = emrunity.qtyDefined;

            char[]   delimiters = new char[] { '\r', ',' };
            string[] parts      = qtyToRequest.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

            qtyToRequest = parts[0].ToString();

            if (String.IsNullOrEmpty(valueOPERATION_SEQ))
            {
                valueOPERATION_SEQ = "-1";
            }

            string wipLocation = valueOPERATION_SEQ;
            string lineStatus  = statusUbic;

            listaInsercion.Add(new Entity.EntityInsertion()
            {
                sp             = sp,
                batchId        = emrunity.batchId,
                wipLocation    = wipLocation,
                rawMaterialId  = emrunity.rawMaterialId,
                partNumber     = emrunity.partNumber,
                unityOfMeasure = "EA",
                qtyToRequest   = qtyToRequest,
                laneStatus     = "",
                laneDestiny    = "",
                locationOrigin = lineStatus,
                status         = lineStatus,
                laneNumber     = emrunity.laneNumber,
                idMachine      = emrunity.idMaquina,
                location       = emrunity.location
            });

            String connectionString = "ConnectToMySQLAutoRequest";
            string returnedId       = Conectivity.insertIntoMySqlDataBase(listaInsercion, connectionString);

            try
            {
                if ((p_2) && ((returnedId != "")))
                {
                    String insertIntoXXE_WMS_COGISCAN_PEDIDOS = @"
                    INSERT INTO [XXE_WMS_COGISCAN_PEDIDOS]
                    ([OP_NUMBER]
                    ,[ORGANIZATION_CODE]
                    ,[OPERATION_SEQ]
                    ,[ITEM_CODE]
                    ,[ITEM_UOM_CODE]
                    ,[QUANTITY]
                    ,[PROD_LINE]
                    ,[MAQUINA]
                    ,[UBICACION]
                    ,[STATUS]
                    ,[INSERT_ID])
                    VALUES
                    ( '" + emrunity.batchId + "', 'UP3', '" + valueOPERATION_SEQ + "', '" + emrunity.partNumber + "', 'EA', '" + qtyToRequest + "', '" + emrunity.laneNumber + "', '" + emrunity.idMaquina + "', '" + emrunity.location + "', 'NEW" + "'" + ", '" + returnedId + "')";

                    string connect = "ConnectToInterfaceDESA";
                    if (Conectivity.NotInTheInterface(returnedId))
                    {
                        Conectivity.InsertOnEBSInterface(insertIntoXXE_WMS_COGISCAN_PEDIDOS, connect);
                        Console.WriteLine("ID: " + returnedId + " insertado en la interfaz \n");
                    }
                }
            }
            catch (Exception errorInterfaceInser)
            { Console.WriteLine("ERROR-10303 - ERROR EN LA INSERCION DE QUERY EN INTEFACE: " + errorInterfaceInser.Message); }

            avoidSequence : string sequenceAvoided = "";
            return(returnedId);
        }