diff --git a/sf_tool_management/__init__.py b/sf_tool_management/__init__.py
index c081ee06..c9ba0265 100644
--- a/sf_tool_management/__init__.py
+++ b/sf_tool_management/__init__.py
@@ -1,2 +1,3 @@
# -*-coding:utf-8-*-
from . import models
+from . import wizard
diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py
index 8368f528..6fbf1152 100644
--- a/sf_tool_management/__manifest__.py
+++ b/sf_tool_management/__manifest__.py
@@ -14,9 +14,9 @@
'data': [
'security/group_security.xml',
'security/ir.model.access.csv',
+ 'wizard/wizard_view.xml',
'views/tool_base_views.xml',
'views/menu_view.xml',
-
],
'demo': [
],
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index ae13cb56..8563fed3 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -26,7 +26,7 @@ class FunctionalCuttingToolEntity(models.Model):
remark = fields.Char('备注')
# 功能刀具出入库记录 特有字段
- thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '细')], string='粗/中/细')
+ thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '精')], string='粗/中/精')
max_life_span = fields.Char(string='最大寿命值')
# alarm_value = fields.Char(string='报警值')
# used_value = fields.Char(string='已使用值')
@@ -56,7 +56,8 @@ class FunctionalCuttingToolEntity(models.Model):
return_processing_num = fields.Text(string='归还需磨削数量')
return_total = fields.Text(string='合计')
total = fields.Text(string='总计')
- # remark = fields.Text(string='备注/说明')
+
+ # remark = fields.Char(string='备注/说明')
# @api.onchange('functional_cutting_tool_id')
# def get_functional_cutting_tool_info(self):
@@ -97,3 +98,272 @@ class FunctionalCuttingToolEntity(models.Model):
else:
new_code = '001'
return new_code
+
+
+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='换刀需求信息',
+ attrs="{'invisible': 1}")
+
+ CNC_machine_table = fields.Char(string='CNC机床')
+ # todo 机床类型和刀位号 为 Many2one
+ machine_table_type = fields.Char(string='机床类型')
+ machine_tool_code = fields.Char(string='机台号', attrs="{'invisible': 1}")
+ cutter_spacing_code = fields.Char(string='刀位号')
+ functional_tool_code = fields.Char(string='功能刀具编码')
+ functional_tool_name = fields.Char(string='功能刀具名称')
+ # todo 功能刀具类型为 Many2one
+ functional_tool_type = fields.Char(string='功能刀具类型')
+ diameter = fields.Char(string='直径')
+ coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精')
+ hilt_name = fields.Char(string='刀柄名称')
+ hilt_code = fields.Char(string='刀柄编号')
+ max_lifetime_value = fields.Char(string='最大寿命值')
+ alarm_value = fields.Char(string='报警值')
+ used_value = fields.Char(string='已使用值')
+ functional_tool_status = fields.Selection([('正常', '正常'), ('异常', '异常')], string='功能刀具状态', default='正常')
+
+ replacement_tool_code = fields.Char(string='待换刀具编码')
+ replacement_tool_name = fields.Char(string='待换刀具名称')
+ replacement_tool_type = fields.Char(string='待换刀具类型')
+ replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
+ string='粗/中/精')
+ new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧')
+ applicant = fields.Char(string='申请人')
+ used_tool_time = fields.Datetime(string='用刀时间')
+ reason_for_applying = fields.Char(string='申请原因')
+ remark = fields.Char(string='备注说明')
+
+ status = fields.Selection([('0', '未操作'), ('1', '已换刀申请'), ('2', '已转移')], string='操作状态', default='0')
+
+ @api.onchange('functional_tool_status')
+ def automation_apply_for_tool_change(self):
+ """
+ 自动申请换刀
+ :return:
+ """
+ # 更新数据到机台换刀申请界面
+ # todo 换刀申请条件需补充完善
+ if(self.functional_tool_status == '异常'):
+ self.env['sf.machine.table.tool.changing.apply'].search([
+ ('CNC_machine_table', '=', self.CNC_machine_table)]).write({
+ 'replacement_tool_code': self.functional_tool_code,
+ 'replacement_tool_name': self.functional_tool_name,
+ 'replacement_tool_type': self.functional_tool_type,
+ 'replacement_tool_coarse_middle_thin': self.coarse_middle_thin,
+ 'new_former': '0',
+ 'applicant': None,
+ 'used_tool_time': fields.Datetime.now(),
+ 'reason_for_applying': None,
+ 'remark': None,
+ 'status': '1'
+ })
+
+ # 新建组装任务
+ self.env['sf.functional.tool.assembly'].create({
+ 'functional_tool_code': self.functional_tool_code,
+ 'functional_tool_name': self.functional_tool_name,
+ 'functional_tool_type': self.functional_tool_type,
+ 'functional_tool_diameter': self.diameter,
+ 'loading_task_source': '1',
+ 'applicant': self.applicant,
+ 'reason_for_applying': self.reason_for_applying,
+ 'use_tool_time': self.used_tool_time,
+ 'machine_tool_name': self.CNC_machine_table,
+ 'machine_tool_code': self.machine_tool_code,
+ 'cutter_spacing_code': self.cutter_spacing_code
+ })
+
+
+
+ def new_assembly_task(self,vals):
+ """
+ 新建组装任务
+ :param vals:
+ :return:
+ """
+ # 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'] = self.diameter
+
+ self.env['sf.functional.tool.assembly'].create(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': 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'
+ })
+
+ # 撤回功能刀具组装创建新任务
+ self.env['sf.functional.tool.assembly'].search(
+ [('functional_tool_code', '=', self.functional_tool_code)]).unlink()
+
+
+ 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):
+ _name = 'sf.cam.work.order.program.knife.plan'
+ _description = 'CAM工单程序用刀计划'
+
+ ticket_task_code = fields.Char(string='工单任务编号')
+ cam_procedure_code = fields.Char(string='CAM程序编号')
+ cam_cutter_spacing_code = fields.Char(string='CAM刀位号')
+ functional_tool_code = fields.Char(string='功能刀具编码')
+ functional_tool_name = fields.Char(string='功能刀具名称')
+ functional_tool_type = fields.Char(string='功能刀具类型')
+ machine_table_name = fields.Char(string='机床名称')
+ machine_tool_cutter_spacing_code = fields.Char(string='机床刀位号')
+ diameter = fields.Char(string='直径(程式)')
+ tool_loading_length = fields.Char(string='装刀长')
+ clearance_length = fields.Char(string='避空长')
+ tool_included_angle = fields.Char(string='刀尖角(R角)')
+ L_D = fields.Char(string='L/D')
+ coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精')
+ required_cutting_time = fields.Char(string='需要切割时间')
+ whether_standard_tool = fields.Boolean(string='是否标准刀')
+ need_knife_time = fields.Datetime(string='需要用刀时间')
+ plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')], string='计划执行状态')
+ applicant = fields.Char(string='申请人')
+ reason_for_applying = fields.Char(string='申请原因')
+ remark = fields.Char(string='备注说明')
+
+ def automation_apply_for_tooling(self):
+ """
+ todo 自动申请装刀
+ :return:
+ """
+ self.env['sf.functional.tool.assembly'].create({
+ 'functional_tool_code': self.functional_tool_code,
+ 'functional_tool_name': self.functional_tool_name,
+ 'functional_tool_type': self.functional_tool_type,
+ 'functional_tool_diameter': self.diameter,
+ 'functional_tool_length': self.tool_loading_length,
+ 'loading_task_source': '0',
+ 'coarse_middle_thin': None,
+ 'tool_loading_length': None,
+ '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_code': self.cam_procedure_code,
+ 'cutter_spacing_code': self.cam_cutter_spacing_code
+ })
+
+ # 将计划执行状态改为执行中
+ 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()
+
+ # 将计划执行状态改为待执行
+ 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='备注说明')
+
+ def cancel_functional_tool_assembly(self):
+ """
+ 取消功能刀具组装
+ :return:
+ """
+ self.env['sf.functional.tool.assembly'].search([
+ ('machine_tool_name', '=', self.machine_tool_name),
+ ('cutter_spacing_code', '=', self.cutter_spacing_code)
+ ]).write({
+ 'tool_name': None,
+ 'tool_brand': None,
+ 'tool_type': None,
+ 'knife_handle_name': None,
+ 'knife_handle_brand': None,
+ 'knife_handle_type': None,
+ 'coarse_middle_thin': None,
+ 'tool_loading_length': None,
+ 'new_former': None,
+ 'reference_length': None,
+ 'cut_time': None,
+ 'cut_length': None,
+ 'cut_number': None,
+ 'assemble_status': '0'
+ })
diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv
index 3156f716..1792b613 100644
--- a/sf_tool_management/security/ir.model.access.csv
+++ b/sf_tool_management/security/ir.model.access.csv
@@ -1,5 +1,16 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_functional_cutting_tool_entity,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,base.group_user,1,1,1,1
+access_sf_cam_work_order_program_knife_plan,sf.cam.work.order.program.knife.plan,model_sf_cam_work_order_program_knife_plan,base.group_user,1,1,1,1
+access_sf_machine_table_tool_changing_apply,sf.machine.table.tool.changing.apply,model_sf_machine_table_tool_changing_apply,base.group_user,1,1,1,1
+
+
+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
+access_sf_delivery_of_cargo_from_storage,sf.delivery.of.cargo.from.storage,model_sf_delivery_of_cargo_from_storage,base.group_user,1,1,1,1
diff --git a/sf_tool_management/views/menu_view.xml b/sf_tool_management/views/menu_view.xml
index 5791bf90..5196e7b0 100644
--- a/sf_tool_management/views/menu_view.xml
+++ b/sf_tool_management/views/menu_view.xml
@@ -30,7 +30,7 @@
parent="menu_sf_tool_manage"
name="功能刀具预警"
sequence="4"
- action="sf_function_tool_entry_warning_view_act"
+ action="action_sf_functional_cutting_tool_warning"
/>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml
index 8e44b693..6ccaedbc 100644
--- a/sf_tool_management/views/tool_base_views.xml
+++ b/sf_tool_management/views/tool_base_views.xml
@@ -1,7 +1,7 @@
-
+
sf.functional.cutting.tool.entity.list.tree
sf.functional.cutting.tool.entity
@@ -9,13 +9,8 @@
-
-
-
-
-
-
-
+
+
@@ -40,7 +35,7 @@
-
+
sf.functional.cutting.tool.entity.tree
sf.functional.cutting.tool.entity
@@ -48,13 +43,8 @@
-
-
-
-
-
-
-
+
+
@@ -75,15 +65,8 @@
-
- 功能刀具预警
- ir.actions.act_window
- sf.functional.cutting.tool.entity
- tree
-
-
-
+
功能刀具出入库记录
sf.functional.cutting.tool.entity
@@ -92,13 +75,8 @@
-
-
-
-
-
-
-
+
+
@@ -150,13 +128,8 @@
-
-
-
-
-
-
-
+
+
@@ -189,5 +162,349 @@
+
+
+
+ 机床换刀申请
+ sf.machine.table.tool.changing.apply
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sf.machine.table.tool.changing.apply
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 机床换刀申请
+ ir.actions.act_window
+ sf.machine.table.tool.changing.apply
+ tree,form,search
+
+
+
+
+
+ CAM工单程序用刀计划
+ sf.cam.work.order.program.knife.plan
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sf.cam.work.order.program.knife.plan
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CAM工单程序用刀计划
+ ir.actions.act_window
+ sf.cam.work.order.program.knife.plan
+ tree,form,search
+
+
+
+
+
+ 功能刀具组装
+ sf.functional.tool.assembly
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sf.functional.tool.assembly
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 功能刀具组装
+ ir.actions.act_window
+ sf.functional.tool.assembly
+ tree,form,search
+
+
+
+
diff --git a/sf_tool_management/wizard/__init__.py b/sf_tool_management/wizard/__init__.py
new file mode 100644
index 00000000..20a7f5c4
--- /dev/null
+++ b/sf_tool_management/wizard/__init__.py
@@ -0,0 +1 @@
+from . import wizard
\ No newline at end of file
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
new file mode 100644
index 00000000..22a5a0d7
--- /dev/null
+++ b/sf_tool_management/wizard/wizard.py
@@ -0,0 +1,239 @@
+from odoo import fields, models, api
+
+
+class ToolChangeRequirementInformation(models.TransientModel):
+ _name = 'sf.tool.change.requirement.information'
+ _description = '换刀需求信息'
+
+ tool_change_to_apply_id = fields.Many2one('sf.machine.table.tool.changing.apply', string='机床换刀申请')
+
+ 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)
+
+ replacement_tool_code = fields.Char(string='待换刀具编码')
+ replacement_tool_name = fields.Char(string='待换刀具名称')
+ replacement_tool_type = fields.Char(string='待换刀具类型')
+ replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
+ string='粗/中/精')
+ new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧')
+ applicant = fields.Char(string='申请人')
+ used_tool_time = fields.Datetime(string='用刀时间')
+ reason_for_applying = fields.Char(string='申请原因')
+ remark = fields.Char(string='备注说明')
+
+ 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,
+ 'status': '1'
+ }
+ # 将数据更新到机台换刀申请界面
+ self.env['sf.machine.table.tool.changing.apply'].search(
+ [('CNC_machine_table', '=', desc.get('CNC_machine_table'))]).write(desc)
+
+ # 功能刀具组装创建新任务
+ self.env['sf.machine.table.tool.changing.apply'].new_assembly_task({
+ 'functional_tool_code': self.replacement_tool_code,
+ 'functional_tool_name': self.replacement_tool_name,
+ 'functional_tool_type': self.replacement_tool_type,
+ 'loading_task_source': '1',
+ 'applicant': self.applicant,
+ 'reason_for_applying': self.reason_for_applying,
+ 'use_tool_time': self.used_tool_time,
+ 'machine_tool_name': self.CNC_machine_table,
+ 'machine_tool_code': self.machine_tool_code,
+ 'cutter_spacing_code': self.cutter_spacing_code
+ })
+
+ # 关闭弹出窗口
+ 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:
+ """
+ self.env['sf.machine.table.tool.changing.apply'].search(
+ [('CNC_machine_table', '=', self.CNC_machine_table)]).write({'status': '2'})
+
+
+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)
+
+ applicant = fields.Char(string='申请人', invisible='1')
+
+ def apply_for_tooling(self):
+ """
+ 申请装刀
+ :return:
+ """
+ self.env['sf.functional.tool.assembly'].create({
+ 'functional_tool_code': self.functional_tool_code,
+ 'functional_tool_name': self.functional_tool_name,
+ 'functional_tool_type': self.functional_tool_type,
+ 'functional_tool_diameter': self.diameter,
+ 'functional_tool_length': self.tool_loading_length,
+ 'loading_task_source': '0',
+ 'coarse_middle_thin': None,
+ 'tool_loading_length': None,
+ '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_code': self.cam_procedure_code,
+ 'cutter_spacing_code': self.cam_cutter_spacing_code
+ })
+
+ # 将计划执行状态改为执行中
+ self.env['sf.cam.work.order.program.knife.plan'].search(
+ [('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '1'})
+
+ # 关闭弹出窗口
+ return {'type': 'ir.actions.act_window_close'}
+
+
+class FunctionalToolAssemblyOrder(models.TransientModel):
+ _name = 'sf.functional.tool.assembly.order'
+ _description = '功能刀具组装单'
+
+ # 功能刀具申请信息
+ machine_tool_name = fields.Char(string='机床名称', readonly=True)
+ cutter_spacing_code = fields.Char(string='刀位号', readonly=True)
+ functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
+ functional_tool_type = fields.Char(string='功能刀具类型', readonly=True)
+ functional_tool_length = fields.Char(string='功能刀具伸出长', readonly=True)
+ effective_length = fields.Char(string='有效长', readonly=True)
+ functional_tool_diameter = fields.Char(string='功能刀具直径', readonly=True)
+ tool_included_angle = fields.Char(string='刀尖角(R角)', readonly=True)
+ functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=True)
+ required_cutting_time = fields.Char(string='需要切割时间', readonly=True)
+ whether_standard_tool = fields.Boolean(string='是否标准刀', readonly=True)
+
+ # 功能刀具组装信息
+ tool_name = fields.Char(string='刀具名称')
+ tool_code = fields.Char(string='刀具编码')
+ tool_brand = fields.Char(string='品牌')
+ tool_type = fields.Char(string='型号')
+ knife_handle_name = fields.Char(string='刀柄名称')
+ knife_handle_code = 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='已切削次数')
+
+ def functional_tool_assembly(self):
+ """
+ 功能刀具组装
+ :return:
+ """
+ self.env['sf.functional.tool.assembly'].search([
+ ('machine_tool_name', '=', self.machine_tool_name),
+ ('cutter_spacing_code', '=', self.cutter_spacing_code)
+ ]).write({
+ 'tool_name': self.tool_name,
+ 'tool_brand': self.tool_brand,
+ 'tool_type': self.tool_type,
+ 'knife_handle_name': self.knife_handle_name,
+ 'knife_handle_brand': self.knife_handle_brand,
+ 'knife_handle_type': self.knife_handle_type,
+ 'coarse_middle_thin': self.coarse_middle_thin,
+ 'tool_loading_length': self.tool_loading_length,
+ 'new_former': self.new_former,
+ 'reference_length': self.reference_length,
+ 'cut_time': self.cut_time,
+ 'cut_length': self.cut_length,
+ 'cut_number': self.cut_number,
+ 'assemble_status': '1',
+ 'tool_loading_person': self.env.user.name,
+ 'tool_loading_time': fields.Datetime.now()
+ })
+
+ # 关闭弹出窗口
+ return {'type': 'ir.actions.act_window_close'}
+
+
+class DeliveryOfCargoFromStorage(models.TransientModel):
+ _name = 'sf.delivery.of.cargo.from.storage'
+ _description = '出库'
+
+ functional_tool_code = fields.Char(string='功能刀具编码')
+ functional_tool_name = fields.Char(string='功能刀具名称')
+ functional_tool_type = fields.Char(string='功能刀具类型')
+ production_line_name = fields.Char(string='产线名称')
+ machine_tool_code = fields.Char(string='机台号')
+ receive_person = fields.Char(string='领用人')
+ receive_time = fields.Datetime(string='领用出库时间')
+
+ def stock_removal(self):
+ """
+ 出库
+ :return:
+ """
\ No newline at end of file
diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml
new file mode 100644
index 00000000..d6900757
--- /dev/null
+++ b/sf_tool_management/wizard/wizard_view.xml
@@ -0,0 +1,295 @@
+
+
+
+
+ 换刀需求信息
+ sf.tool.change.requirement.information
+
+
+
+
+
+
+ 换刀需求信息
+ ir.actions.act_window
+ sf.tool.change.requirement.information
+ form
+
+ 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
+
+
+
+
+
+ 功能刀具组装单
+ sf.functional.tool.assembly.order
+
+
+
+
+
+
+ 功能刀具组装单
+ ir.actions.act_window
+ sf.functional.tool.assembly.order
+ form
+
+ new
+
+
+
+
+
+
+ 出库
+ sf.delivery.of.cargo.from.storage
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 出库
+ ir.actions.act_window
+ sf.delivery.of.cargo.from.storage
+ tree
+
+ new
+
+
\ No newline at end of file