同步刀具标准库
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['account', 'base', 'mrp_workorder', 'sale', 'sf_maintenance'],
|
||||
'depends': ['account', 'base', 'mrp_workorder', 'sale'],
|
||||
'data': [
|
||||
'security/group_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
||||
@@ -3,6 +3,7 @@ from . import common
|
||||
from . import tool_base_new
|
||||
from . import fixture
|
||||
from . import functional_fixture
|
||||
from . import tool_other_features
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -148,10 +148,10 @@ class CuttingToolModel(models.Model):
|
||||
'适合冷却液', domain=[('type', '=', '冷却液')])
|
||||
compaction_way_ids = fields.Many2many('maintenance.equipment.image', 'compaction_way_library_rel',
|
||||
'压紧方式', domain=[('type', '=', '压紧方式')])
|
||||
# tool_materials_basic_parameters_ids = fields.One2many('mrs.tool.materials.basic.parameters',
|
||||
# 'cutting_tool_model_id', string='基本参数')
|
||||
# cutting_speed_ids = fields.One2many('mrs.cutting.speed', 'cutting_tool_model_id', string='切削速度Vc')
|
||||
# feed_per_tooth_ids = fields.One2many('mrs.feed.per.tooth', 'cutting_tool_model_id', '每齿走刀量fz')
|
||||
basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'standard_library_id', string='基本参数')
|
||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'standard_library_id', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz')
|
||||
|
||||
material_model_id = fields.Many2one('sf.materials.model', '材料型号')
|
||||
nut = fields.Float('配对螺母(mm)')
|
||||
@@ -204,3 +204,48 @@ class CuttingToolModel(models.Model):
|
||||
|
||||
def get_cutter_bar_ids(self):
|
||||
return self.cutter_bar_ids
|
||||
|
||||
|
||||
class MaintenanceStandardImage(models.Model):
|
||||
_name = 'maintenance.equipment.image'
|
||||
_description = '能力特征库'
|
||||
|
||||
active = fields.Boolean('有效', default=True)
|
||||
name = fields.Char('名称')
|
||||
image = fields.Binary(string='图文')
|
||||
type = fields.Selection(
|
||||
[('加工能力', '加工能力'), ('刀尖特征', '刀尖特征'), ('柄部类型', '柄部类型'), ('走刀方向', '走刀方向'),
|
||||
('冷却液', '冷却液'), ('压紧方式', '压紧方式'), ('刀片形状', '刀片形状')],
|
||||
string='特征')
|
||||
equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备')
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
# 调用父类的name_search方法,获取原始的结果列表
|
||||
res = super().name_search(name, args, operator, limit)
|
||||
# 定义一个空字典用来存储id和name的映射关系
|
||||
name_dict = {}
|
||||
# 遍历结果列表,将id和name存入字典中
|
||||
for item in res:
|
||||
id = item[0]
|
||||
name = item[1]
|
||||
name_dict[id] = name
|
||||
# 根据id列表搜索符合条件的记录
|
||||
records = self.browse(name_dict.keys())
|
||||
# 定义一个新的结果列表用来存储修改后的结果
|
||||
new_res = []
|
||||
# 遍历每条记录
|
||||
for record in records:
|
||||
# 获取记录的id,name和image属性
|
||||
id = record.id
|
||||
name = name_dict[id]
|
||||
image = record.image
|
||||
# 如果image不为空,将其转换为data URI scheme
|
||||
if image:
|
||||
data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
|
||||
else:
|
||||
data_uri = ""
|
||||
# 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
|
||||
new_res.append([id, name, data_uri])
|
||||
# 返回新的结果列表
|
||||
return new_res
|
||||
|
||||
282
sf_base/models/tool_other_features.py
Normal file
282
sf_base/models/tool_other_features.py
Normal file
@@ -0,0 +1,282 @@
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class ToolMaterialsBasicParameters(models.Model):
|
||||
_name = 'sf.tool.materials.basic.parameters'
|
||||
_description = '刀具物料基本参数'
|
||||
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库')
|
||||
cutting_tool_type = fields.Char(related='standard_library_id.cutting_tool_type', string='刀具物料类型',
|
||||
store=True)
|
||||
# cutting_tool_type_1 = fields.Char(related='cutting_tool_type', string='类型', store=True)
|
||||
|
||||
# 整体式刀具参数
|
||||
code = fields.Char('物料号', size=50)
|
||||
total_length = fields.Char('总长度(mm)', size=20)
|
||||
blade_number = fields.Selection(
|
||||
[('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')],
|
||||
string='刃数(个)')
|
||||
neck_diameter = fields.Char('颈部直径(mm)', size=20)
|
||||
neck_length = fields.Char('颈部长度(mm)', size=20)
|
||||
handle_diameter = fields.Char('柄部直径(mm)', size=20)
|
||||
handle_length = fields.Char('柄部长度(mm)', size=20)
|
||||
blade_tip_diameter = fields.Char('刀尖直径(mm)', size=20)
|
||||
blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20)
|
||||
blade_tip_taper = fields.Integer('刀尖锥度(°)')
|
||||
blade_diameter = fields.Char('刃部直径(mm)', size=20)
|
||||
blade_length = fields.Char('刃部长度(mm)', size=20)
|
||||
blade_helix_angle = fields.Integer('刃部螺旋角(°)')
|
||||
blade_width = fields.Char('刃部宽度(mm)', size=20)
|
||||
blade_depth = fields.Char('刃部深度(mm)', size=20)
|
||||
pitch = fields.Char('牙距(mm)', size=20)
|
||||
cutting_depth = fields.Char('切削深度(mm)', size=20)
|
||||
# 刀片参数
|
||||
length = fields.Char('长度(mm)', size=20)
|
||||
thickness = fields.Char('厚度(mm)', size=20)
|
||||
width = fields.Char('宽度(mm)', size=20)
|
||||
cutting_blade_length = fields.Char('切削刃长(mm)', size=20)
|
||||
relief_angle = fields.Integer('后角(°)')
|
||||
blade_tip_circular_arc_radius = fields.Char('刀尖圆弧半径(mm)', size=20)
|
||||
inscribed_circle_diameter = fields.Char('内接圆直径(mm)', size=20)
|
||||
install_aperture_diameter = fields.Char('安装孔直径(mm)', size=20)
|
||||
chip_breaker_groove = fields.Selection([('无', '无'), ('单面', '单面'), ('双面', '双面')],
|
||||
string='有无断屑槽')
|
||||
blade_teeth_model = fields.Selection(
|
||||
[('V牙型', 'V牙型'), ('米制全牙型', '米制全牙型'), ('美制全牙型', '美制全牙型'),
|
||||
('惠氏全牙型', '惠氏全牙型'), ('BSPT全牙型', 'BSPT全牙型'), ('NPT全牙型', 'NPT全牙型'),
|
||||
('UNJ全牙型', 'UNJ全牙型'), ('DIN405圆牙型', 'DIN405圆牙型'), ('ACME梯形', 'ACME梯形'),
|
||||
('石油管螺纹刀片', '石油管螺纹刀片'), ('矮牙ACME梯形', '矮牙ACME梯形'),
|
||||
('Trapeze30° 103', 'Trapeze30° 103')], string='刀片牙型')
|
||||
blade_blade_number = fields.Selection([('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'),
|
||||
('7', '7'), ('8', '8'), ('9', '9'), ('10', '10')],
|
||||
string='刀片的刃数(个)')
|
||||
main_included_angle = fields.Integer('主偏角(°)')
|
||||
top_angle = fields.Integer('顶角(°)')
|
||||
blade_tip_dip_angle = fields.Integer('刀尖倾角(°)')
|
||||
side_cutting_edge_angle = fields.Integer('侧切削角(°)')
|
||||
thread_model = fields.Selection([('外螺纹', '外螺纹'), ('内螺纹', '内螺纹')], string='螺纹类型')
|
||||
thread_num = fields.Char('每英寸螺纹数(TPI)', size=20)
|
||||
blade_tip_height_tolerance = fields.Char('刀尖高度公差(mm)', size=20)
|
||||
inscribed_circle_tolerance = fields.Char('内接圆公差(mm)', size=20)
|
||||
thickness_tolerance = fields.Char('厚度公差(mm)', size=20)
|
||||
# 刀杆参数
|
||||
height = fields.Char('高度(mm)', size=20)
|
||||
blade_height = fields.Char('刃部高度(mm)', size=20)
|
||||
cutter_arbor_diameter = fields.Char('刀杆直径(mm)', size=20)
|
||||
min_machining_aperture = fields.Char('最小加工孔径(mm)', size=20)
|
||||
install_blade_tip_num = fields.Char('可装刀片数/齿数(个)', size=20)
|
||||
cutting_blade_model = fields.Char('切削类型', size=20)
|
||||
cooling_hole = fields.Selection([('有', '有'), ('无', '无')], string='有无冷却孔')
|
||||
locating_slot_code = fields.Char('定位槽代号', size=20)
|
||||
installing_structure = fields.Char('安装结构', size=20)
|
||||
blade_ids = fields.Many2many(
|
||||
'sf.cutting.tool.type',
|
||||
relation='basic_param_pad_blade_rel',
|
||||
column1='model_id_1',
|
||||
column2='model_id_2',
|
||||
domain="[('cutting_tool_material_id.name', '=', '刀片')]",
|
||||
string='适配刀片型号' # 使用空列表作为默认值
|
||||
)
|
||||
tool_shim = fields.Char('适配刀垫型号', size=50)
|
||||
cotter_pin = fields.Char('适配销钉型号', size=50)
|
||||
pressing_plate = fields.Char('适配压板型号', size=50)
|
||||
screw = fields.Char('适配螺钉型号', size=50)
|
||||
spanner = fields.Char('适配扳手型号', size=50)
|
||||
# 刀盘参数
|
||||
cutter_head_diameter = fields.Char('刀盘直径(mm)', size=20)
|
||||
interface_diameter = fields.Char('接口直径(mm)', size=20)
|
||||
# 刀柄参数
|
||||
flange_shank_length = fields.Char('法兰柄长(mm)', size=20)
|
||||
handle_external_diameter = fields.Char('柄部外径(mm)', size=20)
|
||||
handle_inside_diameter = fields.Char('柄部内径(mm)', size=20)
|
||||
min_clamping_diameter = fields.Char('最小夹持直径(mm)', size=20)
|
||||
max_clamping_diameter = fields.Char('最大夹持直径(mm)', size=20)
|
||||
clamping_mode = fields.Char('夹持方式', size=20)
|
||||
max_load_capacity = fields.Char('最大负载能力(kg)', size=20)
|
||||
taper = fields.Integer('锥度(°)')
|
||||
tool_changing_time = fields.Integer('换刀时间(s)')
|
||||
standard_rotate_speed = fields.Char('标准转速(n/min)', size=20)
|
||||
max_rotate_speed = fields.Char('最大转速(n/min)', size=20)
|
||||
diameter_slip_accuracy = fields.Char('径跳精度(mm)', size=20)
|
||||
cooling_model = fields.Char('冷却类型', size=20)
|
||||
is_rough_machining = fields.Selection([('是', '是'), ('否', '否')], string='是否可粗加工')
|
||||
is_finish_machining = fields.Selection([('是', '是'), ('否', '否')], string='是否可精加工')
|
||||
is_quick_cutting = fields.Selection([('是', '是'), ('否', '否')], string='是否可高速切削')
|
||||
is_drill_hole = fields.Selection([('是', '是'), ('否', '否')], string='是否可钻孔')
|
||||
is_safe_lock = fields.Selection([('是', '是'), ('否', '否')], string='有无安全锁')
|
||||
# 夹头参数
|
||||
er_size_model = fields.Char('ER尺寸型号', size=20)
|
||||
outer_diameter = fields.Char('外径(mm)', size=20)
|
||||
inner_diameter = fields.Char('内径(mm)', size=20)
|
||||
run_out_accuracy = fields.Char('跳动精度(mm)', size=20)
|
||||
top_diameter = fields.Char('顶部直径(mm)', size=20)
|
||||
weight = fields.Char('重量(kg)', size=20)
|
||||
clamping_length = fields.Char('夹持长度(mm)', size=20)
|
||||
clamping_tolerance = fields.Char('夹持公差(mm)', size=20)
|
||||
handle_ids = fields.Many2many(
|
||||
'sf.cutting.tool.type',
|
||||
relation='basic_param_chuck_handle_rel',
|
||||
column1='model_id_1',
|
||||
column2='model_id_2',
|
||||
domain="[('cutting_tool_material_id.name', '=', '刀柄')]",
|
||||
string='适用刀柄型号'
|
||||
)
|
||||
|
||||
def _json_basic_param(self, obj):
|
||||
basic_param_str = [0, '', {
|
||||
'code': obj['code'],
|
||||
'total_length': obj['total_length'],
|
||||
'blade_number': obj['blade_number'],
|
||||
'neck_diameter': obj['neck_diameter'],
|
||||
'neck_length': obj['neck_length'],
|
||||
'handle_diameter': obj['handle_diameter'],
|
||||
'handle_length': obj['handle_length'],
|
||||
'blade_tip_diameter': obj['blade_tip_diameter'],
|
||||
'blade_tip_working_size': obj['blade_tip_working_size'],
|
||||
'blade_tip_taper': obj['blade_tip_taper'],
|
||||
'blade_diameter': obj['blade_diameter'],
|
||||
'blade_length': obj['blade_length'],
|
||||
'blade_helix_angle': obj['blade_helix_angle'],
|
||||
'blade_width': obj['blade_width'],
|
||||
'blade_depth': obj['blade_depth'],
|
||||
'pitch': obj['pitch'],
|
||||
'cutting_depth': obj['cutting_depth'],
|
||||
'length': obj['length'],
|
||||
'thickness': obj['thickness'],
|
||||
'width': obj['width'],
|
||||
'cutting_blade_length': obj['cutting_blade_length'],
|
||||
'relief_angle': obj['relief_angle'],
|
||||
'blade_tip_circular_arc_radius': obj['blade_tip_circular_arc_radius'],
|
||||
'inscribed_circle_diameter': obj['inscribed_circle_diameter'],
|
||||
'install_aperture_diameter': obj['install_aperture_diameter'],
|
||||
'chip_breaker_groove': obj['chip_breaker_groove'],
|
||||
'blade_teeth_model': obj['bladed_teeth_model'],
|
||||
'blade_blade_number': obj['blade_blade_number'],
|
||||
'main_included_angle': obj['main_included_angle'],
|
||||
'top_angle': obj['top_angle'],
|
||||
'blade_tip_dip_angle': obj['blade_tip_dip_angle'],
|
||||
'side_cutting_edge_angle': obj['side_cutting_edge_angle'],
|
||||
'thread_model': obj['thread_model'],
|
||||
'thread_num': obj['thread_num'],
|
||||
'blade_tip_height_tolerance': obj['blade_tip_height_tolerance'],
|
||||
'inscribed_circle_tolerance': obj['inscribed_circle_tolerance'],
|
||||
'thickness_tolerance': obj['thickness_tolerance'],
|
||||
'height': obj['height'],
|
||||
'blade_height': obj['blade_height'],
|
||||
'cutter_arbor_diameter': obj['cutter_arbor_diameter'],
|
||||
'min_machining_aperture': obj['min_machining_aperture'],
|
||||
'install_blade_tip_num': obj['install_blade_tip_num'],
|
||||
'cutting_blade_model': obj['cutting_blade_model'],
|
||||
'cooling_hole': obj['cooling_hole'],
|
||||
'locating_slot_code': obj['locating_slot_code'],
|
||||
'installing_structure': obj['installing_structure'],
|
||||
'tool_shim': obj['tool_shim'],
|
||||
'cotter_pin': obj['cotter_pin'],
|
||||
'pressing_plate': obj['pressing_plate'],
|
||||
'screw': obj['screw'],
|
||||
'spanner': obj['spanner'],
|
||||
'cutter_head_diameter': obj['cutter_head_diameter'],
|
||||
'interface_diameter': obj['interface_diameter'],
|
||||
'flange_shank_length': obj['flange_shank_length'],
|
||||
'handle_external_diameter': obj['handle_external_diameter'],
|
||||
'handle_inside_diameter': obj['handle_inside_diameter'],
|
||||
'min_clamping_diameter': obj['min_clamping_diameter'],
|
||||
'max_clamping_diameter': obj['max_clamping_diameter'],
|
||||
'clamping_mode': obj['clamping_mode'],
|
||||
'max_load_capacity': obj['max_load_capacity'],
|
||||
'taper': obj['taper'],
|
||||
'tool_changing_time': obj['tool_changing_time'],
|
||||
'standard_rotate_speed': obj['standard_rotate_speed'],
|
||||
'max_rotate_speed': obj['max_rotate_speed'],
|
||||
'diameter_slip_accuracy': obj['diameter_slip_accuracy'],
|
||||
'cooling_model': obj['cooling_model'],
|
||||
'is_rough_machining': obj['is_rough_machining'],
|
||||
'is_finish_machining': obj['is_finish_machining'],
|
||||
'is_quick_cutting': obj['is_quick_cutting'],
|
||||
'is_drill_hole': obj['is_drill_hole'],
|
||||
'is_safe_lock': obj['is_safe_lock'],
|
||||
'er_size_model': obj['er_size_model'],
|
||||
'outer_diameter': obj['outer_diameter'],
|
||||
'inner_diameter': obj['inner_diameter'],
|
||||
'run_out_accuracy': obj['run_out_accuracy'],
|
||||
'top_diameter': obj['top_diameter'],
|
||||
'weight': obj['weight'],
|
||||
'clamping_length': obj['clamping_length'],
|
||||
'clamping_tolerance': obj['clamping_tolerance'],
|
||||
'handle_ids': obj['weight'],
|
||||
'blade_ids': obj['clamping_length'],
|
||||
}]
|
||||
return basic_param_str
|
||||
|
||||
|
||||
class CuttingSpeed(models.Model):
|
||||
_name = 'sf.cutting.speed'
|
||||
_description = '切削速度Vc'
|
||||
|
||||
# product_template_id = fields.Many2one('product.template', string='产品')
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
||||
execution_standard_id = fields.Char('执行标准')
|
||||
material_code = fields.Char('材料代号')
|
||||
material_name = fields.Char('材料名称')
|
||||
material_grade = fields.Char('材料牌号')
|
||||
tensile_strength = fields.Float('拉伸强度 (N/mm²)')
|
||||
hardness = fields.Float('硬度(HRC)')
|
||||
cutting_speed_n1 = fields.Char('径向切宽 ae=100%D1 ap=1*D1 切削速度Vc')
|
||||
cutting_speed_n2 = fields.Char('径向切宽 ae=50%D1 ap=1.5*D1 切削速度Vc')
|
||||
cutting_speed_n3 = fields.Char('径向切宽 ae=25%D1 ap=L1max 切削速度Vc')
|
||||
cutting_speed_n4 = fields.Char('径向切宽 ae=15%D1 ap=L1max 切削速度Vc')
|
||||
cutting_speed_n5 = fields.Char('径向切宽 ae=5%D1 ap=L1max 切削速度Vc')
|
||||
rough_machining = fields.Char('粗加工 Vc(m/min)')
|
||||
precision_machining = fields.Char('精加工 Vc(m/min)')
|
||||
application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
|
||||
|
||||
def _json_cutting_speed(self, obj):
|
||||
cutting_speed_str = [0, '', {
|
||||
'execution_standard_id': obj['execution_standard_id'],
|
||||
'material_code': obj['material_code'],
|
||||
'material_name': obj['material_name'],
|
||||
'material_grade': obj['material_grade'],
|
||||
'tensile_strength': obj['tensile_strength'],
|
||||
'hardness': obj['hardness'],
|
||||
'cutting_speed_n1': obj['cutting_speed_n1'],
|
||||
'cutting_speed_n2': obj['cutting_speed_n2'],
|
||||
'cutting_speed_n3': obj['cutting_speed_n3'],
|
||||
'cutting_speed_n4': obj['cutting_speed_n4'],
|
||||
'cutting_speed_n5': obj['cutting_speed_n5'],
|
||||
'rough_machining': obj['rough_machining'],
|
||||
'precision_machining': obj['precision_machining'],
|
||||
'application': obj['application'],
|
||||
}]
|
||||
return cutting_speed_str
|
||||
|
||||
|
||||
class FeedPerTooth(models.Model):
|
||||
_name = 'sf.feed.per.tooth'
|
||||
_description = '每齿走刀量fz'
|
||||
|
||||
# product_template_id = fields.Many2one('product.template', string='产品')
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
||||
|
||||
cutting_speed = fields.Char('径向切宽 ae(mm)')
|
||||
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
|
||||
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
||||
# blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True,
|
||||
# related='product_template_id.cutting_tool_blade_diameter')
|
||||
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
|
||||
unit = fields.Char('单位', default='fz')
|
||||
|
||||
def _json_feed_per_tooth(self, obj):
|
||||
feed_per_tooth_str = [0, '', {
|
||||
'cutting_speed': obj['cutting_speed'],
|
||||
'machining_method': obj['machining_method'],
|
||||
'materials_type_id': obj['materials_type_id'],
|
||||
# 'blade_diameter': obj['blade_diameter'],
|
||||
'feed_per_tooth': obj['feed_per_tooth'],
|
||||
'unit': obj['unit'],
|
||||
}]
|
||||
return feed_per_tooth_str
|
||||
|
||||
# @api.depends('product_template_id')
|
||||
# def _compute_product_template_id(self):
|
||||
# if self.product_template_id is not None:
|
||||
# self.blade_diameter = self.product_template_id.cutting_tool_blade_diameter
|
||||
@@ -15,7 +15,6 @@ access_sf_production_process_category,sf_production_process_category,model_sf_pr
|
||||
access_sf_machine_tool_category,sf_machine_tool_category,model_sf_machine_tool_category,base.group_user,1,1,1,1
|
||||
access_sf_cutting_tool_material,sf_cutting_tool_material,model_sf_cutting_tool_material,base.group_user,1,1,1,1
|
||||
access_sf_cutting_tool_type,sf_cutting_tool_type,model_sf_cutting_tool_type,base.group_user,1,1,1,1
|
||||
access_sf_cutting_tool_model,sf_cutting_tool_model,model_sf_cutting_tool_model,base.group_user,1,1,1,1
|
||||
access_sf_functional_cutting_tool,sf_functional_cutting_tool,model_sf_functional_cutting_tool,base.group_user,1,1,1,1
|
||||
access_sf_functional_cutting_tool_model,sf_functional_cutting_tool_model,model_sf_functional_cutting_tool_model,base.group_user,1,1,1,1
|
||||
access_sf_fixture_material,sf_fixture_material,model_sf_fixture_material,base.group_user,1,1,1,1
|
||||
@@ -27,6 +26,11 @@ access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,
|
||||
access_sf_international_standards,sf_international_standards,model_sf_international_standards,base.group_user,1,1,1,1
|
||||
access_material_apply,material_apply,model_material_apply,base.group_user,1,1,1,1
|
||||
access_sf_cutting_tool_standard_library,sf_cutting_tool_standard_library,model_sf_cutting_tool_standard_library,base.group_user,1,1,1,1
|
||||
access_sf_tool_materials_basic_parameters,sf_tool_materials_basic_parameters,model_sf_tool_materials_basic_parameters,base.group_user,1,1,1,1
|
||||
access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
|
||||
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1
|
||||
access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -85,5 +85,12 @@
|
||||
action="action_sf_functional_cutting_tool_model_type"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_maintenance_equipment_image"
|
||||
name="能力特征库"
|
||||
parent="menu_sf_cutting_tool"
|
||||
action="action_maintenance_equipment_image"
|
||||
sequence="5"/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -359,4 +359,43 @@
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- ================================================能力特征库================================================ -->
|
||||
<record id="view_maintenance_equipment_image_tree" model="ir.ui.view">
|
||||
<field name="name">maintenance.equipment.image.tree</field>
|
||||
<field name="model">maintenance.equipment.image</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="能力特征库" editable="bottom" delete="0" create="0" >
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="type" readonly="1"/>
|
||||
<field name="image" widget="image" readonly="1"/>
|
||||
<field name="equipment_id" />
|
||||
<field name="active" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_maintenance_equipment_image_search">
|
||||
<field name="name">maintenance.equipment.image.search</field>
|
||||
<field name="model">maintenance.equipment.image</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
<searchpanel class="account_root">
|
||||
<field name="type" icon="fa-filter" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_maintenance_equipment_image" model="ir.actions.act_window">
|
||||
<field name="name">能力特征库</field>
|
||||
<field name="res_model">maintenance.equipment.image</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -10,12 +10,13 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['mrp', 'base', 'sale', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting', 'purchase_stock',
|
||||
'uom','jikimo_frontend'],
|
||||
'depends': ['mrp', 'base', 'sale', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting',
|
||||
'purchase_stock',
|
||||
'uom', 'jikimo_frontend', 'product'],
|
||||
'data': [
|
||||
'data/product_data.xml',
|
||||
'data/uom_data.xml',
|
||||
'views/product_template_view.xml',
|
||||
# 'views/product_template_view.xml',
|
||||
'views/product_workorder.xml'
|
||||
],
|
||||
'demo': [
|
||||
|
||||
@@ -296,9 +296,9 @@
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<field name="cutting_tool_er_size_model"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<field name="cutting_tool_handle_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<!-- <field name="cutting_tool_handle_ids" widget="many2many_tags"-->
|
||||
<!-- options="{'no_create': True}"-->
|
||||
<!-- attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>-->
|
||||
<field name="cooling_suit_type_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
|
||||
|
||||
@@ -567,50 +567,6 @@ class SfMaintenanceEquipment(models.Model):
|
||||
image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='设备图文')
|
||||
|
||||
|
||||
class MaintenanceStandardImage(models.Model):
|
||||
_name = 'maintenance.equipment.image'
|
||||
_description = '能力特征库'
|
||||
|
||||
active = fields.Boolean('有效', default=True)
|
||||
name = fields.Char('名称')
|
||||
image = fields.Binary(string='图文')
|
||||
type = fields.Selection(
|
||||
[('加工能力', '加工能力'), ('刀尖特征', '刀尖特征'), ('柄部类型', '柄部类型'), ('走刀方向', '走刀方向'),
|
||||
('冷却液', '冷却液'), ('压紧方式', '压紧方式'), ('刀片形状', '刀片形状')],
|
||||
string='特征')
|
||||
equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备')
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
# 调用父类的name_search方法,获取原始的结果列表
|
||||
res = super().name_search(name, args, operator, limit)
|
||||
# 定义一个空字典用来存储id和name的映射关系
|
||||
name_dict = {}
|
||||
# 遍历结果列表,将id和name存入字典中
|
||||
for item in res:
|
||||
id = item[0]
|
||||
name = item[1]
|
||||
name_dict[id] = name
|
||||
# 根据id列表搜索符合条件的记录
|
||||
records = self.browse(name_dict.keys())
|
||||
# 定义一个新的结果列表用来存储修改后的结果
|
||||
new_res = []
|
||||
# 遍历每条记录
|
||||
for record in records:
|
||||
# 获取记录的id,name和image属性
|
||||
id = record.id
|
||||
name = name_dict[id]
|
||||
image = record.image
|
||||
# 如果image不为空,将其转换为data URI scheme
|
||||
if image:
|
||||
data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
|
||||
else:
|
||||
data_uri = ""
|
||||
# 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
|
||||
new_res.append([id, name, data_uri])
|
||||
# 返回新的结果列表
|
||||
return new_res
|
||||
|
||||
class SfRobotAxisNum(models.Model):
|
||||
_name = 'sf.robot.axis.num'
|
||||
_description = '机器人轴参数'
|
||||
|
||||
@@ -4,7 +4,6 @@ access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,base.gr
|
||||
access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,base.group_user,1,1,1,1
|
||||
access_maintenance_standards,maintenance_standards,model_maintenance_standards,base.group_user,1,1,1,1
|
||||
access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,base.group_user,1,1,1,1
|
||||
access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1
|
||||
access_sf_robot_axis_num,sf_robot_axis_num,model_sf_robot_axis_num,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
@@ -949,48 +949,6 @@
|
||||
<!-- groups="maintenance.group_equipment_manager,base.group_user"-->
|
||||
<!-- sequence="1"/-->
|
||||
<!-- 设备图文展示-->
|
||||
<record id="view_maintenance_equipment_image_tree" model="ir.ui.view">
|
||||
<field name="name">maintenance.equipment.image.tree</field>
|
||||
<field name="model">maintenance.equipment.image</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="能力特征库" editable="bottom" delete="0" create="0" >
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="type" readonly="1"/>
|
||||
<field name="image" widget="image" readonly="1"/>
|
||||
<field name="equipment_id" />
|
||||
<field name="active" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_maintenance_equipment_image_search">
|
||||
<field name="name">maintenance.equipment.image.search</field>
|
||||
<field name="model">maintenance.equipment.image</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
<searchpanel class="account_root">
|
||||
<field name="type" icon="fa-filter" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_maintenance_equipment_image" model="ir.actions.act_window">
|
||||
<field name="name">能力特征库</field>
|
||||
<field name="res_model">maintenance.equipment.image</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="maintenance_equipment_image_form"
|
||||
name="能力特征库"
|
||||
parent="maintenance.menu_m_request"
|
||||
action="action_maintenance_equipment_image"
|
||||
groups="maintenance.group_equipment_manager,base.group_user"
|
||||
sequence="2"/>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -8,7 +8,6 @@ from . import mrp_routing_workcenter
|
||||
from . import stock
|
||||
from . import res_user
|
||||
from . import production_line_base
|
||||
from . import tool_other_features
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -178,8 +178,8 @@ class ResProductMo(models.Model):
|
||||
# if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最小(min)不能为0")
|
||||
|
||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
|
||||
# cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
|
||||
# feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
@@ -272,14 +272,14 @@ class ResProductMo(models.Model):
|
||||
cooling_suit_type_ids = fields.Char('适用冷却套型号')
|
||||
# cooling_suit_type_ids = fields.Many2many('冷却类型')
|
||||
cutting_tool_er_size_model = fields.Char('ER尺寸型号')
|
||||
cutting_tool_handle_ids = fields.Many2many(
|
||||
'sf.cutting.tool.model',
|
||||
relation='product_cutting_tool_model_chuck_handle_rel',
|
||||
column1='model_id_1',
|
||||
column2='model_id_2',
|
||||
domain="[('cutting_tool_type', '=', '刀柄')]",
|
||||
string='适用刀柄型号'
|
||||
)
|
||||
# cutting_tool_handle_ids = fields.Many2many(
|
||||
# 'sf.cutting.tool.model',
|
||||
# relation='product_cutting_tool_model_chuck_handle_rel',
|
||||
# column1='model_id_1',
|
||||
# column2='model_id_2',
|
||||
# domain="[('cutting_tool_type', '=', '刀柄')]",
|
||||
# string='适用刀柄型号'
|
||||
# )
|
||||
# 夹具参数
|
||||
fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料")
|
||||
fixture_model_id = fields.Many2one('sf.fixture.model', string="夹具型号")
|
||||
|
||||
@@ -1,225 +1,226 @@
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class SuitableMachiningMethod(models.Model):
|
||||
_name = 'sf.suitable.machining.method'
|
||||
_description = '适合加工方式'
|
||||
class ToolMaterialsBasicParameters(models.Model):
|
||||
_name = 'sf.tool.materials.basic.parameters'
|
||||
_description = '刀具物料基本参数'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库')
|
||||
cutting_tool_type = fields.Char(related='cutting_tool_model_id.cutting_tool_type', string='刀具物料类型',
|
||||
store=True)
|
||||
# cutting_tool_type_1 = fields.Char(related='cutting_tool_type', string='类型', store=True)
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
# 调用父类的name_search方法,获取原始的结果列表
|
||||
res = super().name_search(name, args, operator, limit)
|
||||
# 定义一个空字典用来存储id和name的映射关系
|
||||
name_dict = {}
|
||||
# 遍历结果列表,将id和name存入字典中
|
||||
for item in res:
|
||||
id = item[0]
|
||||
name = item[1]
|
||||
name_dict[id] = name
|
||||
# 根据id列表搜索符合条件的记录
|
||||
records = self.browse(name_dict.keys())
|
||||
# 定义一个新的结果列表用来存储修改后的结果
|
||||
new_res = []
|
||||
# 遍历每条记录
|
||||
for record in records:
|
||||
# 获取记录的id,name和image属性
|
||||
id = record.id
|
||||
name = name_dict[id]
|
||||
image = record.image
|
||||
# 如果image不为空,将其转换为data URI scheme
|
||||
if image:
|
||||
data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
|
||||
else:
|
||||
data_uri = ""
|
||||
# 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
|
||||
new_res.append([id, name, data_uri])
|
||||
# 返回新的结果列表
|
||||
return new_res
|
||||
# 整体式刀具参数
|
||||
code = fields.Char('物料号', size=50)
|
||||
total_length = fields.Char('总长度(mm)', size=20)
|
||||
blade_number = fields.Selection(
|
||||
[('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')],
|
||||
string='刃数(个)')
|
||||
neck_diameter = fields.Char('颈部直径(mm)', size=20)
|
||||
neck_length = fields.Char('颈部长度(mm)', size=20)
|
||||
handle_diameter = fields.Char('柄部直径(mm)', size=20)
|
||||
handle_length = fields.Char('柄部长度(mm)', size=20)
|
||||
blade_tip_diameter = fields.Char('刀尖直径(mm)', size=20)
|
||||
blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20)
|
||||
blade_tip_taper = fields.Integer('刀尖锥度(°)')
|
||||
blade_diameter = fields.Char('刃部直径(mm)', size=20)
|
||||
blade_length = fields.Char('刃部长度(mm)', size=20)
|
||||
blade_helix_angle = fields.Integer('刃部螺旋角(°)')
|
||||
blade_width = fields.Char('刃部宽度(mm)', size=20)
|
||||
blade_depth = fields.Char('刃部深度(mm)', size=20)
|
||||
pitch = fields.Char('牙距(mm)', size=20)
|
||||
cutting_depth = fields.Char('切削深度(mm)', size=20)
|
||||
# 刀片参数
|
||||
length = fields.Char('长度(mm)', size=20)
|
||||
thickness = fields.Char('厚度(mm)', size=20)
|
||||
width = fields.Char('宽度(mm)', size=20)
|
||||
cutting_blade_length = fields.Char('切削刃长(mm)', size=20)
|
||||
relief_angle = fields.Integer('后角(°)')
|
||||
blade_tip_circular_arc_radius = fields.Char('刀尖圆弧半径(mm)', size=20)
|
||||
inscribed_circle_diameter = fields.Char('内接圆直径(mm)', size=20)
|
||||
install_aperture_diameter = fields.Char('安装孔直径(mm)', size=20)
|
||||
chip_breaker_groove = fields.Selection([('无', '无'), ('单面', '单面'), ('双面', '双面')],
|
||||
string='有无断屑槽')
|
||||
blade_teeth_model = fields.Selection(
|
||||
[('V牙型', 'V牙型'), ('米制全牙型', '米制全牙型'), ('美制全牙型', '美制全牙型'),
|
||||
('惠氏全牙型', '惠氏全牙型'), ('BSPT全牙型', 'BSPT全牙型'), ('NPT全牙型', 'NPT全牙型'),
|
||||
('UNJ全牙型', 'UNJ全牙型'), ('DIN405圆牙型', 'DIN405圆牙型'), ('ACME梯形', 'ACME梯形'),
|
||||
('石油管螺纹刀片', '石油管螺纹刀片'), ('矮牙ACME梯形', '矮牙ACME梯形'),
|
||||
('Trapeze30° 103', 'Trapeze30° 103')], string='刀片牙型')
|
||||
blade_blade_number = fields.Selection([('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'),
|
||||
('7', '7'), ('8', '8'), ('9', '9'), ('10', '10')],
|
||||
string='刀片的刃数(个)')
|
||||
main_included_angle = fields.Integer('主偏角(°)')
|
||||
top_angle = fields.Integer('顶角(°)')
|
||||
blade_tip_dip_angle = fields.Integer('刀尖倾角(°)')
|
||||
side_cutting_edge_angle = fields.Integer('侧切削角(°)')
|
||||
thread_model = fields.Selection([('外螺纹', '外螺纹'), ('内螺纹', '内螺纹')], string='螺纹类型')
|
||||
thread_num = fields.Char('每英寸螺纹数(TPI)', size=20)
|
||||
blade_tip_height_tolerance = fields.Char('刀尖高度公差(mm)', size=20)
|
||||
inscribed_circle_tolerance = fields.Char('内接圆公差(mm)', size=20)
|
||||
thickness_tolerance = fields.Char('厚度公差(mm)', size=20)
|
||||
# 刀杆参数
|
||||
height = fields.Char('高度(mm)', size=20)
|
||||
blade_height = fields.Char('刃部高度(mm)', size=20)
|
||||
cutter_arbor_diameter = fields.Char('刀杆直径(mm)', size=20)
|
||||
min_machining_aperture = fields.Char('最小加工孔径(mm)', size=20)
|
||||
install_blade_tip_num = fields.Char('可装刀片数/齿数(个)', size=20)
|
||||
cutting_blade_model = fields.Char('切削类型', size=20)
|
||||
cooling_hole = fields.Selection([('有', '有'), ('无', '无')], string='有无冷却孔')
|
||||
locating_slot_code = fields.Char('定位槽代号', size=20)
|
||||
installing_structure = fields.Char('安装结构', size=20)
|
||||
blade_ids = fields.Many2many(
|
||||
'sf.cutting.tool.type',
|
||||
relation='cutting_tool_type_library_pad_blade_rel',
|
||||
column1='model_id_1',
|
||||
column2='model_id_2',
|
||||
domain="[('cutting_tool_material_id.name', '=', '刀片')]",
|
||||
string='适配刀片型号' # 使用空列表作为默认值
|
||||
)
|
||||
tool_shim = fields.Char('适配刀垫型号', size=50)
|
||||
cotter_pin = fields.Char('适配销钉型号', size=50)
|
||||
pressing_plate = fields.Char('适配压板型号', size=50)
|
||||
screw = fields.Char('适配螺钉型号', size=50)
|
||||
spanner = fields.Char('适配扳手型号', size=50)
|
||||
# 刀盘参数
|
||||
cutter_head_diameter = fields.Char('刀盘直径(mm)', size=20)
|
||||
interface_diameter = fields.Char('接口直径(mm)', size=20)
|
||||
# 刀柄参数
|
||||
flange_shank_length = fields.Char('法兰柄长(mm)', size=20)
|
||||
handle_external_diameter = fields.Char('柄部外径(mm)', size=20)
|
||||
handle_inside_diameter = fields.Char('柄部内径(mm)', size=20)
|
||||
min_clamping_diameter = fields.Char('最小夹持直径(mm)', size=20)
|
||||
max_clamping_diameter = fields.Char('最大夹持直径(mm)', size=20)
|
||||
clamping_mode = fields.Char('夹持方式', size=20)
|
||||
max_load_capacity = fields.Char('最大负载能力(kg)', size=20)
|
||||
taper = fields.Integer('锥度(°)')
|
||||
tool_changing_time = fields.Integer('换刀时间(s)')
|
||||
standard_rotate_speed = fields.Char('标准转速(n/min)', size=20)
|
||||
max_rotate_speed = fields.Char('最大转速(n/min)', size=20)
|
||||
diameter_slip_accuracy = fields.Char('径跳精度(mm)', size=20)
|
||||
cooling_model = fields.Char('冷却类型', size=20)
|
||||
is_rough_machining = fields.Selection([('是', '是'), ('否', '否')], string='是否可粗加工')
|
||||
is_finish_machining = fields.Selection([('是', '是'), ('否', '否')], string='是否可精加工')
|
||||
is_quick_cutting = fields.Selection([('是', '是'), ('否', '否')], string='是否可高速切削')
|
||||
is_drill_hole = fields.Selection([('是', '是'), ('否', '否')], string='是否可钻孔')
|
||||
is_safe_lock = fields.Selection([('是', '是'), ('否', '否')], string='有无安全锁')
|
||||
# 夹头参数
|
||||
er_size_model = fields.Char('ER尺寸型号', size=20)
|
||||
outer_diameter = fields.Char('外径(mm)', size=20)
|
||||
inner_diameter = fields.Char('内径(mm)', size=20)
|
||||
run_out_accuracy = fields.Char('跳动精度(mm)', size=20)
|
||||
top_diameter = fields.Char('顶部直径(mm)', size=20)
|
||||
weight = fields.Char('重量(kg)', size=20)
|
||||
clamping_length = fields.Char('夹持长度(mm)', size=20)
|
||||
clamping_tolerance = fields.Char('夹持公差(mm)', size=20)
|
||||
handle_ids = fields.Many2many(
|
||||
'sf.cutting.tool.type',
|
||||
relation='cutting_tool_type_library_chuck_handle_rel',
|
||||
column1='model_id_1',
|
||||
column2='model_id_2',
|
||||
domain="[('cutting_tool_material_id.name', '=', '刀柄')]",
|
||||
string='适用刀柄型号'
|
||||
)
|
||||
|
||||
|
||||
class BladeTipCharacteristics(models.Model):
|
||||
_name = 'sf.blade.tip.characteristics'
|
||||
_description = '刀尖特征'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
# 调用父类的name_search方法,获取原始的结果列表
|
||||
res = super().name_search(name, args, operator, limit)
|
||||
# 定义一个空字典用来存储id和name的映射关系
|
||||
name_dict = {}
|
||||
# 遍历结果列表,将id和name存入字典中
|
||||
for item in res:
|
||||
id = item[0]
|
||||
name = item[1]
|
||||
name_dict[id] = name
|
||||
# 根据id列表搜索符合条件的记录
|
||||
records = self.browse(name_dict.keys())
|
||||
# 定义一个新的结果列表用来存储修改后的结果
|
||||
new_res = []
|
||||
# 遍历每条记录
|
||||
for record in records:
|
||||
# 获取记录的id,name和image属性
|
||||
id = record.id
|
||||
name = name_dict[id]
|
||||
image = record.image
|
||||
# 如果image不为空,将其转换为data URI scheme
|
||||
if image:
|
||||
data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
|
||||
else:
|
||||
data_uri = ""
|
||||
# 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
|
||||
new_res.append([id, name, data_uri])
|
||||
# 返回新的结果列表
|
||||
return new_res
|
||||
|
||||
|
||||
class HandleType(models.Model):
|
||||
_name = 'sf.handle.type'
|
||||
_description = '柄部类型'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
# 调用父类的name_search方法,获取原始的结果列表
|
||||
res = super().name_search(name, args, operator, limit)
|
||||
# 定义一个空字典用来存储id和name的映射关系
|
||||
name_dict = {}
|
||||
# 遍历结果列表,将id和name存入字典中
|
||||
for item in res:
|
||||
id = item[0]
|
||||
name = item[1]
|
||||
name_dict[id] = name
|
||||
# 根据id列表搜索符合条件的记录
|
||||
records = self.browse(name_dict.keys())
|
||||
# 定义一个新的结果列表用来存储修改后的结果
|
||||
new_res = []
|
||||
# 遍历每条记录
|
||||
for record in records:
|
||||
# 获取记录的id,name和image属性
|
||||
id = record.id
|
||||
name = name_dict[id]
|
||||
image = record.image
|
||||
# 如果image不为空,将其转换为data URI scheme
|
||||
if image:
|
||||
data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
|
||||
else:
|
||||
data_uri = ""
|
||||
# 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
|
||||
new_res.append([id, name, data_uri])
|
||||
# 返回新的结果列表
|
||||
return new_res
|
||||
|
||||
|
||||
class CuttingDirection(models.Model):
|
||||
_name = 'sf.cutting.direction'
|
||||
_description = '走刀方向'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
# 调用父类的name_search方法,获取原始的结果列表
|
||||
res = super().name_search(name, args, operator, limit)
|
||||
# 定义一个空字典用来存储id和name的映射关系
|
||||
name_dict = {}
|
||||
# 遍历结果列表,将id和name存入字典中
|
||||
for item in res:
|
||||
id = item[0]
|
||||
name = item[1]
|
||||
name_dict[id] = name
|
||||
# 根据id列表搜索符合条件的记录
|
||||
records = self.browse(name_dict.keys())
|
||||
# 定义一个新的结果列表用来存储修改后的结果
|
||||
new_res = []
|
||||
# 遍历每条记录
|
||||
for record in records:
|
||||
# 获取记录的id,name和image属性
|
||||
id = record.id
|
||||
name = name_dict[id]
|
||||
image = record.image
|
||||
# 如果image不为空,将其转换为data URI scheme
|
||||
if image:
|
||||
data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
|
||||
else:
|
||||
data_uri = ""
|
||||
# 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
|
||||
new_res.append([id, name, data_uri])
|
||||
# 返回新的结果列表
|
||||
return new_res
|
||||
|
||||
|
||||
class SuitableCoolant(models.Model):
|
||||
_name = 'sf.suitable.coolant'
|
||||
_description = '适合冷却液'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
# 调用父类的name_search方法,获取原始的结果列表
|
||||
res = super().name_search(name, args, operator, limit)
|
||||
# 定义一个空字典用来存储id和name的映射关系
|
||||
name_dict = {}
|
||||
# 遍历结果列表,将id和name存入字典中
|
||||
for item in res:
|
||||
id = item[0]
|
||||
name = item[1]
|
||||
name_dict[id] = name
|
||||
# 根据id列表搜索符合条件的记录
|
||||
records = self.browse(name_dict.keys())
|
||||
# 定义一个新的结果列表用来存储修改后的结果
|
||||
new_res = []
|
||||
# 遍历每条记录
|
||||
for record in records:
|
||||
# 获取记录的id,name和image属性
|
||||
id = record.id
|
||||
name = name_dict[id]
|
||||
image = record.image
|
||||
# 如果image不为空,将其转换为data URI scheme
|
||||
if image:
|
||||
data_uri = f"data:image/png;base64,{image.decode('utf-8')}"
|
||||
else:
|
||||
data_uri = ""
|
||||
# 将这三个属性组成一个数组,并添加到结果列表中 result.append([id, name, data_uri]) # 返回结果列表 return result
|
||||
new_res.append([id, name, data_uri])
|
||||
# 返回新的结果列表
|
||||
return new_res
|
||||
def _json_basic_param(self, obj):
|
||||
basic_param_str = [0, '', {
|
||||
'code': obj['code'],
|
||||
'total_length': obj['total_length'],
|
||||
'blade_number': obj['blade_number'],
|
||||
'neck_diameter': obj['neck_diameter'],
|
||||
'neck_length': obj['neck_length'],
|
||||
'handle_diameter': obj['handle_diameter'],
|
||||
'handle_length': obj['handle_length'],
|
||||
'blade_tip_diameter': obj['blade_tip_diameter'],
|
||||
'blade_tip_working_size': obj['blade_tip_working_size'],
|
||||
'blade_tip_taper': obj['blade_tip_taper'],
|
||||
'blade_diameter': obj['blade_diameter'],
|
||||
'blade_length': obj['blade_length'],
|
||||
'blade_helix_angle': obj['blade_helix_angle'],
|
||||
'blade_width': obj['blade_width'],
|
||||
'blade_depth': obj['blade_depth'],
|
||||
'pitch': obj['pitch'],
|
||||
'cutting_depth': obj['cutting_depth'],
|
||||
'length': obj['length'],
|
||||
'thickness': obj['thickness'],
|
||||
'width': obj['width'],
|
||||
'cutting_blade_length': obj['cutting_blade_length'],
|
||||
'relief_angle': obj['relief_angle'],
|
||||
'blade_tip_circular_arc_radius': obj['blade_tip_circular_arc_radius'],
|
||||
'inscribed_circle_diameter': obj['inscribed_circle_diameter'],
|
||||
'install_aperture_diameter': obj['install_aperture_diameter'],
|
||||
'chip_breaker_groove': obj['chip_breaker_groove'],
|
||||
'blade_teeth_model': obj['bladed_teeth_model'],
|
||||
'blade_blade_number': obj['blade_blade_number'],
|
||||
'main_included_angle': obj['main_included_angle'],
|
||||
'top_angle': obj['top_angle'],
|
||||
'blade_tip_dip_angle': obj['blade_tip_dip_angle'],
|
||||
'side_cutting_edge_angle': obj['side_cutting_edge_angle'],
|
||||
'thread_model': obj['thread_model'],
|
||||
'thread_num': obj['thread_num'],
|
||||
'blade_tip_height_tolerance': obj['blade_tip_height_tolerance'],
|
||||
'inscribed_circle_tolerance': obj['inscribed_circle_tolerance'],
|
||||
'thickness_tolerance': obj['thickness_tolerance'],
|
||||
'height': obj['height'],
|
||||
'blade_height': obj['blade_height'],
|
||||
'cutter_arbor_diameter': obj['cutter_arbor_diameter'],
|
||||
'min_machining_aperture': obj['min_machining_aperture'],
|
||||
'install_blade_tip_num': obj['install_blade_tip_num'],
|
||||
'cutting_blade_model': obj['cutting_blade_model'],
|
||||
'cooling_hole': obj['cooling_hole'],
|
||||
'locating_slot_code': obj['locating_slot_code'],
|
||||
'installing_structure': obj['installing_structure'],
|
||||
'tool_shim': obj['tool_shim'],
|
||||
'cotter_pin': obj['cotter_pin'],
|
||||
'pressing_plate': obj['pressing_plate'],
|
||||
'screw': obj['screw'],
|
||||
'spanner': obj['spanner'],
|
||||
'cutter_head_diameter': obj['cutter_head_diameter'],
|
||||
'interface_diameter': obj['interface_diameter'],
|
||||
'flange_shank_length': obj['flange_shank_length'],
|
||||
'handle_external_diameter': obj['handle_external_diameter'],
|
||||
'handle_inside_diameter': obj['handle_inside_diameter'],
|
||||
'min_clamping_diameter': obj['min_clamping_diameter'],
|
||||
'max_clamping_diameter': obj['max_clamping_diameter'],
|
||||
'clamping_mode': obj['clamping_mode'],
|
||||
'max_load_capacity': obj['max_load_capacity'],
|
||||
'taper': obj['taper'],
|
||||
'tool_changing_time': obj['tool_changing_time'],
|
||||
'standard_rotate_speed': obj['standard_rotate_speed'],
|
||||
'max_rotate_speed': obj['max_rotate_speed'],
|
||||
'diameter_slip_accuracy': obj['diameter_slip_accuracy'],
|
||||
'cooling_model': obj['cooling_model'],
|
||||
'is_rough_machining': obj['is_rough_machining'],
|
||||
'is_finish_machining': obj['is_finish_machining'],
|
||||
'is_quick_cutting': obj['is_quick_cutting'],
|
||||
'is_drill_hole': obj['is_drill_hole'],
|
||||
'is_safe_lock': obj['is_safe_lock'],
|
||||
'er_size_model': obj['er_size_model'],
|
||||
'outer_diameter': obj['outer_diameter'],
|
||||
'inner_diameter': obj['inner_diameter'],
|
||||
'run_out_accuracy': obj['run_out_accuracy'],
|
||||
'top_diameter': obj['top_diameter'],
|
||||
'weight': obj['weight'],
|
||||
'clamping_length': obj['clamping_length'],
|
||||
'clamping_tolerance': obj['clamping_tolerance'],
|
||||
'handle_ids': obj['weight'],
|
||||
'blade_ids': obj['clamping_length'],
|
||||
}]
|
||||
return basic_param_str
|
||||
|
||||
|
||||
class CuttingSpeed(models.Model):
|
||||
_name = 'sf.cutting.speed'
|
||||
_description = '切削速度Vc'
|
||||
|
||||
# def _get_order(self):
|
||||
# last_tool = self.search([], order='id desc', limit=1)
|
||||
# if last_tool:
|
||||
# last_order = int(last_tool.order)
|
||||
# new_order = last_order + 1
|
||||
# else:
|
||||
# new_order = '1'
|
||||
# return new_order
|
||||
#
|
||||
# order = fields.Char('序', default=_get_order, readonly=True)
|
||||
|
||||
product_template_id = fields.Many2one('product.template', string='产品')
|
||||
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
||||
execution_standard_id = fields.Char('执行标准')
|
||||
material_code = fields.Char('材料代号')
|
||||
material_name = fields.Char('材料名称')
|
||||
material_grade = fields.Char('材料牌号')
|
||||
tensile_strength = fields.Float('拉伸强度 (N/mm²)')
|
||||
hardness = fields.Float('硬度(HRC)')
|
||||
|
||||
cutting_speed_n1 = fields.Char('径向切宽 ae=100%D1 ap=1*D1 切削速度Vc')
|
||||
cutting_speed_n2 = fields.Char('径向切宽 ae=50%D1 ap=1.5*D1 切削速度Vc')
|
||||
cutting_speed_n3 = fields.Char('径向切宽 ae=25%D1 ap=L1max 切削速度Vc')
|
||||
@@ -229,20 +230,52 @@ class CuttingSpeed(models.Model):
|
||||
precision_machining = fields.Char('精加工 Vc(m/min)')
|
||||
application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
|
||||
|
||||
def _json_cutting_speed(self, obj):
|
||||
cutting_speed_str = [0, '', {
|
||||
'execution_standard_id': obj['execution_standard_id'],
|
||||
'material_code': obj['material_code'],
|
||||
'material_name': obj['material_name'],
|
||||
'material_grade': obj['material_grade'],
|
||||
'tensile_strength': obj['tensile_strength'],
|
||||
'hardness': obj['hardness'],
|
||||
'cutting_speed_n1': obj['cutting_speed_n1'],
|
||||
'cutting_speed_n2': obj['cutting_speed_n2'],
|
||||
'cutting_speed_n3': obj['cutting_speed_n3'],
|
||||
'cutting_speed_n4': obj['cutting_speed_n4'],
|
||||
'cutting_speed_n5': obj['cutting_speed_n5'],
|
||||
'rough_machining': obj['rough_machining'],
|
||||
'precision_machining': obj['precision_machining'],
|
||||
'application': obj['application'],
|
||||
}]
|
||||
return cutting_speed_str
|
||||
|
||||
|
||||
class FeedPerTooth(models.Model):
|
||||
_name = 'sf.feed.per.tooth'
|
||||
_description = '每齿走刀量fz'
|
||||
|
||||
product_template_id = fields.Many2one('product.template', string='产品')
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
||||
|
||||
cutting_speed = fields.Char('径向切宽 ae(mm)')
|
||||
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
|
||||
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
||||
blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True, related='product_template_id.cutting_tool_blade_diameter')
|
||||
blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True,
|
||||
related='product_template_id.cutting_tool_blade_diameter')
|
||||
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
|
||||
unit = fields.Char('单位', default='fz')
|
||||
|
||||
def _json_feed_per_tooth(self, obj):
|
||||
feed_per_tooth_str = [0, '', {
|
||||
'cutting_speed': obj['cutting_speed'],
|
||||
'machining_method': obj['machining_method'],
|
||||
'materials_type_id': obj['materials_type_id'],
|
||||
'blade_diameter': obj['blade_diameter'],
|
||||
'feed_per_tooth': obj['feed_per_tooth'],
|
||||
'unit': obj['unit'],
|
||||
}]
|
||||
return feed_per_tooth_str
|
||||
|
||||
# @api.depends('product_template_id')
|
||||
# def _compute_product_template_id(self):
|
||||
# if self.product_template_id is not None:
|
||||
|
||||
@@ -4,16 +4,7 @@ access_sf_model_type,sf_model_type,model_sf_model_type,base.group_user,1,1,1,1
|
||||
access_sf_product_model_type_routing_sort,sf_product_model_type_routing_sort,model_sf_product_model_type_routing_sort,base.group_user,1,1,1,1
|
||||
access_sf_embryo_model_type_routing_sort,sf_embryo_model_type_routing_sort,model_sf_embryo_model_type_routing_sort,base.group_user,1,1,1,1
|
||||
access_sf_surface_technics_model_type_routing_sort,sf_surface_technics_model_type_routing_sort,model_sf_surface_technics_model_type_routing_sort,base.group_user,1,1,1,1
|
||||
|
||||
access_sf_production_line,sf.production.line,model_sf_production_line,base.group_user,1,1,1,1
|
||||
|
||||
access_sf_suitable_machining_method,sf_suitable_machining_method,model_sf_suitable_machining_method,base.group_user,1,1,1,1
|
||||
access_sf_blade_tip_characteristics,sf_blade_tip_characteristics,model_sf_blade_tip_characteristics,base.group_user,1,1,1,1
|
||||
access_sf_handle_type,sf_handle_type,model_sf_handle_type,base.group_user,1,1,1,1
|
||||
access_sf_cutting_direction,sf_cutting_direction,model_sf_cutting_direction,base.group_user,1,1,1,1
|
||||
access_sf_suitable_coolant,sf_suitable_coolant,model_sf_suitable_coolant,base.group_user,1,1,1,1
|
||||
access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
|
||||
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1
|
||||
access_maintenance_equipment_tool,maintenance_equipment_tool,model_maintenance_equipment_tool,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
@@ -1,178 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- ======================================== 适合加工方式========================================-->
|
||||
<record model="ir.ui.view" id="sf_suitable_machining_method_tree">
|
||||
<field name="name">适合加工方式</field>
|
||||
<field name="model">sf.suitable.machining.method</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="sf_suitable_machining_method_form">
|
||||
<field name="name">适合加工方式</field>
|
||||
<field name="model">sf.suitable.machining.method</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_suitable_machining_method_act" model="ir.actions.act_window">
|
||||
<field name="name">适合加工方式</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.suitable.machining.method</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 刀尖特征========================================-->
|
||||
<record model="ir.ui.view" id="sf_blade_tip_characteristics_tree">
|
||||
<field name="name">刀尖特征</field>
|
||||
<field name="model">sf.blade.tip.characteristics</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="sf_blade_tip_characteristics_form">
|
||||
<field name="name">刀尖特征</field>
|
||||
<field name="model">sf.blade.tip.characteristics</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_blade_tip_characteristics_act" model="ir.actions.act_window">
|
||||
<field name="name">刀尖特征</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.blade.tip.characteristics</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 柄部类型========================================-->
|
||||
<record model="ir.ui.view" id="sf_handle_type_tree">
|
||||
<field name="name">柄部类型</field>
|
||||
<field name="model">sf.handle.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="sf_handle_type_forme">
|
||||
<field name="name">柄部类型</field>
|
||||
<field name="model">sf.handle.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_handle_type_act" model="ir.actions.act_window">
|
||||
<field name="name">柄部类型</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.handle.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 走刀方向========================================-->
|
||||
<record model="ir.ui.view" id="sf_cutting_direction_tree">
|
||||
<field name="name">走刀方向</field>
|
||||
<field name="model">sf.cutting.direction</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="sf_cutting_direction_form">
|
||||
<field name="name">走刀方向</field>
|
||||
<field name="model">sf.cutting.direction</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_cutting_direction_act" model="ir.actions.act_window">
|
||||
<field name="name">走刀方向</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.cutting.direction</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 适合冷却液========================================-->
|
||||
<record model="ir.ui.view" id="sf_suitable_coolant_tree">
|
||||
<field name="name">适合冷却液</field>
|
||||
<field name="model">sf.suitable.coolant</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="sf_suitable_coolant_form">
|
||||
<field name="name">适合冷却液</field>
|
||||
<field name="model">sf.suitable.coolant</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_suitable_coolant_act" model="ir.actions.act_window">
|
||||
<field name="name">适合冷却液</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.suitable.coolant</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 切削速度Vc========================================-->
|
||||
<record id="sf_cutting_speed_tree" model="ir.ui.view">
|
||||
<field name="name">切削速度Vc</field>
|
||||
@@ -215,7 +42,7 @@
|
||||
<field name="cutting_speed" attrs="{'readonly': [('materials_type_id','!=',False)]}"/>
|
||||
<field name="machining_method" attrs="{'readonly': [('cutting_speed','!=',False)]}"/>
|
||||
<field name="materials_type_id" attrs="{'readonly': [('cutting_speed','!=',False)]}"/>
|
||||
<field name="blade_diameter"/>
|
||||
<!-- <field name="blade_diameter"/>-->
|
||||
<field name="feed_per_tooth"/>
|
||||
<field name="unit"/>
|
||||
</tree>
|
||||
|
||||
@@ -1868,16 +1868,30 @@ class Cutting_tool_standard_library(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['cutting_tool_standard_library_all_list']:
|
||||
cutting_tool_standard_library = self.search([("code", '=', item['code'])])
|
||||
cutting_tool_standard_library = self.search(
|
||||
[("code", '=', item['code'].replace("JKM", result['factory_short_name']))])
|
||||
cutting_tool_type = self.env['sf.cutting.tool.type'].search(
|
||||
[("code", '=', item['cutting_tool_type_code'])])
|
||||
cutting_tool_material = self.env['sf.cutting.tool.material'].search(
|
||||
[("code", '=', item['cutting_tool_material_code'])])
|
||||
materials_model = self.env['sf.materials.model'].search(
|
||||
[("code", '=', item['materials_model_code'])])
|
||||
[("materials_no", '=', item['material_model_code'])])
|
||||
brand = self.env['sf.machine.brand'].search([("code", '=', item['brand_code'])])
|
||||
basic_param_list = []
|
||||
for basic_param_item in item['basic_parameter']:
|
||||
basic_param_list.append(
|
||||
self.env['sf.tool.materials.basic.parameters']._json_basic_param(basic_param_item))
|
||||
cutting_speed_list = []
|
||||
for cutting_speed_item in item['cutting_speed']:
|
||||
cutting_speed_list.append(
|
||||
self.env['sf.cutting.speed']._json_cutting_speed(cutting_speed_item))
|
||||
feed_per_tooth_list = []
|
||||
for feed_per_tooth_item in item['basic_parameter']:
|
||||
feed_per_tooth_list.append(
|
||||
self.env['sf.feed.per.tooth']._json_feed_per_tooth(feed_per_tooth_item))
|
||||
if not cutting_tool_standard_library:
|
||||
self.create({
|
||||
"code": item['code'].replace("JKM", result['factory_short_name']),
|
||||
"name": item['name'],
|
||||
"cutting_tool_material_id": cutting_tool_material.id,
|
||||
"cutting_tool_type_id": cutting_tool_type.id,
|
||||
@@ -1891,6 +1905,9 @@ class Cutting_tool_standard_library(models.Model):
|
||||
"integral_coarse_medium_fine": item['integral_coarse_medium_fine'],
|
||||
"integral_run_out_accuracy_max": item['integral_run_out_accuracy_max'],
|
||||
"integral_run_out_accuracy_min": item['integral_run_out_accuracy_min'],
|
||||
"basic_parameters_ids": basic_param_list,
|
||||
"cutting_speed_ids": cutting_speed_list,
|
||||
"feed_per_tooth_ids": feed_per_tooth_list,
|
||||
"active": item['active'],
|
||||
})
|
||||
else:
|
||||
@@ -1908,6 +1925,9 @@ class Cutting_tool_standard_library(models.Model):
|
||||
"integral_coarse_medium_fine": item['integral_coarse_medium_fine'],
|
||||
"integral_run_out_accuracy_max": item['integral_run_out_accuracy_max'],
|
||||
"integral_run_out_accuracy_min": item['integral_run_out_accuracy_min'],
|
||||
"basic_parameters_ids": basic_param_list,
|
||||
"cutting_speed_ids": cutting_speed_list,
|
||||
"feed_per_tooth_ids": feed_per_tooth_list,
|
||||
"active": item['active'], }
|
||||
)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user