rabin 5 gadi atpakaļ
vecāks
revīzija
d472960a61
5 mainītis faili ar 54 papildinājumiem un 26 dzēšanām
  1. 5 5
      admin/page/device.py
  2. 1 1
      admin/page/origin.py
  3. 2 2
      conf/dev.conf
  4. 36 8
      conf/env.conf
  5. 10 10
      front/page/device.py

+ 5 - 5
admin/page/device.py

@@ -101,7 +101,7 @@ class info_path(Load):
 			,state = True
 		)
 		self.data['common']['search_type_id-select-'] = self.service('common').list('setting_device_type')
-		self.data['common']['search_gateway_id-select---farm_id'] = self.service('common').list('device_gateway')
+		self.data['common']['search_gateway_id-select---farm_id'] = self.service('common').list('device_gateway', order='hardware_id asc')
 		self.data['common']['search_hardware_type-select-'] = self.service('common').list('hardware_type')
 		"""
 		if self.data['common']['search_hardware_type-select-']:
@@ -194,7 +194,7 @@ class info_update_path(Load):
 				,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址', u'排序')
 				,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-input-')
 				,update_farm_id = Demeter.config['setting']['farmList']
-				,update_gateway_id = self.service('common').list('device_gateway')
+				,update_gateway_id = self.service('common').list('device_gateway', order='hardware_id asc')
 				#,update_hardware_type = self.service('common').list('hardware_type')
 			)
 		elif self.data['info']['hardware_type'] == 6:
@@ -203,7 +203,7 @@ class info_update_path(Load):
 				,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址', u'排序')
 				,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-input-')
 				,update_farm_id = Demeter.config['setting']['farmList']
-				,update_gateway_id = self.service('common').list('device_gateway')
+				,update_gateway_id = self.service('common').list('device_gateway', order='hardware_id asc')
 			)
 		elif self.data['info']['hardware_type'] in (2,4):
 			self.set(
@@ -252,7 +252,7 @@ class camera_update_path(Load):
 			,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址',u'排序')
 			,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-text-')
 			,update_farm_id = Demeter.config['setting']['farmList']
-			,update_gateway_id = self.service('common').list('device_gateway')
+			,update_gateway_id = self.service('common').list('device_gateway', order='hardware_id asc')
 		)
 		self.one('device_info')
 		self.show('update')
@@ -282,7 +282,7 @@ class camera_pic_update_path(Load):
 			,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址',u'排序')
 			,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-text-')
 			,update_farm_id = Demeter.config['setting']['farmList']
-			,update_gateway_id = self.service('common').list('device_gateway')
+			,update_gateway_id = self.service('common').list('device_gateway', order='hardware_id asc')
 		)
 		self.one('device_info')
 		self.show('update')

+ 1 - 1
admin/page/origin.py

@@ -38,7 +38,7 @@ class batch_update_path(Load):
 			path = '/origin/batch'
 			,label = (u'产品名称', u'种植时间',u'采收时间',u'设备网关',u'地块',u'图像记录')
 			,update = ('name-input-required', 'zzdate-date-required', 'csdate-date-required','gateway_id-select-required','land_id-select-required','pic-pic-required')
-			,update_gateway_id = self.service('common').list('device_gateway')
+			,update_gateway_id = self.service('common').list('device_gateway', order='hardware_id asc')
 			,update_land_id = self.service('common').list('farm_work_land')
 		)
 		self.one('origin_batch')

+ 2 - 2
conf/dev.conf

@@ -51,7 +51,7 @@ password			= public
 timeout				= 60
 ;topic定义
 topic				= method/type/gateway/device
-sub					= pic,sensor,control,power
+sub					= pic,sensor,control,power,status,log
 
 ;后台配置
 [admin]
@@ -84,7 +84,7 @@ mobile				= True
 
 ;网站前台配置
 [web]
-port                = 8089
+port                = 8092
 debug               = True
 max_buffer_size     = 210763776
 process             = 0

+ 36 - 8
conf/env.conf

@@ -16,7 +16,7 @@ host				= iot-pgsql
 port				= 5432
 username			= postgres
 password			= 123456
-dbname				= xinnongbaohe
+dbname				= xinnongbaohe_eros
 prefix				= demeter
 ;允许自动建表
 create				= True
@@ -26,7 +26,7 @@ host                = iot-influx
 port                = 8086
 username            = root
 password            = root
-dbname              = xinnongbaohe
+dbname              = xinnongbaohe_eros
 prefix              = demeter
 
 [redis]
@@ -54,16 +54,44 @@ debug				= True
 max_buffer_size		= 210763776
 ;子进程
 process				= 0
-;top菜单的数据来源
-top 				= farm
+;定义后台父级菜单
+menu_parent			= 农场管理:,设备管理:,配置管理:
+;定义后台子级菜单
+menu_child			= 基础资料:/farm/info?id=1,用户管理:/farm/user,产品管理:/farm/product,地块管理:/work/land,农事管理:/work/work;网关列表:/device/gateway,设备列表:/device/info;产品配置:/setting/product,服务配置:/setting/server,设备类型:/setting/device_type,硬件类型:/hardware/type,MODBUS命令码:/setting/modbus_code,错误码配置:/device/notice_type,消息类型设置:/msg/type
+
+;cookie
+cookie_secret       = 61oETzKXQAGaYekL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=
+login_url           = /user/login
+;是否使用安全cookie
+xsrf_cookies        = True
 
 ;前台配置
 [front]
-port				= 8090
+port				= 8091
 debug				= True
 max_buffer_size		= 210763776
 process				= 0
-;url					= http://www.xinnongbaohe.com:8090/device
-url					= http://v3.xinnongbaohe.com/device
+url					= http://192.168.33.10:8091/device
 qrcode				= http://pan.baidu.com/share/qrcode?w=300&h=300&url=
-mobile				= True
+mobile				= True
+
+;网站前台配置
+[web]
+port                = 8092
+debug               = True
+max_buffer_size     = 210763776
+process             = 0
+url                 = http://www.xinnongbaohe.com/
+farmurl             = http://farm.xinnongbaohe.com/?id=
+originurl           = http://s.xinnongbaohe.com/?id=
+
+;云端配置
+[zeus]
+host                = http://192.168.33.10:8088/
+
+;同步配置
+[sync]
+;同步的表,多个用逗号隔开
+table               = farm,farm_user,farm_product,farm_work,farm_work_method,farm_work_category,farm_work_land,origin_batch,origin_growth,device_info,device_gateway,device_camera,device_camera_pic,device_group,device_page,device_pic,device_printer,device_set_condition,device_set_loop,device_set_timing
+;同步的方法,仅限service
+service              = core,zeus

+ 10 - 10
front/page/device.py

@@ -11,7 +11,7 @@ class index_path(Load):
 	@Web.setting
 	def get(self):
 		# 获取网关列表
-		self.data['gateway'] = self.service('common').list('device_gateway', state=True, search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', state=True, search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		# 获取页面
 		self.data['page'] = self.service('common').list('device_page', order='inorder asc,cdate desc', search={'farm_id':self.data['setting']['farm']})
 		self.view("device/index.html")
@@ -121,7 +121,7 @@ class screen_set_path(Load):
 	def get(self):
 		self.data['info'] = self.data['setting']['farmInfo']
 		self.data['info']['devices'] = self.data['info']['gateway']
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type--ins' : (2,4,5),'farm_id':self.data['setting']['farm']})
 		self.view("device/alert/screen.html")
 
@@ -355,7 +355,7 @@ class update_group_path(Load):
 		if id:
 			self.data['info'] = self.service('common').one('device_group', id=id)
 
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'farm_id':self.data['setting']['farm']})
 		self.view("device/alert/group.html")
 
@@ -414,7 +414,7 @@ class update_set_mul_path(Load):
 		if id:
 			self.data['info'] = self.service('common').one('device_mul', id=id)
 
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type' : 3,'farm_id':self.data['setting']['farm']})
 		self.data['type'] = ({'id':1, 'name':'开关'},{'id':2, 'name':'卷帘'})
 		self.view("device/alert/mul.html")
@@ -458,7 +458,7 @@ class set_timing_path(Load):
 		self.data['name'] = '定时设置'
 		Device.set(self)
 		Device.setCronOper(self)
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type': 3,'farm_id':self.data['setting']['farm']})
 		self.data['list'] = self.service('common').list('device_set_timing', state=True, page={'num':10}, search={'farm_id':self.data['setting']['farm']})
 		if self.data['list']:
@@ -492,7 +492,7 @@ class update_set_timing_path(Load):
 			if self.data['info'] and self.data['info']['zdate']:
 				self.data['info']['zdate'] = Demeter.date(self.data['info']['zdate'])
 
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type' : 3,'farm_id':self.data['setting']['farm']})
 		self.view("device/alert/timing.html")
 
@@ -536,7 +536,7 @@ class set_loop_path(Load):
 		self.data['name'] = '周期设置'
 		Device.set(self)
 		Device.setCronOper(self)
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type': 3,'farm_id':self.data['setting']['farm']})
 		self.data['list'] = self.service('common').list('device_set_loop', page={'num':10}, search={'farm_id':self.data['setting']['farm']})
 		if self.data['list']:
@@ -576,7 +576,7 @@ class update_set_loop_path(Load):
 		if id:
 			self.data['info'] = self.service('common').one('device_set_loop', id=id)
 
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type' : 3,'farm_id':self.data['setting']['farm']})
 		self.view("device/alert/loop.html")
 
@@ -631,7 +631,7 @@ class set_condition_path(Load):
 		self.data['name'] = '条件控制'
 		Device.set(self)
 		Device.setCronOper(self)
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type': 3,'farm_id':self.data['setting']['farm']})
 		self.data['list'] = self.service('common').list('device_set_condition', state=True, page={'num':10}, search={'farm_id':self.data['setting']['farm']})
 		if self.data['list']:
@@ -664,7 +664,7 @@ class update_set_condition_path(Load):
 		if id:
 			self.data['info'] = self.service('common').one('device_set_condition', id=id)
 
-		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']})
+		self.data['gateway'] = self.service('common').list('device_gateway', search={'farm_id':self.data['setting']['farm']}, order='hardware_id asc')
 		self.data['device'] = Device.getByGateway(self, search={'hardware_type' : 3,'farm_id':self.data['setting']['farm']})
 		self.data['device_list'] = self.service('common').list('device_info', search={'hardware_type--ins' : (2,4),'gateway_id':self.data['gateway'][0]['id']})
 		self.view("device/alert/condition.html")