rabin 4 years ago
parent
commit
7b713d42de
3 changed files with 7 additions and 6 deletions
  1. 1 1
      model/device_info.py
  2. 3 1
      model/setting_device_type.py
  3. 3 4
      model/setting_modbus_code.py

+ 1 - 1
model/device_info.py

@@ -18,7 +18,7 @@ class Device_info(Model):
 	server_id = Fields(type='int', comment='服务id')
 	product_id = Fields(type='int', comment='产品id')
 	gateway_id = Fields(type='uuid', comment='网关id')
-	type_id = Fields(type='int', comment='设备类型,从旧版本过度,不做任何修改,直接关联setting_device里的id')
+	type_id = Fields(type='int', comment='设备类型id')
 	value = Fields(type='varchar(1000)', comment='设备传过来的值')
 	exp = Fields(type='varchar(500)', comment='表达式')
 	max = Fields(type='float', comment='最大上限', match='numberFloat|最大上限必须是数字')

+ 3 - 1
model/setting_device_type.py

@@ -5,7 +5,7 @@
     name:device_type.py
     author:rabin
 """
-from __load__ import *
+from .__load__ import *
 
 class Setting_device_type(Model):
 	__table__ = 'setting_device_type'
@@ -15,5 +15,7 @@ class Setting_device_type(Model):
 	key = Fields(type='varchar(50)', comment='设备标识', unique=True)
 	unit = Fields(type='varchar(20)', comment='设备单位')
 	exp = Fields(type='varchar(300)', comment='表达式')
+	data_type = Fields(type='int', comment='数据类型')
+	data_option = Fields(type='text', comment='数据类型选项')
 	state = Fields(type='boolean', default='True', comment='数据存在状态')
 	cdate = Fields(type='int', default='time', comment='创建时间')

+ 3 - 4
model/setting_modbus_code.py

@@ -11,14 +11,13 @@ class Setting_modbus_code(Model):
 	__comment__ = 'modbus命令码'
 	id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='id')
 	name = Fields(type='varchar(50)', comment='命令码名称')
-	device_name = Fields(type='varchar(300)', comment='设备名称,多个用换行隔开')
+	device_type_key = Fields(type='varchar(300)', comment='设备名称,多个用换行隔开')
 	product_id = Fields(type='int', comment='产品id')
 	exp = Fields(type='varchar(300)', comment='设备计算公式,多个用换行隔开')
+	hardware_type = Fields(type='int', comment='硬件类型')
 	oper_type = Fields(type='int', comment='1读取2写入')
-	data_type = Fields(type='int', comment='数据类型')
-	data_option = Fields(type='text', comment='数据类型选项')
 	slave_id = Fields(type='int', comment='从机id', unique=True)
 	register_type = Fields(type='int', comment='寄存器类型')
-	register_address = Fields(type='varchar(200)', comment='寄存器地址和长度,多个用换行隔开')
+	register_address = Fields(type='varchar(200)', comment='寄存器地址和长度,多个用换行隔开,与设备名称对应')
 	state = Fields(type='boolean', default='True', comment='数据存在状态')
 	cdate = Fields(type='int', default='time', comment='创建时间')