CAM用刀添加编程单号字段,优化CNC程序用刀校验缺刀生成的CAM用刀计划记录的判断条件,优化tree和form视图;

This commit is contained in:
yuxianghui
2024-09-24 09:50:44 +08:00
parent d238d09cc3
commit c9378fc9fe
2 changed files with 33 additions and 22 deletions

View File

@@ -185,6 +185,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
_description = 'CAM工单程序用刀计划'
name = fields.Char('工单任务编号')
programming_no = fields.Char('编程单号')
cam_procedure_code = fields.Char('程序名')
filename = fields.Char('文件')
cam_cutter_spacing_code = fields.Char('刀号')
@@ -317,23 +318,30 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
"""
根据传入的工单信息查询是否有需要的功能刀具如果没有则生成CAM工单程序用刀计划
"""
knife_plan = self.env['sf.cam.work.order.program.knife.plan'].sudo().create({
'name': cnc_processing.workorder_id.production_id.name,
'cam_procedure_code': cnc_processing.program_name,
'filename': cnc_processing.cnc_id.name,
'functional_tool_name': cnc_processing.cutting_tool_name,
'cam_cutter_spacing_code': cnc_processing.cutting_tool_no,
'process_type': cnc_processing.processing_type,
'margin_x_y': float(cnc_processing.margin_x_y),
'margin_z': float(cnc_processing.margin_z),
'finish_depth': float(cnc_processing.depth_of_processing_z),
'extension_length': float(cnc_processing.cutting_tool_extension_length),
'shank_model': cnc_processing.cutting_tool_handle_type,
'estimated_processing_time': cnc_processing.estimated_processing_time,
})
logging.info('CAM工单程序用刀计划创建成功')
# 创建装刀请求
knife_plan.apply_for_tooling()
# 获取编程单号
programming_no = cnc_processing.workorder_id.production_id.programming_no
if not self.env['sf.cam.work.order.program.knife.plan'].sudo().search(
[('programming_no', '=', programming_no),
('functional_tool_name', '=', cnc_processing.cutting_tool_name)]):
knife_plan = self.env['sf.cam.work.order.program.knife.plan'].sudo().create({
'name': cnc_processing.workorder_id.production_id.name,
'programming_no': programming_no,
'cam_procedure_code': cnc_processing.program_name,
'filename': cnc_processing.cnc_id.name,
'functional_tool_name': cnc_processing.cutting_tool_name,
'cam_cutter_spacing_code': cnc_processing.cutting_tool_no,
'process_type': cnc_processing.processing_type,
'margin_x_y': float(cnc_processing.margin_x_y),
'margin_z': float(cnc_processing.margin_z),
'finish_depth': float(cnc_processing.depth_of_processing_z),
'extension_length': float(cnc_processing.cutting_tool_extension_length),
'shank_model': cnc_processing.cutting_tool_handle_type,
'estimated_processing_time': cnc_processing.estimated_processing_time,
})
logging.info('CAM工单程序用刀计划创建成功')
# 创建装刀请求
knife_plan.apply_for_tooling()
def unlink_cam_plan(self, production):
for item in production:

View File

@@ -283,21 +283,22 @@
<field name="arch" type="xml">
<tree create="0">
<field name="name" string="工单编码"/>
<field name="cam_procedure_code"/>
<field name="filename"/>
<field name="programming_no"/>
<field name="cam_procedure_code" optional="hide"/>
<field name="filename" optional="hide"/>
<field name="functional_tool_name" string="刀具名称"/>
<field name="cam_cutter_spacing_code"/>
<field name="diameter" optional="hide"/>
<field name="tool_included_angle" optional="hide"/>
<field name="process_type"/>
<field name="process_type" optional="hide"/>
<field name="margin_x_y"/>
<field name="margin_z"/>
<field name="finish_depth"/>
<field name="extension_length" string="刀具伸出长度(mm)"/>
<field name="shank_model"/>
<field name="estimated_processing_time"/>
<field name="need_knife_time"/>
<field name="applicant_time"/>
<field name="need_knife_time" optional="hide"/>
<field name="applicant_time" optional="hide"/>
<field name="plan_execute_status"/>
<field name="production_line_id" invisible="1"/>
@@ -332,6 +333,7 @@
</div>
<group>
<group>
<field name="programming_no"/>
<field name="cam_procedure_code"/>
<field name="filename"/>
<field name="production_line_id"/>
@@ -388,6 +390,7 @@
<field name="model">sf.cam.work.order.program.knife.plan</field>
<field name="arch" type="xml">
<search>
<field name="programming_no"/>
<field name="name" string="工单编码"/>
<field name="cam_procedure_code"/>
<field name="filename"/>