From 8e61d5f87c4ce692200ba95ffd2577e092836685 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 28 Dec 2023 10:50:44 +0800 Subject: [PATCH 001/151] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/security/group_security.xml | 2 +- sf_warehouse/security/ir.model.access.csv | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sf_base/security/group_security.xml b/sf_base/security/group_security.xml index dd78c2c0..478d41b9 100644 --- a/sf_base/security/group_security.xml +++ b/sf_base/security/group_security.xml @@ -71,7 +71,7 @@ 计划总监 - + diff --git a/sf_warehouse/security/ir.model.access.csv b/sf_warehouse/security/ir.model.access.csv index 2367fbd7..87ddef13 100644 --- a/sf_warehouse/security/ir.model.access.csv +++ b/sf_warehouse/security/ir.model.access.csv @@ -96,7 +96,7 @@ access_stock_replenish_option,stock.replenishment.option,stock.model_stock_reple access_mrp_production,mrp.production,mrp.model_mrp_production,sf_warehouse.group_sf_stock_user,1,1,1,0 access_sf_shelf_location,sf.shelf.location,model_sf_shelf_location,sf_base.group_plan_dispatch,1,0,0,0 -access_stock_move,stock.move,stock.model_stock_move,sf_base.group_plan_dispatch,1,0,0,0 +access_stock_move,stock.move,stock.model_stock_move,sf_base.group_plan_dispatch,1,1,1,0 access_stock_scrap_user,stock.scrap.user,stock.model_stock_scrap,sf_base.group_plan_dispatch,1,0,0,0 access_stock_scrap_manager,stock.scrap.manager,stock.model_stock_scrap,sf_base.group_plan_dispatch,1,0,0,0 access_stock_picking,stock.picking,stock.model_stock_picking,sf_base.group_plan_dispatch,1,0,0,0 @@ -104,8 +104,10 @@ access_stock_lot,stock.lot,stock.model_stock_lot,sf_base.group_plan_dispatch,1,1 access_stock_warehouse_orderpoint,stock.warehouse.orderpoint,stock.model_stock_warehouse_orderpoint,sf_base.group_plan_dispatch,1,0,0,0 access_stock_quant,stock.quant,stock.model_stock_quant,sf_base.group_plan_dispatch,1,0,0,0 -access_product_product,product.product,product.model_product_product,sf_base.group_plan_dispatch,1,1,1,0 -access_product_template,product.template,product.model_product_template,sf_base.group_plan_dispatch,1,1,1,0 +access_product_product,product.product,product.model_product_product,sf_base.group_plan_dispatch,1,0,0,0 +access_product_template,product.template,product.model_product_template,sf_base.group_plan_dispatch,1,0,0,0 +access_product_product,product.product,product.model_product_product,sf_base.group_plan_director,1,1,1,0 +access_product_template,product.template,product.model_product_template,sf_base.group_plan_director,1,1,1,0 access_stock_inventory_conflict,stock.inventory.conflict,stock.model_stock_inventory_conflict,sf_base.group_plan_dispatch,1,0,0,0 access_stock_inventory_warning,stock.inventory.warning,stock.model_stock_inventory_warning,sf_base.group_plan_dispatch,1,0,0,0 From a9c2d1aa5c4a78f72ec74b79ef8b16d469f7d0e3 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Thu, 28 Dec 2023 16:27:40 +0800 Subject: [PATCH 002/151] =?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:06:34 +0800 Subject: [PATCH 003/151] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E5=A4=B9?= =?UTF-8?q?=E5=85=B7=E7=89=A9=E6=96=99=E5=9F=BA=E6=9C=AC=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=EF=BC=8C=E9=87=8D=E6=9E=84=E5=B7=A5=E5=8E=82?= =?UTF-8?q?=E7=9A=84=E5=A4=B9=E5=85=B7=E5=9E=8B=E5=8F=B7=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E9=87=8D=E6=96=B0=E4=BC=98=E5=8C=96=E5=A4=B9=E5=85=B7?= =?UTF-8?q?=E7=89=A9=E6=96=99form=E8=A7=86=E5=9B=BE=EF=BC=9B2=E3=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=80=E5=85=B7=E6=A0=87=E5=87=86=E5=BA=93?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=EF=BC=8C=E4=BC=98=E5=8C=96=E5=88=87=E5=89=8A?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E6=A8=A1=E5=9E=8B=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=AF=8F=E9=BD=BF=E8=B5=B0=E5=88=80=E9=87=8F=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=88=87=E5=89=8A=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E5=92=8C=E6=B7=B1=E5=BA=A6=E6=A8=A1=E5=9E=8B=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=9D=A1=E9=93=A3=E8=A7=92=E5=BA=A6=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=EF=BC=9B3=E3=80=81=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7=E5=AE=89=E5=85=A8=E5=BA=93=E5=AD=98=E6=9C=80?= =?UTF-8?q?=E4=BD=8E=E5=AE=89=E5=85=A8=E5=BA=93=E5=AD=98=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=AB=98=E4=BA=8E=E6=9C=80=E9=AB=98=E5=BA=93=E5=AD=98=E7=9A=84?= =?UTF-8?q?bug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/__init__.py | 1 + sf_base/models/basic_parameters_fixture.py | 68 ++++++ sf_base/models/fixture.py | 59 +++-- sf_base/models/tool_base_new.py | 13 +- sf_base/models/tool_other_features.py | 52 +++- sf_base/security/ir.model.access.csv | 5 + sf_base/views/fixture_view.xml | 272 +++++++++++++++------ sf_base/views/tool_views.xml | 112 ++++----- sf_tool_management/models/base.py | 7 +- 9 files changed, 412 insertions(+), 177 deletions(-) create mode 100644 sf_base/models/basic_parameters_fixture.py diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index 31dfcf95..f7d50427 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -4,3 +4,4 @@ from . import tool_base_new from . import fixture from . import functional_fixture from . import tool_other_features +from . import basic_parameters_fixture diff --git a/sf_base/models/basic_parameters_fixture.py b/sf_base/models/basic_parameters_fixture.py new file mode 100644 index 00000000..0dfb4b6d --- /dev/null +++ b/sf_base/models/basic_parameters_fixture.py @@ -0,0 +1,68 @@ +from odoo import models, fields + + +class BasicParametersFixture(models.Model): + _name = 'sf.fixture.materials.basic.parameters' + _description = '夹具物料基本参数' + + fixture_model_id = fields.Many2one('sf.fixture.model', '夹具型号') + name = fields.Char('物料号', size=20) + length = fields.Float('长度(mm)', digits=(16, 2)) + width = fields.Float('宽度(mm)', digits=(16, 2)) + height = fields.Float('高度(mm)', digits=(16, 2)) + diameter = fields.Float('直径(mm)', digits=(16, 2)) + + # '零点卡盘' 字段 + weight = fields.Float('重量(mm)', digits=(16, 2)) + orientation_dish_diameter = fields.Float('定位盘直径(mm)', digits=(16, 2)) + clamping_diameter = fields.Float('装夹直径(mm)', digits=(16, 2)) + clamping_num = fields.Selection([('1', '1'), ('2', '2'), ('4', '4'), ('6', '6'), ('8', '8')], string='夹装单元数') + chucking_power_max = fields.Float('最大夹持力(KN)', digits=(16, 2)) + repeated_positioning_accuracy = fields.Char('重复定位精度(mm)', size=20) + boolean_transposing_hole = fields.Boolean('是否有转位孔') + unlocking_method = fields.Selection( + [('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')], string='解锁方式') + boolean_chip_blowing_function = fields.Boolean('是否有吹屑功能') + carrying_capacity_max = fields.Float('最大承载重量(kg)', digits=(16, 2)) + rigidity = fields.Integer('硬度HRC') + materials_model_id = fields.Many2one('sf.materials.model', '夹具材质') + machine_tool_type_id = fields.Many2one('sf.machine_tool.type', '适用机床型号') + + # ’零点托盘‘ 字段 + connector_diameter = fields.Selection([('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('8', '8')], + string='连接头直径(mm)') + way_to_install = fields.Selection( + [('接口式', '接口式'), ('螺栓固定', '螺栓固定'), ('磁吸式', '磁吸式'), ('其他', '其他')], string='安装方式') + type_of_drive = fields.Selection( + [('气动式', '气动式'), ('液压式', '液压式'), ('机械式', '机械式'), ('电动式', '电动式'), ('其他', '其他')], + string='驱动方式') + + # ’气动夹具‘ 字段 + gripper_length_min = fields.Float('夹持工件最小长度(mm)', digits=(16, 2)) + gripper_width_min = fields.Float('夹持工件最小宽度(mm)', digits=(16, 2)) + gripper_height_min = fields.Float('夹持工件最小高度(mm)', digits=(16, 2)) + gripper_diameter_min = fields.Float('夹持工件最小直径(mm)', digits=(16, 2)) + gripper_length_max = fields.Float('夹持工件最大长度(mm)', digits=(16, 2)) + gripper_width_max = fields.Float('夹持工件最大宽度(mm)', digits=(16, 2)) + gripper_height_max = fields.Float('夹持工件最大高度(mm)', digits=(16, 2)) + gripper_diameter_max = fields.Float('夹持工件最大直径(mm)', digits=(16, 2)) + rated_air_pressure = fields.Float('额定气压(Mpa)', digits=(16, 2)) + interface_materials_model_id = fields.Many2one('sf.materials.model', '接口类型') + + # ‘虎钳夹具' 字段 + transverse_groove = fields.Float('横向配合槽n(mm)', digits=(16, 2)) + longitudinal_fitting_groove = fields.Float('纵向配合槽l(mm)', digits=(16, 2)) + + # '磁吸夹具' 字段 + height_tolerance_value = fields.Char('高度公差(mm)') + rated_adsorption_force = fields.Float('额定吸附力(N/cm²)', digits=(16, 2)) + magnetic_field_height = fields.Float('磁场高度(mm)', digits=(16, 2)) + magnetic_pole_plate_grinding_allowance = fields.Float('磁极板磨削余量(mm)', digits=(16, 2)) + + # '转接板夹具' 字段 + screw_size = fields.Float('螺牙大小(mm)', digits=(16, 2)) + via_hole_diameter = fields.Float('过孔直径(mm)', digits=(16, 2)) + + # '三爪卡盘' 字段 + mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2)) + centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2)) \ No newline at end of file diff --git a/sf_base/models/fixture.py b/sf_base/models/fixture.py index f7cb5fa8..91aec75e 100644 --- a/sf_base/models/fixture.py +++ b/sf_base/models/fixture.py @@ -26,33 +26,28 @@ class FixtureModel(models.Model): _name = 'sf.fixture.model' _description = "夹具型号" - name = fields.Char(string="名称", size=15) - fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料", ) - fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name', store=True) - multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型") - brand_id = fields.Many2one('sf.machine.brand', string="品牌", domain="[('tag_ids.name', 'ilike', '夹具')]") - clamping_way = fields.Char(string="装夹方式") - port_type = fields.Char(string="接口类型") + name = fields.Char(string="名称", size=50, required=True) + fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料", required=True) + fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name') + multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型", required=True) + brand_id = fields.Many2one('sf.machine.brand', string="品牌") model_file = fields.Binary(string="3D模型图") + active = fields.Boolean('有效', default=False) - length = fields.Char(string="长度(mm)") - width = fields.Char(string="宽度(mm)") - height = fields.Char(string="高度(mm)") - weight = fields.Char(string="重量(kg)") - clamp_workpiece_length_max = fields.Integer(string="夹持工件长度max(mm)") - clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度max(mm)") - clamp_workpiece_height_max = fields.Integer(string="夹持工件高度max(mm)") - clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径max(mm)") - maximum_carrying_weight = fields.Float(string="最大承载重量(kg)") - maximum_clamping_force = fields.Integer(string="最大夹持力(n)") - - materials_model_id = fields.Many2one('sf.materials.model', string="材料型号") - driving_way = fields.Selection([('气动', '气动'), ('液压', '液压'), ('机械', '机械')], string="驱动方式") - apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_fixture_model_machine_tool_type', - string="适用机床型号") - through_hole_size = fields.Integer(string="过孔大小[mm]") - screw_size = fields.Integer(string="螺牙大小[mm]") - active = fields.Boolean('有效', default=True) + zero_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', + string='零点卡盘基本参数') + zero_tray_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', + string='零点托盘基本参数') + pneumatic_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', + string='气动夹具基本参数') + jaw_vice_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', + string='虎钳夹具基本参数') + magnet_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', + string='磁吸夹具基本参数') + adapter_board_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', + string='转接板夹具基本参数') + scroll_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id', + string='三爪卡盘基本参数') def _get_code(self, fixture_model_type_code): fixture_model = self.env['sf.fixture.model'].sudo().search( @@ -70,14 +65,18 @@ class FixtureModel(models.Model): def _onchange_fixture_material_id(self, fixture_material_id): if fixture_material_id: - if fixture_material_id.name == "气动夹具": + if self.fixture_material_id.name == "气动夹具": code = self._get_code("JKM-C-JJWL-QDJJ-") - elif fixture_material_id.name == "转接板(锁板)夹具": - code = self._get_code("JKM-C-JJWL-ZJBJJ-") - elif fixture_material_id.name == "磁吸夹具": + elif self.fixture_material_id.name == "转接板夹具": + code = self._get_code("JKM-C-JJWL-ZJJJ-") + elif self.fixture_material_id.name == "磁吸夹具": code = self._get_code("JKM-C-JJWL-CXJJ-") - elif fixture_material_id.name == "虎钳夹具": + elif self.fixture_material_id.name == "虎钳夹具": code = self._get_code("JKM-C-JJWL-HQJJ-") + elif self.fixture_material_id.name == "零点托盘": + code = self._get_code("JKM-C-JJWL-LDTP-") + elif self.fixture_material_id.name == "三爪卡盘": + code = self._get_code("JKM-C-JJWL-SZKP-") else: code = self._get_code("JKM-C-JJWL-LDKP-") return code diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index e8769b80..4dc6b619 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -75,6 +75,8 @@ class CuttingToolModel(models.Model): integral_coarse_medium_fine = fields.Selection([('粗', '粗'), ('中', '中'), ('精', '精')], '粗/中/精') integral_run_out_accuracy_max = fields.Char('整体式刀具端跳精度max') integral_run_out_accuracy_min = fields.Char('整体式刀具端跳精度min') + ramping_angle_ids = fields.One2many('sf.ramping.angle', 'standard_library_id', '坡铣角度', + domain=lambda self: [('standard_library_id', '=', self.id)]) fit_blade_shape_id = fields.Many2one('maintenance.equipment.image', '适配刀片形状', domain=[('type', '=', '刀片形状')]) @@ -106,12 +108,9 @@ class CuttingToolModel(models.Model): 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_2 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz', - domain=[('machining_method', '!=', False)]) feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz', domain=[('cutting_speed', '!=', False)]) - feed_per_tooth_ids_4 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz', - domain=[('machining_method', '!=', False)]) + material_model_id = fields.Many2one('sf.materials.model', '材料型号') # 适用夹头型号可以多选 chuck_ids = fields.Many2many( @@ -157,6 +156,12 @@ 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 acbb569d..63ea66e7 100644 --- a/sf_base/models/tool_other_features.py +++ b/sf_base/models/tool_other_features.py @@ -293,14 +293,28 @@ class CuttingSpeed(models.Model): product_template_id = fields.Many2one('product.template') standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库') + execution_standard_id = fields.Many2one('sf.international.standards', string='执行标准', store=True) material_code = fields.Char('材料代号') + material_name_id = fields.Many2one('sf.materials.model', '材料名称', + domain="[('standards_id', '=', execution_standard_id)]") + material_grade = fields.Char('材料牌号') + tensile_strength = fields.Char('拉伸强度 (N/mm²)') + hardness = fields.Integer('硬度(hrc)') + ability_feature_library = fields.Many2one('maintenance.equipment.image', '加工方式', + domain="[('type', '=', '加工能力')]") + cutting_width_depth_id = fields.Many2one('sf.cutting.width.depth', '切削宽度和深度') + process_capability = fields.Selection([('粗加工', '粗加工'), ('精加工', '精加工')], string='粗/精加工') + cutting_speed = fields.Char('切削速度', required=True) + cutting_speed_max = fields.Float('最大值') + 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('坡铣角度(°)') - material_grade = fields.Char('材料牌号') - tensile_strength = fields.Char('拉伸强度 (N/mm²)') - hardness = fields.Integer('硬度(HRC)') 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') @@ -308,7 +322,8 @@ class CuttingSpeed(models.Model): 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)') - application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用') + + # ====================================== def _json_cutting_speed(self, obj): cutting_speed_str = (0, '', { @@ -334,15 +349,20 @@ class CuttingSpeed(models.Model): class FeedPerTooth(models.Model): _name = 'sf.feed.per.tooth' _description = '每齿走刀量fz' - _order = 'machining_method desc, blade_diameter, materials_type_id' + _order = 'blade_diameter,cutting_width_depth_id,materials_type_id' 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) + + # =============待删除字段=========== cutting_speed = fields.Char('径向切宽 ae(mm)') machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式') - materials_type_id = fields.Many2one('sf.materials.model', string='材料型号') - blade_diameter = fields.Integer('刃部直径(mm)', readonly=True) - feed_per_tooth = fields.Char('每齿走刀量 (mm/z)') + + # ================================ def _json_feed_per_tooth(self, obj): feed_per_tooth_str = (0, '', { @@ -382,3 +402,19 @@ class FeedPerTooth(models.Model): # def _compute_product_template_id(self): # if self.product_template_id is not None: # self.blade_diameter = self.product_template_id.cutting_tool_blade_diameter + + +class CuttingWidthDepth(models.Model): + _name = 'sf.cutting.width.depth' + _description = '切削宽度和深度' + + name = fields.Char('名称') + + +class RampingAngle(models.Model): + _name = 'sf.ramping.angle' + _description = '坡铣角度' + + standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', '刀具标准库') + + name = fields.Char('坡铣角度') diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 1767871b..77c3e810 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -18,6 +18,8 @@ access_sf_cutting_tool_type,sf_cutting_tool_type,model_sf_cutting_tool_type,base access_sf_functional_cutting_tool,sf_functional_cutting_tool,model_sf_functional_cutting_tool,base.group_user,1,1,1,1 access_sf_functional_cutting_tool_model,sf_functional_cutting_tool_model,model_sf_functional_cutting_tool_model,base.group_user,1,1,1,1 access_sf_fixture_material,sf_fixture_material,model_sf_fixture_material,base.group_user,1,1,1,1 +access_sf_fixture_materials_basic_parameters,sf_fixture_materials_basic_parameters,model_sf_fixture_materials_basic_parameters,base.group_user,1,1,1,1 + access_sf_multi_mounting_type,sf_multi_mounting_type,model_sf_multi_mounting_type,base.group_user,1,1,1,1 access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user,1,1,1,1 access_sf_functional_fixture_type,sf_functional_fixture_type,model_sf_functional_fixture_type,base.group_user,1,1,1,1 @@ -29,6 +31,9 @@ access_sf_cutting_tool_standard_library,sf_cutting_tool_standard_library,model_s access_sf_tool_materials_basic_parameters,sf_tool_materials_basic_parameters,model_sf_tool_materials_basic_parameters,base.group_user,1,1,1,1 access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1 access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1 +access_sf_ramping_angle,sf_ramping_angle,model_sf_ramping_angle,base.group_user,1,1,1,1 +access_sf_cutting_width_depth,sf_cutting_width_depth,model_sf_cutting_width_depth,base.group_user,1,1,1,1 + access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1 access_purchase_order_group_purchase,access_purchase_order_group_purchase,purchase.model_purchase_order,sf_base.group_purchase,1,1,1,0 access_purchase_order_group_purchase_director,access_purchase_order_group_purchase_director,purchase.model_purchase_order,sf_base.group_purchase_director,1,1,1,0 diff --git a/sf_base/views/fixture_view.xml b/sf_base/views/fixture_view.xml index 487899eb..15f43fb1 100644 --- a/sf_base/views/fixture_view.xml +++ b/sf_base/views/fixture_view.xml @@ -151,9 +151,9 @@ context="{'group_by' : 'multi_mounting_type_id'}"/> - - @@ -163,12 +163,17 @@ 夹具型号 sf.fixture.model - + - + + + + + + @@ -181,15 +186,19 @@

- +

- - + + - + + + @@ -198,67 +207,192 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index b2994cca..f189017d 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -149,6 +149,8 @@ options="{'format': false}"/> (mm)&nbsp; + @@ -274,7 +276,7 @@ - + @@ -304,7 +306,7 @@ - + @@ -328,11 +330,11 @@ - - - - - + + + + + @@ -364,23 +366,21 @@ - + - + - - - - - - - - + + + + + @@ -389,33 +389,18 @@ - - - - - - - - + - + - - - - - - - + - + @@ -508,34 +493,31 @@ [] - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 37c534da..bc487f46 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -296,6 +296,12 @@ class RealTimeDistributionOfFunctionalTools(models.Model): sf_functional_tool_assembly_ids = fields.Many2many('sf.functional.tool.assembly', 'sf_functional_tool_assembly_ref', '功能刀具组装单', readonly=True) + @api.constrains('min_stock_num', 'max_stock_num') + def _check_stock_num(self): + for obj in self: + if obj.min_stock_num > obj.min_stock_num: + raise ValidationError('【最低安全库存】不能高于【最高安全库存】!!!') + @api.model def _read_mrs_cutting_tool_type_ids(self, categories, domain, order): mrs_cutting_tool_type_ids = categories._search([], order=order, access_rights_uid=SUPERUSER_ID) @@ -327,7 +333,6 @@ class RealTimeDistributionOfFunctionalTools(models.Model): else: tool.batch_replenishment_num = 0 - def create_functional_tool_assembly(self): """ 创建功能刀具组装单 From 98847a2c42c5dcc95ccfe501f9c30182dcc290c4 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Thu, 28 Dec 2023 17:38:56 +0800 Subject: [PATCH 004/151] =?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', '!=', '机床')]}"> - + - + - + 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 d1c10f56d1bea67dd82c69c3651efcc7e7de344b Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Fri, 5 Jan 2024 17:33:06 +0800 Subject: [PATCH 029/151] =?UTF-8?q?1=E3=80=81sf=5Fbase=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=88=80=E5=85=B7=E7=BB=84=E6=A8=A1=E5=9E=8B=EF=BC=9B2?= =?UTF-8?q?=E3=80=81=E6=89=80=E4=BB=A5=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=A8=A1=E5=9E=8B=E6=B7=BB=E5=8A=A0=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E5=AF=B9=E8=B1=A1=E5=AD=97=E6=AE=B5=EF=BC=88?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=EF=BC=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/tool_base_new.py | 9 +++++++++ sf_base/security/ir.model.access.csv | 1 + sf_base/views/tool_menu.xml | 7 +++++++ sf_base/views/tool_views.xml | 22 ++++++++++++++++++++++ sf_tool_management/models/base.py | 10 +++++++++- 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index 4dc6b619..3d6504ab 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -238,3 +238,12 @@ class MaintenanceStandardImage(models.Model): else: record['image'] = "" return records + + +class ToolGroups(models.Model): + _name = 'sf.tool.groups' + _description = '刀具组' + + name = fields.Char('名称') + equipment_ids = fields.Many2many('maintenance.equipment', 'ref_maintenance_equipment', string='机台号') + remark = fields.Char('备注', size=50) diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 77c3e810..1490b9ef 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -28,6 +28,7 @@ access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1, access_sf_international_standards,sf_international_standards,model_sf_international_standards,base.group_user,1,1,1,1 access_material_apply,material_apply,model_material_apply,base.group_user,1,1,1,1 access_sf_cutting_tool_standard_library,sf_cutting_tool_standard_library,model_sf_cutting_tool_standard_library,base.group_user,1,1,1,1 +access_sf_tool_groups,sf_tool_groups,model_sf_tool_groups,base.group_user,1,1,1,1 access_sf_tool_materials_basic_parameters,sf_tool_materials_basic_parameters,model_sf_tool_materials_basic_parameters,base.group_user,1,1,1,1 access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1 access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1 diff --git a/sf_base/views/tool_menu.xml b/sf_base/views/tool_menu.xml index cddb7d90..82ecca18 100644 --- a/sf_base/views/tool_menu.xml +++ b/sf_base/views/tool_menu.xml @@ -92,5 +92,12 @@ action="action_maintenance_equipment_image" sequence="5"/> + + diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index f189017d..d300f845 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -493,6 +493,28 @@ [] + + + 刀具组 + sf.tool.groups + + + + + + + + + + + + + 刀具组 + ir.actions.act_window + sf.tool.groups + tree,form,search + + diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 80ac3811..d64b8ee1 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -10,7 +10,8 @@ class FunctionalCuttingToolEntity(models.Model): _name = 'sf.functional.cutting.tool.entity' _description = '功能刀具列表' - # code = fields.Char('序列号') + code = fields.Char('编码', related='functional_tool_name_id.code') + tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id') name = fields.Char(related='functional_tool_name_id.name') functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称', readonly=True) barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True) @@ -175,6 +176,8 @@ class FunctionalToolWarning(models.Model): _name = 'sf.functional.tool.warning' _description = '功能刀具预警' + code = fields.Char('编码', related='functional_tool_name_id.code') + tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id') name = fields.Char('名称', invisible=True, readonly=True, related='functional_tool_name_id.name') # 机床信息 production_line_id = fields.Many2one('sf.production.line', string='生产线', @@ -243,6 +246,8 @@ class StockMoveLine(models.Model): diameter = fields.Integer(string='刀具直径(mm)', related='functional_tool_name_id.functional_tool_diameter') knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle') install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time') + code = fields.Char('编码', related='functional_tool_name_id.code') + tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id') @api.model def _read_group_functional_tool_type_id(self, categories, domain, order): @@ -255,6 +260,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model): _description = '功能刀具安全库存' name = fields.Char('功能刀具名称', readonly=False) + tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组') sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False, group_expand='_read_mrs_cutting_tool_type_ids', store=True) diameter = fields.Integer(string='刀具直径(mm)', readonly=False) @@ -421,6 +427,8 @@ class MachineTableToolChangingApply(models.Model): cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=True, required=True, domain="[('equipment_id', '=', maintenance_equipment_id)]") # 功能刀具信息 + code = fields.Char('编码', related='functional_tool_name_id.code') + tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id') functional_tool_name = fields.Char(string='刀具名称', related='functional_tool_name_id.name', store=True) barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', store=True, domain=[('product_id.name', '=', '功能刀具')], From bc4a4df53e56d0d71c672df9097e8c22b9e8a261 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 8 Jan 2024 14:52:29 +0800 Subject: [PATCH 030/151] =?UTF-8?q?tree=E8=A7=86=E5=9B=BE=E4=B8=AD?= =?UTF-8?q?=E7=9A=84"=E6=89=B9=E9=87=8F=E6=8E=92=E7=A8=8B"=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=BC=98=E5=8C=96=E4=B8=BA=E5=90=91=E5=AF=BC=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan/__init__.py | 1 + sf_plan/__manifest__.py | 4 +- sf_plan/models/custom_plan.py | 3 +- sf_plan/security/ir.model.access.csv | 2 + sf_plan/views/view.xml | 6 ++- sf_plan/wizard/__init__.py | 1 + sf_plan/wizard/action_plan_some.py | 65 ++++++++++++++++++++++++++++ sf_plan/wizard/action_plan_some.xml | 31 +++++++++++++ 8 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 sf_plan/wizard/__init__.py create mode 100644 sf_plan/wizard/action_plan_some.py create mode 100644 sf_plan/wizard/action_plan_some.xml diff --git a/sf_plan/__init__.py b/sf_plan/__init__.py index 8134f974..52497701 100644 --- a/sf_plan/__init__.py +++ b/sf_plan/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import models +from . import wizard diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py index 257400d3..6059e3bd 100644 --- a/sf_plan/__manifest__.py +++ b/sf_plan/__manifest__.py @@ -17,8 +17,10 @@ 'data': [ 'security/ir.model.access.csv', # 'security/rules.xml', + 'wizard/action_plan_some.xml', 'views/view.xml', - 'views/change_manufactuing.xml' + 'views/change_manufactuing.xml', + ], 'assets': { diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index a60af7f3..ef6d77a0 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -12,7 +12,7 @@ class sf_production_plan(models.Model): _name = 'sf.production.plan' _description = 'sf_production_plan' _inherit = ['mail.thread'] - _order = 'create_date desc' + _order = 'state desc, write_date desc' state = fields.Selection([ ('draft', '待排程'), @@ -252,6 +252,7 @@ class sf_production_plan(models.Model): def cancel_production_schedule(self): self.date_planned_finished = False self.state = 'draft' + self.production_line_id = False aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)]) aa.schedule_state = '未排' return self.date_planned_finished diff --git a/sf_plan/security/ir.model.access.csv b/sf_plan/security/ir.model.access.csv index 3123afe9..be1708f7 100644 --- a/sf_plan/security/ir.model.access.csv +++ b/sf_plan/security/ir.model.access.csv @@ -1,3 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_sf_production_plan,sf.production.plan,model_sf_production_plan,base.group_user,1,0,0,0 access_sf_production_plan_for_dispatch,sf.production.plan for dispatch,model_sf_production_plan,sf_base.group_plan_dispatch,1,1,1,0 + +access_sf_action_plan_all_wizard,sf.action.plan.all.wizard,model_sf_action_plan_all_wizard,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml index c1bdf5fe..b4e23965 100644 --- a/sf_plan/views/view.xml +++ b/sf_plan/views/view.xml @@ -5,9 +5,11 @@ sf.production.plan.tree sf.production.plan - + +
-
diff --git a/sf_plan/wizard/__init__.py b/sf_plan/wizard/__init__.py new file mode 100644 index 00000000..1dd0edf6 --- /dev/null +++ b/sf_plan/wizard/__init__.py @@ -0,0 +1 @@ +from . import action_plan_some diff --git a/sf_plan/wizard/action_plan_some.py b/sf_plan/wizard/action_plan_some.py new file mode 100644 index 00000000..9760f7ec --- /dev/null +++ b/sf_plan/wizard/action_plan_some.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +import base64 +import logging +import os +from datetime import datetime +from odoo import fields, models +# from odoo.exceptions import ValidationError +from odoo.exceptions import UserError + +_logger = logging.getLogger(__name__) + + +class Action_Plan_All_Wizard(models.TransientModel): + _name = 'sf.action.plan.all.wizard' + _description = u'排程向导' + + # 选择生产线 + production_line_id = fields.Many2one('sf.production.line', string=u'生产线', required=True) + + # 接收传递过来的计划ID + plan_ids = fields.Many2many('sf.production.plan', string=u'计划ID') + + # 确认排程按钮 + def action_plan_all(self): + # 使用传递过来的计划ID + temp_plan_ids = self.plan_ids + # 在这里添加您的逻辑来处理这些ID + for plan in temp_plan_ids: + # 处理每个计划 + # 比如更新计划状态、分配资源等 + # 示例:plan.state = 'scheduled' + print('处理计划:', plan.id) + # 拿到计划对象 + plan_obj = self.env['sf.production.plan'].browse(plan.id) + plan_obj.production_line_id = self.production_line_id.id + plan_obj.do_production_schedule() + plan_obj.state = 'done' + print('处理计划:', plan.id, '完成') + + # # 获取当前生产线 + # production_line_id = self.production_line_id + # # 获取当前生产线的所有生产订单 + # production_order_ids = self.env['mrp.production'].search([('production_line_id', '=', production_line_id.id)]) + # # 获取当前生产线的所有生产订单的id + # production_order_id_list = [] + # for production_order_id in production_order_ids: + # production_order_id_list.append(production_order_id.id) + # # 获取当前生产线的所有生产订单的排程状态 + # production_order_plan_state_list = [] + # for production_order_id in production_order_ids: + # production_order_plan_state_list.append(production_order_id.plan_state) + # # 如果当前生产线的所有生产订单的排程状态都是已排程,则报错 + # if all(production_order_plan_state == '已排程' for production_order_plan_state in production_order_plan_state_list): + # raise UserError('当前生产线的所有生产订单都已排程,请勿重复排程!') + # # 如果当前生产线的所有生产订单的排程状态都是未排程,则报错 + # if all(production_order_plan_state == '未排程' for production_order_plan_state in production_order_plan_state_list): + # raise UserError('当前生产线的所有生产订单都未排程,请先排程!') + # # 如果当前生产线的所有生产订单的排程状态都是已完成,则报错 + # if all(production_order_plan_state == '已完成' for production_order_plan_state in production_order_plan_state_list): + # raise UserError('当前生产线的所有生产订单都已完成,请勿重复排程!') + # # 如果当前生产线的所有生产订单的排程状态都是已取消,则报错 + # if all(production_order_plan_state == '已取消' for production_order_plan_state in production_order_plan_state_list): + # raise UserError('当前生产线的所有生产订单都已取消,请勿重复排程!') + # # 如果当前生产线的所有生产订单的排程状态都是已暂停,则报错 + # if all(production_order_plan_state == '已暂停' for production_order_plan_state in production diff --git a/sf_plan/wizard/action_plan_some.xml b/sf_plan/wizard/action_plan_some.xml new file mode 100644 index 00000000..2c52658a --- /dev/null +++ b/sf_plan/wizard/action_plan_some.xml @@ -0,0 +1,31 @@ + + + + 选择生产线 + sf.action.plan.all.wizard + +
+ + + +
+
+
+
+
+ + 请选择要排程的生产线 + ir.actions.act_window + + sf.action.plan.all.wizard + form + + new + {'default_plan_ids': active_ids} + + + +
\ No newline at end of file From ce53afe1b09f96a4f477d7de3ff18439805bf27d Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Mon, 8 Jan 2024 15:29:48 +0800 Subject: [PATCH 031/151] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BB=84=E8=AE=BF=E9=97=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/security/ir.model.access.csv | 17 +++++++++++------ sf_maintenance/views/maintenance_views.xml | 2 +- sf_manufacturing/security/ir.model.access.csv | 7 ++++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index 4f693af2..d772d54c 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -1,10 +1,15 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_equipment_maintenance_standards,equipment_maintenance_standards,model_equipment_maintenance_standards,sf_group_equipment_user,1,1,1,1 -access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_group_equipment_user,1,1,1,1 -access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_user,1,1,1,1 -access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_user,1,1,1,1 -access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,sf_group_equipment_user,1,1,1,1 -access_sf_robot_axis_num,sf_robot_axis_num,model_sf_robot_axis_num,sf_group_equipment_user,1,1,1,1 +access_equipment_maintenance_standards,equipment_maintenance_standards,model_equipment_maintenance_standards,sf_group_equipment_user,1,1,1,0 +access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_group_equipment_user,1,0,0,0 +access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,sf_group_equipment_manager,1,1,1,0 +access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_user,1,0,0,0 +access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,sf_group_equipment_manager,1,1,1,0 +access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_user,1,0,0,0 +access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_group_equipment_manager,1,1,1,0 +access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,sf_group_equipment_user,1,0,0,0 +access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,sf_group_equipment_manager,1,1,1,0 +access_sf_robot_axis_num,sf_robot_axis_num,model_sf_robot_axis_num,sf_group_equipment_user,1,0,0,0 +access_sf_robot_axis_num,sf_robot_axis_num,model_sf_robot_axis_num,sf_group_equipment_manager,1,1,1,0 access_maintenance_request,maintenance.request,maintenance.model_maintenance_request,sf_base.group_plan_dispatch,1,0,0,0 diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 5266bced..0dc18355 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -48,7 +48,7 @@ - + diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv index 313c4567..d71f7f4b 100644 --- a/sf_manufacturing/security/ir.model.access.csv +++ b/sf_manufacturing/security/ir.model.access.csv @@ -6,10 +6,10 @@ access_sf_model_type_manager,sf_model_type,model_sf_model_type,sf_base.group_sf_ access_sf_product_model_type_routing_sort,sf_product_model_type_routing_sort,model_sf_product_model_type_routing_sort,sf_base.group_sf_mrp_user,1,0,0,0 access_sf_product_model_type_routing_sort_manager,sf_product_model_type_routing_sort,model_sf_product_model_type_routing_sort,sf_base.group_sf_mrp_manager,1,1,1,0 access_sf_embryo_model_type_routing_sort,sf_embryo_model_type_routing_sort,model_sf_embryo_model_type_routing_sort,sf_base.group_sf_mrp_user,1,0,0,0 -access_sf_embryo_model_type_routing_sort_manager,sf_embryo_model_type_routing_sort,model_sf_embryo_model_type_routing_sort,sf_base.group_sf_mrp_manager,1,1,1,1 +access_sf_embryo_model_type_routing_sort_manager,sf_embryo_model_type_routing_sort,model_sf_embryo_model_type_routing_sort,sf_base.group_sf_mrp_manager,1,1,1,0 access_sf_surface_technics_model_type_routing_sort,sf_surface_technics_model_type_routing_sort,model_sf_surface_technics_model_type_routing_sort,sf_base.group_sf_mrp_user,1,0,0,0 access_sf_surface_technics_model_type_routing_sort_manager,sf_surface_technics_model_type_routing_sort,model_sf_surface_technics_model_type_routing_sort,sf_base.group_sf_mrp_manager,1,1,1,0 -access_sf_production_line,sf.production.line,model_sf_production_line,sf_base.group_sf_mrp_user,1,0,0,0 +access_sf_production_line,sf.production.line,model_sf_production_line,sf_base.group_sf_mrp_user,1,1,1,0 access_sf_production_line_manager,sf.production.line,model_sf_production_line,sf_base.group_sf_mrp_manager,1,1,1,0 access_maintenance_equipment_tool,maintenance_equipment_tool,model_maintenance_equipment_tool,sf_base.group_sf_mrp_user,1,0,0,0 access_maintenance_equipment_tool_manager,maintenance_equipment_tool,model_maintenance_equipment_tool,sf_base.group_sf_mrp_manager,1,1,1,0 @@ -42,7 +42,7 @@ access_mrp_production_stock_worker,mrp.production stock_worker,mrp.model_mrp_pro access_product_product_user,product.product user,product.model_product_product,sf_base.group_sf_mrp_user,1,0,0,0 access_product_template_user,product.template user,product.model_product_template,sf_base.group_sf_mrp_user,1,0,0,0 access_uom_uom_user,uom.uom user,uom.model_uom_uom,sf_base.group_sf_mrp_user,1,0,0,0 -access_product_supplierinfo_user,product.supplierinfo user,product.model_product_supplierinfo,sf_base.group_sf_mrp_user,1,1,1,0 +access_product_supplierinfo_user,product.supplierinfo user,product.model_product_supplierinfo,sf_base.group_sf_mrp_user,1,0,0,0 access_res_partner,res.partner,base.model_res_partner,sf_base.group_sf_mrp_user,1,0,0,0 access_mrp_workorder_mrp_user,mrp.workorder.user,mrp.model_mrp_workorder,sf_base.group_sf_mrp_user,1,1,1,0 access_mrp_workorder_mrp_manager,mrp.workorder,mrp.model_mrp_workorder,sf_base.group_sf_mrp_user,1,1,1,0 @@ -90,6 +90,7 @@ access_mrp_workcenter_capacity_manager,mrp.workcenter.capacity.manager,mrp.model access_mrp_production,mrp_production,model_mrp_production,sf_base.group_plan_dispatch,1,1,1,0 access_mrp_workorder,mrp_workorder,model_mrp_workorder,sf_base.group_plan_dispatch,1,1,1,0 access_sf_production_line,sf.production.line,model_sf_production_line,sf_base.group_plan_dispatch,1,1,1,0 +access_sf_production_line,sf.production.line,model_sf_production_line,sf_maintenance.sf_group_equipment_user,1,1,1,0 access_mrp_workcenter,mrp_workcenter,model_mrp_workcenter,sf_base.group_plan_dispatch,1,1,1,0 access_mrp_bom,mrp.bom,mrp.model_mrp_bom,sf_base.group_plan_dispatch,1,1,1,0 access_mrp_bom_line,mrp.bom.line,mrp.model_mrp_bom_line,sf_base.group_plan_dispatch,1,0,0,0 From f8c6c766cb704d240a781d0e67693b7979e7c577 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 8 Jan 2024 15:44:16 +0800 Subject: [PATCH 032/151] =?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)]}"/> + + - -