This commit is contained in:
gqh
2022-10-10 10:52:24 +08:00
parent 88bed4d910
commit 839de4c95f
11 changed files with 108 additions and 80 deletions

View File

@@ -350,12 +350,13 @@ class MachineBrandTags(models.Model):
"color": item['color'],
})
else:
raise ValidationError("认证未通过")
class MachineControlSystem(models.Model):
_inherit = 'mrs.machine_tool.type.control_system'
_inherit = 'mrs.machine.control_system'
_description = '控制系统'
url = '/api/machine_control_system/list'
@@ -373,7 +374,7 @@ class MachineControlSystem(models.Model):
if result['status'] == 1:
for item in result['machine_control_system_yesterday_list']:
if item:
brand = self.env['mrs.machine_tool.type.control_system'].search(
brand = self.env['mrs.machine.control_system'].search(
[("code", '=', item['code'])])
if brand:
brand.id = item['id'],
@@ -381,7 +382,7 @@ class MachineControlSystem(models.Model):
brand.code = item['code'],
brand.active = item['active']
else:
self.env['mrs.machine_tool.type.control_system'].create({
self.env['mrs.machine.control_system'].create({
"id": item['id'],
"name": item['name'],
"code": item['code'],
@@ -409,12 +410,13 @@ class MachineControlSystem(models.Model):
if result['status'] == 1:
for item in result['machine_control_system_all_list']:
if item:
self.env['mrs.machine_tool.type.control_system'].create({
self.env['mrs.machine.control_system'].create({
"id": item['id'],
"name": item['name'],
"code": item['code'],
# "brand_id": item['brand_id'],
"brand_id": self.env['mrs.machine.brand'].search(
[("id", '=', item['brand_id'])]),
"active": item['active'],
# "tag_ids": item['tag_ids']
@@ -482,7 +484,9 @@ class MachineBrand(models.Model):
"code": item['code'],
# "image_brand": item['image_brand'],
"active": item['active'],
# "tag_ids": item['tag_ids']
"tag_ids": self.env['mrs.machine.brand.tags'].search(
[("id", 'in', item['tag_ids'])])
})
else:
@@ -534,10 +538,10 @@ class MachineTool(models.Model):
kw = json.dumps(machine_tool_list, ensure_ascii=False)
print(type(kw))
r = requests.post(strurl, json={}, data={'kw':kw}, headers=headers)
print(r)
r = requests.post(strurl, json={}, data={'kw': kw}, headers=headers)
else:
raise _logger.info("没有注册机床")
raise ValidationError("没有机床信息")
# 定时同步机床
def sync_machine_tool(self):