add(派单任务和管片任务的刷新)
This commit is contained in:
@ -4,7 +4,7 @@ from view.widgets.system_center_dialog import SystemCenterDialog
|
||||
from view.widgets.bottom_control_widget import BottomControlWidget
|
||||
from view.widgets.system_diagnostics_dialog import SystemDiagnosticsDialog
|
||||
from view.widgets.message_popup_widget import MessagePopupWidget
|
||||
|
||||
from view.main_window import MainWindow
|
||||
from service.msg_recorder import MessageRecorder
|
||||
from service.msg_query_thread import MsgQueryThread
|
||||
|
||||
@ -16,7 +16,7 @@ from service.monitor_thread import MonitorThread
|
||||
"""
|
||||
|
||||
class BottomControlController:
|
||||
def __init__(self, bottom_control_widget:BottomControlWidget, main_window):
|
||||
def __init__(self, bottom_control_widget:BottomControlWidget, main_window:MainWindow):
|
||||
self.bottom_control_widget = bottom_control_widget
|
||||
self.main_window = main_window
|
||||
|
||||
@ -25,7 +25,7 @@ class BottomControlController:
|
||||
self.diagnostics_device_row = 0 # 系统诊断弹窗的设备检测行号,从0开始
|
||||
self.diagnostics_device_col = 0 # 系统诊断弹窗的设备检测列号,从0开始
|
||||
self.diagnostics_service_row = 0 # 系统诊断弹窗的服务检测行号,从0开始
|
||||
self.diagnostics_service_col = 2 # 系统诊断弹窗的服务检测行号,从2开始
|
||||
self.diagnostics_service_col = 2 # 系统诊断弹窗的服务检测列号,从2开始
|
||||
|
||||
# 系统中心弹窗
|
||||
self.system_center_dialog = SystemCenterDialog(self.main_window)
|
||||
@ -211,8 +211,17 @@ class BottomControlController:
|
||||
self.system_diagnostics_dialog.set_ms_value(row, col, delay)
|
||||
if delay <= self.device_monitor.warning_delay:
|
||||
self.system_diagnostics_dialog.set_circle_status(row, col, "normal")
|
||||
# 设置上料斗或者下料斗的设备状态(主界面的上料斗、下料斗控件中)
|
||||
if device_name == "上料斗":
|
||||
self.main_window.hopper_widget.setUpperHopperStatus(0)
|
||||
elif device_name == "下料斗":
|
||||
self.main_window.hopper_widget.setLowerHopperStatus(0)
|
||||
else:
|
||||
self.system_diagnostics_dialog.set_circle_status(row, col, "warning")
|
||||
if device_name == "上料斗":
|
||||
self.main_window.hopper_widget.setUpperHopperStatus(1)
|
||||
elif device_name == "下料斗":
|
||||
self.main_window.hopper_widget.setLowerHopperStatus(1)
|
||||
# 显示检测组件
|
||||
self.system_diagnostics_dialog.set_selected_show(row, col)
|
||||
|
||||
@ -225,6 +234,11 @@ class BottomControlController:
|
||||
self.system_diagnostics_dialog.set_circle_status(row, col, "error")
|
||||
# 显示检测组件
|
||||
self.system_diagnostics_dialog.set_selected_show(row, col)
|
||||
# 设置上料斗或者下料斗的设备状态(主界面的上料斗、下料斗控件中)
|
||||
if device_name == "上料斗":
|
||||
self.main_window.hopper_widget.setUpperHopperStatus(2)
|
||||
elif device_name == "下料斗":
|
||||
self.main_window.hopper_widget.setLowerHopperStatus(2)
|
||||
|
||||
def _get_diagnostics_service_row_col(self):
|
||||
"""获取系统诊断弹窗中 服务检测的 行号 和 列号"""
|
||||
|
||||
@ -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) # 关闭,手动派单
|
||||
# 修改系统配置文件中的 派单状态为手动派单...
|
||||
|
||||
Reference in New Issue
Block a user