diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index e5a4f03b..595a5d25 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -12,6 +12,7 @@ 'security/ir.model.access.csv', 'security/ir_rule_data.xml', 'views/maintenance_logs_views.xml', + 'views/maintenance_equipment_oee_views.xml', 'views/maintenance_views.xml', 'views/equipment_maintenance_standards_views.xml', 'views/maintenance_request_views.xml', diff --git a/sf_maintenance/models/__init__.py b/sf_maintenance/models/__init__.py index 0e06b132..b177eb3c 100644 --- a/sf_maintenance/models/__init__.py +++ b/sf_maintenance/models/__init__.py @@ -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 diff --git a/sf_maintenance/models/sf_equipment_maintenance_standards.py b/sf_maintenance/models/sf_equipment_maintenance_standards.py index 92a94c0e..388199da 100644 --- a/sf_maintenance/models/sf_equipment_maintenance_standards.py +++ b/sf_maintenance/models/sf_equipment_maintenance_standards.py @@ -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): diff --git a/sf_maintenance/models/sf_maintenance_logs.py b/sf_maintenance/models/sf_maintenance_logs.py index 791f66f8..2dc26f7e 100644 --- a/sf_maintenance/models/sf_maintenance_logs.py +++ b/sf_maintenance/models/sf_maintenance_logs.py @@ -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='故障类型') diff --git a/sf_maintenance/models/sf_maintenance_oee.py b/sf_maintenance/models/sf_maintenance_oee.py new file mode 100644 index 00000000..71802fda --- /dev/null +++ b/sf_maintenance/models/sf_maintenance_oee.py @@ -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 \ No newline at end of file diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index 92277bf8..998c6744 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -4,6 +4,9 @@ access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_grou access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_group_equipment_manager,1,1,1,0 access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_user,1,0,0,0 access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_manager,1,1,1,0 +access_maintenance_equipment_oee,maintenance_equipment_oee,model_maintenance_equipment_oee,sf_group_equipment_user,1,0,0,0 +access_maintenance_equipment_oee,maintenance_equipment_oee,model_maintenance_equipment_oee,sf_group_equipment_manager,1,1,1,0 +access_maintenance_equipment_oee,maintenance_equipment_oee,model_maintenance_equipment_oee,base.group_user,1,1,1,1 access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_user,1,0,0,0 access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_manager,1,1,1,0 access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,sf_group_equipment_user,1,0,0,0 diff --git a/sf_maintenance/views/maintenance_equipment_oee_views.xml b/sf_maintenance/views/maintenance_equipment_oee_views.xml new file mode 100644 index 00000000..60055631 --- /dev/null +++ b/sf_maintenance/views/maintenance_equipment_oee_views.xml @@ -0,0 +1,118 @@ + + + + + + maintenance.oee.tree + maintenance.equipment.oee + + + + + + + + + + + + + + + + maintenance.oee.form + maintenance.equipment.oee + +
+
+ +
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + +
+
+
+
+ + + + maintenance.oee.search + maintenance.equipment.oee + + + + + + + + + + + + + + 设备OEE + ir.actions.act_window + maintenance.equipment.oee + + tree,form + + +

+ 设备OEE +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index ef635f78..c8461e8a 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -6,8 +6,8 @@ import os from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +#from OCC.Extend.DataExchange import read_step_file +#from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 09ea3f0f..1b29c6d2 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -from quatotion import readSql, feature_recognize, auto_quatotion +#from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 1e5f274c..5ec1fd52 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -5,8 +5,8 @@ import os import json from datetime import datetime import requests -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +#from OCC.Extend.DataExchange import read_step_file +#from OCC.Extend.DataExchange import write_stl_file from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError