Exemplo n.º 1
0
    def execute_main(self):
            v_start_time = time.time()
            self.lo.log_to_file("INFO", "Login in to DC4 Pre-Prod")
            lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
            so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
            input_sheet = self.v_input_wb.get_sheet_by_name('Input')

            #HardCoded Location
            current_row = 2
            Company_Name = input_sheet.cell(row=current_row, column=1).value
            Retailer_Name=input_sheet.cell(row=current_row,column=2).value
            Capability_UID=input_sheet.cell(row=current_row,column=5).value

            #Login to DC4 Pre-Production
            lg.login("DC4 PreProd")

            #Entering & Searching DC4 Company
            dc4_common_dc4_utility_object = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
            dc4_common_dc4_utility_object.company_search_by_name(Company_Name)

            #Clicking on Searched Company Name, Relationships Tab
            dc4_local_dc4_utility_local_object=DC4_Utility_Local(self.v_task_type, self.v_driver, self.lo, self.v_input_wb)
            dc4_local_dc4_utility_local_object.click_on_searched_company_name()
            dc4_local_dc4_utility_local_object.add_new_capability()
            dc4_local_dc4_utility_local_object.return_capability_uid()
            dc4_local_dc4_utility_local_object.click_on_preprod_relationships_tab()
            dc4_local_dc4_utility_local_object.search_trading_partner_name_in_relationships(Retailer_Name)
            dc4_local_dc4_utility_local_object.click_on_profile_name_via_relationships()
            dc4_local_dc4_utility_local_object.click_on_show_link_of_searched_profile()
            dc4_local_dc4_utility_local_object.add_existing_capability()

            time.sleep(10)
Exemplo n.º 2
0
 def execute_main(self):
     self.lo.log_to_file("INFO",
                         "Executing Process_Test_Files.execute_main()")
     lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
     so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
     self.v_data_sheet = self.v_input_wb.get_sheet_by_name(
         'PROCESS_TEST_FILES_INPUT')
     total_rows = self.v_data_sheet.max_row
     lg.login("Launchpad")
     self.v_driver.maximize_window()
     self.v_driver.execute_script("window.open('about:blank', 'tab2');")
     self.v_driver.switch_to.window("tab2")
     lg.login("DC4 PreProd")
     self.v_driver.execute_script("window.open('about:blank', 'tab3');")
     self.v_driver.switch_to.window("tab3")
     lg.login("FTP Pre-prod")
     for row_count in range(2, total_rows + 1):
         v_supplier = self.v_data_sheet.cell(row=row_count, column=1).value
         v_retailer = self.v_data_sheet.cell(row=row_count, column=2).value
         v_doc_type = self.v_data_sheet.cell(row=row_count, column=3).value
         v_date = self.v_data_sheet.cell(row=row_count, column=4).value
         if v_doc_type == CommonLocators.PO_File:
             ptf_850 = Process_Test_file_850(self.v_task_type, self.lo,
                                             self.v_username,
                                             self.v_input_wb, self.v_driver)
             ptf_850.execute_main(v_supplier, v_retailer, v_doc_type,
                                  row_count, v_date)
         else:
             self.lo.log_to_file(
                 "ERROR",
                 "Document is not found in Process_Test_Files.execute_main()"
             )
    def execute_main(self):


        login_object = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.log_file_object)
        error_hospital_machine_learning_object = Error_Hospital_Machine_Learning(self.v_task_type, self.v_username)
        report_file_object = ReportFileUtility(self.v_task_type)
        output_sheet = self.v_input_wb.get_sheet_by_name('Output')
        input_sheet = self.v_input_wb.get_sheet_by_name('Input')
        excel_operation_object = ExcelOperations(self.v_task_type, input_sheet)
        #Login into DC4 Prod
        login_object.login("DC4 Prod")
        self.log_file_object.log_to_file("INFO", "Login in to DC4 Prod")
        self.v_driver.execute_script("window.open('https://commerce.spscommerce.com/transaction-tracker/prod/transactions/', 'new_window')")
        self.v_driver.switch_to.window(self.v_driver.window_handles[-1])
        time.sleep(2)
        #Login into Launchpad
        login_object.login("Launchpad")
        self.log_file_object.log_to_file("INFO", "Login in to Launchpad")
        self.v_driver.switch_to.window(self.v_driver.window_handles[0])
        time.sleep(2)
        #Extract data from input sheet
        for index in range(2,input_sheet.max_row+1):
            today = datetime.datetime.now()
            DD = datetime.timedelta(days=6)
            earlier = today - DD
            earlier_str = earlier.strftime("%Y-%m-%d")
            earlier_str = earlier_str+' 00:00:00'

            v_error_title = excel_operation_object.get_value(index, 1)
            #Searching data as per error title
            if v_error_title == LocalElementLocator.ADHOC_ERROR_TITLE:
                self.log_file_object.log_to_file("INFO", "Seaching tickets for error title:- AdhocReporting: document rejected")
                v_start_time = time.time()
                v_ticket_uid = excel_operation_object.get_value(index, 2)
                if v_ticket_uid is None:
                    v_ticket_uid = ' '
                Error_Document_rejected_obj = Error_Document_rejected(self.v_task_type, self.v_driver, self.log_file_object,
                                                                      self.v_input_wb, error_hospital_machine_learning_object)
                v_count = Error_Document_rejected_obj.execute_main(v_error_title, v_ticket_uid, output_sheet, earlier_str)
                v_end_time = time.time()
                report_file_object.update_sheet(self.v_username, v_count, math.floor(v_end_time - v_start_time), str(datetime.date.today()))
            if v_error_title == LocalElementLocator.WEB_DOC_REJECTED_ERROR_TITLE:
                self.log_file_object.log_to_file("INFO",
                                                 "Seaching tickets for error title:- WebForms-ToService: document rejected")
                v_start_time = time.time()
                v_ticket_uid = excel_operation_object.get_value(index, 2)
                if v_ticket_uid is None:
                    v_ticket_uid = ' '
                Error_Document_rejected_obj = Error_Document_rejected(self.v_task_type, self.v_driver, self.log_file_object, self.v_input_wb, error_hospital_machine_learning_object)
                v_count = Error_Document_rejected_obj.execute_main(v_error_title, v_ticket_uid, output_sheet, earlier_str)
                v_end_time = time.time()
                report_file_object.update_sheet(self.v_username, v_count, math.floor(v_end_time - v_start_time),
                                str(datetime.date.today()))
            else:
                self.log_file_object.log_to_file("ERROR",
                                                 "Invalid error title ErrorHospital.execute_main()")
        time.sleep(3)
        self.v_driver.close()
 def execute_main(self):
     # self.v_driver = webdriver.Chrome(AppConstants.BROWSER_DRIVER)
     # self.v_driver.maximize_window()
     self.lo.log_to_file("INFO", "Login in to Launchpad")
     lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
     so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
     time.sleep(5)
     print("Browser opened,login,open TT")
     self.process(self.v_input_wb)
     print("Task filter completed")
Exemplo n.º 5
0
 def execute_main(self):
     self.lo.log_to_file(
         "INFO", "Executing ProductionDataMonitoring.execute_main()")
     self.v_driver = webdriver.Chrome(AppConstants.BROWSER_DRIVER)
     self.v_driver.maximize_window()
     lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
     lg.login("Launchpad")
     self.lo.log_to_file("INFO", "Login in to Launchpad")
     time.sleep(5)
     self.v_driver.get(LocalElementLocator.TRANSACTION_TRACKER_PROD_LINK)
     self.TaskFilter(self.v_input_wb, 'InProgress')
     self.lo.log_to_file(
         "INFO", "completed ProductionDataMonitoring.execute_main()")
     self.v_driver.close()
Exemplo n.º 6
0
    def __init__(self, task_type, lo, username,v_Browser):

        self.v_input_wb = openpyxl.load_workbook(ElementLocators.INPUT_FILE_PATH)
        self.v_task_type = task_type
        self.v_input_sheet = self.v_input_wb.get_sheet_by_name("Input")
        self.v_input_sheet_maps = self.v_input_wb.get_sheet_by_name("Maps")
        self.v_input_sheet_Adaptor_Data_Type_ID = self.v_input_wb.get_sheet_by_name("Adaptor Data Type ID")
        self.log = lo
        self.v_username = username
        self.v_Browser=v_Browser
        self.so = SeleniumOperations(self.v_task_type, self.v_Browser, self.log)
        self.login_operations_object = Login(self.v_task_type, self.v_Browser, self.v_input_wb, self.log)
        self.so = SeleniumOperations(self.v_task_type, self.v_Browser, self.log)
        self.login_operations_object.login("Launchpad")
        self.login_operations_object.login("DC4 Prod")
    def execute_main(self):
        # self.lo.log_to_file("INFO", "Login in to DC4 Pre_Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        self.v_data_sheet = self.v_input_wb.get_sheet_by_name('PROCESS_TEST_FILES_INPUT')

        total_rows = self.v_data_sheet.max_row
        self.v_driver.maximize_window()
        lg.login("Launchpad")
        time.sleep(3)
        self.v_driver.get("https://commerce.spscommerce.com/transaction-tracker/prod/transactions/")
        time.sleep(5)
        tto=TransactionTrackerOperations(self.v_task_type, self.v_driver, self.lo)

        # tto.search_process_for_process_test_file("Spring Silver Foods Inc","C&S Wholesale","850","10/02/2018")
        tto.search_by_parcel_id_and_download("10944250370")
 def execute_main(self):
     self.log.log_to_file(
         "INFO", "Executing CMProductionDataMonitoring.execute_main()")
     self.v_driver = webdriver.Chrome(AppConstants.BROWSER_DRIVER)
     self.v_driver.maximize_window()
     TransactionTrackerOperations_page_object = TransactionTrackerOperations(
         self.v_task_type, self.v_driver, self.log, self.v_input_sheet,
         self.v_input_wb, self.v_username, self.v_driver)
     self.log.log_to_file("INFO", "Login in to Launchpad")
     login_operations_object = Login(self.v_task_type, self.v_driver,
                                     self.v_input_wb, self.log)
     login_operations_object.login("Launchpad")
     time.sleep(5)
     self.v_driver.get(LocalElementLocator.TRANSACTION_TRACKER_PROD_LINK)
     TransactionTrackerOperations_page_object.TaskFilter_for_CM_PDM(
         self.v_input_wb, 'InProgress')
     self.log.log_to_file(
         "INFO", "completed CMProductionDataMonitoring.execute_main()")
     self.v_driver.close()
Exemplo n.º 9
0
    def execute_main(self):
        v_start_time = time.time()
        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        rf = ReportFileUtility(self.v_task_type)

        lg.login("DC4 Prod")

        #so.click_element(AppConstants.DC4_TAB, "BY_NAME")
        dc = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
        dc.company_search_by_name('Midlab Inc')
        #dc.company_search_by_ISA_ID('6166651648')
        #dc.company_search_by_TPID('620TSTWONDERTRE')

        self.v_driver.close()
        v_end_time = time.time()
        rf.update_sheet(self.v_username, 2,
                        math.floor(v_end_time - v_start_time),
                        str(datetime.date.today()))
    def execute_main(self):

        print('in main method of PDM')

        self.v_driver = webdriver.Chrome(AppConstants.BROWSER_DRIVER)
        self.v_driver.maximize_window()

        self.lo.log_to_file("INFO", "Login in to Launchpad")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        print("asdasdsad")
        lg.login("Launchpad")
        time.sleep(5)
        self.v_driver.get(LocalElementLocator.TRANSACTION_TRACKER_PROD_LINK)
        time.sleep(5)
        if so.check_clickable_by_xpath(
                "html/body/app-reporting/div/div/nav-bar/div/nav"):
            print("Element clickable")
        else:
            print("Not clickable")
    def retailer_ver_check(self, doc_type, retailer_capability_name):

        self.lo.log_to_file("INFO", "Login in to DC4 Pre_Prod")
        login = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                      self.lo)
        selenium_operations = SeleniumOperations(self.v_task_type,
                                                 self.v_driver, self.lo)

        selenium_operations.click_element_by_xpath(
            CommonLocators.DC4_ADMIN_TAB)

        selenium_operations.send_text_by_xpath(
            CommonLocators.DATATYPE_NAME_TEXTFIELD, retailer_capability_name)

        selenium_operations.click_element_by_xpath(
            CommonLocators.DATATYPE_SEARCH_BUTTON)

        retailer_FEDS_capability_name = selenium_operations.get_text_by_xpath(
            CommonLocators.FEDS_CAPABILITY)

        selenium_operations.send_text_by_xpath(
            CommonLocators.DATATYPE_NAME_TEXTFIELD,
            retailer_FEDS_capability_name)

        table_rows = self.v_driver.find_elements_by_xpath(
            '//*[@id="form1:table1"]/table[2]/tbody/tr[1]/th[1]')

        total_rows = len(table_rows) - 1

        print(total_rows)

        for counter in range(0, total_rows):

            retailer_version_value = selenium_operations.get_text_by_xpath(
                '//*[@id="form1:table1"]/table[2]/tbody/tr[' + str(counter) +
                ']/td[7]')
            if retailer_version_value == " ":
                pass
            else:
                return retailer_version_value
Exemplo n.º 12
0
    def execute_main(self):
        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        login_object = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                             self.lo)
        selenium_operation_object = SeleniumOperations(self.v_task_type,
                                                       self.v_driver, self.lo)
        # report_file_object = ReportFileUtility(self.v_task_type)

        total_rows = self.v_data_sheet.max_row
        print(total_rows)
        login_object.login("DC4 Prod")
        self.v_driver.maximize_window()

        for row_count in range(2, total_rows + 1):
            v_start_time = time.time()
            excel_operations = ExcelOperations(self.v_task_type,
                                               self.v_data_sheet)
            v_supplier = self.v_data_sheet.cell(row=row_count, column=1).value
            v_retailer = self.v_data_sheet.cell(row=row_count, column=2).value
            v_erp = self.v_data_sheet.cell(row=row_count, column=15).value
            print(v_retailer)
            print(v_erp)
            service_name = ["FItoService", "FIfromService"]

            v_doc_type = self.v_data_sheet.cell(row=row_count, column=3).value
            print(v_doc_type)
            v_date = self.v_data_sheet.cell(row=row_count, column=4).value

            if v_doc_type == 850:
                print(v_doc_type)
                Setup_U_Ob = QB_Setup_Util(self.v_task_type, self.lo,
                                           self.v_username, self.v_input_wb,
                                           self.v_driver)
                retailer_flag = Setup_U_Ob.retailer_v_check(
                    v_supplier, v_retailer, v_doc_type, row_count)
                supplier_flag = Setup_U_Ob.Supplier_Setup_Check(
                    v_supplier, v_retailer, v_doc_type, v_erp, row_count)
    def retailer_setup_check(self, v_supplier, v_retailer, v_document_type,
                             current_row):
        v_document_type_1 = str(v_document_type)
        v_document_type_2 = '875'
        self.lo.log_to_file("INFO", "Login in to DC4 Pre_Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)

        eo = ExcelOperations(self.v_task_type, self.v_data_sheet)

        self.lo.log_to_file("INFO", "Login in to DC4 Pre_Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)

        so.click_element_by_xpath(AppConstants.DC4_TAB)

        dc = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
        self.v_driver.find_element_by_xpath(
            AppConstants.DC4_COMPANY_NAME_TEXT_FIELD).send_keys(v_retailer)
        self.v_driver.find_element_by_xpath(
            AppConstants.DC4_COMPANY_NAME_SEARCH_CLICK).click()
        select_retailer = self.v_driver.find_element_by_xpath(
            CommonLocators.Company_Select_Link).click()

        # Check the retationship
        click_relationship = so.click_element_by_xpath(
            CommonLocators.Relationship_Tab)
        search_retailer_relationship = so.send_text_by_xpath(
            CommonLocators.Trading_Partner_Name_text_Field, v_supplier)
        so.click_element_by_xpath(CommonLocators.click_search)

        # Select the Retailer company profile and check for the FI setup
        select_retailer_profile = so.click_element_by_xpath(
            CommonLocators.Supplier_Profile_Link)

        # Profile Page Display
        show_option_click = so.click_element_by_xpath(
            CommonLocators.show_click)

        counter = 2
        path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
            counter) + ']/td[10]'
        while (so.check_exists_by_xpath(path)):

            service = so.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[10]')
            doc_tpe = so.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[3]')
            print(doc_tpe)

            if doc_tpe == v_document_type_1:
                if service != 'DoNotRoute':
                    print("850 capability is available")

                    retailer_version = so.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                        + str(counter) + ']/td[8]')
                    eo.set_value(current_row, 10, retailer_version)
                    self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
                    break

                elif service == 'DoNotRoute':
                    print("850 capability is not available")

            elif doc_tpe == v_document_type_2:
                if service != 'DoNotRoute':
                    print("875 capability is present")

                    retailer_version = so.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                        + str(counter) + ']/td[8]')
                    eo.set_value(current_row, 10, retailer_version)
                    self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
                    break

                elif service == 'DoNotRoute':
                    print("875 capability is present")

            counter = counter + 1
            path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
                counter) + ']/td[10]'

        time.sleep(10)
    def execute_main(self):

        t1 = threading.Thread(target=self.thread1)

        t2 = threading.Thread(target=self.thread2)
        t1.start()
        t2.start()

        t1.join()
        t2.join()

        db_object = DatabaseUtility(self.v_task_type, self.lo)
        if db_object.connection():
            self.lo.log_to_file('INFO', 'Successful Connection')
        else:
            self.lo.log_to_file('ERROR', 'DB Server is not active')
            return
        v_start_time = time.time()
        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        login_obj = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                          self.lo)
        selenium_operation_obj = SeleniumOperations(self.v_task_type,
                                                    self.v_driver, self.lo)
        report_file_obj = ReportFileUtility(self.v_task_type)
        input_sheet = self.v_input_wb.get_sheet_by_name('Input')
        input_sheet_row_count = input_sheet.max_row
        excel_operation_obj = ExcelOperations(self.v_task_type, input_sheet)
        Web_Fulfillment_Utility_obj = Web_Fulfillment_Utility(
            self.v_task_type, self.v_driver, self.v_input_wb, self.lo,
            self.v_username, db_object, self.v_driver_mv)
        # login_obj.login("Salesforce")
        self.v_driver.execute_script(
            "window.open('http://dc4ui.p01.pro:7777/dc4custmanager/faces/home.jsp', 'new_window')"
        )

        # self.v_driver.execute_script(
        #     "window.open('https://atlassian.spscommerce.com/browse/FICS-163692', 'new_window')")
        self.v_driver.switch_to.window(self.v_driver.window_handles[-1])
        report_file_object = ReportFileUtility(self.v_task_type)
        time.sleep(2)
        login_obj.login("DC4 Prod")

        input_row = input_sheet_row_count + 1
        FICS_Number = excel_operation_obj.get_value(input_row, 1)
        flag = 1
        count = 0
        v_start_time = time.time()
        while (flag):
            v_start_time1 = time.time()
            v_salesforce_id = easygui.enterbox('Please enter salesforce ID')
            self.v_driver.switch_to.window(self.v_driver.window_handles[0])
            time.sleep(2)
            #self.v_driver.get('https://atlassian.spscommerce.com/browse/'+FICS_Number)
            #v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name, v_salesforce_id = Web_Fulfillment_Utility_obj.get_info_from_JIRA()
            v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name, client_uid, retailer_uid = Web_Fulfillment_Utility_obj.get_info_from_salesforce(
                v_salesforce_id)
            print(v_salesforce_id + "\n" + v_supplier_name + "\n" +
                  v_email_address + "\n" + v_phone_number + "\n" +
                  v_retailer_name + "\n" + v_vendor_number + "\n" +
                  v_retailer_web_company_uid + "\n" + v_account_number + "\n" +
                  v_retailer_dc4_company_uid + "\n" + v_contact_name)
            print(v_billing_address)

            self.v_driver.switch_to.window(self.v_driver.window_handles[-1])
            time.sleep(2)
            #Web_Fulfillment_Utility_obj.get_data_for_library(v_salesforce_id, v_supplier_name, v_retailer_name, v_retailer_dc4_company_uid, FICS_Number)
            Web_Fulfillment_Utility_obj.run_setup_tool(
                v_salesforce_id, v_supplier_name, v_email_address,
                v_phone_number, v_retailer_name, v_billing_address,
                v_vendor_number, v_retailer_web_company_uid, v_account_number,
                v_retailer_dc4_company_uid, v_contact_name, client_uid,
                retailer_uid)
            print(input_row)
            count = count + 1
            excel_operation_obj.set_value(input_row, 1, count)

            FICS_Number = excel_operation_obj.get_value(input_row, 1)
            v_end_time1 = time.time()
            excel_operation_obj.set_value(
                input_row, 2, math.floor(v_end_time1 - v_start_time1))
            excel_operation_obj.set_value(input_row, 3, datetime.date.today())
            print(
                '----------------------------------------------\n\nExecution Time: '
                + str(math.floor(v_end_time1 - v_start_time1)) + '   count: ' +
                str(count) + '\n\n-------------------------')
            time.sleep(2)
            input_row = input_row + 1

            self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
            flag = easygui.ynbox('Do you want to run one more setup?')
        v_end_time = time.time()
        report_file_object.update_sheet(self.v_username, count,
                                        math.floor(v_end_time - v_start_time),
                                        str(datetime.date.today()))
Exemplo n.º 15
0
    def check_extensions(self, v_supplier, v_retailer, v_document_type,
                         current_row, service_name):

        v_document_type = str(v_document_type)
        self.lo.log_to_file("INFO", "Check for the map extensions")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        eo = ExcelOperations(self.v_task_type, self.v_data_sheet)
        self.lo.log_to_file("INFO", "Login in to DC4 Pre_Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        so.click_element_by_xpath(AppConstants.DC4_TAB)
        dc = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
        so.send_text_by_xpath(AppConstants.DC4_COMPANY_NAME_TEXT_FIELD,
                              v_supplier)
        so.click_element_by_xpath(AppConstants.DC4_COMPANY_NAME_SEARCH_CLICK)
        select_supplier = so.click_element_by_xpath(
            CommonLocators.Company_Select_Link)

        # Check the retationship
        click_relationship = self.v_driver.find_element_by_xpath(
            CommonLocators.Relationship_Tab).click()
        search_retailer_relationship = self.v_driver.find_element_by_xpath(
            CommonLocators.Trading_Partner_Name_text_Field).send_keys(
                v_retailer)
        self.v_driver.find_element_by_xpath(
            CommonLocators.click_search).click()
        select_supplier_profile = so.click_element_by_xpath(
            CommonLocators.Supplier_Profile_Link)

        # Profile Page Display
        show_option_click = self.v_driver.find_element_by_xpath(
            CommonLocators.show_click).click()

        counter = 2
        path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
            counter) + ']/td[10]'
        flag = 0
        while (so.check_exists_by_xpath(path)):

            service = so.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[10]')
            doc_tpe = so.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[3]')

            if service == service_name and doc_tpe == v_document_type:

                V_configure_extensions_xpath = '//*[@id="form1:table1:0:table2:' + str(
                    counter - 2) + ':extensionPopup"]'
                so.click_element_by_xpath(V_configure_extensions_xpath)

                self.v_driver.switch_to.window(
                    self.v_driver.window_handles[-1])
                time.sleep(3)
                self.v_driver.switch_to.frame(0)
                time.sleep(2)

                extension_counter = 2
                click_show_path = '//*[@id="form1:table1"]/table[2]/tbody/tr[' + str(
                    extension_counter) + ']/td[1]/div/a[2]'
                extension_counter1 = 0
                map_extension_list = list()
                while (so.check_exists_by_xpath(click_show_path)):
                    so.click_element_by_xpath(
                        '//*[@id="form1:table1"]/table[2]/tbody/tr[' +
                        str(extension_counter) + ']/td[1]/div/a[2]')
                    time.sleep(1)
                    map_text = self.v_driver.find_element_by_name(
                        'form1:table1:' + str(extension_counter1) +
                        ':table2:0:outputText22')
                    map_values = map_text.get_attribute('value')

                    map_extension_list.append(map_values)
                    print(map_extension_list)
                    extension_counter = extension_counter + 2
                    extension_counter1 = extension_counter1 + 1
                    click_show_path = '//*[@id="form1:table1"]/table[2]/tbody/tr[' + str(
                        extension_counter) + ']/td[1]/div/a[2]'

                map_extension_list_str = ('\n').join(map_extension_list)

                supplier_map_version = self.v_data_sheet.cell(row=current_row,
                                                              column=9).value
                retailer_map_version = self.v_data_sheet.cell(row=current_row,
                                                              column=10).value

                msg_1 = "Please press Yes if the maps are correct. Select No if the maps are incorrect \n\n " + "\n" + "Supplier Version:" + supplier_map_version + "\n" + "Retailer Version:" + retailer_map_version + "\n\n" + map_extension_list_str

                if msg_1 is not None:
                    title = "Please Confirm"
                    if boolbox(msg_1, title):  # show a Continue/Cancel dialog
                        pass  # user chose Yes
                    else:  # user chose No
                        flag = 1
                        break
                else:
                    pass

            counter = counter + 1
            # map_extension_list.clear()
            path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
                counter) + ']/td[10]'

        close_extension_tab = so.click_element_by_xpath(
            CommonLocators.extensions_cancel_button)

        self.v_driver.switch_to.window(self.v_driver.window_handles[0])
        return flag
    def execute_main(self):
        v_start_time = time.time()
        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type,self.v_driver,self.lo)
        ehu =  ErrorHospital_Utility(self.v_task_type,self.v_driver,self.lo)
        rf = ReportFileUtility(self.v_task_type)
        output_sheet = self.v_input_wb.get_sheet_by_name('Output')
        input_sheet = self.v_input_wb.get_sheet_by_name('Input')
        eo = ExcelOperations(self.v_task_type, input_sheet)
        output_sheet_eo = ExcelOperations(self.v_task_type, output_sheet)
        output_sheet_curr_row = 2
        for index in range(2,input_sheet.max_row+1):
            list_duplicate_ticket_uid = []
            today = datetime.datetime.now()
            DD = datetime.timedelta(days=14)
            earlier = today - DD
            earlier_str = earlier.strftime("%Y-%m-%d")
            earlier_str = earlier_str+' 00:00:00'
            lg.login("DC4 Prod")
            v_error_title = eo.get_value(index, 1)
            if v_error_title == LocalElementLocator.ADHOC_ERROR_TITLE:
                v_ticket_uid = eo.get_value(index, 2)
                if v_ticket_uid is None:
                    v_ticket_uid = ' '
                ehu.adhoc_error_search(v_ticket_uid,earlier_str,' ')
            if so.check_exists_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH):
                so.click_element_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH)
            tuid_index = 2
            while(ehu.get_ticket_uid(tuid_index)):
                temp_ticket_uid = ehu.get_ticket_uid(tuid_index)
                temp_receiver = ehu.get_receiver_name(tuid_index)
                temp_sender = ehu.get_sender_name(tuid_index)
                if temp_ticket_uid not in list_duplicate_ticket_uid:
                    ehu.adhoc_error_search(temp_ticket_uid,earlier_str,' ')
                    v_tpid, v_doctype = ehu.get_info_from_description(tuid_index-2)
                    ehu.adhoc_error_search(' ', earlier_str,v_tpid)
                    if so.check_exists_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH):
                        so.click_element_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH)
                    temp_tuid_index = 2
                    while (ehu.get_ticket_uid(temp_tuid_index)):
                        list_duplicate_ticket_uid.append(ehu.get_ticket_uid(temp_tuid_index))
                        temp_tuid_index = temp_tuid_index+1
                    output_sheet_eo.set_value(output_sheet_curr_row, 1, temp_ticket_uid)
                    output_sheet_eo.set_value(output_sheet_curr_row, 2, temp_sender)
                    output_sheet_eo.set_value(output_sheet_curr_row, 3, temp_receiver)
                    output_sheet_eo.set_value(output_sheet_curr_row, 4, v_tpid)
                    output_sheet_eo.set_value(output_sheet_curr_row, 5, v_doctype)
                    output_sheet_curr_row = output_sheet_curr_row+1
                    self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
                    ehu.adhoc_error_search(v_ticket_uid, earlier_str, ' ')
                    if so.check_exists_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH):
                        so.click_element_by_xpath(LocalElementLocator.EH_SHOW_ALL_TAB_XPATH)
                tuid_index = tuid_index+1



        #so.click_element(AppConstants.DC4_TAB, "BY_NAME")
        #dc = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
        #dc.company_search_by_name('Midlab Inc')
        #dc.company_search_by_ISA_ID('6166651648')
        #dc.company_search_by_TPID('620TSTWONDERTRE')

        self.v_driver.close()
        v_end_time = time.time()
        rf.update_sheet(self.v_username, 2, math.floor(v_end_time - v_start_time), str(datetime.date.today()))
 def thread2(self):
     login_obj = Login(self.v_task_type, self.v_driver_mv, self.v_input_wb,
                       self.lo)
     login_obj.login('Launchpad')
     time.sleep(5)
    def retailer_v_check(self, v_supplier, v_retailer, v_document_type,
                         current_row):
        v_document_type_1 = str(v_document_type)
        v_document_type_2 = '875'
        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        login = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                      self.lo)
        selenium_operations = SeleniumOperations(self.v_task_type,
                                                 self.v_driver, self.lo)

        excel_operations = ExcelOperations(self.v_task_type, self.v_data_sheet)

        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        login = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                      self.lo)
        selenium_operations = SeleniumOperations(self.v_task_type,
                                                 self.v_driver, self.lo)

        selenium_operations.click_element_by_xpath(AppConstants.DC4_TAB)

        dc4_utility = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
        self.v_driver.find_element_by_xpath(
            AppConstants.DC4_COMPANY_NAME_TEXT_FIELD).send_keys(v_retailer)
        self.v_driver.find_element_by_xpath(
            AppConstants.DC4_COMPANY_NAME_SEARCH_CLICK).click()
        select_retailer = self.v_driver.find_element_by_xpath(
            '//*[@id="table1:10:commandLink2"]').click()

        click_relationship = selenium_operations.click_element_by_xpath(
            CommonLocators.Relationship_Prod_Tab)
        search_retailer_relationship = selenium_operations.send_text_by_xpath(
            CommonLocators.Trading_Partner_Name_text_Field, v_supplier)
        selenium_operations.click_element_by_xpath(CommonLocators.click_search)

        # Select the Retailer company profile and check for the FI setup
        select_retailer_profile = selenium_operations.click_element_by_xpath(
            CommonLocators.Supplier_Profile_Link)

        # Profile Page Display
        show_option_click = selenium_operations.click_element_by_xpath(
            CommonLocators.show_click)

        counter = 2
        path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
            counter) + ']/td[10]'
        while (selenium_operations.check_exists_by_xpath(path)):

            service = selenium_operations.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[10]')
            print(service)
            doc_type = selenium_operations.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[3]')
            counter = counter + 1
            print(doc_type)

            if doc_type == v_document_type_1:
                if service != 'DoNotRoute' and 'WEBtoService':
                    print("850 capability is available")

                    retailer_version = selenium_operations.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                        + str(counter) + ']/td[8]')
                    capability_name = selenium_operations.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2:' + str(counter) +
                        ':outputText14"]')
                    print(retailer_version)
                    print(capability_name)

                    if retailer_version == " ":
                        retailer_version = self.retailer_ver_check(
                            doc_type, capability_name)
                        excel_operations.set_value(current_row, 10,
                                                   retailer_version)
                        retailer_capability_version = selenium_operations.get_text_by_xpath(
                            '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                            + str(counter) + ']/td[6]')
                        excel_operations.set_value(
                            current_row, 11, retailer_capability_version)
                        self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
                        break
                    else:
                        excel_operations.set_value(current_row, 10,
                                                   retailer_version)
                        retailer_capability_version = selenium_operations.get_text_by_xpath(
                            '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                            + str(counter) + ']/td[6]')
                        excel_operations.set_value(
                            current_row, 11, retailer_capability_version)
                        self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
                        break

                elif service == 'DoNotRoute':
                    print("850 capability is not available")
    def Supplier_Setup_Check(self, v_supplier, v_retailer, v_document_type,
                             v_erp, current_row):
        v_document_type_1 = str(v_document_type)
        v_document_type_2 = '875'
        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        login = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                      self.lo)
        selenium_operations = SeleniumOperations(self.v_task_type,
                                                 self.v_driver, self.lo)

        excel_operations = ExcelOperations(self.v_task_type, self.v_data_sheet)

        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        login = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                      self.lo)
        selenium_operations = SeleniumOperations(self.v_task_type,
                                                 self.v_driver, self.lo)

        selenium_operations.click_element_by_xpath(AppConstants.DC4_TAB)

        dc4_utility = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
        self.v_driver.find_element_by_xpath(
            AppConstants.DC4_COMPANY_NAME_TEXT_FIELD).send_keys(v_supplier)
        self.v_driver.find_element_by_xpath(
            AppConstants.DC4_COMPANY_NAME_SEARCH_CLICK).click()
        select_retailer = self.v_driver.find_element_by_xpath(
            '//*[@id="table1:10:commandLink2"]').click()

        click_relationship = selenium_operations.click_element_by_xpath(
            CommonLocators.Relationship_Prod_Tab)
        search_retailer_relationship = selenium_operations.send_text_by_xpath(
            CommonLocators.Trading_Partner_Name_text_Field, v_retailer)
        selenium_operations.click_element_by_xpath(CommonLocators.click_search)

        # Select the Retailer company profile and check for the FI setup
        select_retailer_profile = selenium_operations.click_element_by_xpath(
            CommonLocators.Supplier_Profile_Link)

        # Profile Page Display
        show_option_click = selenium_operations.click_element_by_xpath(
            CommonLocators.show_click)

        counter = 2
        path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
            counter) + ']/td[10]'
        while (selenium_operations.check_exists_by_xpath(path)):

            service = selenium_operations.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[10]')
            print(service)
            doc_type = selenium_operations.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[3]')
            counter = counter + 1
            print(doc_type)
            print(v_erp)

            if doc_type == v_document_type_1:
                if service != 'DoNotRoute' and service != 'WEBtoService':
                    print("850 capability is already available")
                    print(v_document_type_1)

                else:
                    print('add new capability')
                    add_existing_capability = selenium_operations.click_element_by_xpath(
                        '//*[@id="form1:table1:0:table2:addExistingCapability"]/img'
                    )
                    time.sleep(2)

                    self.v_driver.switch_to.window(
                        self.v_driver.window_handles[-1])
                    time.sleep(3)
                    self.v_driver.switch_to.frame(0)
                    time.sleep(2)

                    self.v_driver.find_element_by_xpath(
                        '//*[@id="form1:showDetailHeader1"]/tbody/tr[2]/td[2]/table/tbody/tr[1]/td[1]'
                    ).click()
                    self.v_driver.find_element_by_xpath(
                        '//*[@id="form1:inputText3"]').send_keys('FI%')

                    time.sleep(3)

                    if v_erp == 'QB':
                        self.v_driver.find_element_by_xpath(
                            '//*[@id="form1:inputText4"]'
                        ).send_keys(
                            'SPS QuickBooks Adaptor | RSX 7.2 | 850 - Legacy')
                        selenium_operations.click_element_by_xpath(
                            '//*[@id="form1:commandButton2"]/img')
                        print('850 QB exists')
                        try:
                            self.v_driver.find_element_by_xpath(
                                '//*[@id="form1:table1:0:tableSelectMany1"]')
                            capability_flag = 0
                        except:
                            capability_flag = 1

                    elif v_erp == 'Dwyer':
                        self.v_driver.find_element_by_xpath(
                            '//*[@id="form1:inputText4"]').send_keys(
                                'Dwyer Adaptor V7 850 V2 XML')
                        selenium_operations.click_element_by_xpath(
                            '//*[@id="form1:commandButton2"]/img')
                        print('850 QB exists')
                        try:
                            self.v_driver.find_element_by_xpath(
                                '//*[@id="form1:table1:0:tableSelectMany1"]')
                            capability_flag = 0
                        except:
                            capability_flag = 1
                    else:
                        self.v_driver.find_element_by_xpath(
                            '//*[@id="form1:inputText4"]').send_keys(
                                'SPS Fishbowl Adaptor | RSX 7.2 | 850 - Legacy'
                            )
                        selenium_operations.click_element_by_xpath(
                            '//*[@id="form1:commandButton2"]/img')
                        print('850 QB exists')
                        try:
                            self.v_driver.find_element_by_xpath(
                                '//*[@id="form1:table1:0:tableSelectMany1"]')
                            capability_flag = 0
                        except:
                            capability_flag = 1

                    if capability_flag == 0:
                        self.v_driver.find_element_by_xpath(
                            '//*[@id="form1:table1:0:tableSelectMany1"]'
                        ).click()
                        Choose = selenium_operations.double_click_by_xpath(
                            '//*[@id="form1:table1:commandButton1"]')
                        time.sleep(10)

                    else:
                        self.v_driver.close()
                        print('Add new capability')

                        self.v_driver.switch_to.window(
                            self.v_driver.window_handles[0])
                        time.sleep(2)
                        selenium_operations.click_element_by_xpath(
                            '//*[@id="form1:table1:0:table2:createCapability"]/img'
                        )
                        time.sleep(5)

                        self.v_driver.switch_to.window(
                            self.v_driver.window_handles[-1])
                        time.sleep(3)
                        self.v_driver.switch_to.frame(0)
                        time.sleep(2)

                        self.v_driver.find_element_by_xpath(
                            '//*[@id="form1:findService"]').send_keys('1007')

                        if v_erp == 'QB':
                            self.v_driver.find_element_by_xpath(
                                '//*[@id="form1:findDataType"]').send_keys(
                                    '106967')
                            selenium_operations.click_element_by_xpath(
                                '//*[@id="form1:commandButton1"]/img')

                        elif v_erp == 'Dwwyer':
                            self.v_driver.find_element_by_xpath(
                                '//*[@id="form1:findDataType"]').send_keys(
                                    '91552')
                            selenium_operations.click_element_by_xpath(
                                '//*[@id="form1:commandButton1"]/img')

                        else:
                            self.v_driver.find_element_by_xpath(
                                '//*[@id="form1:findDataType"]').send_keys(
                                    '109095')
                            selenium_operations.click_element_by_xpath(
                                '//*[@id="form1:commandButton1"]/img')
                self.v_driver.switch_to.window(self.v_driver.window_handles[0])
                time.sleep(2)
                counter = 2
                path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
                    counter) + ']/td[10]'
                while (selenium_operations.check_exists_by_xpath(path)):
                    service = selenium_operations.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                        + str(counter) + ']/td[10]')
                    print(service)
                    doc_type = selenium_operations.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                        + str(counter) + ']/td[3]')
                    print(doc_type)
                    capability_uid = selenium_operations.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2:column24"]')
                    print(capability_uid)
                    profile_uid = selenium_operations.get_text_by_xpath(
                        '//*[@id="form1:table1:0:outputText1"]')
                    print(profile_uid)

                    if doc_type == v_document_type_1:
                        if service != 'DoNotRoute' and service != 'WEBtoService':
                            print("850 capability exist")
                            selenium_operations.click_element_by_xpath(
                                '//*[@id="form1:table1:0:table2:' +
                                str(counter - 2) + ':tableSelectMany1"]')
                            print("Capability selected")
                            selenium_operations.click_element_by_xpath(
                                '//*[@id="form1:table1:0:table2:disableCapability"]/img'
                            )
                            time.sleep(10)
                            break
                    counter = counter + 1
                path = 'Close'
    def supplier_setup_check(self, v_supplier, v_retailer, v_document_type,
                             current_row, service_name):

        v_document_type = str(v_document_type)
        self.lo.log_to_file("INFO", "Login in to DC4 Pre_Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)

        # lg.login("DC4 PreProd")
        #
        # # Switch to other window
        # self.v_driver.execute_script("window.open('about:blank', 'tab2');")
        # self.v_driver.switch_to.window("tab2")
        # time.sleep(2)
        #
        # lg.login("Launchpad")
        # time.sleep(5)
        #
        # self.v_driver.maximize_window()

        eo = ExcelOperations(self.v_task_type, self.v_data_sheet)

        self.lo.log_to_file("INFO", "Login in to DC4 Pre_Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)

        so.click_element_by_xpath(AppConstants.DC4_TAB)

        dc = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
        so.send_text_by_xpath(AppConstants.DC4_COMPANY_NAME_TEXT_FIELD,
                              v_supplier)
        so.click_element_by_xpath(AppConstants.DC4_COMPANY_NAME_SEARCH_CLICK)
        select_supplier = so.click_element_by_xpath(
            CommonLocators.Company_Select_Link)

        # Check the retationship
        click_relationship = self.v_driver.find_element_by_xpath(
            CommonLocators.Relationship_Tab).click()
        search_retailer_relationship = self.v_driver.find_element_by_xpath(
            CommonLocators.Trading_Partner_Name_text_Field).send_keys(
                v_retailer)

        self.v_driver.find_element_by_xpath(
            CommonLocators.click_search).click()

        # retailer_profile_name = self.v_driver.find_element_by_xpath(CommonLocators.Trading_Partner_Profile_Name).text
        # print(retailer_profile_name)

        supplier_EDI_Data = self.v_driver.find_element_by_xpath(
            CommonLocators.Supplier_EDI_Info).text
        retailer_EDI_Data = self.v_driver.find_element_by_xpath(
            CommonLocators.Retailer_EDI_Info).text

        # Supplier EDI Info
        supplier_EDI_Data_list_1 = supplier_EDI_Data.split('GRP_ID:')
        supplier_EDI_Data_list_2 = supplier_EDI_Data.split('Qual:')

        supplier_qaul_ID = supplier_EDI_Data_list_2[1].split('ID:')[0]
        supplier_qaul_ID = re.sub('\W+', '', supplier_qaul_ID)
        eo.set_value(current_row, 5, supplier_qaul_ID)
        self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)

        supplier_ISA_ID = supplier_EDI_Data_list_1[0].split('ID:')[2]
        supplier_ISA_ID = re.sub('\W+', '', supplier_ISA_ID)
        eo.set_value(current_row, 6, supplier_ISA_ID)
        self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)

        supplier_Grp_ID = supplier_EDI_Data_list_1[1]
        supplier_Grp_ID = re.sub('\W+', '', supplier_Grp_ID)

        # Retailer EDI Info
        retailer_EDI_Data_list_1 = retailer_EDI_Data.split('GRP_ID:')
        retailer_EDI_Data_list_2 = retailer_EDI_Data.split('Qual:')

        retailer_qaul_ID = retailer_EDI_Data_list_2[1].split('ID:')[0]
        retailer_qaul_ID = re.sub('\W+', '', retailer_qaul_ID)
        eo.set_value(current_row, 7, retailer_qaul_ID)
        self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)

        retailer_ISA_ID = retailer_EDI_Data_list_1[0].split('ID:')[2]
        retailer_ISA_ID = re.sub('\W+', '', retailer_ISA_ID)
        eo.set_value(current_row, 8, retailer_ISA_ID)
        self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)

        retailer_Grp_ID = retailer_EDI_Data_list_1[1]
        retailer_Grp_ID = re.sub('\W+', '', retailer_Grp_ID)

        v_trading_partner_name = self.v_driver.find_element_by_xpath(
            CommonLocators.Trading_Partner_Name).text
        print(v_trading_partner_name)

        if v_trading_partner_name == v_retailer:

            # Select the Supplier company profile and check for the FI setup
            select_supplier_profile = self.v_driver.find_element_by_xpath(
                CommonLocators.Supplier_Profile_Link).click()

        elif v_trading_partner_name == "No trading partners found.":

            print("No Retailer Found")
            return

        # Profile Page Display
        show_option_click = self.v_driver.find_element_by_xpath(
            CommonLocators.show_click).click()

        counter = 2
        path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
            counter) + ']/td[10]'
        while (so.check_exists_by_xpath(path)):

            service = so.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[10]')
            doc_tpe = so.get_text_by_xpath(
                '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                + str(counter) + ']/td[3]')

            if service == service_name:
                if doc_tpe == v_document_type:

                    eo.set_value(current_row, 11, "FI Capability is present")

                    supplier_version = so.get_text_by_xpath(
                        '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr['
                        + str(counter) + ']/td[7]')
                    eo.set_value(current_row, 9, supplier_version)
                    self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)

                    click_extension = so.click_element_by_xpath(
                        '//*[@id="form1:table1:0:table2:' + str(counter) +
                        ':extensionPopup"]')

                    # Process_Test_Files_Utility.add_extensions(counter)
                    break
                else:
                    eo.set_value(current_row, 11, "FI is not present")

            self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
            counter = counter + 1
            path = '//*[@id="form1:table1:0:table2"]/table/tbody/tr[3]/td/table/tbody/tr[' + str(
                counter) + ']/td[10]'

        time.sleep(15)
    def execute_main(self):
        v_start_time = time.time()
        self.lo.log_to_file("INFO", "Login in to DC4 Pre-Prod")
        lg = Login(self.v_task_type, self.v_driver, self.v_input_wb, self.lo)
        so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        rf = ReportFileUtility(self.v_task_type)
        SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
        output_sheet = self.v_input_wb.get_sheet_by_name('Output')
        input_sheet = self.v_input_wb.get_sheet_by_name('Input')
        input_sheet_ex = ExcelOperations(self.v_task_type, input_sheet)
        output_sheet_ex = ExcelOperations(self.v_task_type, output_sheet)
        self.v_driver.maximize_window()
        Max_row = input_sheet.max_row
        current_row = 2
        #Max_row = output_sheet.max_row
        #current_row_output = 2

        lg.login("DC4 PreProd")

        while (current_row <= Max_row):
            v_TPID = input_sheet.cell(row=current_row, column=1).value
            v_Doc_850 = input_sheet.cell(row=current_row, column=2).value
            if (v_Doc_850 == 'Y'):
                v_doc = '850'
                V_supplier_doc_version = '7.4'
            dc = DC4_Utility(self.v_task_type, self.v_driver, self.lo)
            dc.company_search_by_TPID(v_TPID)
            self.lo.log_to_file("INFO", "Searching Supplier Data")
            V_Supplier_Profile_name = so.get_text_by_xpath(
                '//*[@id="table2"]/table/tbody/tr/td/table/tbody/tr[2]/td[2]')
            V_Supplier_name = so.get_text_by_xpath(
                '//*[@id="table2:0:commandLink4"]')
            print("Supplier Name = " + V_Supplier_name)
            output_sheet_ex.set_value(current_row, 1, V_Supplier_name)
            print("Supplier Profile = " + V_Supplier_Profile_name)
            so.click_element_by_xpath('//*[@id="table2:0:commandLink4"]')
            so.click_element_by_xpath(
                '//*[@id="form1:panelPage1"]/table/tbody/tr[3]/td/table/tbody/tr/td[2]/table/tbody/tr/td[3]/a'
            )
            self.lo.log_to_file("INFO", "Searching Retailer Data")
            V_retailer_name, V_retailer_profile, V_supplier_row_index = self.search_retailer_profile(
                V_Supplier_Profile_name)
            #print(V_retailer_name, V_retailer_profile, V_supplier_row_index)
            if V_retailer_name == V_retailer_profile == V_supplier_row_index == False:
                print('No relationship found')
                self.lo.log_to_file(
                    "INFO", "No relationship found, going to next row")
                output_sheet_ex.set_value(current_row, 4,
                                          'Relationship not found')
                current_row = current_row + 1
            else:
                print("Retailer Name = " + V_retailer_name)
                output_sheet_ex.set_value(current_row, 2, V_retailer_name)
                print("Retailer Profile = " + V_retailer_profile)
                self.lo.log_to_file("INFO", "Searching Retailer Map Versions")
                V_ret_document, V_ret_doc_status, V_ret_doc_service, V_ret_doc_version = self.search_retailer_map(
                    v_doc, V_retailer_profile, V_Supplier_Profile_name,
                    V_Supplier_name)
                V_supplier_map_version, V_supplier_profile_map_name, V_supplier_map_row_index = self.check_supplier_profile(
                    V_Supplier_Profile_name, v_doc, V_supplier_row_index)
                print("Supplier Map version = " + V_supplier_map_version)
                print("Supplier Map Name" + V_supplier_profile_map_name)
                output_sheet_ex.set_value(current_row, 3, V_ret_document)
                self.v_input_wb.save(AppConstants.INPUT_FILE_PATH)
                self.lo.log_to_file("INFO", "Maps and version found")
                V_send_suuplier_map_index = int(V_supplier_map_row_index)
                V_send_suuplier_map_index = V_send_suuplier_map_index - 2
                status = self.add_extensions(V_ret_doc_version,
                                             V_supplier_doc_version,
                                             V_send_suuplier_map_index)
                #print(status)
                if status == 'None':
                    output_sheet_ex.set_value(current_row, 4, 'Success')
                else:
                    output_sheet_ex.set_value(current_row, 4, 'Fail')
                current_row = current_row + 1

        self.v_driver.close()
        v_end_time = time.time()
        rf.update_sheet(self.v_username, 2,
                        math.floor(v_end_time - v_start_time),
                        str(datetime.date.today()))
 def thread1(self, ):
     login_obj = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                       self.lo)
     login_obj.login("Salesforce")
     time.sleep(5)
    def execute_main(self):
        db_object = DatabaseUtility(self.v_task_type, self.lo)
        if db_object.connection():
            self.lo.log_to_file('INFO', 'Successful Connection')
        else:
            self.lo.log_to_file('ERROR', 'DB Server is not active')
            return
        v_start_time = time.time()
        self.lo.log_to_file("INFO", "Login in to DC4 Prod")
        login_obj = Login(self.v_task_type, self.v_driver, self.v_input_wb,
                          self.lo)
        selenium_operation_obj = SeleniumOperations(self.v_task_type,
                                                    self.v_driver, self.lo)
        report_file_obj = ReportFileUtility(self.v_task_type)
        input_sheet = self.v_input_wb.get_sheet_by_name('Input')
        input_sheet_row_count = input_sheet.max_row
        excel_operation_obj = ExcelOperations(self.v_task_type, input_sheet)
        Web_Fulfillment_Utility_obj = Web_Fulfillment_Utility(
            self.v_task_type, self.v_driver, self.v_input_wb, self.lo,
            self.v_username, db_object)
        login_obj.login("Salesforce")
        self.v_driver.execute_script(
            "window.open('http://dc4ui.p01.pro:7777/dc4custmanager/faces/home.jsp', 'new_window')"
        )

        # self.v_driver.execute_script(
        #     "window.open('https://atlassian.spscommerce.com/browse/FICS-163692', 'new_window')")
        self.v_driver.switch_to.window(self.v_driver.window_handles[-1])
        report_file_object = ReportFileUtility(self.v_task_type)
        time.sleep(2)
        login_obj.login("DC4 Prod")

        input_row = excel_operation_obj.get_value(2, 4)
        FICS_Number = excel_operation_obj.get_value(input_row, 1)

        while (FICS_Number != None):
            v_start_time = time.time()
            v_salesforce_id = FICS_Number
            self.v_driver.switch_to.window(self.v_driver.window_handles[0])
            time.sleep(2)
            #self.v_driver.get('https://atlassian.spscommerce.com/browse/'+FICS_Number)
            #v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name, v_salesforce_id = Web_Fulfillment_Utility_obj.get_info_from_JIRA()
            v_supplier_name, v_email_address, v_phone_number, v_retailer_name, v_billing_address, v_vendor_number, v_retailer_web_company_uid, v_account_number, v_retailer_dc4_company_uid, v_contact_name = Web_Fulfillment_Utility_obj.get_info_from_salesforce(
                v_salesforce_id)
            print(v_salesforce_id + "\n" + v_supplier_name + "\n" +
                  v_email_address + "\n" + v_phone_number + "\n" +
                  v_retailer_name + "\n" + v_vendor_number + "\n" +
                  v_retailer_web_company_uid + "\n" + v_account_number + "\n" +
                  v_retailer_dc4_company_uid + "\n" + v_contact_name)
            print(v_billing_address)

            self.v_driver.switch_to.window(self.v_driver.window_handles[-1])
            time.sleep(2)
            try:
                #Web_Fulfillment_Utility_obj.get_data_for_library(v_salesforce_id, v_supplier_name, v_retailer_name, v_retailer_dc4_company_uid, FICS_Number)
                Web_Fulfillment_Utility_obj.run_setup_tool(
                    v_salesforce_id, v_supplier_name, v_email_address,
                    v_phone_number, v_retailer_name, v_billing_address,
                    v_vendor_number, v_retailer_web_company_uid,
                    v_account_number, v_retailer_dc4_company_uid,
                    v_contact_name)
            except:
                self.v_driver.save_screenshot(AppConstants.APP_RUNNER_PATH +
                                              v_salesforce_id + '.png')

            print(input_row)
            v_end_time = time.time()
            report_file_object.update_sheet(
                self.v_username, 1, math.floor(v_end_time - v_start_time),
                str(datetime.date.today()))
            input_row = input_row + 1
            excel_operation_obj.set_value(2, 4, input_row)
            FICS_Number = excel_operation_obj.get_value(input_row, 1)
            time.sleep(2)