新增调取cloud的刀具标准库接口

This commit is contained in:
jinling.yang
2023-10-11 17:39:46 +08:00
parent 0752ba9d2d
commit 296efcc395
5 changed files with 58 additions and 34 deletions

View File

@@ -345,7 +345,7 @@ class sfProductionProcess(models.Model):
self.create({
"name": item['name'],
"category_id": category.id,
"process_encode": item['process_encode'],
"process_encode": item['code'],
"remark": item['remark'],
"active": item['active'],
})
@@ -563,7 +563,7 @@ class MachineBrand(models.Model):
brand = self.search([("code", '=', item['code'])])
if brand:
brand.name = item['name']
brand.image_brand = '' if not item['image_brand'] else base64.b64encode(item.image_brand)
brand.image_brand = '' if not item['image_brand'] else base64.b64decode(item['image_brand'])
brand.active = item['active']
brand.remark = item['remark']
brand.tag_ids = self.env['sf.machine.brand.tags'].search([("name", 'in', item['tag_ids'])]).ids
@@ -571,7 +571,7 @@ class MachineBrand(models.Model):
self.create({
"name": item['name'],
"code": item['code'],
"image_brand": '' if not item['image_brand'] else base64.b64encode(item.image_brand),
"image_brand": '' if not item['image_brand'] else base64.b64decode(item['image_brand']),
"active": item['active'],
"remark": item['remark'],
"tag_ids": self.env['sf.machine.brand.tags'].search([("name", 'in', item['tag_ids'])]).ids,
@@ -593,22 +593,18 @@ class MachineBrand(models.Model):
for item in result['machine_brand_all_list']:
brand = self.search([("code", '=', item['code'])])
if not brand:
if item.get('image_brand'):
image = base64.b64decode(item['image_brand'])
else:
image = ''
self.create({
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"image_brand": image,
"image_brand": '' if not item['image_brand'] else base64.b64decode(item['image_brand']),
"tag_ids": self.env['sf.machine.brand.tags'].search(
[("name", 'in', item['tag_ids'])]).ids
})
else:
brand.name = item['name']
brand.remark = item['remark']
brand.image_brand = '' if not item['image_brand'] else base64.b64encode(item.image_brand)
brand.image_brand = '' if not item['image_brand'] else base64.b64decode(item['image_brand'])
brand.tag_ids = self.env['sf.machine.brand.tags'].search(
[("name", 'in', item['tag_ids'])]).ids
else:
@@ -933,16 +929,13 @@ class sfProductionProcessParameter(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
_logger.info('result:%s' % result)
for item in result['mrs_production_process_parameter_all_list']:
if item:
_logger.info('create可选参数:%s' % item)
production_process_parameter = self.search(
[("code", '=', item['code'])])
process = self.env['sf.production.process'].search(
[('process_encode', '=', item['process_id_code'])])
if not production_process_parameter:
_logger.info('create可选参数:%s' % item)
self.create({
"name": item['name'],
"code": item['code'],
@@ -1569,7 +1562,6 @@ class SfToolType(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
_logger.info('result:%s' % result)
for item in result['mrs_cutting_tool_type_yesterday_list']:
if item:
cutting_tool_type = self.search([("code", '=', item['code'])])
@@ -1604,7 +1596,6 @@ class SfToolType(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
_logger.info('result:%s' % result)
for item in result['mrs_cutting_tool_type_all_list']:
if item:
cutting_tool_type = self.search([("code", '=', item['code'])])
@@ -1647,7 +1638,6 @@ class SfMaintenanceEquipmentImage(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
_logger.info('result:%s' % result)
for item in result['ability_feature_library_yesterday_list']:
if item:
ability_feature_library = self.search([("name", '=', item['name'])])
@@ -1678,7 +1668,6 @@ class SfMaintenanceEquipmentImage(models.Model):
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
_logger.info('result:%s' % result)
for item in result['ability_feature_library_all_list']:
if item:
ability_feature_library = self.search([("name", '=', item['name'])])