예제 #1
0
        /// <summary>
        /// Данный метод реализует основной функционал программы.
        /// производится чтение исходного файла,
        /// обращение к Equatoin
        /// запись результата в новый файл
        /// </summary>
        public void Work()
        {
            #region подготовка к работе
            placeHeaders();
            List <FL_data> mans = new List <FL_data>();
            Console.WriteLine("Reading data from Excel (Persons)");
            double    onePercent = 100.00 / sheet.Dimension.Rows;
            double    progress   = 0;
            Statistic statistic  = new Statistic(3);
            #endregion

            #region Поиск информации по каждому ПИНу в Equation
            for (int i = 2; i <= sheet.Dimension.Rows; i++)
            {
                Application.DoEvents();
                Console.WriteLine($"Done: {progress:F2}% ({i - 2}/{sheet.Dimension.Rows - 2})");
                mans.Add(equation.ReadData(sheet.Cells[i, 1].Text));
                progress = onePercent * i;
                LogWorker.ClearPrevConsoleLine();
                statistic.OperationDone(); //Сбор статистики об использовании робота.
            }
            #endregion

            Console.WriteLine("Done.");
            Console.WriteLine("Getting AccountsData");

            //Заполнение данных о счетах в получейся коллекции
            equation.fillAccounts(mans);

            Console.WriteLine("Done.");
            Console.WriteLine("Exporting data to .xlsx");

            #region Запись данных в Excel
            int rowIndex = 2;
            int column   = 1;
            for (int i = 0; i < mans.Count; i++)
            {
                for (int j = 0; j < mans[i].Accounts.Count; j++)
                {
                    column = 1;
                    Write(rowIndex, column++, mans[i].Pin);
                    Write(rowIndex, column++, mans[i].Type);
                    Write(rowIndex, column++, mans[i].Identification);
                    Write(rowIndex, column++, mans[i].ApproveType);
                    Write(rowIndex, column++, mans[i].FIO);
                    Write(rowIndex, column++, NormalizeData(mans[i].BirthDate));
                    Write(rowIndex, column++, mans[i].BirthPlace);
                    Write(rowIndex, column++, mans[i].mnemonicFull);
                    Write(rowIndex, column++, mans[i].mnemonicShort);
                    Write(rowIndex, column++, mans[i].regCountry);
                    Write(rowIndex, column++, mans[i].Inn);
                    Write(rowIndex, column++, mans[i].SNILS);
                    Write(rowIndex, column++, mans[i].IsClient);
                    Write(rowIndex, column++, NormalizeData(mans[i].BecomeContragentDate));
                    Write(rowIndex, column++, NormalizeData(mans[i].BecomeClientDate));
                    Write(rowIndex, column++, mans[i].DocTypeInt);
                    Write(rowIndex, column++, mans[i].DocTypeStr);
                    Write(rowIndex, column++, mans[i].DocSeries);
                    Write(rowIndex, column++, mans[i].DocNumber);
                    Write(rowIndex, column++, mans[i].DocGiver);
                    Write(rowIndex, column++, mans[i].DocKPPCode);
                    Write(rowIndex, column++, NormalizeData(mans[i].DocOpenDate));
                    Write(rowIndex, column++, NormalizeData(mans[i].DocClosedDate));
                    Write(rowIndex, column++, mans[i].DocResponsibleUnit);
                    Write(rowIndex, column++, mans[i].Citizenship);
                    Write(rowIndex, column++, mans[i].WorkPhone);
                    Write(rowIndex, column++, mans[i].MobilePhone);
                    Write(rowIndex, column++, mans[i].Email);
                    Write(rowIndex, column++, mans[i].Reserve1);
                    Write(rowIndex, column++, mans[i].Reserve2);
                    Write(rowIndex, column++, mans[i].AnyBeneficiary);
                    Write(rowIndex, column++, mans[i].PDL);
                    Write(rowIndex, column++, mans[i].BeneficiaryOwner);
                    Write(rowIndex, column++, mans[i].Reputation);
                    Write(rowIndex, column++, mans[i].FinancialPosition);
                    Write(rowIndex, column++, NormalizeData(mans[i].ActualizationDate));
                    Write(rowIndex, column++, mans[i].ActualizationEmployee);
                    Write(rowIndex, column++, mans[i].UpdateType);
                    Write(rowIndex, column++, NormalizeData(mans[i].LastUpdatedDate));
                    Write(rowIndex, column++, mans[i].UpdateEmployee);
                    Write(rowIndex, column++, mans[i].IsCrossedTheBorder);
                    Write(rowIndex, column++, NormalizeData(mans[i].CrossBorderDate));
                    Write(rowIndex, column++, mans[i].ResidenceDocTypeInt);
                    Write(rowIndex, column++, mans[i].ResidenceDocTypeStr);
                    Write(rowIndex, column++, mans[i].ResidenceSerieAndNumber);
                    Write(rowIndex, column++, NormalizeData(mans[i].ResidenceDateStart));
                    Write(rowIndex, column++, NormalizeData(mans[i].ResidenceDateEnd));
                    Write(rowIndex, column++, mans[i].MigrationCardTypeInt);
                    Write(rowIndex, column++, mans[i].MigrationCardNumber);
                    Write(rowIndex, column++, NormalizeData(mans[i].MigrationCardDateStart));
                    Write(rowIndex, column++, NormalizeData(mans[i].MigrationCardDateEnd));
                    Write(rowIndex, column++, mans[i].RiskLevelInt.ToString());
                    Write(rowIndex, column++, mans[i].RiskLevelStr);
                    Write(rowIndex, column++, mans[i].Accounts[j].Number);
                    Write(rowIndex, column++, mans[i].Accounts[j].Type);
                    Write(rowIndex, column++, mans[i].Accounts[j].OpenDate.ToString("dd.MM.yyyy"));
                    Write(rowIndex, column++, mans[i].Accounts[j].Mnemonic);
                    Write(rowIndex, column++, mans[i].Accounts[j].MnemonicFull);
                    Write(rowIndex, column++, mans[i].Accounts[j].EmployeeOpenedFIO);
                    Write(rowIndex, column++, mans[i].Accounts[j].AccountingMode);
                    Write(rowIndex, column++, NormalizeData(mans[i].Accounts[j].CloseDate));
                    Write(rowIndex, column++, mans[i].RegistrationAddress);
                    Write(rowIndex, column++, mans[i].PrimePhone);
                    Write(rowIndex, column++, mans[i].RegistrationAddressFull);
                    Write(rowIndex, column++, NormalizeData(mans[i].RegistrationUpdateDate));
                    Write(rowIndex, column++, mans[i].Registration_Index);
                    Write(rowIndex, column++, mans[i].Registration_Country);
                    Write(rowIndex, column++, mans[i].Registration_RegionCode);
                    Write(rowIndex, column++, mans[i].Registration_RegionType);
                    Write(rowIndex, column++, mans[i].Registration_RegionName);
                    Write(rowIndex, column++, mans[i].Registration_Town);
                    Write(rowIndex, column++, mans[i].Registration_LocalityType);
                    Write(rowIndex, column++, mans[i].Registration_LocalityName);
                    Write(rowIndex, column++, mans[i].Registration_StreetType);
                    Write(rowIndex, column++, mans[i].Registration_StreetName);
                    Write(rowIndex, column++, mans[i].Registration_HouseNumber);
                    Write(rowIndex, column++, mans[i].Registration_BuildingNumber);
                    Write(rowIndex, column++, mans[i].Registration_FlatNumber);
                    Write(rowIndex, column++, mans[i].RegistrationPhone);
                    Write(rowIndex, column++, mans[i].FactAddress);
                    Write(rowIndex, column++, mans[i].Fact_Index);
                    Write(rowIndex, column++, mans[i].Fact_Country);
                    Write(rowIndex, column++, mans[i].Fact_RegionCode);
                    Write(rowIndex, column++, mans[i].Fact_RegionType);
                    Write(rowIndex, column++, mans[i].Fact_RegionName);
                    Write(rowIndex, column++, mans[i].Fact_Town);
                    Write(rowIndex, column++, mans[i].Fact_LocalityType);
                    Write(rowIndex, column++, mans[i].Fact_LocalityName);
                    Write(rowIndex, column++, mans[i].Fact_StreetType);
                    Write(rowIndex, column++, mans[i].Fact_StreetName);
                    Write(rowIndex, column++, mans[i].Fact_HouseNumber);
                    Write(rowIndex, column++, mans[i].Fact_BuildingNumber);
                    Write(rowIndex, column++, mans[i].Fact_FlatNumber);
                    Write(rowIndex, column++, NormalizeData(mans[i].FactAddressUpdateDate));
                    Write(rowIndex, column++, mans[i].FactAddressPhone);
                    Write(rowIndex, column++, mans[i].RecordStatus);
                    Write(rowIndex, column++, mans[i].BirthPlace);
                    Write(rowIndex, column++, mans[i].BirthPlaceCountryCode);
                    Write(rowIndex, column++, mans[i].BirthPlaceCountry);
                    Write(rowIndex, column++, mans[i].BirthPlaceRegionCode);
                    Write(rowIndex, column++, mans[i].BirthPlaceRegionType);
                    Write(rowIndex, column++, mans[i].BirthPlaceRegion);
                    Write(rowIndex, column++, mans[i].BirthPlaceCityType);
                    Write(rowIndex, column++, mans[i].BirthPlaceCity);
                    Write(rowIndex, column++, mans[i].BirthPlaceLocalityType);
                    Write(rowIndex, column++, mans[i].BirthPlaceLocality);
                    Write(rowIndex, column++, mans[i].BirthPlaceFull);

                    rowIndex++;
                }
            }
            #endregion

            //Сохранение файла Excel
            Save();
            equation.CloseConnection();
            //отправка статистики на сервер
            statistic.Commit();
        }
예제 #2
0
        /// <summary>
        /// Получить информацию о всех счетах с бух.режимом 100
        /// </summary>
        /// <param name="data">Коллекция физ.лиц</param>
        public void fillAccounts(List <FL_data> data)
        {
            EUCL.ClearScreen();
            send(21, 17, "ppp");
            pEnter();
            pEnter();
            send(6, 2, "1");
            EUCL.Wait();
            send(5, 5, "40*  ");
            send(5, 77, "*   ");

            double onePercent      = 100.00 / data.Count;
            double currentProgress = 0.0;
            int    counter         = 0;

            foreach (FL_data item in data)
            {
                currentProgress += onePercent;
                Console.WriteLine($"Done: {currentProgress:F2}% ({counter++}/{data.Count})");
                send(7, 69, item.Pin);
                send(5, 71, "100");
                pEnter();
                List <Account> accList = new List <Account>();

                for (int i = 8; i < 20; i += 2)
                {
                    Account acc = new Account();
                    acc.Number   = EUCL.ReadScreen(i, 5, 24).Replace(".", string.Empty);
                    acc.OpenDate = parseCustom(EUCL.ReadScreen(i, 56, 6));
                    if (string.IsNullOrWhiteSpace(acc.Number))
                    {
                        break;
                    }
                    send(i, 2, "1");
                    EUCL.Wait();
                    acc.Type         = ClearWhiteSpacesStr(EUCL.ReadScreen(8, 34, 35));
                    acc.Mnemonic     = EUCL.ReadScreen(10, 34, 4);
                    acc.MnemonicFull = ClearWhiteSpacesStr(EUCL.ReadScreen(10, 40, 35));
                    EUCL.SendStr("@l"); //F21
                    EUCL.Wait();
                    acc.AccountingMode = ClearWhiteSpacesStr(EUCL.ReadScreen(8, 18, 35));
                    DateTime.TryParse(EUCL.ReadScreen(4, 70, 11), out acc.OpenDate);
                    DateTime.TryParse(EUCL.ReadScreen(5, 70, 11), out acc.CloseDate);
                    if (string.IsNullOrWhiteSpace(ClearWhiteSpacesStr(EUCL.ReadScreen(16, 18, 35))))
                    {
                        acc.EmployeeOpenedFIO = EUCL.ReadScreen(9, 18, 4);
                    }
                    else
                    {
                        send(16, 2, "1");
                        EUCL.Wait();
                        acc.EmployeeOpenedFIO = EUCL.ReadScreen(6, 26, 4);
                        EUCL.SendStr("@c"); //F12
                        EUCL.Wait();
                    }
                    EUCL.SendStr("@3"); //F3
                    EUCL.Wait();
                    EUCL.SendStr("@c"); //F12
                    EUCL.Wait();
                    accList.Add(acc);
                }
                LogWorker.ClearPrevConsoleLine();
                item.Accounts = accList;
            }
        }