新增了功能刀具组装界面,新增了功能刀具计划的按键功能,以及按键的显示功能
This commit is contained in:
@@ -139,35 +139,23 @@ 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([])
|
||||
#
|
||||
# # 循环遍历每个记录
|
||||
# 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,
|
||||
# })
|
||||
status = fields.Selection([('0', '未操作'), ('1', '已换刀申请'), ('2', '已转移')], string='操作状态', default='0')
|
||||
|
||||
def amendant_record(self, vals):
|
||||
def new_assembly_task(self,vals):
|
||||
"""
|
||||
确认换刀申请(按键)
|
||||
将弹窗数据更新到记录
|
||||
新建组装任务
|
||||
:param vals:
|
||||
:return:
|
||||
"""
|
||||
self.env['sf.machine.table.tool.changing.apply'].search(
|
||||
[('CNC_machine_table', '=', vals.get('CNC_machine_table'))]).write(vals)
|
||||
# todo 设置直径的值
|
||||
# tool_changing_apply = self.env['sf.machine.table.tool.changing.apply'].search(
|
||||
# [('CNC_machine_table', '=', vals.get('CNC_machine_table'))])
|
||||
# for i in tool_changing_apply:
|
||||
# print(i)
|
||||
# vals['functional_tool_diameter'] = tool_changing_apply.diameter
|
||||
|
||||
self.env['sf.functional.tool.assembly'].create(vals)
|
||||
|
||||
|
||||
def revocation_1(self):
|
||||
"""
|
||||
@@ -175,26 +163,33 @@ class MachineTableToolChangingApply(models.Model):
|
||||
: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
|
||||
self.env['sf.machine.table.tool.changing.apply'].search([('CNC_machine_table', '=', self.CNC_machine_table)]).write({
|
||||
'replacement_tool_code': None,
|
||||
'replacement_tool_name': None,
|
||||
'replacement_tool_type': None,
|
||||
'replacement_tool_coarse_middle_thin': None,
|
||||
'new_former': None,
|
||||
'applicant': None,
|
||||
'used_tool_time': None,
|
||||
'reason_for_applying': None,
|
||||
'remark': None,
|
||||
'status': '0'
|
||||
})
|
||||
|
||||
# todo 撤回功能刀具组装创建新任务
|
||||
# 撤回功能刀具组装创建新任务
|
||||
self.env['sf.functional.tool.assembly'].search(
|
||||
[('functional_tool_code', '=', self.functional_tool_code)]).unlink()
|
||||
|
||||
def revocation_1(self):
|
||||
|
||||
def revocation_2(self):
|
||||
"""
|
||||
转移撤回按键
|
||||
:return:
|
||||
"""
|
||||
self.env['sf.machine.table.tool.changing.apply'].search(
|
||||
[('CNC_machine_table', '=', self.CNC_machine_table)]).write({
|
||||
'status': '0'
|
||||
})
|
||||
|
||||
|
||||
class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
@@ -222,3 +217,62 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
applicant = fields.Char(string='申请人')
|
||||
reason_for_applying = fields.Char(string='申请原因')
|
||||
remark = fields.Char(string='备注说明')
|
||||
|
||||
def revocation(self):
|
||||
"""
|
||||
撤回装刀申请
|
||||
:return:
|
||||
"""
|
||||
self.env['sf.functional.tool.assembly'].search(
|
||||
[('functional_tool_code', '=', self.functional_tool_code)]).unlink()
|
||||
|
||||
# 将计划执行状态改为待执行
|
||||
self.env['sf.cam.work.order.program.knife.plan'].search(
|
||||
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '0'})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class FunctionalToolAssembly(models.Model):
|
||||
_name = 'sf.functional.tool.assembly'
|
||||
_description = '功能刀具组装'
|
||||
|
||||
functional_tool_code = fields.Char(string='功能刀具编码')
|
||||
functional_tool_name = fields.Char(string='功能刀具名称')
|
||||
functional_tool_type = fields.Char(string='功能刀具类型')
|
||||
functional_tool_diameter = fields.Char(string='功能刀具直径')
|
||||
functional_tool_length = fields.Char(string='功能刀具伸出长')
|
||||
functional_tool_cutting_type = fields.Char(string='功能刀具切削类型')
|
||||
|
||||
tool_name = fields.Char(string='刀具名称')
|
||||
tool_brand = fields.Char(string='品牌')
|
||||
tool_type = fields.Char(string='型号')
|
||||
knife_handle_name = fields.Char(string='刀柄名称')
|
||||
knife_handle_brand = fields.Char(string='品牌')
|
||||
knife_handle_type = fields.Char(string='型号')
|
||||
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精')
|
||||
tool_loading_length = fields.Char(string='装刀长')
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧')
|
||||
reference_length = fields.Char(string='参考伸出长')
|
||||
cut_time = fields.Char(string='已切削时间')
|
||||
cut_length = fields.Char(string='已切削长度')
|
||||
cut_number = fields.Char(string='已切削次数')
|
||||
|
||||
loading_task_source = fields.Selection([('0', 'CAM装刀'), ('1', '机台换刀')], string='装刀任务来源')
|
||||
applicant = fields.Char(string='申请人')
|
||||
reason_for_applying = fields.Char(string='申请原因')
|
||||
apply_time = fields.Datetime(string='申请时间', default=fields.Datetime.now())
|
||||
|
||||
assemble_status = fields.Selection([('0', '待组装'), ('1', '已组装'), ('2', '已出库')],string='组装状态', default='0')
|
||||
use_tool_time = fields.Datetime(string='用刀时间')
|
||||
production_line_name = fields.Char(string='产线名称')
|
||||
machine_tool_name = fields.Char(string='机床名称')
|
||||
machine_tool_code = fields.Char(string='机台号')
|
||||
cutter_spacing_code = fields.Char(string='刀位号')
|
||||
tool_loading_person = fields.Char(string='装刀人')
|
||||
tool_loading_time = fields.Datetime(string='装刀时间')
|
||||
receive_person = fields.Char(string='领用人')
|
||||
receive_time = fields.Datetime(string='领用出库时间')
|
||||
remark = fields.Char(string='备注说明')
|
||||
|
||||
Reference in New Issue
Block a user