add(派单任务和管片任务的刷新)

This commit is contained in:
yaj
2026-03-06 18:33:58 +08:00
parent 37d60ba63e
commit a3b6287808
9 changed files with 393 additions and 42 deletions

View File

@ -80,6 +80,11 @@ class MainController:
self.opc_client.opc_signal.opc_log.connect(self.msg_recorder.normal_record, Qt.QueuedConnection) # opcua客户端日志
# 主界面的计划表单自动派单控制
self.main_window.plan_table_widget.auto_dispatch_signal.connect(self.handlePlanTableAutoDispatch) # 计划表单的自动派单切换
# 主界面的计划表单中的计划方量修改控制
self.main_window.plan_volume_modified_signal.connect(self.handleVolumeModified) # 计划方量修改
def handleMainWindowClose(self):
"""主界面关闭"""
@ -92,6 +97,19 @@ class MainController:
if hasattr(self, 'opc_client'):
self.opc_client.stop_run()
def handlePlanTableAutoDispatch(self, auto_status:bool):
"""处理计划表单的 自动派单和手动派单的切换
pd_mode: 1,自动派单 2,手动派单
"""
if auto_status: # 自动派单
self.opc_client.write_value_by_name("pd_mode", 1)
else: # 手动派单
self.opc_client.write_value_by_name("pd_mode", 2)
def handleVolumeModified(self, volume_json_str:str):
"""处理 修改方量 (计划表单中 和 派单详情中)"""
self.opc_client.write_value_by_name("pd_plan_volume", volume_json_str)
def start_msg_database_clean_task(self):
"""启动清理消息数据库(messages.db)中过期消息的定时任务"""
from PySide6.QtCore import QTimer, QDateTime, QDate, QTime
@ -239,4 +257,35 @@ class MainController:
def _update_vibration_frequency(self, val):
# 更新振捣频率
self.main_window.frequency_button_group.set_selected_frequency(val)
self.main_window.frequency_button_group.set_selected_frequency(val) # 频率选择按钮上显示的选中的频率
self.main_window.arc_progress.setFrequency(val) # 模具车上显示的振捣频率
def _update_mould_vibrate_status(self, vibrate_status:bool):
# 更新模具车上显示的振捣状态
# vibrate_status: False:未振捣、True:振捣中
if vibrate_status:
self.main_window.arc_progress.setState("振捣中")
else:
self.main_window.arc_progress.setState("未振捣")
self.opc_client.write_value_by_name("vibration_frequency", 0) # 将振捣频率设置为0
def _update_mould_finish_weight(self, finish_weight:int):
# 更新模具车中的下料重量
# finish_weight已下料重量
self.main_window.arc_progress.setWeight(finish_weight)
def _update_pd_mode(self, mode:int):
# 更新计划表单中的 派单模式(主界面下发状态的下面的切换开关),自动派单/手动派单
mode_mapping = {
1: "自动派单",
2: "手动派单",
0: None # 未知
}
mode_text = mode_mapping.get(mode)
if mode_text == "自动派单":
# 设置主界面下发状态的下面的切换开关
self.main_window.plan_table_widget.set_auto_dispatch(True) # 开启,自动派单
# 修改系统配置文件中的 派单状态为自动派单...
else:
self.main_window.plan_table_widget.set_auto_dispatch(False) # 关闭,手动派单
# 修改系统配置文件中的 派单状态为手动派单...