JobDone数据处理源代码_第1页
JobDone数据处理源代码_第2页
JobDone数据处理源代码_第3页
JobDone数据处理源代码_第4页
JobDone数据处理源代码_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、JobDone数据处理源代码# JobDone处理web中间件传回的数据 同时操作本地sql数据库Sub JobDone (Job As HttpJob) Log("JobName = " & Job.JobName & ", Success = " & Job.Success) If Job.Success = True Then Select Job.JobName Case "Job1" 'print the result to the logs 'Log(Job.GetString)Di

2、m JSON As JSONParser Dim Map1 As Map JSON.Initialize(Job.GetString)Map1 = JSON.NextObjectDim m1 As StringDim m As Map 'helper map for navigatingDim MenuItems As List'log("success":False,"message":"用户名或密码错误!"Log(11111111111111111111111111111111111) m1 = Map1.Get(

3、"success") Log( m1)'Log(m.Get(m.GetKeyAt(0) If m1=False Then mymsg("用户名或密码错误!") Return End Ifm = Map1.Get("data")id=m.Get("ID")Name =m.Get("UserName")sj =m.Get("ExpirationDate")ppxtp1t.Text ="系统("&Name&")"If

4、jcsj(sj) =1 Thenmymsg("软件已经到期,过期日期:"&sj)ReturnEnd Ifmymsg(Name&"登录成功"&CRLF&"id:"&id&CRLF&"过期日期:"&sj)Log(Name&"登录成功"&"id"&id&"过期日期"&sj)If pxtc.Checked=True ThenFile.WriteString(Fi

5、le.DirInternal,"dl.txt",Job.GetString)End IfPxt.Visible=False'加密jm'For i = 0 To m.Size - 1''m = m.GetKeyAt(i) 'Log( m.GetKeyAt(i)'Log( m.Get(m.GetKeyAt(i)'Next''=Case "Job9"Log(Job.GetString)If Job.GetString<>"1" ThenExitApplica

6、tionEnd If'=Case "Job4" 'Log(Job.GetString)Dim JSON As JSONParser Dim Map1 As Map JSON.Initialize(Job.GetString)Map1 = JSON.NextObjectDim m1 As StringDim m As Map 'helper map for navigatingDim MenuItems As List m1 = Map1.Get("success") Log( m1)'Log(m.Get(m.GetKeyA

7、t(0) If m1=False Then mymsg("新建用户不成功!") Return Else mymsg("新建成功!") Dim m As Map 'helper map for navigatingDim ml As Listm = Map1.Get("data") Dim Query As String Query = "INSERT INTO bd " _&"(Name,OrgGroupName,CallName,ChildrenName,Email,OrgGroup,C

8、hildrenSchool,ID,Organization,PhoneNo,WeiXin,Birthday,Address) " _&"VALUES ('"&m.Get("Name")&"','"&m.Get("OrgGroupName")&"','"&m.Get("CallName")&"','"&m.Get("Ch

9、ildrenName")&"','"&m.Get("Email")&"','"&m.Get("OrgGroup")&"','"&m.Get("ChildrenSchool")&"','"&m.Get("ID")&"','"&m.Get("O

10、rganization")&"','"&m.Get("PhoneNo")&"','"&m.Get("WeiXin")&"','"&m.Get("Birthday")&"','"&m.Get("Address")&"')" SQL1.ExecNonQuery(Quer

11、y)mymsg("同步完成") p4.Visible =False End If'= Case "Job3" 'print the result to the logs 'Log(Job.GetString)Dim JSON As JSONParserDim Map1 As MapJSON.Initialize(Job.GetString)Map1 = JSON.NextObjectDim m As Map 'helper map for navigatingDim ml As Listml = Map1.Get(&quo

12、t;data")'Map1.SizeDim Query2 As String Query2 = "DELETE FROM bd" SQL1.ExecNonQuery(Query2)Query2 = "update sqlite_sequence set seq=0 where Name='bd'"SQL1.ExecNonQuery(Query2)For i = 0 To ml.Size - 1m=ml.Get(i) Dim Query As String Query = "INSERT INTO bd &quo

13、t; _&"(Name,OrgGroupName,CallName,ChildrenName,Email,OrgGroup,ChildrenSchool,ID,Organization,PhoneNo) " _&"VALUES ('"&m.Get("Name")&"','"&m.Get("OrgGroupName")&"','"&m.Get("CallName"

14、)&"','"&m.Get("ChildrenName")&"','"&m.Get("Email")&"','"&m.Get("OrgGroup")&"','"&m.Get("ChildrenSchool")&"','"&m.Get("ID"

15、;)&"','"&m.Get("Organization")&"','"&m.Get("PhoneNo")&"')" SQL1.ExecNonQuery(Query)DoEventsNextmymsg("同步完成")ppxtan1.Enabled=Truepb.Visible =FalseDim sjsj As String sjsj=DateTime.Date(DateTime.Now)&

16、;" "& DateTime.time(DateTime.Now)ppxtl3.Text="数据同步至:"&sjsjFile.WriteString(File.DirInternal,"ytsj.txt",sjsj)'=同步计划 Case "Job5" 'print the result to the logs 'Log(Job.GetString)Dim JSON As JSONParserDim Map1 As MapJSON.Initialize(Job.GetStri

17、ng)Map1 = JSON.NextObjectDim m As Map 'helper map for navigatingDim ml As Listml = Map1.Get("data")'Map1.SizeDim Query2 As String Query2 = "DELETE FROM PL" SQL1.ExecNonQuery(Query2)Query2 = "update sqlite_sequence set seq=0 where Name='PL'"SQL1.ExecNonQu

18、ery(Query2) For i = 0 To ml.Size - 1 m=ml.Get(i)Log(m.Get("ID")&"-"&m.Get("PlanName") Dim ml2 As ListDim ml3 As List ml2 = m.Get("SendPlanDetailList")ml3 = m.Get("SendPlanContractList")Dim yhs As Stringyhs=ml3.SizeFor ii = 0 To ml2.Size - 1 D

19、im map2 As Map map2=ml2.Get(ii) Log(map2.Get("SendDate")&"-"&map2.Get("Content") Dim sj As String Dim sj1 As StringDim sj2 As StringDateTime.DateFormat="yyyy-MM-dd"DateTime.timeFormat="HH:mm:ss"sj=map2.Get("SendDate")If sj.IndexOf (

20、"T")>0 Then sj1=sj.SubString2(0,10)sj2=sj.SubString2(11,19)sj=sj1&" "&sj2Log(sj)Elsesj="1900-01-01 00:00:00"End If Dim Query As String Query = "INSERT INTO PL " _&"(ID,PlanName,Content,SendDate,CID) " _&"VALUES ('"&am

21、p;m.Get("ID")&"','"&m.Get("PlanName")&"','"&map2.Get("Content")&"','"&sj&"','"&yhs&"')"Log(Query) SQL1.ExecNonQuery(Query)Dim Cursor7 As CursorDim s

22、qls As String Dim wenben As String sqls="Select Max(id2) As ok FROM pl"Cursor7 = SQL1.ExecQuery(sqls)If Cursor7.RowCount > 0 ThenCursor7.Position = 0For iii = 0 To ml3.Size - 1 Dim Query As String Query = "INSERT or ignore INTO PLC " _&"(jhid,id,pid,k) " _&&q

23、uot;VALUES ('"&m.Get("ID")&"','"&ml3.Get(iii)&"','"&Cursor7.GetString("ok")&"','"&m.Get("ID")&ml3.Get(iii)&Cursor7.GetString("ok")&"')" SQL1.Ex

24、ecNonQuery(Query)DoEvents Next End IfCursor7.CloseNext Next mymsg("同步完成")SQL1.ExecNonQuery("update PL SET zt='运行' where SendDate>datetime('now','localtime')")Log("update PL SET zt='运行' where SendDate>datetime('now','localtime

25、')")ppxtan3.Enabled=Truepb.Visible =FalseDim sjsj As String sjsj=DateTime.Date(DateTime.Now)&" "& DateTime.time(DateTime.Now)ppxtl3.Text="数据同步至:"&sjsjFile.WriteString(File.DirInternal,"ytsj.txt",sjsj)'=Case "Job7"Dim JSON As JSONParser

26、 Dim Map1 As Map JSON.Initialize(Job.GetString)Map1 = JSON.NextObjectDim m1 As StringDim m2 As Int m1 = Map1.Get("success") Log( m1)'Log(m.Get(m.GetKeyAt(0) If m1=False Then mymsg("数据读取错误!") Return End Ifm2 = Map1.Get("data")Log( m2)SQL1.ExecNonQuery("update wh SET s="&m2)StopService(fuwu)StartService(fuwu)L

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论