jkonoch

entry helper program unfinished

Oct 28th, 2021
1,110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pyautogui as pag
  2. import time
  3. """
  4.  
  5. Input the basic info on the Header Tab for order ASNs in portal
  6.  
  7. OUTLINE
  8. _________________________________________
  9.  
  10. Introduction
  11. Loop:
  12.    User asked for order_info
  13.    submit supplied order_info to ASN Header
  14.    Loop:
  15.        User asked
  16.        '''
  17.        Hit enter to enter information to ASN Header
  18.        Type 'new' to enter new information
  19.        Type 'exit' to exit
  20.        '''
  21.  
  22.  
  23. """
  24. carrier_dd_list = ['dayton', 'central t', 'fedex freight ltl priority', 'taxa',
  25.                    'roadrunner', ]
  26. order_info = {}
  27.  
  28. # def carrier_code_selection(x):  # will I even use this?
  29.  
  30. def tab(x):
  31.     for i in range(x+1):
  32.         pag.press('tab')
  33.  
  34. def exit_option():
  35.     exit_query = input("Type 'exit' to exit the program or hit enter to "
  36.                        "continue. ")
  37.     if exit_query.lower() == 'exit':
  38.         quit()
  39.  
  40. sxe_header_field_positions = {
  41.     'gross weight': (410,619),
  42. }
  43.  
  44. def order_info_grab():
  45.     order_info = {
  46.         'weight': input("Weight:  \n->  "),
  47.         'carrier dropdown': input(f"Carrier Selection - (Type one of the "
  48.                                   f"following:\n"
  49.                                   f"{carrier_dd_list}\nCarrier:  \n->  "),
  50.         'scac': input('SCAC or "Carrier Name":  '),
  51.        # 'equipment number': 69,
  52.         'bill of lading': input("Bill of Lading #:  \n->  "),
  53.         'pro number': input("Pro #:  \n->  "),
  54.         'ship date': input("Ship date MM/DD/YYYY format \n->  ")
  55.     }
  56.  
  57.  
  58.  
  59. def entry_to_header():
  60.     pag.moveTo(sxe_header_field_positions['gross weight'])
  61.     time.sleep(.4)
  62.     pag.click()
  63.     time.sleep(.4)
  64.     pag.write(order_info['weight'])
  65.     time.sleep(.4)
  66.     tab(1)
  67.     pag.write(order_info['carrier dropdown'])
  68.     tab(1)
  69.     pag.write(order_info['scac'])
  70.     tab(1)
  71.     pag.write('69')
  72.     tab(1)
  73.     pag.write(order_info['bill of lading'])
  74.     tab(1)
  75.     pag.write(order_info['pro number'])
  76.     tab(1)
  77.     pag.write(order_info['ship date'])
  78.     tab(2),pag.press('c')
  79.     tab(11)
  80.     pag.write('Company Name')
  81.     pag.scroll(4000) # just to get to the top of the page again
  82.  
  83.  
  84. def order_info_change():
  85.     for key, value in order_info.items():
  86.         if key != 'equipment number':
  87.             change_y_n = input(f"would you like to change the "
  88.                                f"{key.title()}? Type 'y' to change or hit enter to "
  89.                                f"skip the change.\n->  ")
  90.             if change_y_n.lower() in ('y','yes','yeah'):
  91.                 order_info[key] = input(f"New {key.title()}:  \n->  ")
  92.         else:
  93.             continue
  94.  
  95.  
  96. order_info_grab()
  97.  
  98. while True:
  99.     entry_to_header()
  100. #     # TODO enter the user supplied info to the ASN header
  101.  
  102.     while True:
  103.  
  104.         begin_or_change = input('We are about to start a new loop and enter '
  105.                                'the order information into the ASN Header '
  106.                                 'tab. \nBe sure the page is open '
  107.               'and is set to zoom level 100%. \nIf you need to change the '
  108.               'order information, please type "new" or you can just hit '
  109.               'enter to start the loop with the previous information.\n->  ')
  110.  
  111.         if begin_or_change.lower() == 'new':
  112.             order_info_grab()
  113.  
  114.         elif begin_or_change.lower() == '':
  115.             break
  116.         else:
  117.             print("That's invalid. Try again: ")
  118.  
  119.  
  120.     exit_option()
RAW Paste Data