Skip to content

ui_qml.models.industry_models ​

源文件 ui_qml/models/industry_models.py · 由 scripts/gen_api_docs.py 自动生成,请勿手改

模块说明:

工业制造 — Table Model 类

函数 ​

_fmt_dhms ​

python
def _fmt_dhms(seconds) -> str

把秒格式化为 d/h/m

定义行:9

_remaining ​

python
def _remaining(p: dict, now: datetime | None=None) -> int | None

计划剩余秒(进行中);非进行中/无 started_at 返回 None

定义行:22

_sort_key ​

python
def _sort_key(value)

列排序键:数值(含 bool)按大小、文本按小写,类型混合也不崩。

定义行:29

bound_line_capacity ​

python
def bound_line_capacity(p: dict) -> int

计划行已绑蓝图能覆盖的产线条数。

定义行:42

类 ​

class PlanTableModel(继承 QAbstractTableModel) ​

20 列生产计划模型 — 支持 checkbox、类别、图标、行内编辑、排序

定义行:58

方法 ​

__init__ ​
python
def __init__(self, plans: list[dict])

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:124

toggle_collapse ​
python
def toggle_collapse(self, group_id: int) -> None

切换指定组的折叠状态

定义行:137

beginResetModel ​
python
def beginResetModel(self) -> None

整体重置前丢掉派生视图缓存。

定义行:147

_is_visible ​
python
def _is_visible(self, plan: dict) -> bool

判断行是否可见(未被折叠隐藏)

定义行:156

_is_shared_root_collapsed ​
python
def _is_shared_root_collapsed(self) -> bool

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:169

_visible_plans ​
python
def _visible_plans(self) -> list[dict]

返回过滤后的可见行列表

定义行:172

_has_children ​
python
def _has_children(self, group_id: int) -> bool

判断指定 group 是否有子项(含 -1 共享区)。走缓存,O(1)。

定义行:176

_view_cache ​
python
def _view_cache(self) -> tuple[list[dict], list[int], frozenset[int], bool]

派生视图缓存 → (可见行, 过滤行号→原始行号, 有子项的组号集合, 是否有 -1 共享行)。

定义行:180

_row_map ​
python
def _row_map(self, filtered_row: int) -> int

过滤行号 → 原始行号映射

定义行:211

rowCount ​
python
def rowCount(self, parent=None)

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:218

columnCount ​
python
def columnCount(self, parent=None)

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:223

data ​
python
def data(self, index, role=Qt.ItemDataRole.DisplayRole)

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:231

_line_levels ​
python
def _line_levels(p: dict) -> list[tuple[int, int]]

逐线 ME/TE(与计划级不一致时才有意义);空列表表示按计划级单次计算。

定义行:246

_levels_tooltip ​
python
def _levels_tooltip(self, p: dict) -> str

ME/TE 列 tooltip:各线不一致时逐条列出实际用的等级。

定义行:252

_display_text ​
python
def _display_text(self, p: dict, c: int) -> str

列 0~19 的 DisplayRole 文本

定义行:260

headerData ​
python
def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole)

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:384

flags ​
python
def flags(self, index)

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:395

setData ​
python
def setData(self, index, value, role=Qt.ItemDataRole.EditRole)

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:405

sort ​
python
def sort(self, column: int, order=Qt.SortOrder.AscendingOrder)

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:427

set_plans ​
python
def set_plans(self, plans: list[dict]) -> None

替换所有数据 — 保持同一个 model 实例,避免 setModel 清除选中

定义行:443

get_plan ​
python
def get_plan(self, row: int) -> dict

⚠️ 待补 docstring

此函数暂无 docstring,欢迎补充。

定义行:450

tick ​
python
def tick(self) -> list[int]

倒计时 tick:遍历进行中行算剩余;≤0 内存置 ready;对变动行 emit dataChanged。

定义行:454