当前位置: 首页 > news >正文

英语培训网站建设丰顺最新新闻今天

英语培训网站建设,丰顺最新新闻今天,站长之家域名查询鹿少女,wordpress主机空间选择监测数据采集物联网应用开发步骤(2) 系统整体结构搭建 新建项目 输入项目名称:MonitorData 所谓兵马未动粮草先行,按下图创建好对应的模块备用: com.plugins 业务插件模块 com.zxy.adminlog 日志或文本文…
  1. 监测数据采集物联网应用开发步骤(2)

系统整体结构搭建

新建项目

输入项目名称:MonitorData

所谓兵马未动粮草先行,按下图创建好对应的模块备用:

com.plugins                     业务插件模块

com.zxy.adminlog            日志或文本文件读写模块

com.zxy.autoUpdate       程序版本自动更新模块

com.zxy.business             通用业务处理模块

com.zxy.common            通用函数模块

com.zxy.comport             串口通讯模块

com.zxy.db_Self               静态接口配置库(Sqlit3)模块

com.zxy.db1                     静态接口配置库(Sqlit3)模块

com.zxy.db2                     业务数据库(Sqlite3)模块

com.zxy.interfaceReflect         通用插件管理模块

com.zxy.main                   全局变量初始化模块

com.zxy.taskhandler        定时器任务模块

com.zxy.tcp                      tcp协议模块

编写主程序代码MonitorDataCmd.py,打印启动时间,sleep 5秒,然后打印结束时间

#! python3
# -*- coding: utf-8 -
'''
Created on 2023年08月28日
@author: zxyong 13738196011
'''import time
from com.zxy.common.Com_Fun import Com_Fun#监测数据采集物联网应用-主程序
class MonitorDataCmd(object):def __init__(self, params):passif __name__ == '__main__':print("监测数据采集物联网应用软件开始:"+Com_Fun.GetTimeDef())time.sleep(5)print("监测数据采集物联网应用软件结束:"+Com_Fun.GetTimeDef())

新建通用函数代码com.zxy.common.Com_Fun.py

#! python3
# -*- coding: utf-8 -
'''
Created on 2023年08月28日
@author: zxyong 13738196011
'''import datetime,uuid,time
from datetime import timedelta#监测数据采集物联网应用--通用函数
class Com_Fun():def __init__(self):pass@staticmethoddef NoNull(objTag):if objTag is None:return ""else:return str(objTag)@staticmethoddef FloatNull(objTag):if objTag is None or objTag == "" or objTag == "-":return 0else:return float(objTag)@staticmethoddef ZeroNull(objTag):if objTag is None or objTag == "":return 0else:return int(objTag)@staticmethoddef GetLong(inputTimeFormat,inputTime):if len(inputTime) > 19:inputTime = inputTime[0:19]time1=datetime.datetime.strptime(inputTime.replace("T"," "),inputTimeFormat)return time.mktime(time1.timetuple())#获得当前时间戳@staticmethoddef getTimeLong():temT = datetime.datetime.now()timeStamp = time.mktime(temT.timetuple())return timeStamp#日期信息格式化timeFormat : '%Y-%m-%d %H:%M:%S'@staticmethoddef GetTime(inputTimeFormat):return datetime.datetime.now().strftime(inputTimeFormat)#日期信息格式化秒数据10整数化@staticmethoddef GetTimeNum(inputTime):temTime = datetime.datetime.strptime(inputTime.replace("T", " "),"%Y-%m-%d %H:%M:%S")temSB = temTime.strftime("%Y-%m-%d %H:%M")temSE = temTime.strftime("%S")temSec = int(int(temSE) / 10)return temSB+":"+str(temSec)+"0"#日期信息格式化timeFormat : '%Y-%m-%d %H:%M:%S'@staticmethoddef GetTimeDef():return str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))#日期信息格式化timeFormat : '%Y-%m-%d %H:%M:%S' 字符串@staticmethoddef GetTimeInput(inputTimeFormat,inputTime):if inputTime is None or inputTime == "":return "1900-01-01 00:00:00"time1=datetime.datetime.strptime(inputTime.replace("T", " "),inputTimeFormat)return time1#日期信息格式化timeFormat : '%Y-%m-%d %H:%M:%S' 字符串@staticmethoddef GetStrTimeInput(inputTimeFormat,inputTime):if inputTime is None or inputTime == "":return "1900-01-01 00:00:00"time1=datetime.datetime.strptime(inputTime.replace("T", " "),inputTimeFormat)return str(time1)#返回time格式@staticmethoddef GetToTimeInput(inputTimeFormat,inputTime):if inputTime is None or inputTime == "":return "1900-01-01 00:00:00"elif len(inputTime) <= 19:return datetime.datetime.strptime(inputTime.replace("T"," "),inputTimeFormat)else:return datetime.datetime.strptime(inputTime[0:19],inputTimeFormat)#日期信息格式化timeFormat : '%Y-%m-%d %H:%M:%S',返回字符串格式@staticmethoddef GetDateInput(inputDateFormat,inputTimeFormat,inputTime):if len(inputTime) < 10 or inputTime is None or  inputTime == "":return "1900-01-01"time1=datetime.datetime.strptime(inputTime.replace("T"," "),inputTimeFormat)return time1.strftime(inputDateFormat)#(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)@staticmethoddef DateTimeAdd(inputDate,inputDateType,inputNum):#%d %H:%M:%Sdelta = Noneif inputDateType == "d":delta = timedelta(days=inputNum)elif inputDateType == "W":delta = timedelta(weeks=inputNum)elif inputDateType == "H":delta = timedelta(hours=inputNum)elif inputDateType == "M":delta = timedelta(minutes=inputNum)elif inputDateType == "S":delta = timedelta(seconds=inputNum)return inputDate + delta@staticmethoddef SetHashTable(inputHt,inputStrKey,inputStrValue):if inputHt is None:inputHt = {}inputHt[inputStrKey] = inputStrValue@staticmethoddef GetHashTable(inputHt,inputStrKey):if inputHt is None or inputStrKey not in list(inputHt.keys()):return ""else:return inputHt[inputStrKey]@staticmethoddef GetHashTableNone(inputHt,inputStrKey):if inputHt is None or inputStrKey not in list(inputHt.keys()):return Noneelse:return inputHt[inputStrKey]@staticmethoddef RemoveHashTable(inputHt,inputStrKey):if inputHt.get(inputStrKey) is not None:inputHt.pop(inputStrKey)@staticmethoddef Str_To_Int(inputStr):if inputStr is not None and inputStr != "":return int(inputStr)else:return 0@staticmethoddef Get_New_GUID():return str(uuid.uuid1()).upper()

运行程序,选择主程序右键:

程序执行结果:

恭喜你!系统整体结构搭建完成。

  1. 监测数据采集物联网应用开发步骤(4)
http://www.yayakq.cn/news/313241/

相关文章:

  • 网站改版影响seo吗石景山老山网站建设
  • 织梦网站上传步骤360的网站怎么做
  • 南京建设监理协会网站打不开广东百度推广的代理商
  • 低代码平台 开源灰色词优化培训
  • 网站收录量php做购物网站的弊端
  • 沈阳网站建设团队免费建论坛
  • 网站系统繁忙是什么原因北京网站seo哪家公司好
  • 礼盒包装设计网站泰安肥城网站建设
  • xp网站建设网站群系统建设的目的
  • 做商品网站的教学视频用阿里云建站wordpress
  • wordpress价格插件长春seo关键字排名优化
  • 网站开发好了如何上线移动端开发工具
  • 自己做商城网站无锡专业做网站的公司有哪些
  • 新闻类网站模板苏州建设营销网站
  • asp婚纱摄影网站网站建设与制作教案
  • 巡视组 住房与城乡建设部网站秦皇岛市建设银行网点
  • 自己做网络棋牌网站流程哈尔滨网络科技公司网站
  • 黑色网站模板资讯是做网站还是公众号
  • 网站建设功能报价单ping wordpress
  • 淮南医院网站建设软件开发专业能力
  • 商城网站有哪些功能网站建设公司主营业务
  • 网站建好了还需要什么维护莆田建设网站建站
  • 网站网页设计尺寸wordpress版本下载
  • wordpress下载5.0.3网站做优化需要多少钱
  • 网站优化塔山双喜电影视频网站怎么做
  • 网站建设公司石家庄爱美眉网站源码
  • 泗洪建设局网站百度员工收入工资表
  • 常见的网站推广途径云南建投第十建设有限公司网站
  • 用vs2012做网站宁津做网站
  • 绵阳网站建设 经开区成都住建局官网怎么查询楼盘剩余房