2106 lines
72 KiB
VB.net
2106 lines
72 KiB
VB.net
Imports System
|
|
Imports System.IO.Ports
|
|
Imports System.Threading
|
|
Imports System.IO.Ports.SerialPort
|
|
|
|
Public Class MainForm
|
|
Public cmdMessage As String
|
|
Public rxMessage As String
|
|
Public cmpMessage As String = "SUCCESS"
|
|
Public tmpCmdMessage As String
|
|
Dim retErr As Boolean
|
|
Public sysTimer As ULong
|
|
Const TIMEOUT As ULong = 5000
|
|
Const cmdWaitTime As UInteger = 100
|
|
|
|
Public BoardModelName As String = ""
|
|
Public BoardName As String = ""
|
|
Public BoardTypelName As String = ""
|
|
Public BoardRunMode As String = ""
|
|
|
|
Public DevTypeName As String
|
|
Public DevModelName As String
|
|
Public CartType As String
|
|
|
|
Dim BoardColor As Color
|
|
Dim CartColor As Color
|
|
Dim AuthColor As Color
|
|
Dim ScsColor As Color
|
|
Dim ShotColor As Color
|
|
|
|
Public strFileName As String
|
|
Public fileReadData() As Byte
|
|
Public FWBoardName As String
|
|
Const PackSize As Integer = 1024
|
|
|
|
Public FWDownBuf(0 To 1028) As Byte
|
|
Public FWDownStop As Boolean
|
|
Public setTimeout As Integer
|
|
Public DefalutTimeout As Integer = 1000
|
|
Public CON_STATUS As String = ""
|
|
Public CART_STATUS As String = ""
|
|
Public initStatusCheck As Boolean = True
|
|
Public ErrorCnt As Integer
|
|
Public SCSErrorCnt As Integer
|
|
Public RxCnt As Long
|
|
Public TXRX_CNT As Boolean = False
|
|
Private Sub systemTimer_Tick(sender As Object, e As EventArgs) Handles systemTimer.Tick
|
|
lblTime.Text = Now
|
|
End Sub
|
|
|
|
Private Sub MainForm_Deactivate(sender As Object, e As EventArgs) Handles Me.FormClosing 'Deactivate
|
|
exit_Process()
|
|
End Sub
|
|
|
|
|
|
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Dim portname() As String
|
|
Dim i As Integer
|
|
Dim YearStr, MonthStr As String
|
|
|
|
|
|
portname = SerialPort.GetPortNames
|
|
|
|
For i = 1 To portname.Length
|
|
cboComPort.Items.Add(portname(i - 1))
|
|
Next i
|
|
|
|
txbCartFrq.BackColor = Color.WhiteSmoke
|
|
txbCartPower.BackColor = Color.WhiteSmoke
|
|
txbShot.BackColor = Color.WhiteSmoke
|
|
txbMaxShot.BackColor = Color.WhiteSmoke
|
|
txbBarcode.BackColor = Color.WhiteSmoke
|
|
txbFactory.BackColor = Color.WhiteSmoke
|
|
nudYear.BackColor = Color.WhiteSmoke
|
|
nudMonth.BackColor = Color.WhiteSmoke
|
|
nudSN.BackColor = Color.WhiteSmoke
|
|
txbAbroad.BackColor = Color.WhiteSmoke
|
|
txbAgency.BackColor = Color.WhiteSmoke
|
|
txbFront.BackColor = Color.WhiteSmoke
|
|
txbRear.BackColor = Color.WhiteSmoke
|
|
txbBarcodeDev.BackColor = Color.WhiteSmoke
|
|
txbFactoryDev.BackColor = Color.WhiteSmoke
|
|
nudYearDev.BackColor = Color.WhiteSmoke
|
|
nudMonthDev.BackColor = Color.WhiteSmoke
|
|
nudSNDev.BackColor = Color.WhiteSmoke
|
|
txbAbroadDev.BackColor = Color.WhiteSmoke
|
|
txbAgencyDev.BackColor = Color.WhiteSmoke
|
|
txbRuntime.BackColor = Color.WhiteSmoke
|
|
txbReadyTime.BackColor = Color.WhiteSmoke
|
|
txbRFCnt.BackColor = Color.WhiteSmoke
|
|
txbErrCnt.BackColor = Color.WhiteSmoke
|
|
txbRunMode.BackColor = Color.WhiteSmoke
|
|
|
|
|
|
cboComPort.Text = "PRESS!"
|
|
|
|
YearStr = Year(Now)
|
|
nudYear.Text = Mid(YearStr, 3, 2)
|
|
nudYearDev.Text = Mid(YearStr, 3, 2)
|
|
MonthStr = Month(Now)
|
|
If Len(MonthStr) < 2 Then
|
|
MonthStr = "0" + MonthStr
|
|
End If
|
|
nudMonth.Text = MonthStr
|
|
nudMonthDev.Text = MonthStr
|
|
updateBarcode()
|
|
updateBarcodeDev()
|
|
End Sub
|
|
Private Sub cmdSerial_Click(sender As Object, e As EventArgs) Handles cmdSerial.Click
|
|
Dim portname() As String
|
|
Dim i As Integer
|
|
|
|
If cboComPort.Text = "" Then
|
|
MsgBox("통신 Port를 선택하여 주세요.")
|
|
Else
|
|
If cmdSerial.Text = "열기" Then
|
|
If SerialPort1.IsOpen = False Then
|
|
ComportSetup()
|
|
Try
|
|
SerialPort1.Open()
|
|
cmdSerial.Text = "닫기"
|
|
|
|
|
|
cboComPort.Enabled = False
|
|
|
|
|
|
gpbCartSet.Enabled = True
|
|
tbcDevice.Enabled = True
|
|
|
|
''gpbInfo.Enabled = True
|
|
''gpbLocal.Enabled = True
|
|
''gpbSensor.Enabled = True
|
|
''gpbAuth.Enabled = True
|
|
''gpbCart.Enabled = True
|
|
''gpbShot.Enabled = True
|
|
|
|
txbBarcode.BackColor = Color.FromArgb(192, 255, 255)
|
|
txbFactory.BackColor = Color.FromArgb(255, 255, 192)
|
|
nudYear.BackColor = Color.FromArgb(255, 224, 192)
|
|
nudMonth.BackColor = Color.FromArgb(255, 224, 192)
|
|
nudSN.BackColor = Color.FromArgb(255, 224, 192)
|
|
txbAbroad.BackColor = Color.FromArgb(255, 192, 128)
|
|
txbAgency.BackColor = Color.FromArgb(192, 192, 0)
|
|
txbFront.BackColor = Color.FromArgb(255, 255, 128)
|
|
txbRear.BackColor = Color.FromArgb(192, 192, 255)
|
|
txbCartFrq.BackColor = Color.FromArgb(255, 192, 128)
|
|
txbCartPower.BackColor = Color.FromArgb(255, 192, 192)
|
|
txbShot.BackColor = Color.FromArgb(255, 192, 255)
|
|
txbMaxShot.BackColor = Color.FromArgb(192, 192, 255)
|
|
txbBarcodeDev.BackColor = Color.FromArgb(192, 255, 255)
|
|
txbFactoryDev.BackColor = Color.FromArgb(255, 255, 192)
|
|
nudYearDev.BackColor = Color.FromArgb(255, 224, 192)
|
|
nudMonthDev.BackColor = Color.FromArgb(255, 224, 192)
|
|
nudSNDev.BackColor = Color.FromArgb(255, 224, 192)
|
|
txbAbroadDev.BackColor = Color.FromArgb(255, 192, 128)
|
|
txbAgencyDev.BackColor = Color.FromArgb(192, 192, 0)
|
|
txbRuntime.BackColor = Color.FromArgb(255, 255, 192)
|
|
txbReadyTime.BackColor = Color.FromArgb(255, 224, 192)
|
|
txbRFCnt.BackColor = Color.FromArgb(255, 128, 128)
|
|
txbErrCnt.BackColor = Color.FromArgb(255, 192, 128)
|
|
txbRunMode.BackColor = Color.FromArgb(192, 192, 0)
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
End If
|
|
Else
|
|
Try
|
|
cmdSerial.Text = "열기"
|
|
cboComPort.Enabled = True
|
|
|
|
gpbCartSet.Enabled = False
|
|
tbcDevice.Enabled = False
|
|
|
|
|
|
''gpbInfo.Enabled = False
|
|
''gpbLocal.Enabled = False
|
|
''gpbSensor.Enabled = False
|
|
''gpbAuth.Enabled = True
|
|
''gpbCart.Enabled = False
|
|
''gpbShot.Enabled = False
|
|
|
|
SerialPort1.Close()
|
|
cboComPort.Items.Clear()
|
|
|
|
portname = SerialPort.GetPortNames
|
|
For i = 1 To portname.Length
|
|
cboComPort.Items.Add(portname(i - 1))
|
|
Next i
|
|
|
|
txbBarcode.BackColor = Color.WhiteSmoke
|
|
txbFactory.BackColor = Color.WhiteSmoke
|
|
nudYear.BackColor = Color.WhiteSmoke
|
|
nudMonth.BackColor = Color.WhiteSmoke
|
|
nudSN.BackColor = Color.WhiteSmoke
|
|
txbAbroad.BackColor = Color.WhiteSmoke
|
|
txbAgency.BackColor = Color.WhiteSmoke
|
|
txbFront.BackColor = Color.WhiteSmoke
|
|
txbRear.BackColor = Color.WhiteSmoke
|
|
txbCartFrq.BackColor = Color.WhiteSmoke
|
|
txbCartPower.BackColor = Color.WhiteSmoke
|
|
txbShot.BackColor = Color.WhiteSmoke
|
|
txbMaxShot.BackColor = Color.WhiteSmoke
|
|
txbBarcodeDev.BackColor = Color.WhiteSmoke
|
|
txbFactoryDev.BackColor = Color.WhiteSmoke
|
|
nudYearDev.BackColor = Color.WhiteSmoke
|
|
nudMonthDev.BackColor = Color.WhiteSmoke
|
|
nudSNDev.BackColor = Color.WhiteSmoke
|
|
txbAbroadDev.BackColor = Color.WhiteSmoke
|
|
txbAgencyDev.BackColor = Color.WhiteSmoke
|
|
txbRuntime.BackColor = Color.WhiteSmoke
|
|
txbReadyTime.BackColor = Color.WhiteSmoke
|
|
txbRFCnt.BackColor = Color.WhiteSmoke
|
|
txbErrCnt.BackColor = Color.WhiteSmoke
|
|
txbRunMode.BackColor = Color.WhiteSmoke
|
|
|
|
txbAuthBox.Visible = False
|
|
txbInfoBox.Visible = False
|
|
txbLocalBox.Visible = False
|
|
txbSensorBox.Visible = False
|
|
txbCartBox.Visible = False
|
|
txbShotBox.Visible = False
|
|
txbAuthBoxDev.Visible = False
|
|
txbInfoBoxDev.Visible = False
|
|
txbDevInfoBox.Visible = False
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub ComportSetup()
|
|
With SerialPort1
|
|
'.PortName = "COM" & Val(cboComPort.Text)
|
|
.PortName = cboComPort.Text
|
|
.BaudRate = 230400
|
|
.DataBits = 8
|
|
.Parity = IO.Ports.Parity.None
|
|
.StopBits = IO.Ports.StopBits.One
|
|
.Handshake = IO.Ports.Handshake.None
|
|
''.RtsEnable = True
|
|
|
|
'AddHandler SerialPort1.DataReceived, AddressOf DataReceivedHandler
|
|
|
|
End With
|
|
End Sub
|
|
Public Sub Delay(Delaytime As Integer)
|
|
Dim currTick As Integer = 0
|
|
Dim preTick As Integer = 0
|
|
|
|
preTick = GetTickCount()
|
|
currTick = GetTickCount()
|
|
Do While (currTick - preTick < Delaytime)
|
|
currTick = GetTickCount()
|
|
Application.DoEvents()
|
|
Loop
|
|
|
|
End Sub
|
|
|
|
Private Sub exit_Process()
|
|
Try
|
|
SerialPort1.Close()
|
|
''cmdSerial.Text = "열기"
|
|
''cboComPort.Enabled = True
|
|
''txbAuthBox.Visible = False
|
|
''txbCartBox.Visible = False
|
|
''txbShotBox.Visible = False
|
|
''GroupBoxEnable(False)
|
|
|
|
End
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
|
|
''Try
|
|
'' Me.Close()
|
|
''Catch ex As InvalidOperationException
|
|
'' Console.WriteLine(ex.GetType().FullName)
|
|
'' Console.WriteLine(ex.Message)
|
|
''End Try
|
|
|
|
End Sub
|
|
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
|
|
exit_Process()
|
|
End Sub
|
|
Private Function SendData(SendMessage As String) As Boolean
|
|
Try
|
|
If SerialPort1.IsOpen = True Then
|
|
SerialPort1.DiscardInBuffer()
|
|
SerialPort1.DiscardOutBuffer()
|
|
SerialPort1.WriteTimeout = -1
|
|
SerialPort1.WriteLine(SendMessage)
|
|
Else
|
|
MsgBox("통신 포트가 열리지 않았습니다.")
|
|
End If
|
|
Catch ex As Exception
|
|
Return True
|
|
End Try
|
|
Return False
|
|
End Function
|
|
|
|
Private Function ReceiveData() As Boolean
|
|
Dim TimeoutVal As Integer
|
|
|
|
Try
|
|
If SerialPort1.IsOpen = True Then
|
|
If setTimeout Then
|
|
TimeoutVal = setTimeout
|
|
Else
|
|
TimeoutVal = DefalutTimeout
|
|
End If
|
|
rxMessage = ""
|
|
SerialPort1.ReadTimeout = TimeoutVal
|
|
rxMessage = SerialPort1.ReadLine()
|
|
Return False
|
|
Else
|
|
MsgBox("통신 포트가 열리지 않았습니다.")
|
|
Return True
|
|
End If
|
|
Catch ex As Exception
|
|
Return True
|
|
End Try
|
|
End Function
|
|
Private Sub rdbCT015_CheckedChanged(sender As Object, e As EventArgs) Handles rdbCT015.CheckedChanged
|
|
If rdbCT015.Checked = False And rdbCT030.Checked = False Then
|
|
|
|
Else
|
|
updateBarcode()
|
|
upDateShotCount()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub rdbCT030_CheckedChanged(sender As Object, e As EventArgs) Handles rdbCT030.CheckedChanged
|
|
If rdbCT015.Checked = False And rdbCT030.Checked = False Then
|
|
|
|
Else
|
|
updateBarcode()
|
|
upDateShotCount()
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub btnRdCart_Click(sender As Object, e As EventArgs) Handles btnRdCart.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
txbCartBox.Visible = True
|
|
txbCartBox.Text = "RUNNING"
|
|
txbCartBox.BackColor = Color.GreenYellow
|
|
txbCartBox.Refresh()
|
|
|
|
txbCartFrq.Text = ""
|
|
txbCartFrq.Refresh()
|
|
txbCartPower.Text = ""
|
|
txbCartPower.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* Cart Frq Info 수신 ********
|
|
''************************************
|
|
tmpCmdMessage = "cartfreq"
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbCartFrq.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
|
|
|
|
''************************************
|
|
''******* Cart PWR Info 수신 ********
|
|
''************************************
|
|
tmpCmdMessage = "ctpower"
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbCartPower.Text = Val(rxVal) / 100
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
|
|
txbCartBox.Text = "SUCCESS"
|
|
txbCartBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbCartBox.Text = "FAIL"
|
|
txbCartBox.BackColor = Color.Red
|
|
txbCartFrq.Refresh()
|
|
txbCartPower.Refresh()
|
|
|
|
SuccessExit:
|
|
|
|
btnRdCart.Enabled = True
|
|
btnWrCart.Enabled = True
|
|
txbCartBox.Refresh()
|
|
|
|
Exit Sub
|
|
End Sub
|
|
Private Sub btnWrCart_Click(sender As Object, e As EventArgs) Handles btnWrCart.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
Dim tmpVal As Integer
|
|
|
|
If txbCartFrq.Text = "" Or txbCartPower.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
If Len(txbCartFrq.Text) > 6 Or Val(txbCartPower.Text) < -0.5 Or Val(txbCartPower.Text) > 0.5 Then
|
|
MsgBox("입력 정보 형식을 확인해주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
txbCartBox.Visible = True
|
|
txbCartBox.Text = "RUNNING"
|
|
txbCartBox.BackColor = Color.GreenYellow
|
|
txbCartBox.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* Cart 주파수 전송 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "cartfreq"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & txbCartFrq.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, 10)
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''******* Cart 파워 전송 ********
|
|
''************************************
|
|
|
|
tmpVal = (Val(txbCartPower.Text) * 100)
|
|
|
|
tmpCmdMessage = "ctpower"
|
|
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & tmpVal & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, 10)
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
txbCartBox.Text = "SUCCESS"
|
|
txbCartBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbCartBox.Text = "Timeout" + Str(stageCnt)
|
|
txbCartBox.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbCartBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
Private Sub btnRdShot_Click(sender As Object, e As EventArgs) Handles btnRdShot.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
txbShot.Text = ""
|
|
txbShot.Refresh()
|
|
txbMaxShot.Text = ""
|
|
txbMaxShot.Refresh()
|
|
txbShotBox.Visible = True
|
|
txbShotBox.Text = "RUNNING"
|
|
txbShotBox.BackColor = Color.GreenYellow
|
|
txbShotBox.Refresh()
|
|
|
|
|
|
Try
|
|
''************************************
|
|
''******* Shot Cnt 수신 ********
|
|
''************************************
|
|
tmpCmdMessage = "rshotcnt"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbShot.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
|
|
|
|
''************************************
|
|
''****** Max Shot Cnt 수신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "tshotcnt"
|
|
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbMaxShot.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txbShotBox.Text = "SUCCESS"
|
|
txbShotBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbShotBox.Text = "FAIL"
|
|
txbShotBox.BackColor = Color.Red
|
|
|
|
SuccessExit:
|
|
txbShotBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
Private Sub btnWrShot_Click(sender As Object, e As EventArgs) Handles btnWrShot.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
If txbShot.Text = "" Or txbMaxShot.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
If txbShot.Text > txbMaxShot.Text Then
|
|
MsgBox("입력 정보 형식을 확인해주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
txbShotBox.Visible = True
|
|
txbShotBox.Text = "RUNNING"
|
|
txbShotBox.BackColor = Color.GreenYellow
|
|
txbShotBox.Refresh()
|
|
|
|
If rdbDevPro.Checked = True And rdbCT030.Checked = True Then
|
|
If txbShot.Enabled = False Then txbShot.Text = 6100
|
|
If txbMaxShot.Enabled = False Then txbMaxShot.Text = 6100
|
|
ElseIf rdbDevPro.Checked = True And rdbCT015.Checked = True Then
|
|
If txbShot.Enabled = False Then txbShot.Text = 60100
|
|
If txbMaxShot.Enabled = False Then txbMaxShot.Text = 60100
|
|
ElseIf rdbDevLux.Checked = True And rdbCT030.Checked = True Then
|
|
If txbShot.Enabled = False Then txbShot.Text = 3000
|
|
If txbMaxShot.Enabled = False Then txbMaxShot.Text = 3000
|
|
ElseIf rdbDevLux.Checked = True And rdbCT015.Checked = True Then
|
|
If txbShot.Enabled = False Then txbShot.Text = 30000
|
|
If txbMaxShot.Enabled = False Then txbMaxShot.Text = 30000
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Try
|
|
''************************************
|
|
''******* Shot Cnt 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "rshotcnt"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & txbShot.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''****** Max Shot Cnt 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "tshotcnt"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & txbMaxShot.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''********* 판정 **********
|
|
''************************************
|
|
|
|
txbShotBox.Text = "SUCCESS"
|
|
txbShotBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbShotBox.Text = "Timeout" + Str(stageCnt)
|
|
txbShotBox.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbCartBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub cboComPort_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboComPort.SelectedIndexChanged
|
|
cmdSerial.Enabled = True
|
|
End Sub
|
|
|
|
Private Sub rdbCT080_CheckedChanged_1(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal, modelType As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
txbFactory.Text = ""
|
|
txbFactory.Refresh()
|
|
txbBarcode.Text = ""
|
|
txbBarcode.Refresh()
|
|
nudYear.Text = ""
|
|
nudYear.Refresh()
|
|
nudMonth.Text = ""
|
|
nudMonth.Refresh()
|
|
nudSN.Text = ""
|
|
nudSN.Refresh()
|
|
txbModel.Text = ""
|
|
txbModel.Refresh()
|
|
rdbDevPro.Checked = False
|
|
rdbDevPro.Refresh()
|
|
rdbDevLux.Checked = False
|
|
rdbDevLux.Refresh()
|
|
rdbCT015.Checked = False
|
|
rdbCT015.Refresh()
|
|
rdbCT030.Checked = False
|
|
rdbCT030.Refresh()
|
|
txbInfoBox.Visible = True
|
|
txbInfoBox.Text = "RUNNING"
|
|
txbInfoBox.BackColor = Color.GreenYellow
|
|
txbInfoBox.Refresh()
|
|
|
|
|
|
|
|
Try
|
|
''************************************
|
|
''******* 제조사 코드 수신 *******
|
|
''************************************
|
|
tmpCmdMessage = "cartmanu"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbFactory.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''****** 모델타입 수신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "ctmodel"
|
|
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
modelType = Mid(rxVal, 1, 2)
|
|
|
|
If modelType = "11" Then
|
|
rdbDevPro.Checked = True
|
|
rdbDevLux.Checked = False
|
|
ElseIf modelType = "21" Then
|
|
rdbDevPro.Checked = False
|
|
rdbDevLux.Checked = True
|
|
Else
|
|
rdbDevPro.Checked = False
|
|
rdbDevLux.Checked = False
|
|
End If
|
|
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''******* Cart Type 수신 ********
|
|
''************************************
|
|
tmpCmdMessage = "carttype"
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
End If
|
|
|
|
If rxVal = "1" Then
|
|
rdbCT015.Checked = True
|
|
ElseIf rxVal = "2" Then
|
|
rdbCT030.Checked = True
|
|
Else
|
|
rdbCT015.Checked = False
|
|
rdbCT030.Checked = False
|
|
End If
|
|
|
|
''************************************
|
|
''****** 시리얼넘버 수신 ********
|
|
''************************************
|
|
tmpCmdMessage = "cartsn"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
|
|
If Len(rxVal) = 10 Then
|
|
nudYear.Text = Mid(rxVal, 1, 2)
|
|
nudMonth.Text = Mid(rxVal, 3, 2)
|
|
nudSN.Text = Mid(rxVal, 5, 6)
|
|
ElseIf Len(rxVal) = 9 Then
|
|
nudYear.Text = Mid(rxVal, 1, 1)
|
|
nudMonth.Text = Mid(rxVal, 2, 2)
|
|
nudSN.Text = Mid(rxVal, 4, 6)
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txbInfoBox.Text = "SUCCESS"
|
|
txbInfoBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbInfoBox.Text = "FAIL"
|
|
txbInfoBox.BackColor = Color.Red
|
|
|
|
SuccessExit:
|
|
updateBarcode()
|
|
txbInfoBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
Dim tmpStrSN, modelType As String
|
|
Dim cnt, i As Integer
|
|
|
|
If txbFactory.Text = "" Then txbFactory.Text = "jomt"
|
|
|
|
If txbFactory.Text = "" Or nudSN.Text = "" Or nudYear.Text = "0" Or nudMonth.TextAlign = "0" Or (rdbDevPro.Checked = False And rdbDevLux.Checked = False) Or (rdbCT030.Checked = False And rdbCT015.Checked = False) Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
txbInfoBox.Visible = True
|
|
txbInfoBox.Text = "RUNNING"
|
|
txbInfoBox.BackColor = Color.GreenYellow
|
|
txbInfoBox.Refresh()
|
|
|
|
If rdbCT030.Checked = True And rdbCT015.Checked = False Then
|
|
CartType = 2
|
|
ElseIf rdbCT030.Checked = False And rdbCT015.Checked = True Then
|
|
CartType = 1
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If rdbDevPro.Checked = True Then
|
|
If rdbCT030.Checked = True Then
|
|
modelType = "11"
|
|
ElseIf rdbCT015.Checked = True Then
|
|
modelType = "12"
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
ElseIf rdbDevLux.Checked = True Then
|
|
If rdbCT030.Checked = True Then
|
|
modelType = "21"
|
|
ElseIf rdbCT015.Checked = True Then
|
|
modelType = "22"
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Try
|
|
''************************************
|
|
''******* 제조사코드 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "cartmanu"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & "JOMT" & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''****** 모델넘버 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "ctmodel"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & modelType & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''******* Cart Type 전송 ********
|
|
''************************************
|
|
|
|
|
|
tmpCmdMessage = "carttype"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & CartType & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, 10)
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''****** 시리얼넘버 발신 ********
|
|
''************************************
|
|
|
|
i = Len(nudSN.Text)
|
|
tmpStrSN = nudSN.Text
|
|
For cnt = i To 5
|
|
tmpStrSN = "0" + tmpStrSN
|
|
Next cnt
|
|
|
|
If Len(nudMonth.Text) = 2 Then
|
|
tmpStrSN = nudYear.Text & nudMonth.Text & tmpStrSN
|
|
ElseIf Len(nudMonthDev.Text) = 1 Then
|
|
tmpStrSN = nudYear.Text & "0" & nudMonth.Text & tmpStrSN
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
tmpCmdMessage = "cartsn"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & tmpStrSN & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''********* 판정 **********
|
|
''************************************
|
|
|
|
txbInfoBox.Text = "SUCCESS"
|
|
txbInfoBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbInfoBox.Text = "Timeout" + Str(stageCnt)
|
|
txbInfoBox.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbInfoBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
txbFront.Text = ""
|
|
txbFront.Refresh()
|
|
txbRear.Text = ""
|
|
txbRear.Refresh()
|
|
txbSensorBox.Visible = True
|
|
txbSensorBox.Text = "RUNNING"
|
|
txbSensorBox.BackColor = Color.GreenYellow
|
|
txbSensorBox.Refresh()
|
|
|
|
|
|
Try
|
|
''************************************
|
|
''******* Front 센서 수신 ********
|
|
''************************************
|
|
tmpCmdMessage = "frontsen"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbFront.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
|
|
|
|
''************************************
|
|
''****** Rear센서 수신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "rearsen"
|
|
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbRear.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txbSensorBox.Text = "SUCCESS"
|
|
txbSensorBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbSensorBox.Text = "FAIL"
|
|
txbSensorBox.BackColor = Color.Red
|
|
|
|
SuccessExit:
|
|
txbSensorBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
If txbFront.Text = "" Or txbRear.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
txbSensorBox.Visible = True
|
|
txbSensorBox.Text = "RUNNING"
|
|
txbSensorBox.BackColor = Color.GreenYellow
|
|
txbSensorBox.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* txbFront 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "frontsen"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & txbFront.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''****** txbRear 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "rearsen"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & txbRear.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''********* 판정 **********
|
|
''************************************
|
|
|
|
txbSensorBox.Text = "SUCCESS"
|
|
txbSensorBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbSensorBox.Text = "Timeout" + Str(stageCnt)
|
|
txbSensorBox.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbSensorBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
txbAbroad.Text = ""
|
|
txbAbroad.Refresh()
|
|
txbAgency.Text = ""
|
|
txbAgency.Refresh()
|
|
txbLocalBox.Visible = True
|
|
txbLocalBox.Text = "RUNNING"
|
|
txbLocalBox.BackColor = Color.GreenYellow
|
|
txbLocalBox.Refresh()
|
|
|
|
|
|
Try
|
|
''************************************
|
|
''******* txbAbroad 수신 ********
|
|
''************************************
|
|
tmpCmdMessage = "ctabroad"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbAbroad.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
|
|
''************************************
|
|
''****** txbAgency 수신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "ctagency"
|
|
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
txbAgency.Text = rxVal
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txbAgency.Text = rxVal
|
|
|
|
txbLocalBox.Text = "SUCCESS"
|
|
txbLocalBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbLocalBox.Text = "FAIL"
|
|
txbLocalBox.BackColor = Color.Red
|
|
|
|
SuccessExit:
|
|
txbLocalBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
If txbAbroad.Text = "" Or txbAgency.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
txbLocalBox.Visible = True
|
|
txbLocalBox.Text = "RUNNING"
|
|
txbLocalBox.BackColor = Color.GreenYellow
|
|
txbLocalBox.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* txbAbroad 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "ctabroad"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & txbAbroad.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''****** txbAgency 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "ctagency"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & txbAgency.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''********* 판정 **********
|
|
''************************************
|
|
|
|
txbLocalBox.Text = "SUCCESS"
|
|
txbLocalBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbLocalBox.Text = "Timeout" + Str(stageCnt)
|
|
txbLocalBox.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbLocalBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
|
|
txbAuthBox.Visible = True
|
|
txbAuthBox.Text = "RUNNING"
|
|
txbAuthBox.BackColor = Color.GreenYellow
|
|
txbAuthBox.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''***** 카트리지 인증 발신 *******
|
|
''************************************
|
|
|
|
tmpCmdMessage = "cartauth"
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 10000
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''********* 판정 **********
|
|
''************************************
|
|
|
|
txbAuthBox.Text = "SUCCESS"
|
|
txbAuthBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbAuthBox.Text = "Timeout" + Str(stageCnt)
|
|
txbAuthBox.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbAuthBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub Button15_Click(sender As System.Object, e As System.EventArgs) Handles Button15.Click
|
|
Dim YearStr, MonthStr As String
|
|
|
|
YearStr = Year(Now)
|
|
nudYear.Text = Mid(YearStr, 3, 2)
|
|
MonthStr = Month(Now)
|
|
If Len(MonthStr) < 2 Then
|
|
MonthStr = "0" + MonthStr
|
|
nudMonth.Text = MonthStr
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub upDateShotCount()
|
|
If rdbDevPro.Checked = True And rdbCT030.Checked = True Then
|
|
txbShot.Text = 6100
|
|
txbMaxShot.Text = 6100
|
|
ElseIf rdbDevPro.Checked = True And rdbCT015.Checked = True Then
|
|
txbShot.Text = 60100
|
|
txbMaxShot.Text = 60100
|
|
ElseIf rdbDevLux.Checked = True And rdbCT030.Checked = True Then
|
|
txbShot.Text = 3000
|
|
txbMaxShot.Text = 3000
|
|
ElseIf rdbDevLux.Checked = True And rdbCT015.Checked = True Then
|
|
txbShot.Text = 30000
|
|
txbMaxShot.Text = 30000
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub updateBarcode()
|
|
''Dim devModel, yearStr, monthStr, snLowStr, snHighStr As String
|
|
Dim devModel, cartType, snTotalStr, snLowStr, snHighStr, tmpYear, tmpMonth As String
|
|
Dim cnt, i As Integer
|
|
|
|
If rdbDevPro.Checked = True Then
|
|
devModel = "1"
|
|
ElseIf rdbDevLux.Checked = True Then
|
|
devModel = "2"
|
|
Else
|
|
devModel = "0"
|
|
End If
|
|
|
|
If rdbCT030.Checked = True Then
|
|
cartType = "1"
|
|
ElseIf rdbCT015.Checked = True Then
|
|
cartType = "2"
|
|
Else
|
|
cartType = "0"
|
|
End If
|
|
|
|
i = Len(nudSN.Text)
|
|
If Val(nudSN.Text) = 0 Then i = 0
|
|
|
|
snTotalStr = nudSN.Text
|
|
For cnt = i To 5
|
|
snTotalStr = "0" + snTotalStr
|
|
Next cnt
|
|
|
|
snHighStr = Mid(snTotalStr, 1, 3)
|
|
snLowStr = Mid(snTotalStr, 4, 3)
|
|
|
|
If Len(nudYear.Text) >= 2 Then
|
|
tmpYear = nudYear.Text
|
|
Else
|
|
tmpYear = "0" & nudYear.Text
|
|
End If
|
|
|
|
If Len(nudMonth.Text) >= 2 Then
|
|
tmpMonth = nudMonth.Text
|
|
Else
|
|
tmpMonth = "0" & nudMonth.Text
|
|
End If
|
|
|
|
txbBarcode.Text = devModel + cartType + tmpYear + tmpMonth + snLowStr + snHighStr
|
|
txbBarcode.Refresh()
|
|
|
|
End Sub
|
|
|
|
Private Sub updateBarcodeDev()
|
|
''Dim devModel, yearStr, monthStr, snLowStr, snHighStr As String
|
|
Dim devModel, snTotalStr, snLowStr, snHighStr, tmpYear, tmpMonth As String
|
|
Dim cnt, i As Integer
|
|
|
|
If rdbDevProDev.Checked = True Then
|
|
devModel = "10"
|
|
ElseIf rdbDevLuxDev.Checked = True Then
|
|
devModel = "20"
|
|
Else
|
|
devModel = "00"
|
|
End If
|
|
|
|
i = Len(nudSNDev.Text)
|
|
If Val(nudSNDev.Text) = 0 Then i = 0
|
|
|
|
snTotalStr = nudSNDev.Text
|
|
For cnt = i To 5
|
|
snTotalStr = "0" + snTotalStr
|
|
Next cnt
|
|
|
|
snHighStr = Mid(snTotalStr, 1, 3)
|
|
snLowStr = Mid(snTotalStr, 4, 3)
|
|
|
|
If Len(nudYearDev.Text) >= 2 Then
|
|
tmpYear = nudYearDev.Text
|
|
Else
|
|
tmpYear = "0" & nudYearDev.Text
|
|
End If
|
|
|
|
If Len(nudMonthDev.Text) >= 2 Then
|
|
tmpMonth = nudMonthDev.Text
|
|
Else
|
|
tmpMonth = "0" & nudMonthDev.Text
|
|
End If
|
|
|
|
txbBarcodeDev.Text = devModel + tmpYear + tmpMonth + snLowStr + snHighStr
|
|
txbBarcodeDev.Refresh()
|
|
|
|
End Sub
|
|
Private Sub rdbDevPro_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rdbDevPro.CheckedChanged
|
|
If rdbDevPro.Checked = False And rdbDevLux.Checked = False Then
|
|
|
|
Else
|
|
updateBarcode()
|
|
upDateShotCount()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub rdbDevLux_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rdbDevLux.CheckedChanged
|
|
If rdbDevPro.Checked = False And rdbDevLux.Checked = False Then
|
|
|
|
Else
|
|
updateBarcode()
|
|
upDateShotCount()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub nudSN_ValueChanged(sender As System.Object, e As System.EventArgs) Handles nudSN.ValueChanged
|
|
If nudSN.Text <> "" Then updateBarcode()
|
|
End Sub
|
|
|
|
Private Sub nudSN_Click(sender As System.Object, e As System.EventArgs) Handles nudSN.Click
|
|
If nudSN.Text <> "" Then updateBarcode()
|
|
End Sub
|
|
|
|
Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
'' Dim AUTH() As Byte = {&H5E, &H6D, &H72, &H70, &H77, &H30, &H70, &H64, &H6C, &H6F, &H30, &H73, &H6D, &H66, &H43, &H6D, &H66, &H6C, &H6B, &H6A, &H62, &H61, &H66, &H71, &H62, &H60, &H65, &H2B, &H60, &H6C, &H6A, &H5A}
|
|
txbAuthBoxDev.Visible = True
|
|
txbAuthBoxDev.Text = "RUNNING"
|
|
txbAuthBoxDev.BackColor = Color.GreenYellow
|
|
txbAuthBoxDev.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* 본체 인증 발신 ********
|
|
''************************************
|
|
|
|
tmpCmdMessage = "mainauth"
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 10000
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''********* 판정 **********
|
|
''************************************
|
|
|
|
txbAuthBoxDev.Text = "SUCCESS"
|
|
txbAuthBoxDev.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbAuthBoxDev.Text = "Timeout" + Str(stageCnt)
|
|
txbAuthBoxDev.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbAuthBoxDev.Refresh()
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub Button13_Click(sender As System.Object, e As System.EventArgs) Handles Button13.Click
|
|
Dim YearStr, MonthStr As String
|
|
|
|
YearStr = Year(Now)
|
|
nudYearDev.Text = Mid(YearStr, 3, 2)
|
|
MonthStr = Month(Now)
|
|
If Len(MonthStr) < 2 Then
|
|
MonthStr = "0" + MonthStr
|
|
nudMonthDev.Text = MonthStr
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub rdbDevProDev_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rdbDevProDev.CheckedChanged
|
|
If rdbDevProDev.Checked = False And rdbDevLuxDev.Checked = False Then
|
|
|
|
Else
|
|
updateBarcodeDev()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub rdbDevLuxDev_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rdbDevLuxDev.CheckedChanged
|
|
If rdbDevProDev.Checked = False And rdbDevLuxDev.Checked = False Then
|
|
|
|
Else
|
|
updateBarcodeDev()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub nudSNDev_ValueChanged(sender As System.Object, e As System.EventArgs) Handles nudSNDev.ValueChanged
|
|
If nudSNDev.Text <> "" Then updateBarcodeDev()
|
|
End Sub
|
|
Private Sub nudSNDev_Click(sender As System.Object, e As System.EventArgs) Handles nudSNDev.Click
|
|
If nudSNDev.Text <> "" Then updateBarcodeDev()
|
|
End Sub
|
|
|
|
Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles Button9.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr, tmpStr1, tmpStr2 As String
|
|
Dim modelTypeStr As String
|
|
|
|
|
|
txbFactoryDev.Text = ""
|
|
txbFactoryDev.Refresh()
|
|
txbBarcodeDev.Text = ""
|
|
txbBarcodeDev.Refresh()
|
|
nudYearDev.Text = ""
|
|
nudYearDev.Refresh()
|
|
nudMonthDev.Text = ""
|
|
nudMonthDev.Refresh()
|
|
nudSNDev.Text = ""
|
|
nudSNDev.Refresh()
|
|
rdbDevProDev.Checked = False
|
|
rdbDevProDev.Refresh()
|
|
rdbDevLuxDev.Checked = False
|
|
rdbDevLuxDev.Refresh()
|
|
txbInfoBoxDev.Visible = True
|
|
txbInfoBoxDev.Text = "RUNNING"
|
|
txbInfoBoxDev.BackColor = Color.GreenYellow
|
|
txbInfoBoxDev.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* 제조사 코드 수신 *******
|
|
''************************************
|
|
tmpCmdMessage = "rdstconf"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
|
|
txbFactoryDev.Text = Mid(rxVal, 1, InStr(rxVal, ",") - 1)
|
|
|
|
tmpStr = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
rxVal = tmpStr
|
|
tmpStr = Mid(rxVal, 1, InStr(rxVal, ",") - 1)
|
|
|
|
If Len(tmpStr) = 10 Then
|
|
nudYearDev.Text = Mid(rxVal, 1, 2)
|
|
nudMonthDev.Text = Mid(rxVal, 3, 2)
|
|
nudSNDev.Text = Mid(rxVal, 5, 6)
|
|
ElseIf Len(tmpStr) = 9 Then
|
|
nudYearDev.Text = Mid(rxVal, 1, 1)
|
|
nudMonthDev.Text = Mid(rxVal, 2, 2)
|
|
nudSNDev.Text = Mid(rxVal, 4, 6)
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
tmpStr = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
rxVal = tmpStr
|
|
modelTypeStr = Mid(rxVal, 1, InStr(rxVal, ",") - 1)
|
|
|
|
If modelTypeStr = "10" Then
|
|
rdbDevProDev.Checked = True
|
|
rdbDevLuxDev.Checked = False
|
|
ElseIf modelTypeStr = "20" Then
|
|
rdbDevProDev.Checked = False
|
|
rdbDevLuxDev.Checked = True
|
|
Else
|
|
rdbDevProDev.Checked = False
|
|
rdbDevLuxDev.Checked = False
|
|
End If
|
|
|
|
tmpStr = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
rxVal = tmpStr
|
|
txbAbroadDev.Text = Mid(rxVal, 1, InStr(rxVal, ",") - 1)
|
|
|
|
txbAgencyDev.Text = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txbInfoBoxDev.Text = "SUCCESS"
|
|
txbInfoBoxDev.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbInfoBoxDev.Text = "FAIL"
|
|
txbInfoBoxDev.BackColor = Color.Red
|
|
|
|
SuccessExit:
|
|
updateBarcodeDev()
|
|
txbInfoBoxDev.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button10_Click(sender As System.Object, e As System.EventArgs) Handles Button10.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr1, tmpStr2 As String
|
|
Dim tmpStrSN, modelType, totalSN As String
|
|
Dim cnt, i As Integer
|
|
|
|
If txbFactoryDev.Text = "" Then txbFactoryDev.Text = "jomt"
|
|
|
|
If txbFactoryDev.Text = "" Or nudSNDev.Text = "" Or (rdbDevProDev.Checked = False And rdbDevLuxDev.Checked = False) Or nudYearDev.Text = "" Or nudMonthDev.Text = "" Or txbAbroadDev.Text = "" Or txbAgencyDev.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.")
|
|
Exit Sub
|
|
End If
|
|
|
|
txbInfoBoxDev.Visible = True
|
|
txbInfoBoxDev.Text = "RUNNING"
|
|
txbInfoBoxDev.BackColor = Color.GreenYellow
|
|
txbInfoBoxDev.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* 제조사코드 발신 ********
|
|
''************************************
|
|
|
|
i = Len(nudSNDev.Text)
|
|
tmpStrSN = nudSNDev.Text
|
|
For cnt = i To 5
|
|
tmpStrSN = "0" + tmpStrSN
|
|
Next cnt
|
|
|
|
If rdbDevProDev.Checked = True And rdbDevLuxDev.Checked = False Then
|
|
modelType = "10"
|
|
ElseIf rdbDevProDev.Checked = False And rdbDevLuxDev.Checked = True Then
|
|
modelType = "20"
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If Len(nudMonthDev.Text) = 2 Then
|
|
totalSN = nudYearDev.Text & nudMonthDev.Text & tmpStrSN
|
|
ElseIf Len(nudMonthDev.Text) = 1 Then
|
|
totalSN = nudYearDev.Text & "0" & nudMonthDev.Text & tmpStrSN
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
tmpCmdMessage = "wrstconf"
|
|
cmdMessage = "[sb" & tmpCmdMessage & " " & "jomt" & "," & totalSN & "," & modelType & "," & txbAbroadDev.Text & "," & txbAgencyDev.Text & "]"
|
|
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal <> "success" Then GoTo FailExit
|
|
End If
|
|
|
|
''************************************
|
|
''********* 판정 **********
|
|
''************************************
|
|
|
|
txbInfoBoxDev.Text = "SUCCESS"
|
|
txbInfoBoxDev.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
FailExit:
|
|
txbInfoBoxDev.Text = "Timeout" + Str(stageCnt)
|
|
txbInfoBoxDev.BackColor = Color.Red
|
|
SuccessExit:
|
|
txbInfoBoxDev.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub nudYearDev_ValueChanged(sender As System.Object, e As System.EventArgs) Handles nudYearDev.ValueChanged
|
|
If nudYearDev.Text <> "" Then updateBarcodeDev()
|
|
End Sub
|
|
Private Sub nudYearDev_Click(sender As System.Object, e As System.EventArgs) Handles nudYearDev.Click
|
|
If nudYearDev.Text <> "" Then updateBarcodeDev()
|
|
End Sub
|
|
|
|
Private Sub nudMonthDev_ValueChanged(sender As System.Object, e As System.EventArgs) Handles nudMonthDev.ValueChanged
|
|
If nudMonthDev.Text <> "" Then updateBarcodeDev()
|
|
End Sub
|
|
Private Sub nudMonthDev_Click(sender As System.Object, e As System.EventArgs) Handles nudMonthDev.Click
|
|
If nudMonthDev.Text <> "" Then updateBarcodeDev()
|
|
End Sub
|
|
|
|
Private Sub nudYear_ValueChanged(sender As System.Object, e As System.EventArgs) Handles nudYear.ValueChanged
|
|
If nudYear.Text <> "" Then updateBarcode()
|
|
End Sub
|
|
Private Sub nudYear_Click(sender As System.Object, e As System.EventArgs) Handles nudYear.Click
|
|
If nudYear.Text <> "" Then updateBarcode()
|
|
End Sub
|
|
|
|
Private Sub nudMonth_ValueChanged(sender As System.Object, e As System.EventArgs) Handles nudMonth.ValueChanged
|
|
If nudMonth.Text <> "" Then updateBarcode()
|
|
End Sub
|
|
Private Sub nudMonth_Click(sender As System.Object, e As System.EventArgs) Handles nudMonth.Click
|
|
If nudMonth.Text <> "" Then updateBarcode()
|
|
End Sub
|
|
|
|
Private Sub Button11_Click(sender As System.Object, e As System.EventArgs) Handles Button11.Click
|
|
Dim stageCnt As Integer
|
|
Dim rxVal As String
|
|
Dim tmpStr, tmpStr1, tmpStr2 As String
|
|
Dim timeCnt, u64tmp As ULong
|
|
Dim dayStr, hourStr, minStr, secStr As String
|
|
|
|
txbDevInfoBox.Visible = True
|
|
txbDevInfoBox.BackColor = Color.GreenYellow
|
|
txbDevInfoBox.Refresh()
|
|
|
|
txbRuntime.Text = ""
|
|
txbRuntime.Refresh()
|
|
txbReadyTime.Text = ""
|
|
txbReadyTime.Refresh()
|
|
txbRFCnt.Text = ""
|
|
txbRFCnt.Refresh()
|
|
txbErrCnt.Text = ""
|
|
txbErrCnt.Refresh()
|
|
txbRunMode.Text = ""
|
|
txbRunMode.Refresh()
|
|
|
|
txbDevInfoBox.Text = "RUNNING"
|
|
txbDevInfoBox.BackColor = Color.GreenYellow
|
|
txbDevInfoBox.Refresh()
|
|
|
|
Try
|
|
''************************************
|
|
''******* 기기 사용 정보 수신 *******
|
|
''************************************
|
|
tmpCmdMessage = "rdstinfo"
|
|
|
|
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
|
retErr = SendData(cmdMessage)
|
|
stageCnt = 0
|
|
If retErr Then GoTo FailExit
|
|
setTimeout = 1500
|
|
retErr = ReceiveData()
|
|
stageCnt += 1
|
|
If retErr Then GoTo FailExit
|
|
|
|
tmpStr1 = Mid(rxMessage, 1, 1)
|
|
tmpStr2 = Mid(rxMessage, InStr(rxMessage, "]"), 1)
|
|
rxVal = Mid(rxMessage, 2, Len(tmpCmdMessage))
|
|
|
|
If rxVal = tmpCmdMessage And tmpStr1 = "[" And tmpStr2 = "]" Then
|
|
rxVal = Mid(rxMessage, InStr(rxMessage, " ") + 1, InStr(rxMessage, "]") - InStr(rxMessage, " ") - 1)
|
|
If rxVal = "fail" Then GoTo FailExit
|
|
|
|
timeCnt = Val(Mid(rxVal, 1, InStr(rxVal, ",") - 1))
|
|
timeCnt = timeCnt / 1000
|
|
u64tmp = (timeCnt / 86400)
|
|
dayStr = u64tmp
|
|
u64tmp = (timeCnt Mod 86400) / 3600
|
|
hourStr = u64tmp
|
|
u64tmp = (timeCnt Mod 3600) / 60
|
|
minStr = u64tmp
|
|
secStr = timeCnt Mod 60
|
|
txbRuntime.Text = dayStr & "Day "
|
|
|
|
If hourStr < 10 Then
|
|
txbRuntime.Text = txbRuntime.Text & "0" & hourStr & ":"
|
|
Else
|
|
txbRuntime.Text = txbRuntime.Text & hourStr & ":"
|
|
End If
|
|
|
|
If minStr < 10 Then
|
|
txbRuntime.Text = txbRuntime.Text & "0" & minStr & ":"
|
|
Else
|
|
txbRuntime.Text = txbRuntime.Text & minStr & ":"
|
|
End If
|
|
|
|
If secStr < 10 Then
|
|
txbRuntime.Text = txbRuntime.Text & "0" & secStr
|
|
Else
|
|
txbRuntime.Text = txbRuntime.Text & secStr
|
|
End If
|
|
|
|
|
|
tmpStr = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
rxVal = tmpStr
|
|
timeCnt = Mid(rxVal, 1, InStr(rxVal, ",") - 1)
|
|
timeCnt = timeCnt / 1000
|
|
u64tmp = (timeCnt / 86400)
|
|
dayStr = u64tmp
|
|
u64tmp = (timeCnt Mod 86400) / 3600
|
|
hourStr = u64tmp
|
|
u64tmp = (timeCnt Mod 3600) / 60
|
|
minStr = u64tmp
|
|
secStr = timeCnt Mod 60
|
|
txbReadyTime.Text = dayStr & "Day "
|
|
|
|
If hourStr < 10 Then
|
|
txbReadyTime.Text = txbReadyTime.Text & "0" & hourStr & ":"
|
|
Else
|
|
txbReadyTime.Text = txbReadyTime.Text & hourStr & ":"
|
|
End If
|
|
|
|
If minStr < 10 Then
|
|
txbReadyTime.Text = txbReadyTime.Text & "0" & minStr & ":"
|
|
Else
|
|
txbReadyTime.Text = txbReadyTime.Text & minStr & ":"
|
|
End If
|
|
|
|
If secStr < 10 Then
|
|
txbReadyTime.Text = txbReadyTime.Text & "0" & secStr
|
|
Else
|
|
txbReadyTime.Text = txbReadyTime.Text & secStr
|
|
End If
|
|
|
|
|
|
tmpStr = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
rxVal = tmpStr
|
|
txbRFCnt.Text = Mid(rxVal, 1, InStr(rxVal, ",") - 1)
|
|
|
|
|
|
tmpStr = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
rxVal = tmpStr
|
|
txbErrCnt.Text = Mid(rxVal, 1, InStr(rxVal, ",") - 1)
|
|
|
|
txbRunMode.Text = Mid(rxVal, InStr(rxVal, ",") + 1, Len(rxVal))
|
|
Else
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txbDevInfoBox.Text = "SUCCESS"
|
|
txbDevInfoBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Catch ex As Exception
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbDevInfoBox.Text = "FAIL"
|
|
txbDevInfoBox.BackColor = Color.Red
|
|
|
|
SuccessExit:
|
|
txbDevInfoBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Button12_Click(sender As System.Object, e As System.EventArgs) Handles Button12.Click
|
|
txbDevInfoBox.Visible = True
|
|
|
|
End Sub
|
|
|
|
Private Sub LblRemainShot_DoubleClick(sender As Object, e As System.EventArgs) Handles LblRemainShot.DoubleClick
|
|
If txbShot.Enabled = True Then
|
|
txbShot.Enabled = False
|
|
Else
|
|
txbShot.Enabled = True
|
|
End If
|
|
txbShot.Refresh()
|
|
End Sub
|
|
|
|
Private Sub LblMaxShot_DoubleClick(sender As Object, e As System.EventArgs) Handles LblMaxShot.DoubleClick
|
|
If txbMaxShot.Enabled = True Then
|
|
txbMaxShot.Enabled = False
|
|
Else
|
|
txbMaxShot.Enabled = True
|
|
End If
|
|
txbMaxShot.Refresh()
|
|
End Sub
|
|
|
|
Private Sub gpbCartSet_Enter(sender As System.Object, e As System.EventArgs) Handles gpbCartSet.Enter
|
|
|
|
End Sub
|
|
End Class |