@@ -5,105 +5,283 @@ from odoo import fields, models, api
# class FunctionalCuttingToolEntity(models.Model):
# _name = 'sf.functional.cutting.tool.entity'
# _inherit = 'sf.functional.cutting.tool'
# _inherits = {'sf.functional.cutting.tool': 'sf_functional_cutting_tool_entity_id'}
# _description = '功能刀具管理'
class FunctionalCuttingToolEntity ( models . Model ) :
_name = ' sf.functional.cutting.tool.entity '
_description = ' 功能刀具管理 '
_inherits = { ' sf.functional.cutting.tool ' : ' sf_functional_cutting_tool_entity_id ' }
_description = ' 功能刀具列表 '
code = fields . Char ( ' 编码 ' )
name = fields . Char ( ' 名称 ' )
mrs_cutting_tool_type_id = fields . Many2one ( ' sf.functional.cutting.tool.model ' , string = ' 功能刀具类型 ' )
mrs_cutting_tool_model_id = fields . Many2one ( ' sf.cutting.tool.model ' , string = ' 刀具型号 ' )
# 整体式刀具型号
mrs_cutting_tool_integral_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_cutting_tool_entity_id ' ,
string = ' 整体式刀具型号 ' , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 整体式刀具 ' ) ] )
# 刀片型号
mrs_cutting_tool_blade_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' , ' sf_functional_cutting_tool_entity_id ' ,
string = ' 刀片型号 ' , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀片 ' ) ] )
# 刀杆型号
mrs_cutting_tool_cutterbar_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_cutting_tool_entity_id ' ,
string = ' 刀杆型号 ' , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀杆 ' ) ] )
# 刀盘型号
mrs_cutting_tool_cutterpad_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_cutting_tool_entity_id ' ,
string = ' 刀盘型号 ' , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀盘 ' ) ] )
# 刀柄型号
mrs_cutting_tool_cutterhandle_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_cutting_tool_entity_id ' ,
string = ' 刀柄型号 ' , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀柄 ' ) ] )
# 夹头型号
mrs_cutting_tool_cutterhead_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_cutting_tool_entity_id ' ,
string = ' 夹头型号 ' , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 夹头 ' ) ] )
diameter = fields . Float ( ' 直径(mm) ' )
tool_grade = fields . Selection ( [ ( ' 1 ' , ' P1 ' ) , ( ' 2 ' , ' P2 ' ) , ( ' 3 ' , ' P3 ' ) , ( ' 4 ' , ' P4 ' ) , ( ' 5 ' , ' P5 ' ) , ( ' 6 ' , ' P6 ' ) ] ,
string = ' 刀具等级 ' )
machining_accuracy = fields . Float ( ' 加工精度(mm) ' )
tool_length = fields . Float ( ' 装刀长 ' )
blade_number = fields . Integer ( ' 刃数 ' )
integral_blade_length = fields . Float ( ' 整体刃长(mm) ' )
effective_blade_length = fields . Float ( ' 有效刃长(mm) ' )
max_life = fields . Float ( ' 最大寿命值 ' )
is_standard = fields . Boolean ( ' 是否标准刀 ' )
applicable_range = fields . Char ( ' 适用范围 ' )
image = fields . Binary ( ' 图片 ' )
def _get_functional_tool_model_ids ( self , functional_tool_model_code ) :
functional_tool_model_ids = [ ]
for item in functional_tool_model_code :
functional_tool_model = self . env [ ' sf.cutting.tool.model ' ] . search ( [ ( ' code ' , ' = ' , item ) ] )
functional_tool_model_ids . append ( functional_tool_model . id )
return [ ( 6 , 0 , functional_tool_model_ids ) ]
class FunctionalToolWarning ( models . Model ) :
_name = ' sf.functional.tool.warning '
_description = ' 功能刀具预警 '
functional_cutting_tool_id = fields . Many2one ( ' sf.functional.cutting.tool.entity ' , ' 功能刀具 ' , readonly = True )
code = fields . Char ( ' 编码 ' , readonly = True )
name = fields . Char ( ' 名称 ' , invisible = True , readonly = True )
mrs_cutting_tool_type_id = fields . Many2one ( ' sf.functional.cutting.tool.model ' , string = ' 功能刀具类型 ' , readonly = True )
# 整体式刀具型号
mrs_cutting_tool_integral_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_tool_warning_id ' ,
string = ' 整体式刀具型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 整体式刀具 ' ) ] )
# 刀片型号
mrs_cutting_tool_blade_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_tool_warning_id ' ,
string = ' 刀片型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀片 ' ) ] )
# 刀杆型号
mrs_cutting_tool_cutterbar_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_tool_warning_id ' ,
string = ' 刀杆型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀杆 ' ) ] )
# 刀盘型号
mrs_cutting_tool_cutterpad_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_tool_warning_id ' ,
string = ' 刀盘型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀盘 ' ) ] )
# 刀柄型号
mrs_cutting_tool_cutterhandle_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_tool_warning_id ' ,
string = ' 刀柄型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀柄 ' ) ] )
# 夹头型号
mrs_cutting_tool_cutterhead_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_functional_tool_warning_id ' ,
string = ' 夹头型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 夹头 ' ) ] )
diameter = fields . Float ( ' 直径(mm) ' , readonly = True )
tool_grade = fields . Selection ( [ ( ' 1 ' , ' P1 ' ) , ( ' 2 ' , ' P2 ' ) , ( ' 3 ' , ' P3 ' ) , ( ' 4 ' , ' P4 ' ) , ( ' 5 ' , ' P5 ' ) , ( ' 6 ' , ' P6 ' ) ] ,
string = ' 刀具等级 ' , readonly = True )
machining_accuracy = fields . Float ( ' 加工精度(mm) ' , readonly = True )
tool_length = fields . Float ( ' 装刀长 ' , readonly = True )
blade_number = fields . Integer ( ' 刃数 ' , readonly = True )
integral_blade_length = fields . Float ( ' 整体刃长(mm) ' , readonly = True )
effective_blade_length = fields . Float ( ' 有效刃长(mm) ' , readonly = True )
max_life = fields . Float ( ' 最大寿命值 ' , readonly = True )
is_standard = fields . Boolean ( ' 是否标准刀 ' , readonly = True )
applicable_range = fields . Char ( ' 适用范围 ' , readonly = True )
image = fields . Binary ( ' 图片 ' , readonly = True )
# 新添加的关联到原模型的字段
sf_functional_cutting_tool_entity_id = fields . Many2one ( ' sf.functional.cutting.tool ' , ondelete = ' cascade ' )
order = fields . Char ( string = ' 序 ' )
functional_cutting_tool_id = fields . Char ( string = ' 功能刀具 ' , invisible = True )
# 功能刀具预警 特有字段
install_tool_time = fields . Char ( " 装刀时间 " )
outbound_time = fields . Char ( ' 出库时间 ' )
on_board_time = fields . Char ( ' 上机时间 ' )
machine_tool_code = fields . Char ( ' 机台号 ' )
cutting_tool_code = fields . Char ( ' 刀位号 ' )
idle_time = fields . Char ( ' 闲置时长 ' )
alarm_value = fields . Char ( ' 报警值 ' )
used_value = fields . Char ( ' 已使用值 ' )
alarm_type = fields . Char ( ' 报警类型 ' )
alarm_time = fields . Char ( ' 报警时间 ' )
dispose_user = fields . Char ( ' 处理人 ' )
dispose_time = fields . Char ( ' 处理时间 ' )
dispose_func = fields . Char ( ' 处理方法/措施 ' )
remark = fields . Char ( ' 备注 ' )
install_tool_time = fields . Char ( " 装刀时间 " , readonly = True )
outbound_time = fields . Char ( ' 出库时间 ' , readonly = True )
on_board_time = fields . Char ( ' 上机时间 ' , readonly = True )
machine_tool_code = fields . Char ( ' 机台号 ' , readonly = True )
cutting_tool_code = fields . Char ( ' 刀位号 ' , readonly = True )
idle_time = fields . Char ( ' 闲置时长 ' , readonly = True )
alarm_value = fields . Char ( ' 报警值 ' , readonly = True )
used_value = fields . Char ( ' 已使用值 ' , readonly = True )
alarm_type = fields . Char ( ' 报警类型 ' , readonly = True )
alarm_time = fields . Char ( ' 报警时间 ' , readonly = True )
dispose_user = fields . Char ( ' 处理人 ' , readonly = True )
dispose_time = fields . Char ( ' 处理时间 ' , readonly = True )
dispose_func = fields . Char ( ' 处理方法/措施 ' , readonly = True )
remark = fields . Char ( ' 备注 ' , readonly = True )
# 功能刀具出入库记录 特有字段
thickness = fields . Selection ( [ ( ' 1 ' , ' 粗 ' ) , ( ' 2 ' , ' 中 ' ) , ( ' 3 ' , ' 精 ' ) ] , string = ' 粗/中/精 ' )
max_life_span = fields . Char ( string = ' 最大寿命值 ' )
# alarm_value = fields.Char(string='报警值')
# used_value = fields.Char(string='已使用值')
current_state = fields . Char ( string = ' 当前状态 ' )
current_store_area = fields . Char ( string = ' 当前库区 ' )
current_store_place = fields . Char ( string = ' 当前库位 ' )
number = fields . Integer ( string = ' 数量 ' )
reason_application = fields . Char ( string = ' 申请原因 ' )
applicant = fields . Char ( string = ' 申请人 ' )
return_staff = fields . Char ( string = ' 归还人 ' )
return_time = fields . Date ( string = ' 归还入库时间 ' )
tool_state = fields . Char ( string = " 刀具状态 " )
tool_install_staff = fields . Char ( string = ' 装刀人 ' )
tool_install_time = fields . Datetime ( string = ' 装刀时间 ' )
receive_equipment = fields . Char ( string = ' 领用机台 ' )
receive_staff = fields . Char ( string = ' 领用人 ' )
receive_time = fields . Char ( string = ' 领用出库时间 ' )
# remark = fields.Text(string='备注/说明')
@api.onchange ( ' functional_cutting_tool_id ' )
def onchange_functional_cutting_tool_id ( self ) :
print ( self . functional_cutting_tool_id . name )
class RealTimeDistributionOfFunctionalTools ( models . Model ) :
_name = ' sf.real.time.distribution.of.functional.tools '
_description = ' 功能刀具实时分布 '
functional_cutting_tool_id = fields . Many2one ( ' sf.functional.cutting.tool.entity ' , ' 功能刀具 ' , readonly = True )
code = fields . Char ( ' 编码 ' , readonly = True )
name = fields . Char ( ' 名称 ' , invisible = True , readonly = True )
mrs_cutting_tool_type_id = fields . Many2one ( ' sf.functional.cutting.tool.model ' , string = ' 功能刀具类型 ' , readonly = True )
# 整体式刀具型号
mrs_cutting_tool_integral_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_real_time_distribution_of_functional_tools_id ' ,
string = ' 整体式刀具型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 整体式刀具 ' ) ] )
# 刀片型号
mrs_cutting_tool_blade_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_real_time_distribution_of_functional_tools_id ' ,
string = ' 刀片型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀片 ' ) ] )
# 刀杆型号
mrs_cutting_tool_cutterbar_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_real_time_distribution_of_functional_tools_id ' ,
string = ' 刀杆型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀杆 ' ) ] )
# 刀盘型号
mrs_cutting_tool_cutterpad_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_real_time_distribution_of_functional_tools_id ' ,
string = ' 刀盘型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀盘 ' ) ] )
# 刀柄型号
mrs_cutting_tool_cutterhandle_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_real_time_distribution_of_functional_tools_id ' ,
string = ' 刀柄型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀柄 ' ) ] )
# 夹头型号
mrs_cutting_tool_cutterhead_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_real_time_distribution_of_functional_tools_id ' ,
string = ' 夹头型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 夹头 ' ) ] )
diameter = fields . Float ( ' 直径(mm) ' , readonly = True )
tool_grade = fields . Selection ( [ ( ' 1 ' , ' P1 ' ) , ( ' 2 ' , ' P2 ' ) , ( ' 3 ' , ' P3 ' ) , ( ' 4 ' , ' P4 ' ) , ( ' 5 ' , ' P5 ' ) , ( ' 6 ' , ' P6 ' ) ] ,
string = ' 刀具等级 ' , readonly = True )
machining_accuracy = fields . Float ( ' 加工精度(mm) ' , readonly = True )
tool_length = fields . Float ( ' 装刀长 ' , readonly = True )
blade_number = fields . Integer ( ' 刃数 ' , readonly = True )
integral_blade_length = fields . Float ( ' 整体刃长(mm) ' , readonly = True )
effective_blade_length = fields . Float ( ' 有效刃长(mm) ' , readonly = True )
max_life = fields . Float ( ' 最大寿命值 ' , readonly = True )
is_standard = fields . Boolean ( ' 是否标准刀 ' , readonly = True )
applicable_range = fields . Char ( ' 适用范围 ' , readonly = True )
image = fields . Binary ( ' 图片 ' , readonly = True )
# 功能刀具实时分布
tool_stock_num = fields . Text ( string = ' 刀具房库存数量 ' )
side_shelf_num = fields . Text ( string = ' 线边货架货架数量 ' )
on_tool_stock_num = fields . Text ( string = ' 机内刀库库存数量 ' )
tool_stock_total = fields . Text ( string = ' 合计 ' )
return_reuse_num_re = fields . Text ( string = ' 归还再用数量(精) ' )
return_reuse_num_co = fields . Text ( string = ' 归还再用数量(粗) ' )
return_processing_num = fields . Text ( string = ' 归还需磨削数量 ' )
return_total = fields . Text ( string = ' 合计 ' )
total = fields . Text ( string = ' 总计 ' )
tool_stock_num = fields . Char ( string = ' 刀具房库存数量 ' , readonly = True )
side_shelf_num = fields . Char ( string = ' 线边货架货架数量 ' , readonly = True )
on_tool_stock_num = fields . Char ( string = ' 机内刀库库存数量 ' , readonly = True )
tool_stock_total = fields . Char ( string = ' 合计 ' , readonly = True )
return_reuse_num_re = fields . Char ( string = ' 归还再用数量(精) ' , readonly = True )
return_reuse_num_co = fields . Char ( string = ' 归还再用数量(粗) ' , readonly = True )
return_processing_num = fields . Char ( string = ' 归还需磨削数量 ' , readonly = True )
return_total = fields . Char ( string = ' 合计 ' , readonly = True )
total = fields . Char ( string = ' 总计 ' , readonly = True )
remark = fields . Char ( string = ' 备注/说明 ' , readonly = True )
# remark = fields.Char(string='备注/说明')
# @api.onchange('functional_cutting_tool_id')
# def get_functional_cutting_tool_info(self):
# for item in self:
# item.code = item.functional_cutting_tool_id.code,
# item.name = item.functional_cutting_tool_id.name,
# item.functional_model_number = item.functional_cutting_tool_id.functional_model_number,
# item.integral_model_number = item.functional_cutting_tool_id.integral_model_number,
# item.blade_model_number = item.functional_cutting_tool_id.blade_model_number,
# item.cutterbar_model_number = item.functional_cutting_tool_id.cutterbar_model_number,
# item.cutterpad_model_number = item.functional_cutting_tool_id.cutterpad_model_number,
# item.handle_model_number = item.functional_cutting_tool_id.handle_model_number,
# item.chuck_model_number = item.functional_cutting_tool_id.chuck_model_number,
# item.diameter = item.functional_cutting_tool_id.diameter,
# item.tool_grade = item.functional_cutting_tool_id.tool_grade,
# item.machining_accuracy = item.functional_cutting_tool_id.machining_accuracy,
# item.ctool_lengthode = item.functional_cutting_tool_id.tool_length,
# item.blade_number = item.functional_cutting_tool_id.blade_number,
# item.integral_blade_length = item.functional_cutting_tool_id.integral_blade_length,
# item.effective_blade_length = item.functional_cutting_tool_id.effective_blade_length,
# item.max_life = item.functional_cutting_tool_id.max_life,
# item.is_standard = item.functional_cutting_tool_id.is_standard,
# item.applicable_range = item.functional_cutting_tool_id.applicable_range,
class InboundAndOutboundRecordsOfFunctionalTools ( models . Model ) :
_name = ' sf.inbound.and.outbound.records.of.functional.tools '
_description = ' 功能刀具出入库记录 '
@api.model
def create ( self , vals ) :
functional_cutting_tool_id = fields . Many2one ( ' sf.functional.cutting.tool.entity ' , ' 功能刀具 ' , readonly = True )
co de = fields . Char ( ' 编码 ' , readonly = True )
name = fields . Char ( ' 名称 ' , invisible = True , readonly = True )
mrs_cutting_tool_type_id = fields . Many2one ( ' sf.functional.cutting.tool.model ' , string = ' 功能刀具类型 ' , readonly = True )
if not vals . get ( ' order ' ) :
vals [ ' order ' ] = self . _generate_code ( )
return super ( FunctionalCuttingToolEntity , self ) . create ( vals )
# 整体式刀具型号
mrs_cutting_tool_integral_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_inbound_and_outbound_records_of_functional_tools_id ' ,
string = ' 整体式刀具型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 整体式刀具 ' ) ] )
# 刀片型号
mrs_cutting_tool_blade_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_inbound_and_outbound_records_of_functional_tools_id ' ,
string = ' 刀片型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀片 ' ) ] )
# 刀杆型号
mrs_cutting_tool_cutterbar_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_inbound_and_outbound_records_of_functional_tools_id ' ,
string = ' 刀杆型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀杆 ' ) ] )
# 刀盘型号
mrs_cutting_tool_cutterpad_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_inbound_and_outbound_records_of_functional_tools_id ' ,
string = ' 刀盘型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀盘 ' ) ] )
# 刀柄型号
mrs_cutting_tool_cutterhandle_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_inbound_and_outbound_records_of_functional_tools_id ' ,
string = ' 刀柄型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 刀柄 ' ) ] )
# 夹头型号
mrs_cutting_tool_cutterhead_model_ids = fields . Many2many ( ' sf.cutting.tool.model ' ,
' sf_inbound_and_outbound_records_of_functional_tools_id ' ,
string = ' 夹头型号 ' , readonly = True , domain =
[ ( ' mrs_cutting_tool_material_name ' , ' = ' , ' 夹头 ' ) ] )
@api.model
def _generate_code ( self ) :
last_tool = self . search ( [ ] , order = ' id desc ' , limit = 1 )
if last_tool :
last_code = int ( last_tool . code . spli t( ' - ' ) [ - 1 ] )
new_code = ' {:03d} ' . format ( last_code + 1 )
els e :
new_code = ' 001 '
return new_code
diameter = fields . Float ( ' 直径(mm) ' , readonly = True )
tool_gra de = fields . Selection ( [ ( ' 1 ' , ' P1 ' ) , ( ' 2 ' , ' P2 ' ) , ( ' 3 ' , ' P3 ' ) , ( ' 4 ' , ' P4 ' ) , ( ' 5 ' , ' P5 ' ) , ( ' 6 ' , ' P6 ' ) ] ,
string = ' 刀具等级 ' , readonly = True )
machining_accuracy = fields . Float ( ' 加工精度(mm) ' , readonly = True )
tool_length = fields . Floa t( ' 装刀长 ' , readonly = True )
blade_number = fields . Integer ( ' 刃数 ' , readonly = True )
integral_blade_length = fields . Float ( ' 整体刃长(mm) ' , readonly = Tru e)
effective_blade_length = fields . Float ( ' 有效刃长(mm) ' , readonly = True )
max_life = fields . Float ( ' 最大寿命值 ' , readonly = True )
is_standard = fields . Boolean ( ' 是否标准刀 ' , readonly = True )
applicable_range = fields . Char ( ' 适用范围 ' , readonly = True )
image = fields . Binary ( ' 图片 ' , readonly = True )
# 功能刀具出入库记录 特有字段
thickness = fields . Selection ( [ ( ' 1 ' , ' 粗 ' ) , ( ' 2 ' , ' 中 ' ) , ( ' 3 ' , ' 精 ' ) ] , string = ' 粗/中/精 ' , readonly = True )
max_life_span = fields . Char ( string = ' 最大寿命值 ' , readonly = True )
alarm_value = fields . Char ( string = ' 报警值 ' , readonly = True )
used_value = fields . Char ( string = ' 已使用值 ' , readonly = True )
current_state = fields . Char ( string = ' 当前状态 ' , readonly = True )
current_store_area = fields . Char ( string = ' 当前库区 ' , readonly = True )
current_store_place = fields . Char ( string = ' 当前库位 ' , readonly = True )
number = fields . Integer ( string = ' 数量 ' , readonly = True )
reason_application = fields . Char ( string = ' 申请原因 ' , readonly = True )
applicant = fields . Char ( string = ' 申请人 ' , readonly = True )
return_staff = fields . Char ( string = ' 归还人 ' , readonly = True )
return_time = fields . Date ( string = ' 归还入库时间 ' , readonly = True )
tool_state = fields . Char ( string = " 刀具状态 " , readonly = True )
tool_install_staff = fields . Char ( string = ' 装刀人 ' , readonly = True )
tool_install_time = fields . Datetime ( string = ' 装刀时间 ' , readonly = True )
receive_equipment = fields . Char ( string = ' 领用机台 ' , readonly = True )
receive_staff = fields . Char ( string = ' 领用人 ' , readonly = True )
receive_time = fields . Char ( string = ' 领用出库时间 ' , readonly = True )
remark = fields . Text ( string = ' 备注/说明 ' , readonly = True )
class MachineTableToolChangingApply ( models . Model ) :
@@ -116,34 +294,34 @@ class MachineTableToolChangingApply(models.Model):
# string='换刀需求信息',
# attrs="{'invisible': 1}")
name = fields . Char ( string = ' CNC机床 ' )
name = fields . Char ( string = ' CNC机床 ' , readonly = " True " )
# todo 机床类型和刀位号 为 Many2one
machine_table_type = fields . Char ( string = ' 机床类型 ' )
machine_table_type = fields . Char ( string = ' 机床类型 ' , readonly = " True " )
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 = ' 功能刀具名称 ' )
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 = ' 功能刀具类型 ' )
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 = ' 正常 ' )
functional_tool_type = fields . Char ( string = ' 功能刀具类型 ' , readonly = " True " )
diameter = fields . Char ( string = ' 直径 ' , readonly = " True " )
coarse_middle_thin = fields . Selection ( [ ( " 1 " , " 粗 " ) , ( ' 2 ' , ' 中 ' ) , ( ' 3 ' , ' 精 ' ) ] , string = ' 粗/中/精 ' , readonly = " True " )
hilt_name = fields . Char ( string = ' 刀柄名称 ' , readonly = " True " )
hilt_code = fields . Char ( string = ' 刀柄编号 ' , readonly = " True " )
max_lifetime_value = fields . Char ( string = ' 最大寿命值 ' , readonly = " True " )
alarm_value = fields . Char ( string = ' 报警值 ' , readonly = " True " )
used_value = fields . Char ( string = ' 已使用值 ' , readonly = " True " )
functional_tool_status = fields . Selection ( [ ( ' 正常 ' , ' 正常 ' ) , ( ' 异常 ' , ' 异常 ' ) ] , string = ' 功能刀具状态 ' , default = ' 正常 ' , readonly = " True " )
replacement_tool_code = fields . Char ( string = ' 待换刀具编码 ' )
replacement_tool_name = fields . Char ( string = ' 待换刀具名称 ' )
replacement_tool_type = fields . Char ( string = ' 待换刀具类型 ' )
replacement_tool_code = fields . Char ( string = ' 待换刀具编码 ' , readonly = " True " )
replacement_tool_name = fields . Char ( string = ' 待换刀具名称 ' , readonly = " True " )
replacement_tool_type = fields . Char ( string = ' 待换刀具类型 ' , readonly = " True " )
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 = ' 备注说明 ' )
string = ' 粗/中/精 ' , readonly = " True " )
new_former = fields . Selection ( [ ( ' 0 ' , ' 新 ' ) , ( ' 1 ' , ' 旧 ' ) ] , string = ' 新/旧 ' , readonly = " True " )
applicant = fields . Char ( string = ' 申请人 ' , readonly = " True " )
used_tool_time = fields . Datetime ( string = ' 用刀时间 ' , readonly = " True " )
reason_for_applying = fields . Char ( string = ' 申请原因 ' , readonly = " True " )
remark = fields . Char ( string = ' 备注说明 ' , readonly = " True " )
status = fields . Selection ( [ ( ' 0 ' , ' 未操作 ' ) , ( ' 1 ' , ' 已换刀申请 ' ) , ( ' 2 ' , ' 已转移 ' ) ] , string = ' 操作状态 ' , default = ' 0 ' )
@@ -240,27 +418,28 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
_name = ' sf.cam.work.order.program.knife.plan '
_description = ' CAM工单程序用刀计划 '
name = 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 = ' 计划执行状态 ' , default = ' 0 ' )
applicant = fields . Char ( string = ' 申请人 ' )
reason_for_applying = fields . Char ( string = ' 申请原因 ' )
remark = fields . Char ( string = ' 备注说明 ' )
name = fields . Char ( string = ' 工单任务编号 ' , readonly = True )
cam_procedure_code = fields . Char ( string = ' CAM程序编号 ' , 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 )
machine_table_name = fields . Char ( string = ' 机床名称 ' , readonly = True )
machine_tool_cutter_spacing_code = 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 )
required_cutting_time = fields . Char ( string = ' 需要切割时间 ' , readonly = True )
whether_standard_tool = fields . Boolean ( string = ' 是否标准刀 ' , readonly = True )
need_knife_time = fields . Datetime ( string = ' 需要用刀时间 ' , readonly = True )
plan_execute_status = fields . Selection ( [ ( ' 0 ' , ' 待下发 ' ) , ( ' 1 ' , ' 执行中 ' ) , ( ' 2 ' , ' 已完成 ' ) ] ,
string = ' 计划执行状态 ' , default = ' 0 ' , readonly = True )
applicant = fields . Char ( string = ' 申请人 ' , readonly = True )
reason_for_applying = fields . Char ( string = ' 申请原因 ' , readonly = True )
remark = fields . Char ( string = ' 备注说明 ' , readonly = True )
def automation_apply_for_tooling ( self ) :
"""
@@ -309,44 +488,45 @@ class FunctionalToolAssembly(models.Model):
_description = ' 功能刀具组装 '
_order = ' use_tool_time asc '
functional_tool_code = fields . Char ( string = ' 功能刀具编码 ' )
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 = ' 功能刀具切削类型 ' )
functional_tool_code = fields . Char ( string = ' 功能刀具编码 ' , readonly = True )
name = fields . Char ( string = ' 功能刀具名称 ' , readonly = True )
functional_tool_type = fields . Char ( string = ' 功能刀具类型 ' , readonly = True )
functional_tool_diameter = fields . Char ( string = ' 功能刀具直径 ' , readonly = True )
functional_tool_length = fields . Char ( string = ' 功能刀具伸出长 ' , readonly = True )
functional_tool_cutting_type = fields . Char ( string = ' 功能刀具切削类型 ' , readonly = True )
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 = ' 已切削次数 ' )
tool_name = fields . Char ( string = ' 刀具名称 ' , readonly = True )
tool_brand = fields . Char ( string = ' 品牌 ' , readonly = True )
tool_type = fields . Char ( string = ' 型号 ' , readonly = True )
knife_handle_name = fields . Char ( string = ' 刀柄名称 ' , readonly = True )
knife_handle_brand = fields . Char ( string = ' 品牌 ' , readonly = True )
knife_handle_type = fields . Char ( string = ' 型号 ' , readonly = True )
coarse_middle_thin = fields . Selection ( [ ( " 1 " , " 粗 " ) , ( ' 2 ' , ' 中 ' ) , ( ' 3 ' , ' 精 ' ) ] , string = ' 粗/中/精 ' , readonly = True )
tool_loading_length = fields . Char ( string = ' 装刀长 ' , readonly = True )
new_former = fields . Selection ( [ ( ' 0 ' , ' 新 ' ) , ( ' 1 ' , ' 旧 ' ) ] , string = ' 新/旧 ' , readonly = True )
reference_length = fields . Char ( string = ' 参考伸出长 ' , readonly = True )
cut_time = fields . Char ( string = ' 已切削时间 ' , readonly = True )
cut_length = fields . Char ( string = ' 已切削长度 ' , readonly = True )
cut_number = fields . Char ( string = ' 已切削次数 ' , readonly = True )
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 = ' 备注说明 ' )
loading_task_source = fields . Selection ( [ ( ' 0 ' , ' CAM装刀 ' ) , ( ' 1 ' , ' 机台换刀 ' ) ] , string = ' 装刀任务来源 ' , readonly = True )
applicant = fields . Char ( string = ' 申请人 ' , readonly = True )
reason_for_applying = fields . Char ( string = ' 申请原因 ' , readonly = True )
apply_time = fields . Datetime ( string = ' 申请时间 ' , default = fields . Datetime . now ( ) , readonly = True )
assemble_status = fields . Selection ( [ ( ' 0 ' , ' 待组装 ' ) , ( ' 1 ' , ' 已组装 ' ) , ( ' 2 ' , ' 已出库 ' ) ] , string = ' 组装状态 ' , default = ' 0 ' , readonly = True )
use_tool_time = fields . Datetime ( string = ' 用刀时间 ' , readonly = True )
production_line_name = fields . Char ( string = ' 产线名称 ' , readonly = True )
machine_tool_name = fields . Char ( string = ' 机床名称 ' , readonly = True )
machine_tool_code = fields . Char ( string = ' 机台号 ' , readonly = True )
cutter_spacing_code = fields . Char ( string = ' 刀位号 ' , readonly = True )
check_box_1 = fields . Boolean ( string = ' 复选框 ' , default = Fals e)
tool_loading_person = fields . Char ( string = ' 装刀人 ' , readonly = Tru e)
tool_loading_time = fields . Datetime ( string = ' 装刀时间 ' , readonly = True )
receive_person = fields . Char ( string = ' 领用人 ' , readonly = True )
receive_time = fields . Datetime ( string = ' 领用出库时间 ' , readonly = True )
remark = fields . Char ( string = ' 备注说明 ' , readonly = True )
check_box_1 = fields . Boolean ( string = ' 复选框 ' , default = False , readonly = True )
@api.onchange ( ' assemble_status ' )
def check_box ( self ) :