B70340 3 gadus atpakaļ
vecāks
revīzija
9ba96b45da

+ 4
- 0
.editorconfig Parādīt failu

@@ -0,0 +1,4 @@
1
+[*.vb]
2
+
3
+# BC42353: 函式在所有程式碼路徑上皆不會傳回值
4
+dotnet_diagnostic.BC42353.severity = suggestion

Binārs
.vs/TENDEN-MES-SYS/v16/.suo Parādīt failu


+ 5
- 0
TENDEN-MES-SYS.sln Parādīt failu

@@ -5,6 +5,11 @@ VisualStudioVersion = 16.0.29519.87
5 5
 MinimumVisualStudioVersion = 10.0.40219.1
6 6
 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "天盾系統", "TENDEN-MES-SYS\天盾系統.vbproj", "{27F7A8C0-0F0B-488C-BECB-5D62C4D74631}"
7 7
 EndProject
8
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{93AE1D6D-94FC-47DA-8BEC-07107B605AB0}"
9
+	ProjectSection(SolutionItems) = preProject
10
+		.editorconfig = .editorconfig
11
+	EndProjectSection
12
+EndProject
8 13
 Global
9 14
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 15
 		Debug|Any CPU = Debug|Any CPU

+ 19
- 12
TENDEN-MES-SYS/LoginForm1vb.vb Parādīt failu

@@ -34,13 +34,6 @@ Public Class LoginForm1vb
34 34
         '-----------------------控件基本設定-----------------------------------------------------------------------------------------------------------------------------------------------
35 35
         CheckBox1.Enabled = False : CheckBox1.Enabled = False : TextBox4.Text = "1" : Label1.Text = "執行檔版本號 : " & 版本 : UsernameTextBox.ImeMode = 3
36 36
         網段.ShowDialog()
37
-        If 登入判斷 = True Then
38
-            ComboBox1.Text = "天盾伺服器"
39
-            OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
40
-        ElseIf 登入判斷 = False Then
41
-            ComboBox1.Text = "雲端伺服器"
42
-            OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
43
-        End If
44 37
         '-----------------------調整視窗大小-----------------------------------------------------------------------------------------------------------------------------------------------
45 38
         Me.Size = New Size(470, 288)
46 39
         If screenWidth = 1920 And screenHeight = 1080 Then : Me.Location = New Point(725, 396)
@@ -51,6 +44,15 @@ Public Class LoginForm1vb
51 44
         End If
52 45
         Timer1.Enabled = True
53 46
     End Sub
47
+    Private Sub LoginForm1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
48
+        If 登入判斷 = True Then
49
+            ComboBox1.Text = "天盾伺服器"
50
+            OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
51
+        ElseIf 登入判斷 = False Then
52
+            ComboBox1.Text = "雲端伺服器"
53
+            OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
54
+        End If
55
+    End Sub
54 56
     Private Sub 登入()
55 57
         '-----------------------寫入連線字串-----------------------------------------------------------------------------------------------------------------------------------------------
56 58
         If ComboBox1.Text = "雲端伺服器" Then
@@ -97,12 +99,17 @@ Public Class LoginForm1vb
97 99
     Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
98 100
         '-----------------------確認登入伺服器位置-----------------------------------------------------------------------------------------------------------------------------------------
99 101
         If ComboBox1.Text = "天盾伺服器" Then
100
-            登入人IP = "192.168.0.107"
101
-            登入()
102
-            OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
102
+            If SQL_連線狀態模組.ConnectTest("192.168.0.107") = True Then
103
+                登入人IP = "192.168.0.107" : 登入()
104
+                OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
105
+            Else
106
+                MsgBox("天盾伺服器無法連線,自動轉跳測試線路,請聯繫系統管理員!!")
107
+                ComboBox1.Text = "雲端伺服器"
108
+                登入人IP = "106.1.48.106,4567" : 登入()
109
+                OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
110
+            End If
103 111
         ElseIf ComboBox1.Text = "雲端伺服器" Then
104
-            登入人IP = "106.1.48.106,4567"
105
-            登入()
112
+            登入人IP = "106.1.48.106,4567" : 登入()
106 113
             OK.Enabled = True : Cancel.Enabled = True : CheckBox1.Checked = True
107 114
         End If
108 115
         UsernameTextBox.Focus()

+ 65
- 0
TENDEN-MES-SYS/Module/SQL_連線狀態模組.vb Parādīt failu

@@ -0,0 +1,65 @@
1
+Module SQL_連線狀態模組
2
+#Region "——连接测试:避免等待时间过长——"
3
+    Dim bConnect As Boolean
4
+    Dim BgWorker1 As New System.ComponentModel.BackgroundWorker
5
+    Dim ServerIP As String
6
+    ''' <summary>
7
+    ''' 测试连接:True-连接成功,False-连接失败
8
+    ''' 参数[必选]:服务器IP
9
+    ''' 参数[可选]:等待超时时间(秒),默认为1.2秒
10
+    ''' </summary>
11
+    ''' <returns></returns>
12
+    ''' <remarks></remarks>
13
+    Function ConnectTest(ByVal varServerIP As String, Optional ByVal varTimeout As Decimal = 3) As Boolean
14
+        AddHandler BgWorker1.DoWork, AddressOf BgWorker1_DoWork
15
+        Dim g As Integer
16
+        Dim k As Integer
17
+        If BgWorker1.CancellationPending Then
18
+            BgWorker1.CancelAsync()
19
+            '取消BackgroundWorker執行中的工作
20
+        End If
21
+        Try
22
+            If varServerIP = "" Then
23
+                Exit Function
24
+            End If
25
+            ServerIP = varServerIP
26
+            If varTimeout <= 0 Then
27
+                varTimeout = 3
28
+            End If
29
+            k = Int(varTimeout * 10)
30
+            bConnect = False
31
+            BgWorker1.WorkerSupportsCancellation = True
32
+            BgWorker1.RunWorkerAsync()
33
+            For g = 1 To k '1.2s
34
+                Threading.Thread.Sleep(100)
35
+                If bConnect = True Then
36
+                    ConnectTest = True
37
+                    Exit Function
38
+                End If
39
+            Next
40
+            ConnectTest = False
41
+            BgWorker1.CancelAsync()
42
+        Catch ex As Exception
43
+            MsgBox(ex.Message)
44
+        End Try
45
+    End Function
46
+    '--异步动作
47
+    Private Sub BgWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
48
+        Call ConnectMSSQLServer()
49
+    End Sub
50
+    '--连接数据库
51
+    Private Function ConnectMSSQLServer() As Boolean
52
+        Dim sqlConTest As Data.SqlClient.SqlConnection ' 连接   
53
+        sqlConTest = New Data.SqlClient.SqlConnection
54
+        sqlConTest.ConnectionString = "Data Source=" + ServerIP + ";Initial Catalog=天盾國際管理系統資料庫;Persist Security Info=True;User ID=b70340;Password=0911274990;Max pool size = 200;Connection Timeout=0"
55
+        Try
56
+            sqlConTest.Open()
57
+            sqlConTest.Close()
58
+        Catch ex As Exception
59
+        Finally
60
+            bConnect = True
61
+        End Try
62
+    End Function
63
+#End Region
64
+End Module
65
+

Binārs
TENDEN-MES-SYS/bin/Debug/TENDEN-ERP-SYS.exe Parādīt failu


Binārs
TENDEN-MES-SYS/bin/Debug/TENDEN-ERP-SYS.pdb Parādīt failu


+ 9
- 0
TENDEN-MES-SYS/bin/Debug/TENDEN-ERP-SYS.xml Parādīt failu

@@ -232,5 +232,14 @@ TENDEN-ERP-SYS
232 232
   查詢類型 System.Drawing.Bitmap 的當地語系化資源。
233 233
 </summary>
234 234
 </member>
235
+<member name="M:天盾國際管理系統.SQL_連線狀態模組.ConnectTest(System.String,System.Decimal)">
236
+ <summary>
237
+ 测试连接:True-连接成功,False-连接失败
238
+ 参数[必选]:服务器IP
239
+ 参数[可选]:等待超时时间(秒),默认为1.2秒
240
+ </summary>
241
+ <returns></returns>
242
+ <remarks></remarks>
243
+</member>
235 244
 </members>
236 245
 </doc>

Binārs
TENDEN-MES-SYS/obj/Debug/DesignTimeResolveAssemblyReferences.cache Parādīt failu


Binārs
TENDEN-MES-SYS/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache Parādīt failu


Binārs
TENDEN-MES-SYS/obj/Debug/TENDEN-ERP-SYS.exe Parādīt failu


Binārs
TENDEN-MES-SYS/obj/Debug/TENDEN-ERP-SYS.pdb Parādīt failu


+ 9
- 0
TENDEN-MES-SYS/obj/Debug/TENDEN-ERP-SYS.xml Parādīt failu

@@ -232,5 +232,14 @@ TENDEN-ERP-SYS
232 232
   查詢類型 System.Drawing.Bitmap 的當地語系化資源。
233 233
 </summary>
234 234
 </member>
235
+<member name="M:天盾國際管理系統.SQL_連線狀態模組.ConnectTest(System.String,System.Decimal)">
236
+ <summary>
237
+ 测试连接:True-连接成功,False-连接失败
238
+ 参数[必选]:服务器IP
239
+ 参数[可选]:等待超时时间(秒),默认为1.2秒
240
+ </summary>
241
+ <returns></returns>
242
+ <remarks></remarks>
243
+</member>
235 244
 </members>
236 245
 </doc>

+ 1
- 1
TENDEN-MES-SYS/obj/Debug/天盾系統.vbproj.CoreCompileInputs.cache Parādīt failu

@@ -1 +1 @@
1
-84eb73d2d4c30da277b562d207fe0f6ae09feec2
1
+faf913a810261d1ca276697c3a73648b9bc8c807

Binārs
TENDEN-MES-SYS/obj/Debug/天盾系統.vbprojAssemblyReference.cache Parādīt failu


+ 4
- 0
TENDEN-MES-SYS/天盾系統.vbproj Parādīt failu

@@ -103,6 +103,7 @@
103 103
     <Compile Include="Module\SQL_人事系統管理.vb" />
104 104
     <Compile Include="Module\SQL_成本系統管理.vb" />
105 105
     <Compile Include="Module\SQL_資料庫系統管理.vb" />
106
+    <Compile Include="Module\SQL_連線狀態模組.vb" />
106 107
     <Compile Include="Module\SQL_量產訂單資料庫切換.vb" />
107 108
     <Compile Include="Module\SQL_圖片資料庫管理.vb" />
108 109
     <Compile Include="Module\SQL_彙總報表管理.vb" />
@@ -1074,6 +1075,9 @@
1074 1075
     </EmbeddedResource>
1075 1076
   </ItemGroup>
1076 1077
   <ItemGroup>
1078
+    <None Include="..\.editorconfig">
1079
+      <Link>.editorconfig</Link>
1080
+    </None>
1077 1081
     <None Include="My Project\Application.myapp">
1078 1082
       <Generator>MyApplicationCodeGenerator</Generator>
1079 1083
       <LastGenOutput>Application.Designer.vb</LastGenOutput>

Notiek ielāde…
Atcelt
Saglabāt