功能刀具计划(换刀申请和CAM工单程序用刀计划)视图已完成

This commit is contained in:
yuxianghui
2023-06-20 16:51:06 +08:00
parent 062b50d34c
commit 6caae0325a
4 changed files with 208 additions and 3 deletions

View File

@@ -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,99 @@ class FunctionalCuttingToolEntity(models.Model):
else:
new_code = '001'
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):
"""
装刀申请(按键)
"""