|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import datetime
|
|
|
|
from peewee import *
|
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
|
|
from utils.DBModels.BaseModel import BaseModel
|
|
|
|
|
|
|
|
sys.path.append('../')
|
|
|
|
sys.path.append('../../../')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PressureTranslationBlock(BaseModel):
|
|
|
|
index = CharField()
|
|
|
|
paramName = CharField()
|
|
|
|
objectType = CharField()
|
|
|
|
dataType = CharField()
|
|
|
|
saveType = CharField()
|
|
|
|
dataSize = CharField()
|
|
|
|
accessType = CharField()
|
|
|
|
transferType = CharField()
|
|
|
|
description = CharField()
|
|
|
|
createTime = CharField()
|
|
|
|
|
|
|
|
# 查询设备是否存在
|
|
|
|
@classmethod
|
|
|
|
def getallParame(cls):
|
|
|
|
devices = cls.get_all()
|
|
|
|
if devices is 'error':
|
|
|
|
return
|
|
|
|
l = []
|
|
|
|
for x in devices:
|
|
|
|
l.append([x.index, x.paramName, x.description, x.dataType, x.accessType])
|
|
|
|
return l
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def getByName(cls, paramName):
|
|
|
|
try:
|
|
|
|
return cls.get(cls.paramName == str(paramName))
|
|
|
|
except Exception as e:
|
|
|
|
return
|
|
|
|
|
|
|
|
def addParame(self, index, paramName, objectType, dataType, saveType, dataSize, accessType, transferType, description):
|
|
|
|
self.index = index
|
|
|
|
self.paramName = paramName
|
|
|
|
self.objectType = objectType
|
|
|
|
self.dataType = dataType
|
|
|
|
self.saveType = saveType
|
|
|
|
self.dataSize = dataSize
|
|
|
|
self.accessType = accessType
|
|
|
|
self.transferType = transferType
|
|
|
|
self.description = description
|
|
|
|
self.createTime = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S')
|
|
|
|
# print(self.createTime)
|
|
|
|
self.save()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PhysicalBlock(PressureTranslationBlock):
|
|
|
|
index = CharField()
|
|
|
|
paramName = CharField()
|
|
|
|
objectType = CharField()
|
|
|
|
dataType = CharField()
|
|
|
|
saveType = CharField()
|
|
|
|
dataSize = CharField()
|
|
|
|
accessType = CharField()
|
|
|
|
transferType = CharField()
|
|
|
|
description = CharField()
|
|
|
|
createTime = CharField()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AIFunctionBlock(PressureTranslationBlock):
|
|
|
|
index = CharField()
|
|
|
|
paramName = CharField()
|
|
|
|
objectType = CharField()
|
|
|
|
dataType = CharField()
|
|
|
|
saveType = CharField()
|
|
|
|
dataSize = CharField()
|
|
|
|
accessType = CharField()
|
|
|
|
transferType = CharField()
|
|
|
|
description = CharField()
|
|
|
|
createTime = CharField()
|
|
|
|
|
|
|
|
|