# -*- 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 StorageOccupyRecord(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_storage_occupy_record(self):
        self.iframe.out_frame()
        self.menu.open_menu(first_menu, self.third_menu)

    @allure.step('查询：{}'.format(third_menu))
    def storage_occupy_record_search(self, tap_name='库存占用', field='订单号', text=None, count=1):
        """
        param tap_name: 库存占用、序列号占用、库存占用历史、序列号占用历史
        """
        self.menu.click("//a[text()='展开 ']")
        self.list_page.order_search(self.third_menu, tap_name, field, text, count)
