新增同步夹具相关的定时器

This commit is contained in:
jinling.yang
2023-06-27 16:35:30 +08:00
parent 87e3f6d04e
commit d18b1808d9
6 changed files with 124 additions and 69 deletions

View File

@@ -2866,13 +2866,13 @@ class SyncMulti_Mounting_Type(models.Model):
class SyncFixtureModel(models.Model):
_inherit = 'sf.fixture_model'
_inherit = 'sf.fixture.model'
_description = '同步夹具型号列表'
url = '/api/fixture_model/list'
# 定时同步夹具物料列表
def sync_multi_mounting_type(self):
# 定时同步夹具型号列表
def sync_fixture_model(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
@@ -2893,11 +2893,11 @@ class SyncFixtureModel(models.Model):
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"fixture_material_id": self.env['mrs.fixture.material'].search(
"fixture_material_id": self.env['sf.fixture.material'].search(
[('code', '=', item.fixture_material_code)]).id,
"multi_mounting_type_id": self.env['mrs.multi_mounting.type'].search(
"multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
[('code', '=', item.multi_mounting_type_code)]).id,
"brand_id": self.env['mrs.machine.brand'].search([('code', '=', item.brand_code)]).id,
"brand_id": self.env['sf.machine.brand'].search([('code', '=', item.brand_code)]).id,
"clamping_way": item.clamping_way,
"port_type": item.port_type,
"model_file": item.model_file,
@@ -2910,8 +2910,8 @@ class SyncFixtureModel(models.Model):
"clamp_workpiece_height_max": item.clamp_workpiece_height_max,
"clamp_workpiece_diameter_max": item.clamp_workpiece_diameter_max,
"maximum_carrying_weight": item.maximum_carrying_weight,
"Maximum_clamping_force": item.Maximum_clamping_force,
"materials_model_id": self.env['mrs.materials.model'].search(
"maximum_clamping_force": item.maximum_clamping_force,
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item.materials_model_code)]).id,
"driving_way": item.driving_way,
"apply_machine_tool_type": item.apply_machine_tool_type,
@@ -2921,11 +2921,11 @@ class SyncFixtureModel(models.Model):
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"fixture_material_id": self.env['mrs.fixture.material'].search(
"fixture_material_id": self.env['sf.fixture.material'].search(
[('code', '=', item.fixture_material_code)]).id,
"multi_mounting_type_id": self.env['mrs.multi_mounting.type'].search(
"multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
[('code', '=', item.multi_mounting_type_code)]).id,
"brand_id": self.env['mrs.machine.brand'].search([('code', '=', item.brand_code)]).id,
"brand_id": self.env['sf.machine.brand'].search([('code', '=', item.brand_code)]).id,
"clamping_way": item.clamping_way,
"port_type": item.port_type,
"model_file": item.model_file,
@@ -2938,8 +2938,8 @@ class SyncFixtureModel(models.Model):
"clamp_workpiece_height_max": item.clamp_workpiece_height_max,
"clamp_workpiece_diameter_max": item.clamp_workpiece_diameter_max,
"maximum_carrying_weight": item.maximum_carrying_weight,
"Maximum_clamping_force": item.Maximum_clamping_force,
"materials_model_id": self.env['mrs.materials.model'].search(
"maximum_clamping_force": item.maximum_clamping_force,
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item.materials_model_code)]).id,
"driving_way": item.driving_way,
"apply_machine_tool_type": item.apply_machine_tool_type,
@@ -2947,7 +2947,7 @@ class SyncFixtureModel(models.Model):
else:
raise ValidationError("认证未通过")
# 定时同步所有夹具物料列表
# 定时同步所有夹具型号列表
def sync_all_fixture_model(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
@@ -2970,11 +2970,11 @@ class SyncFixtureModel(models.Model):
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"fixture_material_id": self.env['mrs.fixture.material'].search(
"fixture_material_id": self.env['sf.fixture.material'].search(
[('code', '=', item.fixture_material_code)]).id,
"multi_mounting_type_id": self.env['mrs.multi_mounting.type'].search(
"multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
[('code', '=', item.multi_mounting_type_code)]).id,
"brand_id": self.env['mrs.machine.brand'].search([('code', '=', item.brand_code)]).id,
"brand_id": self.env['sf.machine.brand'].search([('code', '=', item.brand_code)]).id,
"clamping_way": item.clamping_way,
"port_type": item.port_type,
"model_file": item.model_file,
@@ -2987,8 +2987,8 @@ class SyncFixtureModel(models.Model):
"clamp_workpiece_height_max": item.clamp_workpiece_height_max,
"clamp_workpiece_diameter_max": item.clamp_workpiece_diameter_max,
"maximum_carrying_weight": item.maximum_carrying_weight,
"Maximum_clamping_force": item.Maximum_clamping_force,
"materials_model_id": self.env['mrs.materials.model'].search(
"maximum_clamping_force": item.maximum_clamping_force,
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item.materials_model_code)]).id,
"driving_way": item.driving_way,
"apply_machine_tool_type": item.apply_machine_tool_type,
@@ -2998,11 +2998,11 @@ class SyncFixtureModel(models.Model):
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"fixture_material_id": self.env['mrs.fixture.material'].search(
"fixture_material_id": self.env['sf.fixture.material'].search(
[('code', '=', item.fixture_material_code)]).id,
"multi_mounting_type_id": self.env['mrs.multi_mounting.type'].search(
"multi_mounting_type_id": self.env['sf.multi_mounting.type'].search(
[('code', '=', item.multi_mounting_type_code)]).id,
"brand_id": self.env['mrs.machine.brand'].search([('code', '=', item.brand_code)]).id,
"brand_id": self.env['sf.machine.brand'].search([('code', '=', item.brand_code)]).id,
"clamping_way": item.clamping_way,
"port_type": item.port_type,
"model_file": item.model_file,
@@ -3015,8 +3015,8 @@ class SyncFixtureModel(models.Model):
"clamp_workpiece_height_max": item.clamp_workpiece_height_max,
"clamp_workpiece_diameter_max": item.clamp_workpiece_diameter_max,
"maximum_carrying_weight": item.maximum_carrying_weight,
"Maximum_clamping_force": item.Maximum_clamping_force,
"materials_model_id": self.env['mrs.materials.model'].search(
"maximum_clamping_force": item.maximum_clamping_force,
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item.materials_model_code)]).id,
"driving_way": item.driving_way,
"apply_machine_tool_type": item.apply_machine_tool_type,