新增了功能刀具组装界面,新增了功能刀具计划的按键功能,以及按键的显示功能
This commit is contained in:
@@ -139,35 +139,23 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
reason_for_applying = fields.Char(string='申请原因')
|
reason_for_applying = fields.Char(string='申请原因')
|
||||||
remark = fields.Char(string='备注说明')
|
remark = fields.Char(string='备注说明')
|
||||||
|
|
||||||
# def sync_tool_entity_from_tool_changing_apply_table(self):
|
status = fields.Selection([('0', '未操作'), ('1', '已换刀申请'), ('2', '已转移')], string='操作状态', default='0')
|
||||||
# """
|
|
||||||
# ‘功能刀具预警’数据同步到‘机床换刀申请’
|
|
||||||
# """
|
|
||||||
# # 获取源表中的所有记录
|
|
||||||
# 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,
|
|
||||||
# })
|
|
||||||
|
|
||||||
def amendant_record(self, vals):
|
def new_assembly_task(self,vals):
|
||||||
"""
|
"""
|
||||||
确认换刀申请(按键)
|
新建组装任务
|
||||||
将弹窗数据更新到记录
|
|
||||||
:param vals:
|
:param vals:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
self.env['sf.machine.table.tool.changing.apply'].search(
|
# todo 设置直径的值
|
||||||
[('CNC_machine_table', '=', vals.get('CNC_machine_table'))]).write(vals)
|
# 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):
|
def revocation_1(self):
|
||||||
"""
|
"""
|
||||||
@@ -175,26 +163,33 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
# 撤回数据更新
|
# 撤回数据更新
|
||||||
self.env['sf.machine.table.tool.changing.apply'].search(
|
self.env['sf.machine.table.tool.changing.apply'].search([('CNC_machine_table', '=', self.CNC_machine_table)]).write({
|
||||||
[('CNC_machine_table', '=', self.CNC_machine_table)]).write({
|
'replacement_tool_code': None,
|
||||||
'replacement_tool_code': False,
|
'replacement_tool_name': None,
|
||||||
'replacement_tool_name': False,
|
'replacement_tool_type': None,
|
||||||
'replacement_tool_type': False,
|
'replacement_tool_coarse_middle_thin': None,
|
||||||
'replacement_tool_coarse_middle_thin': False,
|
'new_former': None,
|
||||||
'new_former': False,
|
'applicant': None,
|
||||||
'applicant': False,
|
'used_tool_time': None,
|
||||||
'used_tool_time': False,
|
'reason_for_applying': None,
|
||||||
'reason_for_applying': False,
|
'remark': None,
|
||||||
'remark': False
|
'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:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
self.env['sf.machine.table.tool.changing.apply'].search(
|
||||||
|
[('CNC_machine_table', '=', self.CNC_machine_table)]).write({
|
||||||
|
'status': '0'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class CAMWorkOrderProgramKnifePlan(models.Model):
|
class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||||
@@ -222,3 +217,62 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
applicant = fields.Char(string='申请人')
|
applicant = fields.Char(string='申请人')
|
||||||
reason_for_applying = fields.Char(string='申请原因')
|
reason_for_applying = fields.Char(string='申请原因')
|
||||||
remark = 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='备注说明')
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ access_sf_tool_change_requirement_information,sf.tool.change.requirement.informa
|
|||||||
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_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_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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -72,5 +72,14 @@
|
|||||||
parent="menu_sf_function_tool_plan"
|
parent="menu_sf_function_tool_plan"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
sequence="2"
|
||||||
|
name="功能刀具组装"
|
||||||
|
id="menu_sf_functional_tool_assembly"
|
||||||
|
action="sf_functional_tool_assembly_view_act"
|
||||||
|
parent="menu_sf_tool_manage"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -164,6 +164,7 @@
|
|||||||
<field name="alarm_value"/>
|
<field name="alarm_value"/>
|
||||||
<field name="used_value"/>
|
<field name="used_value"/>
|
||||||
<field name="functional_tool_status"/>
|
<field name="functional_tool_status"/>
|
||||||
|
<field name="status" invisible="1"/>
|
||||||
|
|
||||||
<button string="换刀申请"
|
<button string="换刀申请"
|
||||||
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
|
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
|
||||||
@@ -175,9 +176,10 @@
|
|||||||
'default_replacement_tool_name': functional_tool_name,
|
'default_replacement_tool_name': functional_tool_name,
|
||||||
'default_replacement_tool_type': functional_tool_type,
|
'default_replacement_tool_type': functional_tool_type,
|
||||||
'default_replacement_tool_coarse_middle_thin': coarse_middle_thin}"
|
'default_replacement_tool_coarse_middle_thin': coarse_middle_thin}"
|
||||||
attrs="{'invisible': [('functional_tool_status', '=', '正常')]}"
|
attrs="{'invisible': ['|',('functional_tool_status', '=', '正常'), ('status', '!=', '0')]}"
|
||||||
|
class="btn-primary"
|
||||||
/>
|
/>
|
||||||
<button string="换刀申请" name="" attrs="{'invisible': [('functional_tool_status', '=', '异常')]}"/>
|
<button string="换刀申请" name="" attrs="{'invisible': [ ('functional_tool_status', '=', '异常'), ('status', '=', '0')]}" class="btn-primary"/>
|
||||||
|
|
||||||
<button string="转移"
|
<button string="转移"
|
||||||
name="%(sf_tool_management.sf_tool_transfer_request_information_act)d"
|
name="%(sf_tool_management.sf_tool_transfer_request_information_act)d"
|
||||||
@@ -188,10 +190,13 @@
|
|||||||
'default_functional_tool_code': functional_tool_code,
|
'default_functional_tool_code': functional_tool_code,
|
||||||
'default_functional_tool_name': functional_tool_name,
|
'default_functional_tool_name': functional_tool_name,
|
||||||
'default_functional_tool_type': functional_tool_type}"
|
'default_functional_tool_type': functional_tool_type}"
|
||||||
|
class="btn-primary"
|
||||||
|
attrs="{'invisible': [('status', '!=', '0')]}"
|
||||||
/>
|
/>
|
||||||
<button string="撤回" name="revocation_1"/>
|
<button string="转移" name="" class="btn-primary" attrs="{'invisible': [('status', '=', '0')]}"/>
|
||||||
<button string="撤回" name="revocation_2"/>
|
<button string="撤回" name="" class="btn-primary" attrs="{'invisible': [('status', '!=', '0')]}"/>
|
||||||
<button string="撤回" name=""/>
|
<button string="撤回" name="revocation_1" type="object" class="btn-primary" attrs="{'invisible': [('status', '!=', '1')]}"/>
|
||||||
|
<button string="撤回" name="revocation_2" type="object" class="btn-primary" attrs="{'invisible': [('status', '!=', '2')]}"/>
|
||||||
|
|
||||||
<field name="replacement_tool_code"/>
|
<field name="replacement_tool_code"/>
|
||||||
<field name="replacement_tool_name"/>
|
<field name="replacement_tool_name"/>
|
||||||
@@ -261,9 +266,15 @@
|
|||||||
'default_coarse_middle_thin': coarse_middle_thin,
|
'default_coarse_middle_thin': coarse_middle_thin,
|
||||||
'default_whether_standard_tool': whether_standard_tool,
|
'default_whether_standard_tool': whether_standard_tool,
|
||||||
'default_need_knife_time': need_knife_time,
|
'default_need_knife_time': need_knife_time,
|
||||||
|
'default_applicant': applicant,
|
||||||
'default_required_cutting_time': required_cutting_time,
|
'default_required_cutting_time': required_cutting_time,
|
||||||
'default_reason_for_applying': reason_for_applying}"
|
'default_reason_for_applying': reason_for_applying}"
|
||||||
|
class="btn-primary"
|
||||||
|
attrs="{'invisible': [('plan_execute_status', '!=', '0')]}"
|
||||||
/>
|
/>
|
||||||
|
<button string="装刀申请" name="" class="btn-primary" attrs="{'invisible': [('plan_execute_status', '=', '0')]}"/>
|
||||||
|
<button string="撤回" name="revocation" type="object" class="btn-primary" attrs="{'invisible': [('plan_execute_status', '!=', '1')]}"/>
|
||||||
|
<button string="撤回" name="" class="btn-primary" attrs="{'invisible': [('plan_execute_status', '=', '1')]}"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -276,7 +287,63 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!--================================================CAM工单程序用刀计划================================================-->
|
||||||
|
<record id="sf_functional_tool_assembly_tree" model="ir.ui.view">
|
||||||
|
<field name="name">CAM工单程序用刀计划</field>
|
||||||
|
<field name="model">sf.functional.tool.assembly</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="functional_tool_code"/>
|
||||||
|
<field name="functional_tool_name"/>
|
||||||
|
<field name="functional_tool_type"/>
|
||||||
|
<field name="functional_tool_diameter"/>
|
||||||
|
<field name="functional_tool_length"/>
|
||||||
|
<field name="functional_tool_cutting_type"/>
|
||||||
|
<field name="tool_name"/>
|
||||||
|
<field name="tool_brand"/>
|
||||||
|
<field name="tool_type"/>
|
||||||
|
<field name="knife_handle_name"/>
|
||||||
|
<field name="knife_handle_brand"/>
|
||||||
|
<field name="knife_handle_type"/>
|
||||||
|
<field name="coarse_middle_thin"/>
|
||||||
|
<field name="tool_loading_length"/>
|
||||||
|
<field name="new_former"/>
|
||||||
|
<field name="reference_length"/>
|
||||||
|
<field name="cut_time"/>
|
||||||
|
<field name="cut_length"/>
|
||||||
|
<field name="cut_number"/>
|
||||||
|
<field name="loading_task_source"/>
|
||||||
|
<field name="applicant"/>
|
||||||
|
<field name="reason_for_applying"/>
|
||||||
|
<field name="apply_time"/>
|
||||||
|
|
||||||
|
<button string="组装" name=""/>
|
||||||
|
<button string="自动打印二维码" name=""/>
|
||||||
|
<button string="取消组装" name=""/>
|
||||||
|
<button string="出库" name=""/>
|
||||||
|
<button string="组装单打印" name=""/>
|
||||||
|
|
||||||
|
<field name="assemble_status"/>
|
||||||
|
<field name="use_tool_time"/>
|
||||||
|
<field name="production_line_name"/>
|
||||||
|
<field name="machine_tool_name"/>
|
||||||
|
<field name="machine_tool_code"/>
|
||||||
|
<field name="cutter_spacing_code"/>
|
||||||
|
<field name="tool_loading_person"/>
|
||||||
|
<field name="tool_loading_time"/>
|
||||||
|
<field name="receive_person"/>
|
||||||
|
<field name="receive_time"/>
|
||||||
|
<field name="remark"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="sf_functional_tool_assembly_view_act" model="ir.actions.act_window">
|
||||||
|
<field name="name">CAM工单程序用刀计划</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">sf.functional.tool.assembly</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,12 +40,26 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
'applicant': self.applicant,
|
'applicant': self.applicant,
|
||||||
'used_tool_time': self.used_tool_time,
|
'used_tool_time': self.used_tool_time,
|
||||||
'reason_for_applying': self.reason_for_applying,
|
'reason_for_applying': self.reason_for_applying,
|
||||||
'remark': self.new_former
|
'remark': self.new_former,
|
||||||
|
'status': '1'
|
||||||
}
|
}
|
||||||
# 将数据更新到换刀申请
|
# 将数据更新到换刀申请
|
||||||
self.env['sf.machine.table.tool.changing.apply'].amendant_record(desc)
|
self.env['sf.machine.table.tool.changing.apply'].search(
|
||||||
|
[('CNC_machine_table', '=', desc.get('CNC_machine_table'))]).write(desc)
|
||||||
|
|
||||||
# todo 功能刀具组装创建新任务
|
# 功能刀具组装创建新任务
|
||||||
|
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'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
@@ -81,6 +95,8 @@ class ToolTransferRequestInformation(models.TransientModel):
|
|||||||
刀具转移申请信息确定按钮
|
刀具转移申请信息确定按钮
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
self.env['sf.machine.table.tool.changing.apply'].search(
|
||||||
|
[('CNC_machine_table', '=', self.CNC_machine_table)]).write({'status': '2'})
|
||||||
|
|
||||||
|
|
||||||
class ApplyForTooling(models.TransientModel):
|
class ApplyForTooling(models.TransientModel):
|
||||||
@@ -107,11 +123,36 @@ class ApplyForTooling(models.TransientModel):
|
|||||||
required_cutting_time = fields.Char(string='需要切割时间', readonly=True)
|
required_cutting_time = fields.Char(string='需要切割时间', readonly=True)
|
||||||
reason_for_applying = fields.Char(string='申请原因', readonly=True)
|
reason_for_applying = fields.Char(string='申请原因', readonly=True)
|
||||||
|
|
||||||
|
applicant = fields.Char(string='申请人', invisible='1')
|
||||||
|
|
||||||
def apply_for_tooling(self):
|
def apply_for_tooling(self):
|
||||||
"""
|
"""
|
||||||
|
申请装刀
|
||||||
:return:
|
: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'}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user