feat/qw-scale-integration #9
@ -300,9 +300,6 @@ Public Class mainForm
|
||||
varDataSetting()
|
||||
dgvRefresh()
|
||||
fullLoad(sender, e)
|
||||
|
||||
' 모든 설정 로드 후에 시리얼 포트 초기화
|
||||
InitializeSerialAfterLoad()
|
||||
If rdbMode2.Checked = True Then
|
||||
loadConfig(saveList.lastCount)
|
||||
End If
|
||||
@ -313,23 +310,6 @@ Public Class mainForm
|
||||
txbProdSN.Focus()
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeSerialAfterLoad()
|
||||
Try
|
||||
If ckbWeight.Checked = True AndAlso cboComPort.SelectedItem IsNot Nothing Then
|
||||
Dim serialName As String = cboComPort.SelectedItem.ToString()
|
||||
If serialName <> "" Then
|
||||
'Debug.Print("설정 로드 완료 후 시리얼 초기화")
|
||||
'Debug.Print("serialName: [" & serialName & "]")
|
||||
'Debug.Print("QW 체크 여부: " & rdbWeightQW.Checked)
|
||||
'Debug.Print("CAS 체크 여부: " & rdbWeightCAS.Checked)
|
||||
openSerial(serialName)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Debug.Print("시리얼 초기화 오류: " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub StartFormSet()
|
||||
Me.Text = projectName & projectVer
|
||||
pnOption.Visible = False
|
||||
@ -5123,12 +5103,28 @@ Public Class mainForm
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' 추가: 설정 변경시 시리얼 포트 재연결을 위한 함수
|
||||
Private Sub ReconnectSerialPort()
|
||||
Try
|
||||
If ckbWeight.Checked = True AndAlso cboComPort.SelectedItem IsNot Nothing Then
|
||||
Dim serialName As String = cboComPort.SelectedItem.ToString()
|
||||
If serialName <> "" Then
|
||||
'Debug.Print("=== 설정 변경으로 인한 시리얼 포트 재연결 ===")
|
||||
'Debug.Print("serialName: [" & serialName & "]")
|
||||
'Debug.Print("QW 체크 여부: " & rdbWeightQW.Checked)
|
||||
openSerial(serialName)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Debug.Print("시리얼 포트 재연결 오류: " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function openSerial(serialName As String)
|
||||
Try
|
||||
If ckbWeight.Checked = True Then
|
||||
If serialName <> "" Or serialName <> Nothing Then
|
||||
'Debug.Print("serialName: [" & serialName & "]")
|
||||
'Debug.Print("QW 체크 여부: " & rdbWeightQW.Checked)
|
||||
|
||||
If rdbWeightQW.Checked Then
|
||||
' QW 모드: QWSerialPort 사용
|
||||
@ -5378,6 +5374,7 @@ Public Class mainForm
|
||||
Case saveList.comport
|
||||
Dim textNum As Int16 = UBound(Split(readData, "^"))
|
||||
Dim parsingCk As String
|
||||
Dim savedComPort As String = ""
|
||||
|
||||
For i = 0 To textNum
|
||||
|
||||
@ -5389,6 +5386,7 @@ Public Class mainForm
|
||||
End If
|
||||
|
||||
If i = 0 Then
|
||||
savedComPort = parsingCk ' COM 포트 정보 저장
|
||||
cboComPort.Items.Clear()
|
||||
|
||||
If ckbWeight.Checked = True Then
|
||||
@ -5404,8 +5402,6 @@ Public Class mainForm
|
||||
For cnt = 0 To cboComPort.Items.Count - 1
|
||||
If parsingCk = cboComPort.Items(cnt).ToString() Then
|
||||
cboComPort.SelectedIndex = cnt
|
||||
' 여기서 즉시 시리얼 포트를 열지 않고 선택만 함
|
||||
' openSerial(parsingCk) <- 이 부분을 제거
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
@ -5480,6 +5476,16 @@ Public Class mainForm
|
||||
errorGen("Config 파일을 불러오는 과정에서 오류가 발생하였습니다.")
|
||||
End If
|
||||
Next
|
||||
' 모든 설정이 로드된 후 시리얼 포트 연결 시도
|
||||
If savedComPort <> "" AndAlso ckbWeight.Checked = True Then
|
||||
' UI 업데이트가 완료되도록 잠시 대기 후 실행
|
||||
Application.DoEvents()
|
||||
'Debug.Print("=== 설정 로드 완료 후 시리얼 포트 연결 ===")
|
||||
'Debug.Print("저장된 COM포트: " & savedComPort)
|
||||
'Debug.Print("QW 체크 여부: " & rdbWeightQW.Checked)
|
||||
'Debug.Print("CAS 체크 여부: " & rdbWeightCAS.Checked)
|
||||
openSerial(savedComPort)
|
||||
End If
|
||||
|
||||
Case saveList.divideCode
|
||||
Dim textNum As Int16 = UBound(Split(readData, "^"))
|
||||
@ -5545,6 +5551,16 @@ Public Class mainForm
|
||||
|
||||
Private Sub ckbWeight_Click(sender As Object, e As EventArgs) Handles ckbWeight.Click, chbUseBarcode.Click, ckbPrinter.Click, ckbAPIuse.Click, rdbMode1.Click, rdbMode2.Click, rdbAuto1.Click, rdbAuto2.Click, rdbWeightAuto.Click, rdbWeightCAS.Click, rdbWeightQW.Click, rdbMesDbAPI.Click, rdbMesDbPg.Click, rdbNew.Click, rdbBef.Click
|
||||
ckbChange = True
|
||||
|
||||
' 중량 관련 라디오 버튼이 변경된 경우 시리얼 포트 재연결
|
||||
If TypeOf sender Is RadioButton Then
|
||||
Dim changedRadio As RadioButton = DirectCast(sender, RadioButton)
|
||||
If changedRadio.Name.StartsWith("rdbWeight") AndAlso changedRadio.Checked Then
|
||||
' 잠시 대기 후 재연결 (UI 업데이트 완료 후)
|
||||
Application.DoEvents()
|
||||
ReconnectSerialPort()
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnReg_Click(sender As Object, e As EventArgs) Handles btnReg.Click
|
||||
|
Loading…
x
Reference in New Issue
Block a user