ui_qml.models.inventory_helpers
源文件
ui_qml/models/inventory_helpers.py· 由scripts/gen_api_docs.py自动生成,请勿手改
模块说明:
仓库页面 — 公共数据模型和常量
包含 InvTableModel 和 BlueprintTableModel。
函数
item_gap
def item_gap(row: dict) -> int缺口 = max(0, 规划占用 − 库存数量)。纯函数。
定义行:22
item_locked_isk
def item_locked_isk(row: dict) -> float占用资金 = 单个成本记录 × 库存数量(成本价缺失/为 0 → 0)。纯函数。
定义行:27
price_unreliable
def price_unreliable(row: dict) -> bool这一行的卖单价是否有价但立不住(三态里的 False;无价 None 不算)。纯函数。
定义行:41
price_credible_text
def price_credible_text(row: dict) -> str「估值可信」列的显示串:无价 → -,不可信 → 警示,可信 → 可。
定义行:49
blueprint_run_profit
def blueprint_run_profit(row: dict) -> float | None每流程利润 = 销售收入 − 材料成本(任一侧缺失 → None)。
定义行:61
_profit_sort_key
def _profit_sort_key(row: dict) -> float「每流程利润」的排序键:缺失沉底(与「利润率」列同口径)。
定义行:74
类
class InvTableModel(继承 QAbstractTableModel)
机库物品表格模型
定义行:85
方法
__init__
def __init__(self, items: list[dict])⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:101
rowCount
def rowCount(self, parent=None)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:109
columnCount
def columnCount(self, parent=None)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:112
data
def data(self, index, role=Qt.ItemDataRole.DisplayRole)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:115
headerData
def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:176
item_at
def item_at(self, row: int) -> dict | None⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:181
sort
def sort(self, column: int, order=Qt.SortOrder.AscendingOrder)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:184
_sort_key
def _sort_key(self, column: int) -> Callable[[dict], Any] | None列的排序键(纯函数、不碰状态)。None = 该列不可排。
定义行:194
reapply_sort
def reapply_sort(self) -> None按当前排序设置重排 self._items。
定义行:208
class BlueprintTableModel(继承 QAbstractTableModel)
蓝图表格模型
定义行:232
方法
__init__
def __init__(self, rows: list[dict])⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:251
rowCount
def rowCount(self, parent=None)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:258
columnCount
def columnCount(self, parent=None)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:261
data
def data(self, index, role=Qt.ItemDataRole.DisplayRole)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:264
headerData
def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:348
row_at
def row_at(self, row: int) -> dict | None⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:353
sort
def sort(self, column: int, order=Qt.SortOrder.AscendingOrder)⚠️ 待补 docstring
此函数暂无 docstring,欢迎补充。
定义行:356
_sort_key
def _sort_key(self, column: int) -> Callable[[dict], Any] | None列的排序键(纯函数、不碰状态)。None = 该列不可排。
定义行:366
reapply_sort
def reapply_sort(self) -> None按当前排序设置重排 self._rows。
定义行:385