# -*- coding:utf-8 -*-
# 作者：齐振鋆
# 日期：2023/3/12
# 描述: 序列号库存
import logging
import allure

from component.GuKeYiTiHua import iframe, list_page, menu, button, order_detail_table
from component.GuKeYiTiHua.StorageManage import first_menu

log = logging.getLogger(__name__)


class SerialStorage(object):
    third_menu = '序列号库存'

    def __init__(self):
        self.iframe = iframe
        self.menu = menu
        self.list_page = list_page
        self.button = button

    @allure.step('打开菜单：{}'.format(third_menu))
    def open_menu_serial_storage(self):
        self.iframe.out_frame()
        self.menu.open_menu(first_menu, self.third_menu)

    @allure.step('查询：{}'.format(third_menu))
    def serial_storage_search(self, tap_name=None, field='订单号', text=None, count=1):
        self.iframe.to_main_iframe()
        self.menu.click("//a[text()='展开 ']")
        self.list_page.order_search(self.third_menu, tap_name, field, text, count)
