diff --git a/sf_maintenance/models/sf_maintenance_oee.py b/sf_maintenance/models/sf_maintenance_oee.py index 6d76ffbe..6e8db042 100644 --- a/sf_maintenance/models/sf_maintenance_oee.py +++ b/sf_maintenance/models/sf_maintenance_oee.py @@ -7,20 +7,23 @@ class SfMaintenanceEquipmentOEE(models.Model): _description = '设备OEE' name = fields.Char('设备oee') - equipment_id = fields.Many2one('maintenance.equipment', '设备', + equipment_id = fields.Many2one('maintenance.equipment', '机台号', domain="[('category_id.equipment_type', '=', '机床'),('state_zc', '=', '已注册')]") type_id = fields.Many2one('sf.machine_tool.type', '型号', related='equipment_id.type_id') - machine_tool_picture = fields.Binary('设备图片', related='equipment_id.machine_tool_picture') + machine_tool_picture = fields.Binary('设备图片', related='equipment_id.machine_tool_picture') state = fields.Selection( [("正常", "正常"), ("故障停机", "故障停机"), ("计划维保", "计划维保"), ("空闲", "空闲"), ("封存(报废)", "封存(报废)")], default='正常', string="机床状态", related='equipment_id.state') - run_time = fields.Float('正常运行总时长(h)') - equipment_time = fields.Float('总时长(h)') - done_nums = fields.Integer('累计加工总件数') - utilization_rate = fields.Char('开动率') - fault_time = fields.Float('故障停机总时长(h)') + run_time = fields.Float('加工时长(h)') + equipment_time = fields.Float('开机时长(h)') + done_nums = fields.Integer('加工件数') + utilization_rate = fields.Char('可用率') + fault_time = fields.Float('故障时长') fault_nums = fields.Integer('故障次数') + # 故障率 + fault_rate = fields.Char('故障率') + # 设备故障日志 sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_oee_id', '设备故障日志', related='equipment_id.sf_maintenance_logs_ids') oee_logs = fields.One2many('maintenance.equipment.oee.logs', 'equipment_oee_id', string='运行日志') @@ -38,12 +41,46 @@ class SfMaintenanceEquipmentOEELog(models.Model): _name = 'maintenance.equipment.oee.logs' _description = '设备运行日志' - name = fields.Char('运行日志') - run_time = fields.Datetime('时间') - state = fields.Selection([("开机", "开机"), ("关机", "关机"), ("等待", "等待"), ("开始加工", "开始加工"), - ("结束加工", "结束加工"), ("故障", "故障"), - ("检修", "检修"), ("保养", "保养")], default="", string="事件/状态") - workorder_id = fields.Char('加工订单') - time = fields.Char('持续时长') - color = fields.Char('颜色', default=1) + equipment_id = fields.Many2one('maintenance.equipment', '机台号') + name = fields.Char('设备名称') + machine_tool_picture = fields.Binary('设备图片') + type_id = fields.Many2one('sf.machine_tool.type', '品牌型号') + state = fields.Selection([("加工", "加工"), ("关机", "关机"), ("待机", "待机"), ("故障", "故障"), + ("检修", "检修"), ("保养", "保养")], default="", string="实时状态") + online_time = fields.Char('开机时长') + + offline_time = fields.Char('关机时长') + offline_nums = fields.Integer('关机次数') + # 待机时长 + + idle_time = fields.Char('待机时长') + + # 待机率 + idle_rate = fields.Char('待机率') + + work_time = fields.Char('加工时长') + work_rate = fields.Char('可用率') + fault_time = fields.Char('故障时长') + fault_rate = fields.Char('故障率') + fault_nums = fields.Integer('故障次数') + + detail_ids = fields.One2many('maintenance.equipment.oee.log.detail', 'log_id', string='日志详情') + + # maintenance_time = fields.Char('维保时长') + # work_nums = fields.Integer('加工件数') equipment_oee_id = fields.Many2one('maintenance.equipment.oee', '设备OEE') + + +# 设备运行日志详情 +class SfMaintenanceEquipmentOEELogDetail(models.Model): + _name = 'maintenance.equipment.oee.log.detail' + _description = '设备运行日志详情' + + sequence = fields.Integer('序号') + time = fields.Datetime('时间') + state = fields.Selection([("加工", "加工"), ("关机", "关机"), ("待机", "待机"), ("故障", "故障"), + ("检修", "检修"), ("保养", "保养")], default="", string="事件/状态") + production_id = fields.Many2one('mrp.production', '加工工单') + + log_id = fields.Many2one('maintenance.equipment.oee.logs', '日志') + diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index abbd4878..fec317c2 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -67,3 +67,6 @@ access_sf_cutting_tool_type_admin_sf_group_equipment_user,sf_cutting_tool_type_a access_sf_cutting_tool_type_group_purchase_director_sf_group_equipment_user,sf_cutting_tool_type_group_purchase_director,sf_base.model_sf_cutting_tool_type,sf_maintenance.sf_group_equipment_user,1,0,0,0 access_sf_cutting_tool_type_group_sale_director_sf_group_equipment_user,sf_cutting_tool_type_group_sale_director,sf_base.model_sf_cutting_tool_type,sf_maintenance.sf_group_equipment_user,1,0,0,0 access_sf_cutting_tool_type_group_plan_director_sf_group_equipment_user,sf_cutting_tool_type_group_plan_director,sf_base.model_sf_cutting_tool_type,sf_maintenance.sf_group_equipment_user,1,0,0,0 + +access_maintenance_equipment_oee_logs,maintenance_equipment_oee_logs,model_maintenance_equipment_oee_logs,sf_maintenance.sf_group_equipment_manager,1,1,1,0 +access_maintenance_equipment_oee_log_detail,maintenance_equipment_oee_log_detail,model_maintenance_equipment_oee_log_detail,sf_maintenance.sf_group_equipment_manager,1,1,1,0 \ No newline at end of file diff --git a/sf_maintenance/views/maintenance_equipment_oee_views.xml b/sf_maintenance/views/maintenance_equipment_oee_views.xml index 091e3c47..9370fbbc 100644 --- a/sf_maintenance/views/maintenance_equipment_oee_views.xml +++ b/sf_maintenance/views/maintenance_equipment_oee_views.xml @@ -14,6 +14,7 @@ + @@ -49,19 +50,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/sf_maintenance/views/maintenance_logs_views.xml b/sf_maintenance/views/maintenance_logs_views.xml index 76e52d55..8c80372d 100644 --- a/sf_maintenance/views/maintenance_logs_views.xml +++ b/sf_maintenance/views/maintenance_logs_views.xml @@ -105,6 +105,233 @@ + + + maintenance.logs.run.tree + maintenance.equipment.oee.logs + + + + + + + + + maintenance.logs.run.form + maintenance.equipment.oee.logs + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + maintenance.logs.run.detail.tree + maintenance.equipment.oee.log.detail + + + + + + + + + + + + maintenance.logs.run.detail.form + maintenance.equipment.oee.log.detail + +
+
+ +
+ +
+

+ +

+
+ + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 设备运行日志 + ir.actions.act_window + maintenance.equipment.oee.logs + + tree,form + + + +

+ 设备运行日志 +

+
+
+ + + +