Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HX-PGS-UPDATE.vb 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. Imports System.IO
  2. Imports System.Net
  3. Imports System.Net.NetworkInformation
  4. Public Class HX_PGS_UPDATE
  5. ReadOnly ds2 As New DataSet
  6. ReadOnly computerProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
  7. ReadOnly IPEndPoint() As EndPoint = computerProperties.GetActiveTcpListeners()
  8. Dim myIPEndPoint As IPEndPoint
  9. Dim 內網線路 As Boolean : ReadOnly 開發線路 As Boolean
  10. Private Sub Set_清單1()
  11. ftp清單_dgv.DataSource = Nothing : ds2.Clear()
  12. ftp清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  13. ftp清單_dgv.ColumnHeadersHeight = 25
  14. ftp清單_dgv.AllowUserToAddRows = False
  15. SQL_FTP資料夾路徑分配()
  16. da.Fill(ds2) : ftp清單_dgv.DataSource = ds2.Tables(0) : conn.Close()
  17. End Sub
  18. Private Sub IP比對()
  19. '-----------------------IP比對----------------------------------------------------------------------------------------------------------------------------------------------------
  20. For Each myIPEndPoint In IPEndPoint
  21. If Strings.Left(myIPEndPoint.Address.ToString, 8) = "172.1.1." Then
  22. 伺服器區域_cb.Text = "公司內網" : 內網線路 = True
  23. Exit For
  24. End If
  25. Next
  26. If 內網線路 = False And 開發線路 = False Then
  27. 伺服器區域_cb.Text = "印尼外網"
  28. End If
  29. End Sub
  30. Private Sub HX_PGS_UPDATE_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  31. IP比對() : 資料數 = 11
  32. MyModule1.進度條() : If Strings.Left(伺服器區域_cb.Text, 2) = "印尼" Or Strings.Left(伺服器區域_cb.Text, 2) = "公司" Then : SQL_連線字串_正式() : Else : SQL_連線字串_測試() : End If
  33. MyModule1.進度條() : SQL_FTP伺服器登入位置()
  34. MyModule1.進度條() : If dr.Read() Then : Target = dr("FTP地址") : FTP帳號 = dr("FTP帳號") : FTP密碼 = dr("FTP密碼") : FTP物理位置 = dr("FTP物理位置") : End If : conn.Close()
  35. MyModule1.進度條() : Set_清單1()
  36. MyModule1.進度條() : Dim HH As String = ""
  37. For i As Integer = 0 To ftp清單_dgv.Rows.Count - 1
  38. If i < 10 Then : HH = "0" & i : ElseIf i >= 10 Then : HH = i : End If
  39. If ftp清單_dgv("指定", i).Value.ToString = "AA" & HH Then : AA(i) = ftp清單_dgv("資料夾名稱", i).Value.ToString : End If
  40. Next
  41. MyModule1.進度條() : Target1 = Target & AA(0) & "/"
  42. End Sub
  43. Private Sub HX_PGS_UPDATE_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  44. MyModule1.進度條() : Delay(30000)
  45. MyModule1.進度條() : Dim Str As String = Application.StartupPath
  46. MyModule1.進度條() : If File.Exists(Str + "\HX-PGS-ERP-SYS.exe") Then : File.Delete(Str + "\HX-PGS-ERP-SYS.exe") : End If
  47. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "HX-PGS-ERP-SYS.exe", Str + "\HX-PGS-ERP-SYS.exe")
  48. MyModule1.進度條() : Shell(Str + "\HX-PGS-ERP-SYS.exe", vbNormalFocus)
  49. Me.Close()
  50. End Sub
  51. Private Sub 伺服器區域_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 伺服器區域_cb.SelectedIndexChanged
  52. '-----------------------確認登入伺服器位置-----------------------------------------------------------------------------------------------------------------------------------------
  53. If 伺服器區域_cb.Text = "印尼外網" Then
  54. 登入人IP = "103.231.201.230,2433"
  55. ElseIf 伺服器區域_cb.Text = "公司內網" Then
  56. 登入人IP = "172.1.1.10,2433"
  57. ElseIf 伺服器區域_cb.Text = "台灣開發" Then
  58. 登入人IP = "106.1.50.79"
  59. End If
  60. End Sub
  61. Public Sub Delay(ByRef Interval As Double) 'Interval单位为毫秒
  62. Dim time As DateTime = DateTime.Now
  63. Dim Span As Double = Interval * 1234
  64. While ((DateTime.Now.Ticks - time.Ticks) < Span)
  65. Application.DoEvents()
  66. End While
  67. End Sub
  68. End Class