From d5749251229ff033fd277fe084a7d8a89c94b944 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Tue, 1 Aug 2023 17:41:21 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=80=E5=85=B7=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=9C=BA=E5=BA=8A=E6=8D=A2=E5=88=80=E7=94=B3=E8=AF=B7=E3=80=81?= =?UTF-8?q?CAM=E5=B7=A5=E5=8D=95=E7=A8=8B=E5=BA=8F=E7=94=A8=E5=88=80?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=BB=84=E8=A3=85=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=9C=BA=E5=BA=8A?= =?UTF-8?q?=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E5=92=8C=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?=E7=9A=84=E5=85=B3=E8=81=94=E5=85=B3=E7=B3=BB=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86tree=E8=A7=86=E5=9B=BE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8C=89=E9=94=AE=20=20=202=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=86CAM=E5=B7=A5=E5=8D=95=E7=A8=8B=E5=BA=8F=E7=94=A8?= =?UTF-8?q?=E5=88=80=E8=AE=A1=E5=88=92=E7=9A=84=E6=8C=89=E9=94=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20=203=E3=80=81=E5=AF=B9=E4=B8=89=E4=B8=AA=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E7=9A=84=E5=AD=97=E6=AE=B5=E7=9A=84=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=80=A7=E8=BF=9B=E8=A1=8C=E4=BA=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 273 +++++++++--------- .../security/ir.model.access.csv | 1 - sf_tool_management/views/tool_base_views.xml | 183 +++++++----- sf_tool_management/wizard/wizard.py | 104 ++----- sf_tool_management/wizard/wizard_view.xml | 97 +------ 5 files changed, 288 insertions(+), 370 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 596e54bb..2c7ddf30 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -123,20 +123,20 @@ class FunctionalToolWarning(models.Model): image = fields.Binary('图片', readonly=True) # 功能刀具预警 特有字段 - install_tool_time = fields.Char("装刀时间", readonly=True) - outbound_time = fields.Char('出库时间', readonly=True) - on_board_time = fields.Char('上机时间', readonly=True) - machine_tool_code = fields.Char('机台号', readonly=True) - cutting_tool_code = fields.Char('刀位号', readonly=True) - idle_time = fields.Char('闲置时长', readonly=True) - alarm_value = fields.Char('报警值', readonly=True) - used_value = fields.Char('已使用值', readonly=True) - alarm_type = fields.Char('报警类型', readonly=True) - alarm_time = fields.Char('报警时间', readonly=True) - dispose_user = fields.Char('处理人', readonly=True) - dispose_time = fields.Char('处理时间', readonly=True) - dispose_func = fields.Char('处理方法/措施', readonly=True) - remark = fields.Char('备注', readonly=True) + install_tool_time = fields.Char("装刀时间", readonly=False) + outbound_time = fields.Char('出库时间', readonly=False) + on_board_time = fields.Char('上机时间', readonly=False) + machine_tool_code = fields.Char('机台号', readonly=False) + cutting_tool_code = fields.Char('刀位号', readonly=False) + idle_time = fields.Char('闲置时长', readonly=False) + alarm_value = fields.Char('报警值', readonly=False) + used_value = fields.Char('已使用值', readonly=False) + alarm_type = fields.Char('报警类型', readonly=False) + alarm_time = fields.Char('报警时间', readonly=False) + dispose_user = fields.Char('处理人', readonly=False) + dispose_time = fields.Char('处理时间', readonly=False) + dispose_func = fields.Char('处理方法/措施', readonly=False) + remark = fields.Char('备注', readonly=False) @api.onchange('functional_cutting_tool_id') def onchange_functional_cutting_tool_id(self): @@ -197,16 +197,16 @@ class RealTimeDistributionOfFunctionalTools(models.Model): image = fields.Binary('图片', readonly=True) # 功能刀具实时分布 - tool_stock_num = fields.Char(string='刀具房库存数量', readonly=True) - side_shelf_num = fields.Char(string='线边货架货架数量', readonly=True) - on_tool_stock_num = fields.Char(string='机内刀库库存数量', readonly=True) - tool_stock_total = fields.Char(string='合计', readonly=True) - return_reuse_num_re = fields.Char(string='归还再用数量(精)', readonly=True) - return_reuse_num_co = fields.Char(string='归还再用数量(粗)', readonly=True) - return_processing_num = fields.Char(string='归还需磨削数量', readonly=True) - return_total = fields.Char(string='合计', readonly=True) - total = fields.Char(string='总计', readonly=True) - remark = fields.Char(string='备注/说明', readonly=True) + tool_stock_num = fields.Char(string='刀具房库存数量', readonly=False) + side_shelf_num = fields.Char(string='线边货架货架数量', readonly=False) + on_tool_stock_num = fields.Char(string='机内刀库库存数量', readonly=False) + tool_stock_total = fields.Char(string='合计', readonly=False) + return_reuse_num_re = fields.Char(string='归还再用数量(精)', readonly=False) + return_reuse_num_co = fields.Char(string='归还再用数量(粗)', readonly=False) + return_processing_num = fields.Char(string='归还需磨削数量', readonly=False) + return_total = fields.Char(string='合计', readonly=False) + total = fields.Char(string='总计', readonly=False) + remark = fields.Char(string='备注/说明', readonly=False) class InboundAndOutboundRecordsOfFunctionalTools(models.Model): @@ -263,25 +263,25 @@ class InboundAndOutboundRecordsOfFunctionalTools(models.Model): image = fields.Binary('图片', readonly=True) # 功能刀具出入库记录 特有字段 - thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True) - max_life_span = fields.Char(string='最大寿命值', readonly=True) - alarm_value = fields.Char(string='报警值', readonly=True) - used_value = fields.Char(string='已使用值', readonly=True) - current_state = fields.Char(string='当前状态', readonly=True) - current_store_area = fields.Char(string='当前库区', readonly=True) - current_store_place = fields.Char(string='当前库位', readonly=True) - number = fields.Integer(string='数量', readonly=True) - reason_application = fields.Char(string='申请原因', readonly=True) - applicant = fields.Char(string='申请人', readonly=True) - return_staff = fields.Char(string='归还人', readonly=True) - return_time = fields.Date(string='归还入库时间', readonly=True) - tool_state = fields.Char(string="刀具状态", readonly=True) - tool_install_staff = fields.Char(string='装刀人', readonly=True) - tool_install_time = fields.Datetime(string='装刀时间', readonly=True) - receive_equipment = fields.Char(string='领用机台', readonly=True) - receive_staff = fields.Char(string='领用人', readonly=True) - receive_time = fields.Char(string='领用出库时间', readonly=True) - remark = fields.Text(string='备注/说明', readonly=True) + thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False) + max_life_span = fields.Char(string='最大寿命值', readonly=False) + alarm_value = fields.Char(string='报警值', readonly=False) + used_value = fields.Char(string='已使用值', readonly=False) + current_state = fields.Char(string='当前状态', readonly=False) + current_store_area = fields.Char(string='当前库区', readonly=False) + current_store_place = fields.Char(string='当前库位', readonly=False) + number = fields.Integer(string='数量', readonly=False) + reason_application = fields.Char(string='申请原因', readonly=False) + applicant = fields.Char(string='申请人', readonly=False) + return_staff = fields.Char(string='归还人', readonly=False) + return_time = fields.Date(string='归还入库时间', readonly=False) + tool_state = fields.Char(string="刀具状态", readonly=False) + tool_install_staff = fields.Char(string='装刀人', readonly=False) + tool_install_time = fields.Datetime(string='装刀时间', readonly=False) + receive_equipment = fields.Char(string='领用机台', readonly=False) + receive_staff = fields.Char(string='领用人', readonly=False) + receive_time = fields.Char(string='领用出库时间', readonly=False) + remark = fields.Text(string='备注/说明', readonly=False) class MachineTableToolChangingApply(models.Model): @@ -294,37 +294,43 @@ class MachineTableToolChangingApply(models.Model): # string='换刀需求信息', # attrs="{'invisible': 1}") - name = fields.Char(string='CNC机床', readonly="True") - # todo 机床类型和刀位号 为 Many2one - machine_table_type = fields.Char(string='机床类型', readonly="True") + name = fields.Many2one('sf.machine_tool', string='CNC机床', readonly=False) + machine_table_type_id = fields.Many2one('sf.machine_tool.category', string='机床类型', readonly=False) machine_tool_code = fields.Char(string='机台号', attrs="{'invisible': 1}") - cutter_spacing_code = fields.Char(string='刀位号', readonly="True") - functional_tool_code = fields.Char(string='功能刀具编码', readonly="True") - functional_tool_name = fields.Char(string='功能刀具名称', readonly="True") - # todo 功能刀具类型为 Many2one - functional_tool_type = fields.Char(string='功能刀具类型', readonly="True") - diameter = fields.Char(string='直径', readonly="True") - coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly="True") - hilt_name = fields.Char(string='刀柄名称', readonly="True") - hilt_code = fields.Char(string='刀柄编号', readonly="True") - max_lifetime_value = fields.Char(string='最大寿命值', readonly="True") - alarm_value = fields.Char(string='报警值', readonly="True") - used_value = fields.Char(string='已使用值', readonly="True") - functional_tool_status = fields.Selection([('正常', '正常'), ('异常', '异常')], string='功能刀具状态', default='正常', readonly="True") + cutter_spacing_code = fields.Char(string='刀位号', readonly=False) + functional_tool_code = fields.Char(string='功能刀具编码', readonly=True, compute='_compute_functional_tool_name_id') + functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False) + functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',string='功能刀具类型', readonly=True, compute='_compute_functional_tool_name_id') + diameter = fields.Char(string='直径', readonly=False) + coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False) + hilt_name = fields.Char(string='刀柄名称', readonly=False) + hilt_code = fields.Char(string='刀柄编号', readonly=False) + max_lifetime_value = fields.Char(string='最大寿命值', readonly=False) + alarm_value = fields.Char(string='报警值', readonly=False) + used_value = fields.Char(string='已使用值', readonly=False) + functional_tool_status = fields.Selection([('正常', '正常'), ('异常', '异常')], string='功能刀具状态', default='正常', readonly=False) - replacement_tool_code = fields.Char(string='待换刀具编码', readonly="True") - replacement_tool_name = fields.Char(string='待换刀具名称', readonly="True") - replacement_tool_type = fields.Char(string='待换刀具类型', readonly="True") + replacement_tool_code = fields.Char(string='待换刀具编码', readonly=True) + replacement_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='待换刀具名称', readonly=True) + replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换刀具类型', readonly=True) replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], - string='粗/中/精', readonly="True") - new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly="True") - applicant = fields.Char(string='申请人', readonly="True") - used_tool_time = fields.Datetime(string='用刀时间', readonly="True") - reason_for_applying = fields.Char(string='申请原因', readonly="True") - remark = fields.Char(string='备注说明', readonly="True") + string='粗/中/精', readonly=True) + new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True) + applicant = fields.Char(string='申请人', readonly=True) + used_tool_time = fields.Datetime(string='用刀时间', readonly=True) + reason_for_applying = fields.Char(string='申请原因', readonly=True) + remark = fields.Char(string='备注说明', readonly=False) status = fields.Selection([('0', '未操作'), ('1', '已换刀申请'), ('2', '已转移')], string='操作状态', default='0') + @api.depends('functional_tool_name_id') + def _compute_functional_tool_name_id(self): + for record in self: + if record: + record.functional_tool_code = record.functional_tool_name_id.code + record.functional_tool_type_id = record.functional_tool_name_id.mrs_cutting_tool_type_id.id + + @api.onchange('functional_tool_status') def automation_apply_for_tool_change(self): """ @@ -335,10 +341,10 @@ class MachineTableToolChangingApply(models.Model): # todo 自动换刀申请条件需补充完善 if(self.functional_tool_status == '异常'): self.env['sf.machine.table.tool.changing.apply'].search([ - ('name', '=', self.name)]).write({ + ('name', '=', self.name.id)]).write({ 'replacement_tool_code': self.functional_tool_code, - 'replacement_tool_name': self.functional_tool_name, - 'replacement_tool_type': self.functional_tool_type, + 'replacement_tool_name_id': self.functional_tool_name_id.id, + 'replacement_tool_type_id': self.functional_tool_type_id.id, 'replacement_tool_coarse_middle_thin': self.coarse_middle_thin, 'new_former': '0', 'applicant': '自动申请', @@ -351,8 +357,8 @@ class MachineTableToolChangingApply(models.Model): # 新建组装任务 self.env['sf.functional.tool.assembly'].create({ 'functional_tool_code': self.functional_tool_code, - 'name': self.functional_tool_name, - 'functional_tool_type': self.functional_tool_type, + 'name': self.functional_tool_name_id, + 'functional_tool_type_id': self.functional_tool_type_id.id, 'functional_tool_diameter': self.diameter, 'loading_task_source': '1', 'applicant': '自动申请', @@ -384,11 +390,16 @@ class MachineTableToolChangingApply(models.Model): 换刀申请撤回按键 :return: """ + # 撤回功能刀具组装创建的任务 + self.env['sf.functional.tool.assembly'].search( + [('functional_tool_code', '=', self.replacement_tool_code), + ('loading_task_source', '=', '机台换刀')]).unlink() + # 撤回数据更新 - self.env['sf.machine.table.tool.changing.apply'].search([('name', '=', self.name)]).write({ + self.env['sf.machine.table.tool.changing.apply'].search([('name', '=', self.name.id)]).write({ 'replacement_tool_code': None, - 'replacement_tool_name': None, - 'replacement_tool_type': None, + 'replacement_tool_name_id': None, + 'replacement_tool_type_id': None, 'replacement_tool_coarse_middle_thin': None, 'new_former': None, 'applicant': None, @@ -398,10 +409,6 @@ class MachineTableToolChangingApply(models.Model): 'status': '0' }) - # 撤回功能刀具组装创建新任务 - self.env['sf.functional.tool.assembly'].search( - [('functional_tool_code', '=', self.functional_tool_code)]).unlink() - def revocation_2(self): """ @@ -409,7 +416,7 @@ class MachineTableToolChangingApply(models.Model): :return: """ self.env['sf.machine.table.tool.changing.apply'].search( - [('name', '=', self.name)]).write({ + [('name', '=', self.name.id)]).write({ 'status': '0' }) @@ -418,38 +425,38 @@ class CAMWorkOrderProgramKnifePlan(models.Model): _name = 'sf.cam.work.order.program.knife.plan' _description = 'CAM工单程序用刀计划' - name = fields.Char(string='工单任务编号', readonly=True) - cam_procedure_code = fields.Char(string='CAM程序编号', readonly=True) - cam_cutter_spacing_code = fields.Char(string='CAM刀位号', readonly=True) - functional_tool_code = fields.Char(string='功能刀具编码', readonly=True) - functional_tool_name = fields.Char(string='功能刀具名称', readonly=True) - functional_tool_type = fields.Char(string='功能刀具类型', readonly=True) - machine_table_name = fields.Char(string='机床名称', readonly=True) - machine_tool_cutter_spacing_code = fields.Char(string='机床刀位号', readonly=True) - diameter = fields.Char(string='直径(程式)', readonly=True) - tool_loading_length = fields.Char(string='装刀长', readonly=True) - clearance_length = fields.Char(string='避空长', readonly=True) - tool_included_angle = fields.Char(string='刀尖角(R角)', readonly=True) - L_D = fields.Char(string='L/D', readonly=True) - coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True) - required_cutting_time = fields.Char(string='需要切割时间', readonly=True) - whether_standard_tool = fields.Boolean(string='是否标准刀', readonly=True) - need_knife_time = fields.Datetime(string='需要用刀时间', readonly=True) + 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) + functional_tool_code = fields.Char(string='功能刀具编码', readonly=False) + functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False) + functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False) + machine_table_name_id = fields.Many2one('sf.machine_tool', string='机床名称', readonly=False) + machine_tool_cutter_spacing_code = fields.Char(string='机床刀位号', readonly=False) + diameter = fields.Char(string='直径(程式)', readonly=False) + tool_loading_length = fields.Char(string='装刀长', readonly=False) + clearance_length = fields.Char(string='避空长', 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) + required_cutting_time = fields.Char(string='需要切割时间', readonly=False) + whether_standard_tool = fields.Boolean(string='是否标准刀', readonly=False) + need_knife_time = fields.Datetime(string='需要用刀时间', readonly=False) plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')], - string='计划执行状态', default='0', readonly=True) - applicant = fields.Char(string='申请人', readonly=True) - reason_for_applying = fields.Char(string='申请原因', readonly=True) - remark = fields.Char(string='备注说明', readonly=True) + string='计划执行状态', default='0', readonly=False) + applicant = fields.Char(string='申请人', readonly=False) + reason_for_applying = fields.Char(string='申请原因', readonly=False) + remark = fields.Char(string='备注说明', readonly=False) - def automation_apply_for_tooling(self): + def apply_for_tooling(self): """ - 自动申请装刀 + 申请装刀 :return: """ self.env['sf.functional.tool.assembly'].create({ 'functional_tool_code': self.functional_tool_code, - 'name': self.functional_tool_name, - 'functional_tool_type': self.functional_tool_type, + 'name': self.functional_tool_name_id.id, + 'functional_tool_type_id': self.functional_tool_type_id.id, 'functional_tool_diameter': self.diameter, 'functional_tool_length': self.tool_loading_length, 'loading_task_source': '0', @@ -458,7 +465,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model): 'applicant': self.applicant, 'reason_for_applying': self.reason_for_applying, 'use_tool_time': self.need_knife_time, - 'machine_tool_name': self.machine_table_name, + 'machine_tool_name_id': self.machine_table_name_id.id, 'machine_tool_code': self.cam_procedure_code, 'cutter_spacing_code': self.cam_cutter_spacing_code }) @@ -467,13 +474,15 @@ class CAMWorkOrderProgramKnifePlan(models.Model): self.env['sf.cam.work.order.program.knife.plan'].search( [('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '1'}) + def revocation(self): """ 撤回装刀申请 :return: """ self.env['sf.functional.tool.assembly'].search( - [('functional_tool_code', '=', self.functional_tool_code)]).unlink() + [('functional_tool_code', '=', self.functional_tool_code), + ('loading_task_source', '=', 'CAM装刀')]).unlink() # 将计划执行状态改为待执行 self.env['sf.cam.work.order.program.knife.plan'].search( @@ -489,25 +498,25 @@ class FunctionalToolAssembly(models.Model): _order = 'use_tool_time asc' functional_tool_code = fields.Char(string='功能刀具编码', readonly=True) - name = fields.Char(string='功能刀具名称', readonly=True) - functional_tool_type = fields.Char(string='功能刀具类型', readonly=True) + name = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=True) + functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True) functional_tool_diameter = fields.Char(string='功能刀具直径', readonly=True) functional_tool_length = fields.Char(string='功能刀具伸出长', readonly=True) - functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=True) + functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False) - tool_name = fields.Char(string='刀具名称', readonly=True) - tool_brand = fields.Char(string='品牌', readonly=True) - tool_type = fields.Char(string='型号', readonly=True) - knife_handle_name = fields.Char(string='刀柄名称', readonly=True) - knife_handle_brand = fields.Char(string='品牌', readonly=True) - knife_handle_type = fields.Char(string='型号', readonly=True) - coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True) - tool_loading_length = fields.Char(string='装刀长', readonly=True) - new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True) - reference_length = fields.Char(string='参考伸出长', readonly=True) - cut_time = fields.Char(string='已切削时间', readonly=True) - cut_length = fields.Char(string='已切削长度', readonly=True) - cut_number = fields.Char(string='已切削次数', readonly=True) + tool_name = fields.Char(string='刀具名称', readonly=False) + tool_brand = fields.Char(string='品牌', readonly=False) + tool_type = fields.Char(string='型号', readonly=False) + knife_handle_name = fields.Char(string='刀柄名称', readonly=False) + knife_handle_brand = fields.Char(string='品牌', readonly=False) + knife_handle_type = fields.Char(string='型号', readonly=False) + coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False) + tool_loading_length = fields.Char(string='装刀长', readonly=False) + new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=False) + reference_length = fields.Char(string='参考伸出长', readonly=False) + cut_time = fields.Char(string='已切削时间', readonly=False) + cut_length = fields.Char(string='已切削长度', readonly=False) + cut_number = fields.Char(string='已切削次数', readonly=False) loading_task_source = fields.Selection([('0', 'CAM装刀'), ('1', '机台换刀')], string='装刀任务来源', readonly=True) applicant = fields.Char(string='申请人', readonly=True) @@ -515,8 +524,8 @@ class FunctionalToolAssembly(models.Model): apply_time = fields.Datetime(string='申请时间', default=fields.Datetime.now(), readonly=True) assemble_status = fields.Selection([('0', '待组装'), ('1', '已组装'), ('2', '已出库')],string='组装状态', default='0', readonly=True) use_tool_time = fields.Datetime(string='用刀时间', readonly=True) - production_line_name = fields.Char(string='产线名称', readonly=True) - machine_tool_name = fields.Char(string='机床名称', readonly=True) + production_line_name = fields.Char(string='产线名称', readonly=False) + machine_tool_name_id = fields.Many2one('sf.machine_tool', string='机床名称', readonly=True) machine_tool_code = fields.Char(string='机台号', readonly=True) cutter_spacing_code = fields.Char(string='刀位号', readonly=True) @@ -526,7 +535,7 @@ class FunctionalToolAssembly(models.Model): receive_time = fields.Datetime(string='领用出库时间', readonly=True) remark = fields.Char(string='备注说明', readonly=True) - check_box_1 = fields.Boolean(string='复选框', default=False, readonly=True) + check_box_1 = fields.Boolean(string='复选框', default=False, readonly=False) @api.onchange('assemble_status') def check_box(self): @@ -540,7 +549,7 @@ class FunctionalToolAssembly(models.Model): :return: """ self.env['sf.functional.tool.assembly'].search([ - ('machine_tool_name', '=', self.machine_tool_name), + ('machine_tool_name_id', '=', self.machine_tool_name_id.id), ('cutter_spacing_code', '=', self.cutter_spacing_code) ]).write({ 'tool_name': None, @@ -575,8 +584,8 @@ class FunctionalToolAssembly(models.Model): for val in vals: self.env['sf.delivery.of.cargo.from.storage'].create({ 'functional_tool_code': val.functional_tool_code, - 'name': val.name, - 'functional_tool_type': val.functional_tool_type, + 'name': val.name.id, + 'functional_tool_type_id': val.functional_tool_type_id.id, 'production_line_name': val.production_line_name, 'machine_tool_code': val.machine_tool_code, 'receive_person': val.receive_person, @@ -585,8 +594,8 @@ class FunctionalToolAssembly(models.Model): else: self.env['sf.delivery.of.cargo.from.storage'].create({ 'functional_tool_code': self.functional_tool_code, - 'name': self.name, - 'functional_tool_type': self.functional_tool_type, + 'name': self.name.id, + 'functional_tool_type_id': self.functional_tool_type_id.id, 'production_line_name': self.production_line_name, 'machine_tool_code': self.machine_tool_code, 'receive_person': self.receive_person, diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv index 65b027b6..1cb5d1a0 100644 --- a/sf_tool_management/security/ir.model.access.csv +++ b/sf_tool_management/security/ir.model.access.csv @@ -10,7 +10,6 @@ access_sf_machine_table_tool_changing_apply,sf.machine.table.tool.changing.apply access_sf_tool_change_requirement_information,sf.tool.change.requirement.information,model_sf_tool_change_requirement_information,base.group_user,1,1,1,1 access_sf_tool_transfer_request_information,sf.tool.transfer.request.information,model_sf_tool_transfer_request_information,base.group_user,1,1,1,1 -access_sf_apply_for_tooling,sf.apply.for.tooling,model_sf_apply_for_tooling,base.group_user,1,1,1,1 access_sf_functional_tool_assembly,sf.functional.tool.assembly,model_sf_functional_tool_assembly,base.group_user,1,1,1,1 access_sf_functional_tool_assembly_order,sf.functional.tool.assembly.order,model_sf_functional_tool_assembly_order,base.group_user,1,1,1,1 diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index fddba05e..becab19c 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -536,16 +536,44 @@ - + - - + + - - + - - + + + + +