新增设备OEE菜单 以及对象
This commit is contained in:
33
sf_maintenance/models/sf_maintenance_oee.py
Normal file
33
sf_maintenance/models/sf_maintenance_oee.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class SfMaintenanceEquipmentOEE(models.Model):
|
||||
_name = 'maintenance.equipment.oee'
|
||||
_description = '设备OEE'
|
||||
|
||||
name = fields.Char('设备oee')
|
||||
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')
|
||||
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)')
|
||||
fault_nums = fields.Integer('故障次数')
|
||||
sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_oee_id', '设备故障日志',
|
||||
related='equipment_id.sf_maintenance_logs_ids')
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for parameter in self:
|
||||
if parameter.equipment_id:
|
||||
name = parameter.equipment_id.name
|
||||
result.append((parameter.id, name))
|
||||
return result
|
||||
Reference in New Issue
Block a user