def get_waybill(self, driver=''): '''获取运单查询页面可删除的运单号''' try: waybillId, tmsBillCode = ISHaveWaybill().is_have_waybill( driver=driver)[:2] # 打开运单管理模块 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/label/a') if waybillId == None: waybillId, tmsBillCode = PageWaybillCreate( self.driver).create_waybill_submit(driver=driver) # 打开运单查询页面 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/div/ul/li[1]/a/span' ) # 输入查询内容查询运单 Select(self.driver.get_element( 'id->TMS-dateInterval')).select_by_index(1) HeplerWaybill().fuzzy_query( self.driver, 'id->normalCondition', 'id->TMS-waybillIndex-normalSearch-', tmsBillCode) return waybillId, tmsBillCode else: # 打开运单查询页面 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/div/ul/li[1]/a/span' ) # 输入查询内容查询运单 Select(self.driver.get_element( 'id->TMS-dateInterval')).select_by_index(1) HeplerWaybill().fuzzy_query(self.driver, 'id->normalCondition', 'TMS-normalSearch-', tmsBillCode) cName = self.driver.driver.find_element_by_id( 'TMS-showDialog-').get_attribute("class") if cName == 'btn btn-danger': return waybillId, tmsBillCode else: waybillId, tmsBillCode = PageWaybillCreate( self.driver).create_waybill_submit(driver=driver) # 打开运单查询页面 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/div/ul/li[1]/a/span' ) return waybillId, tmsBillCode except Exception as e: self.logger.error('获取运单查询页面可删除的运单号发生异常:{0}'.format(e)) return None
def test_own_car_waybill_create(self): '''创建自有车运单''' PageWaybillCreate(self.driver).login() PageWaybillCreate(self.driver).open_waybill_manage() PageWaybillCreate(self.driver).input_own_car_waybill(index='1', totalAmt='100', income='100', preAmt='0.01', photoAirWay='', content='运单备注') PageWaybillCreate(self.driver).submit() self.assertIn( PageWaybillCreate(self.driver).create_waybill_success(), ('创建成功', '此手机号已有未确认的订单,不可重复提交,请发车确认后再录单'))
def send_order(self, planNo=''): '''订单派车''' try: self.logger.info('订单派车的运单号:{0}'.format(planNo)) HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[3]/div/ul/li[1]/a/span') # 输入订单号查询订单 HeplerWaybill().input_query(self.driver, 'id->TMS-param-planNo', planNo, 'xpath->//*[@id="TMS-search-"]/span') # 点击派车按钮 self.driver.retry_find_click('id->TMS-listCargo-') self.driver.element_is_not_visible('class->loading-bar-background') self.driver.retry_find_click('id->TMS-dispatchedAndUpdateCargo-') self.driver.element_is_not_visible('class->loading-bar-background') # 打开运单管理模块 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/label/a') # 生成运单 waybillId, tmsBillCode = PageWaybillCreate( self.driver).jump_waybill_submit(driver='18056070532', index='1', totalAmt='100', income='100', preAmt='0.01', photoAirWay='', content='运单备注') return planNo, waybillId, tmsBillCode except Exception as e: self.logger.error('订单派车发生异常:{0}'.format(e)) return None, None, None
def get_arrived_waybill2(self, driver='', driverConfirm='0'): '''获取到达确认页面货主发车确认的运单号''' try: in_transit_waybillId, in_transit_tmsBillCode = ISHaveWaybill( ).is_have_in_transit_waybill(driver=driver, driverConfirm=driverConfirm)[:2] wait_departure_waybillId, wait_departure_tmsBillCode = ISHaveWaybill( ).is_have_wait_departure_waybill(driver=driver)[:2] # 打开运单管理模块 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/label/a') if in_transit_waybillId != None: waybillId, tmsBillCode = str(in_transit_waybillId[0]), str( in_transit_tmsBillCode[0]) return waybillId, tmsBillCode elif wait_departure_waybillId != None: waybillId, tmsBillCode = str(wait_departure_waybillId[0]), str( wait_departure_tmsBillCode[0]) # 货主发车确认 tmsBillCode = PageWaybillDeparture( self.driver).departure_confirm(tmsBillCode=tmsBillCode) return waybillId, tmsBillCode else: waybillId, tmsBillCode = PageWaybillCreate( self.driver).create_waybill_submit(driver=driver) # 货主发车确认 tmsBillCode = PageWaybillDeparture( self.driver).departure_confirm(tmsBillCode=tmsBillCode) return waybillId, tmsBillCode except Exception as e: self.logger.error('获取到达确认页面司机发车确认的运单号:{0}'.format(e)) return None
def get_waybill(self, driver=''): '''获取运单详情页面的运单号''' try: waybillId, tmsBillCode = ISHaveWaybill().is_have_waybill(driver=driver)[:2] # 打开运单管理模块 HeplerWaybill().open_menu(self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/label/a') if waybillId == None: waybillId, tmsBillCode = PageWaybillCreate(self.driver).create_waybill_submit(driver=driver) return waybillId, tmsBillCode else: return waybillId, tmsBillCode except Exception as e: self.logger.error('获取运单号的运单详情发生异常:{0}'.format(e)) return None
def get_arrived_waybill(self, driver='', driverConfirm='1'): '''获取到达确认页面司机发车确认的运单号''' try: in_transit_waybillId, in_transit_tmsBillCode = ISHaveWaybill( ).is_have_in_transit_waybill(driver=driver, driverConfirm=driverConfirm)[:2] wait_departure_waybillId, wait_departure_tmsBillCode = ISHaveWaybill( ).is_have_wait_departure_waybill(driver=driver)[:2] # 打开运单管理模块 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/label/a') if in_transit_waybillId != None: waybillId, tmsBillCode = str(in_transit_waybillId[0]), str( in_transit_tmsBillCode[0]) return waybillId, tmsBillCode elif wait_departure_waybillId != None: waybillId, tmsBillCode = str(wait_departure_waybillId[0]), str( wait_departure_tmsBillCode[0]) # 司机发车确认 DriverConfirmApi().driver_confirm_api(billId=waybillId, totalAmt='1000', preAmt='0.01', oilAmt='0.01', destAmt='0.01', lastAmt='0.01', receiverId='') return waybillId, tmsBillCode else: waybillId, tmsBillCode = PageWaybillCreate( self.driver).create_waybill_submit(driver=driver) # 司机发车确认 DriverConfirmApi().driver_confirm_api(billId=waybillId, totalAmt='1000', preAmt='0.01', oilAmt='0.01', destAmt='0.01', lastAmt='0.01', receiverId='') return waybillId, tmsBillCode except Exception as e: self.logger.error('获取到达确认页面司机发车确认的运单号:{0}'.format(e)) return None
def get_arrived_waybill(self, driver='', driverConfirm=''): '''获取回单录入页面的运单号''' try: in_transit_waybillId, in_transit_tmsBillCode = ISHaveWaybill( ).is_have_in_transit_waybill(driver=driver, driverConfirm=driverConfirm)[:2] wait_departure_waybillId, wait_departure_tmsBillCode = ISHaveWaybill( ).is_have_wait_departure_waybill(driver=driver)[:2] # 打开运单管理模块 HeplerWaybill().open_menu( self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[4]/label/a') if in_transit_waybillId != None: waybillId, tmsBillCode = str(in_transit_waybillId[0]), str( in_transit_tmsBillCode[0]) if driverConfirm == '1': PageWaybillArrival( self.driver).arrival_confirm(tmsBillCode=tmsBillCode) self.driver.move_to_click( 'xpath->//*[@id="myModal"]/div/div/div[3]/button') self.driver.element_is_not_visible( 'class->loading-bar-background') self.logger.info('司机发车确认的运单 到达确认:{0}'.format(tmsBillCode)) elif driverConfirm == '0': PageWaybillArrival( self.driver).arrival_confirm2(tmsBillCode=tmsBillCode) self.driver.move_to_click( 'xpath->//*[@id="myModal"]/div/div/div[3]/button') self.driver.element_is_not_visible( 'class->loading-bar-background') self.logger.info('货主发车确认的运单 到达确认:{0}'.format(tmsBillCode)) else: self.logger.error('请确认运单是否发车确认:{0}'.format(tmsBillCode)) return waybillId, tmsBillCode elif wait_departure_waybillId != None: waybillId, tmsBillCode = str(wait_departure_waybillId[0]), str( wait_departure_tmsBillCode[0]) PageWaybillDeparture( self.driver).departure_confirm(tmsBillCode=tmsBillCode) PageWaybillArrival( self.driver).arrival_confirm2(tmsBillCode=tmsBillCode) self.driver.move_to_click( 'xpath->//*[@id="myModal"]/div/div/div[3]/button') self.driver.element_is_not_visible( 'class->loading-bar-background') self.logger.info('待发车的运单 货主发车确认 到达确认:{0}'.format(tmsBillCode)) return waybillId, tmsBillCode else: waybillId, tmsBillCode = PageWaybillCreate( self.driver).create_waybill_submit(driver=driver) PageWaybillDeparture( self.driver).departure_confirm(tmsBillCode=tmsBillCode) PageWaybillArrival( self.driver).arrival_confirm2(tmsBillCode=tmsBillCode) self.driver.move_to_click( 'xpath->//*[@id="myModal"]/div/div/div[3]/button') self.driver.element_is_not_visible( 'class->loading-bar-background') self.logger.info('新建运单 货主发车确认 到达确认:{0}'.format(tmsBillCode)) return waybillId, tmsBillCode except Exception as e: self.logger.error('获取回单录入页面的运单号:{0}'.format(e)) return None, None