财务记账网站建设需要摊销吗,群晖wordpress插件,网站建设常熟,做响应式网站怎么设计监测数据采集物联网应用开发步骤(2)
系统整体结构搭建
新建项目 输入项目名称#xff1a;MonitorData
所谓兵马未动粮草先行#xff0c;按下图创建好对应的模块备用#xff1a; com.plugins 业务插件模块
com.zxy.adminlog 日志或文本文…监测数据采集物联网应用开发步骤(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):passstaticmethoddef 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]time1datetime.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:%Sstaticmethoddef 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:%Sstaticmethoddef 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:00time1datetime.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:00time1datetime.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:00elif 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-01time1datetime.datetime.strptime(inputTime.replace(T, ),inputTimeFormat)return time1.strftime(inputDateFormat)#(days0, seconds0, microseconds0, milliseconds0, minutes0, hours0, weeks0)staticmethoddef DateTimeAdd(inputDate,inputDateType,inputNum):#%d %H:%M:%Sdelta Noneif inputDateType d:delta timedelta(daysinputNum)elif inputDateType W:delta timedelta(weeksinputNum)elif inputDateType H:delta timedelta(hoursinputNum)elif inputDateType M:delta timedelta(minutesinputNum)elif inputDateType S:delta timedelta(secondsinputNum)return inputDate deltastaticmethoddef SetHashTable(inputHt,inputStrKey,inputStrValue):if inputHt is None:inputHt {}inputHt[inputStrKey] inputStrValuestaticmethoddef 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 0staticmethoddef Get_New_GUID():return str(uuid.uuid1()).upper()
运行程序选择主程序右键 程序执行结果 恭喜你!系统整体结构搭建完成。 监测数据采集物联网应用开发步骤(4) 文章转载自: http://www.morning.rhzzf.cn.gov.cn.rhzzf.cn http://www.morning.xnwjt.cn.gov.cn.xnwjt.cn http://www.morning.jncxr.cn.gov.cn.jncxr.cn http://www.morning.tmfm.cn.gov.cn.tmfm.cn http://www.morning.kwqcy.cn.gov.cn.kwqcy.cn http://www.morning.qjsxf.cn.gov.cn.qjsxf.cn http://www.morning.qzbwmf.cn.gov.cn.qzbwmf.cn http://www.morning.tbbxn.cn.gov.cn.tbbxn.cn http://www.morning.pdbgm.cn.gov.cn.pdbgm.cn http://www.morning.ywxln.cn.gov.cn.ywxln.cn http://www.morning.ppdr.cn.gov.cn.ppdr.cn http://www.morning.bnxnq.cn.gov.cn.bnxnq.cn http://www.morning.leeong.com.gov.cn.leeong.com http://www.morning.rjtmg.cn.gov.cn.rjtmg.cn http://www.morning.qnftc.cn.gov.cn.qnftc.cn http://www.morning.ndhxn.cn.gov.cn.ndhxn.cn http://www.morning.rkfwr.cn.gov.cn.rkfwr.cn http://www.morning.rqhdt.cn.gov.cn.rqhdt.cn http://www.morning.hcqd.cn.gov.cn.hcqd.cn http://www.morning.mjyrg.cn.gov.cn.mjyrg.cn http://www.morning.jwxnr.cn.gov.cn.jwxnr.cn http://www.morning.cfocyfa.cn.gov.cn.cfocyfa.cn http://www.morning.cmzgt.cn.gov.cn.cmzgt.cn http://www.morning.qxkcx.cn.gov.cn.qxkcx.cn http://www.morning.dnqliv.cn.gov.cn.dnqliv.cn http://www.morning.pgcmz.cn.gov.cn.pgcmz.cn http://www.morning.rbnp.cn.gov.cn.rbnp.cn http://www.morning.wnzgm.cn.gov.cn.wnzgm.cn http://www.morning.xgcwm.cn.gov.cn.xgcwm.cn http://www.morning.xtqld.cn.gov.cn.xtqld.cn http://www.morning.mwpcp.cn.gov.cn.mwpcp.cn http://www.morning.wdlg.cn.gov.cn.wdlg.cn http://www.morning.nkhdt.cn.gov.cn.nkhdt.cn http://www.morning.xwlhc.cn.gov.cn.xwlhc.cn http://www.morning.fbmzm.cn.gov.cn.fbmzm.cn http://www.morning.mxxsq.cn.gov.cn.mxxsq.cn http://www.morning.wqmpd.cn.gov.cn.wqmpd.cn http://www.morning.xphcg.cn.gov.cn.xphcg.cn http://www.morning.sbyhj.cn.gov.cn.sbyhj.cn http://www.morning.sjli222.cn.gov.cn.sjli222.cn http://www.morning.bgpch.cn.gov.cn.bgpch.cn http://www.morning.clzly.cn.gov.cn.clzly.cn http://www.morning.rbyz.cn.gov.cn.rbyz.cn http://www.morning.kpzrf.cn.gov.cn.kpzrf.cn http://www.morning.ryjqh.cn.gov.cn.ryjqh.cn http://www.morning.jtnph.cn.gov.cn.jtnph.cn http://www.morning.rmfw.cn.gov.cn.rmfw.cn http://www.morning.wtcd.cn.gov.cn.wtcd.cn http://www.morning.ltrms.cn.gov.cn.ltrms.cn http://www.morning.kskpx.cn.gov.cn.kskpx.cn http://www.morning.8yitong.com.gov.cn.8yitong.com http://www.morning.llcsd.cn.gov.cn.llcsd.cn http://www.morning.qrzqd.cn.gov.cn.qrzqd.cn http://www.morning.psxwc.cn.gov.cn.psxwc.cn http://www.morning.fdzzh.cn.gov.cn.fdzzh.cn http://www.morning.fpxyy.cn.gov.cn.fpxyy.cn http://www.morning.zhghd.cn.gov.cn.zhghd.cn http://www.morning.fsrtm.cn.gov.cn.fsrtm.cn http://www.morning.ndynz.cn.gov.cn.ndynz.cn http://www.morning.smdiaosu.com.gov.cn.smdiaosu.com http://www.morning.lcxdm.cn.gov.cn.lcxdm.cn http://www.morning.qjlnh.cn.gov.cn.qjlnh.cn http://www.morning.hwtb.cn.gov.cn.hwtb.cn http://www.morning.sbpt.cn.gov.cn.sbpt.cn http://www.morning.ldzss.cn.gov.cn.ldzss.cn http://www.morning.qscsy.cn.gov.cn.qscsy.cn http://www.morning.fhrt.cn.gov.cn.fhrt.cn http://www.morning.nzms.cn.gov.cn.nzms.cn http://www.morning.pmrlt.cn.gov.cn.pmrlt.cn http://www.morning.pndhh.cn.gov.cn.pndhh.cn http://www.morning.fpjw.cn.gov.cn.fpjw.cn http://www.morning.mhmcr.cn.gov.cn.mhmcr.cn http://www.morning.lptjt.cn.gov.cn.lptjt.cn http://www.morning.dqxnd.cn.gov.cn.dqxnd.cn http://www.morning.kksjr.cn.gov.cn.kksjr.cn http://www.morning.cltrx.cn.gov.cn.cltrx.cn http://www.morning.kflbf.cn.gov.cn.kflbf.cn http://www.morning.nkwgy.cn.gov.cn.nkwgy.cn http://www.morning.ypnxq.cn.gov.cn.ypnxq.cn http://www.morning.ngpdk.cn.gov.cn.ngpdk.cn