From ecc9bd446feff6bf8fc5125d35f882d33e599ea9 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 6 Sep 2023 16:32:25 +0800 Subject: [PATCH 1/5] =?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 2/5] =?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 7551bf38ef560afb6a87d07a1008f32cc8b0ba70 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Sun, 8 Oct 2023 17:19:02 +0800 Subject: [PATCH 3/5] =?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: Mon, 9 Oct 2023 15:15:52 +0800 Subject: [PATCH 4/5] =?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 5/5] =?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