標題:
助航服務費iqy查詢
[打印本頁]
作者:
jewayy
時間:
2014-1-14 07:43
標題:
助航服務費iqy查詢
Dear 各位先進,
此網站的iqy查詢也寫了幾次了,但是下面這個一直鬼打牆寫不出來
不好意思再請教各位一個問題,欲查詢內容如下:
網址:http://portal.sw.nat.gov.tw/APGQ/GC319?request_locale=zh_TW
船舶呼號:9VDB7
查詢結果:
[attach]17256[/attach]
按照之前的經驗,iqy我的寫法如下:
----------
WEB
1
http://portal.sw.nat.gov.tw/APGQ/GC319!query
queryType=2&vslSign=9VDB7
Selection=1
Formatting=None
----------
但一直查詢不到內容,再麻煩各位了,感激不盡。
作者:
joey0415
時間:
2014-1-14 08:16
回復
1#
jewayy
http://portal.sw.nat.gov.tw/APGQ/GC319!query?transportId=&queryType=2&vslSign=
9VDB7
&shipCoCd=
http://portal.sw.nat.gov.tw/APGQ/GC319!query?transportId=&queryType=2&vslSign=9VDB7&shipCoCd=
查詢結果
{"msg":"[執行成功]","netWgt":10855,"shipName":"WAN HAI 301","clearId":"BCF21153004920","shipCoCd":"1105292","data":[{"berthTime":"2013-11-12T14:42:19","item":1,"portName":null,"vslRegNo":"02V538"},{"berthTime":"2013-11-13T00:00:00","item":2,"portName":"TAIPEI","vslRegNo":"02AN57"},{"berthTime":"2013-11-21T13:56:10","item":3,"portName":null,"vslRegNo":"024173"},{"berthTime":"2013-11-22T14:46:39","item":4,"portName":null,"vslRegNo":"02V717"},{"berthTime":"2013-12-11T18:04:49","item":5,"portName":null,"vslRegNo":"02V942"},{"berthTime":"2013-12-12T18:19:50","item":6,"portName":null,"vslRegNo":"02AP87"},{"berthTime":"2013-12-19T22:28:25","item":7,"portName":null,"vslRegNo":"024531"},{"berthTime":"2013-12-20T22:10:42","item":8,"portName":null,"vslRegNo":"02VB13"},{"berthTime":"2014-01-08T14:35:17","item":9,"portName":null,"vslRegNo":"02VD51"},{"berthTime":"2014-01-09T00:00:00","item":10,"portName":"TAIPEI","vslRegNo":"02AS14"}],"vslSign":"9VDB7","issueCustCd":"BC","timeLimit":"2014-03-11T14:42:19","detailShow":"block","addDate":null,"status":"ok","countryCd":"SG","payNote":"N"}
作者:
GBKEE
時間:
2014-1-14 11:00
回復
1#
jewayy
Option Explicit
Sub 助航服務費查詢_GC319()
Dim Element, 船舶呼號 As String, xi As Integer, i As Integer, k As Integer, j As Integer
船舶呼號 = InputBox("船舶呼號")
With CreateObject("InternetExplorer.Application")
' .Visible = True
'.Navigate "http://portal.sw.nat.gov.tw/APGQ/GC319?request_locale=zh_TW"
.Navigate "http://portal.sw.nat.gov.tw/APGQ/GC319"
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
.Document.getelementbyid("queryType1").Click
.Document.getelementbyid("vslSign").Value = 船舶呼號 '"9VDB7"
For Each Element In .Document.getelementsbytagname("INPUT") ' 這個迴圈找到按鈕是第幾個輸入項
If Element.Type = "button" And Trim(Element.Value) = "查詢" Then
Element.Click
Exit For
End If
Next
.Document.getelementsbytagname("SELECT")(0).Value = 30 '資料數
.Document.getelementsbytagname("SELECT")(0).FireEvent ("onchange") '讀取
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
Application.Wait Time + #12:00:02 AM#
If .Document.getelementbyid("statusMsg").Value <> "[執行成功]" Then
MsgBox 船舶呼號 & vbLf & .Document.getelementbyid("statusMsg").Value
.Quit
Exit Sub
End If
Set Element = .Document.getelementsbytagname("TABLE") '
With ActiveSheet
.UsedRange.Clear
k = 1
For xi = 2 To 6
If xi <> 3 Then
For i = 0 To Element(xi).Rows.Length - 1
For j = 0 To Element(xi).Rows(i).Cells.Length - 1
.Cells(k, j + 1) = Element(xi).Rows(i).Cells(j).innertext
Next
k = k + 1
Next
End If
Next
End With
.Quit
End With
MsgBox "Ok"
End Sub
複製代碼
作者:
jewayy
時間:
2014-1-14 16:08
謝謝joey以及GBKEE版大的回覆。
小弟有點疑問,為何一定要加shipCoCd這個條件才跑得出來(還不用給值),不是二選一嗎?
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)