Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 def get_payment_select_waybill(self, driver='', driverConfirm='1'):
     '''获取支付查询页面的运单号'''
     try:
         self.login()
         payment_select_waybillId, payment_select_tmsBillCode = ISHaveWaybill(
         ).is_have_payment_arrival_waybill(driver=driver,
                                           driverConfirm=driverConfirm)[:2]
         if payment_select_waybillId != None:
             waybillId, tmsBillCode = str(payment_select_waybillId[0]), str(
                 payment_select_tmsBillCode[0])
             return waybillId, tmsBillCode
         else:
             waybillId, tmsBillCode = PageWaybillDeparture(
                 self.driver).get_wait_departure_waybill(driver=driver)
             if driverConfirm == '1':
                 # 司机发车确认
                 DriverConfirmApi().driver_confirm_api(billId=waybillId,
                                                       totalAmt='1000',
                                                       preAmt='0.01',
                                                       oilAmt='0.01',
                                                       destAmt='0.01',
                                                       lastAmt='0.01',
                                                       receiverId='')
             elif driverConfirm == '0':
                 PageWaybillDeparture(
                     self.driver).departure_confirm(tmsBillCode=tmsBillCode)
             else:
                 self.logger.error(
                     '是否司机发车确认输入参数错误:{0}'.format(driverConfirm))
             return waybillId, tmsBillCode
     except Exception as e:
         self.logger.error('获取支付查询页面的运单号:{0}'.format(e))
         return None
Exemplo n.º 3
0
    def get_payment_departure_waybill(self, driver='', driverConfirm='1'):
        '''获取发车支付页面的运单号'''
        try:
            payment_departure_waybillId, payment_departure_tmsBillCode = ISHaveWaybill(
            ).is_have_payment_departure_waybill(
                driver=driver, driverConfirm=driverConfirm)[:2]

            if payment_departure_waybillId != None:
                waybillId, tmsBillCode = str(
                    payment_departure_waybillId[0]), str(
                        payment_departure_tmsBillCode[0])
                return waybillId, tmsBillCode
            else:
                waybillId, tmsBillCode = PageWaybillDeparture(
                    self.driver).get_wait_departure_waybill(driver=driver)
                PageWaybillDeparture(
                    self.driver).departure_confirm(tmsBillCode=tmsBillCode)
                if driverConfirm == '1':
                    # 司机发车确认
                    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, None
        finally:
            # 打开运费支付模块
            HeplerWaybill().open_menu(
                self.driver, 'xpath->//*[@id="menu"]/div/nav/ul/li[5]/label/a')
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    def jump_waybill_submit(self,
                            project='',
                            driver='',
                            supplier='',
                            index='1',
                            totalAmt='1000',
                            income='2000',
                            preAmt='0.01',
                            oilAmt='0.01',
                            destAmt='0.01',
                            lastAmt='0.01',
                            photoAirWay='',
                            content=''):
        '''创建运单'''
        waybillId, tmsBillCode, driver_mobile = ISHaveWaybill(
        ).is_have_wait_departure_waybill(driver=driver)
        # 判断是否存在未发车的运单
        if waybillId != None:
            self.logger.info("存在未发车确认的运单ID:{0}".format(waybillId))
            DepartureConfirmApi().departure_confirm_api(str(waybillId[0]))

        self.input_default_field(project, index, totalAmt, income, preAmt,
                                 oilAmt, destAmt, lastAmt, photoAirWay,
                                 content)
        # 选择司机、车辆
        HeplerWaybill().set_value_select_input(self.driver, "id->realName",
                                               driver)
        # 选择供应商
        HeplerWaybill().set_value_select_input(
            self.driver, 'id->TMS-billModel-supplierName', supplier)
        # 输入有无回单
        self.driver.select('id->TMS-billModel-hasReceipt',
                           "index->{0}".format(index))
        self.submit()

        # 获取创建运单运单号、运单ID
        self.DBUtil = DBUtil(host=self.config['db_host'],
                             port=self.config['db_port'],
                             user=self.config['db_user'],
                             passwd=self.config['db_passwd'],
                             dbname=self.config['db_dbname'],
                             charset=self.config['db_charset'])
        sql1 = 'SELECT airWayBillNo ,tmsBillCode FROM YD_APP_TRANSPORTCASH WHERE mobile = \'{0}\' and billStatus = \'W\' ' \
               'and delStatus = \'0\' and partnerNo = \'{1}\''.format(driver_mobile, self.config['partnerNo'])
        waybillId, tmsBillCode = self.DBUtil.excute_select_one_record(sql1)
        return waybillId, tmsBillCode
Exemplo n.º 8
0
    def create_waybill_submit(self,
                              project='',
                              driver='',
                              supplier='',
                              index='1',
                              totalAmt='1000',
                              income='2000',
                              preAmt='0.01',
                              oilAmt='0.01',
                              destAmt='0.01',
                              lastAmt='0.01',
                              photoAirWay='',
                              content=''):
        '''创建运单'''
        waybillId, tmsBillCode, driver_mobile = ISHaveWaybill(
        ).is_have_wait_departure_waybill(driver=driver)
        # 判断是否存在未发车的运单
        if waybillId != None:
            self.logger.info("已认证外请车存在未发车确认的运单ID:{0}".format(waybillId))
            DepartureConfirmApi().departure_confirm_api(str(waybillId[0]))

        # 创建运单
        self.input_fee_car_waybill(project, driver_mobile, supplier, index,
                                   totalAmt, income, preAmt, oilAmt, destAmt,
                                   lastAmt, photoAirWay, content)
        self.create_waybill_confirm()

        # 获取创建运单运单号、运单ID
        self.DBUtil = DBUtil(host=self.config['db_host'],
                             port=self.config['db_port'],
                             user=self.config['db_user'],
                             passwd=self.config['db_passwd'],
                             dbname=self.config['db_dbname'],
                             charset=self.config['db_charset'])
        sql = 'SELECT airWayBillNo ,tmsBillCode FROM YD_APP_TRANSPORTCASH WHERE mobile = \'{0}\' and billStatus = \'W\' ' \
              'and delStatus = \'0\' and partnerNo = \'{1}\''.format(driver_mobile, self.config['partnerNo'])
        waybillId, tmsBillCode = self.DBUtil.excute_select_one_record(sql)
        return waybillId, tmsBillCode
Exemplo n.º 9
0
    def get_payment_lastAmt_waybill(self, driver='', driverConfirm='1'):
        '''获取尾款支付页面的运单号'''
        try:
            self.login()
            payment_lastAmt_waybillId, payment_lastAmt_tmsBillCode = ISHaveWaybill(
            ).is_have_payment_lastAmt_waybill(driver=driver,
                                              driverConfirm=driverConfirm)[:2]
            payment_arrival_waybillId, payment_arrival_tmsBillCode = ISHaveWaybill(
            ).is_have_payment_arrival_waybill(driver=driver,
                                              driverConfirm=driverConfirm)[:2]
            payment_departure_waybillId, payment_departure_tmsBillCode = ISHaveWaybill(
            ).is_have_payment_departure_waybill(
                driver=driver, driverConfirm=driverConfirm)[:2]
            completed_waybillId, completed_tmsBillCode = ISHaveWaybill(
            ).is_have_completed_waybill(driver=driver)[:2]
            arrived_waybillId, arrived_tmsBillCode = ISHaveWaybill(
            ).is_have_arrived_waybill(driver=driver)[:2]

            if payment_lastAmt_waybillId != None:
                waybillId, tmsBillCode = str(
                    payment_lastAmt_waybillId[0]), str(
                        payment_lastAmt_tmsBillCode[0])
                # 打开运费支付模块
                HeplerWaybill().open_menu(
                    self.driver,
                    'xpath->//*[@id="menu"]/div/nav/ul/li[5]/label/a')
                self.logger.info('待尾款支付的运单编号:{0}'.format(tmsBillCode))
                return waybillId, tmsBillCode

            elif payment_arrival_waybillId != None and completed_waybillId != None and payment_arrival_waybillId == completed_waybillId:
                waybillId, tmsBillCode = str(
                    payment_arrival_waybillId[0]), str(
                        payment_arrival_tmsBillCode[0])
                # 打开运费支付模块
                HeplerWaybill().open_menu(
                    self.driver,
                    'xpath->//*[@id="menu"]/div/nav/ul/li[5]/label/a')
                PagePaymentArrival(
                    self.driver).singlePay_OFFLINE(tmsBillCode=tmsBillCode)
                self.driver.click('id->TMS-toList-')
                self.driver.element_is_not_visible(
                    'class->loading-bar-background')
                self.logger.info(
                    '待到达支付且运单状态为已完成的运单编号:{0}, 到达支付'.format(tmsBillCode))
                return waybillId, tmsBillCode

            elif payment_departure_waybillId != None and completed_waybillId != None and payment_departure_waybillId == completed_waybillId:
                waybillId, tmsBillCode = str(
                    payment_departure_waybillId[0]), str(
                        payment_departure_tmsBillCode[0])
                # 打开运费支付模块
                HeplerWaybill().open_menu(
                    self.driver,
                    'xpath->//*[@id="menu"]/div/nav/ul/li[5]/label/a')
                PagePaymentDeparture(
                    self.driver).singlePay_OFFLINE(tmsBillCode=tmsBillCode)
                self.driver.click('id->TMS-toList-')
                self.driver.element_is_not_visible(
                    'class->loading-bar-background')
                PagePaymentArrival(
                    self.driver).singlePay_OFFLINE(tmsBillCode=tmsBillCode)
                self.driver.click('id->TMS-toList-')
                self.driver.element_is_not_visible(
                    'class->loading-bar-background')
                self.logger.info(
                    '待发车支付且运单状态为已完成的运单编号:{0}, 发车支付&到达支付'.format(tmsBillCode))
                return waybillId, tmsBillCode

            elif payment_departure_waybillId != None and arrived_waybillId != None and payment_departure_waybillId == arrived_waybillId:
                waybillId, tmsBillCode = str(
                    payment_departure_waybillId[0]), str(
                        payment_departure_tmsBillCode[0])
                # 打开运单管理模块
                HeplerWaybill().open_menu(
                    self.driver,
                    'xpath->//*[@id="menu"]/div/nav/ul/li[4]/label/a')
                PageWaybillReceipt(
                    self.driver).receipt_upload(tmsBillCode=tmsBillCode)
                # 打开运费支付模块
                HeplerWaybill().open_menu(
                    self.driver,
                    'xpath->//*[@id="menu"]/div/nav/ul/li[5]/label/a')
                PagePaymentDeparture(
                    self.driver).singlePay_OFFLINE(tmsBillCode=tmsBillCode)
                self.driver.click('id->TMS-toList-')
                self.driver.element_is_not_visible(
                    'class->loading-bar-background')
                PagePaymentArrival(
                    self.driver).singlePay_OFFLINE(tmsBillCode=tmsBillCode)
                self.driver.click('id->TMS-toList-')
                self.driver.element_is_not_visible(
                    'class->loading-bar-background')
                self.logger.info(
                    '待发车支付且运单状态为已已到达的运单编号:{0}, 上传回单&发车支付&到达支付'.format(
                        tmsBillCode))
                return waybillId, tmsBillCode

            else:
                waybillId, tmsBillCode = PageWaybillDeparture(
                    self.driver).get_wait_departure_waybill(driver=driver)
                if driverConfirm == '1':
                    # 司机发车确认
                    DriverConfirmApi().driver_confirm_api(billId=waybillId,
                                                          totalAmt='1000',
                                                          preAmt='0.01',
                                                          oilAmt='0.01',
                                                          destAmt='0.01',
                                                          lastAmt='0.01',
                                                          receiverId='')
                    PageWaybillArrival(
                        self.driver).arrival_confirm(tmsBillCode=tmsBillCode)
                elif driverConfirm == '0':
                    PageWaybillDeparture(
                        self.driver).departure_confirm(tmsBillCode=tmsBillCode)
                    PageWaybillArrival(
                        self.driver).arrival_confirm2(tmsBillCode=tmsBillCode)
                else:
                    self.logger.error(
                        '是否司机发车确认输入参数错误:{0}'.format(driverConfirm))
                PageWaybillReceipt(
                    self.driver).receipt_upload(tmsBillCode=tmsBillCode)
                # 打开运费支付模块
                HeplerWaybill().open_menu(
                    self.driver,
                    'xpath->//*[@id="menu"]/div/nav/ul/li[5]/label/a')
                PagePaymentDeparture(
                    self.driver).singlePay_OFFLINE(tmsBillCode=tmsBillCode)
                self.driver.click('id->TMS-toList-')
                self.driver.element_is_not_visible(
                    'class->loading-bar-background')
                PagePaymentArrival(
                    self.driver).singlePay_OFFLINE(tmsBillCode=tmsBillCode)
                self.driver.click('id->TMS-toList-')
                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
Exemplo n.º 10
0
    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