feat: 보수 연산을 적용한 Dualsonic 시리얼 파싱 로직 구현
This commit is contained in:
parent
3650cb83a0
commit
2e1d716fb0
@ -16,9 +16,7 @@ Public Class MainForm
|
||||
Private Const WriteSerialLength As Int16 = 6
|
||||
Private Const SerialLength As Int16 = 9
|
||||
Private Const SerialParsingLength As Int16 = 12
|
||||
Private Const PROSerialParsing As ULong = 111669149696
|
||||
Private Const LUXSerialParsing As ULong = 0
|
||||
Private Const ALPHASerialParsing As ULong = 412316860416
|
||||
Private Const TwosComplement32Mask As Long = 4294967296
|
||||
|
||||
Private Const OneDay As Int32 = 86400
|
||||
Private Const OneHour As Int32 = 3600
|
||||
@ -562,10 +560,12 @@ End_Finish:
|
||||
GoTo FAIL_Finish
|
||||
End If
|
||||
|
||||
txbIfNumber.Text = CInt(ModelCode) & CInt(TypeCode) & nudIfYear.Text & MonthParsing & Mid(SerialValue, 4, 3) & Mid(SerialValue, 1, 3)
|
||||
Dim nudSerial = nudIfYear.Text & MonthParsing & Mid(SerialValue, 4, 3) & Mid(SerialValue, 1, 3)
|
||||
Dim productSerial = CInt(ModelCode) & CInt(TypeCode) & nudSerial
|
||||
txbIfNumber.Text = productSerial
|
||||
|
||||
tmpCmdMessage = "cartsn"
|
||||
cmdMessage = "[sb" & tmpCmdMessage & " " & txbIfNumber.Text & "]"
|
||||
cmdMessage = "[sb" & tmpCmdMessage & " " & nudSerial & "]"
|
||||
|
||||
If SendData(cmdMessage) Then
|
||||
StageCnt = ErrorList.SendError
|
||||
@ -1020,16 +1020,16 @@ End_Finish:
|
||||
GoTo FAIL_Finish
|
||||
End If
|
||||
|
||||
DataResult = Mid(DataResult, 1, 1)
|
||||
Dim cartCode = Mid(DataResult, 1, 1)
|
||||
|
||||
If TypeChecking(Val(DataResult)) Then
|
||||
If TypeChecking(Val(cartCode)) Then
|
||||
MsgBox("없는 타입 번호입니다.", vbCritical, FormName)
|
||||
GoTo FAIL_Finish
|
||||
End If
|
||||
|
||||
''************************************
|
||||
''****** 시리얼넘버 발신 **********
|
||||
''************************************
|
||||
'************************************
|
||||
'****** 시리얼넘버 발신 **********
|
||||
'************************************
|
||||
|
||||
tmpCmdMessage = "cartsn"
|
||||
cmdMessage = "[sb" & tmpCmdMessage & "]"
|
||||
@ -1039,6 +1039,7 @@ End_Finish:
|
||||
GoTo FAIL_Finish
|
||||
End If
|
||||
|
||||
|
||||
DataResult = PollingReceiveData(1500)
|
||||
|
||||
If DataResult = "False" Then
|
||||
@ -1046,22 +1047,26 @@ End_Finish:
|
||||
GoTo FAIL_Finish
|
||||
End If
|
||||
|
||||
'If DataResult.Length <> SerialLength Then
|
||||
' StageCnt = ErrorList.DataError
|
||||
' GoTo FAIL_Finish
|
||||
'End If
|
||||
Dim serial = Long.Parse(DataResult)
|
||||
|
||||
DataResult = SerialParsingFunc(ModelCode, DataResult)
|
||||
If serial < 0 Then
|
||||
serial += TwosComplement32Mask
|
||||
End If
|
||||
|
||||
If DataResult.Length <> SerialParsingLength Then
|
||||
DataResult = serial.ToString
|
||||
|
||||
Dim productSerial = ModelCode & cartCode & DataResult
|
||||
|
||||
If productSerial.Length <> SerialParsingLength Then
|
||||
StageCnt = ErrorList.DataError
|
||||
GoTo FAIL_Finish
|
||||
End If
|
||||
|
||||
txbIfNumber.Text = DataResult
|
||||
nudIfYear.Text = Mid(DataResult, 3, 2)
|
||||
nudIfMonth.Text = Mid(DataResult, 5, 2)
|
||||
nudIfSerial.Text = Mid(DataResult, 10, 3) & Mid(DataResult, 7, 3)
|
||||
txbIfNumber.Text = productSerial
|
||||
|
||||
nudIfYear.Text = Mid(productSerial, 3, 2)
|
||||
nudIfMonth.Text = Mid(productSerial, 5, 2)
|
||||
nudIfSerial.Text = Mid(productSerial, 10, 3) & Mid(productSerial, 7, 3)
|
||||
|
||||
txbInfoBox.Text = "SUCCESS"
|
||||
txbInfoBox.BackColor = Color.Green
|
||||
@ -1322,19 +1327,6 @@ End_Finish:
|
||||
txbInfoBox.BackColor = Color.FromArgb(0, 192, 0)
|
||||
End Sub
|
||||
|
||||
Private Function SerialParsingFunc(ModelNum As Int16, CheckSerial As String) As String
|
||||
Select Case ModelNum
|
||||
Case ModelList.PRO
|
||||
Return Val(CheckSerial) + PROSerialParsing
|
||||
Case ModelList.LUX
|
||||
Return Val(CheckSerial) + LUXSerialParsing
|
||||
Case ModelList.ALPHA
|
||||
Return Val(CheckSerial) + ALPHASerialParsing
|
||||
Case Else
|
||||
Return False
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function ModelChecking(ModelNum As Int16) As Boolean
|
||||
Select Case ModelNum
|
||||
Case ModelList.PRO
|
||||
|
Loading…
x
Reference in New Issue
Block a user