夹具型号相关数据表的优化
This commit is contained in:
@@ -67,6 +67,52 @@ class BasicParametersFixture(models.Model):
|
||||
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
|
||||
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
|
||||
|
||||
# ‘磁吸托盘’ 字段
|
||||
magnet_tray_length = fields.Float('磁吸托盘长度(mm)', digits=(16, 2))
|
||||
magnet_tray_width = fields.Float('磁吸托盘宽度(mm)', digits=(16, 2))
|
||||
magnet_tray_height = fields.Float('磁吸托盘厚度(mm)', digits=(16, 2))
|
||||
magnet_tray_diameter = fields.Float('磁吸托盘直径(mm)', digits=(16, 2))
|
||||
magnet_tray_weight = fields.Float('磁吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
magnet_max_adsorp_length = fields.Float('磁吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_width = fields.Float('磁吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_height = fields.Float('磁吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_diameter = fields.Float('磁吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_force = fields.Float('磁吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
magnet_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='磁吸托盘锁紧方式'
|
||||
)
|
||||
magnet_flatness = fields.Char('磁吸托盘平面精度(mm)', size=20)
|
||||
magnet_max_load = fields.Float('磁吸托盘最大负载(kg)', digits=(16, 2))
|
||||
|
||||
# ‘气吸托盘’ 字段
|
||||
air_tray_length = fields.Float('气吸托盘长度(mm)', digits=(16, 2))
|
||||
air_tray_width = fields.Float('气吸托盘宽度(mm)', digits=(16, 2))
|
||||
air_tray_height = fields.Float('气吸托盘高度(mm)', digits=(16, 2))
|
||||
air_tray_diameter = fields.Float('气吸托盘直径(mm)', digits=(16, 2))
|
||||
air_tray_weight = fields.Float('气吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
air_max_adsorp_length = fields.Float('气吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_width = fields.Float('气吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_height = fields.Float('气吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_diameter = fields.Float('气吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
air_max_adsorp_force = fields.Float('气吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
air_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='气吸托盘锁紧方式'
|
||||
)
|
||||
air_flatness = fields.Char('气吸托盘平面精度(mm)', size=20)
|
||||
air_max_load = fields.Float('气吸托盘最大负载(kg)', digits=(16, 2))
|
||||
air_boolean_chip_blowing_function = fields.Boolean('气吸托盘是否有吹屑功能')
|
||||
air_way_to_install = fields.Selection(
|
||||
[('接口式', '接口式'), ('螺栓固定', '螺栓固定'), ('磁吸式', '磁吸式'), ('其他', '其他')],
|
||||
string='气吸托盘安装方式'
|
||||
)
|
||||
|
||||
|
||||
code = fields.Char('编码')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@@ -85,6 +131,10 @@ class BasicParametersFixture(models.Model):
|
||||
return self._json_adapter_board_fixture_param(fixture_materials_data)
|
||||
elif fixture_materials_name == '三爪卡盘':
|
||||
return self._json_scroll_chuck_param(fixture_materials_data)
|
||||
elif fixture_materials_name == '磁吸托盘':
|
||||
return self._json_magnet_tray_param(fixture_materials_data)
|
||||
elif fixture_materials_name == '气吸托盘':
|
||||
return self._json_air_tray_param(fixture_materials_data)
|
||||
return {}
|
||||
|
||||
def _json_zero_chuck_param(self, obj):
|
||||
@@ -284,3 +334,57 @@ class BasicParametersFixture(models.Model):
|
||||
'centering_diameter': obj['centering_diameter'],
|
||||
'type_of_drive': obj['type_of_drive'],
|
||||
'active': obj['active']}
|
||||
|
||||
def _json_magnet_tray_param(self, obj):
|
||||
"""磁吸托盘:将data数据转换成list数据"""
|
||||
return {
|
||||
'code': obj['code'],
|
||||
'fixture_model_id': self.env['sf.fixture.model'].sudo().search(
|
||||
[('code', '=', obj.get('fixture_model_code'))]).id,
|
||||
'name': obj['name'],
|
||||
'length': obj['length'],
|
||||
'width': obj['width'],
|
||||
'height': obj['height'],
|
||||
'diameter': obj['diameter'],
|
||||
'weight': obj['weight'],
|
||||
'max_adsorp_length': obj['max_adsorp_length'],
|
||||
'max_adsorp_width': obj['max_adsorp_width'],
|
||||
'max_adsorp_height': obj['max_adsorp_height'],
|
||||
'max_adsorp_diameter': obj.get('max_adsorp_diameter'),
|
||||
'max_adsorp_force': obj['max_adsorp_force'],
|
||||
'flatness': obj.get('flatness'),
|
||||
'max_load': obj.get('max_load'),
|
||||
'unlocking_method': obj.get('unlocking_method'),
|
||||
'materials_model_id': self.env['sf.materials.model'].sudo().search(
|
||||
[('materials_no', '=', obj['materials_model_id']), ('active', '=', True)]
|
||||
).id if obj.get('materials_model_id') else False,
|
||||
'active': obj.get('active', True),
|
||||
}
|
||||
|
||||
def _json_air_tray_param(self, obj):
|
||||
"""气吸托盘:将data数据转换成list数据"""
|
||||
return {
|
||||
'code': obj['code'],
|
||||
'fixture_model_id': self.env['sf.fixture.model'].sudo().search(
|
||||
[('code', '=', obj.get('fixture_model_code'))]).id,
|
||||
'name': obj['name'],
|
||||
'length': obj['length'],
|
||||
'width': obj['width'],
|
||||
'height': obj['height'],
|
||||
'diameter': obj['diameter'],
|
||||
'weight': obj['weight'],
|
||||
'max_adsorp_length': obj['max_adsorp_length'],
|
||||
'max_adsorp_width': obj['max_adsorp_width'],
|
||||
'max_adsorp_height': obj['max_adsorp_height'],
|
||||
'max_adsorp_diameter': obj.get('max_adsorp_diameter'),
|
||||
'max_adsorp_force': obj['max_adsorp_force'],
|
||||
'flatness': obj.get('flatness'),
|
||||
'max_load': obj.get('max_load'),
|
||||
'unlocking_method': obj.get('unlocking_method'),
|
||||
'boolean_chip_blowing_function': obj.get('blowing_function', False),
|
||||
'way_to_install': obj.get('way_to_install'),
|
||||
'materials_model_id': self.env['sf.materials.model'].sudo().search(
|
||||
[('materials_no', '=', obj['materials_model_id']), ('active', '=', True)]
|
||||
).id if obj.get('materials_model_id') else False,
|
||||
'active': obj.get('active', True),
|
||||
}
|
||||
|
||||
@@ -36,21 +36,24 @@ class FixtureModel(models.Model):
|
||||
status = fields.Boolean('状态')
|
||||
active = fields.Boolean('有效', default=False)
|
||||
|
||||
zero_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
zero_chuck_ids = fields.One2many('mrs.basic_parameters.zero.chuck', 'fixture_model_id',
|
||||
string='零点卡盘基本参数')
|
||||
zero_tray_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
zero_tray_ids = fields.One2many('mrs.basic_parameters.zero.tray', 'fixture_model_id',
|
||||
string='零点托盘基本参数')
|
||||
pneumatic_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
pneumatic_fixture_ids = fields.One2many('mrs.basic_parameters.pneumatic.fixture', 'fixture_model_id',
|
||||
string='气动夹具基本参数')
|
||||
jaw_vice_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
jaw_vice_fixture_ids = fields.One2many('mrs.basic_parameters.jaw.vice.fixture', 'fixture_model_id',
|
||||
string='虎钳夹具基本参数')
|
||||
magnet_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
magnet_fixture_ids = fields.One2many('mrs.basic_parameters.magnet.fixture', 'fixture_model_id',
|
||||
string='磁吸夹具基本参数')
|
||||
adapter_board_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
magnet_tray_ids = fields.One2many('mrs.basic_parameters.magnet.tray', 'fixture_model_id',
|
||||
string='磁吸托盘基本参数')
|
||||
adapter_board_fixture_ids = fields.One2many('mrs.basic_parameters.adapter.board.fixture', 'fixture_model_id',
|
||||
string='转接板(锁板)夹具基本参数')
|
||||
scroll_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
scroll_chuck_ids = fields.One2many('mrs.basic_parameters.scroll.chuck', 'fixture_model_id',
|
||||
string='三爪卡盘基本参数')
|
||||
code = fields.Char(string='编码', readonly=True)
|
||||
air_tray_ids = fields.One2many('mrs.basic_parameters.air.tray', 'fixture_model_id',
|
||||
string='气吸托盘基本参数')
|
||||
|
||||
# def _get_code(self, fixture_model_type_code):
|
||||
# fixture_model = self.env['sf.fixture.model'].sudo().search(
|
||||
|
||||
@@ -328,6 +328,52 @@
|
||||
<field name="type_of_drive"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="air_tray_ids"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}">
|
||||
<tree editable="bottom" class="center" delete="0">
|
||||
<field name="code" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="length"/>
|
||||
<field name="width"/>
|
||||
<field name="height"/>
|
||||
<field name="diameter"/>
|
||||
<field name="weight" string="重量(kg)"/>
|
||||
<field name="max_adsorp_length"/>
|
||||
<field name="max_adsorp_width"/>
|
||||
<field name="max_adsorp_height"/>
|
||||
<field name="max_adsorp_diameter"/>
|
||||
<field name="max_adsorp_force"/>
|
||||
<field name="flatness"/>
|
||||
<field name="max_load"/>
|
||||
<field name="unlocking_method"/>
|
||||
<field name="boolean_chip_blowing_function"/>
|
||||
<field name="way_to_install"/>
|
||||
<field name="materials_model_id" options="{'no_create': True}" placeholder="请选择"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="magnet_tray_ids"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}">
|
||||
<tree editable="bottom" class="center" delete="0">
|
||||
<field name="code" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="length"/>
|
||||
<field name="width"/>
|
||||
<field name="height"/>
|
||||
<field name="diameter"/>
|
||||
<field name="weight" string="重量(kg)"/>
|
||||
<field name="max_adsorp_length"/>
|
||||
<field name="max_adsorp_width"/>
|
||||
<field name="max_adsorp_height"/>
|
||||
<field name="max_adsorp_diameter"/>
|
||||
<field name="max_adsorp_force"/>
|
||||
<field name="flatness"/>
|
||||
<field name="max_load"/>
|
||||
<field name="unlocking_method"/>
|
||||
<field name="materials_model_id" options="{'no_create': True}" placeholder="请选择"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="scroll_chuck_ids"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '三爪卡盘')]}">
|
||||
<tree editable="bottom" class="center" delete="0">
|
||||
|
||||
@@ -513,112 +513,168 @@
|
||||
</notebook>
|
||||
</page>
|
||||
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
|
||||
<group>
|
||||
<group>
|
||||
<field name="brand_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}"
|
||||
attrs="{'required': [('categ_type', '=', '夹具')]}"/>
|
||||
<field name="length" string="长度(mm)"/>
|
||||
<field name="width" string="宽度(mm)"/>
|
||||
<field name="height" string="高度(mm)"/>
|
||||
<field name="height_tolerance_value"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="diameter"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘', '零点托盘', '三爪卡盘'])]}"/>
|
||||
<field name="weight"/>
|
||||
<field name="chucking_power_max"
|
||||
attrs="{'invisible': [('fixture_material_type', '=','磁吸夹具')]}"/>
|
||||
<field name="carrying_capacity_max"/>
|
||||
<field name="rigidity"/>
|
||||
<group>
|
||||
<field name="brand_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}"
|
||||
attrs="{'required': [('categ_type', '=', '夹具')]}"/>
|
||||
<field name="length" string="长度(mm)"/>
|
||||
<field name="width" string="宽度(mm)"/>
|
||||
<field name="height" string="高度(mm)"/>
|
||||
<field name="height_tolerance_value"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="diameter"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘', '零点托盘', '三爪卡盘', '磁吸托盘'])]}"/>
|
||||
<field name="weight"/>
|
||||
<field name="chucking_power_max"
|
||||
attrs="{'invisible': [('fixture_material_type', '=','磁吸夹具')]}"/>
|
||||
<field name="carrying_capacity_max"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具', '气吸托盘'])]}"/>
|
||||
<field name="rigidity"/>
|
||||
</group>
|
||||
<group>
|
||||
<!-- 夹持工件尺寸 -->
|
||||
<label for="gripper_length_min" string="夹持工件最小尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_min" string="长"/>
|
||||
<field name="gripper_length_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_min" string="宽"/>
|
||||
<field name="gripper_width_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_height_min" string="高"/>
|
||||
<field name="gripper_height_min" class="o_address_zip"/>
|
||||
</div>
|
||||
<label for="gripper_length_max" string="夹持工件最大尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_max" string="长"/>
|
||||
<field name="gripper_length_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_max" string="宽"/>
|
||||
<field name="gripper_width_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_height_max" string="高"/>
|
||||
<field name="gripper_height_max" class="o_address_zip"/>
|
||||
</div>
|
||||
|
||||
<field name="gripper_diameter_min" string="夹持工件最小直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="gripper_diameter_max" string="夹持工件最大直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="clamping_diameter" string="装夹直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="clamping_num" placeholder="请选择" string="装夹单元数"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '零点卡盘')]}"/>
|
||||
<field name="repeated_positioning_accuracy" placeholder="请输入重复定位孔精度"
|
||||
string="重复定位精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="orientation_dish_diameter" string="定位盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="boolean_transposing_hole" string="是否有转位孔"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="connector_diameter" placeholder="请选择" string="连接头直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
|
||||
<field name="way_to_install" placeholder="请选择" string="安装方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气吸托盘'])]}"/>
|
||||
<field name="rated_air_pressure" string="额定气压(Mpa)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具'])]}"/>
|
||||
|
||||
<field name="transverse_groove" string="横向配合槽n(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
<field name="longitudinal_fitting_groove" string="纵向配合槽l(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
|
||||
<field name="rated_adsorption_force" string="额定吸附力(N/cm²)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_field_height" string="磁场高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_pole_plate_grinding_allowance" string="磁极板磨削余量(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
|
||||
<!-- 磁吸托盘字段 -->
|
||||
<field name="magnet_tray_length" string="磁吸托盘长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_tray_width" string="磁吸托盘宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_tray_height" string="磁吸托盘厚度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_tray_diameter" string="磁吸托盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_tray_weight" string="磁吸托盘重量(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
|
||||
<field name="magnet_max_adsorp_length" string="磁吸托盘最大吸附长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_max_adsorp_width" string="磁吸托盘最大吸附宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_max_adsorp_height" string="磁吸托盘最大吸附厚度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_max_adsorp_diameter" string="磁吸托盘最大吸附直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_max_adsorp_force" string="磁吸托盘最大吸附力(N)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
|
||||
<field name="magnet_unlocking_method" string="磁吸托盘锁紧方式"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_flatness" string="磁吸托盘平面精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
<field name="magnet_max_load" string="磁吸托盘最大负载(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}"/>
|
||||
|
||||
<!-- 气吸托盘字段 -->
|
||||
<field name="air_tray_length" string="气吸托盘长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_tray_width" string="气吸托盘宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_tray_height" string="气吸托盘高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_tray_diameter" string="气吸托盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_tray_weight" string="气吸托盘重量(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
|
||||
<field name="air_max_adsorp_length" string="气吸托盘最大吸附长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_max_adsorp_width" string="气吸托盘最大吸附宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_max_adsorp_height" string="气吸托盘最大吸附高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_max_adsorp_diameter" string="气吸托盘最大吸附直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_max_adsorp_force" string="气吸托盘最大吸附力(N)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
|
||||
<field name="air_unlocking_method" string="气吸托盘锁紧方式"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_flatness" string="气吸托盘平面精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_max_load" string="气吸托盘最大负载(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_boolean_chip_blowing_function" string="气吸托盘是否有吹屑功能"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
<field name="air_way_to_install" string="气吸托盘安装方式"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}"/>
|
||||
|
||||
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘','气吸托盘'])]}"/>
|
||||
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
|
||||
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','气吸托盘','磁吸托盘'])]}"/>
|
||||
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<label for="gripper_length_min" string="夹持工件最小尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_min" string="长"/>
|
||||
<field name="gripper_length_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_min" string="宽"/>
|
||||
<field name="gripper_width_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_height_min" string="高"/>
|
||||
<field name="gripper_height_min" class="o_address_zip"/>
|
||||
</div>
|
||||
<label for="gripper_length_max" string="夹持工件最大尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_max" string="长"/>
|
||||
<field name="gripper_length_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_max" string="宽"/>
|
||||
<field name="gripper_width_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_max" string="高"/>
|
||||
<field name="gripper_width_max" class="o_address_zip"/>
|
||||
</div>
|
||||
<field name="gripper_diameter_min" string="夹持工件最小直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="gripper_diameter_max" string="夹持工件最大直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="clamping_diameter" string="装夹直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="clamping_num" placeholder="请选择" string="装夹单元数"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '零点卡盘')]}"/>
|
||||
<field name="repeated_positioning_accuracy" placeholder="请输入重复定位孔精度"
|
||||
string="重复定位精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="orientation_dish_diameter" string="定位盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="boolean_transposing_hole" string="是否有转位孔"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="connector_diameter" placeholder="请选择" string="连接头直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
|
||||
<field name="way_to_install" placeholder="请选择" string="安装方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
|
||||
<field name="rated_air_pressure" string="额定气压(Mpa)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具'])]}"/>
|
||||
|
||||
<field name="transverse_groove" string="横向配合槽n(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
<field name="longitudinal_fitting_groove" string="纵向配合槽l(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
|
||||
<field name="rated_adsorption_force" string="额定吸附力(N/cm²)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_field_height" string="磁场高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_pole_plate_grinding_allowance" string="磁极板磨削余量(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
|
||||
<field name="screw_size" string="螺牙大小(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['转接板(锁板)夹具'])]}"/>
|
||||
<field name="via_hole_diameter" string="过孔直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['转接板(锁板)夹具'])]}"/>
|
||||
|
||||
<field name="mounting_hole_depth" string="安装孔深度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['三爪卡盘'])]}"/>
|
||||
<field name="centering_diameter" string="定心直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['三爪卡盘'])]}"/>
|
||||
|
||||
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
|
||||
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1215,6 +1215,51 @@ class ResProductFixture(models.Model):
|
||||
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
|
||||
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
|
||||
|
||||
# ‘磁吸托盘’ 字段
|
||||
magnet_tray_length = fields.Float('磁吸托盘长度(mm)', digits=(16, 2))
|
||||
magnet_tray_width = fields.Float('磁吸托盘宽度(mm)', digits=(16, 2))
|
||||
magnet_tray_height = fields.Float('磁吸托盘厚度(mm)', digits=(16, 2))
|
||||
magnet_tray_diameter = fields.Float('磁吸托盘直径(mm)', digits=(16, 2))
|
||||
magnet_tray_weight = fields.Float('磁吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
magnet_max_adsorp_length = fields.Float('磁吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_width = fields.Float('磁吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_height = fields.Float('磁吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_diameter = fields.Float('磁吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_force = fields.Float('磁吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
magnet_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='磁吸托盘锁紧方式'
|
||||
)
|
||||
magnet_flatness = fields.Char('磁吸托盘平面精度(mm)', size=20)
|
||||
magnet_max_load = fields.Float('磁吸托盘最大负载(kg)', digits=(16, 2))
|
||||
|
||||
# ‘气吸托盘’ 字段
|
||||
air_tray_length = fields.Float('气吸托盘长度(mm)', digits=(16, 2))
|
||||
air_tray_width = fields.Float('气吸托盘宽度(mm)', digits=(16, 2))
|
||||
air_tray_height = fields.Float('气吸托盘高度(mm)', digits=(16, 2))
|
||||
air_tray_diameter = fields.Float('气吸托盘直径(mm)', digits=(16, 2))
|
||||
air_tray_weight = fields.Float('气吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
air_max_adsorp_length = fields.Float('气吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_width = fields.Float('气吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_height = fields.Float('气吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_diameter = fields.Float('气吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
air_max_adsorp_force = fields.Float('气吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
air_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='气吸托盘锁紧方式'
|
||||
)
|
||||
air_flatness = fields.Char('气吸托盘平面精度(mm)', size=20)
|
||||
air_max_load = fields.Float('气吸托盘最大负载(kg)', digits=(16, 2))
|
||||
air_boolean_chip_blowing_function = fields.Boolean('气吸托盘是否有吹屑功能')
|
||||
air_way_to_install = fields.Selection(
|
||||
[('接口式', '接口式'), ('螺栓固定', '螺栓固定'), ('磁吸式', '磁吸式'), ('其他', '其他')],
|
||||
string='气吸托盘安装方式'
|
||||
)
|
||||
|
||||
@api.onchange('specification_fixture_id')
|
||||
def _onchange_specification_fixture_id(self):
|
||||
if self.specification_fixture_id:
|
||||
|
||||
@@ -2,5 +2,3 @@ from . import ftp_operate
|
||||
from . import res_config_setting
|
||||
from . import sync_common
|
||||
from . import order_price
|
||||
from . import redis_utils
|
||||
from . import common
|
||||
@@ -1509,149 +1509,157 @@ class SyncMulti_Mounting_Type(models.Model):
|
||||
raise ValidationError("联装类型认证未通过")
|
||||
|
||||
|
||||
# class SyncFixtureModel(models.Model):
|
||||
# _inherit = 'sf.fixture.model'
|
||||
# _description = '同步夹具型号列表'
|
||||
class SyncFixtureModel(models.Model):
|
||||
_inherit = 'sf.fixture.model'
|
||||
_description = '同步夹具型号列表'
|
||||
|
||||
# url = '/api/fixture_model/list'
|
||||
url = '/api/fixture_model/list'
|
||||
|
||||
# # 定时同步夹具型号列表
|
||||
# def sync_fixture_model_yesterday(self):
|
||||
# config = self.env['res.config.settings'].get_values()
|
||||
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
# strUrl = config['sf_url'] + self.url
|
||||
# r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
# r = r.json()
|
||||
# result = json.loads(r['result'])
|
||||
# if result['status'] == 1:
|
||||
# if result.get('fixture_model_yesterday_list'):
|
||||
# for item in result['fixture_model_yesterday_list']:
|
||||
# if item:
|
||||
# fixture_model = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
||||
# val = {
|
||||
# "name": item['name'],
|
||||
# "code": item['code'],
|
||||
# "fixture_material_id": self.env['sf.fixture.material'].search(
|
||||
# [('code', '=', item['fixture_material_code'])]).id,
|
||||
# "multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
|
||||
# [('code', '=', item['multi_mounting_type_code'])]).id,
|
||||
# "brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id,
|
||||
# "model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||
# "status": item['status'],
|
||||
# "active": item['active'],
|
||||
# }
|
||||
# if not fixture_model:
|
||||
# self.create(val)
|
||||
# else:
|
||||
# fixture_model.write(val)
|
||||
# 定时同步夹具型号列表
|
||||
def sync_fixture_model_yesterday(self):
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
strUrl = config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
if result.get('fixture_model_yesterday_list'):
|
||||
for item in result['fixture_model_yesterday_list']:
|
||||
if item:
|
||||
fixture_model = self.search([("code", '=', item['code']), ('active', 'in', [True, False])])
|
||||
val = {
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"fixture_material_id": self.env['sf.fixture.material'].search(
|
||||
[('code', '=', item['fixture_material_code'])]).id,
|
||||
"multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
|
||||
[('code', '=', item['multi_mounting_type_code'])]).id,
|
||||
"brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id,
|
||||
"model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||
"status": item['status'],
|
||||
"active": item['active'],
|
||||
}
|
||||
if not fixture_model:
|
||||
self.create(val)
|
||||
else:
|
||||
fixture_model.write(val)
|
||||
|
||||
# else:
|
||||
# raise ValidationError("夹具型号认证未通过")
|
||||
else:
|
||||
raise ValidationError("夹具型号认证未通过")
|
||||
|
||||
# # 定时同步所有夹具型号列表
|
||||
# def sync_all_fixture_model(self):
|
||||
# config = self.env['res.config.settings'].get_values()
|
||||
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
# strUrl = config['sf_url'] + self.url
|
||||
# r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
# r = r.json()
|
||||
# result = json.loads(r['result'])
|
||||
# # print('result:%s' % result)
|
||||
# if result['status'] == 1:
|
||||
# if result.get('fixture_model_all_list'):
|
||||
# for item in result['fixture_model_all_list']:
|
||||
# if item:
|
||||
# fixture_model = self.search([('code', '=', item['code']), ('active', 'in', [True, False])])
|
||||
# val = {
|
||||
# "name": item['name'],
|
||||
# "code": item['code'],
|
||||
# "fixture_material_id": self.env['sf.fixture.material'].search(
|
||||
# [('code', '=', item['fixture_material_code'])]).id,
|
||||
# "multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
|
||||
# [('code', '=', item['multi_mounting_type_code'])]).id,
|
||||
# "brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id,
|
||||
# "model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||
# "status": item['status'],
|
||||
# "active": item['active'],
|
||||
# }
|
||||
# if not fixture_model:
|
||||
# self.create(val)
|
||||
# else:
|
||||
# fixture_model.write(val)
|
||||
# else:
|
||||
# raise ValidationError("夹具型号认证未通过")
|
||||
# 定时同步所有夹具型号列表
|
||||
def sync_all_fixture_model(self):
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
strUrl = config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
# print('result:%s' % result)
|
||||
if result['status'] == 1:
|
||||
if result.get('fixture_model_all_list'):
|
||||
for item in result['fixture_model_all_list']:
|
||||
if item:
|
||||
fixture_model = self.search([('code', '=', item['code']), ('active', 'in', [True, False])])
|
||||
val = {
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"fixture_material_id": self.env['sf.fixture.material'].search(
|
||||
[('code', '=', item['fixture_material_code'])]).id,
|
||||
"multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
|
||||
[('code', '=', item['multi_mounting_type_code'])]).id,
|
||||
"brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id,
|
||||
"model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||
"status": item['status'],
|
||||
"active": item['active'],
|
||||
}
|
||||
if not fixture_model:
|
||||
self.create(val)
|
||||
else:
|
||||
fixture_model.write(val)
|
||||
else:
|
||||
raise ValidationError("夹具型号认证未通过")
|
||||
|
||||
|
||||
# class SyncfixtureMaterialsBasicParameters(models.Model):
|
||||
# _inherit = 'sf.fixture.materials.basic.parameters'
|
||||
# _description = '同步夹具型号基本参数列表'
|
||||
class SyncfixtureMaterialsBasicParameters(models.Model):
|
||||
_inherit = 'sf.fixture.materials.basic.parameters'
|
||||
_description = '同步夹具型号基本参数列表'
|
||||
|
||||
# url = '/api/fixture_parameters/list'
|
||||
url = '/api/fixture_parameters/list'
|
||||
|
||||
# # 定时同步夹具型号基本信息
|
||||
# def sync_fixture_materials_basic_parameters_yesterday(self):
|
||||
# config = self.env['res.config.settings'].get_values()
|
||||
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
# strUrl = config['sf_url'] + self.url
|
||||
# r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
# r = r.json()
|
||||
# result = json.loads(r['result'])
|
||||
# if result['status'] == 1:
|
||||
# if result.get('fixture_parameters_yesterday_list'):
|
||||
# all_list = result.get('fixture_parameters_yesterday_list')
|
||||
# if all_list.get('zero_chuck_all_list'):
|
||||
# self._write_or_create(all_list.get('zero_chuck_yesterday_list'), '零点卡盘')
|
||||
# if all_list.get('zero_tray_all_list'):
|
||||
# self._write_or_create(all_list.get('zero_tray_yesterday_list'), '零点托盘')
|
||||
# if all_list.get('pneumatic_fixture_all_list'):
|
||||
# self._write_or_create(all_list.get('pneumatic_fixture_yesterday_list'), '气动夹具')
|
||||
# if all_list.get('jaw_vice_all_list'):
|
||||
# self._write_or_create(all_list.get('jaw_vice_yesterday_list'), '虎钳夹具')
|
||||
# if all_list.get('magnet_fixture_all_list'):
|
||||
# self._write_or_create(all_list.get('magnet_fixture_yesterday_list'), '磁吸夹具')
|
||||
# if all_list.get('adapter_board_all_list'):
|
||||
# self._write_or_create(all_list.get('adapter_board_yesterday_list'), '转接板(锁板)夹具')
|
||||
# if all_list.get('scroll_chuck_all_list'):
|
||||
# self._write_or_create(all_list.get('scroll_chuck_yesterday_list'), '三爪卡盘')
|
||||
# else:
|
||||
# raise ValidationError("夹具型号基本参数认证未通过")
|
||||
# 定时同步夹具型号基本信息
|
||||
def sync_fixture_materials_basic_parameters_yesterday(self):
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
strUrl = config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
if result.get('fixture_parameters_yesterday_list'):
|
||||
all_list = result.get('fixture_parameters_yesterday_list')
|
||||
if all_list.get('zero_chuck_all_list'):
|
||||
self._write_or_create(all_list.get('zero_chuck_yesterday_list'), '零点卡盘')
|
||||
if all_list.get('zero_tray_all_list'):
|
||||
self._write_or_create(all_list.get('zero_tray_yesterday_list'), '零点托盘')
|
||||
if all_list.get('pneumatic_fixture_all_list'):
|
||||
self._write_or_create(all_list.get('pneumatic_fixture_yesterday_list'), '气动夹具')
|
||||
if all_list.get('jaw_vice_all_list'):
|
||||
self._write_or_create(all_list.get('jaw_vice_yesterday_list'), '虎钳夹具')
|
||||
if all_list.get('magnet_fixture_all_list'):
|
||||
self._write_or_create(all_list.get('magnet_fixture_yesterday_list'), '磁吸夹具')
|
||||
if all_list.get('adapter_board_all_list'):
|
||||
self._write_or_create(all_list.get('adapter_board_yesterday_list'), '转接板(锁板)夹具')
|
||||
if all_list.get('scroll_chuck_all_list'):
|
||||
self._write_or_create(all_list.get('scroll_chuck_yesterday_list'), '三爪卡盘')
|
||||
if all_list.get('air_blow_tray_all_list'):
|
||||
self._write_or_create(all_list.get('air_tray_yesterday_list'), '气吸托盘')
|
||||
if all_list.get('magnet_tray_all_list'):
|
||||
self._write_or_create(all_list.get('magnet_tray_yesterday_list'), '磁吸托盘')
|
||||
else:
|
||||
raise ValidationError("夹具型号基本参数认证未通过")
|
||||
|
||||
# # 定时同步所有夹具型号基本信息
|
||||
# def sync_all_fixture_materials_basic_parameters(self):
|
||||
# config = self.env['res.config.settings'].get_values()
|
||||
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
# strUrl = config['sf_url'] + self.url
|
||||
# r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
# r = r.json()
|
||||
# result = json.loads(r['result'])
|
||||
# if result['status'] == 1:
|
||||
# if result.get('fixture_parameters_all_list'):
|
||||
# all_list = result.get('fixture_parameters_all_list')
|
||||
# if all_list.get('zero_chuck_all_list'):
|
||||
# self._write_or_create(all_list.get('zero_chuck_all_list'), '零点卡盘')
|
||||
# if all_list.get('zero_tray_all_list'):
|
||||
# self._write_or_create(all_list.get('zero_tray_all_list'), '零点托盘')
|
||||
# if all_list.get('pneumatic_fixture_all_list'):
|
||||
# self._write_or_create(all_list.get('pneumatic_fixture_all_list'), '气动夹具')
|
||||
# if all_list.get('jaw_vice_all_list'):
|
||||
# self._write_or_create(all_list.get('jaw_vice_all_list'), '虎钳夹具')
|
||||
# if all_list.get('magnet_fixture_all_list'):
|
||||
# self._write_or_create(all_list.get('magnet_fixture_all_list'), '磁吸夹具')
|
||||
# if all_list.get('adapter_board_all_list'):
|
||||
# self._write_or_create(all_list.get('adapter_board_all_list'), '转接板(锁板)夹具')
|
||||
# if all_list.get('scroll_chuck_all_list'):
|
||||
# self._write_or_create(all_list.get('scroll_chuck_all_list'), '三爪卡盘')
|
||||
# else:
|
||||
# raise ValidationError("夹具型号基本参数认证未通过")
|
||||
# 定时同步所有夹具型号基本信息
|
||||
def sync_all_fixture_materials_basic_parameters(self):
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
strUrl = config['sf_url'] + self.url
|
||||
r = requests.post(strUrl, json={}, data=None, headers=headers)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
if result.get('fixture_parameters_all_list'):
|
||||
all_list = result.get('fixture_parameters_all_list')
|
||||
if all_list.get('zero_chuck_all_list'):
|
||||
self._write_or_create(all_list.get('zero_chuck_all_list'), '零点卡盘')
|
||||
if all_list.get('zero_tray_all_list'):
|
||||
self._write_or_create(all_list.get('zero_tray_all_list'), '零点托盘')
|
||||
if all_list.get('pneumatic_fixture_all_list'):
|
||||
self._write_or_create(all_list.get('pneumatic_fixture_all_list'), '气动夹具')
|
||||
if all_list.get('jaw_vice_all_list'):
|
||||
self._write_or_create(all_list.get('jaw_vice_all_list'), '虎钳夹具')
|
||||
if all_list.get('magnet_fixture_all_list'):
|
||||
self._write_or_create(all_list.get('magnet_fixture_all_list'), '磁吸夹具')
|
||||
if all_list.get('adapter_board_all_list'):
|
||||
self._write_or_create(all_list.get('adapter_board_all_list'), '转接板(锁板)夹具')
|
||||
if all_list.get('scroll_chuck_all_list'):
|
||||
self._write_or_create(all_list.get('scroll_chuck_all_list'), '三爪卡盘')
|
||||
if all_list.get('air_blow_tray_all_list'):
|
||||
self._write_or_create(all_list.get('air_tray_all_list'), '气吸托盘')
|
||||
if all_list.get('magnet_tray_all_list'):
|
||||
self._write_or_create(all_list.get('magnet_tray_all_list'), '磁吸托盘')
|
||||
else:
|
||||
raise ValidationError("夹具型号基本参数认证未通过")
|
||||
|
||||
# def _write_or_create(self, fixture_parameters_list, material_name):
|
||||
# for item in fixture_parameters_list:
|
||||
# if item:
|
||||
# basic_parameters = self.search([('code', '=', item.get('code')), ('active', 'in', [True, False])])
|
||||
# if not basic_parameters:
|
||||
# self.create(self._get_basic_parameters_list(item, material_name))
|
||||
# else:
|
||||
# basic_parameters.write(self._get_basic_parameters_list(item, material_name))
|
||||
def _write_or_create(self, fixture_parameters_list, material_name):
|
||||
for item in fixture_parameters_list:
|
||||
if item:
|
||||
basic_parameters = self.search([('code', '=', item.get('code')), ('active', 'in', [True, False])])
|
||||
if not basic_parameters:
|
||||
self.create(self._get_basic_parameters_list(item, material_name))
|
||||
else:
|
||||
basic_parameters.write(self._get_basic_parameters_list(item, material_name))
|
||||
|
||||
|
||||
class SyncFunctionalFixtureType(models.Model):
|
||||
@@ -3234,179 +3242,3 @@ class EmbryoRedundancySync(models.Model):
|
||||
"active": item['active'],
|
||||
"remark": item['remark'],
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class SyncfixtureMaterialsBasicParameters(models.Model):
|
||||
_inherit = 'sf.fixture.materials.basic.parameters'
|
||||
_description = 'Redis 优先同步夹具基本参数'
|
||||
|
||||
def sync_all_fixture_materials_basic_parameters(self):
|
||||
# 你已有的批量同步方法不变
|
||||
rc = RedisClient()
|
||||
key = 'mrs:fixture_param_all_list'
|
||||
all_list = rc.get_json(key)
|
||||
if not all_list:
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(config['token'], config['sf_secret_key'])
|
||||
refresh_url = config['mrs_url'] + '/api/refresh_redis/fixture_param'
|
||||
try:
|
||||
res = requests.post(refresh_url, headers=headers, json={}, timeout=10)
|
||||
res.raise_for_status()
|
||||
except Exception as e:
|
||||
raise ValidationError(f"Redis 无数据,MRS 缓存刷新失败: {str(e)}")
|
||||
all_list = rc.get_json(key)
|
||||
if not all_list:
|
||||
raise ValidationError("Redis 刷新后仍无数据,无法同步夹具基本参数")
|
||||
def _sync_list(param_list, material_name):
|
||||
for item in param_list or []:
|
||||
if not item or not item.get('code'):
|
||||
continue
|
||||
record = self.search([('code', '=', item['code'])], limit=1)
|
||||
vals = self._get_basic_parameters_list(item, material_name)
|
||||
if record:
|
||||
record.write(vals)
|
||||
else:
|
||||
self.create(vals)
|
||||
_sync_list(all_list.get('zero_chuck_all_list'), '零点卡盘')
|
||||
_sync_list(all_list.get('zero_tray_all_list'), '零点托盘')
|
||||
_sync_list(all_list.get('pneumatic_fixture_all_list'), '气动夹具')
|
||||
_sync_list(all_list.get('jaw_vice_all_list'), '虎钳夹具')
|
||||
_sync_list(all_list.get('magnet_fixture_all_list'), '磁吸夹具')
|
||||
_sync_list(all_list.get('adapter_board_all_list'), '转接板(锁板)夹具')
|
||||
_sync_list(all_list.get('scroll_chuck_all_list'), '三爪卡盘')
|
||||
_sync_list(all_list.get('air_tray_all_list'), '气吹托盘')
|
||||
_sync_list(all_list.get('magnet_tray_all_list'), '磁吸托盘')
|
||||
|
||||
def sync_from_mrs(self, code):
|
||||
rc = RedisClient()
|
||||
key = 'mrs:fixture_param_all_list'
|
||||
all_list = rc.get_json(key) or {}
|
||||
if not all_list:
|
||||
# Redis没数据,刷新一次
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(config['token'], config['sf_secret_key'])
|
||||
refresh_url = config['mrs_url'] + '/api/refresh_redis/fixture_param'
|
||||
try:
|
||||
res = requests.post(refresh_url, headers=headers, json={}, timeout=10)
|
||||
res.raise_for_status()
|
||||
except Exception as e:
|
||||
raise ValidationError(f"Redis 无数据,MRS 缓存刷新失败: {str(e)}")
|
||||
all_list = rc.get_json(key) or {}
|
||||
if not all_list:
|
||||
raise ValidationError("刷新后仍无 Redis 数据,无法同步夹具基本参数")
|
||||
|
||||
# 遍历所有分类列表查找code匹配项
|
||||
for material_name, param_list in all_list.items():
|
||||
for item in param_list or []:
|
||||
if item.get('code') == code:
|
||||
vals = self._get_basic_parameters_list(item, material_name)
|
||||
record = self.search([('code', '=', code)], limit=1)
|
||||
if record:
|
||||
record.write(vals)
|
||||
else:
|
||||
self.create(vals)
|
||||
return True
|
||||
return False
|
||||
|
||||
def _get_basic_parameters_list(self, item, material_name):
|
||||
# 请根据实际字段完善,这里给个示范
|
||||
return {
|
||||
'code': item.get('code'),
|
||||
'length': item.get('length'),
|
||||
'width': item.get('width'),
|
||||
'height': item.get('height'),
|
||||
'chucking_power_max': item.get('chucking_power_max'),
|
||||
'type_of_drive': item.get('type_of_drive'),
|
||||
'locking_method': item.get('locking_method'),
|
||||
'max_adsorp_force': item.get('max_adsorp_force'),
|
||||
# 你可以加上 material_name 做记录或其它业务字段
|
||||
# 'material_name': material_name,
|
||||
}
|
||||
|
||||
|
||||
class SyncFixtureModel(models.Model):
|
||||
_inherit = 'sf.fixture.model'
|
||||
_description = 'Redis 优先同步夹具型号'
|
||||
|
||||
def sync_all_fixture_model(self):
|
||||
rc = RedisClient()
|
||||
key = 'mrs:fixture_model_all_list'
|
||||
all_list = rc.get_json(key)
|
||||
if not all_list:
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(config['token'], config['sf_secret_key'])
|
||||
refresh_url = config['mrs_url'] + '/api/refresh_redis/fixture_model'
|
||||
try:
|
||||
res = requests.post(refresh_url, headers=headers, json={}, timeout=10)
|
||||
res.raise_for_status()
|
||||
except Exception as e:
|
||||
raise ValidationError(f"Redis 无数据,MRS 刷新失败: {str(e)}")
|
||||
all_list = rc.get_json(key)
|
||||
if not all_list:
|
||||
raise ValidationError("刷新后仍无 Redis 数据,无法同步夹具型号")
|
||||
|
||||
for item in all_list:
|
||||
if not item or not item.get('code'):
|
||||
continue
|
||||
record = self.search([('code', '=', item['code'])], limit=1)
|
||||
vals = {
|
||||
'name': item['name'],
|
||||
'code': item['code'],
|
||||
'fixture_material_id': self.env['sf.fixture.material']
|
||||
.search([('code', '=', item.get('fixture_material_code'))], limit=1).id or False,
|
||||
'multi_mounting_type_id': self.env['sf.multi_mounting.type']
|
||||
.search([('code', '=', item.get('multi_mounting_type_code'))], limit=1).id or False,
|
||||
'brand_id': self.env['sf.machine.brand']
|
||||
.search([('code', '=', item.get('brand_code'))], limit=1).id or False,
|
||||
'model_file': base64.b64decode(item['model_file']) if item.get('model_file') else False,
|
||||
'status': item['status'],
|
||||
'active': item['active'],
|
||||
}
|
||||
if record:
|
||||
record.write(vals)
|
||||
else:
|
||||
self.create(vals)
|
||||
|
||||
def sync_from_mrs(self, code):
|
||||
rc = RedisClient()
|
||||
key = 'mrs:fixture_model_all_list'
|
||||
all_list = rc.get_json(key) or []
|
||||
if not all_list:
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(config['token'], config['sf_secret_key'])
|
||||
refresh_url = config['mrs_url'] + '/api/refresh_redis/fixture_model'
|
||||
try:
|
||||
res = requests.post(refresh_url, headers=headers, json={}, timeout=10)
|
||||
res.raise_for_status()
|
||||
except Exception as e:
|
||||
raise ValidationError(f"Redis 无数据,MRS 刷新失败: {str(e)}")
|
||||
all_list = rc.get_json(key) or []
|
||||
if not all_list:
|
||||
raise ValidationError("刷新后仍无 Redis 数据,无法同步夹具型号")
|
||||
|
||||
for item in all_list:
|
||||
if item.get('code') == code:
|
||||
record = self.search([('code', '=', code)], limit=1)
|
||||
vals = {
|
||||
'name': item['name'],
|
||||
'code': item['code'],
|
||||
'fixture_material_id': self.env['sf.fixture.material']
|
||||
.search([('code', '=', item.get('fixture_material_code'))], limit=1).id or False,
|
||||
'multi_mounting_type_id': self.env['sf.multi_mounting.type']
|
||||
.search([('code', '=', item.get('multi_mounting_type_code'))], limit=1).id or False,
|
||||
'brand_id': self.env['sf.machine.brand']
|
||||
.search([('code', '=', item.get('brand_code'))], limit=1).id or False,
|
||||
'model_file': base64.b64decode(item['model_file']) if item.get('model_file') else False,
|
||||
'status': item['status'],
|
||||
'active': item['active'],
|
||||
}
|
||||
if record:
|
||||
record.write(vals)
|
||||
else:
|
||||
self.create(vals)
|
||||
return True
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user