新增设备OEE菜单 以及对象

This commit is contained in:
qihao.gong@jikimo.com
2024-01-15 17:45:43 +08:00
parent 1bc09a4424
commit bb75b73247
10 changed files with 163 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
# -*-coding:utf-8-*-
from . import sf_maintenance
from . import sf_maintenance_oee
from . import sf_maintenance_logs
from . import sf_equipment_maintenance_standards
from . import sf_maintenance_requests

View File

@@ -86,7 +86,7 @@ class SfSaintenanceStandards(models.Model):
images = fields.One2many('maintenance.standard.image', 'standard_id', string='反馈图片')
maintenance_request_ids = fields.Many2many('maintenance.request', string='维保计划')
Period = fields.Integer('周期/频次(天)')
remark = fields.Char('备注说明')
remark = fields.Char('维保记录')
class MaintenanceStandardImage(models.Model):

View File

@@ -11,6 +11,7 @@ class SfMaintenanceLogs(models.Model):
type = fields.Selection([('type1', '类型1'), ('type2', '类型2')], string='类型')
brand = fields.Many2one('sf.machine.brand', related='maintenance_equipment_id.brand_id', string='品牌')
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='设备')
maintenance_equipment_oee_id = fields.Many2one('maintenance.equipment.oee', string='设备oee')
code_location = fields.Char(string='编码位置')
fault_type = fields.Selection(
[('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='故障类型')

View 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