Example #1
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);
        }
Example #2
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);
        }
Example #3
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);
        }
Example #4
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);
        }
Example #5
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");
            }
        }