完成了机台换刀申请的换刀申请按键弹窗数据同步回机台换刀申请界面以及转移按键界面、CAM工单程序用刀计划的申请装刀界面

This commit is contained in:
yuxianghui
2023-06-25 17:36:33 +08:00
parent f135f0a5e7
commit c37166397e
5 changed files with 369 additions and 93 deletions

View File

@@ -104,7 +104,11 @@ class MachineTableToolChangingApply(models.Model):
_name = 'sf.machine.table.tool.changing.apply'
_description = '机床换刀申请'
apply_to_tool_change_ids = fields.One2many('sf.tool.change.requirement.information', 'tool_change_to_apply_id', string='换刀需求信息')
apply_to_tool_change_ids = fields.One2many(
'sf.tool.change.requirement.information',
'tool_change_to_apply_id',
string='换刀需求信息',
attrs="{'invisible': 1}")
CNC_machine_table = fields.Char(string='CNC机床')
# todo 机床类型和刀位号 为 Many2one
@@ -135,32 +139,61 @@ class MachineTableToolChangingApply(models.Model):
reason_for_applying = fields.Char(string='申请原因')
remark = fields.Char(string='备注说明')
def sync_tool_entity_from_tool_changing_apply_table(self):
"""
‘功能刀具预警’数据同步到‘机床换刀申请’
"""
# 获取源表中的所有记录
source_records = self.env['sf.functional.cutting.tool.entity'].search([])
# def sync_tool_entity_from_tool_changing_apply_table(self):
# """
# ‘功能刀具预警’数据同步到‘机床换刀申请’
# """
# # 获取源表中的所有记录
# source_records = self.env['sf.functional.cutting.tool.entity'].search([])
#
# # 循环遍历每个记录
# for source_record in source_records:
# # 检查目标表中是否存在相同的记录
# destination_record = self.search([('CNC_machine_table', '=', source_record.machine_tool_code)])
# if destination_record:
# # todo 如果目标表中已经存在相同的记录,则更新该记录
# destination_record.name = source_record.name
# else:
# # todo 如果目标表中不存在相同的记录,则创建一个新记录
# destination_record = self.create({
# # 'name': source_record.name,
# })
# 循环遍历每个记录
for source_record in source_records:
# 检查目标表中是否存在相同的记录
destination_record = self.search([('CNC_machine_table', '=', source_record.machine_tool_code)])
if destination_record:
# 如果目标表中已经存在相同的记录,则更新该记录
# todo
destination_record.name = source_record.name
else:
# 如果目标表中不存在相同的记录,则创建一个新记录
destination_record = self.create({
# todo
# 'name': source_record.name,
})
# todo
def transfer(self):
def amendant_record(self, vals):
"""
转移(按键)
确认换刀申请(按键)
将弹窗数据更新到记录
:param vals:
:return:
"""
self.env['sf.machine.table.tool.changing.apply'].search(
[('CNC_machine_table', '=', vals.get('CNC_machine_table'))]).write(vals)
def revocation_1(self):
"""
换刀申请撤回按键
:return:
"""
# 撤回数据更新
self.env['sf.machine.table.tool.changing.apply'].search(
[('CNC_machine_table', '=', self.CNC_machine_table)]).write({
'replacement_tool_code': False,
'replacement_tool_name': False,
'replacement_tool_type': False,
'replacement_tool_coarse_middle_thin': False,
'new_former': False,
'applicant': False,
'used_tool_time': False,
'reason_for_applying': False,
'remark': False
})
# todo 撤回功能刀具组装创建新任务
def revocation_1(self):
"""
转移撤回按键
:return:
"""
@@ -189,9 +222,3 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
applicant = fields.Char(string='申请人')
reason_for_applying = fields.Char(string='申请原因')
remark = fields.Char(string='备注说明')
# todo
def tool_loading_apply(self):
"""
装刀申请(按键)
"""