108 lines
3.6 KiB
VB.net
Raw Normal View History

2025-05-12 09:13:11 +09:00
Imports System.Threading
Public Class invForm
Private projectForm As String = " -Invoice"
Private startBol As Boolean = False
Public successSwitch As Boolean = False
Const limitLength As Int16 = 7
Private Sub invForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = mainForm.projectName & mainForm.projectVer & projectForm
startBol = False
successSwitch = False
formLoad()
End Sub
Private Sub formLoad()
txbInv.BackColor = Color.LemonChiffon
txbInv.Text = Nothing
If mainForm.chbUseBarcode.Checked = True Then
Me.Size = New Size(825, 315)
btnInvOK.Visible = False
Else
Me.Size = New Size(825, 390)
btnInvOK.Visible = True
End If
End Sub
Private Sub SetInputCnt()
mainForm.InputCnt = mainForm.InputCntVal
invTimer.Enabled = True
End Sub
Private Sub invTimer_Tick(sender As Object, e As EventArgs) Handles invTimer.Tick
If mainForm.InputCnt Then
mainForm.InputCnt -= 1
Else
invTimer.Enabled = False
If mainForm.chbUseBarcode.Checked Then
btnInvOK_Click(sender, e)
Else
txbInv.Focus()
txbInv.Refresh()
End If
End If
End Sub
Private Sub txbProdSN_TextChanged(sender As Object, e As EventArgs) Handles txbInv.TextChanged
Dim tmpStr As String
If startBol = True Then
If mainForm.InputCnt = 0 And mainForm.chbUseBarcode.Checked = True Then
tmpStr = txbInv.Text
If (Len(tmpStr) > 1) Then
tmpStr = Mid(tmpStr, Len(tmpStr), 1)
txbInv.Clear()
txbInv.AppendText(tmpStr)
End If
SetInputCnt()
End If
Else
startBol = True
End If
End Sub
Private Sub btnInvOK_Click(sender As Object, e As EventArgs) Handles btnInvOK.Click
If txbInv.Text.Replace(" ", "") = "" Then
mainForm.errorGen("송장 번호를 입력해 주십시오.")
Exit Sub
End If
If txbInv.Text.Length < limitLength Then
mainForm.errorGen("올바른 송장 번호가 아닙니다. 번호를 확인하여 주십시오.")
Exit Sub
End If
If InStr(txbInv.Text, mainForm.codeState(mainForm.codeStateList.ERP)) > 0 Or InStr(txbInv.Text, mainForm.codeState(mainForm.codeStateList.MES)) Then
mainForm.errorGen("전표번호를 입력할 수 없습니다. 번호를 확인하여 주십시오.")
Exit Sub
End If
If InStr(mainForm.codeState(mainForm.codeStateList.ERP), txbInv.Text) > 0 Or InStr(mainForm.codeState(mainForm.codeStateList.MES), txbInv.Text) Then
mainForm.errorGen("전표 번호는 입력할 수 없습니다. 번호를 확인하여 주십시오.")
Exit Sub
End If
For i = 0 To mainForm.prodArray.GetLength(1) - 1
If InStr(mainForm.prodArray(mainForm.itemCode.serialNum, i), txbInv.Text) > 0 Then
mainForm.errorGen("시리얼 번호는 입력할 수 없습니다. 번호를 확인하여 주십시오.")
Exit Sub
End If
Next
txbInv.BackColor = Color.Green
weightForm.delay(1000)
mainForm.invoiceCode = txbInv.Text
successSwitch = True
Me.Close()
End Sub
Private Sub failFunc(txtError As String)
txbInv.BackColor = Color.Red
txbInv.Text = txtError
End Sub
End Class