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

    @allure.step('查询：{}-批次库存'.format(third_menu))
    def available_storage_batch_search(self, tap_name='批次库存', field='批次/序列', text=None, count=1):
        self.list_page.order_search(self.third_menu, tap_name, field, text, count)

    @allure.step('查询：{}-商品库存'.format(third_menu))
    def available_storage_good_search(self, tap_name='商品库存', field=None, text=None, count=1):
        field = ['仓库编码', '商品编码'] if field is None else field
        self.list_page.order_search(self.third_menu, tap_name, field, text, count)
