diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index a33c7df1..d4d1a7ba 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -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):
- """
- 装刀申请(按键)
- """
diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv
index ebc4d2db..e97c88f8 100644
--- a/sf_tool_management/security/ir.model.access.csv
+++ b/sf_tool_management/security/ir.model.access.csv
@@ -5,6 +5,8 @@ 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
diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml
index 6637d0e9..22c780cd 100644
--- a/sf_tool_management/views/tool_base_views.xml
+++ b/sf_tool_management/views/tool_base_views.xml
@@ -143,6 +143,79 @@
+
+
+ 机床换刀申请
+ sf.machine.table.tool.changing.apply
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 机床换刀申请
+ ir.actions.act_window
+ sf.machine.table.tool.changing.apply
+ tree,form
+
+
+
CAM工单程序用刀计划
@@ -170,7 +243,27 @@
-
+
@@ -183,64 +276,7 @@
-
-
- 机床换刀申请
- sf.machine.table.tool.changing.apply
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 机床换刀申请
- ir.actions.act_window
- sf.machine.table.tool.changing.apply
- tree,form
-
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index 3f4a0734..60fcfd86 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -22,14 +22,102 @@ class ToolChangeRequirementInformation(models.TransientModel):
reason_for_applying = fields.Char(string='申请原因')
remark = fields.Char(string='备注说明')
- # todo 未完成
def tool_changing_apply(self):
"""
- 确认换刀申请(按键)
+ 确认换刀申请(按键)
+ :return:
"""
+ # 封装数据
+ desc = {
+ 'CNC_machine_table': self.CNC_machine_table,
+ 'machine_tool_code': self.machine_tool_code,
+ 'cutter_spacing_code': self.cutter_spacing_code,
+ 'replacement_tool_code': self.replacement_tool_code,
+ 'replacement_tool_name': self.replacement_tool_name,
+ 'replacement_tool_type': self.replacement_tool_type,
+ 'replacement_tool_coarse_middle_thin': self.replacement_tool_coarse_middle_thin,
+ 'new_former': self.new_former,
+ 'applicant': self.applicant,
+ 'used_tool_time': self.used_tool_time,
+ 'reason_for_applying': self.reason_for_applying,
+ 'remark': self.new_former
+ }
# 将数据更新到换刀申请
- self.tool_change_to_apply_id.write({'replacement_tool_name': self.replacement_tool_name})
- self.env.cr.commit()
+ self.env['sf.machine.table.tool.changing.apply'].amendant_record(desc)
+
+ # todo 功能刀具组装创建新任务
# 关闭弹出窗口
return {'type': 'ir.actions.act_window_close'}
+
+
+class ToolTransferRequestInformation(models.TransientModel):
+ _name = 'sf.tool.transfer.request.information'
+ _description = '刀具转移申请信息'
+
+ CNC_machine_table = fields.Char(string='CNC机床', readonly=True)
+ machine_tool_code = fields.Char(string='机台号', readonly=True)
+ 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)
+ transfer_target = fields.Selection([('机台', '机台'),
+ ('线边刀库', '线边刀库'),
+ ('刀具房', '刀具房')], string='转移到:', default='线边刀库')
+
+ new_cnc_machine_table = fields.Char(string='机床名称')
+ new_machine_tool_code = fields.Char(string='机床号')
+ new_cutter_spacing_code = fields.Char(string='刀位号')
+
+ magazine_tool_warehouse_district = fields.Char(string='库区')
+ magazine_tool_warehouse_position = fields.Char(string='库位')
+
+ tool_room_warehouse_district = fields.Char(string='库区')
+ tool_room_warehouse_position = fields.Char(string='库位')
+
+ def tool_transfer_apply(self):
+ """
+ 刀具转移申请信息确定按钮
+ :return:
+ """
+
+
+class ApplyForTooling(models.TransientModel):
+ _name = 'sf.apply.for.tooling'
+ _description = '申请装刀'
+
+ ticket_task_code = fields.Char(string='工单任务编号', readonly=True)
+ cam_procedure_code = fields.Char(string='CAM程序编号', readonly=True)
+ machine_table_name = fields.Char(string='机床名称', 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)
+
+ 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)
+
+ whether_standard_tool = fields.Boolean(string='是否标准刀', readonly=True)
+ need_knife_time = fields.Datetime(string='需要用刀时间', readonly=True)
+ required_cutting_time = fields.Char(string='需要切割时间', readonly=True)
+ reason_for_applying = fields.Char(string='申请原因', readonly=True)
+
+ def apply_for_tooling(self):
+ """
+
+ :return:
+ """
+
+
+
+
+
+
+
+
+
diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml
index 8cdb7998..4706f86e 100644
--- a/sf_tool_management/wizard/wizard_view.xml
+++ b/sf_tool_management/wizard/wizard_view.xml
@@ -1,5 +1,6 @@
+
换刀需求信息
sf.tool.change.requirement.information
@@ -54,4 +55,126 @@
new
+
+
+
+ 刀具转移申请信息
+ sf.tool.transfer.request.information
+
+
+
+
+
+
+ 刀具转移申请信息
+ ir.actions.act_window
+ sf.tool.transfer.request.information
+ form
+
+ new
+
+
+
+
+
+ 申请装刀
+ sf.apply.for.tooling
+
+
+
+
+
+
+ 申请装刀
+ ir.actions.act_window
+ sf.apply.for.tooling
+ form
+
+ new
+
\ No newline at end of file