add(设备检测、读取管片任务、opcua客户端)
This commit is contained in:
27
service/artifact_query_thread.py
Normal file
27
service/artifact_query_thread.py
Normal file
@ -0,0 +1,27 @@
|
||||
from PySide6.QtWidgets import QWidget
|
||||
from PySide6.QtCore import QThread, Signal # 只需要导入QThread和Signal即可
|
||||
from typing import List
|
||||
from busisness.blls import ArtifactBll
|
||||
from busisness.models import ArtifactInfoModel
|
||||
|
||||
class ArtifactInfoQueryThread(QThread):
|
||||
# 定义信号:子线程查询完成
|
||||
query_finished = Signal(List[ArtifactInfoModel])
|
||||
# 定义信号:发送错误信息
|
||||
query_error = Signal(str)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
artifact_dal = ArtifactBll()
|
||||
artifacts = artifact_dal.get_artifact_task()
|
||||
|
||||
if artifacts:
|
||||
# 查询完成,发射信号
|
||||
self.query_finished.emit(artifacts)
|
||||
else:
|
||||
raise ValueError("未查询到有效数据")
|
||||
except Exception as e:
|
||||
self.query_error.emit(f"更新管片任务数据失败: {str(e)}")
|
||||
Reference in New Issue
Block a user