From f8426ae4c3a896951617bbf370afca20bc702ed6 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Fri, 8 Dec 2023 17:29:32 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E9=87=8D=E6=9E=84CAM=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E7=A8=8B=E5=BA=8F=E7=94=A8=E5=88=80=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=EF=BC=9B2=E3=80=81=E6=9C=BA=E5=BA=8A?= =?UTF-8?q?=E6=8D=A2=E5=88=80=E7=94=B3=E8=AF=B7=E6=A8=A1=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=8D=A2=E5=88=80=E3=80=81=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E6=8C=89=E9=94=AE=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=85=B3=E9=97=AD=E6=8D=A2=E5=88=80=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=BC=B9=E7=AA=97=E5=92=8C=E5=8A=9F=E8=83=BD=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E8=A3=85=E5=BC=B9=E7=AA=97=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=B0=E5=BD=95=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/__init__.py | 17 +++ sf_tool_management/data/tool_data.xml | 8 ++ sf_tool_management/models/__init__.py | 1 + sf_tool_management/models/base.py | 61 +++++---- sf_tool_management/views/tool_base_views.xml | 124 ++++++++++--------- sf_tool_management/wizard/wizard_view.xml | 6 +- 6 files changed, 130 insertions(+), 87 deletions(-) create mode 100644 sf_tool_management/data/tool_data.xml diff --git a/sf_tool_management/__init__.py b/sf_tool_management/__init__.py index c9ba0265..bb4c0be1 100644 --- a/sf_tool_management/__init__.py +++ b/sf_tool_management/__init__.py @@ -1,3 +1,20 @@ # -*-coding:utf-8-*- from . import models from . import wizard + +# from odoo import api, SUPERUSER_ID +# import logging +# _logger = logging.getLogger(__name__) +# +# +# def _sf_tool_management_post_install(cr, registry): +# # 这里执行你想要在安装模块时执行的操作,包括调用和执行模型的方法 +# env = api.Environment(cr, SUPERUSER_ID, {}) +# +# # 获取需要执行方法的模型 +# model_obj = env['sf.machine.table.tool.changing.apply'] +# logging.info('post_install方法执行了') +# print('post_install方法执行了') +# +# # 调用模型方法 +# model_obj.create_tool_change_application() diff --git a/sf_tool_management/data/tool_data.xml b/sf_tool_management/data/tool_data.xml new file mode 100644 index 00000000..714d03ee --- /dev/null +++ b/sf_tool_management/data/tool_data.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/sf_tool_management/models/__init__.py b/sf_tool_management/models/__init__.py index 88279b79..c942dcac 100644 --- a/sf_tool_management/models/__init__.py +++ b/sf_tool_management/models/__init__.py @@ -1,3 +1,4 @@ from . import base from . import tool_material_search from . import maintenance_equipment + diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index cb057cb5..71cb41f5 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -476,6 +476,9 @@ class MachineTableToolChangingApply(models.Model): self.env['sf.machine.table.tool.changing.apply'].search( [('name', '=', self.name.id)]).write({'status': '0'}) + def create_tool_change_application(self): + print("调用了create_tool_change_application()") + class CAMWorkOrderProgramKnifePlan(models.Model): _name = 'sf.cam.work.order.program.knife.plan' @@ -484,39 +487,49 @@ class CAMWorkOrderProgramKnifePlan(models.Model): name = fields.Char(string='工单任务编号', readonly=False) cam_procedure_code = fields.Char(string='CAM程序编号', readonly=False) cam_cutter_spacing_code = fields.Char(string='CAM刀位号', readonly=False) + tool_position_interface_type = fields.Selection( + [('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'), + ('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'), + ('直装固定式', '直装固定式')], string='刀位接口型号') + production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=False, + group_expand='_read_group_names') + machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称', readonly=False, + domain="[('production_line_id', '=', production_line_id)]") + machine_table_name = fields.Char(string='机台号', readonly=True, related='machine_table_name_id.name') + cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', required=True, + domain="[('equipment_id', '=', machine_table_name_id)]") + whether_standard_knife = fields.Boolean(string='是否标准刀', default=True) + need_knife_time = fields.Datetime(string='用刀时间', readonly=False) + applicant = fields.Char(string='申请人', readonly=True) + applicant_time = fields.Datetime(string='申请时间', readonly=True) + reason_for_applying = fields.Char(string='申请原因', readonly=False) + barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', domain=[('product_id.name', '=', '功能刀具')]) - functional_tool_name_id = fields.Many2one('product.product', string='功能刀具名称', - domain=[('name', '=', '功能刀具')]) + functional_tool_name = fields.Char(string='功能刀具名称', required=True) functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False) - machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称', readonly=False, - group_expand='_read_group_machine_table_name_ids') + diameter = fields.Integer(string='刀具直径(mm)', readonly=False) + tool_included_angle = fields.Float(string='刀尖R角(mm)', readonly=False) + tool_loading_length = fields.Float(string='装刀长(mm)', readonly=False) + extension_length = fields.Float(string='伸出长(mm)') + effective_length = fields.Float(string='有效长(mm)') + new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=False, default='0') + coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], default='3', + string='粗/中/精', readonly=False) + L_D = fields.Float(string='L/D值', readonly=False) + clearance_length = fields.Float(string='避空长(mm)', readonly=False) + required_cutting_time = fields.Integer(string='需切削时长', readonly=False) - @api.model - def _read_group_machine_table_name_ids(self, categories, domain, order): - machine_table_name_ids = categories._search([], order=order, access_rights_uid=SUPERUSER_ID) - return categories.browse(machine_table_name_ids) - - machine_tool_cutter_spacing_code = fields.Char(string='机床刀位号', readonly=False) - diameter = fields.Char(string='直径(程式)(mm)', readonly=False) - tool_loading_length = fields.Char(string='装刀长(mm)', readonly=False) - clearance_length = fields.Char(string='避空长(mm)', readonly=False) - tool_included_angle = fields.Char(string='刀尖角(R角)', readonly=False) - L_D = fields.Char(string='L/D', readonly=False) - coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False, - default='2') - required_cutting_time = fields.Char(string='需切削时长', readonly=False) - whether_standard_tool = fields.Selection([('1', '是'), ('0', '否')], string='是否标准刀', readonly=False, - default='1') - need_knife_time = fields.Datetime(string='需要用刀时间', readonly=False) plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')], string='计划执行状态', default='0', readonly=False) - applicant = fields.Char(string='申请人', readonly=True) - reason_for_applying = fields.Char(string='申请原因', readonly=False) - remark = fields.Char(string='备注说明', readonly=False) sf_functional_tool_assembly_id = fields.Many2one('sf.functional.tool.assembly', '功能刀具组装', readonly=True) + @api.model + def _read_group_names(self, categories, domain, order): + names = categories._search([], order=order, access_rights_uid=SUPERUSER_ID) + return categories.browse(names) + def apply_for_tooling(self): """ 申请装刀 diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index eb0cd379..3227b185 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -347,11 +347,13 @@ - - @@ -531,7 +533,7 @@ 'default_replacement_extension_length': extension_length, 'default_replacement_effective_length': effective_length, }" - attrs="{'invisible': [('status', '!=', '0')]}" + attrs="{'invisible': ['|',('status', '!=', '0'), ('functional_tool_name_id', '=', False)]}" class="btn-primary" />