예제 #1
0
 public void BackToMainMenu()
 {
     ehllapi.SendStr("@7");
     EhllapiWrapper.Wait();
     ehllapi.SendStr("@3");
     EhllapiWrapper.Wait();
 }
예제 #2
0
        public void PrestamoAutorizacion(string MFTemplateAprobacion)
        {
            Methods.LogProceso("Menú principal de IBS..");

            ehllapi.SendStr("@7");
            Methods.GetMenuProgram("12");

            FileInfo existingFile = new FileInfo(MFTemplateAprobacion);

            using (ExcelPackage package = new ExcelPackage(existingFile))
            {
                int    rowLoad = 0;
                string NroFinanciamiento = "", SiZeCustomer, TypeProduct = "";

                ExcelWorksheet worksheetAutoriza_load = package.Workbook.Worksheets[2];

                int rowCount = worksheetAutoriza_load.Dimension.End.Row;

                Methods.LogProceso("INICIA PROCESO DE DESCARGA DE FINANCIAMIENTOS" + "\n " + "con lecctura de excel.... " + TemplateLoad);

                string patron = @"[^\d+]";
                Regex  regex  = new Regex(patron);

                for (rowLoad = 2; rowLoad <= rowCount; rowLoad++)
                {
                    try
                    {
                        NroFinanciamiento = worksheetAutoriza_load.Cells["A" + rowLoad].Value == null ? "" : worksheetAutoriza_load.Cells["A" + rowLoad].Value.ToString().Trim();
                        NroFinanciamiento = regex.Replace(NroFinanciamiento, "");

                        if (NroFinanciamiento.Equals(""))
                        {
                            break;
                        }

                        SiZeCustomer = worksheetAutoriza_load.Cells["B" + rowLoad].Value == null ? "" : worksheetAutoriza_load.Cells["B" + rowLoad].Value.ToString().Trim();
                        TypeProduct  = worksheetAutoriza_load.Cells["C" + rowLoad].Value == null ? "" : worksheetAutoriza_load.Cells["C" + rowLoad].Value.ToString().Trim();

                        Console.WriteLine("+++++++++ NroFinanciamiento+++:: " + NroFinanciamiento);
                        Console.WriteLine("+++++++++ ZiseCustomer+++:: " + SiZeCustomer);
                        Console.WriteLine("+++++++++ TypeProduct+++:: " + TypeProduct);

                        ehllapi.SetCursorPos("9,51");
                        ehllapi.SendStr("@F");
                        ehllapi.SendStr(NroFinanciamiento.Trim());
                        //ehllapi.SendStr("@A@+");
                        //ehllapi.SendStr("@E");
                        //EhllapiWrapper.Wait();

                        ehllapi.SetCursorPos("15,51");
                        ehllapi.SendStr("@F");
                        ehllapi.SendStr("01");

                        // SubProducto
                        var emp = "";

                        ExcelManagament excel = new ExcelManagament();
                        config = excel.GetDataConfig(MFTemplateAprobacion);
                        config.ListConfigCatalog.ForEach(delegate(ByProduct pr)
                        {
                            if (SiZeCustomer.Equals(pr.SizeCustomerType.ToString().Trim()))
                            {
                                if (TypeProduct.Equals(EnumTipoProducto._FEXP))
                                {
                                    emp = pr.Product_Type_Fexp.ToString().Trim();
                                }
                                else if (TypeProduct.Equals(EnumTipoProducto._FIMP))
                                {
                                    emp = pr.Product_Type_Fimp.ToString().Trim();
                                }
                            }
                        });

                        if (!emp.Equals(""))
                        {
                            worksheetAutoriza_load.Cells["D" + rowLoad].Value = emp;

                            ehllapi.SetCursorPos("17,51");
                            ehllapi.SendStr("@F");
                            ehllapi.SendStr(emp);

                            ehllapi.SendStr("@E"); //
                            EhllapiWrapper.Wait();

                            worksheetAutoriza_load.Cells["E" + rowLoad].Value = "CARGADO";
                        }
                        else
                        {
                            worksheetAutoriza_load.Cells["E" + rowLoad].Value = "NO CARGADO_ " + "Código de Sub Producto incorrecto";
                        }

                        ehllapi.SendStr("@1"); // F1
                        EhllapiWrapper.Wait();

#if DEBUG
                        ehllapi.SendStr("@E"); // Intro
                        EhllapiWrapper.Wait();
#endif
                        ///**************
                        //      ehllapi.SendStr("@7"); // F7
                        //      EhllapiWrapper.Wait();
                        ///**************

                        NroFinanciamiento = ""; SiZeCustomer = ""; emp = "";

                        package.Save();
                    }
                    catch (Exception ex)
                    {
                        Methods.LogProceso("ERROR: " + ex.Message);
                    }
                }
            } // END for1
            Methods.LogProceso("FINALIZÓ EL PROCESO, presionar INTRO para salir...");
        }     // End Using
예제 #3
0
        public void PrestamoExteriorLoad(string TemplateLoad, string Paswrord_2)
        {
#if DEBUG
            ehllapi.SendStr("@g");
            ehllapi.SetCursorPos("20,7");
            ehllapi.SendStr("GO MGCIA2");
            ehllapi.SendStr("@E");
#endif
            Methods.LogProceso("Menú principal de IBS..");
            Methods.GetMenuProgram("88");
            Methods.GetMenuProgram("4");
            Methods.GetMenuProgram("2");

            FileInfo existingFile = new FileInfo(TemplateLoad);

            using (ExcelPackage package = new ExcelPackage(existingFile))
            {
                int    rowLoad = 0;
                string NroFinanciamiento = "", NroContratoAdeudado = "", msgErrorAdeudado = "";

                ExcelWorksheet worksheet_load = package.Workbook.Worksheets[1];
                int            rowCount       = worksheet_load.Dimension.End.Row;

                Methods.LogProceso("INICIA PROCESO DE DESCARGA DE FINANCIAMIENTOS" + "\n " + "con lecctura de excel.... " + TemplateLoad);

                string patron = @"[^\d+]";
                Regex  regex  = new Regex(patron);

                for (rowLoad = 2; rowLoad <= rowCount; rowLoad++)
                {
                    try
                    {
                        NroFinanciamiento = worksheet_load.Cells["A" + rowLoad].Value == null ? "" : worksheet_load.Cells["A" + rowLoad].Value.ToString().Trim();
                        NroFinanciamiento = regex.Replace(NroFinanciamiento, "");

                        if (NroFinanciamiento.Equals(""))
                        {
                            break;
                        }

                        NroContratoAdeudado = worksheet_load.Cells["B" + rowLoad].Value == null ? "" : worksheet_load.Cells["B" + rowLoad].Value.ToString().Trim();
                        NroContratoAdeudado = regex.Replace(NroContratoAdeudado, "");

                        Console.WriteLine("+++++++++ NroFinanciamiento+++:: " + NroFinanciamiento);
                        Console.WriteLine("+++++++++ NroContratoAdeudado+++:: " + NroContratoAdeudado);

                        ehllapi.SetCursorPos("15,47");

#if DEBUG
                        //***** Para Desarrollo**************************************

                        var subProducto = "";
                        subProducto = ehllapi.ReadScreen("6,47", 4).Trim();

                        if (subProducto.Equals(""))
                        {
                            ehllapi.SetCursorPos("6,47");
                            ehllapi.SendStr("@a");
                            EhllapiWrapper.Wait();

                            ehllapi.SetCursorPos("12,25");
                            ehllapi.SendStr("FEXP");
                            for (int i = 0; i < 11; i++)
                            {
                                ehllapi.SendStr("@v");
                                EhllapiWrapper.Wait();
                            }

                            ehllapi.SetCursorPos("15,71");
                            ehllapi.SendStr("X");
                            ehllapi.SendStr("@E");
                            EhllapiWrapper.Wait();
                            //***********************************************************
                        }
#endif
                        ehllapi.SetCursorPos("15,47");
                        ehllapi.SendStr("@F");
                        ehllapi.SendStr(NroFinanciamiento.Trim());
                        ehllapi.SendStr("@A@+");
                        //ehllapi.SendStr("@E");
                        EhllapiWrapper.Wait();

                        ehllapi.SetCursorPos("17,47");
                        ehllapi.SendStr(Paswrord_2.Trim());
                        ehllapi.SendStr("@E");
                        EhllapiWrapper.Wait();

                        // Nro de Contrato Adeudado
                        ehllapi.SetCursorPos("20,68");
                        ehllapi.SendStr("@F");
                        ehllapi.SendStr(NroContratoAdeudado);

                        ehllapi.SendStr("@E"); // Intro
                        EhllapiWrapper.Wait();

                        msgErrorAdeudado = ehllapi.ReadScreen("5,7", 15).Trim();
                        if (msgErrorAdeudado.Trim().Equals("Dato no Valido"))
                        {
                            worksheet_load.Cells["C" + rowLoad].Value = "ERROR_" + msgErrorAdeudado.Trim();
                            ehllapi.SendStr("@E"); // Intro
                            EhllapiWrapper.Wait();
                        }
                        else
                        {
                            worksheet_load.Cells["C" + rowLoad].Value = "CARGADO";
                        }

                        ehllapi.SendStr("@1"); // F1
                        EhllapiWrapper.Wait();

                        //**************
                        //ehllapi.SendStr("@7"); // F7
                        //EhllapiWrapper.Wait();
                        //**************

#if DEBUG
                        // Esto se debe quitar es de prueba
                        ehllapi.SendStr("@1"); // F1
                        EhllapiWrapper.Wait();
#endif
                        ehllapi.SendStr("@6"); // F6
                        EhllapiWrapper.Wait();

                        ehllapi.SendStr("@3"); //F3
                        EhllapiWrapper.Wait();

                        NroFinanciamiento = ""; NroContratoAdeudado = ""; msgErrorAdeudado = "";
                        package.Save();
                    }
                    catch (Exception ex)
                    {
                        Methods.LogProceso("ERROR: " + ex.Message);
                    }
                }
            } // END for1

            Methods.LogProceso("FINALIZÓ 1ER PROCESO DE CARGA DE FINANCIAMIENTOS.");
            Methods.LogProceso("Presionar INTRO para continuar con 2do PROCESO...");
        } // End Using
예제 #4
0
파일: BLMain.cs 프로젝트: tkMageztik/RPA
        public List <T> SetDataFromScreenList <T>(Func <string, int, T> formatMethod, int startYCoordenates,
                                                  int pageSize, int rowsByItem, Func <string, int, string> readData /*MyDelegateType<T> formatMethod, */)
        {
            //string temp = ehllapi.ReadScreen(startYCoordenates + ",1", ROW_LENGTH * rowsByItem);
            string temp = readData(startYCoordenates.ToString(), ROW_LENGTH * rowsByItem);

            EhllapiWrapper.Wait();

            List <T> rows   = new List <T>();
            int      iItems = 0;

            if (temp.Trim() != "")
            {
                var obj = formatMethod(temp, startYCoordenates);

                if (obj != null)
                {
                    rows.Add(obj);
                    iItems = rowsByItem;
                }
            }

            int i = rowsByItem;

            while (temp.Trim() != "")
            {
                if (i >= pageSize)
                {
                    ehllapi.SendStr("@v");

                    //TODO: si hay error en IBS ahí queda( deberíamos ver como obtener el valor de la x)
                    //temp = ehllapi.ReadScreen(startYCoordenates + ",1", ROW_LENGTH * rowsByItem);
                    temp = readData(startYCoordenates.ToString(), ROW_LENGTH * rowsByItem);
                    EhllapiWrapper.Wait();

                    Methods.LogProceso("last " + temp);
                    Methods.LogProceso("last2 " + rows[rows.Count - iItems / rowsByItem].ToString());


                    if (temp == rows[rows.Count - iItems / rowsByItem].ToString())
                    {
                        break;
                    }
                    else
                    {
                        var obj = formatMethod(temp, startYCoordenates);

                        if (obj != null)
                        {
                            rows.Add(obj);
                        }
                    }

                    i      = rowsByItem;
                    iItems = rowsByItem;
                }
                else
                {
                    //TODO: depende de donde inicia la lista
                    //temp = ehllapi.ReadScreen(startYCoordenates + i + ",1", ROW_LENGTH * rowsByItem);
                    temp = readData((startYCoordenates + i).ToString(), ROW_LENGTH * rowsByItem);
                    EhllapiWrapper.Wait();

                    if (temp.Trim() != "")
                    {
                        var obj = formatMethod(temp, (startYCoordenates + i));

                        if (obj != null)
                        {
                            rows.Add(obj);
                            iItems += rowsByItem;
                        }
                    }
                    i += rowsByItem;
                }
            }

            return(rows);
        }