功能刀具计划(换刀申请和CAM工单程序用刀计划)视图已完成
This commit is contained in:
@@ -26,7 +26,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
remark = fields.Char('备注')
|
remark = fields.Char('备注')
|
||||||
|
|
||||||
# 功能刀具出入库记录 特有字段
|
# 功能刀具出入库记录 特有字段
|
||||||
thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '细')], string='粗/中/细')
|
thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '精')], string='粗/中/精')
|
||||||
max_life_span = fields.Char(string='最大寿命值')
|
max_life_span = fields.Char(string='最大寿命值')
|
||||||
# alarm_value = fields.Char(string='报警值')
|
# alarm_value = fields.Char(string='报警值')
|
||||||
# used_value = fields.Char(string='已使用值')
|
# used_value = fields.Char(string='已使用值')
|
||||||
@@ -56,7 +56,8 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
return_processing_num = fields.Text(string='归还需磨削数量')
|
return_processing_num = fields.Text(string='归还需磨削数量')
|
||||||
return_total = fields.Text(string='合计')
|
return_total = fields.Text(string='合计')
|
||||||
total = fields.Text(string='总计')
|
total = fields.Text(string='总计')
|
||||||
# remark = fields.Text(string='备注/说明')
|
|
||||||
|
# remark = fields.Char(string='备注/说明')
|
||||||
|
|
||||||
# @api.onchange('functional_cutting_tool_id')
|
# @api.onchange('functional_cutting_tool_id')
|
||||||
# def get_functional_cutting_tool_info(self):
|
# def get_functional_cutting_tool_info(self):
|
||||||
@@ -97,3 +98,99 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
else:
|
else:
|
||||||
new_code = '001'
|
new_code = '001'
|
||||||
return new_code
|
return new_code
|
||||||
|
|
||||||
|
|
||||||
|
class MachineTableToolChangingApply(models.Model):
|
||||||
|
_name = 'sf.machine.table.tool.changing.apply'
|
||||||
|
_description = '机床换刀申请'
|
||||||
|
|
||||||
|
CNC_machine_table = fields.Char(string='CNC机床')
|
||||||
|
# todo 机床类型和刀位号 为 Many2one
|
||||||
|
machine_table_type = fields.Char(string='机床类型')
|
||||||
|
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([("0", "正常"), ('1', '异常')], string='功能刀具状态')
|
||||||
|
|
||||||
|
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 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:
|
||||||
|
# 如果目标表中不存在相同的记录,则创建一个新记录
|
||||||
|
destination_record = self.create({
|
||||||
|
# todo
|
||||||
|
# 'name': source_record.name,
|
||||||
|
})
|
||||||
|
|
||||||
|
# todo
|
||||||
|
def tool_changing_apply(self):
|
||||||
|
"""
|
||||||
|
换刀申请(按键)
|
||||||
|
"""
|
||||||
|
|
||||||
|
# todo
|
||||||
|
def transfer(self):
|
||||||
|
"""
|
||||||
|
转移(按键)
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||||
|
_name = 'sf.cam.work.order.program.knife.plan'
|
||||||
|
_description = '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='机台名称')
|
||||||
|
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='需要用刀时间')
|
||||||
|
applicant = fields.Char(string='申请人')
|
||||||
|
reason_for_applying = fields.Char(string='申请原因')
|
||||||
|
remark = fields.Char(string='备注说明')
|
||||||
|
|
||||||
|
# todo
|
||||||
|
def tool_loading_apply(self):
|
||||||
|
"""
|
||||||
|
装刀申请(按键)
|
||||||
|
"""
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
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_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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -49,5 +49,28 @@
|
|||||||
parent="menu_sf_tool_manage"
|
parent="menu_sf_tool_manage"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
sequence="0"
|
||||||
|
name="功能刀具计划"
|
||||||
|
id="menu_sf_function_tool_plan"
|
||||||
|
parent="menu_sf_tool_manage"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
sequence="10"
|
||||||
|
name="CAM工单程序用刀计划"
|
||||||
|
id="menu_sf_cam_work_order_program_knife_plan"
|
||||||
|
action="sf_cam_work_order_program_knife_plan_view_act"
|
||||||
|
parent="menu_sf_function_tool_plan"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
sequence="0"
|
||||||
|
name="机床换刀申请"
|
||||||
|
id="menu_sf_machine_table_tool_changing_apply"
|
||||||
|
action="sf_machine_table_tool_changing_apply_view_act"
|
||||||
|
parent="menu_sf_function_tool_plan"
|
||||||
|
/>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- ========================================功能刀具出入库记录================================================================== -->
|
<!-- ========================================功能刀具出入库记录======================================================== -->
|
||||||
<record id="sf_function_tool_entry_exit_records_view_tree" model="ir.ui.view">
|
<record id="sf_function_tool_entry_exit_records_view_tree" model="ir.ui.view">
|
||||||
<field name="name">功能刀具出入库记录</field>
|
<field name="name">功能刀具出入库记录</field>
|
||||||
<field name="model">sf.functional.cutting.tool.entity</field>
|
<field name="model">sf.functional.cutting.tool.entity</field>
|
||||||
@@ -142,5 +142,88 @@
|
|||||||
<field name="view_id" ref="sf_functional_tool_real_time_distribution_view_tree"/>
|
<field name="view_id" ref="sf_functional_tool_real_time_distribution_view_tree"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!--================================================CAM工单程序用刀计划================================================-->
|
||||||
|
<record id="sf_CAM_work_order_program_knife_plan_tree" model="ir.ui.view">
|
||||||
|
<field name="name">CAM工单程序用刀计划</field>
|
||||||
|
<field name="model">sf.cam.work.order.program.knife.plan</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="CAM_cutter_spacing_code"/>
|
||||||
|
<field name="functional_tool_code"/>
|
||||||
|
<field name="functional_tool_name"/>
|
||||||
|
<field name="functional_tool_type"/>
|
||||||
|
<field name="machine_table_name"/>
|
||||||
|
<field name="diameter"/>
|
||||||
|
<field name="tool_loading_length"/>
|
||||||
|
<field name="clearance_length"/>
|
||||||
|
<field name="tool_included_angle"/>
|
||||||
|
<field name="L_D"/>
|
||||||
|
<field name="coarse_middle_thin"/>
|
||||||
|
<field name="required_cutting_time"/>
|
||||||
|
<field name="whether_standard_tool"/>
|
||||||
|
<field name="need_knife_time"/>
|
||||||
|
<field name="applicant"/>
|
||||||
|
<field name="reason_for_applying"/>
|
||||||
|
<field name="remark"/>
|
||||||
|
<button string="装刀申请" name="tool_loading_apply"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="sf_cam_work_order_program_knife_plan_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.cam.work.order.program.knife.plan</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!--================================================机床换刀申请================================================-->
|
||||||
|
<record id="sf_machine_table_tool_changing_apply_tree" model="ir.ui.view">
|
||||||
|
<field name="name">机床换刀申请</field>
|
||||||
|
<field name="model">sf.machine.table.tool.changing.apply</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="CNC_machine_table"/>
|
||||||
|
<field name="machine_table_type"/>
|
||||||
|
<field name="cutter_spacing_code"/>
|
||||||
|
<field name="functional_tool_code"/>
|
||||||
|
<field name="functional_tool_name"/>
|
||||||
|
<field name="functional_tool_type"/>
|
||||||
|
<field name="diameter"/>
|
||||||
|
<field name="coarse_middle_thin"/>
|
||||||
|
<field name="hilt_name"/>
|
||||||
|
<field name="hilt_code"/>
|
||||||
|
<field name="max_lifetime_value"/>
|
||||||
|
<field name="alarm_value"/>
|
||||||
|
<field name="used_value"/>
|
||||||
|
<field name="functional_tool_status"/>
|
||||||
|
|
||||||
|
<button string="换刀申请" name="tool_changing_apply"/>
|
||||||
|
<button string="转移" name="transfer"/>
|
||||||
|
|
||||||
|
<field name="replacement_tool_code"/>
|
||||||
|
<field name="replacement_tool_name"/>
|
||||||
|
<field name="replacement_tool_type"/>
|
||||||
|
<field name="replacement_tool_coarse_middle_thin"/>
|
||||||
|
<field name="new_former"/>
|
||||||
|
<field name="applicant"/>
|
||||||
|
<field name="used_tool_time"/>
|
||||||
|
<field name="reason_for_applying"/>
|
||||||
|
<field name="remark"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="sf_machine_table_tool_changing_apply_view_act" model="ir.actions.act_window">
|
||||||
|
<field name="name">机床换刀申请</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">sf.machine.table.tool.changing.apply</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user