From a9c2d1aa5c4a78f72ec74b79ef8b16d469f7d0e3 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Thu, 28 Dec 2023 16:27:40 +0800 Subject: [PATCH 01/16] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=8F=82=E6=95=B0=E7=9A=84=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=8A=E6=96=B9=E6=B3=95=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E9=80=82=E9=85=8D=E5=88=80=E7=89=87=E5=9E=8B=E5=8F=B7?= =?UTF-8?q?=E5=8F=8A=E9=80=82=E9=85=8D=E5=88=80=E6=9F=84=E5=9E=8B=E5=8F=B7?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E5=8F=8A=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=88=80=E6=9F=84=E9=95=BF=E5=BA=A6=EF=BC=8C=E5=88=80=E6=9F=84?= =?UTF-8?q?=E7=9B=B4=E5=BE=84=EF=BC=8C=E6=B3=95=E5=85=B0=E7=9B=B4=E5=BE=84?= =?UTF-8?q?=EF=BC=8C=E5=8A=A8=E5=B9=B3=E8=A1=A1=E7=AD=89=E7=BA=A7=EF=BC=8C?= =?UTF-8?q?=E9=80=82=E9=85=8D=E5=A4=B9=E5=A4=B4=E5=9E=8B=E5=8F=B7,?= =?UTF-8?q?=E9=80=82=E7=94=A8=E9=94=81=E7=B4=A7=E8=9E=BA=E6=AF=8D=E5=9E=8B?= =?UTF-8?q?=E5=8F=B7,=E7=BC=96=E7=A0=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/tool_other_features.py | 26 +- sf_base/views/tool_views.xml | 6 +- sf_dlm_management/__manifest__.py | 2 +- .../product_template_management_view.xml | 25 +- sf_manufacturing/models/product_template.py | 4 +- sf_mrs_connect/models/res_config_setting.py | 2 + sf_mrs_connect/models/sync_common.py | 913 ++++++++++++++---- sf_sale/models/auto_quatotion_common.py | 2 +- sf_sale/models/quick_easy_order.py | 4 +- 9 files changed, 768 insertions(+), 216 deletions(-) diff --git a/sf_base/models/tool_other_features.py b/sf_base/models/tool_other_features.py index acbb569d..c03ea9e9 100644 --- a/sf_base/models/tool_other_features.py +++ b/sf_base/models/tool_other_features.py @@ -6,6 +6,7 @@ class ToolMaterialsBasicParameters(models.Model): _description = '刀具物料基本参数' name = fields.Char('物料号', size=50) + code = fields.Char('编码', size=50) standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库') cutting_tool_type = fields.Char(related='standard_library_id.cutting_tool_type', string='刀具物料类型', store=True) @@ -73,11 +74,8 @@ class ToolMaterialsBasicParameters(models.Model): is_cooling_hole = fields.Boolean('有无冷却孔') locating_slot_code = fields.Char('定位槽代号', size=20) installing_structure = fields.Char('安装结构', size=20) - blade_ids = fields.Many2many( - 'sf.cutting.tool.type', - relation='basic_param_pad_blade_rel', - column1='model_id_1', - column2='model_id_2', + blade_id = fields.Many2one( + 'sf.cutting_tool.standard.library', domain="[('cutting_tool_material_id.name', '=', '刀片')]", string='适配刀片型号' # 使用空列表作为默认值 ) @@ -91,13 +89,17 @@ class ToolMaterialsBasicParameters(models.Model): interface_diameter = fields.Float('接口直径(mm)') # 刀柄参数 flange_shank_length = fields.Float('法兰柄长(mm)') + flange_diameter = fields.Float('法兰直径(mm)') handle_external_diameter = fields.Float('柄部外径(mm)') handle_inside_diameter = fields.Float('柄部内径(mm)') + dynamic_balance_class = fields.Char('动平衡等级') min_clamping_diameter = fields.Float('最小夹持直径(mm)') max_clamping_diameter = fields.Float('最大夹持直径(mm)') clamping_mode = fields.Char('夹持方式', size=20) max_load_capacity = fields.Float('最大负载能力(kg)') taper = fields.Integer('锥度(°)') + shank_length = fields.Float('刀柄长度(mm)', digits=(3, 2)) + shank_diameter = fields.Float('刀柄直径(mm)') tool_changing_time = fields.Integer('换刀时间(s)') standard_rotate_speed = fields.Integer('标准转速(n/min)') max_rotate_speed = fields.Integer('最大转速(n/min)') @@ -108,6 +110,13 @@ class ToolMaterialsBasicParameters(models.Model): is_quick_cutting = fields.Boolean('可高速切削', default=False) is_drill_hole = fields.Boolean('可钻孔', default=False) is_safe_lock = fields.Boolean('有无安全锁', default=False) + chuck_id = fields.Many2one( + 'sf.cutting_tool.standard.library', + domain="[('cutting_tool_material_id.name', '=', '夹头')]", + string='适配夹头型号' # 使用空列表作为默认值 + ) + nut = fields.Char('适用锁紧螺母型号') + # 夹头参数 er_size_model = fields.Char('ER尺寸型号', size=20) outer_diameter = fields.Float('外径(mm)') @@ -118,11 +127,8 @@ class ToolMaterialsBasicParameters(models.Model): clamping_length = fields.Float('夹持长度(mm)') clamping_tolerance = fields.Char('夹持公差(mm)', size=20) cooling_jacket = fields.Char('适用冷却套型号', size=50) - handle_ids = fields.Many2many( - 'sf.cutting.tool.type', - relation='basic_param_chuck_handle_rel', - column1='model_id_1', - column2='model_id_2', + handle_id = fields.Many2one( + 'sf.cutting_tool.standard.library', domain="[('cutting_tool_material_id.name', '=', '刀柄')]", string='适用刀柄型号' ) diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index e7015700..14c5ffd4 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -277,7 +277,7 @@ - + @@ -300,7 +300,7 @@ - + @@ -356,7 +356,7 @@ - + diff --git a/sf_dlm_management/__manifest__.py b/sf_dlm_management/__manifest__.py index a5c894d4..813fdb3f 100644 --- a/sf_dlm_management/__manifest__.py +++ b/sf_dlm_management/__manifest__.py @@ -11,7 +11,7 @@ 'website': 'https://www.sf.jikimo.com', 'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing'], 'data': [ - 'data/stock_data.xml', + # 'data/stock_data.xml', 'views/product_template_management_view.xml', ], 'demo': [ diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml index 737d56db..f096de62 100644 --- a/sf_dlm_management/views/product_template_management_view.xml +++ b/sf_dlm_management/views/product_template_management_view.xml @@ -28,13 +28,13 @@ options="{'no_create': True}" attrs="{'invisible': ['|',('categ_type', '!=', '表面工艺'),('categ_type', '=', False)]}"/> @@ -42,7 +42,7 @@ attrs="{'invisible': [('categ_type', '!=', '夹具')]}" domain="[('fixture_material_id','=',fixture_material_id)]"/> - {'readonly': [('categ_id', '!=', False)]} + {'readonly': [('create_uid', '!=', False)]} @@ -140,23 +140,6 @@ attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('categ_type', '=', '刀具')]}"/> - - - - - - - - - - - - - - - - - Date: Thu, 28 Dec 2023 17:38:56 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=8E=A7=E5=88=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/models/sf_maintenance.py | 2 +- sf_maintenance/views/maintenance_views.xml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index b09fb373..6aac4f91 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -139,7 +139,7 @@ class SfMaintenanceEquipment(models.Model): record.equipment_type = record.category_id.equipment_type code = fields.Char('行业编码') - name = fields.Char('机台号') + name = fields.Char('机台号', required=False) knife_type = fields.Selection( [("BT40", "BT40"), ("BT30", "BT30"), ("BT50", "BT50")], default="", string="刀把类型") diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index ccf333ba..135cf950 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -62,15 +62,15 @@ attrs="{'invisible': [('equipment_type', '!=', '机床')]}"> - + diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index d5d5a9ed..333da9aa 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -877,6 +877,50 @@ class ResProductFixture(models.Model): mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2)) centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2)) + @api.onchange('specification_fixture_id') + def _onchange_specification_fixture_id(self): + if self.specification_fixture_id: + self.length = self.specification_fixture_id.length + self.width = self.specification_fixture_id.width + self.height = self.specification_fixture_id.height + self.weight = self.specification_fixture_id.weight + self.diameter = self.specification_fixture_id.diameter + self.orientation_dish_diameter = self.specification_fixture_id.orientation_dish_diameter + self.clamping_diameter = self.specification_fixture_id.clamping_diameter + self.clamping_num = self.specification_fixture_id.clamping_num + self.chucking_power_max = self.specification_fixture_id.chucking_power_max + self.repeated_positioning_accuracy = self.specification_fixture_id.repeated_positioning_accuracy + self.boolean_transposing_hole = self.specification_fixture_id.boolean_transposing_hole + self.unlocking_method = self.specification_fixture_id.unlocking_method + self.boolean_chip_blowing_function = self.specification_fixture_id.boolean_chip_blowing_function + self.carrying_capacity_max = self.specification_fixture_id.carrying_capacity_max + self.rigidity = self.specification_fixture_id.rigidity + self.materials_model_id = self.specification_fixture_id.materials_model_id + self.machine_tool_type_id = self.specification_fixture_id.machine_tool_type_id + self.connector_diameter = self.specification_fixture_id.connector_diameter + self.way_to_install = self.specification_fixture_id.way_to_install + self.type_of_drive = self.specification_fixture_id.type_of_drive + self.gripper_length_min = self.specification_fixture_id.gripper_length_min + self.gripper_width_min = self.specification_fixture_id.gripper_width_min + self.gripper_height_min = self.specification_fixture_id.gripper_height_min + self.gripper_diameter_min = self.specification_fixture_id.gripper_diameter_min + self.gripper_length_max = self.specification_fixture_id.gripper_length_max + self.gripper_width_max = self.specification_fixture_id.gripper_width_max + self.gripper_height_max = self.specification_fixture_id.gripper_height_max + self.gripper_diameter_max = self.specification_fixture_id.gripper_diameter_max + self.rated_air_pressure = self.specification_fixture_id.rated_air_pressure + self.interface_materials_model_id = self.specification_fixture_id.interface_materials_model_id + self.transverse_groove = self.specification_fixture_id.transverse_groove + self.longitudinal_fitting_groove = self.specification_fixture_id.longitudinal_fitting_groove + self.height_tolerance_value = self.specification_fixture_id.height_tolerance_value + self.rated_adsorption_force = self.specification_fixture_id.rated_adsorption_force + self.magnetic_field_height = self.specification_fixture_id.magnetic_field_height + self.magnetic_pole_plate_grinding_allowance = self.specification_fixture_id.magnetic_pole_plate_grinding_allowance + self.screw_size = self.specification_fixture_id.screw_size + self.via_hole_diameter = self.specification_fixture_id.via_hole_diameter + self.mounting_hole_depth = self.specification_fixture_id.mounting_hole_depth + self.centering_diameter = self.specification_fixture_id.centering_diameter + class SfMaintenanceEquipmentAndProductTemplate(models.Model): _inherit = 'maintenance.equipment' From edf4699e9e48aebc206a7d74aec8e18085bc8f24 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 5 Jan 2024 17:30:13 +0800 Subject: [PATCH 13/16] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=87=E5=89=8A=E9=80=9F=E5=BA=A6=E5=92=8C?= =?UTF-8?q?=E6=AF=8F=E9=BD=BF=E8=B5=B0=E5=88=80=E9=87=8F=E5=8F=8A=E5=88=87?= =?UTF-8?q?=E5=89=8A=E5=AE=BD=E5=BA=A6=E5=92=8C=E6=B7=B1=E5=BA=A6=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=202.=E4=BC=98=E5=8C=96=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/tool_base_new.py | 12 +- sf_base/models/tool_other_features.py | 236 +------------- sf_base/views/tool_views.xml | 1 - .../product_template_management_view.xml | 307 +++++++++--------- sf_manufacturing/models/product_template.py | 30 +- sf_mrs_connect/models/res_config_setting.py | 7 + sf_mrs_connect/models/sync_common.py | 251 +++++++++++++- sf_sale/models/sale_order.py | 17 +- sf_sale/views/res_partner_view.xml | 10 +- 9 files changed, 433 insertions(+), 438 deletions(-) diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index 4dc6b619..354b7b79 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -106,10 +106,8 @@ class CuttingToolModel(models.Model): chuck_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters', 'standard_library_id', string='夹头基本参数') cutting_speed_ids = fields.One2many('sf.cutting.speed', 'standard_library_id', string='切削速度Vc') - feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz', - domain=[('cutting_speed', '!=', False)]) - feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz', - domain=[('cutting_speed', '!=', False)]) + feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz') + feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz') material_model_id = fields.Many2one('sf.materials.model', '材料型号') # 适用夹头型号可以多选 @@ -156,12 +154,6 @@ class CuttingToolModel(models.Model): active = fields.Boolean('有效', default=True) is_cloud = fields.Boolean('云端数据', default=False) - # 无用字段 - feed_per_tooth_ids_2 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz', - domain=[('machining_method', '!=', False)]) - feed_per_tooth_ids_4 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz', - domain=[('machining_method', '!=', False)]) - def _get_ids(self, cutting_tool_type_code, factory_short_name): cutting_tool_type_ids = [] for item in cutting_tool_type_code: diff --git a/sf_base/models/tool_other_features.py b/sf_base/models/tool_other_features.py index 305cac39..23600322 100644 --- a/sf_base/models/tool_other_features.py +++ b/sf_base/models/tool_other_features.py @@ -41,6 +41,7 @@ class ToolMaterialsBasicParameters(models.Model): install_aperture_diameter = fields.Float('安装孔直径(mm)') chip_breaker_groove = fields.Selection([('无', '无'), ('单面', '单面'), ('双面', '双面')], string='有无断屑槽') + chip_breaker_type_code = fields.Char('断屑槽型代号') blade_teeth_model = fields.Selection( [('无', '无'), ('V牙型', 'V牙型'), ('米制全牙型', '米制全牙型'), ('美制全牙型', '美制全牙型'), ('惠氏全牙型', '惠氏全牙型'), ('BSPT全牙型', 'BSPT全牙型'), ('NPT全牙型', 'NPT全牙型'), @@ -107,6 +108,7 @@ class ToolMaterialsBasicParameters(models.Model): max_rotate_speed = fields.Integer('最大转速(n/min)') diameter_slip_accuracy = fields.Char('径跳精度(mm)', size=20) cooling_model = fields.Char('冷却类型', size=20) + taper_shank_model = fields.Char('锥柄型号') is_rough_machining = fields.Boolean('可粗加工', default=False) is_finish_machining = fields.Boolean('可精加工', default=False) is_quick_cutting = fields.Boolean('可高速切削', default=False) @@ -136,169 +138,12 @@ class ToolMaterialsBasicParameters(models.Model): ) active = fields.Boolean(string='有效', default=True) - def _json_integral_tool_basic_param(self, obj): - integral_tool_basic_param_str = (0, '', { - 'name': obj['name'], - 'cutting_tool_type': obj['cutting_tool_type'], - 'total_length': obj['total_length'], - 'blade_diameter': obj['blade_diameter'], - 'blade_length': obj['blade_length'], - 'blade_number': obj['blade_number'], - 'neck_length': obj['neck_length'], - 'neck_diameter': obj['neck_diameter'], - 'handle_diameter': obj['handle_diameter'], - 'handle_length': obj['handle_length'], - 'blade_tip_diameter': obj['blade_tip_diameter'], - 'blade_tip_working_size': obj['blade_tip_working_size'], - 'blade_tip_taper': obj['blade_tip_taper'], - 'blade_helix_angle': obj['blade_helix_angle'], - 'blade_width': obj['blade_width'], - 'blade_depth': obj['blade_depth'], - 'pitch': obj['pitch'], - 'cutting_depth': obj['cutting_depth'], - }) - return integral_tool_basic_param_str - - def _json_blade_basic_param(self, obj): - blade_basic_param_str = (0, '', { - 'name': obj['name'], - 'cutting_tool_type': obj['cutting_tool_type'], - 'length': obj['length'], - 'thickness': obj['thickness'], - 'width': obj['width'], - 'cutting_blade_length': obj['cutting_blade_length'], - 'relief_angle': obj['relief_angle'], - 'blade_tip_circular_arc_radius': obj['blade_tip_circular_arc_radius'], - 'inscribed_circle_diameter': obj['inscribed_circle_diameter'], - 'install_aperture_diameter': obj['install_aperture_diameter'], - 'pitch': obj['pitch'], - 'chip_breaker_groove': obj['chip_breaker_groove'], - 'blade_teeth_model': '无' if not obj['bladed_teeth_model'] else obj['bladed_teeth_model'], - 'blade_blade_number': obj['blade_blade_number'], - 'cutting_depth': obj['cutting_depth'], - 'blade_width': obj['blade_width'], - 'main_included_angle': obj['main_included_angle'], - 'top_angle': obj['top_angle'], - 'blade_tip_dip_angle': obj['blade_tip_dip_angle'], - 'side_cutting_edge_angle': obj['side_cutting_edge_angle'], - 'thread_model': '无' if not obj['thread_model'] else obj['thread_model'], - 'thread_num': obj['thread_num'], - 'blade_tip_height_tolerance': obj['blade_tip_height_tolerance'], - 'inscribed_circle_tolerance': obj['inscribed_circle_tolerance'], - 'thickness_tolerance': obj['thickness_tolerance'], - }) - return blade_basic_param_str - - def _json_cutter_arbor_basic_param(self, obj): - cutter_arbor_basic_param_str = (0, '', { - 'name': obj['name'], - 'cutting_tool_type': obj['cutting_tool_type'], - 'height': obj['height'], - 'width': obj['width'], - 'total_length': obj['total_length'], - 'knife_head_height': obj['knife_head_height'], - 'knife_head_width': obj['knife_head_width'], - 'knife_head_length': obj['knife_head_length'], - 'cutter_arbor_diameter': obj['cutter_arbor_diameter'], - 'main_included_angle': obj['main_included_angle'], - 'relief_angle': obj['relief_angle'], - 'cutting_depth': obj['cutting_depth'], - 'min_machining_aperture': obj['min_machining_aperture'], - 'install_blade_tip_num': obj['install_blade_tip_num'], - 'cutting_blade_model': obj['cutting_blade_model'], - 'is_cooling_hole': obj['is_cooling_hole'], - 'locating_slot_code': obj['locating_slot_code'], - 'installing_structure': obj['installing_structure'], - 'blade_ids': [(6, 0, [])] if not obj.get('blade_codes') else - self.evn['sf.cutting_tool.standard.library']._get_ids(obj['blade_codes']), - 'tool_shim': obj['tool_shim'], - 'cotter_pin': obj['cotter_pin'], - 'pressing_plate': obj['pressing_plate'], - 'screw': obj['screw'], - 'spanner': obj['spanner'], - }) - return cutter_arbor_basic_param_str - - def _json_cutter_head_basic_param(self, obj): - cutter_head_basic_param_str = (0, '', { - 'name': obj['name'], - 'cutting_tool_type': obj['cutting_tool_type'], - 'install_blade_tip_num': obj['install_blade_tip_num'], - 'blade_diameter': obj['blade_diameter'], - 'cutter_head_diameter': obj['cutter_head_diameter'], - 'interface_diameter': obj['interface_diameter'], - 'total_length': obj['total_length'], - 'blade_length': obj['blade_length'], - 'cutting_depth': obj['cutting_depth'], - 'main_included_angle': obj['main_included_angle'], - 'installing_structure': obj['installing_structure'], - 'blade_ids': [(6, 0, [])] if not obj.get('blade_codes') else - self.evn['sf.cutting_tool.standard.library']._get_ids(obj['blade_codes']), - 'screw': obj['screw'], - 'spanner': obj['spanner'], - 'cutting_blade_model': obj['cutting_blade_model'], - 'is_cooling_hole': obj['is_cooling_hole'], - 'locating_slot_code': obj['locating_slot_code'], - }) - return cutter_head_basic_param_str - - def _json_knife_handle_basic_param(self, obj): - knife_handle_basic_param_str = (0, '', { - 'name': obj['name'], - 'cutting_tool_type': obj['cutting_tool_type'], - 'total_length': obj['total_length'], - 'flange_shank_length': obj['flange_shank_length'], - 'handle_inside_diameter': obj['handle_inside_diameter'], - 'min_clamping_diameter': obj['min_clamping_diameter'], - 'max_clamping_diameter': obj['max_clamping_diameter'], - 'clamping_mode': obj['clamping_mode'], - 'max_load_capacity': obj['max_load_capacity'], - 'taper': obj['taper'], - 'tool_changing_time': obj['tool_changing_time'], - 'standard_rotate_speed': obj['standard_rotate_speed'], - 'max_rotate_speed': obj['max_rotate_speed'], - 'diameter_slip_accuracy': obj['diameter_slip_accuracy'], - 'cooling_model': obj['cooling_model'], - 'is_rough_machining': obj['is_rough_machining'], - 'is_finish_machining': obj['is_finish_machining'], - 'is_quick_cutting': obj['is_quick_cutting'], - 'is_drill_hole': obj['is_drill_hole'], - 'is_safe_lock': obj['is_safe_lock'], - 'screw': obj['screw'], - 'spanner': obj['spanner'], - }) - return knife_handle_basic_param_str - - def _json_chuck_basic_param(self, obj): - chuck_basic_param_str = (0, '', { - 'name': obj['name'], - 'cutting_tool_type': obj['cutting_tool_type'], - 'er_size_model': obj['er_size_model'], - 'min_clamping_diameter': obj['min_clamping_diameter'], - 'max_clamping_diameter': obj['max_clamping_diameter'], - 'outer_diameter': obj['outer_diameter'], - 'inner_diameter': obj['inner_diameter'], - 'run_out_accuracy': obj['run_out_accuracy'], - 'total_length': obj['total_length'], - 'taper': obj['taper'], - 'run_out_accuracy': obj['run_out_accuracy'], - 'top_diameter': obj['top_diameter'], - 'weight': obj['weight'], - 'clamping_mode': obj['clamping_mode'], - 'clamping_length': obj['clamping_length'], - 'clamping_tolerance': obj['clamping_tolerance'], - 'max_load_capacity': obj['max_load_capacity'], - 'handle_ids': [(6, 0, [])] if not obj.get( - 'handle_codes') else self.evn['sf.cutting_tool.standard.library']._get_ids(obj['handle_codes']), - 'cooling_jacket': obj['cooling_jacket'], - }) - return chuck_basic_param_str - class CuttingSpeed(models.Model): _name = 'sf.cutting.speed' _description = '切削速度Vc' + name = fields.Char('名称') product_template_id = fields.Many2one('product.template') standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库') @@ -318,40 +163,7 @@ class CuttingSpeed(models.Model): cutting_speed_min = fields.Float('最小值') application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用') - - # ===============待删除字段============== - material_id = fields.Many2one('sf.materials.model', '材料名称', - domain="[('standards_id', '=', execution_standard_id)]") - slope_milling_angle = fields.Integer('坡铣角度(°)') - cutting_speed_n1 = fields.Char('径向切宽 ae=100%D1 ap=1*D1 切削速度Vc') - cutting_speed_n2 = fields.Char('径向切宽 ae=50%D1 ap=1.5*D1 切削速度Vc') - cutting_speed_n3 = fields.Char('径向切宽 ae=25%D1 ap=L1max 切削速度Vc') - cutting_speed_n4 = fields.Char('径向切宽 ae=15%D1 ap=L1max 切削速度Vc') - cutting_speed_n5 = fields.Char('径向切宽 ae=5%D1 ap=L1max 切削速度Vc') - rough_machining = fields.Char('粗加工 Vc(m/min)') - precision_machining = fields.Char('精加工 Vc(m/min)') - - # ====================================== - - def _json_cutting_speed(self, obj): - cutting_speed_str = (0, '', { - 'execution_standard_id': self.env['sf.international.standards'].search( - [('code', '=', obj['execution_standard_code'])]).id, - 'material_code': obj['material_code'], - 'material_id': self.env['sf.materials.model'].search([('materials_no', '=', obj['material_name_code'])]).id, - 'material_grade': obj['material_grade'], - 'tensile_strength': obj['tensile_strength'], - 'hardness': obj['hardness'], - 'cutting_speed_n1': obj['cutting_speed_n1'], - 'cutting_speed_n2': obj['cutting_speed_n2'], - 'cutting_speed_n3': obj['cutting_speed_n3'], - 'cutting_speed_n4': obj['cutting_speed_n4'], - 'cutting_speed_n5': obj['cutting_speed_n5'], - 'rough_machining': obj['rough_machining'], - 'precision_machining': obj['precision_machining'], - 'application': obj['application'], - }) - return cutting_speed_str + active = fields.Boolean(string='有效', default=True) class FeedPerTooth(models.Model): @@ -359,52 +171,16 @@ class FeedPerTooth(models.Model): _description = '每齿走刀量fz' _order = 'blade_diameter,cutting_width_depth_id,materials_type_id' + name = fields.Char('名称') product_template_id = fields.Many2one('product.template') standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库') blade_diameter = fields.Integer('刃部直径(mm)', readonly=True) materials_type_id = fields.Many2one('sf.materials.model', string='材料名称', readonly=True) cutting_width_depth_id = fields.Many2one('sf.cutting.width.depth', '切削宽度和深度', readonly=True) feed_per_tooth = fields.Char('每齿走刀量 (mm/z)', size=20) + active = fields.Boolean(string='有效', default=True) - # =============待删除字段=========== - cutting_speed = fields.Char('径向切宽 ae(mm)') - machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式') - # ================================ - - def _json_feed_per_tooth(self, obj): - feed_per_tooth_str = (0, '', { - 'cutting_speed': obj['cutting_speed'], - 'blade_diameter': obj['blade_diameter'], - 'feed_per_tooth': obj['feed_per_tooth'], - }) - return feed_per_tooth_str - - def _json_feed_per_tooth_2(self, obj): - feed_per_tooth_2_str = (0, '', { - 'machining_method': obj['machining_method'], - 'materials_type_id': self.env['sf.materials.model'].search( - [('materials_no', '=', obj['materials_type_code'])]).id, - 'blade_diameter': obj['blade_diameter'], - 'feed_per_tooth': obj['feed_per_tooth'], - }) - return feed_per_tooth_2_str - - def _json_feed_per_tooth_3(self, obj): - feed_per_tooth_3_str = (0, '', { - 'cutting_speed': obj['cutting_speed'], - 'feed_per_tooth': obj['feed_per_tooth'], - }) - return feed_per_tooth_3_str - - def _json_feed_per_tooth_4(self, obj): - feed_per_tooth_4_str = (0, '', { - 'machining_method': obj['machining_method'], - 'materials_type_id': self.env['sf.materials.model'].search( - [('materials_no', '=', obj['materials_type_code'])]).id, - 'feed_per_tooth': obj['feed_per_tooth'], - }) - return feed_per_tooth_4_str # @api.depends('product_template_id') # def _compute_product_template_id(self): diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index 3543448a..68ed8bda 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -379,7 +379,6 @@ - diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml index b1068c6c..9ef1bc07 100644 --- a/sf_dlm_management/views/product_template_management_view.xml +++ b/sf_dlm_management/views/product_template_management_view.xml @@ -7,7 +7,7 @@ - + + attrs="{'invisible': ['|',('categ_type', '!=', '坯料'),('categ_type', '=', False)],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('categ_type', 'not in', ['成品','坯料', '原材料'])],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('categ_type', 'not in', ['成品','坯料', '原材料'])],'readonly': [('id', '!=', False)]}"/> - - {'readonly': [('create_uid', '!=', False)]} - @@ -103,99 +100,95 @@ + attrs="{'invisible': [('categ_type', '!=', '刀具')],'readonly': [('id', '!=', False)]}"> + placeholder="请选择" attrs="{'readonly': [('id', '!=', False)]}"/> + attrs="{'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀杆','刀盘','夹头','刀柄'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'readonly': [('id', '!=', False)]}"/> - + - + string="材质" attrs="{'readonly': [('id', '!=', False)]}"/> + + attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')],'readonly': [('id', '!=', False)]}"/> + attrs="{'required': [('cutting_tool_type','=','整体式刀具')],'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')],'readonly': [('id', '!=', False)]}"/> - + attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')],'readonly': [('id', '!=', False)]}"/> + + attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')],'readonly': [('id', '!=', False)]}"/> + attrs='{"invisible": [("cutting_tool_type","not in",("夹头","刀柄"))],"readonly": [("id", "!=", False)]}'/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头','刀柄'))],'readonly': [('id', '!=', False)]}"/> + + + attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片','刀杆','刀盘'))],'readonly': [('id', '!=', False)]}"/> - - + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')],'readonly': [('id', '!=', False)]}"/> - - - + attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('id', '!=', False)]}"/> - - + attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('id', '!=', False)]}"/> + + attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘'))],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')],'readonly': [('id', '!=', False)]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆'))],'readonly': [('id', '!=', False)]}"/> + + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀柄'))],'readonly': [('id', '!=', False)]}"/> + + - - + + + attrs="{'readonly': [('id', '!=', False)]}"/> + attrs="{'readonly': [('id', '!=', False)]}"/> + attrs="{'readonly': [('id', '!=', False)]}"/> + attrs="{'readonly': [('id', '!=', False)]}"/> + attrs="{'readonly': [('id', '!=', False)]}"/> + attrs="{'readonly': [('id', '!=', False)]}"> - + - - - - - - - + + + + + + + @@ -450,14 +436,11 @@ + attrs="{'readonly': [('id', '!=', False)]}"> - - - + + + diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 3233e674..13383a10 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -6,6 +6,8 @@ import os from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path + + # from OCC.Extend.DataExchange import read_step_file # from OCC.Extend.DataExchange import write_stl_file @@ -228,7 +230,7 @@ class ResProductMo(models.Model): self.cutting_tool_inscribed_circle_tolerance = self.specification_id.inscribed_circle_tolerance self.cutting_tool_install_aperture_diameter = self.specification_id.install_aperture_diameter self.cutting_tool_chip_breaker_groove = self.specification_id.chip_breaker_groove - # self.cutting_tool_cut_depth_max = self.specification_id.blade_blade_number + self.cutting_tool_chip_breaker_type_code = self.specification_id.chip_breaker_type_code self.cutting_tool_blade_blade_number = self.specification_id.blade_blade_number self.cutting_tool_blade_width = self.specification_id.blade_width self.cutting_tool_rear_angle = self.specification_id.relief_angle @@ -257,7 +259,7 @@ class ResProductMo(models.Model): self.cutting_tool_inscribed_circle_tolerance = self.specification_id.inscribed_circle_tolerance self.cutting_tool_install_aperture_diameter = self.specification_id.install_aperture_diameter self.cutting_tool_chip_breaker_groove = self.specification_id.chip_breaker_groove - # self.cutting_tool_cut_depth_max = self.specification_id.blade_blade_number + self.cutting_tool_chip_breaker_type_code = self.specification_id.chip_breaker_type_code self.cutting_tool_blade_blade_number = self.specification_id.blade_blade_number self.cutting_tool_blade_width = self.specification_id.blade_width self.cutting_tool_rear_angle = self.specification_id.relief_angle @@ -274,15 +276,15 @@ class ResProductMo(models.Model): self.cutting_tool_knife_head_length = self.specification_id.knife_head_length elif self.cutting_tool_type == '刀柄': self.cutting_tool_total_length = self.specification_id.total_length - self.cutting_tool_standard_speed = self.specification_id.standard_rotate_speed self.cutting_tool_speed_max = self.specification_id.max_rotate_speed self.cutting_tool_change_time = self.specification_id.tool_changing_time self.cutting_tool_total_length = self.specification_id.total_length self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter self.cutting_tool_flange_length = self.specification_id.flange_shank_length - self.cutting_tool_shank_outer_diameter = self.specification_id.handle_external_diameter - self.cutting_tool_shank_inner_diameter = self.specification_id.handle_inside_diameter + self.cutting_tool_flange_diameter = self.specification_id.flange_diameter + self.cutting_tool_fit_chuck_size = self.specification_id.fit_chuck_size + self.cutting_tool_dynamic_balance_class = self.specification_id.dynamic_balance_class self.suitable_machining_method_ids = [(6, 0, [])] if not \ self.cutting_tool_model_id.suitable_machining_method_ids \ else [(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)] @@ -384,6 +386,7 @@ class ResProductMo(models.Model): cutting_tool_install_aperture_diameter = fields.Float('安装孔直径(mm)') cutting_tool_chip_breaker_groove = fields.Selection([('无', '无'), ('单面', '单面'), ('双面', '双面')], string='有无断屑槽') + cutting_tool_chip_breaker_type_code = fields.Char('断屑槽型代号') cutting_tool_bladed_teeth_model = fields.Selection( [('无', '无'), ('V牙型', 'V牙型'), ('米制全牙型', '米制全牙型'), ('美制全牙型', '美制全牙型'), ('惠氏全牙型', '惠氏全牙型'), ('BSPT全牙型', 'BSPT全牙型'), ('NPT全牙型', 'NPT全牙型'), @@ -395,8 +398,6 @@ class ResProductMo(models.Model): ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10')], string='刀片的刃数(个)') - cutting_tool_blade_tip_dip_angle = fields.Integer('刀尖倾角(°)') - cutting_tool_side_cutting_edge_angle = fields.Integer('侧切削角(°)') cutting_tool_thread_model = fields.Selection([('无', '无'), ('外螺纹', '外螺纹'), ('内螺纹', '内螺纹')], string='螺纹类型') cutting_tool_thread_num = fields.Float('每英寸螺纹数(tpi)') @@ -451,24 +452,23 @@ class ResProductMo(models.Model): cutting_tool_interface_diameter = fields.Float('接口直径(mm)') # 刀柄参数 - cutting_tool_shank_outer_diameter = fields.Float('柄部外径(mm)') - cutting_tool_shank_inner_diameter = fields.Float('柄部内径(mm)') - cutting_tool_clamping_length = fields.Float('夹持长度(mm)') - cutting_tool_clamping_tolerance = fields.Float('夹持公差(mm)') cutting_tool_clamping_diameter_max = fields.Float('最大夹持直径') cutting_tool_clamping_diameter_min = fields.Float('最小夹持直径') cutting_tool_flange_length = fields.Float('法兰柄长(mm)') cutting_tool_flange_diameter = fields.Float('法兰直径(mm)') - cutting_tool_is_rough_finish = fields.Boolean('可粗加工', default=False) - cutting_tool_is_finish = fields.Boolean('可精加工', default=False) - cutting_tool_is_drill_hole = fields.Boolean('可钻孔', default=False) cutting_tool_is_safety_lock = fields.Boolean('有无安全锁', default=False) cutting_tool_is_high_speed_cutting = fields.Boolean('可高速切削', default=False) cutting_tool_change_time = fields.Integer('换刀时间(s)') cutting_tool_clamping_way = fields.Char('夹持方式') + cutting_tool_fit_chuck_size = fields.Char('适配夹头尺寸') + cutting_tool_taper_shank_model = fields.Char('锥柄型号') cutting_tool_standard_speed = fields.Integer('标准转速(n/min)') cutting_tool_speed_max = fields.Integer('最大转速(n/min)') cutting_tool_cooling_type = fields.Char('冷却类型') + cutting_tool_dynamic_balance_class = fields.Char('动平衡等级') + cutting_tool_fit_nut_model = fields.Char('适用锁紧螺母型号') + + # 夹头参数 cutting_tool_taper = fields.Integer('锥度(°)') cutting_tool_top_diameter = fields.Float('顶部直径') @@ -476,7 +476,7 @@ class ResProductMo(models.Model): cutting_tool_inner_diameter = fields.Float('内径(mm)') cooling_suit_type_ids = fields.Char('适用冷却套型号') cutting_tool_max_load_capacity = fields.Float('最大负载能力(kg)') - cutting_tool_er_size_model = fields.Char('ER尺寸型号') + cutting_tool_er_size_model = fields.Char('尺寸型号') cutting_tool_handle_ids = fields.Many2many( 'sf.cutting_tool.standard.library', relation='product_cutting_tool_library_chuck_handle_rel', diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py index eb47b4b7..d74db38b 100644 --- a/sf_mrs_connect/models/res_config_setting.py +++ b/sf_mrs_connect/models/res_config_setting.py @@ -67,6 +67,13 @@ class ResConfigSettings(models.TransientModel): _logger.info("同步刀具标准库完成") self.env['sf.tool.materials.basic.parameters'].sync_all_cutting_tool_basic_parameters() _logger.info("同步刀具物料基本参数完成") + self.env['sf.cutting.width.depth'].sync_all_cutting_width_depth() + _logger.info("同步刀具物料切削宽度和深度完成") + self.env['sf.cutting.speed'].sync_all_cutting_speed() + _logger.info("同步刀具物料切削速度完成") + self.env['sf.feed.per.tooth'].sync_all_feed_per_tooth() + _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 05d9186f..95856dee 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -64,6 +64,12 @@ class MrStaticResourceDataSync(models.Model): logging.info("刀具标准库已每日同步成功") self.env['sf.tool.materials.basic.parameters'].sync_cutting_tool_basic_parameters_yesterday() _logger.info("同步刀具物料基本参数完成") + self.env['sf.cutting.width.depth'].sync_cutting_width_depth_yesterday() + _logger.info("同步刀具物料切削宽度和深度完成") + self.env['sf.cutting.speed'].sync_cutting_speed_yesterday() + _logger.info("同步刀具物料切削速度完成") + self.env['sf.feed.per.tooth'].sync_feed_per_tooth_yesterday() + _logger.info("同步刀具物料每齿走刀量完成") except Exception as e: logging.info("捕获错误信息:%s" % e) raise ValidationError("数据错误导致同步失败,请联系管理员") @@ -1907,6 +1913,242 @@ class ModelInternationalStandards(models.Model): raise ValidationError("制造标准认证未通过") +class CuttingSpeed(models.Model): + _inherit = 'sf.cutting.speed' + _description = '切削速度' + url = '/api/cutting_speed/list' + + def sync_cutting_speed_yesterday(self): + config = self.env['res.config.settings'].get_values() + headers = Common.get_headers(self, config['token'], config['sf_secret_key']) + strUrl = 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['cutting_speed_yesterday_list']: + cutting_speed = self.search([("name", '=', item['name'])]) + if not cutting_speed: + self.create({ + 'name': item['name'], + 'standard_library_id': self.env['sf.cutting_tool.standard.library'].search( + [('code', '=', item['standard_library_code'].replace("JKM", result[ + 'factory_short_name']))]).id, + 'execution_standard_id': self.env['sf.international.standards'].search( + [('code', '=', item['execution_standard_code'])]).id, + 'material_name_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['material_name'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'ability_feature_library': self.env['maintenance.equipment.image'].search( + [('name', '=', item['ability_feature_library']), ('type', '=', '加工能力')]).id, + 'material_code': item['material_code'], + 'material_grade': item['material_grade'], + 'tensile_strength': item['tensile_strength'], + 'hardness': item['hardness'], + 'cutting_speed': item['cutting_speed'], + 'application': item['application'], + 'active': item['active'], + }) + else: + if item['active'] is False: + item.write({'active': False}) + else: + self.write({ + 'execution_standard_id': self.env['sf.international.standards'].search( + [('code', '=', item['execution_standard_code'])]).id, + 'material_name_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['material_name'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'ability_feature_library': self.env['maintenance.equipment.image'].search( + [('name', '=', item['ability_feature_library']), ('type', '=', '加工能力')]).id, + 'material_code': item['material_code'], + 'material_grade': item['material_grade'], + 'tensile_strength': item['tensile_strength'], + 'hardness': item['hardness'], + 'cutting_speed': item['cutting_speed'], + 'application': item['application'], }) + else: + raise ValidationError("切削速度认证未通过") + + def sync_all_cutting_speed(self): + config = self.env['res.config.settings'].get_values() + headers = Common.get_headers(self, config['token'], config['sf_secret_key']) + strUrl = 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['cutting_speed_all_list']: + cutting_speed = self.search([("name", '=', item['name'])]) + if not cutting_speed: + self.create({ + 'name': item['name'], + 'standard_library_id': self.env['sf.cutting_tool.standard.library'].search( + [('code', '=', item['standard_library_code'].replace("JKM", result[ + 'factory_short_name']))]).id, + 'execution_standard_id': self.env['sf.international.standards'].search( + [('code', '=', item['execution_standard_code'])]).id, + 'material_name_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['material_name'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'ability_feature_library': self.env['maintenance.equipment.image'].search( + [('name', '=', item['ability_feature_library']), ('type', '=', '加工能力')]).id, + 'material_code': item['material_code'], + 'material_grade': item['material_grade'], + 'tensile_strength': item['tensile_strength'], + 'hardness': item['hardness'], + 'cutting_speed': item['cutting_speed'], + 'application': item['application'], + 'active': item['active'], + }) + else: + if item['active'] is False: + item.write({'active': False}) + else: + self.write({ + 'execution_standard_id': self.env['sf.international.standards'].search( + [('code', '=', item['execution_standard_code'])]).id, + 'material_name_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['material_name'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'ability_feature_library': self.env['maintenance.equipment.image'].search( + [('name', '=', item['ability_feature_library']), ('type', '=', '加工能力')]).id, + 'material_code': item['material_code'], + 'material_grade': item['material_grade'], + 'tensile_strength': item['tensile_strength'], + 'hardness': item['hardness'], + 'cutting_speed': item['cutting_speed'], + 'application': item['application'], }) + else: + raise ValidationError("切削速度认证未通过") + + +class CuttingWidthDepth(models.Model): + _inherit = 'sf.cutting.width.depth' + _description = '切削宽度和深度' + url = '/api/cutting_width_depth/list' + + def sync_cutting_width_depth_yesterday(self): + config = self.env['res.config.settings'].get_values() + headers = Common.get_headers(self, config['token'], config['sf_secret_key']) + strUrl = 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['cutting_width_depth_yesterday_list']: + cutting_width_depth = self.search([("name", '=', item['name'])]) + if not cutting_width_depth: + self.create({ + 'name': item['name'], + }) + else: + raise ValidationError("切削宽度和深度认证未通过") + + def sync_all_cutting_width_depth(self): + config = self.env['res.config.settings'].get_values() + headers = Common.get_headers(self, config['token'], config['sf_secret_key']) + strUrl = 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['cutting_width_depth_all_list']: + cutting_width_depth = self.search([("name", '=', item['name'])]) + if not cutting_width_depth: + self.create({ + 'name': item['name'], + }) + else: + raise ValidationError("切削宽度和深度认证未通过") + + +class CuttingSpeed(models.Model): + _inherit = 'sf.feed.per.tooth' + _description = '每齿走刀量' + url = '/api/feed_per_tooth/list' + + def sync_feed_per_tooth_yesterday(self): + config = self.env['res.config.settings'].get_values() + headers = Common.get_headers(self, config['token'], config['sf_secret_key']) + strUrl = 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['feed_per_tooth_yesterday_list']: + feed_per_tooth = self.search([("name", '=', item['name'])]) + if not feed_per_tooth: + self.create({ + 'name': item['name'], + 'standard_library_id': self.env['sf.cutting_tool.standard.library'].search( + [('code', '=', item['standard_library_code'].replace("JKM", result[ + 'factory_short_name']))]).id, + 'materials_type_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['materials_type_code'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'blade_diameter': item['blade_diameter'], + 'feed_per_tooth': item['feed_per_tooth'], + 'active': item['active'], + }) + else: + if item['active'] is False: + item.write({'active': False}) + else: + self.write({ + 'materials_type_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['materials_type_code'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'blade_diameter': item['blade_diameter'], + 'feed_per_tooth': item['feed_per_tooth'], }) + else: + raise ValidationError("每齿走刀量认证未通过") + + def sync_all_feed_per_tooth(self): + config = self.env['res.config.settings'].get_values() + headers = Common.get_headers(self, config['token'], config['sf_secret_key']) + strUrl = 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['feed_per_tooth_all_list']: + feed_per_tooth = self.search([("name", '=', item['name'])]) + if not feed_per_tooth: + self.create({ + 'name': item['name'], + 'standard_library_id': self.env['sf.cutting_tool.standard.library'].search( + [('code', '=', item['standard_library_code'].replace("JKM", result[ + 'factory_short_name']))]).id, + 'materials_type_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['materials_type_code'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'blade_diameter': item['blade_diameter'], + 'feed_per_tooth': item['feed_per_tooth'], + 'active': item['active'], + }) + else: + if item['active'] is False: + item.write({'active': False}) + else: + self.write({ + 'materials_type_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['materials_type_code'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'blade_diameter': item['blade_diameter'], + 'feed_per_tooth': item['feed_per_tooth'], }) + else: + raise ValidationError("每齿走刀量认证未通过") + + class Cutting_tool_standard_library(models.Model): _inherit = 'sf.cutting_tool.standard.library' _description = '刀具标准库' @@ -2197,6 +2439,7 @@ class CuttingToolBasicParameters(models.Model): 'install_aperture_diameter': blade_item['diameter_mounting_hole'], 'pitch': blade_item['pitch'], 'chip_breaker_groove': blade_item['is_chip_breaker'], + 'chip_breaker_type_code': blade_item['chip_breaker_type_code'], 'blade_teeth_model': '无' if not blade_item['blade_profile'] else blade_item[ 'blade_profile'], 'blade_blade_number': blade_item['blade_number'], @@ -2216,7 +2459,6 @@ class CuttingToolBasicParameters(models.Model): 'name': integral_tool_item['name'], 'length': blade_item['length'], 'thickness': blade_item['thickness'], - 'width': blade_item['width'], 'cutting_blade_length': blade_item['cutting_blade_length'], 'relief_angle': blade_item['relief_angle'], 'blade_tip_circular_arc_radius': blade_item['radius_tip_re'], @@ -2224,6 +2466,7 @@ class CuttingToolBasicParameters(models.Model): 'install_aperture_diameter': blade_item['diameter_mounting_hole'], 'pitch': blade_item['pitch'], 'chip_breaker_groove': blade_item['is_chip_breaker'], + 'chip_breaker_type_code': blade_item['chip_breaker_type_code'], 'blade_teeth_model': '无' if not blade_item['blade_profile'] else blade_item[ 'blade_profile'], 'blade_blade_number': blade_item['blade_number'], @@ -2546,6 +2789,7 @@ class CuttingToolBasicParameters(models.Model): 'install_aperture_diameter': blade_item['diameter_mounting_hole'], 'pitch': blade_item['pitch'], 'chip_breaker_groove': blade_item['is_chip_breaker'], + 'chip_breaker_type_code': blade_item['chip_breaker_type_code'], 'blade_teeth_model': '无' if not blade_item['blade_profile'] else blade_item[ 'blade_profile'], 'blade_blade_number': blade_item['blade_number'], @@ -2575,6 +2819,7 @@ class CuttingToolBasicParameters(models.Model): 'install_aperture_diameter': blade_item['diameter_mounting_hole'], 'pitch': blade_item['pitch'], 'chip_breaker_groove': blade_item['is_chip_breaker'], + 'chip_breaker_type_code': blade_item['chip_breaker_type_code'], 'blade_teeth_model': '无' if not blade_item['blade_profile'] else blade_item[ 'blade_profile'], 'blade_blade_number': blade_item['blade_number'], @@ -2587,7 +2832,6 @@ class CuttingToolBasicParameters(models.Model): 'blade_tip_height_tolerance': blade_item['tip_height_tolerance'], 'inscribed_circle_tolerance': blade_item['internal_circle_tolerance'], 'thickness_tolerance': blade_item['thickness_tolerance'], - 'active': blade_item['active'], }) basic_parameters_chuck_list = json.loads( result['cutting_tool_basic_parameters_all_list']['basic_parameters_chuck']) @@ -2634,7 +2878,6 @@ class CuttingToolBasicParameters(models.Model): 'weight': chuck_item['weight'], 'max_load_capacity': chuck_item['load_capacity_max'], 'cooling_jacket': chuck_item['cooling_sleeve_model'], - 'active': chuck_item['active'], }) basic_parameters_cutter_arbor_list = json.loads( result['cutting_tool_basic_parameters_all_list']['basic_parameters_cutter_arbor']) @@ -2705,7 +2948,6 @@ class CuttingToolBasicParameters(models.Model): 'pressing_plate': cutter_arbor_item['fit_plate_model'], 'screw': cutter_arbor_item['fit_screw_model'], 'spanner': cutter_arbor_item['fit_wrench_model'], - 'active': cutter_arbor_item['active'], }) basic_parameters_cutter_head_list = json.loads( result['cutting_tool_basic_parameters_all_list']['basic_parameters_cutter_head']) @@ -2762,7 +3004,6 @@ class CuttingToolBasicParameters(models.Model): 'spanner': cutter_head_item['fit_wrench_model'], 'is_cooling_hole': cutter_head_item['is_cooling_hole'], 'locating_slot_code': cutter_head_item['locator_slot_code'], - 'active': cutter_head_item['active'], }) basic_parameters_knife_handle_list = json.loads( result['cutting_tool_basic_parameters_all_list']['basic_parameters_knife_handle']) diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index a3a6dcb9..c32bde08 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -150,10 +150,10 @@ class ResPartnerToSale(models.Model): if self.env.user.has_group('sf_base.group_purchase_director'): domain = [('supplier_rank', '>', 0)] elif self.env.user.has_group('sf_base.group_purchase'): - customer = self.env['res.partner'].search( - [('supplier_rank', '>', 0), ('user_id', '=', self.env.user.id)]) - if customer: - ids = [t.id for t in customer] + supplier = self.env['res.partner'].search( + [('supplier_rank', '>', 0), ('purchase_user_id', '=', self.env.user.id)]) + if supplier: + ids = [t.id for t in supplier] domain = [('id', 'in', ids)] else: domain = [('id', '=', False)] @@ -191,12 +191,9 @@ class ResUserToSale(models.Model): if self.env.user.has_group('sf_base.group_purchase_director'): domain = [('supplier_rank', '>', 0)] elif self.env.user.has_group('sf_base.group_purchase'): - supplier = self.env['res.partner'].search( - [('supplier_rank', '>', 0), ('purchase_user_id', '=', self.env.user.id)]) - if supplier: - ids = [t.id for t in supplier] - domain = [('id', 'in', ids)] + if self.id != self.env.user.id: + domain = [('id', '=', self.id)] else: - domain = [('id', '=', False)] + domain = [('id', '=', self.env.user.id)] return self._search(domain, limit=limit, access_rights_uid=name_get_uid) return super()._name_search(name, args, operator, limit, name_get_uid) diff --git a/sf_sale/views/res_partner_view.xml b/sf_sale/views/res_partner_view.xml index c7bb79af..e751fe9f 100644 --- a/sf_sale/views/res_partner_view.xml +++ b/sf_sale/views/res_partner_view.xml @@ -6,8 +6,8 @@ res.partner -
- false + + false
@@ -45,7 +45,7 @@ + attrs="{'required' : [('customer_rank','>', 0)],'readonly': [('supplier_rank','>', 0)]}"/> 1 @@ -67,13 +67,13 @@ - + res.partner.property.form.inherit.sf res.partner - false + false From f8c6c766cb704d240a781d0e67693b7979e7c577 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 8 Jan 2024 15:44:16 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=80=E5=85=B7?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E5=92=8C=E5=88=80=E5=85=B7=E6=A0=87=E5=87=86?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/tool_base_new.py | 45 ++++++---- sf_base/models/tool_other_features.py | 14 +-- sf_base/views/tool_basic_param.xml | 2 - sf_base/views/tool_views.xml | 85 +++++++++---------- .../product_template_management_view.xml | 18 ++-- sf_maintenance/security/ir.model.access.csv | 1 - sf_manufacturing/models/product_template.py | 55 ++++++------ sf_manufacturing/models/stock.py | 2 - sf_manufacturing/security/ir.model.access.csv | 3 +- sf_mrs_connect/models/sync_common.py | 20 +++++ sf_sale/models/auto_quatotion_common.py | 2 +- sf_sale/models/quick_easy_order.py | 4 +- sf_tool_management/models/base.py | 6 +- sf_tool_management/views/tool_base_views.xml | 4 +- .../views/tool_material_search.xml | 2 +- 15 files changed, 136 insertions(+), 127 deletions(-) diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index 354b7b79..1c7219bc 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -111,11 +111,16 @@ class CuttingToolModel(models.Model): material_model_id = fields.Many2one('sf.materials.model', '材料型号') # 适用夹头型号可以多选 - chuck_ids = fields.Many2many( + # chuck_ids = fields.Many2many( + # 'sf.cutting_tool.standard.library', + # relation='cutting_tool_type_library_handle_chuck_rel', + # column1='model_id_1', + # column2='model_id_2', + # domain="[('cutting_tool_material_id.name', '=', '夹头')]", + # string='适用夹头型号') + + chuck_id = fields.Many2one( 'sf.cutting_tool.standard.library', - relation='cutting_tool_type_library_handle_chuck_rel', - column1='model_id_1', - column2='model_id_2', domain="[('cutting_tool_material_id.name', '=', '夹头')]", string='适用夹头型号') cutter_bar_ids = fields.Many2many( @@ -135,22 +140,28 @@ class CuttingToolModel(models.Model): string='适用刀盘型号' # 使用空列表作为默认值 ) # 刀杆/参数 - blade_ids = fields.Many2many( + # blade_ids = fields.Many2many( + # 'sf.cutting_tool.standard.library', + # relation='cutting_tool_type_library_pad_blade_rel', + # column1='model_id_1', + # column2='model_id_2', + # domain="[('cutting_tool_material_id.name', '=', '刀片')]", + # string='适用刀片型号' # 使用空列表作为默认值 + # ) + + handle_id = fields.Many2one( 'sf.cutting_tool.standard.library', - relation='cutting_tool_type_library_pad_blade_rel', - column1='model_id_1', - column2='model_id_2', - domain="[('cutting_tool_material_id.name', '=', '刀片')]", - string='适用刀片型号' # 使用空列表作为默认值 - ) - handle_ids = fields.Many2many( - 'sf.cutting_tool.standard.library', - relation='cutting_tool_type_library_chuck_handle_rel', - column1='model_id_1', - column2='model_id_2', domain="[('cutting_tool_material_id.name', '=', '刀柄')]", string='适用刀柄型号' ) + # handle_ids = fields.Many2many( + # 'sf.cutting_tool.standard.library', + # relation='cutting_tool_type_library_chuck_handle_rel', + # column1='model_id_1', + # column2='model_id_2', + # domain="[('cutting_tool_material_id.name', '=', '刀柄')]", + # string='适用刀柄型号' + # ) active = fields.Boolean('有效', default=True) is_cloud = fields.Boolean('云端数据', default=False) @@ -172,7 +183,7 @@ class MaintenanceStandardImage(models.Model): image = fields.Binary(string='图文') type = fields.Selection( [('加工能力', '加工能力'), ('刀尖特征', '刀尖特征'), ('柄部类型', '柄部类型'), ('走刀方向', '走刀方向'), - ('冷却液', '冷却液'), ('压紧方式', '压紧方式'), ('刀片形状', '刀片形状'), ('冷却方式', '冷却方式')], + ('压紧方式', '压紧方式'), ('刀片形状', '刀片形状'), ('冷却方式', '冷却方式')], string='特征') equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备') equipment_lq_id = fields.Many2many('maintenance.equipment', 'image_lq_id', string='设备') diff --git a/sf_base/models/tool_other_features.py b/sf_base/models/tool_other_features.py index 23600322..154bf275 100644 --- a/sf_base/models/tool_other_features.py +++ b/sf_base/models/tool_other_features.py @@ -54,8 +54,6 @@ class ToolMaterialsBasicParameters(models.Model): string='刀片的刃数(个)', default='0') main_included_angle = fields.Integer('主偏角(°)') top_angle = fields.Integer('顶角(°)') - blade_tip_dip_angle = fields.Integer('刀尖倾角(°)') - side_cutting_edge_angle = fields.Integer('侧切削角(°)') thread_model = fields.Selection([('无', '无'), ('外螺纹', '外螺纹'), ('内螺纹', '内螺纹')], string='螺纹类型', default='无') thread_num = fields.Float('每英寸螺纹数(tpi)') @@ -90,7 +88,7 @@ class ToolMaterialsBasicParameters(models.Model): cutter_head_diameter = fields.Float('刀盘直径(mm)') interface_diameter = fields.Float('接口直径(mm)') # 刀柄参数 - flange_shank_length = fields.Float('法兰柄长(mm)') + flange_shank_length = fields.Float('法兰长(mm)') flange_diameter = fields.Float('法兰直径(mm)') fit_chuck_size = fields.Char('适配夹头尺寸') handle_external_diameter = fields.Float('柄部外径(mm)') @@ -109,17 +107,14 @@ class ToolMaterialsBasicParameters(models.Model): diameter_slip_accuracy = fields.Char('径跳精度(mm)', size=20) cooling_model = fields.Char('冷却类型', size=20) taper_shank_model = fields.Char('锥柄型号') - is_rough_machining = fields.Boolean('可粗加工', default=False) - is_finish_machining = fields.Boolean('可精加工', default=False) is_quick_cutting = fields.Boolean('可高速切削', default=False) - is_drill_hole = fields.Boolean('可钻孔', default=False) is_safe_lock = fields.Boolean('有无安全锁', default=False) chuck_id = fields.Many2one( 'sf.cutting_tool.standard.library', domain="[('cutting_tool_material_id.name', '=', '夹头')]", string='适配夹头型号' # 使用空列表作为默认值 ) - nut = fields.Char('适用锁紧螺母型号') + nut = fields.Char('适配锁紧螺母型号') # 夹头参数 er_size_model = fields.Char('ER尺寸型号', size=20) @@ -131,11 +126,6 @@ class ToolMaterialsBasicParameters(models.Model): clamping_length = fields.Float('夹持长度(mm)') clamping_tolerance = fields.Char('夹持公差(mm)', size=20) cooling_jacket = fields.Char('适用冷却套型号', size=50) - handle_id = fields.Many2one( - 'sf.cutting_tool.standard.library', - domain="[('cutting_tool_material_id.name', '=', '刀柄')]", - string='适用刀柄型号' - ) active = fields.Boolean(string='有效', default=True) diff --git a/sf_base/views/tool_basic_param.xml b/sf_base/views/tool_basic_param.xml index 350c38f1..616905ca 100644 --- a/sf_base/views/tool_basic_param.xml +++ b/sf_base/views/tool_basic_param.xml @@ -46,8 +46,6 @@ - - diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index 68ed8bda..f0e79d5f 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -157,6 +157,12 @@ + +
- + @@ -223,7 +229,7 @@ - + @@ -234,24 +240,22 @@ - - - - - + + + + - + + + + - - - - @@ -262,29 +266,29 @@ - - - - - + + + + + - + + - - - - + + + @@ -299,13 +303,13 @@ - + + - + - @@ -316,26 +320,25 @@ + + + - + + + - - - - - - + + + + + - - - - - - + + - - - - - diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml index 2d3067ea..94cb4b7f 100644 --- a/sf_dlm_management/views/product_template_management_view.xml +++ b/sf_dlm_management/views/product_template_management_view.xml @@ -176,6 +176,10 @@ options="{'format': false}" attrs="{'readonly': [('id', '!=', False)]}"/> + + - -
- + diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index 54e54d01..8870c0ec 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -14,5 +14,4 @@ access_maintenance_standard_image_group_plan_dispatch,maintenance_standard_image access_equipment_maintenance_standards_group_plan_dispatch,equipment_maintenance_standards,model_equipment_maintenance_standards,sf_base.group_plan_dispatch,1,0,0,0 access_maintenance_standards_group_plan_dispatch,maintenance_standards,model_maintenance_standards,sf_base.group_plan_dispatch,1,0,0,0 -access_maintenance_equipment_tool_group_plan_dispatch,maintenance.equipment.tool,sf_manufacturing.model_maintenance_equipment_tool,sf_base.group_plan_dispatch,1,0,0,0 access_sf_robot_axis_num_group_plan_dispatch,sf.robot.axis.num,model_sf_robot_axis_num,sf_base.group_plan_dispatch,1,0,0,0 \ No newline at end of file diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 115fdc86..23c659f5 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -6,10 +6,8 @@ import os from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path - - -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): @@ -204,7 +202,6 @@ class ResProductMo(models.Model): self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered( lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter)) elif self.cutting_tool_type == '夹头': - self.cutting_tool_clamping_length = self.specification_id.clamping_length self.cutting_tool_clamping_tolerance = self.specification_id.clamping_tolerance self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter self.cutting_tool_clamping_diameter_min = self.specification_id.max_clamping_diameter @@ -236,8 +233,6 @@ class ResProductMo(models.Model): self.cutting_tool_rear_angle = self.specification_id.relief_angle self.cutting_tool_main_included_angle = self.specification_id.main_included_angle self.cutting_tool_top_angle = self.specification_id.top_angle - self.cutting_tool_blade_tip_dip_angle = self.specification_id.blade_tip_dip_angle - self.cutting_tool_side_cutting_edge_angle = self.specification_id.side_cutting_edge_angle self.cutting_tool_pitch = self.specification_id.pitch self.cutting_tool_bladed_teeth_model = self.specification_id.blade_teeth_model self.cutting_tool_thickness_tolerance = self.specification_id.thickness_tolerance @@ -265,7 +260,14 @@ class ResProductMo(models.Model): self.cutting_tool_rear_angle = self.specification_id.relief_angle self.cutting_tool_main_included_angle = self.specification_id.main_included_angle self.cutting_tool_top_angle = self.specification_id.top_angle - self.cutting_tool_blade_tip_dip_angle = self.specification_id.blade_tip_dip_angle + self.cutting_tool_screw = self.specification_id.screw + self.cutting_tool_wrench = self.specification_id.wrench + self.cutting_tool_blade_id = self.specification_id.blade_id + self.cutting_tool_is_cooling_hole = self.specification_id.is_cooling_hole + self.cutting_tool_locating_slot_code = self.specification_id.locating_slot_code + self.cutting_tool_install_blade_tip_num = self.specification_id.install_blade_tip_num + self.cutting_tool_installing_structure = self.specification_id.installing_structure + self.cutting_tool_cut_depth_max = self.specification_id.cut_depth_max if self.cutting_tool_type == '刀盘': self.cutting_tool_blade_length = self.specification_id.blade_length self.cutting_tool_cutter_head_diameter = self.specification_id.cutter_head_diameter @@ -274,6 +276,9 @@ class ResProductMo(models.Model): self.cutting_tool_knife_head_height = self.specification_id.knife_head_height self.cutting_tool_knife_head_width = self.specification_id.knife_head_width self.cutting_tool_knife_head_length = self.specification_id.knife_head_length + self.cutting_tool_tool_shim = self.specification_id.tool_shim + self.cutting_tool_cotter_pin = self.specification_id.cotter_pin + self.cutting_tool_pressing_plate = self.specification_id.pressing_plate elif self.cutting_tool_type == '刀柄': self.cutting_tool_total_length = self.specification_id.total_length self.cutting_tool_speed_max = self.specification_id.max_rotate_speed @@ -285,6 +290,13 @@ class ResProductMo(models.Model): self.cutting_tool_flange_diameter = self.specification_id.flange_diameter self.cutting_tool_fit_chuck_size = self.specification_id.fit_chuck_size self.cutting_tool_dynamic_balance_class = self.specification_id.dynamic_balance_class + self.cutting_tool_is_high_speed_cutting = self.specification_id.is_quick_cutting + self.cutting_tool_is_safety_lock = self.specification_id.is_safe_lock + self.cutting_tool_fit_nut_model = self.specification_id.nut + self.cutting_tool_wrench = self.specification_id.spanner + self.cutting_tool_chuck_id = self.specification_id.chuck_id.id + self.cutting_tool_jump_accuracy = self.specification_id.diameter_slip_accuracy + self.cutting_tool_taper_shank_model = self.specification_id.taper_shank_model self.suitable_machining_method_ids = [(6, 0, [])] if not \ self.cutting_tool_model_id.suitable_machining_method_ids \ else [(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)] @@ -352,12 +364,12 @@ class ResProductMo(models.Model): raise ValidationError("请选择压紧方式") if self.cutting_tool_type == '刀片': if not self.suitable_coolant_ids: - raise ValidationError("请选择适合冷却液") + raise ValidationError("请选择适合冷却方式") elif self.cutting_tool_type == '整体式刀具': if not self.handle_type_id: raise ValidationError("请选择柄部类型") if not self.suitable_coolant_ids: - raise ValidationError("请选择适合冷却液") + raise ValidationError("请选择适合冷却方式") if not self.suitable_machining_method_ids: raise ValidationError("请选择适合加工方式") if not self.blade_tip_characteristics_id: @@ -371,11 +383,8 @@ class ResProductMo(models.Model): cutting_tool_rear_angle = fields.Integer('后角(°)') cutting_tool_main_included_angle = fields.Integer('主偏角(°)') # 适用夹头型号可以多选 - cutting_tool_chuck_ids = fields.Many2many( + cutting_tool_chuck_id = fields.Many2one( 'sf.cutting_tool.standard.library', - relation='product_cutting_tool_library_handle_chuck_rel', - column1='model_id_1', - column2='model_id_2', domain="[('cutting_tool_type', '=', '夹头')]", string='适用夹头型号') # 刀片参数 @@ -432,11 +441,8 @@ class ResProductMo(models.Model): cutting_tool_min_machining_aperture = fields.Integer('最小加工孔径(mm)') cutting_tool_install_blade_tip_num = fields.Integer('可装刀片数/齿数(个)', size=20) cutting_tool_installing_structure = fields.Char('安装结构', size=20) - cutting_tool_blade_ids = fields.Many2many( + cutting_tool_blade_id = fields.Many2one( 'sf.cutting_tool.standard.library', - relation='product_cutting_tool_library_pad_blade_rel', - column1='model_id_1', - column2='model_id_2', domain="[('cutting_tool_type', '=', '刀片')]", string='适用刀片型号' # 使用空列表作为默认值 ) @@ -547,12 +553,6 @@ class ResProductMo(models.Model): code_arr.append(i.code) return code_arr - def _json_chuck_item_code(self, item): - code_arr = [] - for i in item.product_id.cutting_tool_chuck_ids: - code_arr.append(i.code) - return code_arr - def _json_cutter_bar_item_code(self, item): code_arr = [] for i in item.product_id.cutting_tool_cutter_bar_ids: @@ -565,12 +565,6 @@ class ResProductMo(models.Model): code_arr.append(i.code) return code_arr - def _json_blade_item_code(self, item): - code_arr = [] - for i in item.product_id.cutting_tool_blade_ids: - code_arr.append(i.code) - return code_arr - def _json_handle_item_code(self, item): code_arr = [] for i in item.product_id.cutting_tool_handle_ids: @@ -603,7 +597,6 @@ class ResProductMo(models.Model): for item in self: if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']: item.brand_id = item.fixture_model_id.brand_id.id - item.fixture_multi_mounting_type_id = item.fixture_model_id.multi_mounting_type_id.id item.fixture_model_file = item.fixture_model_id.model_file item.tool_length = item.fixture_model_id.length item.tool_width = item.fixture_model_id.width diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 27edc40f..06269fc5 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -386,8 +386,6 @@ class ReStockMove(models.Model): 'brand_code': self.env['sf.machine.brand'].search([('id', '=', item.product_id.brand_id.id)]).code, 'fixture_material_code': self.env['sf.fixture.material'].search( [('id', '=', item.product_id.fixture_material_id.id)]).code, - 'fixture_multi_mounting_type_code': self.env['sf.multi_mounting.type'].search( - [('id', '=', item.product_id.fixture_multi_mounting_type_id.id)]).code, 'fixture_materials_type_code': self.env['sf.materials.model'].search( [('id', '=', item.product_id.materials_type_id.id)]).materials_no, 'fixture_clamping_way': item.product_id.fixture_clamping_way, diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv index 313c4567..933a2c45 100644 --- a/sf_manufacturing/security/ir.model.access.csv +++ b/sf_manufacturing/security/ir.model.access.csv @@ -106,4 +106,5 @@ access_sf_cnc_processing,sf.cnc.processing,model_sf_cnc_processing,sf_base.group -access_mrp_workcenter_productivity,mrp.workcenter.productivity,mrp.model_mrp_workcenter_productivity,sf_base.group_plan_dispatch,1,0,0,0 \ No newline at end of file +access_mrp_workcenter_productivity,mrp.workcenter.productivity,mrp.model_mrp_workcenter_productivity,sf_base.group_plan_dispatch,1,0,0,0 +access_maintenance_equipment_tool_group_plan_dispatch,maintenance.equipment.tool,sf_manufacturing.model_maintenance_equipment_tool,sf_base.group_plan_dispatch,1,0,0,0 diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 18fb0001..b23b87b2 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -2220,6 +2220,10 @@ class Cutting_tool_standard_library(models.Model): "fit_blade_shape_id": False if not item['fit_blade_shape'] else self.env[ 'maintenance.equipment.image'].search( [('name', '=', item['fit_blade_shape'])]).id, + "chuck_id": False if not item['chuck_code'] else self.search( + [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id, + "handle_id": False if not item['handle_code'] else self.search( + [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id, "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_methods']), @@ -2258,6 +2262,10 @@ class Cutting_tool_standard_library(models.Model): "fit_blade_shape_id": False if not item['fit_blade_shape'] else self.env[ 'maintenance.equipment.image'].search( [('name', '=', item['fit_blade_shape'])]).id, + "chuck_id": False if not item['chuck_code'] else self.search( + [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id, + "handle_id": False if not item['handle_code'] else self.search( + [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id, "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_methods']), @@ -2318,6 +2326,10 @@ class Cutting_tool_standard_library(models.Model): "fit_blade_shape_id": False if not item['fit_blade_shape'] else self.env[ 'maintenance.equipment.image'].search( [('name', '=', item['fit_blade_shape'])]).id, + "chuck_id": False if not item['chuck_code'] else self.search( + [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id, + "handle_id": False if not item['handle_code'] else self.search( + [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id, "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_method') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_method']), @@ -2356,6 +2368,10 @@ class Cutting_tool_standard_library(models.Model): "fit_blade_shape_id": False if not item['fit_blade_shape'] else self.env[ 'maintenance.equipment.image'].search( [('name', '=', item['fit_blade_shape'])]).id, + "chuck_id": False if not item['chuck_code'] else self.search( + [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id, + "handle_id": False if not item['handle_code'] else self.search( + [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id, "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_methods']), @@ -2681,6 +2697,7 @@ class CuttingToolBasicParameters(models.Model): 'name': knife_handle_item['name'], 'code': knife_handle_item['code'], 'cutting_tool_type': '刀柄', + 'taper_shank_model': knife_handle_item['taper_shank_model'], 'standard_library_id': self.env['sf.cutting_tool.standard.library'].search( [('code', '=', knife_handle_item['standard_library_code'].replace("JKM", result[ 'factory_short_name']))]).id, @@ -2706,6 +2723,7 @@ class CuttingToolBasicParameters(models.Model): else: self.write({ 'name': knife_handle_item['name'], + 'taper_shank_model': knife_handle_item['taper_shank_model'], 'total_length': knife_handle_item['total_length'], 'flange_shank_length': knife_handle_item['flange_length'], 'flange_diameter': knife_handle_item['flange_diameter'], @@ -3043,6 +3061,7 @@ class CuttingToolBasicParameters(models.Model): [('code', '=', knife_handle_item['standard_library_code'].replace("JKM", result[ 'factory_short_name']))]).id, 'total_length': knife_handle_item['total_length'], + 'taper_shank_model': knife_handle_item['taper_shank_model'], 'flange_shank_length': knife_handle_item['flange_length'], 'flange_diameter': knife_handle_item['flange_diameter'], 'shank_length': knife_handle_item['shank_length'], @@ -3068,6 +3087,7 @@ class CuttingToolBasicParameters(models.Model): self.write({ 'name': knife_handle_item['name'], 'total_length': knife_handle_item['total_length'], + 'taper_shank_model': knife_handle_item['taper_shank_model'], 'flange_shank_length': knife_handle_item['flange_length'], 'flange_diameter': knife_handle_item['flange_diameter'], 'shank_length': knife_handle_item['shank_length'], diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 10b83aed..09ea3f0f 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -# from quatotion import readSql, feature_recognize, auto_quatotion +from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 7419cc9a..1e5f274c 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -5,8 +5,8 @@ import os import json from datetime import datetime import requests -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 80ac3811..f1947227 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -118,8 +118,8 @@ class FunctionalCuttingToolEntity(models.Model): 'maintenance.equipment.image', 'rel_cutting_product_template_tool_entity', '走刀方向', domain=[('type', '=', '走刀方向')]) suitable_coolant_ids = fields.Many2many( - 'maintenance.equipment.image', 'rel_coolant_product_template_tool_entity', '适合冷却液', - domain=[('type', '=', '冷却液')]) + 'maintenance.equipment.image', 'rel_coolants_product_template_tool_entity', '适合冷却方式', + domain=[('type', '=', '冷却方式')]) @api.depends('cutting_tool_integral_model_id', 'cutting_tool_blade_model_id') def _compute_maintenance_equipment_image(self): @@ -287,7 +287,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model): 'maintenance.equipment.image', 'rel_cutting_product_template_distribution', '走刀方向', domain=[('type', '=', '走刀方向')], related='sf_functional_cutting_tool_entity_ids.cutting_direction_ids') suitable_coolant_ids = fields.Many2many( - 'maintenance.equipment.image', 'rel_coolant_product_template_distribution', '适合冷却液', + 'maintenance.equipment.image', 'rel_coolant_product_template_distribution', '适合冷却方式', domain=[('type', '=', '冷却液')], related='sf_functional_cutting_tool_entity_ids.suitable_coolant_ids') sf_functional_cutting_tool_entity_ids = fields.Many2many('sf.functional.cutting.tool.entity', diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index 62c0f0eb..06ad43aa 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -130,7 +130,7 @@ - + @@ -359,7 +359,7 @@ readonly="1" domain="[('id','in',cutting_direction_ids)]"/> - + diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml index 3bb5d3ea..92369fa8 100644 --- a/sf_tool_management/views/tool_material_search.xml +++ b/sf_tool_management/views/tool_material_search.xml @@ -241,7 +241,7 @@ - + From d980a036cd8ca59017f27cca574d618dc8bf490f Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 8 Jan 2024 15:52:33 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_dlm_management/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_dlm_management/__manifest__.py b/sf_dlm_management/__manifest__.py index 813fdb3f..a5c894d4 100644 --- a/sf_dlm_management/__manifest__.py +++ b/sf_dlm_management/__manifest__.py @@ -11,7 +11,7 @@ 'website': 'https://www.sf.jikimo.com', 'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing'], 'data': [ - # 'data/stock_data.xml', + 'data/stock_data.xml', 'views/product_template_management_view.xml', ], 'demo': [ From 4dde30f9f9e45ad334e3efd072f13778dec319db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=84=B1?= Date: Mon, 8 Jan 2024 16:28:49 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9sf=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/scss/custom_style.scss | 18 ++++++++++++------ sf_sale/static/js/setTableWidth.js | 5 +++-- sf_tool_management/static/src/change.scss | 6 +----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index eddf019b..2b1c6cfc 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -132,11 +132,11 @@ td.o_required_modifier { //font-weight: bold; } -//.text-truncate { -// overflow: unset !important; -// text-overflow: unset !important; -// white-space: nowrap!important; -//} +.text-truncate { + overflow: unset !important; + text-overflow: unset !important; + //white-space: nowrap!important; +} .o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove) { white-space: nowrap !important; @@ -425,7 +425,13 @@ div:has(.o_required_modifier) > label::before { .o_list_renderer .o_list_table thead .o_list_number_th { text-align:left; } - +.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector).o_list_number { + text-align: left; +} .o_list_renderer .flex-row-reverse { flex-direction: unset!important; +} + +.o_list_renderer .flex-row-reverse > .text-end { + text-align: left!important; } \ No newline at end of file diff --git a/sf_sale/static/js/setTableWidth.js b/sf_sale/static/js/setTableWidth.js index 7cae3950..6e494214 100644 --- a/sf_sale/static/js/setTableWidth.js +++ b/sf_sale/static/js/setTableWidth.js @@ -11,15 +11,16 @@ function setTableWidth() { const tbody_tr = dom.find('tbody').children('tr') dom.find('thead').children('tr').children().each(function () { $('#widthTest').text($(this).text()) - const width = $('#widthTest').width() + const width = $('#widthTest').width() + 10 const i = $(this).index() - console.log(111) tbody_tr.each(function () { if($(this).children().length > 2) { $(this).children().eq(i).css('min-width', width + 'px') } }) }) + const resizeEvent = new Event('resize'); + window.dispatchEvent(resizeEvent); } $(function () { diff --git a/sf_tool_management/static/src/change.scss b/sf_tool_management/static/src/change.scss index a4e64f97..4c857c8c 100644 --- a/sf_tool_management/static/src/change.scss +++ b/sf_tool_management/static/src/change.scss @@ -11,11 +11,7 @@ } .o_form_view .o_field_widget .o_list_renderer { - width: calc(100% - 64px) !important; + width: 100%!important; margin:0 auto; overflow: auto; } - -.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector).o_list_number { - text-align: left; -} \ No newline at end of file