Пример #1
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);
        }
Пример #2
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");
            }
        }