From ecc9bd446feff6bf8fc5125d35f882d33e599ea9 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 6 Sep 2023 16:32:25 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E6=9D=90=E6=96=99=E7=AD=89=E5=90=8C?= =?UTF-8?q?=E6=AD=A5Bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_mrs_connect/models/sync_common.py | 126 ++++++++++++++++----------- 1 file changed, 74 insertions(+), 52 deletions(-) diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 3d309689..1d96c027 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -32,20 +32,18 @@ class sfProductionMaterials(models.Model): if result['status'] == 1: for item in result['production_materials_yesterday_list']: if item: - brand = self.env['sf.production.materials'].search( + materials = self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_no'])]) - if brand: - brand.id = item['id'], - brand.name = item['name'], - brand.remark = item['remark'], - brand.active = item['active'] + if materials: + materials.name = item['name'] + materials.remark = item['remark'] + materials.active = item['active'] else: self.env['sf.production.materials'].create({ - "id": item['id'], "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], - "active": item['active'] + "active": item['active'], }) else: raise ValidationError("认证未通过") @@ -65,17 +63,20 @@ class sfProductionMaterials(models.Model): if result['status'] == 1: for item in result['production_materials_all_list']: if item: - - brand = self.env['sf.production.materials'].search( + materials = self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_no'])]) - if not brand: + if not materials: self.env['sf.production.materials'].create({ - "id": item['id'], "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], - "active": item['active'] + "active": item['active'], }) + else: + materials.name = item['name'] + materials.remark = item['remark'] + materials.active = item['active'] + else: raise ValidationError("认证未通过") @@ -102,23 +103,22 @@ class sfMaterialModel(models.Model): materials_model = self.env['sf.materials.model'].search( [("materials_no", '=', item['materials_no'])]) if materials_model: - materials_model.id = item['id'], - materials_model.name = item['name'], - materials_model.materials_no = item['materials_no'], - materials_model.remark = item['remark'], - materials_model.tensile_strength = item['tensile_strength'], - materials_model.hardness = item['hardness'], - materials_model.materials_no = item['materials_no'], - materials_model.rough_machining = item['rough_machining'], - materials_model.finish_machining = item['finish_machining'], - materials_model.mf_materia_post = item['mf_materia_post'], + materials_model.name = item['name'] + materials_model.materials_no = item['materials_no'] + materials_model.remark = item['remark'] + materials_model.tensile_strength = item['tensile_strength'] + materials_model.hardness = item['hardness'] + materials_model.materials_no = item['materials_no'] + materials_model.rough_machining = item['rough_machining'] + materials_model.finish_machining = item['finish_machining'] + materials_model.mf_materia_post = item['mf_materia_post'] materials_model.materials_id = self.env['sf.production.materials'].search( - [("materials_no", '=', item['materials_id.materials_no'])]).id, - materials_model.need_h = item['need_h'], + [("materials_no", '=', item['materials_id.materials_no'])]).id + materials_model.need_h = item['need_h'] materials_model.density = item['density'] + materials_model.active = item['active'] else: self.env['sf.materials.model'].create({ - "id": item['id'], "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], @@ -132,8 +132,6 @@ class sfMaterialModel(models.Model): "need_h": item['need_h'], "mf_materia_post": item['mf_materia_post'], "density": item['density'], - # "tag_ids": item['tag_ids'] - }) else: raise ValidationError("认证未通过") @@ -171,6 +169,22 @@ class sfMaterialModel(models.Model): # "tag_ids": item['tag_ids'] }) + else: + materials_model.name = item['name'] + materials_model.materials_no = item['materials_no'] + materials_model.remark = item['remark'] + materials_model.tensile_strength = item['tensile_strength'] + materials_model.hardness = item['hardness'] + materials_model.materials_no = item['materials_no'] + materials_model.rough_machining = item['rough_machining'] + materials_model.finish_machining = item['finish_machining'] + materials_model.mf_materia_post = item['mf_materia_post'] + materials_model.materials_id = self.env['sf.production.materials'].search( + [("materials_no", '=', item['materials_id.materials_no'])]).id + materials_model.need_h = item['need_h'] + materials_model.density = item['density'] + materials_model.active = item['active'] + else: raise ValidationError("认证未通过") @@ -197,8 +211,8 @@ class sfProductionProcessCategory(models.Model): production_process_category = self.env['sf.production.process.category'].search( [("code", '=', item['code'])]) if production_process_category: - production_process_category.name = item['name'], - production_process_category.code = item['code'], + production_process_category.name = item['name'] + production_process_category.code = item['code'] production_process_category.active = item['active'] else: self.env['sf.production.process.category'].create({ @@ -231,6 +245,9 @@ class sfProductionProcessCategory(models.Model): "code": item['code'], "active": item['active'], }) + else: + category.name = item['name'] + category.active = item['active'] else: raise ValidationError("认证未通过") @@ -254,16 +271,15 @@ class sfProductionProcess(models.Model): if result['status'] == 1: for item in result['production_process_yesterday_list']: if item: - brand = self.env['sf.production.process'].search( + production_process = self.env['sf.production.process'].search( [("process_encode", '=', item['process_encode'])]) - if brand: - brand.name = item['name'], - brand.category_id = self.env['sf.production.process.category'].search( - [("code", '=', item['category_code'])]).id, - brand.process_encode = item['process_encode'], - brand.remark = item['remark'], - brand.active = item['active'], - brand.remark = item['remark'] + if production_process: + production_process.name = item['name'] + production_process.category_id = self.env['sf.production.process.category'].search( + [("code", '=', item['category_code'])]).id + production_process.process_encode = item['process_encode'] + production_process.remark = item['remark'] + production_process.active = item['active'] else: self.env['sf.production.process'].create({ "name": item['name'], @@ -290,9 +306,9 @@ class sfProductionProcess(models.Model): if result['status'] == 1: for item in result['production_process_all_list']: if item: - brand = self.env['sf.production.process'].search( + production_process = self.env['sf.production.process'].search( [("process_encode", '=', item['process_encode'])]) - if not brand: + if not production_process: self.env['sf.production.process'].create({ "name": item['name'], "category_id": self.env['sf.production.process.category'].search( @@ -303,6 +319,12 @@ class sfProductionProcess(models.Model): # "tag_ids": item['tag_ids'] }) + else: + production_process.name = item['name'] + production_process.category_id = self.env['sf.production.process.category'].search( + [("code", '=', item['category_code'])]).id + production_process.remark = item['remark'] + production_process.active = item['active'] else: raise ValidationError("认证未通过") @@ -326,14 +348,12 @@ class sfProcessingTechnology(models.Model): if result['status'] == 1: for item in result['processing_technology_yesterday_list']: if item: - brand = self.env['sf.processing.technology'].search( + processing_technology = self.env['sf.processing.technology'].search( [("process_encode", '=', item['process_encode'])]) - if brand: - brand.id = item['id'], - brand.name = item['name'], - brand.process_encode = item['process_encode'], - brand.remark = item['remark'], - brand.active = item['active'] + if processing_technology: + processing_technology.name = item['name'] + processing_technology.remark = item['remark'] + processing_technology.active = item['active'] else: self.env['sf.processing.technology'].create({ "id": item['id'], @@ -361,18 +381,20 @@ class sfProcessingTechnology(models.Model): if result['status'] == 1: for item in result['processing_technology_all_list']: if item: - brand = self.env['sf.processing.technology'].search( + processing_technology = self.env['sf.processing.technology'].search( [("process_encode", '=', item['process_encode'])]) - if not brand: + if not processing_technology: self.env['sf.processing.technology'].create({ "id": item['id'], "name": item['name'], "process_encode": item['process_encode'], "remark": item['remark'], "active": item['active'], - # "tag_ids": item['tag_ids'] - }) + else: + processing_technology.name = item['name'] + processing_technology.remark = item['remark'] + processing_technology.active = item['active'] else: raise ValidationError("认证未通过") From 3aa34ee0cf6af56076d0ecad3525e30b4995b033 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Thu, 21 Sep 2023 16:10:18 +0800 Subject: [PATCH 02/21] =?UTF-8?q?http=E6=9D=83=E9=99=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/models/http.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sf_bf_connect/models/http.py b/sf_bf_connect/models/http.py index 6b0b3ebd..8f546c88 100644 --- a/sf_bf_connect/models/http.py +++ b/sf_bf_connect/models/http.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import logging -import datetime -import time +from datetime import datetime, timedelta import hashlib from odoo import models from odoo.http import request @@ -10,8 +9,6 @@ __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) -class AuthenticationError(Exception): - pass class AuthenticationError(Exception): pass @@ -29,16 +26,18 @@ class Http(models.AbstractModel): # 查询密钥 factory_secret = request.env['res.partner'].sudo().search( [('sf_token', '=', datas['HTTP_TOKEN'])], limit=1) - logging.info('factory_secret:%s' % factory_secret) if not factory_secret: raise AuthenticationError('无效的token') - timestamp_str = int(time.time()) # 设置API接口请求时间,不能超过5秒 - deltime = datetime.timedelta(seconds=5) - # if abs(int(datas['HTTP_TIMESTAMP'])-timestamp_str) > deltime.seconds: + # deltime = datetime.timedelta(seconds=30) + # if abs(int(datas['HTTP_TIMESTAMP']) - timestamp_str) > deltime.seconds: # raise AuthenticationError('请求已过期') - # 获得sha1_str加密字符串 post_time = int(datas['HTTP_TIMESTAMP']) + datetime_post = datetime.fromtimestamp(post_time) + datetime_now = datetime.now().replace(microsecond=0) + datetime_del = datetime_now + timedelta(seconds=5) + if datetime_post > datetime_del: + raise AuthenticationError('请求已过期') check_str = '%s%s%s' % (datas['HTTP_TOKEN'], post_time, factory_secret.sf_secret_key) check_sf_str = hashlib.sha1(check_str.encode('utf-8')).hexdigest() if check_sf_str != datas['HTTP_CHECKSTR']: From 22a4ccad6b02227d21202706a6fea20f99250f76 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Tue, 26 Sep 2023 17:29:14 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=B4=E4=BF=9D?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=BC=96=E7=A0=81=E5=92=8C=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E7=9A=84=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sf_equipment_maintenance_standards.py | 22 +++++++++++++++++-- .../equipment_maintenance_standards_views.xml | 2 +- sf_manufacturing/__manifest__.py | 2 +- sf_manufacturing/models/mrp_maintenance.py | 4 +--- sf_manufacturing/models/mrp_workcenter.py | 6 ++--- .../models/production_line_base.py | 1 + .../views/mrp_workcenter_views.xml | 2 +- .../views/production_line_view.xml | 11 ++++++++++ 8 files changed, 38 insertions(+), 12 deletions(-) diff --git a/sf_maintenance/models/sf_equipment_maintenance_standards.py b/sf_maintenance/models/sf_equipment_maintenance_standards.py index 7c8740f5..55fea8b0 100644 --- a/sf_maintenance/models/sf_equipment_maintenance_standards.py +++ b/sf_maintenance/models/sf_equipment_maintenance_standards.py @@ -15,13 +15,31 @@ class SfEquipmentSaintenanceStandards(models.Model): num = "%04d" % 1 else: - m = int(partner.code) + 1 + m = int(partner.code[-4:]) + 1 num = "%04d" % m return num - code = fields.Char(string='编码', default=get_no) + code = fields.Char(string='编码') remark = fields.Char('备注') maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养') name = fields.Char(string='名称') + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + if not vals['code']: + if vals['maintenance_type']: + if vals['maintenance_type'] == '保养': + vals['code'] = 'BY' + self.get_no() + else: + vals['code'] = 'JX' + self.get_no() + if not vals['name']: + if vals['maintenance_equipment_category_id']: + ma_name = self.env['maintenance.equipment.category'].sudo().search( + [('id', '=', vals['maintenance_equipment_category_id'])]).name + vals['name'] = ma_name + '-' + vals['maintenance_type'] + '标准-' + vals[ + 'code'] + return super().create(vals_list) + created_user_id = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user) maintenance_equipment_category_id = fields.Many2one('maintenance.equipment.category', string='设备类别') maintenance_equipment_ids = fields.Many2many( diff --git a/sf_maintenance/views/equipment_maintenance_standards_views.xml b/sf_maintenance/views/equipment_maintenance_standards_views.xml index 1b30b68f..3737a31c 100644 --- a/sf_maintenance/views/equipment_maintenance_standards_views.xml +++ b/sf_maintenance/views/equipment_maintenance_standards_views.xml @@ -11,7 +11,7 @@ - + diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py index 37b5fd79..febab313 100644 --- a/sf_manufacturing/__manifest__.py +++ b/sf_manufacturing/__manifest__.py @@ -18,9 +18,9 @@ 'views/mrp_production_addional_change.xml', # 'views/mrp_maintenance_views.xml', 'views/mrp_routing_workcenter_view.xml', + 'views/production_line_view.xml', 'views/mrp_workcenter_views.xml', 'views/mrp_workorder_view.xml', - 'views/production_line_view.xml', 'views/tool_other_features_view.xml', 'views/model_type_view.xml', # 'views/kanban_change.xml' diff --git a/sf_manufacturing/models/mrp_maintenance.py b/sf_manufacturing/models/mrp_maintenance.py index afca09a2..2fabd219 100644 --- a/sf_manufacturing/models/mrp_maintenance.py +++ b/sf_manufacturing/models/mrp_maintenance.py @@ -6,8 +6,8 @@ from dateutil.relativedelta import relativedelta class MaintenanceEquipment(models.Model): _inherit = "maintenance.equipment" - _check_company_auto = True + production_line_id = fields.Many2one('sf.production.line', string='生产线') expected_mtbf = fields.Integer(string='Expected MTBF', help='Expected Mean Time Between Failure') mtbf = fields.Integer(compute='_compute_maintenance_request', string='MTBF', help='Mean Time Between Failure, computed based on done corrective maintenances.') @@ -16,8 +16,6 @@ class MaintenanceEquipment(models.Model): string='Estimated time before next failure (in days)', help='Computed as Latest Failure Date + MTBF') latest_failure_date = fields.Date(compute='_compute_maintenance_request', string='Latest Failure Date') - workcenter_id = fields.Many2one( - 'mrp.workcenter', string='Work Center', check_company=True) @api.depends('effective_date', 'maintenance_ids.stage_id', 'maintenance_ids.close_date', 'maintenance_ids.request_date') diff --git a/sf_manufacturing/models/mrp_workcenter.py b/sf_manufacturing/models/mrp_workcenter.py index c42e9cec..1acb5407 100644 --- a/sf_manufacturing/models/mrp_workcenter.py +++ b/sf_manufacturing/models/mrp_workcenter.py @@ -10,12 +10,10 @@ class ResWorkcenter(models.Model): # 生产线显示 production_line_show = fields.Char(string='生产线名称') machine_tool_id = fields.Many2one('sf.machine_tool', string='机床') - production_line_id = fields.Many2one('sf.production.line', string='生产线') equipment_id = fields.Many2one( 'maintenance.equipment', string="设备", - check_company=True) - - + ) + production_line_id = fields.Many2one('sf.production.line', string='生产线') is_process_outsourcing = fields.Boolean('工艺外协') users_ids = fields.Many2many("res.users", 'users_workcenter') diff --git a/sf_manufacturing/models/production_line_base.py b/sf_manufacturing/models/production_line_base.py index a8c41cd3..2cb704f0 100644 --- a/sf_manufacturing/models/production_line_base.py +++ b/sf_manufacturing/models/production_line_base.py @@ -22,6 +22,7 @@ class ProductionLine(models.Model): return num mrp_workcenter_ids = fields.One2many('mrp.workcenter', 'production_line_id', '工作中心') + mrp_manufacturing_ids = fields.One2many('maintenance.equipment', 'production_line_id', '设备') name = fields.Char('生产线', size=20, required=True) code = fields.Char('编码', default=_get_code, readonly=True) remark = fields.Char('备注') diff --git a/sf_manufacturing/views/mrp_workcenter_views.xml b/sf_manufacturing/views/mrp_workcenter_views.xml index 20275f8a..b54c7750 100644 --- a/sf_manufacturing/views/mrp_workcenter_views.xml +++ b/sf_manufacturing/views/mrp_workcenter_views.xml @@ -162,7 +162,7 @@ - + diff --git a/sf_manufacturing/views/production_line_view.xml b/sf_manufacturing/views/production_line_view.xml index f12f6d98..34a92ce8 100644 --- a/sf_manufacturing/views/production_line_view.xml +++ b/sf_manufacturing/views/production_line_view.xml @@ -82,4 +82,15 @@ name="生产线" sequence="20" action="sf_production_line_act"/> + + + sf_equipment.form + maintenance.equipment + + + + + + + \ No newline at end of file From 6b375ee64dd20aad913503f98565f33f77bc8e8b Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Wed, 27 Sep 2023 14:30:38 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=85=E9=9A=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/__init__.py | 2 +- sf_manufacturing/models/mrp_maintenance.py | 5 ++ sf_manufacturing/models/mrp_workcenter.py | 49 +++++++++---------- .../views/mrp_workcenter_views.xml | 2 +- .../views/production_line_view.xml | 12 +++++ 5 files changed, 43 insertions(+), 27 deletions(-) diff --git a/sf_manufacturing/models/__init__.py b/sf_manufacturing/models/__init__.py index c560211b..25b91f15 100644 --- a/sf_manufacturing/models/__init__.py +++ b/sf_manufacturing/models/__init__.py @@ -2,8 +2,8 @@ from . import model_type from . import product_template from . import mrp_production from . import mrp_workorder -from . import mrp_workcenter from . import mrp_maintenance +from . import mrp_workcenter from . import mrp_routing_workcenter from . import stock from . import res_user diff --git a/sf_manufacturing/models/mrp_maintenance.py b/sf_manufacturing/models/mrp_maintenance.py index 2fabd219..f0b09e8d 100644 --- a/sf_manufacturing/models/mrp_maintenance.py +++ b/sf_manufacturing/models/mrp_maintenance.py @@ -62,3 +62,8 @@ class MaintenanceRequest(models.Model): 'mrp.workorder', string='Work Order', check_company=True) production_company_id = fields.Many2one(string='Production Company', related='production_id.company_id') company_id = fields.Many2one(domain="[('id', '=?', production_company_id)]") + +class SfMaintenanceLogs(models.Model): + _inherit = 'sf.maintenance.logs' + + production_line_id = fields.Many2one('sf.production.line', string='生产线', related='maintenance_equipment_id.production_line_id', store=True) diff --git a/sf_manufacturing/models/mrp_workcenter.py b/sf_manufacturing/models/mrp_workcenter.py index 1acb5407..54d5e9a0 100644 --- a/sf_manufacturing/models/mrp_workcenter.py +++ b/sf_manufacturing/models/mrp_workcenter.py @@ -9,11 +9,10 @@ class ResWorkcenter(models.Model): # 生产线显示 production_line_show = fields.Char(string='生产线名称') - machine_tool_id = fields.Many2one('sf.machine_tool', string='机床') equipment_id = fields.Many2one( 'maintenance.equipment', string="设备", ) - production_line_id = fields.Many2one('sf.production.line', string='生产线') + production_line_id = fields.Many2one('sf.production.line', string='生产线', related='equipment_id.production_line_id', store=True) is_process_outsourcing = fields.Boolean('工艺外协') users_ids = fields.Many2many("res.users", 'users_workcenter') @@ -23,13 +22,13 @@ class ResWorkcenter(models.Model): equipment_status = fields.Selection( [("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")], - string="设备状态", compute='_compute_equipment_id') + string="设备状态", related='equipment_id.state') - @api.depends('equipment_id') - def _compute_equipment_id(self): - for record in self: - if record: - record.equipment_status = record.equipment_id.state + # @api.depends('equipment_id') + # def _compute_equipment_id(self): + # for record in self: + # if record: + # record.equipment_status = record.equipment_id.state equipment_image = fields.Binary('设备图片', related='equipment_id.machine_tool_picture') @@ -38,23 +37,23 @@ class ResWorkcenter(models.Model): outsourcing_workcenter = self.env['mrp.workcenter'].search([('is_process_outsourcing', '=', True)]) return outsourcing_workcenter.id - @api.onchange('machine_tool_id') - def update_machine_tool_is_binding(self): - machine_tool = self.env["sf.machine_tool"].search([('is_binding', '=', True)]) - if machine_tool: - for item in machine_tool: - workcenter_machine_tool = self.env["mrp.workcenter"].search([('machine_tool_id', '=', item.id)]) - if workcenter_machine_tool: - if self.machine_tool_id.id: - if workcenter_machine_tool.id != self.machine_tool_id.id: - self.machine_tool_id.is_binding = True - else: - self.machine_tool_id.is_binding = True - else: - self.machine_tool_id.is_binding = True - item.is_binding = False - else: - self.machine_tool_id.is_binding = True + # @api.onchange('machine_tool_id') + # def update_machine_tool_is_binding(self): + # machine_tool = self.env["sf.machine_tool"].search([('is_binding', '=', True)]) + # if machine_tool: + # for item in machine_tool: + # workcenter_machine_tool = self.env["mrp.workcenter"].search([('machine_tool_id', '=', item.id)]) + # if workcenter_machine_tool: + # if self.machine_tool_id.id: + # if workcenter_machine_tool.id != self.machine_tool_id.id: + # self.machine_tool_id.is_binding = True + # else: + # self.machine_tool_id.is_binding = True + # else: + # self.machine_tool_id.is_binding = True + # item.is_binding = False + # else: + # self.machine_tool_id.is_binding = True def action_work_order(self): if not self.env.context.get('desktop_list_view', False): diff --git a/sf_manufacturing/views/mrp_workcenter_views.xml b/sf_manufacturing/views/mrp_workcenter_views.xml index b54c7750..20275f8a 100644 --- a/sf_manufacturing/views/mrp_workcenter_views.xml +++ b/sf_manufacturing/views/mrp_workcenter_views.xml @@ -162,7 +162,7 @@ - + diff --git a/sf_manufacturing/views/production_line_view.xml b/sf_manufacturing/views/production_line_view.xml index 34a92ce8..47e03488 100644 --- a/sf_manufacturing/views/production_line_view.xml +++ b/sf_manufacturing/views/production_line_view.xml @@ -83,6 +83,7 @@ sequence="20" action="sf_production_line_act"/> + sf_equipment.form maintenance.equipment @@ -93,4 +94,15 @@ + + + sf.maintenance.logs.tree + sf.maintenance.logs + + + + + + + \ No newline at end of file From 960bea5bb02034e73348143fc11a9c57ccab0329 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Thu, 28 Sep 2023 16:20:03 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20AGV=E5=B0=8F=E8=BD=A6table=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/models/sf_maintenance.py | 27 ++++++++++++++++++++-- sf_maintenance/views/maintenance_views.xml | 9 +++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index 2b15ebad..7da49c38 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -14,7 +14,7 @@ class SfMaintenanceEquipmentCategory(models.Model): _inherit = 'maintenance.equipment.category' _description = '设备类别' - equipment_type = fields.Selection([('机床', '机床'), ('机械臂', '机械臂'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')], string='类型', default='机床') + equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')], string='类型', default='机床') class SfMaintenanceEquipment(models.Model): @@ -65,7 +65,7 @@ class SfMaintenanceEquipment(models.Model): MTcode = fields.Char("编码", default=get_no) created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user) - equipment_type = fields.Selection([('机床', '机床')], compute='_compute_category_id') + equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')], compute='_compute_category_id') @api.depends('category_id') def _compute_category_id(self): @@ -235,6 +235,29 @@ class SfMaintenanceEquipment(models.Model): item.machine_tool_category = item.type_id.machine_tool_category.id item.brand_id = item.type_id.brand_id.id + # AGV小车设备参数 + AGV_L = fields.Char('设备尺寸(长)') + AGV_W = fields.Char('设备尺寸(宽)') + AGV_H = fields.Char('设备尺寸(高)') + AGV_goods_L = fields.Char('载货尺寸(长)') + AGV_goods_W = fields.Char('载货尺寸(宽)') + AGV_goods_H = fields.Char('载货尺寸(高)') + AGV_velocity = fields.Char('标准速度') + AGV_velocity_min = fields.Char('标准速度(最小)') + AGV_velocity_max = fields.Char('标准速度(最大)') + AGV_Lifting_height = fields.Char('升降高度(max)') + AGV_ground_clearance = fields.Char('最小离地高度') + AGV_turning_radius = fields.Char('最小转弯半径') + AGV_gradeability_max = fields.Integer('最大爬坡度') + AGV_parking_accuracy = fields.Char('停车精度') + AGV_load_weight_max = fields.Char('最大负载重量') + AGV_load_weight_max = fields.Char('最大负载重量') + AGV_weight = fields.Char('本体总重量') + AGV_job_duration = fields.Char('连续作业时长') + AGV_transfer_mode = fields.Char('移载方式') + + + # 注册同步机床 def enroll_machine_tool(self): sf_sync_config = self.env['res.config.settings'].get_values() diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 500d6282..cce4a1d0 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -65,7 +65,7 @@ force_save="1"/> - + @@ -177,6 +177,13 @@ + + + + + + + From af05d3ec30357b80350227f5398b29765c258a66 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Sat, 7 Oct 2023 17:26:09 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=A2=9E=E5=8A=A0AGV?= =?UTF-8?q?=E5=B0=8F=E8=BD=A6,=E6=9C=BA=E6=A2=B0=E8=87=82,=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E8=AE=BE=E5=A4=87=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/scss/custom_style.scss | 11 +- sf_maintenance/models/sf_maintenance.py | 83 ++- sf_maintenance/security/ir.model.access.csv | 1 + sf_maintenance/views/maintenance_views.xml | 561 +++++++++++++++++- 4 files changed, 650 insertions(+), 6 deletions(-) diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index 3ae7958c..6a398126 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -3,7 +3,7 @@ } .test_model > .o_form_label { - margin-left: 20px; + margin-left: 0px !important; margin-right: 0px !important; white-space: nowrap; } @@ -289,4 +289,13 @@ div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > . .text-bg-warning { background-color: #FED300 !important; +} + +.test_model>div { + display: flex; + width: 40%; +} + +.test_model>div .o_field_widget { + width: 40% !important; } \ No newline at end of file diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index 7da49c38..90574f2b 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -251,10 +251,78 @@ class SfMaintenanceEquipment(models.Model): AGV_gradeability_max = fields.Integer('最大爬坡度') AGV_parking_accuracy = fields.Char('停车精度') AGV_load_weight_max = fields.Char('最大负载重量') - AGV_load_weight_max = fields.Char('最大负载重量') AGV_weight = fields.Char('本体总重量') AGV_job_duration = fields.Char('连续作业时长') AGV_transfer_mode = fields.Char('移载方式') + AGV_drive_motor_power = fields.Char('驱动电机功率') + AGV_hoist_motor_power = fields.Char('提升电机功率') + AGV_drive_motor_speed_ratio = fields.Char('驱动电机速比') + AGV_veer_motor_power = fields.Char('转向电机功率') + AGV_veer_motor_speed_ratio = fields.Char('转向电机速比') + AGV_move_motor_power = fields.Char('前移电机功率') + AGV_move_motor_speed_ratio = fields.Char('前移电机速比') + AGV_drive_mode = fields.Char('驱动方式') + AGV_navigation_mode = fields.Char('导航方式') + AGV_communication_mode = fields.Char('通讯方式') + AGV_direction_travel = fields.Char('行走方向') + AGV_power_requirements = fields.Char('电源要求') + AGV_charge_mode = fields.Selection([('手动', '手动'), ('自动', '自动')], string='充电方式') + AGV_security = fields.Char('安全防护') + AGV_operating_temperature = fields.Char('环境温度') + AGV_operating_humidity = fields.Char('环境湿度') + + # 三元检测设备参数 + detect_L = fields.Char('设备尺寸(长)') + detect_W = fields.Char('设备尺寸(宽)') + detect_H = fields.Char('设备尺寸(高)') + detect_x_axis = fields.Char('X轴') + detect_y_axis = fields.Char('Y轴') + detect_z_axis = fields.Char('Z轴') + detect_precision = fields.Char('测量精度') + detect_measurement_mode = fields.Selection([('光栅尺', '光栅尺'), ('容栅', '容栅'), ('磁栅', '磁栅'), ('激光干涉仪', '激光干涉仪')], string='测量方式') + detect_resolution = fields.Char('分辨率') + detect_load_weight_max = fields.Char('最大负载重量') + detect_weight = fields.Char('本体总重量') + detect_measurement_length = fields.Char('深孔测量长度(max)') + detect_control_mode = fields.Char('控制方式') + detect_balance_mode_for_Z = fields.Char('Z轴平衡方式') + detect_zoom_objective_magnification = fields.Char('变焦物镜倍率') + detect_magnification = fields.Char('放大倍率') + detect_working_distance = fields.Char('工作距离') + detect_locking_mode = fields.Char('锁紧方式') + detect_pressurized_air = fields.Char('压缩空气') + detect_object_field_of_view_max = fields.Char('物方视场(最大)') + detect_object_field_of_view_min = fields.Char('物方视场(最小)') + detect_power_requirements = fields.Char('电源要求') + detect_operating_temperature = fields.Char('环境温度') + detect_operating_humidity = fields.Char('环境湿度') + + # 机器人设备参数 + robot_gripping_of_workpieces_L = fields.Char('可抓取工件(长)') + robot_gripping_of_workpieces_W = fields.Char('可抓取工件(宽)') + robot_gripping_of_workpieces_H = fields.Char('可抓取工件(高)') + robot_radius_of_the_boom = fields.Char('展臂半径') + robot_load_weight_max = fields.Char('最大负载重量') + robot_weight = fields.Char('本体总重量') + robot_repeatable_positioning_accuracy = fields.Char('重复定位精度') + robot_axis_num = fields.Selection([('2轴', '2轴'), ('3轴', '3轴'), ('4轴', '4轴'), ('5轴', '5轴'), ('6轴', '6轴'), ('7轴', '7轴'), ('8轴', '8轴')], string='轴数') + axis_ids = fields.One2many('sf.robot.axis.num', 'equipment_id', string='动作范围') + robot_track_dimensions_L = fields.Char('轨道尺寸(长)') + robot_track_dimensions_W = fields.Char('轨道尺寸(宽)') + robot_track_dimensions_H = fields.Char('轨道尺寸(高)') + robot_drive_mode = fields.Char('驱动方式') + robot_installation_method = fields.Selection([('置地式', '置地式'), ('壁挂式', '壁挂式'), ('倒挂式', '倒挂式')], string='安装方式') + robot_operating_temperature = fields.Char('环境温度') + robot_operating_humidity = fields.Char('环境湿度') + + + + + + + + + @@ -540,3 +608,16 @@ class MaintenanceStandardImage(models.Model): new_res.append([id, name, data_uri]) # 返回新的结果列表 return new_res + +class SfRobotAxisNum(models.Model): + _name = 'sf.robot.axis.num' + _description = '机器人轴参数' + + name = fields.Char('*轴') + angle_min = fields.Char('最小角度-(°)') + angle_max = fields.Char('最大角度+(°)') + velocity = fields.Char('最大速度(°/s)') + weight = fields.Char('最大负载(kg)') + permissible_load_torque = fields.Char('允许负载扭矩(N-m)') + permissible_inertial_torque = fields.Char('允许惯性扭矩(kg-m²)') + equipment_id = fields.Many2one('maintenance.equipment', string='机器人', domain="[('equipment_type', '=', '机器人')]") diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index f5517576..65e93d7a 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -5,6 +5,7 @@ access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,b access_maintenance_standards,maintenance_standards,model_maintenance_standards,base.group_user,1,1,1,1 access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,base.group_user,1,1,1,1 access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1 +access_sf_robot_axis_num,sf_robot_axis_num,model_sf_robot_axis_num,base.group_user,1,1,1,1 diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index cce4a1d0..258dfb34 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -65,7 +65,8 @@ force_save="1"/> - + @@ -177,11 +178,563 @@ - + + + + + + + + + - + + + - + + + + + From 7551bf38ef560afb6a87d07a1008f32cc8b0ba70 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Sun, 8 Oct 2023 17:19:02 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E9=94=80=E5=94=AE=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BE=9D=E8=B5=96=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/controllers/product.py | 12 ++++++++++++ sf_dlm/views/product_template_view.xml | 2 +- sf_sale/__manifest__.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 sf_bf_connect/controllers/product.py diff --git a/sf_bf_connect/controllers/product.py b/sf_bf_connect/controllers/product.py new file mode 100644 index 00000000..eb769a03 --- /dev/null +++ b/sf_bf_connect/controllers/product.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +import json +import logging +from odoo import http +from odoo.http import request + + +# class ProductController(http.Controller): +# +# @http.route('/api/cloud/get_cutting_model', type='http', auth='none', methods=['GET', 'POST'], csrf=False, +# cors="*") +# def get_cutting_model(self, **kw): diff --git a/sf_dlm/views/product_template_view.xml b/sf_dlm/views/product_template_view.xml index dd86fc86..fbc12cee 100644 --- a/sf_dlm/views/product_template_view.xml +++ b/sf_dlm/views/product_template_view.xml @@ -106,7 +106,7 @@ - + Date: Sun, 8 Oct 2023 17:27:51 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=90=E6=96=99?= =?UTF-8?q?=E5=9E=8B=E5=8F=B7=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_base/models/common.py b/sf_base/models/common.py index a6aaf0f8..4425960c 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -67,7 +67,7 @@ class MrsMaterialModel(models.Model): mf_materia_post = fields.Char("热处理后密度") density = fields.Float("密度(kg/m³)") materials_id = fields.Many2one('sf.production.materials', "材料名") - tensile_strength = fields.Float("拉伸强度(n/mm²)") + tensile_strength = fields.Char("拉伸强度(n/mm²)") hardness = fields.Float("硬度(hrc)") rough_machining = fields.Float("粗加工Vc(m/min)") finish_machining = fields.Float("精加工Vc(m/min)") From 59514cc43377250c76c03f84681d6626ad6f98d3 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 9 Oct 2023 15:15:52 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=88=80=E5=85=B7?= =?UTF-8?q?=E5=9E=8B=E5=8F=B7=E7=9A=84=E5=90=8C=E6=AD=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_mrs_connect/models/res_config_setting.py | 3 - sf_mrs_connect/models/sync_common.py | 264 -------------------- 2 files changed, 267 deletions(-) diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py index d0d03620..6eb78537 100644 --- a/sf_mrs_connect/models/res_config_setting.py +++ b/sf_mrs_connect/models/res_config_setting.py @@ -40,13 +40,10 @@ class ResConfigSettings(models.TransientModel): self.env['sf.machine_tool.category'].sync_all_machine_tool_category() _logger.info("同步资源库机床类型") self.env['sf.production.process.parameter'].sync_all_production_process_parameter() - _logger.info("同步表面工艺参数") _logger.info("同步刀具物料") self.env['sf.cutting.tool.material'].sync_all_cutting_tool_material() _logger.info("同步刀具类型") self.env['sf.cutting.tool.type'].sync_all_tool_type() - _logger.info("同步刀具型号") - self.env['sf.cutting.tool.model'].sync_all_tool_model() _logger.info("同步功能刀具类型") self.env['sf.functional.cutting.tool.model'].sync_all_functional_cutting_tool_model() _logger.info("同步夹具物料") diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 2fb55eff..83036854 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -1608,267 +1608,3 @@ class SfToolType(models.Model): }) else: raise ValidationError("刀具类型认证未通过") - - -# 同步刀具型号 -class SfToolModel(models.Model): - _inherit = 'sf.cutting.tool.model' - _description = '同步刀具型号' - - url = '/api/mrs_cutting_tool_model/list' - - # 定时同步每日刀具型号 - def sync_tool_model(self): - sf_sync_config = self.env['res.config.settings'].get_values() - token = sf_sync_config['token'] - sf_secret_key = sf_sync_config['sf_secret_key'] - headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['sf_url'] + self.url - r = requests.post(strUrl, json={}, data=None, headers=headers) - r = r.json() - result = json.loads(r['result']) - if result['status'] == 1: - _logger.info('result:%s' % result) - for item in result['mrs_cutting_tool_model_yesterday_list']: - cutting_tool_model = self.search( - [("code", '=', item['code'])]) - if not cutting_tool_model: - self.env['sf.cutting.tool.model'].create({ - "name": item['name'], - "code": item['code'], - "brand_id": self.env['sf.machine.brand'].search( - [("code", '=', item['brand_code'])]).id, - "material_model_id": self.env['sf.materials.model'].search( - [("materials_no", '=', item['material_model_code'])]).id, - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, - "cutting_tool_type_id": self.env['sf.cutting.tool.type'].search( - [("code", '=', item['cutting_tool_type_code'])]).id, - "tool_length": item['tool_length'], - "tool_width": item['tool_width'], - "tool_height": item['tool_height'], - "tool_thickness": item['tool_thickness'], - "tool_weight": item['tool_weight'], - "coating_material": item['coating_material'], - "total_length": item['total_length'], - "shank_length": item['shank_length'], - "blade_length": item['blade_length'], - "front_angle": item['front_angle'], - "rear_angle": item['rear_angle'], - "main_included_angle": item['main_included_angle'], - "nut": item['nut'], - "top_angle": item['top_angle'], - "jump_accuracy": item['jump_accuracy'], - "working_hardness": item['working_hardness'], - "blade_diameter": item['blade_diameter'], - "wrench": item['wrench'], - "screw": item['screw'], - "accuracy_level": item['accuracy_level'], - "diameter_max": item['diameter_max'], - "clamping_diameter": item['clamping_diameter'], - "flange_length": item['flange_length'], - 'chuck_ids': [(6, 0, [])] if not item.get('chuck_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['chuck_codes']), - 'cutter_bar_ids': [(6, 0, [])] if not item.get('cutter_bar_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_bar_codes']), - 'cutter_pad_ids': [(6, 0, [])] if not item.get('cutter_pad_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_pad_codes']), - 'blade_ids': [(6, 0, [])] if not item.get('blade_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['blade_codes']), - 'handle_ids': [(6, 0, [])] if not item.get('handle_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['handle_codes']), - "flange_diameter": item['flange_diameter'], - "outer_diameter": item['outer_diameter'], - "inner_diameter": item['inner_diameter'], - "active": item['active'], - }) - else: - cutting_tool_model.write({ - "name": item['name'], - "brand_id": self.env['sf.machine.brand'].search( - [("code", '=', item['brand_code'])]).id, - "material_model_id": self.env['sf.materials.model'].search( - [("materials_no", '=', item['material_model_code'])]).id, - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, - "cutting_tool_type_id": self.env['sf.cutting.tool.type'].search( - [("code", '=', item['cutting_tool_type_code'])]).id, - "tool_length": item['tool_length'], - "tool_width": item['tool_width'], - "tool_height": item['tool_height'], - "tool_thickness": item['tool_thickness'], - "tool_weight": item['tool_weight'], - "coating_material": item['coating_material'], - "total_length": item['total_length'], - "shank_length": item['shank_length'], - "blade_length": item['blade_length'], - "front_angle": item['front_angle'], - "rear_angle": item['rear_angle'], - "main_included_angle": item['main_included_angle'], - "nut": item['nut'], - "top_angle": item['top_angle'], - "jump_accuracy": item['jump_accuracy'], - "working_hardness": item['working_hardness'], - "blade_diameter": item['blade_diameter'], - "wrench": item['wrench'], - "screw": item['screw'], - "accuracy_level": item['accuracy_level'], - "diameter_max": item['diameter_max'], - "clamping_diameter": item['clamping_diameter'], - "flange_length": item['flange_length'], - 'chuck_ids': [(6, 0, [])] if not item.get('chuck_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['chuck_codes']), - 'cutter_bar_ids': [(6, 0, [])] if not item.get('cutter_bar_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_bar_codes']), - 'cutter_pad_ids': [(6, 0, [])] if not item.get('cutter_pad_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_pad_codes']), - 'blade_ids': [(6, 0, [])] if not item.get('blade_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['blade_codes']), - 'handle_ids': [(6, 0, [])] if not item.get('handle_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['handle_codes']), - "flange_diameter": item['flange_diameter'], - "outer_diameter": item['outer_diameter'], - "inner_diameter": item['inner_diameter'], - "active": item['active'], - }) - else: - raise ValidationError("刀具型号认证未通过") - - # 同步所有刀具型号列表 - def sync_all_tool_model(self): - sf_sync_config = self.env['res.config.settings'].get_values() - token = sf_sync_config['token'] - sf_secret_key = sf_sync_config['sf_secret_key'] - headers = Common.get_headers(self, token, sf_secret_key) - - strUrl = sf_sync_config['sf_url'] + self.url - r = requests.post(strUrl, json={}, data=None, headers=headers) - r = r.json() - result = json.loads(r['result']) - print('result', result) - if result['status'] == 1: - _logger.info('result:%s' % result) - for item in result['mrs_cutting_tool_model_all_list']: - cutting_tool_model = self.search( - [("code", '=', item['code'])]) - if not cutting_tool_model: - self.env['sf.cutting.tool.model'].create({ - "name": item['name'], - "code": item['code'], - "brand_id": self.env['sf.machine.brand'].search( - [("code", '=', item['brand_code'])]).id, - "material_model_id": self.env['sf.materials.model'].search( - [("materials_no", '=', item['material_model_code'])]).id, - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, - "cutting_tool_type_id": self.env['sf.cutting.tool.type'].search( - [("code", '=', item['cutting_tool_type_code'])]).id, - "tool_length": item['tool_length'], - "tool_width": item['tool_width'], - "tool_height": item['tool_height'], - "tool_thickness": item['tool_thickness'], - "tool_weight": item['tool_weight'], - "coating_material": item['coating_material'], - "total_length": item['total_length'], - "shank_length": item['shank_length'], - "blade_length": item['blade_length'], - "front_angle": item['front_angle'], - "rear_angle": item['rear_angle'], - "main_included_angle": item['main_included_angle'], - "nut": item['nut'], - "top_angle": item['top_angle'], - "jump_accuracy": item['jump_accuracy'], - "working_hardness": item['working_hardness'], - "blade_diameter": item['blade_diameter'], - "wrench": item['wrench'], - "screw": item['screw'], - "accuracy_level": item['accuracy_level'], - "diameter_max": item['diameter_max'], - "clamping_diameter": item['clamping_diameter'], - "flange_length": item['flange_length'], - 'chuck_ids': [(6, 0, [])] if not item.get('chuck_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['chuck_codes']), - 'cutter_bar_ids': [(6, 0, [])] if not item.get('cutter_bar_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_bar_codes']), - 'cutter_pad_ids': [(6, 0, [])] if not item.get('cutter_pad_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_pad_codes']), - 'blade_ids': [(6, 0, [])] if not item.get('blade_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['blade_codes']), - 'handle_ids': [(6, 0, [])] if not item.get('handle_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['handle_codes']), - "flange_diameter": item['flange_diameter'], - "outer_diameter": item['outer_diameter'], - "inner_diameter": item['inner_diameter'], - "active": item['active'], - }) - else: - cutting_tool_model.write({ - "name": item['name'], - "brand_id": self.env['sf.machine.brand'].search( - [("code", '=', item['brand_code'])]).id, - "material_model_id": self.env['sf.materials.model'].search( - [("materials_no", '=', item['material_model_code'])]).id, - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, - "cutting_tool_type_id": self.env['sf.cutting.tool.type'].search( - [("code", '=', item['cutting_tool_type_code'])]).id, - "tool_length": item['tool_length'], - "tool_width": item['tool_width'], - "tool_height": item['tool_height'], - "tool_thickness": item['tool_thickness'], - "tool_weight": item['tool_weight'], - "coating_material": item['coating_material'], - "total_length": item['total_length'], - "shank_length": item['shank_length'], - "blade_length": item['blade_length'], - "front_angle": item['front_angle'], - "rear_angle": item['rear_angle'], - "main_included_angle": item['main_included_angle'], - "nut": item['nut'], - "top_angle": item['top_angle'], - "jump_accuracy": item['jump_accuracy'], - "working_hardness": item['working_hardness'], - "blade_diameter": item['blade_diameter'], - "wrench": item['wrench'], - "screw": item['screw'], - "accuracy_level": item['accuracy_level'], - "diameter_max": item['diameter_max'], - "clamping_diameter": item['clamping_diameter'], - "flange_length": item['flange_length'], - 'chuck_ids': [(6, 0, [])] if not item.get('chuck_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['chuck_codes']), - 'cutter_bar_ids': [(6, 0, [])] if not item.get('cutter_bar_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_bar_codes']), - 'cutter_pad_ids': [(6, 0, [])] if not item.get('cutter_pad_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['cutter_pad_codes']), - 'blade_ids': [(6, 0, [])] if not item.get('blade_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['blade_codes']), - 'handle_ids': [(6, 0, [])] if not item.get('handle_codes') else - self.env['mrs.cutting.tool.dynamic.model'].sudo()._get_cutting_tool_model_ids( - item['handle_codes']), - "flange_diameter": item['flange_diameter'], - "outer_diameter": item['outer_diameter'], - "inner_diameter": item['inner_diameter'], - "active": item['active'], - }) - else: - raise ValidationError("刀具型号认证未通过") From 708889b1edc7b86c4fc489042733ed2eefe686ee Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 9 Oct 2023 15:21:41 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=E5=8F=8A=E5=88=80=E5=85=B7=E5=9E=8B?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E5=AE=9A=E6=97=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_mrs_connect/data/ir_cron_data.xml | 71 ++++++++-------------------- 1 file changed, 19 insertions(+), 52 deletions(-) diff --git a/sf_mrs_connect/data/ir_cron_data.xml b/sf_mrs_connect/data/ir_cron_data.xml index 9dd035d3..cea0fdbc 100644 --- a/sf_mrs_connect/data/ir_cron_data.xml +++ b/sf_mrs_connect/data/ir_cron_data.xml @@ -1,7 +1,7 @@ - 同步资源库材料 + 同步静态资源库材料 code model.sync_production_materials() @@ -12,7 +12,7 @@ - 同步资源库材料型号 + 同步静态资源库材料型号 code model.sync_materials_model() @@ -23,7 +23,7 @@ - 同步表面工艺类别 + 同步静态表面工艺类别 code model.sync_production_process_category() @@ -34,7 +34,7 @@ - 同步资源库表面工艺 + 同步静态资源库表面工艺 code model.sync_production_process() @@ -45,7 +45,7 @@ - 同步资源库加工工艺 + 同步静态资源库加工工艺 code model.sync_processing_technology() @@ -56,7 +56,7 @@ - 同步资源库标签 + 同步静态资源库标签 code model.sync_machine_brand_tags() @@ -67,7 +67,7 @@ - 同步资源库控制系统 + 同步静态资源库数控系统 code model.sync_machine_tool_type_control_system() @@ -78,7 +78,7 @@ - 同步资源库品牌 + 同步静态资源库品牌 code model.sync_machine_brand() @@ -89,7 +89,7 @@ - 同步资源库机床型号 + 同步静态资源库机床型号 code model.sync_machine_tool_type() @@ -100,7 +100,7 @@ - 同步资源库工序 + 同步静态资源库工序 code model.sync_processing_order() @@ -111,7 +111,7 @@ - 同步表面工艺可选参数 + 同步静态表面工艺可选参数 code model.sync_production_process_parameter() @@ -122,7 +122,7 @@ - 同步资源库机床类型 + 同步静态资源库机床类型 code model.sync_machine_tool_category() @@ -134,7 +134,7 @@ - 同步刀具物料 + 同步静态资源库刀具物料 code model.sync_cutting_tool_material() @@ -145,7 +145,7 @@ - 同步刀具类型 + 同步静态资源库刀具类型 code model.sync_tool_type() @@ -155,30 +155,8 @@ - - 同步刀具型号 - - code - model.sync_tool_model() - 1 - days - -1 - - - - - - - - - - - - - - - 同步功能刀具类型 + 同步静态资源库功能刀具类型 code model.sync_functional_cutting_tool_model() @@ -189,7 +167,7 @@ - 同步夹具物料 + 同步静态资源库夹具物料 code model.sync_fixture_material() @@ -200,7 +178,7 @@ - 同步联装类型 + 同步静态资源库联装类型 code model.sync_multi_mounting_type() @@ -211,7 +189,7 @@ - 同步夹具型号 + 同步静态资源库夹具型号 code model.sync_fixture_model() @@ -222,7 +200,7 @@ - 同步功能夹具类型 + 同步静态资源库功能夹具类型 code model.sync_functional_fixture_type() @@ -231,15 +209,4 @@ -1 - - - - - - - - - - - \ No newline at end of file From b9d6e0ea35481d9732cc0bd563f6b517c6d6c84d Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Mon, 9 Oct 2023 17:35:39 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E6=9D=90=E6=96=99=E5=9E=8B=E5=8F=B7?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BD=E9=99=85=E6=A0=87=E5=87=86=E5=92=8C?= =?UTF-8?q?=E6=9D=90=E6=96=99=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/common.py | 22 ++++ sf_base/security/ir.model.access.csv | 2 + sf_base/views/common_view.xml | 21 ++-- sf_mrs_connect/models/res_config_setting.py | 12 +- sf_mrs_connect/models/sync_common.py | 126 +++++++++++++++++++- 5 files changed, 165 insertions(+), 18 deletions(-) diff --git a/sf_base/models/common.py b/sf_base/models/common.py index 4425960c..15b4c65f 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -68,6 +68,11 @@ class MrsMaterialModel(models.Model): density = fields.Float("密度(kg/m³)") materials_id = fields.Many2one('sf.production.materials', "材料名") tensile_strength = fields.Char("拉伸强度(n/mm²)") + standards_id = fields.Many2one('sf.international.standards', '制造标准') + alloy_code = fields.Char('合金牌号') + price = fields.Float('单价/kg') + apply = fields.Many2many('material.apply', string='材料应用') + materials_code = fields.Char('材料代号') hardness = fields.Float("硬度(hrc)") rough_machining = fields.Float("粗加工Vc(m/min)") finish_machining = fields.Float("精加工Vc(m/min)") @@ -172,3 +177,20 @@ class MrsProductionProcessParameter(models.Model): for i in item.parameter_ids: code_arr.append(i.code) return code_arr + + +class ModelInternationalStandards(models.Model): + _name = 'sf.international.standards' + _description = '制造标准' + + code = fields.Char('编码') + name = fields.Char('名称') + active = fields.Boolean('有效', default=True) + + +class MrsMaterialApply(models.Model): + _name = 'material.apply' + _description = '材料应用' + + name = fields.Char('名称', default=True) + active = fields.Boolean('有效', default=True) diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index fefaeb1b..1829085c 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -24,6 +24,8 @@ access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user, access_sf_functional_fixture_type,sf_functional_fixture_type,model_sf_functional_fixture_type,base.group_user,1,1,1,1 access_sf_functional_fixture,sf_functional_fixture,model_sf_functional_fixture,base.group_user,1,1,1,1 access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,1 +access_sf_international_standards,sf_international_standards,model_sf_international_standards,base.group_user,1,1,1,1 +access_material_apply,material_apply,model_material_apply,base.group_user,1,1,1,1 diff --git a/sf_base/views/common_view.xml b/sf_base/views/common_view.xml index b079beda..156ecdab 100644 --- a/sf_base/views/common_view.xml +++ b/sf_base/views/common_view.xml @@ -241,17 +241,20 @@ sf.materials.model - - - - + + + + + + - + - - - - + + + + + diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py index c158ab09..c2a7361c 100644 --- a/sf_mrs_connect/models/res_config_setting.py +++ b/sf_mrs_connect/models/res_config_setting.py @@ -29,7 +29,7 @@ class ResConfigSettings(models.TransientModel): _logger.info("同步资源库表面工艺类别") self.env['sf.production.process'].sync_all_production_process() _logger.info("同步资源库表面工艺") - self.env['sf.processing.technology'].sync_all_processing_technology() + # self.env['sf.processing.technology'].sync_all_processing_technology() _logger.info("同步资源库加工工艺") self.env['sf.machine.brand.tags'].sync_all_machine_brand_tags() _logger.info("同步资源库品牌类别") @@ -47,8 +47,8 @@ class ResConfigSettings(models.TransientModel): _logger.info("同步所有刀具类型...") self.env['sf.cutting.tool.type'].sync_all_tool_type() _logger.info("同步所有刀具类型完成") - _logger.info("同步所有刀具型号...") - self.env['sf.cutting.tool.model'].sync_all_tool_model() + # _logger.info("同步所有刀具型号...") + # self.env['sf.cutting.tool.model'].sync_all_tool_model() _logger.info("同步所有刀具型号完成") _logger.info("定时同步所有功能刀具类型列表...") self.env['sf.functional.cutting.tool.model'].sync_all_functional_cutting_tool_model() @@ -64,9 +64,13 @@ class ResConfigSettings(models.TransientModel): _logger.info("同步夹具型号") self.env['sf.functional.fixture.type'].sync_all_functional_fixture_type() _logger.info("同步功能夹具类型") - self.env['sf.functional.fixture'].sync_all_functional_fixture() + # self.env['sf.functional.fixture'].sync_all_functional_fixture() self.env['sf.machine_tool.type'].sync_all_machine_tool_type() _logger.info("同步资源库机床型号") + self.env['sf.international.standards'].sync_all_mrs_international_standards() + _logger.info("同步资源库国际标准") + self.env['material.apply'].sync_all_material_apply() + _logger.info("同步资源库材料应用") except Exception as e: _logger.info("捕获错误信息:%s" % e) raise ValidationError("数据错误导致同步失败,请联系管理员") diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 3d309689..f0ada89b 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -165,9 +165,15 @@ class sfMaterialModel(models.Model): "finish_machining": item['finish_machining'], "materials_id": self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]).id, + "standards_id": self.env['sf.international.standards'].search( + [("name", '=', item['standards_id'])]).id, "need_h": item['need_h'], + "alloy_code": item['alloy_code'], "mf_materia_post": item['mf_materia_post'], "density": item['density'], + "materials_code": item['materials_code'], + "apply": self.env['material.apply'].search( + [("name", 'in', item['apply'])]).ids # "tag_ids": item['tag_ids'] }) @@ -255,12 +261,12 @@ class sfProductionProcess(models.Model): for item in result['production_process_yesterday_list']: if item: brand = self.env['sf.production.process'].search( - [("process_encode", '=', item['process_encode'])]) + [("process_encode", '=', item['code'])]) if brand: brand.name = item['name'], brand.category_id = self.env['sf.production.process.category'].search( [("code", '=', item['category_code'])]).id, - brand.process_encode = item['process_encode'], + brand.process_encode = item['code'], brand.remark = item['remark'], brand.active = item['active'], brand.remark = item['remark'] @@ -269,7 +275,7 @@ class sfProductionProcess(models.Model): "name": item['name'], "category_id": self.env['sf.production.process.category'].search( [("code", '=', item['category_code'])]).id, - "process_encode": item['process_encode'], + "process_encode": item['code'], "remark": item['remark'], "active": item['active'], }) @@ -291,13 +297,13 @@ class sfProductionProcess(models.Model): for item in result['production_process_all_list']: if item: brand = self.env['sf.production.process'].search( - [("process_encode", '=', item['process_encode'])]) + [("process_encode", '=', item['code'])]) if not brand: self.env['sf.production.process'].create({ "name": item['name'], "category_id": self.env['sf.production.process.category'].search( [("code", '=', item['category_code'])]).id, - "process_encode": item['process_encode'], + "process_encode": item['code'], "remark": item['remark'], "active": item['active'], # "tag_ids": item['tag_ids'] @@ -2176,3 +2182,113 @@ class SfToolModel(models.Model): print('同步所有刀具型号列表成功') else: raise ValidationError("认证未通过") + +class MaterialApply(models.Model): + _inherit = 'material.apply' + _description = '材料应用' + url = '/api/material_apply/list' + + # 定时同步材料应用 + def sync_material_apply(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + for item in result['material_apply_yesterday_list']: + brand = self.env['material.apply'].search( + [("name", '=', item['name'])]) + if brand: + brand.name = item['name'], + brand.active = item['active'] + else: + self.env['material.apply'].create({ + "name": item['name'], + "active": item['active'], + + }) + else: + raise ValidationError("认证未通过") + + # 同步所有材料应用 + def sync_all_material_apply(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + for item in result['material_apply_all_list']: + brand = self.env['material.apply'].search( + [("name", '=', item['name'])]) + if not brand: + self.env['material.apply'].create({ + "name": item['name'], + "active": item['active'], + }) + else: + raise ValidationError("认证未通过") + +class ModelInternationalStandards(models.Model): + _inherit = 'sf.international.standards' + _description = '制造标准' + url = '/api/mrs_international_standards/list' + + # 定时同步制造标准 + def sync_mrs_international_standards(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + for item in result['mrs_international_standards_yesterday_list']: + brand = self.env['sf.international.standards'].search( + [("name", '=', item['name'])]) + if brand: + brand.name = item['name'], + brand.active = item['active'] + else: + self.env['sf.international.standards'].create({ + "name": item['name'], + "active": item['active'], + + }) + else: + raise ValidationError("认证未通过") + + # 同步所有制造标准 + def sync_all_mrs_international_standards(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + for item in result['mrs_international_standards_all_list']: + brand = self.env['sf.international.standards'].search( + [("name", '=', item['name'])]) + if not brand: + self.env['sf.international.standards'].create({ + "name": item['name'], + "active": item['active'], + }) + else: + raise ValidationError("认证未通过") From 6b7b5362366d62d11e93e1cccbc3ddffe2e24c4a Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 10 Oct 2023 17:19:11 +0800 Subject: [PATCH 12/21] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=90=8C=E6=AD=A5clo?= =?UTF-8?q?ud=E7=9A=84=E9=9D=99=E6=80=81=E8=B5=84=E6=BA=90=E5=BA=93?= =?UTF-8?q?=E7=9A=84=E5=AE=9A=E6=97=B6=E5=99=A8=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=202.=E6=96=B0=E5=A2=9E=E8=83=BD=E5=8A=9B=E7=89=B9=E5=BE=81?= =?UTF-8?q?=E5=BA=93=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/__manifest__.py | 2 +- sf_base/views/ir_cron_mrs.xml | 494 ++++++++------------ sf_base/views/tool_menu.xml | 14 +- sf_maintenance/models/sf_maintenance.py | 3 +- sf_maintenance/views/maintenance_views.xml | 35 +- sf_mrs_connect/data/ir_cron_data.xml | 379 +++++++-------- sf_mrs_connect/models/res_config_setting.py | 2 +- sf_mrs_connect/models/sync_common.py | 387 +++++++++------ 8 files changed, 652 insertions(+), 664 deletions(-) diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index bcb25c81..60077453 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['account', 'base', 'mrp_workorder','sale'], + 'depends': ['account', 'base', 'mrp_workorder', 'sale'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', diff --git a/sf_base/views/ir_cron_mrs.xml b/sf_base/views/ir_cron_mrs.xml index a1e88354..748e1bb5 100644 --- a/sf_base/views/ir_cron_mrs.xml +++ b/sf_base/views/ir_cron_mrs.xml @@ -1,50 +1,50 @@ - - 基础信息同步:品牌类别 - - code - model._cron_machine_brand_tags_func() - 1 - days - -1 - - - + + + + + + + + + + + - - 基础信息同步:工序 - - code - model._cron_processing_order_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:品牌 - - code - model._cron_machine_brand_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:机床型号 - - code - model._cron_machine_tool_type_func() - 1 - days - -1 - - + + + + + + + + + + @@ -80,50 +80,50 @@ - - 基础信息同步:材料 - - code - model._cron_production_materials_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:材料型号 - - code - model._cron_materials_model_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:表面工艺类别 - - code - model._cron_production_process_category_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:表面工艺 - - code - model._cron_production_process_func() - 1 - days - -1 - - + + + + + + + + + + @@ -136,237 +136,127 @@ - - 基础信息同步:数控系统 - - code - model._cron_machine_control_system_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:模型类型 - - code - model._cron_model_type_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:可选参数 - - code - model._cron_mrs_production_process_parameter() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:机床类型 - - code - model._cron_machine_tool_category_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:功能刀具型号 - - code - model._cron_mrs_functional_cutting_tool_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:功能刀具类型 - - code - model._cron_mrs_functional_cutting_tool_model_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:整体式刀具 - - code - model._cron_mrs_integral_cutting_tool_func() - 1 - days - -1 - - + + + + + + + + + + + - - 基础信息同步:整体式刀具类型 - - code - model._cron_mrs_integral_cutting_tool_model_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:刀片型号 - - code - model._cron_mrs_blade_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:刀片类型 - - code - model._cron_mrs_blade_model_func() - 1 - days - -1 - - + + + + + + + + + + - - 基础信息同步:刀杆型号 - - code - model._cron_mrs_cutter_bar_func() - 1 - days - -1 - - - - - 基础信息同步:刀杆类型 - - code - model._cron_mrs_cutter_bar_model_func() - 1 - days - -1 - - - - - 基础信息同步:刀盘型号 - - code - model._cron_mrs_cutter_pad_func() - 1 - days - -1 - - - - - 基础信息同步:刀盘类型 - - code - model._cron_mrs_cutter_pad_model_func() - 1 - days - -1 - - - - - - 基础信息同步:刀柄型号 - - code - model._cron_mrs_handle_func() - 1 - days - -1 - - - - - 基础信息同步:刀柄类型 - - code - model._cron_mrs_handle_model_func() - 1 - days - -1 - - - - - 基础信息同步:夹具物料 - - code - model._cron_fixture_material_func() - 1 - days - -1 - - - - - 基础信息同步:联装类型 - - code - model._cron_multi_mounting_type_func() - 1 - days - -1 - - - - - 基础信息同步:夹具型号 - - code - model._cron_fixture_model_func() - 1 - days - -1 - - - - - 基础信息同步:功能夹具类型 - - code - model._cron_functional_fixture_type_func() - 1 - days - -1 - - - - - 基础信息同步:功能夹具 - - code - model._cron_functional_fixture_func() - 1 - days - -1 - - + + + + + + + + + + diff --git a/sf_base/views/tool_menu.xml b/sf_base/views/tool_menu.xml index eeaf0aca..4f6bb693 100644 --- a/sf_base/views/tool_menu.xml +++ b/sf_base/views/tool_menu.xml @@ -62,13 +62,13 @@ action="action_sf_cutting_tool_type" /> - + + + + + + + diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index 90574f2b..dca24821 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -574,7 +574,8 @@ class MaintenanceStandardImage(models.Model): name = fields.Char('名称') image = fields.Binary(string='图文') type = fields.Selection( - [('加工能力', '加工能力'), ('刀尖特征', '刀尖特征'), ('柄部类型', '柄部类型'), ('走刀方向', '走刀方向'), ('冷却液', '冷却液')], + [('加工能力', '加工能力'), ('刀尖特征', '刀尖特征'), ('柄部类型', '柄部类型'), ('走刀方向', '走刀方向'), + ('冷却液', '冷却液'), ('压紧方式', '压紧方式'), ('刀片形状', '刀片形状')], string='特征') equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备') diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 258dfb34..6bd0af90 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -953,40 +953,37 @@ maintenance.equipment.image.tree maintenance.equipment.image - - - - - + + + + + - - maintenance.equipment.image.form + + + maintenance.equipment.image.search maintenance.equipment.image -
- - - - - - - - - -
+ + + +
能力特征库 maintenance.equipment.image - tree,form + tree [] + - - 同步静态资源库材料 - + + + 制造-配置:每日定时同步cloud的静态资源库 + code - model.sync_production_materials() + model._cron_static_resource_yesterday_func() 1 days -1 + + + + + + + + + + - - 同步静态资源库材料型号 - - code - model.sync_materials_model() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态表面工艺类别 - - code - model.sync_production_process_category() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库表面工艺 - - code - model.sync_production_process() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库加工工艺 - - code - model.sync_processing_technology() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库标签 - - code - model.sync_machine_brand_tags() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库数控系统 - - code - model.sync_machine_tool_type_control_system() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库品牌 - - code - model.sync_machine_brand() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库机床型号 - - code - model.sync_machine_tool_type() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库工序 - - code - model.sync_processing_order() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态表面工艺可选参数 - - code - model.sync_production_process_parameter() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库机床类型 - - code - model.sync_machine_tool_category() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库刀具物料 - - code - model.sync_cutting_tool_material() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库刀具类型 - - code - model.sync_tool_type() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库功能刀具类型 - - code - model.sync_functional_cutting_tool_model() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库夹具物料 - - code - model.sync_fixture_material() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库联装类型 - - code - model.sync_multi_mounting_type() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库夹具型号 - - code - model.sync_fixture_model() - 1 - days - -1 - - + + + + + + + + + + - - 同步静态资源库功能夹具类型 - - code - model.sync_functional_fixture_type() - 1 - days - -1 - - + + + + + + + + + + \ No newline at end of file diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py index 6eb78537..95128148 100644 --- a/sf_mrs_connect/models/res_config_setting.py +++ b/sf_mrs_connect/models/res_config_setting.py @@ -35,7 +35,7 @@ class ResConfigSettings(models.TransientModel): _logger.info("同步资源库品牌类别") self.env['sf.machine.brand'].sync_all_machine_brand() _logger.info("同步资源库品牌") - self.env['sf.machine.control_system'].sync_all_machine_tool_type_control_system() + self.env['sf.machine.control_system'].sync_all_machine_control_system() _logger.info("同步资源库控制系统") self.env['sf.machine_tool.category'].sync_all_machine_tool_category() _logger.info("同步资源库机床类型") diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 83036854..9a5146ea 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -10,14 +10,68 @@ from odoo.addons.sf_base.commons.common import Common _logger = logging.getLogger(__name__) +class MrStaticResourceDataSync(models.Model): + _name = 'sf.static.resource.datasync' + _description = '同步cloud的静态资源库' + + def _cron_static_resource_yesterday_func(self): + try: + self.env['sf.machine.brand.tags'].sync_machine_brand_tags_yesterday() + logging.info("品牌类别已每日同步成功") + self.env['sf.machine.brand'].sync_machine_brand_yesterday() + logging.info("品牌已每日同步成功") + self.env['sf.machine_tool.category'].sync_machine_tool_category_yesterday() + logging.info("机床类型已每日同步成功") + self.env['sf.machine_tool.type'].sync_machine_tool_type_yesterday() + logging.info("机床型号已每日同步成功") + self.env['sf.machine.control_system'].sync_machine_control_system_yesterday() + logging.info("数控系统已每日同步成功") + self.env['sf.production.materials'].sync_production_materials_yesterday() + logging.info("材料已每日同步成功") + self.env['sf.materials.model'].sync_materials_model_yesterday() + # logging.info("材料型号已每日同步成功") + # self.env['mrs.international.standards']._cron_mrs_international_standards_func() + # logging.info("材料型号材料应用已每日同步成功") + # self.env['material.apply']._cron_material_apply_func() + logging.info("材料型号材料应用已每日同步成功") + self.env['sf.production.process.category'].sync_production_process_category_yesterday() + logging.info("表面工艺类别已每日同步成功") + self.env['sf.production.process'].sync_production_process_yesterday() + logging.info("表面工艺已每日同步成功") + self.env['sf.production.process.parameter'].sync_production_process_parameter_yesterday() + logging.info("表面工艺可选参数已每日同步成功") + self.env['sf.processing.technology'].sync_processing_technology_yesterday() + logging.info("加工工艺已每日同步成功") + self.env['sf.processing.order'].sync_processing_order_yesterday() + logging.info("工序已同步已每日同步成功") + self.env['sf.fixture.material'].sync_fixture_material_yesterday() + logging.info("夹具物料已每日同步成功") + self.env['sf.multi_mounting.type'].sync_multi_mounting_type_yesterday() + logging.info("联装类型已每日同步成功") + self.env['sf.fixture.model'].sync_fixture_model_yesterday() + logging.info("夹具型号已每日同步成功") + self.env['sf.functional.fixture.type'].sync_functional_fixture_type_yesterday() + logging.info("功能夹具类型已每日同步成功") + self.env['sf.cutting.tool.material'].sync_cutting_tool_material_yesterday() + logging.info("刀具物料已每日同步成功") + self.env['sf.cutting.tool.type'].sync_tool_type_yesterday() + logging.info("刀具类型已每日同步成功") + self.env['sf.functional.cutting.tool.model'].sync_functional_cutting_tool_model_yesterday() + logging.info("功能刀具类型已每日同步成功") + self.env['maintenance.equipment.image'].sync_maintenance_equipment_image_yesterday() + logging.info("能力特征库已每日同步成功") + except Exception as e: + logging.info("捕获错误信息:%s" % e) + raise ValidationError("数据错误导致同步失败,请联系管理员") + + class sfProductionMaterials(models.Model): _inherit = "sf.production.materials" _description = "材料" url = '/api/production_materials/list' # 定时同步每日材料 - def sync_production_materials(self): - + def sync_production_materials_yesterday(self): # 配置中获取token sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] @@ -30,14 +84,13 @@ class sfProductionMaterials(models.Model): if result['status'] == 1: for item in result['production_materials_yesterday_list']: if item: - materials = self.env['sf.production.materials'].search( - [("materials_no", '=', item['materials_no'])]) + materials = self.search([("materials_no", '=', item['materials_no'])]) if materials: materials.name = item['name'] materials.remark = item['remark'] materials.active = item['active'] else: - self.env['sf.production.materials'].create({ + self.create({ "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], @@ -59,10 +112,9 @@ class sfProductionMaterials(models.Model): if result['status'] == 1: for item in result['production_materials_all_list']: if item: - materials = self.env['sf.production.materials'].search( - [("materials_no", '=', item['materials_no'])]) + materials = self.search([("materials_no", '=', item['materials_no'])]) if not materials: - self.env['sf.production.materials'].create({ + self.create({ "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], @@ -72,7 +124,6 @@ class sfProductionMaterials(models.Model): materials.name = item['name'] materials.remark = item['remark'] materials.active = item['active'] - else: raise ValidationError("材料认证未通过") @@ -83,7 +134,7 @@ class sfMaterialModel(models.Model): url = '/api/materials_model/list' # 定时同步每日材料型号 - def sync_materials_model(self): + def sync_materials_model_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -95,8 +146,7 @@ class sfMaterialModel(models.Model): if result['status'] == 1: for item in result['materials_model_yesterday_list']: if item: - materials_model = self.env['sf.materials.model'].search( - [("materials_no", '=', item['materials_no'])]) + materials_model = self.search([("materials_no", '=', item['materials_no'])]) materials = self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]) if materials_model: @@ -114,7 +164,7 @@ class sfMaterialModel(models.Model): materials_model.density = item['density'] materials_model.active = item['active'] else: - self.env['sf.materials.model'].create({ + self.create({ "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], @@ -144,12 +194,11 @@ class sfMaterialModel(models.Model): if result['status'] == 1: for item in result['materials_model_all_list']: if item: - materials_model = self.env['sf.materials.model'].search( - [("materials_no", '=', item['materials_no'])]) + materials_model = self.search([("materials_no", '=', item['materials_no'])]) materials = self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]) if not materials_model: - self.env['sf.materials.model'].create({ + self.create({ "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], @@ -186,7 +235,7 @@ class sfProductionProcessCategory(models.Model): url = '/api/production_process_category/list' # 定时同步每日表面工艺类别 - def sync_production_process_category(self): + def sync_production_process_category_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -198,14 +247,13 @@ class sfProductionProcessCategory(models.Model): if result['status'] == 1: for item in result['production_process_category_yesterday_list']: if item: - production_process_category = self.env['sf.production.process.category'].search( - [("code", '=', item['code'])]) + production_process_category = self.search([("code", '=', item['code'])]) if production_process_category: production_process_category.name = item['name'] production_process_category.code = item['code'] production_process_category.active = item['active'] else: - self.env['sf.production.process.category'].create({ + self.create({ "name": item['name'], "code": item['code'], "active": item['active'], @@ -226,10 +274,9 @@ class sfProductionProcessCategory(models.Model): if result['status'] == 1: for item in result['production_process_category_all_list']: if item: - category = self.env['sf.production.process.category'].search( - [("code", '=', item['code'])]) + category = self.search([("code", '=', item['code'])]) if not category: - self.env['sf.production.process.category'].create({ + self.create({ "name": item['name'], "code": item['code'], "active": item['active'], @@ -247,7 +294,7 @@ class sfProductionProcess(models.Model): url = '/api/production_process/list' # 定时同步每日表面工艺 - def sync_production_process(self): + def sync_production_process_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -259,8 +306,7 @@ class sfProductionProcess(models.Model): if result['status'] == 1: for item in result['production_process_yesterday_list']: if item: - production_process = self.env['sf.production.process'].search( - [("process_encode", '=', item['code'])]) + production_process = self.search([("process_encode", '=', item['code'])]) category = self.env['sf.production.process.category'].search( [("code", '=', item['category_code'])]) if production_process: @@ -269,7 +315,7 @@ class sfProductionProcess(models.Model): production_process.remark = item['remark'] production_process.active = item['active'] else: - self.env['sf.production.process'].create({ + self.create({ "name": item['name'], "category_id": category.id, "process_encode": item['code'], @@ -277,7 +323,7 @@ class sfProductionProcess(models.Model): "active": item['active'], }) else: - raise ValidationError("表面工艺认证未通过") # 定时同步表面工艺 + raise ValidationError("表面工艺认证未通过") # 同步所有表面工艺 def sync_all_production_process(self): @@ -292,12 +338,11 @@ class sfProductionProcess(models.Model): if result['status'] == 1: for item in result['production_process_all_list']: if item: - production_process = self.env['sf.production.process'].search( - [("process_encode", '=', item['code'])]) + production_process = self.search([("process_encode", '=', item['code'])]) category = self.env['sf.production.process.category'].search( [("code", '=', item['category_code'])]) if not production_process: - self.env['sf.production.process'].create({ + self.create({ "name": item['name'], "category_id": category.id, "process_encode": item['process_encode'], @@ -319,7 +364,7 @@ class sfProcessingTechnology(models.Model): url = '/api/processing_technology/list' # 定时同步加工工艺 - def sync_processing_technology(self): + def sync_processing_technology_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -331,14 +376,13 @@ class sfProcessingTechnology(models.Model): if result['status'] == 1: for item in result['processing_technology_yesterday_list']: if item: - processing_technology = self.env['sf.processing.technology'].search( - [("process_encode", '=', item['process_encode'])]) + processing_technology = self.search([("process_encode", '=', item['process_encode'])]) if processing_technology: processing_technology.name = item['name'] processing_technology.remark = item['remark'] processing_technology.active = item['active'] else: - self.env['sf.processing.technology'].create({ + self.create({ "name": item['name'], "process_encode": item['process_encode'], "remark": item['remark'], @@ -360,10 +404,9 @@ class sfProcessingTechnology(models.Model): if result['status'] == 1: for item in result['processing_technology_all_list']: if item: - processing_technology = self.env['sf.processing.technology'].search( - [("process_encode", '=', item['process_encode'])]) + processing_technology = self.search([("process_encode", '=', item['process_encode'])]) if not processing_technology: - self.env['sf.processing.technology'].create({ + self.create({ "name": item['name'], "process_encode": item['process_encode'], "remark": item['remark'], @@ -383,7 +426,7 @@ class MachineBrandTags(models.Model): url = '/api/machine_brand_tags/list' # 定时同步品牌类别 - def sync_machine_brand_tags(self): + def sync_machine_brand_tags_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -394,13 +437,12 @@ class MachineBrandTags(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['machine_brand_tags_yesterday_list']: - brand_tags = self.env['sf.machine.brand.tags'].search( - [("id", '=', item['id'])]) + brand_tags = self.search([("id", '=', item['id'])]) if brand_tags: brand_tags.name = item['name'] brand_tags.color = item['color'] else: - self.env['sf.machine.brand.tags'].create({ + self.create({ "name": item['name'], "color": item['color'], }) @@ -420,10 +462,9 @@ class MachineBrandTags(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['machine_brand_tags_all_list']: - brand_tags = self.env['sf.machine.brand.tags'].search( - [("name", '=', item['name'])]) + brand_tags = self.search([("name", '=', item['name'])]) if not brand_tags: - self.env['sf.machine.brand.tags'].create({ + self.create({ "name": item['name'], "color": item['color'], }) @@ -440,7 +481,7 @@ class MachineControlSystem(models.Model): url = '/api/machine_control_system/list' # 定时同步控制系统 - def sync_machine_tool_type_control_system(self): + def sync_machine_control_system_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -452,8 +493,7 @@ class MachineControlSystem(models.Model): if result['status'] == 1: for item in result['machine_control_system_yesterday_list']: if item: - control_system = self.env['sf.machine.control_system'].search( - [("code", '=', item['code'])]) + control_system = self.search([("code", '=', item['code'])]) brand = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]) if control_system: control_system.name = item['name'] @@ -461,7 +501,7 @@ class MachineControlSystem(models.Model): control_system.brand_id = brand.id control_system.active = item['active'] else: - self.env['sf.machine.control_system'].create({ + self.create({ "remark": item['remark'], "name": item['name'], "code": item['code'], @@ -472,7 +512,7 @@ class MachineControlSystem(models.Model): raise ValidationError("数控系统认证未通过") # 同步所有控制系统 - def sync_all_machine_tool_type_control_system(self): + def sync_all_machine_control_system(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -484,11 +524,10 @@ class MachineControlSystem(models.Model): if result['status'] == 1: for item in result['machine_control_system_all_list']: if item: - control_system = self.env['sf.machine.control_system'].search( - [("code", '=', item['code'])]) + control_system = self.search([("code", '=', item['code'])]) brand = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]) if not control_system: - self.env['sf.machine.control_system'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -510,7 +549,7 @@ class MachineBrand(models.Model): url = '/api/machine_brand/list' # 定时同步品牌 - def sync_machine_brand(self): + def sync_machine_brand_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -521,8 +560,7 @@ class MachineBrand(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['machine_brand_yesterday_list']: - brand = self.env['sf.machine.brand'].search( - [("code", '=', item['code'])]) + brand = self.search([("code", '=', item['code'])]) if brand: brand.name = item['name'] brand.image_brand = '' if not item['image_brand'] else base64.b64encode(item.image_brand) @@ -530,7 +568,7 @@ class MachineBrand(models.Model): brand.remark = item['remark'] brand.tag_ids = self.env['sf.machine.brand.tags'].search([("name", 'in', item['tag_ids'])]).ids else: - self.env['sf.machine.brand'].create({ + self.create({ "name": item['name'], "code": item['code'], "image_brand": '' if not item['image_brand'] else base64.b64encode(item.image_brand), @@ -553,14 +591,13 @@ class MachineBrand(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['machine_brand_all_list']: - brand = self.env['sf.machine.brand'].search( - [("code", '=', item['code'])]) + brand = self.search([("code", '=', item['code'])]) if not brand: if item.get('image_brand'): image = base64.b64decode(item['image_brand']) else: image = '' - self.env['sf.machine.brand'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -584,7 +621,7 @@ class MachineToolType(models.Model): url = '/api/machine_tool_type/list' # 定时同步机床型号 - def sync_machine_tool_type(self): + def sync_machine_tool_type_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -595,9 +632,9 @@ class MachineToolType(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['machine_tool_type_yesterday_list']: - machine_tool_type = self.env['sf.machine_tool.type'].search( - [("code", '=', item['code'])]) - control_system = self.env['sf.machine.control_system'].search([('code', '=', item['control_system_id'])]) + machine_tool_type = self.search([("code", '=', item['code'])]) + control_system = self.env['sf.machine.control_system'].search( + [('code', '=', item['control_system_id'])]) brand = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]) category = self.env['sf.machine_tool.category'].search([('code', '=', item['machine_tool_category'])]) if machine_tool_type: @@ -618,7 +655,8 @@ class MachineToolType(models.Model): 'control_system_id': control_system.id, "active": item['active'], 'brand_id': brand.id, - 'machine_tool_picture': '' if not item['machine_tool_picture'] else base64.b64decode(item['machine_tool_picture']), + 'machine_tool_picture': '' if not item['machine_tool_picture'] else base64.b64decode( + item['machine_tool_picture']), "heightened_way": item['heightened_way'], "workpiece_load": item['workpiece_load'], "lead_screw": item['lead_screw'], @@ -642,7 +680,7 @@ class MachineToolType(models.Model): "machine_tool_category": category.id, }) else: - self.env['sf.machine_tool.type'].create({ + self.create({ "name": item['name'], "code": item['code'], "knife_type": item['knife_type'], @@ -660,7 +698,8 @@ class MachineToolType(models.Model): 'control_system_id': control_system.id, "active": item['active'], 'brand_id': brand.id, - 'machine_tool_picture': '' if not item['machine_tool_picture'] else item['machine_tool_picture'].encode('utf-8'), + 'machine_tool_picture': '' if not item['machine_tool_picture'] else item[ + 'machine_tool_picture'].encode('utf-8'), "heightened_way": item['heightened_way'], "workpiece_load": item['workpiece_load'], "lead_screw": item['lead_screw'], @@ -702,14 +741,13 @@ class MachineToolType(models.Model): image = base64.b64decode(item['machine_tool_picture']) else: image = '' - machine_tool_type = self.env['sf.machine_tool.type'].search( - [("code", '=', item['code'])]) + machine_tool_type = self.search([("code", '=', item['code'])]) control_system = self.env['sf.machine.control_system'].search( [('code', '=', item['control_system_id'])]) brand = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]) category = self.env['sf.machine_tool.category'].search([('code', '=', item['machine_tool_category'])]) if not machine_tool_type: - self.env['sf.machine_tool.type'].create({ + self.create({ "name": item['name'], "code": item['code'], "number_of_knife_library": item['number_of_knife_library'], @@ -767,7 +805,7 @@ class MachineToolType(models.Model): "precision_max": item['precision_max'], 'control_system_id': control_system.id, "active": item['active'], - 'brand_id':brand.id, + 'brand_id': brand.id, 'machine_tool_picture': image, "heightened_way": item['heightened_way'], "workpiece_load": item['workpiece_load'], @@ -801,7 +839,7 @@ class sfProcessingOrder(models.Model): url = '/api/processing_order/list' # 定时同步工序 - def sync_processing_order(self): + def sync_processing_order_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -812,12 +850,11 @@ class sfProcessingOrder(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['processing_order_yesterday_list']: - processing_order = self.env['sf.processing.order'].search( - [("id", '=', item['id'])]) + processing_order = self.search([("id", '=', item['id'])]) if processing_order: processing_order.sequence = item['sequence'] else: - self.env['sf.processing.order'].create({ + self.create({ "sequence": item['sequence'], }) else: @@ -835,10 +872,9 @@ class sfProcessingOrder(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['processing_order_all_list']: - processing_order = self.env['sf.processing.order'].search( - [("id", '=', item['id'])]) + processing_order = self.search([("id", '=', item['id'])]) if not processing_order: - self.env['sf.processing.order'].create({ + self.create({ "sequence": item['sequence'], }) else: @@ -853,7 +889,7 @@ class sfProductionProcessParameter(models.Model): url = '/api/production_process_parameter/list' # 定时同步每日表面工艺 - def sync_production_process_parameter(self): + def sync_production_process_parameter_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -865,8 +901,7 @@ class sfProductionProcessParameter(models.Model): if result['status'] == 1: for item in result['mrs_production_process_parameter_yesterday_list']: if item: - production_process_parameter = self.env['sf.production.process.parameter'].search( - [("code", '=', item['code'])]) + production_process_parameter = self.search([("code", '=', item['code'])]) process = self.env['sf.production.process'].search( [('process_encode', '=', item['process_id_code'])]) if production_process_parameter: @@ -874,9 +909,9 @@ class sfProductionProcessParameter(models.Model): production_process_parameter.active = item['active'] production_process_parameter.process_id = process.id production_process_parameter.materials_model_ids = self.env['sf.materials.model'].search( - [('materials_no', 'in', item['materials_model_ids_codes'])]) + [('materials_no', 'in', item['materials_model_ids_codes'])]) else: - self.env['sf.production.process.parameter'].create({ + self.create({ "name": item['name'], "code": item['code'], "active": item['active'], @@ -902,13 +937,13 @@ class sfProductionProcessParameter(models.Model): for item in result['mrs_production_process_parameter_all_list']: if item: _logger.info('create可选参数:%s' % item) - production_process_parameter = self.env['sf.production.process.parameter'].search( + production_process_parameter = self.search( [("code", '=', item['code'])]) process = self.env['sf.production.process'].search( [('process_encode', '=', item['process_id_code'])]) if not production_process_parameter: _logger.info('create可选参数:%s' % item) - self.env['sf.production.process.parameter'].create({ + self.create({ "name": item['name'], "code": item['code'], "active": item['active'], @@ -932,7 +967,7 @@ class MachineToolCategory(models.Model): url = '/api/machine_tool_category/list' # 定时同步机床类型 - def sync_machine_tool_category(self): + def sync_machine_tool_category_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -943,15 +978,14 @@ class MachineToolCategory(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['machine_tool_category_yesterday_list']: - machine_tool_category = self.env['sf.machine_tool.category'].search( - [("code", '=', item['code'])]) + machine_tool_category = self.search([("code", '=', item['code'])]) if machine_tool_category: machine_tool_category.name = item['name'] machine_tool_category.category = item['category'] machine_tool_category.remark = item['remark'] machine_tool_category.active = item['active'] else: - self.env['sf.machine_tool.category'].create({ + self.create({ "name": item['name'], "code": item['code'], "category": item['category'], @@ -973,10 +1007,9 @@ class MachineToolCategory(models.Model): result = json.loads(r['result']) if result['status'] == 1: for item in result['machine_tool_category_all_list']: - machine_tool_category = self.env['sf.machine_tool.category'].search( - [("code", '=', item['code'])]) + machine_tool_category = self.search([("code", '=', item['code'])]) if not machine_tool_category: - self.env['sf.machine_tool.category'].create({ + self.create({ "name": item['name'], "code": item['code'], "category": item['category'], @@ -1000,7 +1033,7 @@ class sfSyncCutting_tool_Material(models.Model): url = '/api/mrs_cutting_tool_material/list' # 定时同步每日刀具物料 - def sync_cutting_tool_material(self): + def sync_cutting_tool_material_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -1014,10 +1047,9 @@ class sfSyncCutting_tool_Material(models.Model): if result.get('mrs_cutting_tool_material_yesterday_list'): for item in result['mrs_cutting_tool_material_yesterday_list']: if item: - cutting_tool_material = self.env['sf.cutting.tool.material'].search( - [("code", '=', item['code'])]) + cutting_tool_material = self.search([("code", '=', item['code'])]) if not cutting_tool_material: - self.env['sf.cutting.tool.material'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1047,10 +1079,9 @@ class sfSyncCutting_tool_Material(models.Model): if result.get('mrs_cutting_tool_material_all_list'): for item in result['mrs_cutting_tool_material_all_list']: if item: - cutting_tool_material = self.env['sf.cutting.tool.material'].search( - [("code", '=', item['code'])]) + cutting_tool_material = self.search([("code", '=', item['code'])]) if not cutting_tool_material: - self.env['sf.cutting.tool.material'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1073,7 +1104,7 @@ class SyncFunctionalCuttingToolModel(models.Model): url = '/api/mrs_functional_cutting_tool_model/list' # 定时同步每日功能刀具类型列表 - def sync_functional_cutting_tool_model(self): + def sync_functional_cutting_tool_model_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -1087,10 +1118,9 @@ class SyncFunctionalCuttingToolModel(models.Model): if result.get('mrs_functional_cutting_tool_model_yesterday_list'): for item in result['mrs_functional_cutting_tool_model_yesterday_list']: if item: - functional_cutting_tool_model = self.env['sf.functional.cutting.tool.model'].search( - [("code", '=', item['code'])]) + functional_cutting_tool_model = self.search([("code", '=', item['code'])]) if not functional_cutting_tool_model: - self.env['sf.functional.cutting.tool.model'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1121,10 +1151,9 @@ class SyncFunctionalCuttingToolModel(models.Model): if result.get('mrs_functional_cutting_tool_model_all_list'): for item in result['mrs_functional_cutting_tool_model_all_list']: if item: - functional_cutting_tool_model = self.env['sf.functional.cutting.tool.model'].search( - [("code", '=', item['code'])]) + functional_cutting_tool_model = self.search([("code", '=', item['code'])]) if not functional_cutting_tool_model: - self.env['sf.functional.cutting.tool.model'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1147,7 +1176,7 @@ class SyncFixtureMaterial(models.Model): url = '/api/fixture_material/list' # 定时同步夹具物料列表 - def sync_fixture_material(self): + def sync_fixture_material_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -1161,10 +1190,9 @@ class SyncFixtureMaterial(models.Model): if result.get('fixture_material_yesterday_list'): for item in result['fixture_material_yesterday_list']: if item: - fixture_material = self.env['sf.fixture.material'].search( - [("code", '=', item['code'])]) + fixture_material = self.search([("code", '=', item['code'])]) if not fixture_material: - self.env['sf.fixture.material'].create({ + self.create({ "name": item['name'], "code": item['code'], "category": item['category'], @@ -1197,10 +1225,9 @@ class SyncFixtureMaterial(models.Model): if result.get('fixture_material_all_list'): for item in result['fixture_material_all_list']: if item: - fixture_material = self.env['sf.fixture.material'].search( - [("code", '=', item['code'])]) + fixture_material = self.search([("code", '=', item['code'])]) if not fixture_material: - self.env['sf.fixture.material'].create({ + self.create({ "name": item['name'], "code": item['code'], "category": item['category'], @@ -1225,7 +1252,7 @@ class SyncMulti_Mounting_Type(models.Model): url = '/api/multi_mounting_type/list' # 定时同步联装类型列表 - def sync_multi_mounting_type(self): + def sync_multi_mounting_type_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -1238,10 +1265,9 @@ class SyncMulti_Mounting_Type(models.Model): if result.get('multi_mounting_type_yesterday_list'): for item in result['multi_mounting_type_yesterday_list']: if item: - multi_mounting_type = self.env['sf.multi_mounting.type'].search( - [("code", '=', item['code'])]) + multi_mounting_type = self.search([("code", '=', item['code'])]) if not multi_mounting_type: - self.env['sf.multi_mounting.type'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1271,10 +1297,9 @@ class SyncMulti_Mounting_Type(models.Model): if result.get('multi_mounting_type_all_list'): for item in result['multi_mounting_type_all_list']: if item: - multi_mounting_type = self.env['sf.multi_mounting.type'].search( - [("code", '=', item['code'])]) + multi_mounting_type = self.search([("code", '=', item['code'])]) if not multi_mounting_type: - self.env['sf.multi_mounting.type'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1297,7 +1322,7 @@ class SyncFixtureModel(models.Model): url = '/api/fixture_model/list' # 定时同步夹具型号列表 - def sync_fixture_model(self): + def sync_fixture_model_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -1310,10 +1335,9 @@ class SyncFixtureModel(models.Model): if result.get('fixture_model_yesterday_list'): for item in result['fixture_model_yesterday_list']: if item: - fixture_model = self.env['sf.fixture.model'].search( - [("code", '=', item['code'])]) + fixture_model = self.search([("code", '=', item['code'])]) if not fixture_model: - self.env['sf.fixture.model'].create({ + self.create({ "name": item['name'], "code": item['code'], "fixture_material_id": self.env['sf.fixture.material'].search( @@ -1391,10 +1415,9 @@ class SyncFixtureModel(models.Model): if result.get('fixture_model_all_list'): for item in result['fixture_model_all_list']: if item: - fixture_model = self.env['sf.fixture.model'].search( - [("code", '=', item['code'])]) + fixture_model = self.search([("code", '=', item['code'])]) if not fixture_model: - self.env['sf.fixture.model'].create({ + self.create({ "name": item['name'], "code": item['code'], "fixture_material_id": self.env['sf.fixture.material'].search( @@ -1465,7 +1488,7 @@ class SyncFunctionalFixtureType(models.Model): url = '/api/functional_fixture_type/list' # 定时同步功能夹具类型列表 - def sync_functional_fixture_type(self): + def sync_functional_fixture_type_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -1479,10 +1502,9 @@ class SyncFunctionalFixtureType(models.Model): if result.get('functional_fixture_type_yesterday_list'): for item in result['functional_fixture_type_yesterday_list']: if item: - functional_fixture_type = self.env['sf.functional.fixture.type'].search( - [("code", '=', item['code'])]) + functional_fixture_type = self.search([("code", '=', item['code'])]) if not functional_fixture_type: - self.env['sf.functional.fixture.type'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1511,10 +1533,9 @@ class SyncFunctionalFixtureType(models.Model): if result.get('functional_fixture_type_all_list'): for item in result['functional_fixture_type_all_list']: if item: - functional_fixture_type = self.env['sf.functional.fixture.type'].search( - [("code", '=', item['code'])]) + functional_fixture_type = self.search([("code", '=', item['code'])]) if not functional_fixture_type: - self.env['sf.functional.fixture.type'].create({ + self.create({ "name": item['name'], "code": item['code'], "remark": item['remark'], @@ -1538,7 +1559,7 @@ class SfToolType(models.Model): url = '/api/mrs_cutting_tool_type/list' # 定时同步每日刀具类型 - def sync_tool_type(self): + def sync_tool_type_yesterday(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] sf_secret_key = sf_sync_config['sf_secret_key'] @@ -1551,22 +1572,21 @@ class SfToolType(models.Model): _logger.info('result:%s' % result) for item in result['mrs_cutting_tool_type_yesterday_list']: if item: - cutting_tool_type = self.env['sf.cutting.tool.type'].search( - [("code", '=', item['code'])]) + cutting_tool_type = self.search([("code", '=', item['code'])]) + cutting_tool_material = self.env['sf.cutting.tool.material'].search( + [("code", '=', item['cutting_tool_material_code'])]) if not cutting_tool_type: - self.env['sf.cutting.tool.type'].create({ + self.create({ "name": item['name'], "code": item['code'], - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, + "cutting_tool_material_id": cutting_tool_material.id, "remark": item['remark'], "active": item['active'], }) else: cutting_tool_type.write({ "name": item['name'], - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, + "cutting_tool_material_id": cutting_tool_material.id, "remark": item['remark'], "active": item['active'], }) @@ -1587,24 +1607,93 @@ class SfToolType(models.Model): _logger.info('result:%s' % result) for item in result['mrs_cutting_tool_type_all_list']: if item: - cutting_tool_type = self.env['sf.cutting.tool.type'].search( - [("code", '=', item['code'])]) + cutting_tool_type = self.search([("code", '=', item['code'])]) + cutting_tool_material = self.env['sf.cutting.tool.material'].search( + [("code", '=', item['cutting_tool_material_code'])]) if not cutting_tool_type: - self.env['sf.cutting.tool.type'].create({ + self.create({ "name": item['name'], "code": item['code'], - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, + "cutting_tool_material_id": cutting_tool_material.id, "remark": item['remark'], "active": item['active'], }) else: cutting_tool_type.write({ "name": item['name'], - "cutting_tool_material_id": self.env['sf.cutting.tool.material'].search( - [("code", '=', item['cutting_tool_material_code'])]).id, + "cutting_tool_material_id": cutting_tool_material.id, "remark": item['remark'], "active": item['active'], }) else: raise ValidationError("刀具类型认证未通过") + + +# 同步能力特征库 +class SfMaintenanceEquipmentImage(models.Model): + _inherit = 'maintenance.equipment.image' + _description = '能力特征库' + + url = '/api/maintenance_equipment_image/list' + + # 定时同步每日能力特征库 + def sync_maintenance_equipment_image_yesterday(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + _logger.info('result:%s' % result) + for item in result['ability_feature_library_yesterday_list']: + if item: + ability_feature_library = self.search([("name", '=', item['name'])]) + if not ability_feature_library: + self.create({ + "name": item['name'], + "type": item['type'], + "image": '' if not item['image'] else base64.b64decode(item['image']), + "active": item['active'], + }) + else: + ability_feature_library.write({ + "type": item['type'], + "image": '' if not item['image'] else base64.b64decode(item['image']), + "active": item['active'], + }) + else: + raise ValidationError("能力特征库认证未通过") + + # 同步所有能力特征库 + def sync_all_maintenance_equipment_image(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + _logger.info('result:%s' % result) + for item in result['ability_feature_library_all_list']: + if item: + ability_feature_library = self.search([("name", '=', item['name'])]) + if not ability_feature_library: + self.create({ + "name": item['name'], + "type": item['type'], + "image": '' if not item['image'] else base64.b64decode(item['image']), + "active": item['active'], + }) + else: + ability_feature_library.write({ + "type": item['type'], + "image": '' if not item['image'] else base64.b64decode(item['image']), + "active": item['active'], + }) + else: + raise ValidationError("能力特征库认证未通过") From b1d2cd1cebe65f37c79ef09db97e31dcf97468ce Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Wed, 11 Oct 2023 14:45:35 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=88=AB?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A0=B9=E6=8D=AE=E4=B8=8D=E5=90=8C=E7=B1=BB?= =?UTF-8?q?=E5=88=AB=E5=BF=85=E5=A1=AB=20=20=20=E8=AE=BE=E5=A4=87=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=80=E5=85=B7=E5=BA=93=E4=BD=8Dtable=20=E5=B9=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/models/sf_maintenance.py | 1 + sf_maintenance/views/maintenance_views.xml | 208 +++++++++--------- sf_manufacturing/__manifest__.py | 1 + sf_manufacturing/models/product_template.py | 40 ++++ sf_manufacturing/security/ir.model.access.csv | 1 + .../views/sf_maintenance_equipment.xml | 55 +++++ 6 files changed, 202 insertions(+), 104 deletions(-) create mode 100644 sf_manufacturing/views/sf_maintenance_equipment.xml diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index 90574f2b..b6e764e4 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -36,6 +36,7 @@ class SfMaintenanceEquipment(models.Model): num = "%04d" % m return num + equipment_maintenance_standards_ids = fields.Many2many('equipment.maintenance.standards', 'sf_maintenance_equipment_ids', string='设备维保标准') eq_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备保养标准', diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 258dfb34..fe9a35e3 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -73,105 +73,105 @@
- - + - - - + + + - - - + + +
@@ -184,54 +184,54 @@
@@ -611,7 +579,7 @@ - mm  + mm  @@ -635,19 +603,17 @@
- + @@ -665,25 +631,22 @@
@@ -691,31 +654,28 @@
 
 
 
-
From a57cdbe2f3cab8cf150003f08c530e3eeeb03a28 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Tue, 17 Oct 2023 15:10:25 +0800 Subject: [PATCH 21/21] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=85=B6=E4=BB=96table?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/models/sf_maintenance.py | 8 ++++++++ sf_maintenance/views/maintenance_views.xml | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index ec704d6a..5c916387 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -316,6 +316,14 @@ class SfMaintenanceEquipment(models.Model): robot_operating_temperature = fields.Char('环境温度') robot_operating_humidity = fields.Char('环境湿度') + # 其他参数(所有设备) + date_of_purchase = fields.Date('采购日期') + date_of_manufacture = fields.Date('出厂日期') + date_of_warranty = fields.Date('质保截至日期') + original_value = fields.Char('原值') + incomplete_value = fields.Char('残值') + + diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 971deccf..8156c886 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -972,6 +972,11 @@ + + + + +