diff --git a/sf_machine_connect/models/ftp_client.py b/sf_machine_connect/models/ftp_client.py
index 2cc1ee5d..ec46d620 100644
--- a/sf_machine_connect/models/ftp_client.py
+++ b/sf_machine_connect/models/ftp_client.py
@@ -123,128 +123,161 @@ class Machine_ftp(models.Model):
# workorder_ids = fields.One2many('mrp.workorder', 'machine_tool_id', string='工单')
- # 机床配置项目
- # ftp相关
- ftp_num = fields.Char('ftp账号')
- ftp_pwd = fields.Char('ftp密码')
- ftp_host = fields.Char('ftp地址')
- ftp_port = fields.Integer('ftp端口')
- ftp_remote_path = fields.Char('机床ftp路径')
- # 补偿值写入相关
- x_compensation_node = fields.Char('x补偿值节点')
- y_compensation_node = fields.Char('y补偿值节点')
- # 数采配置相关
- machine_ip = fields.Char('机床IP')
- machine_signed = fields.Char('机床刷新间隔')
- machine_status = fields.Char('机床在线状态')
- machine_cnc_type = fields.Char('机床CNC型号')
- machine_axis_count = fields.Char('机床轴总数')
- machine_run_status = fields.Char('机床运行状态')
- machine_emg_status = fields.Char('机床急停状态')
- machine_cut_status = fields.Char('机床当前切削状态')
- machine_mode = fields.Char('机床当前操作模式')
- machine_spindle_load = fields.Char('机床主轴负载')
- machine_x_mach = fields.Char('机床X轴机械坐标')
- machine_x_abs_mach = fields.Char('机床X轴当前位置')
- machine_x_rel_mach = fields.Char('机床X轴相对工件坐标')
- machine_x_dis_mach = fields.Char('机床X轴目标距离')
- machine_x_axis_load = fields.Char('机床X轴伺服轴负载')
- machine_y_mach = fields.Char('机床Y轴机械坐标')
- machine_y_abs_mach = fields.Char('机床Y轴当前位置')
- machine_y_rel_mach = fields.Char('机床Y轴相对工件坐标')
- machine_y_dis_mach = fields.Char('机床Y轴目标距离')
- machine_y_axis_load = fields.Char('机床Y轴伺服轴负载')
- machine_z_mach = fields.Char('机床Z轴机械坐标')
- machine_z_abs_mach = fields.Char('机床Z轴当前位置')
- machine_z_rel_mach = fields.Char('机床Z轴相对工件坐标')
- machine_z_dis_mach = fields.Char('机床Z轴目标距离')
- machine_z_axis_load = fields.Char('机床Z轴伺服轴负载')
- machine_tool_num = fields.Char('机床当前刀位号')
- machine_program = fields.Char('机床主程序名称')
- machine_current_prg = fields.Char('机床当前执行指令')
- machine_prg_seq = fields.Char('机床当前执行语句号')
- machine_spindle_speed_set = fields.Char('机床设定主轴速度')
- machine_act_spindle_speed = fields.Char('机床实际主轴转速')
- machine_feed_speed_set = fields.Char('机床设定进给速度')
- machine_act_feed_speed = fields.Char('机床实际进给速度')
- machine_spindle_feed = fields.Char('机床主轴倍率')
- machine_feed_rate = fields.Char('机床进给倍率')
- machine_rapid_feed = fields.Char('机床快速移动倍率')
- machine_run_time = fields.Char('机床运行时间')
- machine_cut_time = fields.Char('机床切削时间')
- machine_keep_alive_time = fields.Char('机床上电时间')
- machine_circle_time = fields.Char('机床循环时间')
- machine_product_counts = fields.Char('机床加工件数')
- machine_system_date = fields.Char('机床系统日期')
- machine_system_time = fields.Char('机床系统时间')
- machine_alarm_msg = fields.Char('机床系统报警')
+ # # 机床配置项目
+ # # ftp相关
+ # ftp_num = fields.Char('ftp账号')
+ # ftp_pwd = fields.Char('ftp密码')
+ # ftp_host = fields.Char('ftp地址')
+ # ftp_port = fields.Integer('ftp端口')
+ # ftp_remote_path = fields.Char('机床ftp路径')
+ # # 补偿值写入相关
+ # x_compensation_node = fields.Char('x补偿值节点')
+ # y_compensation_node = fields.Char('y补偿值节点')
+ # # 数采配置相关
+ # machine_ip = fields.Char('机床IP')
+ # machine_signed = fields.Char('机床刷新间隔')
+ # machine_status = fields.Char('机床在线状态')
+ # machine_cnc_type = fields.Char('机床CNC型号')
+ # machine_axis_count = fields.Char('机床轴总数')
+ # machine_run_status = fields.Char('机床运行状态')
+ # machine_emg_status = fields.Char('机床急停状态')
+ # machine_cut_status = fields.Char('机床当前切削状态')
+ # machine_mode = fields.Char('机床当前操作模式')
+ # machine_spindle_load = fields.Char('机床主轴负载')
+ # machine_x_mach = fields.Char('机床X轴机械坐标')
+ # machine_x_abs_mach = fields.Char('机床X轴当前位置')
+ # machine_x_rel_mach = fields.Char('机床X轴相对工件坐标')
+ # machine_x_dis_mach = fields.Char('机床X轴目标距离')
+ # machine_x_axis_load = fields.Char('机床X轴伺服轴负载')
+ # machine_y_mach = fields.Char('机床Y轴机械坐标')
+ # machine_y_abs_mach = fields.Char('机床Y轴当前位置')
+ # machine_y_rel_mach = fields.Char('机床Y轴相对工件坐标')
+ # machine_y_dis_mach = fields.Char('机床Y轴目标距离')
+ # machine_y_axis_load = fields.Char('机床Y轴伺服轴负载')
+ # machine_z_mach = fields.Char('机床Z轴机械坐标')
+ # machine_z_abs_mach = fields.Char('机床Z轴当前位置')
+ # machine_z_rel_mach = fields.Char('机床Z轴相对工件坐标')
+ # machine_z_dis_mach = fields.Char('机床Z轴目标距离')
+ # machine_z_axis_load = fields.Char('机床Z轴伺服轴负载')
+ # machine_tool_num = fields.Char('机床当前刀位号')
+ # machine_program = fields.Char('机床主程序名称')
+ # machine_current_prg = fields.Char('机床当前执行指令')
+ # machine_prg_seq = fields.Char('机床当前执行语句号')
+ # machine_spindle_speed_set = fields.Char('机床设定主轴速度')
+ # machine_act_spindle_speed = fields.Char('机床实际主轴转速')
+ # machine_feed_speed_set = fields.Char('机床设定进给速度')
+ # machine_act_feed_speed = fields.Char('机床实际进给速度')
+ # machine_spindle_feed = fields.Char('机床主轴倍率')
+ # machine_feed_rate = fields.Char('机床进给倍率')
+ # machine_rapid_feed = fields.Char('机床快速移动倍率')
+ # machine_run_time = fields.Char('机床运行时间')
+ # machine_cut_time = fields.Char('机床切削时间')
+ # machine_keep_alive_time = fields.Char('机床上电时间')
+ # machine_circle_time = fields.Char('机床循环时间')
+ # machine_product_counts = fields.Char('机床加工件数')
+ # machine_system_date = fields.Char('机床系统日期')
+ # machine_system_time = fields.Char('机床系统时间')
+ # machine_alarm_msg = fields.Char('机床系统报警')
- # 刀位配置
- tool_num1 = fields.Char('刀位1')
- tool_num2 = fields.Char('刀位2')
- tool_num3 = fields.Char('刀位3')
- tool_num4 = fields.Char('刀位4')
- tool_num5 = fields.Char('刀位5')
- tool_num6 = fields.Char('刀位6')
- tool_num7 = fields.Char('刀位7')
- tool_num8 = fields.Char('刀位8')
- tool_num9 = fields.Char('刀位9')
- tool_num10 = fields.Char('刀位10')
- tool_num11 = fields.Char('刀位11')
- tool_num12 = fields.Char('刀位12')
- tool_num13 = fields.Char('刀位13')
- tool_num14 = fields.Char('刀位14')
- tool_num15 = fields.Char('刀位15')
- tool_num16 = fields.Char('刀位16')
- tool_num17 = fields.Char('刀位17')
- tool_num18 = fields.Char('刀位18')
- tool_num19 = fields.Char('刀位19')
- tool_num20 = fields.Char('刀位20')
- tool_num21 = fields.Char('刀位21')
- tool_num22 = fields.Char('刀位22')
- tool_num23 = fields.Char('刀位23')
- tool_num24 = fields.Char('刀位24')
+ # # 刀位配置
+ # tool_num1 = fields.Char('刀位1')
+ # tool_num2 = fields.Char('刀位2')
+ # tool_num3 = fields.Char('刀位3')
+ # tool_num4 = fields.Char('刀位4')
+ # tool_num5 = fields.Char('刀位5')
+ # tool_num6 = fields.Char('刀位6')
+ # tool_num7 = fields.Char('刀位7')
+ # tool_num8 = fields.Char('刀位8')
+ # tool_num9 = fields.Char('刀位9')
+ # tool_num10 = fields.Char('刀位10')
+ # tool_num11 = fields.Char('刀位11')
+ # tool_num12 = fields.Char('刀位12')
+ # tool_num13 = fields.Char('刀位13')
+ # tool_num14 = fields.Char('刀位14')
+ # tool_num15 = fields.Char('刀位15')
+ # tool_num16 = fields.Char('刀位16')
+ # tool_num17 = fields.Char('刀位17')
+ # tool_num18 = fields.Char('刀位18')
+ # tool_num19 = fields.Char('刀位19')
+ # tool_num20 = fields.Char('刀位20')
+ # tool_num21 = fields.Char('刀位21')
+ # tool_num22 = fields.Char('刀位22')
+ # tool_num23 = fields.Char('刀位23')
+ # tool_num24 = fields.Char('刀位24')
# 机床采集项目
timestamp = fields.Datetime('时间戳', readonly=True)
- signed = fields.Integer('刷新间隔', readonly=True)
- status = fields.Boolean('在线状态', readonly=True)
- time_on = fields.Char('总在线时长', readonly=True)
- time_on_now = fields.Char('本次在线时长', readonly=True)
- tool_num = fields.Integer('当前刀具', readonly=True)
- program = fields.Char('当前程序', readonly=True)
- run_status = fields.Selection([('0', '空闲中'), ('1', '加工中'), ('2', '加工中'), ('3', '加工中')], string='运行状态',
+ status = fields.Boolean('机床在线状态', readonly=True)
+ run_status = fields.Selection([('0', '空闲中'), ('1', '加工中'), ('2', '加工中'), ('3', '加工中')], string='机床运行状态',
readonly=True, default='0')
- run_time = fields.Char('总运行时长', readonly=True)
- cut_time = fields.Char('总切削时长', readonly=True)
- cut_status = fields.Selection([('0', '未切削'), ('1', '切削中'), ('2', '切削中'), ('3', '切削中')], string='切削状态',
- readonly=True, default='0')
- spindle_speed = fields.Char('主轴转速', readonly=True)
+ run_time = fields.Char('机床累计运行时长', readonly=True)
+ # 机床系统日期
+ system_date = fields.Char('机床系统日期', readonly=True)
+ # 机床系统时间
+ system_time = fields.Char('机床系统时间', readonly=True)
- tool_num_process_time1 = fields.Char('刀位1', readonly=True, default='0')
- tool_num_process_time2 = fields.Char('刀位2', readonly=True, default='0')
- tool_num_process_time3 = fields.Char('刀位3', readonly=True, default='0')
- tool_num_process_time4 = fields.Char('刀位4', readonly=True, default='0')
- tool_num_process_time5 = fields.Char('刀位5', readonly=True, default='0')
- tool_num_process_time6 = fields.Char('刀位6', readonly=True, default='0')
- tool_num_process_time7 = fields.Char('刀位7', readonly=True, default='0')
- tool_num_process_time8 = fields.Char('刀位8', readonly=True, default='0')
- tool_num_process_time9 = fields.Char('刀位9', readonly=True, default='0')
- tool_num_process_time10 = fields.Char('刀位10', readonly=True, default='0')
- tool_num_process_time11 = fields.Char('刀位11', readonly=True, default='0')
- tool_num_process_time12 = fields.Char('刀位12', readonly=True, default='0')
- tool_num_process_time13 = fields.Char('刀位13', readonly=True, default='0')
- tool_num_process_time14 = fields.Char('刀位14', readonly=True, default='0')
- tool_num_process_time15 = fields.Char('刀位15', readonly=True, default='0')
- tool_num_process_time16 = fields.Char('刀位16', readonly=True, default='0')
- tool_num_process_time17 = fields.Char('刀位17', readonly=True, default='0')
- tool_num_process_time18 = fields.Char('刀位18', readonly=True, default='0')
- tool_num_process_time19 = fields.Char('刀位19', readonly=True, default='0')
- tool_num_process_time20 = fields.Char('刀位20', readonly=True, default='0')
- tool_num_process_time21 = fields.Char('刀位21', readonly=True, default='0')
- tool_num_process_time22 = fields.Char('刀位22', readonly=True, default='0')
- tool_num_process_time23 = fields.Char('刀位23', readonly=True, default='0')
- tool_num_process_time24 = fields.Char('刀位24', readonly=True, default='0')
+ cut_time = fields.Char('机床累计切削时间', readonly=True)
+ cut_status = fields.Selection([('0', '未切削'), ('1', '切削中'), ('2', '切削中'), ('3', '切削中')], string='机床当前切削状态',
+ readonly=True, default='0')
+ # 当前程序名
+
+ program = fields.Char('机床当前程序', readonly=True)
+
+ # 当前刀具号
+ tool_num = fields.Integer('机床当前刀具号', readonly=True)
+
+ # 机床通电开机时间, 机床加工件数, 机床当前操作模式, 开始加工时间, 结束加工时间, 加工程序开始时间, 加工程序结束时间, 待机开始时间,
+ # 待机结束时间, 机床离线开始时间, 机床离线结束时间, 机床急停状态, 机床主程序名称, 程序运行的状态, 机床当前执行指令, 机床当前执行语句号
+ # 机床X轴当前位置, 机床Y轴当前位置, 机床Z轴当前位置
+ machine_power_on_time = fields.Char('机床通电开机时间', readonly=True)
+ product_counts = fields.Char('机床加工件数', readonly=True)
+ mode = fields.Char('机床当前操作模式', readonly=True)
+ start_time = fields.Char('开始加工时间', readonly=True)
+ end_time = fields.Char('结束加工时间', readonly=True)
+ program_start_time = fields.Char('加工程序开始时间', readonly=True)
+ program_end_time = fields.Char('加工程序结束时间', readonly=True)
+ standby_start_time = fields.Char('待机开始时间', readonly=True)
+ standby_end_time = fields.Char('待机结束时间', readonly=True)
+ offline_start_time = fields.Char('机床离线开始时间', readonly=True)
+ offline_end_time = fields.Char('机床离线结束时间', readonly=True)
+ emg_status = fields.Char('机床急停状态', readonly=True)
+ program_name = fields.Char('机床主程序名称', readonly=True)
+ program_status = fields.Char('程序运行状态', readonly=True)
+ current_program = fields.Char('机床当前执行指令', readonly=True)
+ current_program_seq = fields.Char('机床当前执行语句号', readonly=True)
+ x_abs_pos = fields.Char('机床X轴当前位置', readonly=True)
+ y_abs_pos = fields.Char('机床Y轴当前位置', readonly=True)
+ z_abs_pos = fields.Char('机床Z轴当前位置', readonly=True)
+
+ # 机床设定进给速度, 机床实际进给速度, 机床设定主轴转速, 机床实际主轴转速, 机床主轴负载, 机床X轴伺服轴负载, 机床Y轴伺服轴负载
+ # 机床Z轴伺服轴负载, 机床快速移动倍率, 机床进给倍率, 机床X轴机械坐标, 机床Y轴机械坐标, 机床Z轴机械坐标, 机床X轴相对工件坐标
+ # 机床Y轴相对工件坐标, 机床Z轴相对工件坐标, 机床X轴目标距离, 机床Y轴目标距离, 机床Z轴目标距离
+ feed_speed_set = fields.Char('机床设定进给速度', readonly=True)
+ act_feed_speed = fields.Char('机床实际进给速度', readonly=True)
+ spindle_speed_set = fields.Char('机床设定主轴转速', readonly=True)
+ act_spindle_speed = fields.Char('机床实际主轴转速', readonly=True)
+ spindle_load = fields.Char('机床主轴负载', readonly=True)
+ x_axis_load = fields.Char('机床X轴伺服轴负载', readonly=True)
+ y_axis_load = fields.Char('机床Y轴伺服轴负载', readonly=True)
+ z_axis_load = fields.Char('机床Z轴伺服轴负载', readonly=True)
+ rapid_feed = fields.Char('机床快速移动倍率', readonly=True)
+ feed_rate = fields.Char('机床进给倍率', readonly=True)
+ x_mach_coord = fields.Char('机床X轴机械坐标', readonly=True)
+ y_mach_coord = fields.Char('机床Y轴机械坐标', readonly=True)
+ z_mach_coord = fields.Char('机床Z轴机械坐标', readonly=True)
+ x_rel_coord = fields.Char('机床X轴相对工件坐标', readonly=True)
+ y_rel_coord = fields.Char('机床Y轴相对工件坐标', readonly=True)
+ z_rel_coord = fields.Char('机床Z轴相对工件坐标', readonly=True)
+ x_dis_coord = fields.Char('机床X轴目标距离', readonly=True)
+ y_dis_coord = fields.Char('机床Y轴目标距离', readonly=True)
+ z_dis_coord = fields.Char('机床Z轴目标距离', readonly=True)
+
+ # 故障报警时间, 故障报警信息, 故障消除时间(复原时间)
+ alarm_time = fields.Char('故障报警时间', readonly=True)
+ alarm_msg = fields.Char('故障报警信息', readonly=True)
+ clear_time = fields.Char('故障消除时间(复原时间)', readonly=True)
+
+ # 当前程序名, 机床累计运行时间, 机床系统日期, 机床系统时间, 当前刀具号, 机床循环时间
class WorkCenterBarcode(models.Model):
@@ -259,39 +292,59 @@ class WorkCenterBarcode(models.Model):
button_compensation_state = fields.Boolean(string='是否已经补偿', readonly=True)
button_up_all_state = fields.Boolean(string='是否已经全部下发', readonly=True)
machine_tool_id = fields.Many2one('sf.machine_tool.type', string='机床')
- machine_tool_name = fields.Char(string='机床名称', default='未知机床', compute='_run_info', readonly=True)
- machine_tool_type_id = fields.Char(string='机床型号', default='未知型号', compute='_run_info', readonly=True)
- machine_tool_status = fields.Boolean(string='在线状态', compute='_run_info', readonly=True)
+ # machine_tool_name = fields.Char(string='机床名称', default='未知机床', compute='_run_info', readonly=True)
+ # machine_tool_type_id = fields.Char(string='机床型号', default='未知型号', compute='_run_info', readonly=True)
+ # machine_tool_status = fields.Boolean(string='在线状态', compute='_run_info', readonly=True)
+ # machine_tool_run_status = fields.Selection([('0', '关机中'), ('1', '加工中'), ('2', '加工中'), ('3', '加工中')],
+ # string='运行状态', compute='_run_info', readonly=True, default='0')
+ # machine_tool_timestamp = fields.Datetime('时间戳', compute='_run_info', readonly=True)
+ # machine_tool_time_on = fields.Char('总在线时长', compute='_run_info', readonly=True)
+ # machine_tool_time_on_now = fields.Char('本次在线时长', compute='_run_info', readonly=True)
+ # machine_tool_tool_num = fields.Integer('当前刀具', compute='_run_info', readonly=True)
+ # machine_tool_program = fields.Char('当前程序', compute='_run_info', readonly=True)
+ # machine_tool_machine_ip = fields.Char('机床IP', compute='_run_info', readonly=True)
+ # machine_tool_cut_status = fields.Selection([('0', '未切削'), ('1', '切削中'), ('2', '切削中'), ('3', '切削中')],
+ # string='切削状态', compute='_run_info', readonly=True, default='0')
+ # machine_tool_compensation_value_x = fields.Char('x补偿值', compute='_run_info', readonly=True)
+ # machine_tool_compensation_value_y = fields.Char('y补偿值', compute='_run_info', readonly=True)
+
+ machine_tool_name = fields.Char(string='机床名称', default='未知机床', readonly=True)
+ machine_tool_type_id = fields.Char(string='机床型号', default='未知型号', readonly=True)
+ machine_tool_status = fields.Boolean(string='在线状态', readonly=True)
machine_tool_run_status = fields.Selection([('0', '关机中'), ('1', '加工中'), ('2', '加工中'), ('3', '加工中')],
- string='运行状态', compute='_run_info', readonly=True, default='0')
- machine_tool_timestamp = fields.Datetime('时间戳', compute='_run_info', readonly=True)
- machine_tool_time_on = fields.Char('总在线时长', compute='_run_info', readonly=True)
- machine_tool_time_on_now = fields.Char('本次在线时长', compute='_run_info', readonly=True)
- machine_tool_tool_num = fields.Integer('当前刀具', compute='_run_info', readonly=True)
- machine_tool_program = fields.Char('当前程序', compute='_run_info', readonly=True)
- machine_tool_machine_ip = fields.Char('机床IP', compute='_run_info', readonly=True)
+ string='运行状态', readonly=True, default='0')
+ machine_tool_timestamp = fields.Datetime('时间戳', readonly=True)
+ machine_tool_time_on = fields.Char('总在线时长', readonly=True)
+ machine_tool_time_on_now = fields.Char('本次在线时长', readonly=True)
+ machine_tool_tool_num = fields.Integer('当前刀具', readonly=True)
+ machine_tool_program = fields.Char('当前程序', readonly=True)
+ machine_tool_machine_ip = fields.Char('机床IP', readonly=True)
machine_tool_cut_status = fields.Selection([('0', '未切削'), ('1', '切削中'), ('2', '切削中'), ('3', '切削中')],
- string='切削状态', compute='_run_info', readonly=True, default='0')
- machine_tool_compensation_value_x = fields.Char('x补偿值', compute='_run_info', readonly=True)
- machine_tool_compensation_value_y = fields.Char('y补偿值', compute='_run_info', readonly=True)
+ string='切削状态', readonly=True, default='0')
+ machine_tool_compensation_value_x = fields.Char('x补偿值', readonly=True)
+ machine_tool_compensation_value_y = fields.Char('y补偿值', readonly=True)
+
+ # 工单状态
+
delivery_records = fields.One2many('delivery.record', 'workorder_id', string="下发记录")
@api.depends('equipment_id.timestamp')
def _run_info(self):
# self.machine_tool_name = '1号机床'
- self.machine_tool_name = self.equipment_id.name
- self.machine_tool_type_id = self.equipment_id.type_id.name
- self.machine_tool_status = self.equipment_id.status
- self.machine_tool_run_status = self.equipment_id.run_status
- self.machine_tool_timestamp = self.equipment_id.timestamp
- self.machine_tool_time_on = self.equipment_id.time_on
- self.machine_tool_time_on_now = self.equipment_id.time_on_now
- self.machine_tool_tool_num = self.equipment_id.tool_num
- self.machine_tool_program = self.equipment_id.program
- self.machine_tool_machine_ip = self.equipment_id.machine_ip
- self.machine_tool_cut_status = self.equipment_id.cut_status
- self.machine_tool_compensation_value_x = self.compensation_value_x
- self.machine_tool_compensation_value_y = self.compensation_value_y
+ # self.machine_tool_name = self.equipment_id.name
+ # self.machine_tool_type_id = self.equipment_id.type_id.name
+ # self.machine_tool_status = self.equipment_id.status
+ # self.machine_tool_run_status = self.equipment_id.run_status
+ # self.machine_tool_timestamp = self.equipment_id.timestamp
+ # self.machine_tool_time_on = self.equipment_id.time_on
+ # self.machine_tool_time_on_now = self.equipment_id.time_on_now
+ # self.machine_tool_tool_num = self.equipment_id.tool_num
+ # self.machine_tool_program = self.equipment_id.program
+ # self.machine_tool_machine_ip = self.equipment_id.machine_ip
+ # self.machine_tool_cut_status = self.equipment_id.cut_status
+ # self.machine_tool_compensation_value_x = self.compensation_value_x
+ # self.machine_tool_compensation_value_y = self.compensation_value_y
+ pass
def compensation(self):
diff --git a/sf_machine_connect/views/machine_monitor.xml b/sf_machine_connect/views/machine_monitor.xml
index d52bead8..c6964659 100644
--- a/sf_machine_connect/views/machine_monitor.xml
+++ b/sf_machine_connect/views/machine_monitor.xml
@@ -13,294 +13,138 @@
-
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 9ccbaea6..960d4b14 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -34,8 +34,9 @@ class MrpProduction(models.Model):
@api.depends('workorder_ids.tool_state')
def _compute_tool_state(self):
+ # if self.workorder_ids:
for item in self:
- if item:
+ if item.workorder_ids:
workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
if workorder_ids.filtered(lambda a: a.tool_state == '2'):
item.tool_state = '2'
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index ee212b2a..79d7f2c6 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -416,19 +416,19 @@ class ShelfLocation(models.Model):
host = printer_config.printer_id.ip_address
port = printer_config.printer_id.port
self.print_qr_code(barcode, host, port)
- # 获取当前wizard的视图ID或其他标识信息
- view_id = self.env.context.get('view_id')
- # 构造返回wizard页面的action字典
- action = {
- 'type': 'ir.actions.act_window',
- 'name': '返回 Wizard',
- 'res_model': 'sf.shelf', # 替换为你的wizard模型名称
- 'view_mode': 'form',
- 'view_id': view_id, # 如果需要基于特定的视图返回
- 'target': 'new', # 如果需要在新的窗口或标签页打开
- 'res_id': self.shelf_id, # 如果你想要返回当前记录的视图
- }
- return action
+ # # 获取当前wizard的视图ID或其他标识信息
+ # view_id = self.env.context.get('view_id')
+ # # 构造返回wizard页面的action字典
+ # action = {
+ # 'type': 'ir.actions.act_window',
+ # 'name': '返回 Wizard',
+ # 'res_model': 'sf.shelf', # 替换为你的wizard模型名称
+ # 'view_mode': 'form',
+ # 'view_id': view_id, # 如果需要基于特定的视图返回
+ # 'target': 'new', # 如果需要在新的窗口或标签页打开
+ # 'res_id': self.shelf_id, # 如果你想要返回当前记录的视图
+ # }
+ # return action
# # 仓库类别(selection:库区、库位、货位)
# location_type = fields.Selection([