JobDone數(shù)據(jù)處理源代碼_第1頁
JobDone數(shù)據(jù)處理源代碼_第2頁
JobDone數(shù)據(jù)處理源代碼_第3頁
JobDone數(shù)據(jù)處理源代碼_第4頁
JobDone數(shù)據(jù)處理源代碼_第5頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、JobDone數(shù)據(jù)處理源代碼# JobDone處理web中間件傳回的數(shù)據(jù) 同時(shí)操作本地sql數(shù)據(jù)庫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":"用戶名或密碼錯(cuò)誤!"Log(11111111111111111111111111111111111) m1 = Map1.Get(

3、"success") Log( m1)'Log(m.Get(m.GetKeyAt(0) If m1=False Then mymsg("用戶名或密碼錯(cuò)誤!") Return End Ifm = Map1.Get("data")id=m.Get("ID")Name =m.Get("UserName")sj =m.Get("ExpirationDate")ppxtp1t.Text ="系統(tǒng)("&Name&")"If

4、jcsj(sj) =1 Thenmymsg("軟件已經(jīng)到期,過期日期:"&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="數(shù)據(jù)同步至:"&sjsjFile.WriteString(File.DirInternal,"ytsj.txt",sjsj)'=同步計(jì)劃 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='運(yùn)行' where SendDate>datetime('now','localtime')")Log("update PL SET zt='運(yùn)行' 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="數(shù)據(jù)同步至:"&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("數(shù)據(jù)讀取錯(cuò)誤!") 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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論