5106 lines
184 KiB
VB.net
5106 lines
184 KiB
VB.net
Imports System.IO
|
|
Imports System.IO.Ports
|
|
Imports System.Threading
|
|
Imports System.Drawing.Printing
|
|
Imports System.Management
|
|
|
|
Public Class frm_Freq_Reg
|
|
|
|
Private cartridge As String = "jomtTesterDB.jomtCartridgeTbl"
|
|
Private test_cartridge As String = "jomtTesterServerDB.jomtCartridgeTbl"
|
|
|
|
Private MainNonTDDB As String = "jomtTesterDB.jomtNonTDTbl"
|
|
Private TestNonTDDB As String = "jomtTesterServerDB.jomtNonTDTbl"
|
|
|
|
Private cartridge_table As String = cartridge
|
|
Private NonCartridge_table As String = MainNonTDDB
|
|
|
|
Public Enum PD1_ENUM
|
|
STANDBY = 0
|
|
WAIT
|
|
WRITE
|
|
SAVE
|
|
COMPLETE
|
|
MAX_NUM
|
|
End Enum
|
|
Public PD1_STATUS As PD1_ENUM
|
|
|
|
Private Enum info_data
|
|
pv_date
|
|
pv_freq
|
|
pv_imp
|
|
pv_cap
|
|
pv_res
|
|
pv_c
|
|
pv_grade
|
|
pv_power
|
|
pv_depth
|
|
|
|
pv_all
|
|
End Enum
|
|
Private info_select(info_data.pv_all) As String
|
|
|
|
Private Enum check_list
|
|
TestStep
|
|
make_name
|
|
serial
|
|
model
|
|
type
|
|
abroad
|
|
agency
|
|
freq
|
|
power
|
|
shotcount
|
|
p1_motor
|
|
td_serial
|
|
p1_date
|
|
p1_time
|
|
P3_DateTime
|
|
|
|
max_check
|
|
|
|
End Enum
|
|
|
|
Private Const ShotCheck As Int16 = 3
|
|
Private check_data(check_list.max_check) As String
|
|
|
|
Private DBCmd As String '' 데이터베이스 명령어 사용
|
|
Public ParaComport As String
|
|
Public tmpCmdMessage As String
|
|
Public cmdMessage As String
|
|
Public CmdTime As Long
|
|
Public EnableCmdTime As Boolean = False
|
|
Public rxMessage As String
|
|
|
|
Private CsvRegData As String
|
|
|
|
Private serial_switch As Boolean = False ''시리얼 포트 연결 유무
|
|
|
|
Public InputCnt As Long
|
|
Public Const InputCntVal As Integer = 10
|
|
|
|
Private reserve As Boolean = False
|
|
|
|
Private td_first_name As String = "DITI"
|
|
Private td_first_name2 As String = "J"
|
|
Private Const prod_text_count As Int16 = 12 '' 제품시리얼번호 자릿수
|
|
Private Const td_name_size As Int16 = 10 '' td 시리얼 자릿수
|
|
Private Const td_freq_size As Int16 = 4 '' 주파수 자릿수
|
|
|
|
Private ManagerTDUse As Boolean = False
|
|
|
|
Private td_data_switch As Boolean = False '' 제품을 꽂아 td시리얼 데이터를 읽어 왔는지
|
|
|
|
Private thr_run_switch As Boolean = False '' 제품선택 등록 완료 확인
|
|
|
|
Private option_reg_chk As Boolean = False '' 옵션 변경 사항 있는지 확인
|
|
Private option_print_chk As Boolean = False ''프린터 옵션 변경 사항 있는지 확인
|
|
|
|
Private comport_nothing As Boolean = False '' 컴포트 연결하지 않음/함
|
|
|
|
Private write_5_OkNg As Boolean = False
|
|
Private write_5_error As Boolean = False
|
|
|
|
Private rdb_type_num As String
|
|
|
|
Private Delegate Sub commDelegate()
|
|
Private commDelegateFunc As commDelegate
|
|
|
|
Public Structure Maximum_Data_list
|
|
Public td_serial As String
|
|
Public td_step As Int16
|
|
Public td_freq As Int16
|
|
Public td_power As Single
|
|
Public td_grade As String
|
|
Public td_Depth As String
|
|
Public td_textbox As TextBox
|
|
Public prod_code As String
|
|
Public prod_serial As String
|
|
End Structure
|
|
Public Maximum_Data As Maximum_Data_list
|
|
|
|
Delegate Sub delegate_text(ByRef str As String)
|
|
Private TH_thread As Thread
|
|
Private thread_type As Boolean
|
|
Private thread_restart As Boolean = False
|
|
Private info_search As Boolean = False
|
|
Private td_name As String
|
|
Private ItemList As String
|
|
|
|
'' 프린터 관련 변수
|
|
Private print_data(1, 1) As String
|
|
Delegate Sub delegate_print(ByRef str As String)
|
|
Private TH_print As Thread
|
|
Private thread_print As Boolean
|
|
Private print_OnOff As Boolean
|
|
|
|
''도트 관련
|
|
Private dotSerial As String
|
|
|
|
Private Sub frm_Freq_Reg_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
TH_thread = New Thread(AddressOf thread_func)
|
|
TH_print = New Thread(AddressOf print_th_play)
|
|
dgv_data.SelectionMode = DataGridViewSelectionMode.FullRowSelect
|
|
dgvPrinter.SelectionMode = DataGridViewSelectionMode.FullRowSelect
|
|
Me.Size = New Size(1040, 785)
|
|
LoadComportName()
|
|
load_comport("event")
|
|
load_comport("comport")
|
|
load_comport("print")
|
|
If ckbAllPnt.Checked = True Then
|
|
ckbBoxPnt.Checked = True
|
|
ckbWarPnt.Checked = True
|
|
Else
|
|
ckbBoxPnt.Checked = False
|
|
ckbWarPnt.Checked = False
|
|
End If
|
|
event_release()
|
|
cmdSerial.Text = "스캔"
|
|
gb_option.Visible = False
|
|
printOptionData()
|
|
mainOptionCkb()
|
|
control_page()
|
|
End Sub
|
|
|
|
Private Sub frm_Freq_Reg_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
|
If TH_thread.IsAlive Then
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
If TH_print.IsAlive Then
|
|
TH_print.Abort()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub thread_func()
|
|
Do While thread_type
|
|
thread_play()
|
|
Thread.Sleep(3000)
|
|
Loop
|
|
End Sub
|
|
|
|
Private Sub thread_play()
|
|
Dim message_code, shot_ck As String
|
|
|
|
If rdb_freq_auto.Checked = True Then
|
|
|
|
If IsNumeric(shot_search()) Then
|
|
'message_code = read_info()
|
|
|
|
'If message_code <> "0" Then
|
|
' message_code = Mid(message_code, InStr(1, message_code, ",") + 1, message_code.Length)
|
|
' message_serial = Mid(message_code, 1, InStr(1, message_code, ",") - 1)
|
|
' message_code = Mid(message_code, InStr(1, message_code, ",") + 1, message_code.Length)
|
|
' message_code = Mid(message_code, 1, InStr(1, message_code, ",") - 1)
|
|
' message_code = message_code & message_serial
|
|
|
|
' td_name = td_name_load()
|
|
|
|
' If td_name.Length <> 10 Then
|
|
' td_name = Nothing
|
|
|
|
' End If
|
|
|
|
'Else
|
|
' message_code = ""
|
|
'End If
|
|
message_code = td_name_load()
|
|
|
|
If message_code = "1" Then
|
|
TH_thread.Abort()
|
|
MsgBox("제품과의 연결이 올바르지 않습니다. 다시 시도하여 주십시오.", vbCritical)
|
|
Exit Sub
|
|
ElseIf message_code = "0" Then
|
|
TH_thread.Abort()
|
|
MsgBox("TD 시리얼 번호가 존재하지 않습니다. TD 시리얼 번호를 등록하여 주십시오.", vbCritical)
|
|
Exit Sub
|
|
Else
|
|
Maximum_Data.td_serial = message_code
|
|
|
|
End If
|
|
|
|
If txbtdnum.InvokeRequired Then
|
|
txbtdnum.Invoke(New delegate_text(AddressOf thread_play), New Object() {message_code})
|
|
'txbresult.Text = "연결중..."
|
|
Else
|
|
txbtdnum.Text = message_code
|
|
td_data_switch = False
|
|
btnrun.PerformClick()
|
|
If td_data_switch = True Then
|
|
btnrun.PerformClick()
|
|
End If
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
Else
|
|
If info_search = True Then
|
|
message_code = "대기"
|
|
|
|
If txbtdnum.InvokeRequired Then
|
|
txbtdnum.Invoke(New delegate_text(AddressOf thread_play), New Object() {message_code})
|
|
Else
|
|
txbtdnum.Text = message_code
|
|
txbfreq.Text = message_code
|
|
txbpower.Text = message_code
|
|
txbgread.Text = message_code
|
|
td_data_switch = False
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
ElseIf rdb_data_check.Checked = True Then
|
|
|
|
shot_ck = shot_search()
|
|
|
|
If IsNumeric(shot_ck) And shot_ck <> "-1" Then
|
|
|
|
message_code = "입력중.."
|
|
|
|
If txb_5_result.InvokeRequired Then
|
|
txb_5_result.Invoke(New delegate_text(AddressOf thread_play), New Object() {message_code})
|
|
Else
|
|
txb_5_result.Text = message_code
|
|
txb_5_result.BackColor = Color.Orange
|
|
btn_5_write.PerformClick()
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
Else
|
|
|
|
If comport_nothing = True Then
|
|
|
|
message_code = "통신 에러"
|
|
|
|
If txb_5_result.InvokeRequired Then
|
|
txb_5_result.Invoke(New delegate_text(AddressOf thread_play), New Object() {message_code})
|
|
Else
|
|
txb_5_result.Text = message_code
|
|
txb_5_result.BackColor = Color.Red
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
ElseIf rdb_c_mode.Checked = True Then
|
|
|
|
shot_ck = shot_search()
|
|
|
|
If IsNumeric(shot_ck) And shot_ck <> "-1" Then
|
|
|
|
message_code = "입력중.."
|
|
|
|
If txbPV_SN.InvokeRequired Then
|
|
txbPV_SN.Invoke(New delegate_text(AddressOf thread_play), New Object() {dotSerial})
|
|
Else
|
|
txbcState.Text = message_code
|
|
txbPV_SN.BackColor = Color.Orange
|
|
btnc_run.PerformClick()
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
Else
|
|
|
|
If comport_nothing = True Then
|
|
|
|
message_code = "통신 에러"
|
|
|
|
If txbPV_SN.InvokeRequired Then
|
|
txbPV_SN.Invoke(New delegate_text(AddressOf thread_play), New Object() {message_code})
|
|
Else
|
|
txbcState.Text = message_code
|
|
txbPV_SN.BackColor = Color.Red
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Else
|
|
|
|
shot_ck = shot_search()
|
|
|
|
If IsNumeric(shot_ck) And shot_ck <> "-1" Then
|
|
|
|
message_code = "입력중.."
|
|
|
|
If txb_prod_state.InvokeRequired Then
|
|
txb_prod_state.Invoke(New delegate_text(AddressOf thread_play), New Object() {message_code})
|
|
Else
|
|
txb_prod_state.Text = message_code
|
|
txb_prod_state.BackColor = Color.Orange
|
|
btn_prod.PerformClick()
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
Else
|
|
|
|
If comport_nothing = True Then
|
|
|
|
message_code = "통신 에러"
|
|
|
|
If txb_prod_state.InvokeRequired Then
|
|
txb_prod_state.Invoke(New delegate_text(AddressOf thread_play), New Object() {message_code})
|
|
Else
|
|
txb_prod_state.Text = message_code
|
|
txb_prod_state.BackColor = Color.Red
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Private Function td_name_load() As String
|
|
Dim retVal As String
|
|
tmpCmdMessage = "settdsn"
|
|
cmdMessage = "[" & tmpCmdMessage & "]" + vbCrLf
|
|
If SendData(cmdMessage) Then
|
|
Return "1"
|
|
End If
|
|
|
|
retVal = PollingReceiveData(300)
|
|
|
|
If retVal.Length = td_name_size Then
|
|
Return retVal
|
|
Else
|
|
Return "0"
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Sub InputTimer_Tick(sender As Object, e As EventArgs) Handles InputTimer.Tick
|
|
|
|
If InputCnt Then
|
|
InputCnt -= 1
|
|
Else
|
|
|
|
If rdb_prod.Checked = True Then
|
|
If txb_serial_num.Text <> "" Then
|
|
InputTimer.Enabled = False
|
|
If chbAutoMeasure.Checked Then
|
|
btn_prod_Click(sender, e)
|
|
Else
|
|
btn_prod.Focus()
|
|
btn_prod.Refresh()
|
|
End If
|
|
End If
|
|
|
|
ElseIf rdb_freq_auto.Checked = True Then
|
|
If txb_barcode.Text <> "" Then
|
|
InputTimer.Enabled = False
|
|
If chbAutoMeasure.Checked Then
|
|
btnrun_Click(sender, e)
|
|
Else
|
|
txb_barcode.Focus()
|
|
txb_barcode.Refresh()
|
|
End If
|
|
End If
|
|
|
|
ElseIf rdb_data_check.Checked = True Then
|
|
If txb_5_barcode.Text <> "" Then
|
|
InputTimer.Enabled = False
|
|
If chbAutoMeasure.Checked Then
|
|
btn_5_check_Click(sender, e)
|
|
If ckb_auto_write.Checked = True And write_5_error = False Then
|
|
txb_5_result.Text = "입력대기"
|
|
txb_5_result.BackColor = Color.Khaki
|
|
TH_thread = New Thread(AddressOf thread_func)
|
|
TH_thread.IsBackground = True
|
|
TH_thread.Start()
|
|
thread_type = True
|
|
|
|
ElseIf ckb_auto_delete.Checked = True And write_5_error = False Then
|
|
btn_5_delete_Click(sender, e)
|
|
End If
|
|
Else
|
|
txb_5_barcode.Focus()
|
|
txb_5_barcode.Refresh()
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
InputTimer.Enabled = False
|
|
If chbAutoMeasure.Checked Then
|
|
reserve = False
|
|
btnRunPD1_Click(sender, e)
|
|
Else
|
|
btnRunPD1.Focus()
|
|
btnRunPD1.Refresh()
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub OpenSerial()
|
|
Try
|
|
If ParaComport <> "" Then
|
|
If cmdSerialPort.IsOpen = False Then
|
|
With cmdSerialPort
|
|
.PortName = ParaComport
|
|
.BaudRate = 230400
|
|
.DataBits = 8
|
|
.Parity = IO.Ports.Parity.None
|
|
.StopBits = IO.Ports.StopBits.One
|
|
.Handshake = IO.Ports.Handshake.None
|
|
End With
|
|
cmdSerialPort.Open()
|
|
serial_switch = True
|
|
End If
|
|
Else
|
|
cart_timer.Enabled = False
|
|
MsgBox("시리얼포트를 설정해주세요!" & vbCrLf & "", vbCritical, "DUALSONIC T/D Selecter Tester Manager")
|
|
serial_switch = False
|
|
End If
|
|
Catch ex As Exception
|
|
cart_timer.Enabled = False
|
|
MsgBox("COM 포트 에러" & vbCrLf & "", vbOK + vbCritical, "DUALSONIC T/D Selecter Tester Manager")
|
|
serial_switch = False
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub txbPV_SN_TextChanged(sender As Object, e As EventArgs) Handles txbPV_SN.TextChanged
|
|
Dim tmpStr As String
|
|
btnc_run.Text = "검색"
|
|
|
|
If txbPV_SN.Text <> "" Then
|
|
cart_timer.Enabled = False
|
|
|
|
If InputCnt = 0 And chbUseBarcode.Checked = True Then
|
|
tmpStr = txbPV_SN.Text
|
|
If (Len(tmpStr) > 1) Then
|
|
tmpStr = Mid(tmpStr, Len(tmpStr), 1)
|
|
txbPV_SN.Clear()
|
|
txbPV_SN.AppendText(tmpStr)
|
|
End If
|
|
SetInputCnt()
|
|
End If
|
|
|
|
reserve = False
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Sub SetInputCnt()
|
|
InputCnt = InputCntVal
|
|
InputTimer.Enabled = True
|
|
End Sub
|
|
|
|
Private Function dotRunning() As Boolean
|
|
Dim serial_number = txbPV_SN.Text
|
|
|
|
txb_grade.Text = "출력중"
|
|
txb_CValue.Text = "출력중"
|
|
nudPower.Value = 0
|
|
nudDeep.Text = 0
|
|
txb_grade.BackColor = Color.Yellow
|
|
txb_CValue.BackColor = Color.Yellow
|
|
|
|
If db_search(serial_number) Then
|
|
|
|
txbCapacitor.Text = info_select(info_data.pv_freq)
|
|
txbPV_Date.Text = info_select(info_data.pv_date)
|
|
txbPV_C.Text = info_select(info_data.pv_cap)
|
|
txbPV_R.Text = info_select(info_data.pv_res)
|
|
txbPV_Z.Text = info_select(info_data.pv_imp)
|
|
txb_grade.Text = info_select(info_data.pv_grade)
|
|
txb_CValue.Text = info_select(info_data.pv_c)
|
|
txb_grade.BackColor = Color.Khaki
|
|
txb_CValue.BackColor = Color.Khaki
|
|
Return False
|
|
Else
|
|
txb_grade.Text = "FAIL"
|
|
txb_CValue.Text = "번호없음"
|
|
txb_grade.BackColor = Color.Red
|
|
txb_CValue.BackColor = Color.Red
|
|
MsgBox("데이터베이스에 해당 데이터가 존재하지 않습니다.", vbCritical)
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
Private Function dotDBSearch() As Boolean
|
|
If dotRunning() Then
|
|
Return False
|
|
End If
|
|
End Function
|
|
|
|
Private Sub btnRunPD1_Click(sender As Object, e As EventArgs) Handles btnRunPD1.Click, btnc_run.Click
|
|
cModeRun()
|
|
End Sub
|
|
|
|
Private Sub cModeRun()
|
|
|
|
If cmdSerialPort.IsOpen = True Then
|
|
If btnc_run.Text = "검색" Then
|
|
txb_grade.Text = "대기"
|
|
txb_CValue.Text = "출력중"
|
|
txb_grade.BackColor = Color.Yellow
|
|
txb_CValue.BackColor = Color.Yellow
|
|
'nudDeep.Value = 0
|
|
nudDeep.BackColor = Color.White
|
|
'nudPower.Value = 0
|
|
nudPower.BackColor = Color.White
|
|
|
|
If db_search(txbPV_SN.Text) Then
|
|
txbCapacitor.Text = info_select(info_data.pv_c)
|
|
txbPV_Date.Text = info_select(info_data.pv_date)
|
|
txbPV_C.Text = info_select(info_data.pv_cap)
|
|
txbPV_R.Text = info_select(info_data.pv_res)
|
|
txbPV_Z.Text = info_select(info_data.pv_imp)
|
|
txb_grade.Text = info_select(info_data.pv_grade)
|
|
txb_CValue.Text = info_select(info_data.pv_freq)
|
|
txb_grade.BackColor = Color.Khaki
|
|
txb_CValue.BackColor = Color.Khaki
|
|
|
|
dotSerial = txbPV_SN.Text
|
|
btnc_run.Text = "입력"
|
|
|
|
txbPV_SN.BackColor = Color.Moccasin
|
|
threadOn()
|
|
|
|
Else
|
|
txb_grade.Text = "FAIL"
|
|
txb_CValue.Text = "번호없음"
|
|
txb_grade.BackColor = Color.Red
|
|
txb_CValue.BackColor = Color.Red
|
|
MsgBox("데이터베이스에 해당 데이터가 존재하지 않습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
Dim nowDate As String = Format(Now, "yy") & Format(Now, "MM")
|
|
|
|
If prod_reg_data("jomt", nowDate & "000000", "30", "0", "0") Then
|
|
If td_reg_data(dotSerial) Then
|
|
If sett_reg(txb_CValue.Text, "0") Then
|
|
If dbDotReg(txb_CValue.Text) Then
|
|
txbPV_SN.BackColor = Color.Green
|
|
btnc_run.Text = "검색"
|
|
Else
|
|
txbPV_SN.BackColor = Color.Red
|
|
MsgBox("데이터베이스 등록에 실패하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txbPV_SN.BackColor = Color.Red
|
|
MsgBox("주파수와 파워 입력에 실패하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txbPV_SN.BackColor = Color.Red
|
|
MsgBox("시리얼 번호 입력에 실패하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txbPV_SN.BackColor = Color.Red
|
|
MsgBox("기본 정보 입력에 실패하였습니다.", vbCritical)
|
|
End If
|
|
End If
|
|
Else
|
|
MsgBox("통신 포트가 연결되어 있지 않습니다!", vbExclamation)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub threadOff()
|
|
TH_thread = New Thread(AddressOf threadRunFunc)
|
|
|
|
If TH_thread.IsAlive = True Then
|
|
TH_thread.Abort()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub threadRunFunc()
|
|
Dim okNg As Boolean = False
|
|
Do Until okNg = True
|
|
Dim conCheck As String = shot_search()
|
|
|
|
If IsNumeric(conCheck) And conCheck <> "-1" Then
|
|
commDelegateFunc = New commDelegate(AddressOf cModeRun)
|
|
Me.Invoke(commDelegateFunc)
|
|
okNg = True
|
|
End If
|
|
Thread.Sleep(1000)
|
|
Loop
|
|
End Sub
|
|
|
|
Private Sub threadOn()
|
|
If cmdSerialPort.IsOpen = True Then
|
|
TH_thread = New Thread(AddressOf threadRunFunc)
|
|
|
|
If TH_thread.IsAlive = True Then
|
|
TH_thread.Abort()
|
|
End If
|
|
|
|
TH_thread.IsBackground = True
|
|
TH_thread.Start()
|
|
End If
|
|
End Sub
|
|
|
|
Private Function dbDotReg(freq As String) As Boolean
|
|
Dim p_date, p_time As String
|
|
|
|
p_date = DateTime.Now.ToString("yyyy-MM-dd")
|
|
p_time = DateTime.Now.ToString("HH:mm:ss")
|
|
DBCmd = "UPDATE " & cartridge_table & " SET TestStep = '21',Ct_Frequency = '" & freq & "',Ct_Power='0',Ct_Motor_Lv='0',P1_Date='" & p_date & "',P1_Time='" & p_time & "',P1_Model='MAXIMUM',P1_CartType='SET',P1_Frequency='" & freq & "' WHERE PV_SN = '" & dotSerial & "'"
|
|
If DBCommand(DBCmd) Then
|
|
|
|
DBCmd = "SELECT TestStep,Ct_Power,Ct_Motor_Lv FROM " & cartridge_table & " WHERE PV_SN = '" & dotSerial & "'"
|
|
If DBQueryReader(DBCmd) Then
|
|
If sqlDataQuery.Length = 3 Then
|
|
If sqlDataQuery(0) = "21" And sqlDataQuery(1) = "0" And sqlDataQuery(2) = "0" Then
|
|
Return True
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
Private Function db_info_search(serial_num As String) As Boolean
|
|
DBCmd = "SELECT Ct_Power,Ct_Motor_Lv,PV_Date,PV_Frequency,PV_Impedance,PV_Capacitance,PV_Resistance,QC_Capacitor,QC_Grade FROM " & cartridge_table & " WHERE PV_SN = '" & serial_num & "'"
|
|
If DBQueryReader(DBCmd) Then
|
|
info_select(info_data.pv_power) = sqlDataQuery(0)
|
|
info_select(info_data.pv_depth) = sqlDataQuery(1)
|
|
info_select(info_data.pv_date) = sqlDataQuery(2)
|
|
info_select(info_data.pv_freq) = sqlDataQuery(3)
|
|
info_select(info_data.pv_imp) = sqlDataQuery(4)
|
|
info_select(info_data.pv_cap) = sqlDataQuery(5)
|
|
info_select(info_data.pv_res) = sqlDataQuery(6)
|
|
info_select(info_data.pv_c) = sqlDataQuery(7)
|
|
info_select(info_data.pv_grade) = sqlDataQuery(8)
|
|
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
|
|
End Function
|
|
|
|
Private Function db_search(serial_id As String) As Boolean
|
|
|
|
If reserve = False Then
|
|
|
|
If db_info_search(serial_id) Then
|
|
If rdb_freq_auto.Checked = True Then
|
|
reserve = True
|
|
cart_timer.Enabled = True
|
|
End If
|
|
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
Else
|
|
|
|
If info_select(info_data.pv_grade) = "LUX" Then
|
|
|
|
If sett_reg(info_select(info_data.pv_freq), 10) Then
|
|
|
|
If db_update() Then
|
|
cart_timer.Enabled = False
|
|
reserve = False
|
|
txbCartridgePD1.BackColor = Color.Green
|
|
txbCartridgePD1.Text = "성공"
|
|
Return True
|
|
Else
|
|
MsgBox("데이터베이스에 등록하지 못하였습니다. 연결 상태 및 데이터를 확인하여 주십시오.", vbCritical)
|
|
Return False
|
|
End If
|
|
|
|
Else
|
|
cart_timer.Enabled = False
|
|
reserve = False
|
|
txbCartridgePD1.BackColor = Color.Red
|
|
txbCartridgePD1.Text = "실패"
|
|
MsgBox("제품이 연결되지 않았습니다. 제품 전원을 켠 후 연결하여 주십시오.", vbCritical)
|
|
Return False
|
|
End If
|
|
|
|
Else
|
|
If freq_reg() Then
|
|
|
|
If db_update() Then
|
|
cart_timer.Enabled = False
|
|
reserve = False
|
|
txbCartridgePD1.BackColor = Color.Green
|
|
txbCartridgePD1.Text = "성공"
|
|
Return True
|
|
Else
|
|
MsgBox("데이터베이스에 등록하지 못하였습니다. 연결 상태 및 데이터를 확인하여 주십시오.", vbCritical)
|
|
Return False
|
|
End If
|
|
|
|
Else
|
|
cart_timer.Enabled = False
|
|
reserve = False
|
|
txbCartridgePD1.BackColor = Color.Red
|
|
txbCartridgePD1.Text = "실패"
|
|
Return False
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Function db_update() As Boolean
|
|
Dim p_date, p_time, p_freq, p_serial As String
|
|
|
|
p_date = DateTime.Now.ToString("yyyy-MM-dd")
|
|
p_time = DateTime.Now.ToString("HH:mm:ss")
|
|
p_freq = txbPV_FreqPD1.Text
|
|
p_serial = txbPV_SN.Text
|
|
|
|
|
|
DBCmd = "UPDATE " & cartridge_table & " SET P1_Date = '" & p_date & "', P1_Time = '" & p_time & "', P1_Model = 'MAXIMUM', P1_Frequency = '" & p_freq & "' WHERE PV_SN = '" & p_serial & "'"
|
|
|
|
If DBCommand(DBCmd) Then
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
End Function
|
|
|
|
Private Function shot_search() As String
|
|
Dim retVal As String = "-1"
|
|
tmpCmdMessage = "shotconf"
|
|
cmdMessage = "[" & tmpCmdMessage & "]" + vbCrLf
|
|
If SendData(cmdMessage) Then
|
|
Return "-1"
|
|
End If
|
|
|
|
retVal = PollingReceiveData(1000)
|
|
CsvRegData = CsvRegData & retVal.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
|
|
Return retVal
|
|
End Function
|
|
|
|
Private Function shot_reg(shot As Integer) As String
|
|
Dim retval As String
|
|
tmpCmdMessage = "shotconf"
|
|
cmdMessage = "[" & tmpCmdMessage & " " & shot & "]" + vbCrLf
|
|
CsvRegData = CsvRegData & cmdMessage.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retval = PollingReceiveData(500)
|
|
CsvRegData = CsvRegData & retval.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
If retval = shot Then
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
|
|
End Function
|
|
|
|
Private Function freq_reg() As Boolean
|
|
Dim retVal As String
|
|
tmpCmdMessage = "FREQCONF"
|
|
cmdMessage = "[" & tmpCmdMessage & " " & info_select(info_data.pv_freq) & "]" + vbCrLf
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retVal = PollingReceiveData(500)
|
|
|
|
If retVal <> txbPV_FreqPD1.Text Then
|
|
Return False
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Private Function sett_reg(freq As Int16, power As Int16) As Boolean
|
|
Dim retVal As String
|
|
tmpCmdMessage = "settdcnf"
|
|
cmdMessage = "[" & tmpCmdMessage & " " & freq & "," & power & "]" + vbCrLf
|
|
CsvRegData = CsvRegData & cmdMessage.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retVal = PollingReceiveData(500)
|
|
CsvRegData = CsvRegData & retVal.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
|
|
If retVal <> freq & "," & power Then
|
|
Return False
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Private Function sett_data() As String
|
|
Dim retval As String
|
|
|
|
tmpCmdMessage = "settdcnf"
|
|
cmdMessage = "[" & tmpCmdMessage & "]" + vbCrLf
|
|
If SendData(cmdMessage) Then
|
|
Return "0"
|
|
End If
|
|
|
|
retval = PollingReceiveData(500)
|
|
|
|
If InStr(1, retval, ",") > 0 Then
|
|
Return retval
|
|
|
|
Else
|
|
Return "0"
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Function read_info() As String
|
|
Dim retval As String
|
|
|
|
tmpCmdMessage = "rdsconf1"
|
|
cmdMessage = "[" & tmpCmdMessage & "]" + vbCrLf
|
|
If SendData(cmdMessage) Then
|
|
Return "0"
|
|
End If
|
|
|
|
retval = PollingReceiveData(2000)
|
|
CsvRegData = CsvRegData & retval.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
|
|
If InStr(1, retval, ",") > 0 Then
|
|
Return retval
|
|
Else
|
|
Return "0"
|
|
End If
|
|
End Function
|
|
|
|
Private Function Depth_reg(level As Int16) As Boolean
|
|
Dim retval As String
|
|
|
|
tmpCmdMessage = "setdepth"
|
|
cmdMessage = "[" & tmpCmdMessage & " " & level & "]"
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retval = PollingReceiveData(1000)
|
|
|
|
If retval = level Then
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
End Function
|
|
|
|
Private Function Motor_reg(pulse As Integer) As Boolean
|
|
Dim retval As String
|
|
|
|
tmpCmdMessage = "setmotor"
|
|
cmdMessage = "[" & tmpCmdMessage & " " & pulse & ",0,0,0,0]"
|
|
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retval = PollingReceiveData(1000)
|
|
|
|
If retval = pulse & ",0,0,0,0" Then
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
End Function
|
|
|
|
Private Function Motor_Read() As Int16
|
|
Dim retval As String
|
|
|
|
tmpCmdMessage = "setmotor"
|
|
cmdMessage = "[" & tmpCmdMessage & "]"
|
|
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retval = PollingReceiveData(1000)
|
|
|
|
If UBound(Split(retval, ",")) = 4 Then
|
|
Return Mid(retval, 1, InStr(1, retval, ",") - 1)
|
|
End If
|
|
|
|
Return 6
|
|
End Function
|
|
|
|
Private Function SendData(SendMessage As String) As Boolean
|
|
Try
|
|
comport_nothing = False
|
|
If cmdSerialPort.IsOpen = True Then
|
|
cmdSerialPort.DiscardInBuffer()
|
|
cmdSerialPort.DiscardOutBuffer()
|
|
If cmdSerialPort.BytesToRead Then
|
|
cmdSerialPort.DiscardInBuffer()
|
|
End If
|
|
cmdSerialPort.WriteTimeout = -1
|
|
cmdSerialPort.WriteLine(SendMessage)
|
|
CmdTime = 0
|
|
EnableCmdTime = True
|
|
Else
|
|
cart_timer.Enabled = False
|
|
comport_nothing = True
|
|
MsgBox("통신 포트가 열리지 않았습니다.")
|
|
Return True
|
|
End If
|
|
Catch ex As Exception
|
|
Return True
|
|
End Try
|
|
Return False
|
|
End Function
|
|
|
|
Private Function PollingReceiveData(RdTimeout As Long) As String
|
|
Try
|
|
If cmdSerialPort.IsOpen = True Then
|
|
rxMessage = ""
|
|
cmdSerialPort.ReadTimeout = RdTimeout
|
|
rxMessage = cmdSerialPort.ReadLine()
|
|
Return ParsingData(False)
|
|
|
|
Else
|
|
cart_timer.Enabled = False
|
|
MsgBox("통신 포트가 열리지 않았습니다.")
|
|
Return True
|
|
End If
|
|
Catch ex As Exception
|
|
rxMessage = ""
|
|
Return Err.Description
|
|
End Try
|
|
End Function
|
|
|
|
Private Function ParsingData(CmdInclude As Boolean) As String
|
|
Dim cmdStr As String
|
|
Dim cmdVal(0 To 6) As String
|
|
Dim ReturnStr As String
|
|
Dim i As Integer
|
|
|
|
Try
|
|
cmdStr = "0"
|
|
|
|
If rxMessage <> "" Then
|
|
cmdMessage = ""
|
|
|
|
If Mid(rxMessage, 1, 1) = "[" Then
|
|
cmdMessage = Mid(rxMessage, 2, Len(rxMessage))
|
|
|
|
cmdStr = Mid(cmdMessage, 1, (InStr(rxMessage, " ") - 2))
|
|
cmdMessage = Mid(rxMessage, InStr(rxMessage, " ") + 1, Len(cmdMessage))
|
|
|
|
For i = 1 To 5
|
|
If InStr(cmdMessage, ",") <> 0 Then
|
|
cmdVal(i) = Mid(cmdMessage, 1, InStr(cmdMessage, ",") - 1)
|
|
cmdMessage = Mid(cmdMessage, InStr(cmdMessage, ",") + 1, Len(cmdMessage))
|
|
ElseIf InStr(cmdMessage, "]") <> 0 Then
|
|
cmdVal(i) = Mid(cmdMessage, 1, InStr(cmdMessage, "]") - 1)
|
|
'cmdMessage = Mid(cmdMessage, InStr(cmdMessage, "]") + 1, Len(cmdMessage))
|
|
Else
|
|
Exit For
|
|
End If
|
|
Next i
|
|
rxMessage = ""
|
|
|
|
If CmdInclude = True Then
|
|
ReturnStr = cmdStr & ","
|
|
End If
|
|
|
|
If InStr(1, cmdStr, "move") > 0 Then
|
|
cmdStr = "runmotor"
|
|
End If
|
|
|
|
Select Case cmdStr
|
|
|
|
Case "freqconf"
|
|
cmdStr = cmdVal(1)
|
|
Return cmdStr
|
|
Case "settdcnf"
|
|
cmdStr = (cmdVal(1) & "," & cmdVal(2))
|
|
Return cmdStr
|
|
Case "wrsconf1"
|
|
cmdStr = cmdVal(1) & "," & cmdVal(2) & "," & cmdVal(3) & "," & cmdVal(4) & "," & cmdVal(5)
|
|
Return cmdStr
|
|
Case "settdsn"
|
|
cmdStr = cmdVal(1)
|
|
Return cmdStr
|
|
Case "resetinf"
|
|
cmdStr = cmdVal(1)
|
|
Return cmdStr
|
|
Case "rdsconf1"
|
|
cmdStr = cmdVal(1) & "," & cmdVal(2) & "," & cmdVal(3) & "," & cmdVal(4) & "," & cmdVal(5)
|
|
Return cmdStr
|
|
Case "shotconf"
|
|
cmdStr = cmdVal(1)
|
|
Return cmdStr
|
|
Case "runmotor"
|
|
Return True
|
|
Case "setdepth"
|
|
cmdStr = cmdVal(1)
|
|
Return cmdStr
|
|
Case "setmotor"
|
|
cmdStr = cmdVal(1) & "," & cmdVal(2) & "," & cmdVal(3) & "," & cmdVal(4) & "," & cmdVal(5)
|
|
Return cmdStr
|
|
Case Else
|
|
Return "Else"
|
|
rxMessage = ""
|
|
End Select
|
|
End If
|
|
rxMessage = ""
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
rxMessage = ""
|
|
Return Err.Description
|
|
End Try
|
|
End Function
|
|
|
|
|
|
Private Sub cmdSerial_Click(sender As Object, e As EventArgs) Handles cmdSerial.Click
|
|
|
|
If cmdSerial.Text = "스캔" Then
|
|
LoadComportName()
|
|
cmdSerial.Text = "연결"
|
|
Else
|
|
cmdSerialPort.Close()
|
|
ParaComport = cboComPort.SelectedItem
|
|
OpenSerial()
|
|
|
|
If serial_switch = True Then
|
|
cmdSerial.Text = "스캔"
|
|
save_comport("comport")
|
|
MsgBox("연결 완료", vbInformation)
|
|
Else
|
|
LoadComportName()
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Function save_comport(UseCtr As String) As Boolean
|
|
|
|
Dim filepath, comtext As String
|
|
Dim filename As String = ""
|
|
Dim reg_text As String = ""
|
|
Dim objwriter As System.IO.StreamWriter
|
|
|
|
On Error GoTo WR_File_Error
|
|
|
|
filepath = System.AppDomain.CurrentDomain.BaseDirectory() & "\config"
|
|
|
|
If Dir(filepath, vbDirectory) = "" Then
|
|
MkDir(filepath)
|
|
End If
|
|
|
|
Select Case UseCtr
|
|
Case "event"
|
|
filename = filepath & "\" & "event_config" & ".ini"
|
|
|
|
For i = 0 To dgv_data.Rows.Count - 2
|
|
|
|
comtext = dgv_data.Rows(i).Cells(0).Value.ToString & "☏" & dgv_data.Rows(i).Cells(1).Value.ToString & "☏" & dgv_data.Rows(i).Cells(2).Value.ToString & "☏" & dgv_data.Rows(i).Cells(3).Value.ToString & "☏§"
|
|
reg_text = reg_text + comtext
|
|
|
|
Next
|
|
|
|
reg_text = reg_text + txbOptBasic.Text
|
|
|
|
Case "comport"
|
|
|
|
filename = filepath & "\" & "config" & ".ini"
|
|
reg_text = cboComPort.Text & "/" & rdb_type_num & "/" & txb_code_front.Text & "/" & txb_prod1_code.Text & "/" & txb_output_6850.Text & "/" & txb_output_7000.Text
|
|
|
|
Case "print"
|
|
|
|
filename = filepath & "\" & "Printer_Config" & ".ini"
|
|
|
|
reg_text = ckbAllPnt.Checked & "☏" & ckbEachPnt.Checked & "☏" & txbName1.Text & "☏" & txbLabel1.Text & "☏" & txbCode1.Text & "☏" & txbText1.Text & "☏" & txbName2.Text & "☏" & txbLabel2.Text & "☏" & txbText2.Text & "☏"
|
|
|
|
End Select
|
|
|
|
|
|
|
|
System.IO.File.Delete(filename)
|
|
objwriter = New System.IO.StreamWriter(filename, True)
|
|
objwriter.Flush()
|
|
objwriter.WriteLine(reg_text)
|
|
|
|
objwriter.Close()
|
|
Return True
|
|
|
|
|
|
WR_File_Error:
|
|
MsgBox("Config Save Fail!")
|
|
Return False
|
|
|
|
End Function
|
|
|
|
Private Sub load_comport(LoadCtr As String)
|
|
Dim filepath, filename, configStr, Str, COMPORT_NAME, front_code, prod1_code, output_6850, output_7000 As String
|
|
Dim event_list() As String
|
|
Dim objReader As System.IO.StreamReader
|
|
|
|
filepath = System.AppDomain.CurrentDomain.BaseDirectory() & "\config"
|
|
|
|
If Dir(filepath, vbDirectory) = "" Then
|
|
MkDir(filepath)
|
|
End If
|
|
|
|
Select Case LoadCtr
|
|
Case "event"
|
|
|
|
dgv_data.Rows.Clear()
|
|
|
|
filename = filepath & "\event_config.ini"
|
|
|
|
If File.Exists(filename) = True Then
|
|
objReader = New System.IO.StreamReader(filename, True)
|
|
configStr = objReader.ReadLine
|
|
objReader.Close()
|
|
|
|
For count = UBound(Split(configStr, "§")) To 1 Step -1
|
|
Str = Mid(configStr, 1, InStr(configStr, "§") - 1)
|
|
ReDim event_list(UBound(Split(Str, "☏")))
|
|
configStr = Mid(configStr, InStr(configStr, "§") + 1, Len(configStr))
|
|
|
|
For i = 0 To UBound(Split(Str, "☏")) - 1
|
|
event_list(i) = Mid(Str, 1, InStr(Str, "☏") - 1)
|
|
Str = Mid(Str, InStr(Str, "☏") + 1, Len(Str))
|
|
Next
|
|
|
|
dgv_data.Rows.Add(event_list)
|
|
Next
|
|
|
|
txbOptBasic.Text = configStr
|
|
End If
|
|
|
|
Case "comport"
|
|
filename = filepath & "\config.ini"
|
|
|
|
If File.Exists(filename) = True Then
|
|
objReader = New System.IO.StreamReader(filename, True)
|
|
configStr = objReader.ReadLine
|
|
objReader.Close()
|
|
|
|
COMPORT_NAME = Mid(configStr, 1, InStr(1, configStr, "/") - 1)
|
|
configStr = Mid(configStr, InStr(1, configStr, "/") + 1, configStr.Length)
|
|
rdb_type_num = Mid(configStr, 1, InStr(1, configStr, "/") - 1)
|
|
configStr = Mid(configStr, InStr(1, configStr, "/") + 1, configStr.Length)
|
|
front_code = Mid(configStr, 1, InStr(1, configStr, "/") - 1)
|
|
configStr = Mid(configStr, InStr(1, configStr, "/") + 1, configStr.Length)
|
|
prod1_code = Mid(configStr, 1, InStr(1, configStr, "/") - 1)
|
|
configStr = Mid(configStr, InStr(1, configStr, "/") + 1, configStr.Length)
|
|
output_6850 = Mid(configStr, 1, InStr(1, configStr, "/") - 1)
|
|
output_7000 = Mid(configStr, InStr(1, configStr, "/") + 1, configStr.Length)
|
|
|
|
txb_code_front.Text = front_code
|
|
txb_prod1_code.Text = prod1_code
|
|
txb_output_6850.Text = output_6850
|
|
txb_output_7000.Text = output_7000
|
|
|
|
For i = 0 To cboComPort.Items.Count - 1
|
|
If COMPORT_NAME = cboComPort.Items(i) Then
|
|
cboComPort.SelectedIndex = i
|
|
ParaComport = cboComPort.SelectedItem
|
|
OpenSerial()
|
|
End If
|
|
Next
|
|
|
|
Select Case rdb_type_num
|
|
Case 1
|
|
' gbc_prod.Visible = True
|
|
' gpbSpec.Visible = True
|
|
' gpbProduct1.Visible = False
|
|
' 'gb_reg_freq.Visible = False
|
|
' gb_data_info.Visible = False
|
|
' gb_prod_info.Visible = False
|
|
|
|
' gbc_prod.Enabled = True
|
|
' gpbSpec.Enabled = True
|
|
' gpbProduct1.Enabled = False
|
|
' 'gb_reg_freq.Enabled = False
|
|
' gb_data_info.Enabled = False
|
|
' gb_prod_info.Enabled = False
|
|
|
|
' rdb_c_mode.Checked = True
|
|
' rdb_freq_auto.Checked = False
|
|
' rdb_prod.Checked = False
|
|
' rdb_freq_reg.Checked = False
|
|
rdb_c_mode.Checked = True
|
|
|
|
Case 2
|
|
' gbc_prod.Visible = False
|
|
' gpbSpec.Visible = True
|
|
' gpbProduct1.Visible = True
|
|
' 'gb_reg_freq.Visible = False
|
|
' gb_data_info.Visible = False
|
|
' gb_prod_info.Visible = False
|
|
|
|
' gbc_prod.Enabled = False
|
|
' gpbSpec.Enabled = True
|
|
' gpbProduct1.Enabled = True
|
|
' 'gb_reg_freq.Enabled = False
|
|
' gb_data_info.Enabled = False
|
|
' gb_prod_info.Enabled = False
|
|
|
|
' rdb_c_mode.Checked = False
|
|
' rdb_freq_auto.Checked = True
|
|
' rdb_prod.Checked = False
|
|
' rdb_freq_reg.Checked = False
|
|
rdb_freq_auto.Checked = True
|
|
|
|
Case 3
|
|
' gbc_prod.Visible = False
|
|
' gpbSpec.Visible = False
|
|
' gpbProduct1.Visible = False
|
|
' 'gb_reg_freq.Visible = False
|
|
' gb_data_info.Visible = False
|
|
' gb_prod_info.Visible = True
|
|
|
|
' gbc_prod.Enabled = False
|
|
' gpbSpec.Enabled = False
|
|
' gpbProduct1.Enabled = False
|
|
' 'gb_reg_freq.Enabled = False
|
|
' gb_data_info.Enabled = False
|
|
' gb_prod_info.Enabled = True
|
|
|
|
' rdb_c_mode.Checked = False
|
|
' rdb_freq_auto.Checked = False
|
|
' rdb_prod.Checked = True
|
|
' rdb_freq_reg.Checked = False
|
|
rdb_prod.Checked = True
|
|
|
|
|
|
Case 4
|
|
' gbc_prod.Visible = False
|
|
' gpbSpec.Visible = False
|
|
' gpbProduct1.Visible = False
|
|
' 'gb_reg_freq.Visible = False
|
|
' gb_data_info.Visible = True
|
|
' gb_prod_info.Visible = False
|
|
|
|
' gbc_prod.Enabled = False
|
|
' gpbSpec.Enabled = False
|
|
' gpbProduct1.Enabled = False
|
|
' 'gb_reg_freq.Enabled = False
|
|
' gb_data_info.Enabled = True
|
|
' gb_prod_info.Enabled = False
|
|
|
|
' rdb_c_mode.Checked = False
|
|
' rdb_freq_auto.Checked = False
|
|
' rdb_prod.Checked = False
|
|
' rdb_freq_reg.Checked = True
|
|
rdb_freq_reg.Checked = True
|
|
|
|
Case 5
|
|
rdb_data_check.Checked = True
|
|
End Select
|
|
|
|
End If
|
|
|
|
Case "print"
|
|
filename = filepath & "\" & "Printer_Config" & ".ini"
|
|
|
|
If File.Exists(filename) = True Then
|
|
objReader = New System.IO.StreamReader(filename, True)
|
|
configStr = objReader.ReadLine()
|
|
objReader.Close()
|
|
|
|
ckbAllPnt.Checked = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
ckbEachPnt.Checked = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
ckbprint_use()
|
|
|
|
txbName1.Text = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
txbLabel1.Text = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
txbCode1.Text = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
txbText1.Text = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
txbName2.Text = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
txbLabel2.Text = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
configStr = Mid(configStr, InStr(configStr, "☏") + 1, configStr.Length)
|
|
|
|
txbText2.Text = Mid(configStr, 1, InStr(configStr, "☏") - 1)
|
|
End If
|
|
End Select
|
|
|
|
End Sub
|
|
|
|
Private Sub ckbprint_use()
|
|
If ckbAllPnt.Checked = True Or ckbBoxPnt.Checked = True Or ckbWarPnt.Checked = True Then
|
|
ckbfrontprt.Checked = True
|
|
Else
|
|
ckbfrontprt.Checked = False
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub LoadComportName()
|
|
Dim portname() As String
|
|
Dim i As Integer
|
|
|
|
Try
|
|
cboComPort.Items.Clear()
|
|
portname = SerialPort.GetPortNames
|
|
|
|
For i = 1 To portname.Length
|
|
cboComPort.Items.Add(portname(i - 1))
|
|
Next i
|
|
|
|
cboComPort.Text = "PRESS!"
|
|
Catch ex As Exception
|
|
MsgBox("COM 포트 에러" & vbCrLf & "", vbOK + vbCritical, "DUALSONIC T/D Selecter Tester Manager")
|
|
cart_timer.Enabled = False
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
|
|
End
|
|
End Sub
|
|
|
|
Private Sub txbPV_SN_Click(sender As Object, e As EventArgs) Handles txbPV_SN.Click
|
|
txbPV_SN.Text = ""
|
|
End Sub
|
|
|
|
Private Sub event_release()
|
|
|
|
cboselect.Items.Clear()
|
|
cboselect.Text = "사항을 선택해 주세요."
|
|
|
|
If dgv_data.Rows.Count <> 1 Then
|
|
|
|
For i = 0 To dgv_data.Rows.Count - 2
|
|
cboselect.Items.Add(dgv_data.Rows(i).Cells(0).Value)
|
|
Next
|
|
Else
|
|
cboselect.Text = "없음"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btn_option_exit_Click(sender As Object, e As EventArgs) Handles btn_option_exit.Click
|
|
Dim ckb_num As Int16
|
|
|
|
If option_reg_chk = True Or option_print_chk = True Then
|
|
ckb_num = MsgBox("변경된 사항이 존재합니다. 저장하시겠습니까?", vbOKCancel + vbExclamation)
|
|
|
|
If ckb_num = 1 Then
|
|
|
|
If txb_code_front.Text.Replace(" ", "") = "" Then
|
|
txb_code_front.Text = "30"
|
|
End If
|
|
If txb_code_front.Text.Replace(" ", "") = "" Or txb_prod1_code.Text.Replace(" ", "") = "" Or txb_output_6850.Text.Replace(" ", "") = "" Or txb_output_7000.Text.Replace(" ", "") = "" Then
|
|
MsgBox("바코드 번호 중 비어있는 칸이 존재합니다. 모든 정보를 입력하여 주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
|
|
If txbName1.Text.Replace(" ", "") = "" Or txbLabel1.Text.Replace(" ", "") = "" Or txbCode1.Text.Replace(" ", "") = "" Or txbText1.Text.Replace(" ", "") = "" Then
|
|
MsgBox("박스 바코드 인쇄 프린터 설정란에 빈 칸이 존재합니다. 빈 칸을 채워주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
|
|
If txbName2.Text.Replace(" ", "") = "" Or txbLabel2.Text.Replace(" ", "") = "" Or txbText2.Text.Replace(" ", "") = "" Then
|
|
MsgBox("워런티 카드 텍스트 인쇄 프린터 설정란에 빈 칸이 존재합니다. 빈 칸을 채워주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
|
|
If save_comport("event") Then
|
|
If save_comport("comport") Then
|
|
If save_comport("print") = False Then
|
|
MsgBox("데이터를 저장하는 도중 오류가 발생하였습니다.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
Else
|
|
MsgBox("데이터를 저장하는 도중 오류가 발생하였습니다.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
Else
|
|
MsgBox("데이터를 저장하는 도중 오류가 발생하였습니다.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
Me.Size = New Size(1040, 785)
|
|
|
|
gb_option.Visible = False
|
|
gpbSpec.Enabled = True
|
|
gbc_prod.Enabled = True
|
|
gbprodreg.Enabled = True
|
|
gb_prod_info.Enabled = True
|
|
gb_data_info.Enabled = True
|
|
gb_check_data.Enabled = True
|
|
gb_option.Location = New Point(1030, 1)
|
|
|
|
load_comport("event")
|
|
load_comport("comport")
|
|
|
|
event_release()
|
|
|
|
printOptionData()
|
|
|
|
mainOptionCkb()
|
|
|
|
control_page()
|
|
ckbprint_use()
|
|
|
|
End Sub
|
|
|
|
Private Sub mainOptionCkb()
|
|
If rdb_freq_auto.Checked = True Then
|
|
ckbfrontprt.Visible = True
|
|
ckbNonTD.Visible = False
|
|
ManagerTDUse = False
|
|
ckbfrontprt.Location = New Point(21, 48)
|
|
chbUseBarcode.Location = New Point(21, 20)
|
|
chbAutoMeasure.Location = New Point(156, 20)
|
|
|
|
ElseIf rdb_freq_reg.Checked = True Then
|
|
ckbfrontprt.Visible = False
|
|
ckbNonTD.Visible = True
|
|
ckbNonTD.Checked = True
|
|
ManagerTDUse = True
|
|
chbUseBarcode.Location = New Point(21, 20)
|
|
chbAutoMeasure.Location = New Point(156, 20)
|
|
ckbNonTD.Location = New Point(21, 48)
|
|
Else
|
|
ckbfrontprt.Visible = False
|
|
ckbNonTD.Visible = False
|
|
ManagerTDUse = False
|
|
chbUseBarcode.Location = New Point(21, 30)
|
|
chbAutoMeasure.Location = New Point(156, 30)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub control_page()
|
|
Select Case rdb_type_num
|
|
Case 1
|
|
gpbSpec.Visible = True
|
|
gbc_prod.Visible = True
|
|
gbprodreg.Visible = False
|
|
gb_data_info.Visible = False
|
|
gb_prod_info.Visible = False
|
|
gb_check_data.Visible = False
|
|
gbRecycle.Visible = False
|
|
gb_option.Location = New Point(5, 560)
|
|
'gbc_prod.Location = New Point(1, 221)
|
|
gbselect.Visible = False
|
|
gpbTime.Visible = True
|
|
gpbTime.Location = New Point(1, 2)
|
|
gbselect.Location = New Point(1, 2)
|
|
|
|
one_text_box()
|
|
one_text_refresh()
|
|
one_text_color()
|
|
one_vari_default()
|
|
|
|
txbPV_SN.Focus()
|
|
|
|
'lblCapacitor.Text = "주파수"
|
|
'lblCapacitor.Location = New Point(545, 58)
|
|
|
|
'InputCnt = 0
|
|
'InputTimer.Enabled = False
|
|
'cart_timer.Enabled = False
|
|
'reserve = False
|
|
Case 2
|
|
gpbSpec.Visible = False
|
|
gbc_prod.Visible = False
|
|
'gpbProduct1.Visible = True
|
|
gbprodreg.Visible = True
|
|
'gb_reg_freq.Visible = False
|
|
gb_data_info.Visible = False
|
|
gb_prod_info.Visible = False
|
|
gb_check_data.Visible = False
|
|
gbRecycle.Visible = False
|
|
'gb_option.Location = New Point(5, 560)
|
|
'gpbProduct1.Location = New Point(1, 221)
|
|
'lblCapacitor.Text = "C값"
|
|
'lblCapacitor.Location = New Point(565, 58)
|
|
gbselect.Visible = True
|
|
gpbTime.Visible = False
|
|
gpbTime.Location = New Point(1, 2)
|
|
gbselect.Location = New Point(1, 2)
|
|
|
|
ItemList = "TestDate,TestTime,ProdNo.,TDSerial.,Frequence,Power,TestStep,ProdReg(Send),ProdReg(Receive),ShotReg(Send),ShotReg(Receive),ShotCheck1(Receive),ShotCheck2(Receive),ShotCheck3(Receive),ShotCheck4(Receive)
|
|
"
|
|
|
|
TH_print = New Thread(AddressOf print_func)
|
|
|
|
If TH_print.IsAlive = False Then
|
|
TH_print.IsBackground = True
|
|
TH_print.Start()
|
|
thread_print = True
|
|
End If
|
|
|
|
'gb_reg_freq.Visible = False
|
|
|
|
'InputCnt = 0
|
|
'InputTimer.Enabled = False
|
|
|
|
'cart_timer.Enabled = False
|
|
'reserve = False
|
|
btnreset.PerformClick()
|
|
ckbselect.Checked = True
|
|
|
|
Case 3
|
|
gpbSpec.Visible = False
|
|
gbc_prod.Visible = False
|
|
'gpbProduct1.Visible = False
|
|
gbprodreg.Visible = False
|
|
gb_check_data.Visible = False
|
|
gb_data_info.Visible = False
|
|
gb_check_data.Visible = False
|
|
gbRecycle.Visible = False
|
|
gb_prod_info.Visible = True
|
|
'gb_option.Location = New Point(17, 609)
|
|
'gb_reg_freq.Location = New Point(1, 79)
|
|
gbselect.Visible = False
|
|
gpbTime.Visible = True
|
|
gpbTime.Location = New Point(1, 2)
|
|
gbselect.Location = New Point(1, 2)
|
|
btn_reset.PerformClick()
|
|
ItemList = "TestDate,TestTime,SerialNo.,Frequence,Power,TestStep,RegData(Send),RegData(Receive),RegSerial(Send),RegSerial(Receive),RegFreqPower(Send),RegFreqPower(Receive),ReadInfo(Receive)"
|
|
|
|
Case 4
|
|
gpbSpec.Visible = False
|
|
gbc_prod.Visible = False
|
|
'gpbProduct1.Visible = False
|
|
gbprodreg.Visible = False
|
|
'gb_reg_freq.Visible = True
|
|
gb_data_info.Visible = True
|
|
gb_prod_info.Visible = False
|
|
gb_check_data.Visible = False
|
|
gbRecycle.Visible = False
|
|
'gb_option.Location = New Point(5, 650)
|
|
'gb_reg_freq.Location = New Point(1, 79)
|
|
gbselect.Visible = False
|
|
gpbTime.Visible = True
|
|
gpbTime.Location = New Point(1, 2)
|
|
gbselect.Location = New Point(1, 2)
|
|
btn_text_reset.PerformClick()
|
|
|
|
Case 5
|
|
gpbSpec.Visible = False
|
|
gbc_prod.Visible = False
|
|
'gpbProduct1.Visible = False
|
|
gbprodreg.Visible = False
|
|
'gb_reg_freq.Visible = True
|
|
gb_data_info.Visible = False
|
|
gb_prod_info.Visible = False
|
|
gb_check_data.Visible = True
|
|
gbRecycle.Visible = False
|
|
'gb_option.Location = New Point(5, 650)
|
|
'gb_reg_freq.Location = New Point(1, 79)
|
|
gbselect.Visible = False
|
|
gpbTime.Visible = True
|
|
gpbTime.Location = New Point(1, 2)
|
|
gbselect.Location = New Point(1, 2)
|
|
btn_5_reset.PerformClick()
|
|
|
|
txb_5_barcode.Focus()
|
|
|
|
Case 6
|
|
|
|
gpbSpec.Visible = True
|
|
gbc_prod.Visible = False
|
|
gbprodreg.Visible = False
|
|
gb_data_info.Visible = False
|
|
gb_prod_info.Visible = False
|
|
gb_check_data.Visible = False
|
|
gb_option.Location = New Point(5, 560)
|
|
'gbc_prod.Location = New Point(1, 221)
|
|
gbselect.Visible = False
|
|
gbRecycle.Visible = True
|
|
gpbTime.Visible = True
|
|
gpbTime.Location = New Point(1, 2)
|
|
gbselect.Location = New Point(1, 2)
|
|
|
|
one_text_box()
|
|
one_text_refresh()
|
|
one_text_color()
|
|
one_vari_default()
|
|
|
|
txbPV_SN.Focus()
|
|
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub print_func()
|
|
Do While thread_print
|
|
print_th_play()
|
|
Loop
|
|
End Sub
|
|
|
|
Private Sub print_th_play()
|
|
If print_OnOff Then
|
|
print_on(txbpdnum.Text, txbCode1.Text, txbText1.Text, txbText2.Text)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub btnSetup_Click(sender As Object, e As EventArgs) Handles btnSetup.Click
|
|
|
|
Me.Location = New Point(0, 0)
|
|
ckbselect.Checked = False
|
|
reg_text_box()
|
|
reg_text_refresh()
|
|
reg_text_color()
|
|
reg_btn_refresh()
|
|
reg_txb_visible()
|
|
|
|
gb_option.Visible = True
|
|
gpbSpec.Enabled = False
|
|
gbc_prod.Enabled = False
|
|
gbprodreg.Enabled = False
|
|
gb_prod_info.Enabled = False
|
|
gb_data_info.Enabled = False
|
|
gb_check_data.Enabled = False
|
|
|
|
gb_option.Location = New Point(1, 1)
|
|
|
|
option_reg_chk = False
|
|
|
|
If TH_print.IsAlive Then
|
|
TH_print.Abort()
|
|
End If
|
|
|
|
|
|
'If btnSetup.Text = "설정" Then
|
|
' gb_option.Visible = True
|
|
' gpbSpec.Enabled = False
|
|
' gbc_prod.Enabled = False
|
|
' 'gpbProduct1.Enabled = False
|
|
' 'gb_reg_freq.Enabled = False
|
|
' gbprodreg.Enabled = False
|
|
' gb_prod_info.Enabled = False
|
|
' gb_data_info.Enabled = False
|
|
|
|
' If rdb_freq_reg.Checked = True Then
|
|
' gb_option.Location = New Point(5, 650)
|
|
' If thread_restart = True Then
|
|
' thread_type = False
|
|
' TH_thread.Abort()
|
|
' End If
|
|
' thread_restart = True
|
|
|
|
' ElseIf rdb_prod.Checked = True Then
|
|
' gb_option.Location = New Point(17, 609)
|
|
' Else
|
|
' gb_option.Location = New Point(5, 560)
|
|
' End If
|
|
' btnSetup.Text = "완료"
|
|
'Else
|
|
' gb_option.Visible = False
|
|
' gpbSpec.Enabled = True
|
|
' gbc_prod.Enabled = True
|
|
' 'gpbProduct1.Enabled = True
|
|
' gbprodreg.Enabled = True
|
|
' 'gb_reg_freq.Enabled = True
|
|
' gb_prod_info.Enabled = True
|
|
' gb_data_info.Enabled = True
|
|
' btnSetup.Text = "설정"
|
|
' 'save_comport()
|
|
|
|
' If rdb_prod.Checked = True Then
|
|
' If thread_restart = True Then
|
|
' TH_thread = New Thread(AddressOf thread_func)
|
|
' End If
|
|
' TH_thread.IsBackground = True
|
|
' TH_thread.Start()
|
|
' thread_type = True
|
|
' txb_serial_num.Focus()
|
|
' Else
|
|
' txbPV_SN.Focus()
|
|
' End If
|
|
'End If
|
|
Me.Size = New Size(1940, 785)
|
|
gb_option.Size = New Size(1910, 744)
|
|
btPrintref_Click(sender, e)
|
|
|
|
End Sub
|
|
|
|
Private Sub rdb_freq_auto_CheckedChanged(sender As Object, e As EventArgs) Handles rdb_freq_auto.CheckedChanged
|
|
rdb_type_num = 2
|
|
option_reg_chk = True
|
|
End Sub
|
|
|
|
Private Sub rdb_c_mode_CheckedChanged(sender As Object, e As EventArgs) Handles rdb_c_mode.CheckedChanged
|
|
rdb_type_num = 1
|
|
option_reg_chk = True
|
|
End Sub
|
|
|
|
Private Sub rdb_freq_reg_CheckedChanged(sender As Object, e As EventArgs) Handles rdb_freq_reg.CheckedChanged
|
|
rdb_type_num = 4
|
|
option_reg_chk = True
|
|
End Sub
|
|
|
|
Private Sub rdb_prod_CheckedChanged(sender As Object, e As EventArgs) Handles rdb_prod.CheckedChanged
|
|
rdb_type_num = 3
|
|
option_reg_chk = True
|
|
End Sub
|
|
|
|
|
|
Private Sub rdb_data_check_CheckedChanged(sender As Object, e As EventArgs) Handles rdb_data_check.CheckedChanged
|
|
rdb_type_num = 5
|
|
option_reg_chk = True
|
|
End Sub
|
|
|
|
Private Sub rdbTDRecycle_CheckedChanged(sender As Object, e As EventArgs) Handles rdbTDRecycle.CheckedChanged
|
|
rdb_type_num = 6
|
|
option_reg_chk = True
|
|
End Sub
|
|
|
|
'Private Sub btn_option_exit_Click(sender As Object, e As EventArgs)
|
|
' pn_option.Visible = False
|
|
|
|
' gpbTime.Visible = True
|
|
' gpbConfig.Visible = True
|
|
' btnExit.Visible = True
|
|
' gpbSpec.Visible = True
|
|
|
|
' If rdb_c_mode.Checked = True Then
|
|
' gbc_prod.Visible = True
|
|
' gpbProduct1.Visible = False
|
|
' gbc_prod.Location = New Point(1, 221)
|
|
' main_nothing()
|
|
' main_refresh()
|
|
' main_color()
|
|
' data_nothing_freq()
|
|
' data_refresh_freq()
|
|
' data_color_freq()
|
|
' data_nothing_c()
|
|
' data_refresh_c()
|
|
' data_color_c()
|
|
' lblCapacitor.Text = "주파수"
|
|
' lblCapacitor.Location = New Point(545, 58)
|
|
|
|
' cart_timer.Enabled = False
|
|
' reserve = False
|
|
|
|
' Else
|
|
' gbc_prod.Visible = False
|
|
' gpbProduct1.Visible = True
|
|
' gpbProduct1.Location = New Point(1, 221)
|
|
' main_nothing()
|
|
' main_refresh()
|
|
' main_color()
|
|
' data_nothing_freq()
|
|
' data_refresh_freq()
|
|
' data_color_freq()
|
|
' data_nothing_c()
|
|
' data_refresh_c()
|
|
' data_color_c()
|
|
' lblCapacitor.Text = "C값"
|
|
' lblCapacitor.Location = New Point(565, 58)
|
|
|
|
' cart_timer.Enabled = False
|
|
' reserve = False
|
|
|
|
' End If
|
|
|
|
' txbPV_SN.Focus()
|
|
|
|
'End Sub
|
|
|
|
Private Sub cart_timer_Tick(sender As Object, e As EventArgs) Handles cart_timer.Tick
|
|
'Dim message_code, message_serial As String
|
|
|
|
If rdb_prod.Checked = True Then
|
|
'If cmdSerialPort.IsOpen = True Then
|
|
' 'If check_connection() Then
|
|
' If cmdSerialPort.BytesToRead <> 0 Then
|
|
' cmdSerialPort.ReadTimeout = 0
|
|
' rxMessage = cmdSerialPort.ReadLine
|
|
|
|
|
|
' message_code = read_info()
|
|
|
|
' If message_code <> "0" Then
|
|
' message_code = Mid(message_code, InStr(1, message_code, ",") + 1, message_code.Length)
|
|
' message_serial = Mid(message_code, 1, InStr(1, message_code, ",") - 1)
|
|
' message_code = Mid(message_code, InStr(1, message_code, ",") + 1, message_code.Length)
|
|
' message_code = Mid(message_code, 1, InStr(1, message_code, ",") - 1)
|
|
' txb_prod_code.Text = message_code & message_serial
|
|
' End If
|
|
|
|
' Else
|
|
' txb_prod_code.Text = ""
|
|
' End If
|
|
|
|
'End If
|
|
|
|
If check_connection() Then
|
|
btn_prod_Click(sender, e)
|
|
End If
|
|
|
|
Else
|
|
If reserve = True Then
|
|
If check_connection() Then
|
|
btnRunPD1_Click(sender, e)
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Function check_connection() As String
|
|
Dim retval As String
|
|
|
|
tmpCmdMessage = "FREQCONF"
|
|
cmdMessage = "[" & tmpCmdMessage & "]"
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retval = PollingReceiveData(500)
|
|
|
|
If IsNumeric(retval) = True Then
|
|
Return True
|
|
Else
|
|
If rdb_prod.Checked = False Then
|
|
cart_timer.Enabled = False
|
|
MsgBox("제품이 연결되지 않았습니다. 제품을 연결해 주십시오.", vbCritical)
|
|
Return False
|
|
End If
|
|
Return False
|
|
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Sub time_timer_Tick(sender As Object, e As EventArgs) Handles time_timer.Tick
|
|
lblTime.Text = Now
|
|
End Sub
|
|
|
|
Private Sub txb_reg_freq_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
If Not Char.IsDigit(e.KeyChar) And Not Char.IsControl(e.KeyChar) And Not e.KeyChar = "." Then
|
|
e.Handled = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Function freq_data(freq As Int16) As Int16
|
|
|
|
If freq >= 6700 And freq <= 7200 Then
|
|
Return freq
|
|
End If
|
|
|
|
Return 0
|
|
|
|
End Function
|
|
|
|
Private Function power_data(power As Single) As Int16
|
|
|
|
power = power * 100
|
|
|
|
If power >= -50 And power <= 50 Then
|
|
Return power
|
|
End If
|
|
|
|
Return 100
|
|
|
|
End Function
|
|
|
|
Private Sub txb_td_serial_GotFocus(sender As Object, e As EventArgs) Handles txb_td_serial.GotFocus, txb_prod_Depth.GotFocus, txb_prod_grade.GotFocus, txb_prod_power.GotFocus, txb_prod_state.GotFocus, txbStCheck.GotFocus, txbNdCheck.GotFocus, txbRdCheck.GotFocus
|
|
txb_serial_num.Focus()
|
|
End Sub
|
|
|
|
Private Sub btn_prod_Click(sender As Object, e As EventArgs) Handles btn_prod.Click
|
|
Dim output_code As String
|
|
Dim text_serial As String = txb_serial_num.Text
|
|
Dim NowDate As String = Format(Now, "yyyy") & "-" & Format(Now, "MM") & "-" & Format(Now, "dd")
|
|
Dim NowTime As String = Format(Now, "HH") & ":" & Format(Now, "mm") & ":" & Format(Now, "ss")
|
|
|
|
CsvRegData = Nothing
|
|
|
|
If text_serial = txb_prod1_code.Text Or text_serial = txb_output_6850.Text Or text_serial = txb_output_7000.Text Then
|
|
output_code = text_serial
|
|
text_serial = txb_code_front.Text & Format(Now, "yy") & Format(Now, "MM") & text_serial
|
|
Else
|
|
output_code = String.Empty
|
|
End If
|
|
|
|
If InStr(1, text_serial, td_first_name) > 0 Or InStr(1, text_serial, td_first_name2) > 0 Then
|
|
If Maximum_Data.td_serial <> "" Or Maximum_Data.td_step <> Nothing Then
|
|
If MsgBox("작업하고 있는 내용이 존재합니다. 새로 측정하시겠습니까?", vbYesNo + vbExclamation) = MsgBoxResult.No Then
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
txb_prod_state.Text = "대기"
|
|
txb_prod_state.BackColor = Color.Gold
|
|
|
|
If db_info_search(text_serial) Then
|
|
txb_td_serial.Text = text_serial
|
|
txb_td_serial.BackColor = Color.Green
|
|
txb_prod_grade.Text = info_select(info_data.pv_grade)
|
|
txb_prod_power.Text = Val(info_select(info_data.pv_power)) / 100
|
|
txb_prod_Depth.Text = info_select(info_data.pv_depth)
|
|
|
|
Maximum_Data.td_serial = text_serial ''확인 요망
|
|
Maximum_Data.td_power = info_select(info_data.pv_power)
|
|
Maximum_Data.td_Depth = info_select(info_data.pv_depth)
|
|
|
|
txb_prod_state.Text = "TD 정보등록"
|
|
txb_prod_state.BackColor = Color.Green
|
|
|
|
Else
|
|
txb_prod_state.Text = "TD 정보실패"
|
|
txb_prod_state.BackColor = Color.Red
|
|
MsgBox("데이터베이스에 해당 데이터가 존재하지 않습니다.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
|
|
Else
|
|
|
|
If Maximum_Data.td_serial = "" Then
|
|
txb_prod_state.Text = "TD 정보 누락"
|
|
txb_prod_state.BackColor = Color.Red
|
|
MsgBox("TD 정보를 알 수 없습니다. TD 바코드를 입력하여 주십시오.", vbExclamation)
|
|
Exit Sub
|
|
Else
|
|
If Maximum_Data.td_serial <> "" And Maximum_Data.prod_serial <> "" Then
|
|
|
|
If prod_reg_data("jomt", Maximum_Data.prod_serial, txb_code_front.Text, "82", "0") Then
|
|
If td_reg_data(Maximum_Data.td_serial) Then
|
|
If sett_reg(Maximum_Data.td_freq, Maximum_Data.td_power) Then
|
|
|
|
If Motor_reg(Maximum_Data.td_Depth) Then
|
|
|
|
If db_data_reg() Then
|
|
Maximum_Data.td_textbox.Text = "OK"
|
|
Maximum_Data.td_textbox.BackColor = Color.Green
|
|
|
|
If txbStCheck.Text = "OK" And txbNdCheck.Text = "OK" And txbRdCheck.Text = "OK" Or ckb_info.Checked = True Then
|
|
|
|
Dim ComSerial As String = read_info()
|
|
ComSerial = Mid(ComSerial, InStr(1, ComSerial, ",") + 1, ComSerial.Length)
|
|
ComSerial = Mid(ComSerial, 1, InStr(1, ComSerial, ",") - 1)
|
|
|
|
If Maximum_Data.prod_serial = ComSerial Then
|
|
Maximum_Data.prod_serial = Nothing
|
|
txb_prod_state.Text = "정보입력 완료"
|
|
txb_prod_state.BackColor = Color.Green
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
Else
|
|
MsgBox("정보입력한 데이터값과 다릅니다. 정보를 확인하여 주십시오.", vbCritical)
|
|
End If
|
|
|
|
txb_serial_num.Focus()
|
|
|
|
Else
|
|
Maximum_Data.prod_serial = Nothing
|
|
txb_prod_state.Text = Maximum_Data.td_freq & " 입력 완료"
|
|
txb_prod_state.BackColor = Color.Green
|
|
End If
|
|
|
|
Save_Csv(NowDate & "," & NowTime & "," & txb_td_serial.Text & "," & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, True)
|
|
|
|
Else
|
|
Maximum_Data.td_textbox.Text = "FAIL"
|
|
Maximum_Data.td_textbox.BackColor = Color.Red
|
|
txb_prod_state.Text = "정보입력 실패"
|
|
txb_prod_state.BackColor = Color.Red
|
|
Save_Csv(NowDate & "," & NowTime & "," & text_serial & "," & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, True)
|
|
MsgBox("정보 입력은 완료되었으나 데이터베이스에 등록하지 못하였습니다. 다시 시도하여 주십시오.", vbExclamation)
|
|
InputTimer.Enabled = False
|
|
End If
|
|
|
|
Else
|
|
fail_data(Maximum_Data.td_textbox)
|
|
InputTimer.Enabled = False
|
|
End If
|
|
Else
|
|
fail_data(Maximum_Data.td_textbox)
|
|
InputTimer.Enabled = False
|
|
End If
|
|
Else
|
|
fail_data(Maximum_Data.td_textbox)
|
|
InputTimer.Enabled = False
|
|
End If
|
|
Else
|
|
fail_data(Maximum_Data.td_textbox)
|
|
InputTimer.Enabled = False
|
|
End If
|
|
|
|
Else
|
|
If text_serial.Length = prod_text_count And output_code <> String.Empty Then
|
|
|
|
Maximum_Data.prod_code = Mid(text_serial, 1, 2)
|
|
Maximum_Data.prod_serial = Mid(text_serial, 3, text_serial.Length)
|
|
|
|
If output_code = txb_output_6850.Text Then
|
|
Maximum_Data.td_textbox = txbStCheck
|
|
Maximum_Data.td_step = 21
|
|
Maximum_Data.td_freq = 6850
|
|
ElseIf output_code = txb_output_7000.Text Then
|
|
Maximum_Data.td_textbox = txbNdCheck
|
|
Maximum_Data.td_step = 22
|
|
Maximum_Data.td_freq = 7000
|
|
Else
|
|
Maximum_Data.td_freq = info_select(info_data.pv_freq)
|
|
Maximum_Data.td_textbox = txbRdCheck
|
|
Maximum_Data.td_step = 23
|
|
End If
|
|
|
|
Maximum_Data.td_textbox.Text = "입력대기"
|
|
Maximum_Data.td_textbox.BackColor = Color.Yellow
|
|
|
|
If Maximum_Data.td_serial <> "" And Maximum_Data.prod_serial <> "" Then
|
|
txb_prod_state.Text = "제품 연결 대기.."
|
|
txb_prod_state.BackColor = Color.Orange
|
|
|
|
TH_thread = New Thread(AddressOf thread_func)
|
|
TH_thread.IsBackground = True
|
|
TH_thread.Start()
|
|
thread_type = True
|
|
End If
|
|
Else
|
|
txb_prod_state.Text = "잘못된 번호입력"
|
|
txb_prod_state.BackColor = Color.Red
|
|
MsgBox("잘못된 시리얼 번호를 입력하였습니다. 다시 확인하여 주십시오.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
'Private Sub btn_prod_Click(sender As Object, e As EventArgs) Handles btn_prod.Click
|
|
' Dim text_serial As String
|
|
' Dim output_code As String = ""
|
|
|
|
' text_serial = txb_serial_num.Text
|
|
|
|
' If text_serial = txb_prod1_code.Text Or text_serial = txb_output_6850.Text Or text_serial = txb_output_7000.Text Then
|
|
' output_code = text_serial
|
|
' text_serial = txb_code_front.Text & Format(Now, "yy") & Format(Now, "MM") & text_serial
|
|
' End If
|
|
|
|
' If Maximum_Data.td_serial = "" Or Maximum_Data.prod_serial = "" Then
|
|
' If InStr(1, text_serial, td_first_name) > 0 Then
|
|
' If db_info_search(text_serial) Then
|
|
' txb_td_serial.Text = text_serial
|
|
' txb_td_serial.BackColor = Color.Green
|
|
' txb_prod_freq.Text = info_select(info_data.pv_freq)
|
|
' txb_prod_grade.Text = info_select(info_data.pv_grade)
|
|
|
|
' If txb_prod_grade.Text = "LUX" Then
|
|
' txb_prod_power.Text = 0.1
|
|
' Else
|
|
' txb_prod_power.Text = 0
|
|
' End If
|
|
|
|
' Maximum_Data.td_serial = text_serial
|
|
' Maximum_Data.td_freq = info_select(info_data.pv_freq)
|
|
' Maximum_Data.td_power = txb_prod_power.Text * 100
|
|
|
|
' txb_prod_state.Text = "TD 정보등록"
|
|
' txb_prod_state.BackColor = Color.Green
|
|
|
|
' If Maximum_Data.td_serial <> "" And Maximum_Data.prod_serial <> "" Then
|
|
|
|
' txb_prod_state.Text = "제품 연결 대기.."
|
|
' txb_prod_state.BackColor = Color.Orange
|
|
|
|
' TH_thread = New Thread(AddressOf thread_func)
|
|
' TH_thread.IsBackground = True
|
|
' TH_thread.Start()
|
|
' thread_type = True
|
|
' End If
|
|
|
|
' Else
|
|
' txb_prod_state.Text = "TD 정보실패"
|
|
' txb_prod_state.BackColor = Color.Red
|
|
' MsgBox("데이터베이스에 해당 데이터가 존재하지 않습니다.", vbCritical)
|
|
' End If
|
|
' ElseIf text_serial.Length = prod_text_count Then
|
|
|
|
' txb_prod_serial.Text = text_serial
|
|
' txb_prod_serial.BackColor = Color.Green
|
|
|
|
' Maximum_Data.prod_code = Mid(text_serial, 1, 2)
|
|
' Maximum_Data.prod_serial = Mid(text_serial, 3, text_serial.Length)
|
|
|
|
' txb_prod_state.Text = "제품 정보등록"
|
|
' txb_prod_state.BackColor = Color.Green
|
|
|
|
' If Maximum_Data.td_serial <> "" And Maximum_Data.prod_serial <> "" Then
|
|
|
|
' txb_prod_state.Text = "제품 연결 대기.."
|
|
' txb_prod_state.BackColor = Color.Orange
|
|
|
|
' TH_thread = New Thread(AddressOf thread_func)
|
|
' TH_thread.IsBackground = True
|
|
' TH_thread.Start()
|
|
' thread_type = True
|
|
' End If
|
|
|
|
' Else
|
|
' txb_prod_state.Text = "잘못된 번호입력"
|
|
' txb_prod_state.BackColor = Color.Red
|
|
' MsgBox("잘못된 시리얼 번호를 입력하였습니다. 다시 확인하여 주십시오.", vbCritical)
|
|
' End If
|
|
' Else
|
|
' 'If data_reset() Then
|
|
|
|
' If output_code = txb_output_6850.Text Then
|
|
' Maximum_Data.td_step = 21
|
|
' Maximum_Data.td_freq = 6850
|
|
' Maximum_Data.td_power = 0
|
|
' ElseIf output_code = txb_output_7000.Text Then
|
|
' Maximum_Data.td_step = 22
|
|
' Maximum_Data.td_freq = 7000
|
|
' Maximum_Data.td_power = 0
|
|
' Else
|
|
' Maximum_Data.td_step = 23
|
|
' End If
|
|
|
|
' If prod_reg_data("jomt", Maximum_Data.prod_serial, txb_code_front.Text, "82", "0") Then
|
|
' If td_reg_data(Maximum_Data.td_serial) Then
|
|
' If sett_reg(Maximum_Data.td_freq, Maximum_Data.td_power) Then
|
|
' If db_data_reg() Then
|
|
' txb_td_serial.BackColor = Color.Green
|
|
' txb_prod_serial.BackColor = Color.Green
|
|
' txb_prod_state.Text = "정보입력 완료"
|
|
' txb_prod_state.BackColor = Color.Green
|
|
|
|
' thr_vari_reset()
|
|
' reset_box()
|
|
|
|
' txb_serial_num.Focus()
|
|
' Else
|
|
' txb_td_serial.BackColor = Color.Red
|
|
' txb_prod_serial.BackColor = Color.Red
|
|
' txb_prod_state.Text = "정보입력 실패"
|
|
' txb_prod_state.BackColor = Color.Red
|
|
' MsgBox("정보 입력은 완료되었으나 데이터베이스에 등록하지 못하였습니다. 다시 시도하여 주십시오.", vbExclamation)
|
|
' InputTimer.Enabled = False
|
|
' End If
|
|
' Else
|
|
' fail_data()
|
|
' InputTimer.Enabled = False
|
|
' End If
|
|
' Else
|
|
' fail_data()
|
|
' InputTimer.Enabled = False
|
|
' End If
|
|
' Else
|
|
' fail_data()
|
|
' InputTimer.Enabled = False
|
|
' End If
|
|
' 'Else
|
|
' ' fail_data()
|
|
' ' InputTimer.Enabled = False
|
|
' 'End If
|
|
|
|
' End If
|
|
|
|
'End Sub
|
|
|
|
Private Sub fail_data(txtBox As TextBox)
|
|
txb_td_serial.BackColor = Color.Red
|
|
txtBox.BackColor = Color.Red
|
|
txb_prod_state.Text = "정보입력 실패"
|
|
txb_prod_state.BackColor = Color.Red
|
|
MsgBox("제품과의 연결이 올바르지 않습니다. 연결 상태를 확인하여 주십시오.", vbCritical)
|
|
End Sub
|
|
|
|
Private Function data_reset() As Boolean
|
|
Dim retval As String
|
|
|
|
tmpCmdMessage = "resetinf"
|
|
cmdMessage = "[" & tmpCmdMessage & "]" + vbCrLf
|
|
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retval = PollingReceiveData(1500)
|
|
|
|
If retval <> "ok" Then
|
|
Return False
|
|
End If
|
|
|
|
Return True
|
|
End Function
|
|
|
|
Private Function td_reg_data(td_reg_serial As String) As Boolean
|
|
Dim retval As String
|
|
tmpCmdMessage = "settdsn"
|
|
cmdMessage = "[" & tmpCmdMessage & " " & td_reg_serial & "]" + vbCrLf
|
|
CsvRegData = CsvRegData & cmdMessage.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retval = PollingReceiveData(1500)
|
|
CsvRegData = CsvRegData & retval.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
|
|
If retval <> td_reg_serial.ToLower Then
|
|
Return False
|
|
End If
|
|
|
|
Return True
|
|
|
|
End Function
|
|
|
|
Private Function prod_reg_data(factory As String, prod_serial As String, prod_code As String, area As String, abroad As String) As Boolean
|
|
Dim retVal As String
|
|
tmpCmdMessage = "wrsconf1"
|
|
cmdMessage = "[" & tmpCmdMessage & " " & factory & "," & prod_serial & "," & prod_code & "," & area & "," & abroad & "]" + vbCrLf
|
|
CsvRegData = CsvRegData & cmdMessage.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
If SendData(cmdMessage) Then
|
|
Return False
|
|
End If
|
|
|
|
retVal = PollingReceiveData(2000)
|
|
CsvRegData = CsvRegData & retVal.Replace(",", "/").Replace(vbCrLf, "") & ","
|
|
|
|
If retVal <> factory.ToLower & "," & prod_serial & "," & prod_code & "," & area & "," & abroad Then
|
|
Return False
|
|
End If
|
|
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub reset_box()
|
|
txb_td_serial.Text = "대기"
|
|
txb_td_serial.BackColor = DefaultBackColor
|
|
txb_prod_Depth.Text = "대기"
|
|
txb_prod_Depth.BackColor = DefaultBackColor
|
|
txb_prod_grade.Text = "대기"
|
|
txb_prod_grade.BackColor = DefaultBackColor
|
|
txb_prod_power.Text = "대기"
|
|
txb_prod_power.BackColor = DefaultBackColor
|
|
txbStCheck.Text = "대기"
|
|
txbStCheck.BackColor = DefaultBackColor
|
|
txbNdCheck.Text = "대기"
|
|
txbNdCheck.BackColor = DefaultBackColor
|
|
txbRdCheck.Text = "대기"
|
|
txbRdCheck.BackColor = DefaultBackColor
|
|
End Sub
|
|
|
|
Private Sub btn_reset_Click(sender As Object, e As EventArgs) Handles btn_reset.Click
|
|
two_text_box()
|
|
two_text_refresh()
|
|
two_text_color()
|
|
two_btn_refresh()
|
|
thr_vari_reset()
|
|
|
|
txb_serial_num.Focus()
|
|
End Sub
|
|
|
|
Private Sub txb_serial_num_TextChanged(sender As Object, e As EventArgs) Handles txb_serial_num.TextChanged
|
|
Dim tmpStr As String
|
|
|
|
If InputCnt = 0 And chbUseBarcode.Checked = True Then
|
|
tmpStr = txb_serial_num.Text
|
|
If (Len(tmpStr) > 1) Then
|
|
tmpStr = Mid(tmpStr, Len(tmpStr), 1)
|
|
txb_serial_num.Clear()
|
|
txb_serial_num.AppendText(tmpStr)
|
|
End If
|
|
SetInputCnt()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub txb_serial_num_Click(sender As Object, e As EventArgs) Handles txb_serial_num.Click
|
|
txb_serial_num.Text = ""
|
|
End Sub
|
|
|
|
Private Function db_data_reg() As Boolean
|
|
Dim p_date, p_time As String
|
|
|
|
p_date = DateTime.Now.ToString("yyyy-MM-dd")
|
|
p_time = DateTime.Now.ToString("HH:mm:ss")
|
|
|
|
DBCmd = "UPDATE " & cartridge_table & " SET TestStep = '" & Maximum_Data.td_step & "', Ct_Manufacture_Name = 'JOMT', Ct_Manufacture_Year = '" & Format(Now, "yy") & "', Ct_Manufacture_Month = '" & Format(Now, "MM") & "', Ct_Model = 'MAXIMUM', Ct_Type = 'SET', Ct_Abroad = '82', Ct_Agency = '0' , Ct_Frequency = '" & Maximum_Data.td_freq & "', Ct_Power = '" & Maximum_Data.td_power & "', Ct_Motor_Lv = '" & Maximum_Data.td_Depth & "' , P1_Date = '" & p_date & "', P1_Time = '" & p_time & "', P1_Model = 'MAXIMUM',P1_CartType = 'SET', P1_Frequency = '" & Maximum_Data.td_freq & "' WHERE PV_SN = '" & Maximum_Data.td_serial & "'"
|
|
If DBCommand(DBCmd) Then
|
|
|
|
DBCmd = "SELECT TestStep FROM " & cartridge_table & " WHERE PV_SN = '" & Maximum_Data.td_serial & "' "
|
|
If Maximum_Data.td_step = DBQueryScalar(DBCmd) Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End If
|
|
|
|
Return False
|
|
End Function
|
|
|
|
Private Sub btn_info_write_Click(sender As Object, e As EventArgs) Handles btn_info_write.Click
|
|
Dim tmpStrSN, fir_serial, sec_serial, area_code, abr_code, td_name As String
|
|
Dim i As Int16
|
|
Dim stageCnt As Integer
|
|
Dim db_reg_swt As Boolean = False
|
|
|
|
Try
|
|
|
|
If txbFactory.Text = "" Then txbFactory.Text = "jomt"
|
|
|
|
If txbFactory.Text = "" Or nudSN.Text = "" Or nudYear.Text = "" Or nudMonth.Text = "" Then
|
|
stageCnt = 0
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txbInfoBox.Visible = True
|
|
txbInfoBox.Text = "RUNNING"
|
|
txbInfoBox.BackColor = Color.GreenYellow
|
|
txbInfoBox.Refresh()
|
|
|
|
If ManagerTDUse = True Then
|
|
If rdbV1.Checked = False And rdbV2.Checked = False Then
|
|
stageCnt = 0
|
|
MsgBox("타입을 설정하지 않으셨습니다.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
End If
|
|
|
|
td_name = td_name_load()
|
|
|
|
If ckb_db_use.Checked = True And td_name = "1" Or td_name = "0" Then
|
|
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호를 등록하지 않았습니다." & vbCrLf & "TD 시리얼 번호를 먼저 입력하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
|
|
Else
|
|
|
|
If ckb_db_use.Checked = True And td_Serial_db(td_name) = 0 Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호가 데이터베이스에 존재하지 않습니다." & vbCrLf & " TD 시리얼 번호를 확인하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
i = Len(nudSN.Text)
|
|
tmpStrSN = nudSN.Text
|
|
|
|
If tmpStrSN = "0" Then
|
|
db_reg_swt = True
|
|
End If
|
|
|
|
For cnt = i To 5
|
|
tmpStrSN = "0" + tmpStrSN
|
|
Next cnt
|
|
|
|
fir_serial = Mid(tmpStrSN, 1, 3)
|
|
sec_serial = Mid(tmpStrSN, 4, 6)
|
|
|
|
Dim ModeSet As String
|
|
If rdbV1.Checked = True Then
|
|
ModeSet = "0"
|
|
Else
|
|
ModeSet = "1"
|
|
End If
|
|
ModeSet = "3" & ModeSet
|
|
|
|
If Len(nudMonth.Text) = 2 Then
|
|
tmpStrSN = nudYear.Text & nudMonth.Text & tmpStrSN
|
|
txbBarcode.Text = ModeSet & nudYear.Text & nudMonth.Text & sec_serial & fir_serial
|
|
ElseIf Len(nudMonth.Text) = 1 Then
|
|
tmpStrSN = nudYear.Text & "0" & nudMonth.Text & tmpStrSN
|
|
txbBarcode.Text = ModeSet & nudYear.Text & "0" & nudMonth.Text & sec_serial & fir_serial
|
|
Else
|
|
stageCnt = 2
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If ckb_db_use.Checked = True Then
|
|
If prod_info_dup_check(txbBarcode.Text, td_name) Then
|
|
MsgBox("데이터베이스에 같은 제품 시리얼 번호가 존재합니다.", vbCritical)
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
End If
|
|
End If
|
|
|
|
area_code = read_info()
|
|
|
|
If area_code <> "0" Then
|
|
abr_code = Mid(area_code, InStrRev(area_code, ",", area_code.Length) + 1, area_code.Length)
|
|
area_code = Mid(area_code, 1, InStrRev(area_code, ",", area_code.Length) - 1)
|
|
area_code = Mid(area_code, InStrRev(area_code, ",", area_code.Length) + 1, area_code.Length)
|
|
Else
|
|
area_code = "82"
|
|
abr_code = "0"
|
|
End If
|
|
|
|
If prod_reg_data(txbFactory.Text, tmpStrSN, ModeSet, area_code, abr_code) Then
|
|
|
|
If db_reg_swt = True Then
|
|
|
|
If prod_db_delete(td_name) Then
|
|
txbInfoBox.Text = "SUCCESS"
|
|
txbInfoBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
Else
|
|
stageCnt = 6
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Else
|
|
|
|
If prod_serial_db(txbBarcode.Text, txbFactory.Text, nudYear.Text, nudMonth.Text, nudSN.Text, td_name) Then
|
|
txbInfoBox.Text = "SUCCESS"
|
|
txbInfoBox.BackColor = Color.Green
|
|
GoTo SuccessExit
|
|
|
|
Else
|
|
stageCnt = 5
|
|
GoTo FailExit
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
stageCnt = 4
|
|
GoTo FailExit
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 7
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbInfoBox.Text = "Timeout" + Str(stageCnt)
|
|
txbInfoBox.BackColor = Color.Red
|
|
|
|
SuccessExit:
|
|
txbInfoBox.Refresh()
|
|
End Sub
|
|
|
|
Private Function prod_dup_check(prod_id As String) As Int16
|
|
Dim prod_count As Int16
|
|
DBCmd = "SELECT COUNT(Product_SN) FROM " & cartridge_table & " WHERE Product_SN = '" & prod_id & "'"
|
|
|
|
prod_count = DBQueryScalar(DBCmd)
|
|
|
|
If prod_count = 0 Then
|
|
Return False
|
|
End If
|
|
|
|
Return True
|
|
End Function
|
|
|
|
Private Function prod_info_dup_check(prod_id As String, td_serial As String) As Int16
|
|
Dim prod_count As Int16
|
|
Dim td_sn As String
|
|
Dim UseData As String
|
|
|
|
If ManagerTDUse = True Then
|
|
UseData = cartridge_table
|
|
Else
|
|
UseData = NonCartridge_table
|
|
End If
|
|
|
|
DBCmd = "SELECT COUNT(Product_SN), PV_SN FROM " & UseData & " WHERE Product_SN = '" & prod_id & "'"
|
|
|
|
If DBQueryReader(DBCmd) Then
|
|
prod_count = sqlDataQuery(0)
|
|
td_sn = sqlDataQuery(1)
|
|
Else
|
|
Return True
|
|
End If
|
|
|
|
If td_sn <> td_serial.ToUpper And prod_count > 0 Then
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
End Function
|
|
|
|
Private Function prod_serial_db(prod_seiral_data As String, factory_code As String, make_year As String, make_month As String, sn_code As String, td_Serial As String) As Boolean
|
|
If ckb_db_use.Checked = True Then
|
|
DBCmd = "UPDATE " & cartridge_table & " SET Product_SN = '" & prod_seiral_data & "', Ct_Manufacture_Name = '" & factory_code.ToUpper & "', Ct_Manufacture_Year = '" & make_year & "', Ct_Manufacture_Month = '" & make_month & "', Ct_SN = '" & sn_code & "', Ct_Model = 'MAXIMUM', Ct_Type = 'SET', Ct_Remain_ShotCnt = 0 WHERE PV_SN = '" & td_Serial & "'"
|
|
If DBCommand(DBCmd) Then
|
|
Return True
|
|
End If
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Function prod_db_delete(prod_serial_data As String) As Boolean
|
|
|
|
If ckb_db_use.Checked = True Then
|
|
DBCmd = "UPDATE " & cartridge_table & " SET TestStep = '23', Product_SN=NULL, Ct_Manufacture_Name=NULL, Ct_Manufacture_Year = NULL, Ct_Manufacture_Month = NULL, Ct_SN = NULL, Ct_Abroad = NULL, Ct_Agency = NULL WHERE PV_SN = '" & prod_serial_data & "'"
|
|
If DBCommand(DBCmd) Then
|
|
Return True
|
|
End If
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
Private Sub btn_info_read_Click(sender As Object, e As EventArgs) Handles btn_info_read.Click
|
|
Dim data_serial, make_code, year, month, full_serial As String
|
|
Dim stageCnt As Int16
|
|
|
|
Try
|
|
txbInfoBox.Visible = True
|
|
txbInfoBox.Text = "RUNNING"
|
|
txbInfoBox.BackColor = Color.GreenYellow
|
|
txbInfoBox.Refresh()
|
|
|
|
data_serial = read_info()
|
|
|
|
If data_serial = "0" Then
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
|
|
Else
|
|
make_code = Mid(data_serial, 1, InStr(1, data_serial, ",") - 1)
|
|
full_serial = Mid(data_serial, InStr(1, data_serial, ",") + 1, data_serial.Length)
|
|
data_serial = Mid(full_serial, 1, InStr(1, full_serial, ",") - 1)
|
|
full_serial = Mid(full_serial, InStr(1, full_serial, ",") + 1, full_serial.Length)
|
|
full_serial = Mid(full_serial, 1, InStr(1, full_serial, ",") - 1)
|
|
|
|
year = Mid(data_serial, 1, 2)
|
|
data_serial = Mid(data_serial, 3, data_serial.Length)
|
|
month = Mid(data_serial, 1, 2)
|
|
data_serial = Mid(data_serial, 3, data_serial.Length)
|
|
|
|
If ckbNonTD.Checked = True Then
|
|
Dim ModeSet As String = Mid(full_serial, 2, 1)
|
|
|
|
If ModeSet = "0" Then
|
|
rdbV1.Checked = True
|
|
rdbV2.Checked = False
|
|
Else
|
|
rdbV1.Checked = False
|
|
rdbV2.Checked = True
|
|
End If
|
|
|
|
Else
|
|
rdbV1.Checked = False
|
|
rdbV2.Checked = False
|
|
|
|
End If
|
|
|
|
full_serial = full_serial & year & month & Mid(data_serial, 4, 3) & Mid(data_serial, 1, 3)
|
|
|
|
data_serial = data_serial
|
|
|
|
txbBarcode.Text = full_serial
|
|
txbFactory.Text = make_code
|
|
nudYear.Text = year
|
|
nudMonth.Text = month
|
|
nudSN.Text = data_serial
|
|
|
|
End If
|
|
|
|
GoTo SuccessExit
|
|
|
|
Catch ex As Exception
|
|
txbBarcode.Text = Nothing
|
|
txbFactory.Text = Nothing
|
|
nudSN.Text = Nothing
|
|
nudYear.Text = Nothing
|
|
nudMonth.Text = Nothing
|
|
stageCnt = 1
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txbInfoBox.Text = "Timeout" + Str(stageCnt)
|
|
txbInfoBox.BackColor = Color.Red
|
|
txbInfoBox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txbInfoBox.Text = "SUCCESS"
|
|
txbInfoBox.BackColor = Color.Green
|
|
txbInfoBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub btn_area_write_Click(sender As Object, e As EventArgs) Handles btn_area_write.Click
|
|
Dim data_list, make_code, data_serial, full_serial, td_name As String
|
|
Dim stageCnt As Int16
|
|
Try
|
|
|
|
If txb_area_code.Text = "" Or txb_abr_code.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.", vbExclamation)
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txb_areabox.Visible = True
|
|
txb_areabox.Text = "RUNNING"
|
|
txb_areabox.BackColor = Color.GreenYellow
|
|
txb_areabox.Refresh()
|
|
|
|
td_name = td_name_load()
|
|
|
|
If ckb_db_use.Checked = True And td_name = "1" Or td_name = "0" Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호를 등록하지 않았습니다." & vbCrLf & "TD 시리얼 번호를 먼저 입력하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If ckb_db_use.Checked = True And td_Serial_db(td_name) = 0 Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호가 데이터베이스에 존재하지 않습니다." & vbCrLf & " TD 시리얼 번호를 확인하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
data_list = read_info()
|
|
|
|
If data_list <> "0" Then
|
|
|
|
make_code = Mid(data_list, 1, InStr(1, data_list, ",") - 1)
|
|
|
|
If make_code = "" Then
|
|
MsgBox("제품 시리얼 번호를 등록하지 않았습니다." & vbCrLf & "시리얼 번호를 먼저 등록하여 주십시오.", vbExclamation)
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
|
|
Else
|
|
|
|
full_serial = Mid(data_list, InStr(1, data_list, ",") + 1, data_list.Length)
|
|
data_serial = Mid(full_serial, 1, InStr(1, full_serial, ",") - 1)
|
|
full_serial = Mid(full_serial, InStr(1, full_serial, ",") + 1, full_serial.Length)
|
|
full_serial = Mid(full_serial, 1, InStr(1, full_serial, ",") - 1)
|
|
|
|
If prod_reg_data(make_code, data_serial, full_serial, txb_area_code.Text, txb_abr_code.Text) Then
|
|
If area_num_db(txb_area_code.Text, txb_abr_code.Text, td_name) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
stageCnt = 5
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
stageCnt = 4
|
|
GoTo FailExit
|
|
End If
|
|
End If
|
|
Else
|
|
stageCnt = 2
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 6
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
|
|
txb_areabox.Text = "Timeout" + Str(stageCnt)
|
|
txb_areabox.BackColor = Color.Red
|
|
txb_areabox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_areabox.Text = "SUCCESS"
|
|
txb_areabox.BackColor = Color.Green
|
|
txb_areabox.Refresh()
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Function area_num_db(area_num As String, abr_num As String, td_serial As String) As Boolean
|
|
|
|
If ckb_db_use.Checked = True Then
|
|
DBCmd = "UPDATE " & cartridge_table & " SET Ct_Abroad = ' " & area_num & " ' , Ct_Agency = '" & abr_num & "' WHERE PV_SN = '" & td_serial & "'"
|
|
If DBCommand(DBCmd) Then
|
|
Return True
|
|
End If
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Sub btn_area_read_Click(sender As Object, e As EventArgs) Handles btn_area_read.Click
|
|
Dim data_list, make_code, abr_code As String
|
|
Dim stageCnt As Int16
|
|
Try
|
|
|
|
txb_areabox.Visible = True
|
|
txb_areabox.Text = "RUNNING"
|
|
txb_areabox.BackColor = Color.GreenYellow
|
|
txb_areabox.Refresh()
|
|
|
|
data_list = read_info()
|
|
|
|
If data_list <> "0" Then
|
|
|
|
make_code = Mid(data_list, 1, InStr(1, data_list, ",") - 1)
|
|
|
|
If make_code = "" Then
|
|
MsgBox("제품 시리얼 번호를 등록하지 않았습니다." & vbCrLf & "시리얼 번호를 먼저 등록하여 주십시오.", vbExclamation)
|
|
stageCnt = 2
|
|
GoTo FailExit
|
|
Else
|
|
abr_code = Mid(data_list, InStrRev(data_list, ",", data_list.Length) + 1, data_list.Length)
|
|
data_list = Mid(data_list, 1, InStrRev(data_list, ",", data_list.Length) - 1)
|
|
data_list = Mid(data_list, InStrRev(data_list, ",", data_list.Length) + 1, data_list.Length)
|
|
|
|
txb_area_code.Text = data_list
|
|
txb_abr_code.Text = abr_code
|
|
|
|
GoTo SuccessExit
|
|
End If
|
|
|
|
Else
|
|
stageCnt = 1
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
|
|
txb_areabox.Text = "Timeout" + Str(stageCnt)
|
|
txb_areabox.BackColor = Color.Red
|
|
txb_areabox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_areabox.Text = "SUCCESS"
|
|
txb_areabox.BackColor = Color.Green
|
|
txb_areabox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub btn_today_Click(sender As Object, e As EventArgs) Handles btn_today.Click
|
|
nudYear.Text = Format(Now, "yy")
|
|
nudMonth.Text = Format(Now, "MM")
|
|
End Sub
|
|
|
|
Private Function check_prod_code() As String
|
|
Dim prod_code As String
|
|
|
|
prod_code = read_info()
|
|
|
|
If prod_code = "0" Then
|
|
Return "0"
|
|
End If
|
|
|
|
prod_code = Mid(prod_code, InStr(1, prod_code, ",") + 1, prod_code.Length)
|
|
prod_code = Mid(prod_code, 1, InStr(1, prod_code, ",") - 1)
|
|
|
|
Return prod_code
|
|
|
|
End Function
|
|
|
|
Private Sub btn_td_write_Click(sender As Object, e As EventArgs) Handles btn_td_write.Click
|
|
Dim freq As Int16
|
|
Dim power As Single
|
|
Dim stageCnt As Int16
|
|
Dim serial_num As String
|
|
|
|
Try
|
|
txb_tdBox.Visible = True
|
|
txb_tdBox.Text = "RUNNING"
|
|
txb_tdBox.BackColor = Color.GreenYellow
|
|
txb_tdBox.Refresh()
|
|
|
|
If ManagerTDUse = True Then
|
|
|
|
If txb_tds.Text = "" Or txb_tdf.Text = "" Or txb_tdp.Text = "" Or txb_tds.Text.Length <> td_name_size Or txb_tdf.Text.Length <> td_freq_size Then
|
|
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.", vbExclamation)
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
|
|
Else
|
|
|
|
If check_prod_code() = "0" Then
|
|
serial_num = Format(Now, "yy") & Format(Now, "MM") & "000000"
|
|
If prod_reg_data("jomt", serial_num, "30", "82", "0") = False Then
|
|
stageCnt = 1
|
|
GoTo FailExit
|
|
End If
|
|
End If
|
|
|
|
If td_Serial_db(txb_tds.Text) Then
|
|
freq = freq_data(txb_tdf.Text)
|
|
power = power_data(txb_tdp.Text)
|
|
|
|
If freq = 0 Or power = 100 Then
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
stageCnt = 2
|
|
MsgBox("TD 시리얼 번호가 데이터베이스에 존재하지 않습니다." & vbCrLf & " TD 시리얼 번호를 확인하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
End If
|
|
|
|
If sett_reg(freq, power) Then
|
|
|
|
If td_reg_data(txb_tds.Text) Then
|
|
|
|
If td_serial_update(freq, power, txb_tds.Text) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
stageCnt = 6
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
stageCnt = 5
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Else
|
|
stageCnt = 4
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Else
|
|
|
|
If txb_tds.Text = "" Or txb_tds.Text.Length <> td_name_size Then
|
|
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.", vbExclamation)
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
|
|
Else
|
|
|
|
If check_prod_code() = "0" Then
|
|
serial_num = Format(Now, "yy") & Format(Now, "MM") & "000000"
|
|
If prod_reg_data("jomt", serial_num, "30", "82", "0") = False Then
|
|
stageCnt = 1
|
|
GoTo FailExit
|
|
End If
|
|
End If
|
|
|
|
If td_Serial_db(txb_tds.Text) Then
|
|
If td_reg_data(txb_tds.Text) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
stageCnt = 5
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
stageCnt = 2
|
|
MsgBox("TD 시리얼 번호가 데이터베이스에 존재하지 않습니다." & vbCrLf & " TD 시리얼 번호를 확인하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 7
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
|
|
txb_tdBox.Text = "Timeout" + Str(stageCnt)
|
|
txb_tdBox.BackColor = Color.Red
|
|
txb_tdBox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_tdBox.Text = "SUCCESS"
|
|
txb_tdBox.BackColor = Color.Green
|
|
txb_tdBox.Refresh()
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Function td_serial_update(freq As String, power As String, td_serial As String) As Boolean
|
|
|
|
If ckb_db_use.Checked = True Then
|
|
|
|
DBCmd = "UPDATE " & cartridge_table & " SET Ct_Frequency = '" & freq & "' , Ct_Power = '" & power & "' WHERE PV_SN = '" & td_serial & "'"
|
|
|
|
If DBCommand(DBCmd) Then
|
|
DBCmd = "SELECT Ct_Frequency,Ct_Power FROM " & cartridge_table & " WHERE PV_SN = '" & td_serial & "'"
|
|
If DBQueryReader(DBCmd) Then
|
|
If sqlDataQuery.Length = 2 Then
|
|
If sqlDataQuery(0) = freq And sqlDataQuery(1) = power Then
|
|
Return True
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
|
|
End Function
|
|
|
|
Private Function td_Serial_db(td_serial As String) As Int16
|
|
Dim sn_count As Int16
|
|
Dim UseDB As String
|
|
If ManagerTDUse = True Then
|
|
UseDB = cartridge_table
|
|
Else
|
|
UseDB = NonCartridge_table
|
|
End If
|
|
|
|
If ckb_db_use.Checked = True Then
|
|
DBCmd = "SELECT count(PV_SN) FROM " & UseDB & " WHERE PV_SN = '" & td_serial & "'"
|
|
|
|
sn_count = DBQueryScalar(DBCmd)
|
|
|
|
Return sn_count
|
|
|
|
Else
|
|
Return 1
|
|
End If
|
|
|
|
|
|
End Function
|
|
|
|
Private Sub btn_td_read_Click(sender As Object, e As EventArgs) Handles btn_td_read.Click
|
|
Dim td_name, freq, power As String
|
|
Dim stageCnt As Int16
|
|
Try
|
|
txb_tdBox.Visible = True
|
|
txb_tdBox.Text = "RUNNING"
|
|
txb_tdBox.BackColor = Color.GreenYellow
|
|
txb_tdBox.Refresh()
|
|
|
|
td_name = td_name_load()
|
|
|
|
If td_name = "1" Then
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
|
|
Else
|
|
|
|
If ckbNonTD.Checked = True Then
|
|
freq = sett_data()
|
|
|
|
If freq = "0" Then
|
|
stageCnt = 2
|
|
GoTo FailExit
|
|
|
|
Else
|
|
power = Mid(freq, InStrRev(freq, ",", freq.Length) + 1, freq.Length) / 100
|
|
freq = Mid(freq, 1, InStr(1, freq, ",") - 1)
|
|
|
|
txb_tds.Text = td_name
|
|
txb_tdf.Text = freq
|
|
txb_tdp.Text = power
|
|
|
|
GoTo SuccessExit
|
|
|
|
End If
|
|
Else
|
|
|
|
txb_tds.Text = td_name
|
|
txb_tdf.Text = "0"
|
|
txb_tdp.Text = "0"
|
|
|
|
GoTo SuccessExit
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txb_tdBox.Text = "Timeout" + Str(stageCnt)
|
|
txb_tdBox.BackColor = Color.Red
|
|
txb_tdBox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_tdBox.Text = "SUCCESS"
|
|
txb_tdBox.BackColor = Color.Green
|
|
txb_tdBox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub btn_shot_write_Click(sender As Object, e As EventArgs) Handles btn_shot_write.Click
|
|
Dim td_name As String
|
|
Dim stageCnt As Int16
|
|
Try
|
|
If nud_shot.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.", vbExclamation)
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txb_shotbox.Visible = True
|
|
txb_shotbox.Text = "RUNNING"
|
|
txb_shotbox.BackColor = Color.GreenYellow
|
|
txb_shotbox.Refresh()
|
|
|
|
td_name = td_name_load()
|
|
|
|
If ckb_db_use.Checked = True And td_name = "1" Or td_name = "0" Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호를 등록하지 않았습니다." & vbCrLf & "TD 시리얼 번호를 먼저 입력하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If ckb_db_use.Checked = True And td_Serial_db(td_name) = 0 Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호가 데이터베이스에 존재하지 않습니다." & vbCrLf & " TD 시리얼 번호를 확인하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If shot_reg(nud_shot.Text) Then
|
|
If shot_data_db(nud_shot.Text, td_name) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Else
|
|
stageCnt = 2
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 4
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txb_shotbox.Text = "Timeout" + Str(stageCnt)
|
|
txb_shotbox.BackColor = Color.Red
|
|
txb_shotbox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_shotbox.Text = "SUCCESS"
|
|
txb_shotbox.BackColor = Color.Green
|
|
txb_shotbox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Function shot_data_db(shot_num As String, td_serial As String)
|
|
|
|
If ckb_db_use.Checked = True Then
|
|
DBCmd = "UPDATE " & cartridge_table & " SET Ct_Max_ShotCnt = '" & shot_num & "' WHERE PV_SN = '" & td_serial & "'"
|
|
If DBCommand(DBCmd) Then
|
|
Return True
|
|
End If
|
|
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Sub btn_shot_read_Click(sender As Object, e As EventArgs) Handles btn_shot_read.Click
|
|
Dim shot As Integer
|
|
Dim stageCnt As Int16
|
|
Try
|
|
txb_shotbox.Visible = True
|
|
txb_shotbox.Text = "RUNNING"
|
|
txb_shotbox.BackColor = Color.GreenYellow
|
|
txb_shotbox.Refresh()
|
|
|
|
shot = shot_search()
|
|
|
|
If shot = "-1" Then
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
End If
|
|
|
|
nud_shot.Text = shot
|
|
GoTo SuccessExit
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 1
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
|
|
txb_shotbox.Text = "Timeout" + Str(stageCnt)
|
|
txb_shotbox.BackColor = Color.Red
|
|
txb_shotbox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_shotbox.Text = "SUCCESS"
|
|
txb_shotbox.BackColor = Color.Green
|
|
txb_shotbox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub btn_flashreset_Click(sender As Object, e As EventArgs) Handles btn_flashreset.Click
|
|
Dim td_name As String
|
|
Dim oksign, stageCnt As Int16
|
|
|
|
Try
|
|
|
|
txb_resetbox.Visible = True
|
|
txb_resetbox.Text = "RUNNING"
|
|
txb_resetbox.BackColor = Color.GreenYellow
|
|
txb_resetbox.Refresh()
|
|
|
|
oksign = MsgBox("플래쉬 데이터를 초기화 진행합니다. 진행하시겠습니까?", vbOKCancel + vbExclamation)
|
|
|
|
If oksign = 1 Then
|
|
|
|
td_name = td_name_load()
|
|
|
|
If td_name = "1" Or td_name = "0" Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호를 등록하지 않았습니다." & vbCrLf & "TD 시리얼 번호를 먼저 입력하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If data_reset() Then
|
|
If reset_db_update(td_name) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
stageCnt = 2
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 4
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
|
|
txb_resetbox.Text = "Timeout" + Str(stageCnt)
|
|
txb_resetbox.BackColor = Color.Red
|
|
txb_resetbox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_resetbox.Text = "SUCCESS"
|
|
txb_resetbox.BackColor = Color.Green
|
|
txb_resetbox.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Function reset_db_update(td_serial As String) As Boolean
|
|
DBCmd = "UPDATE " & cartridge_table & " SET Product_SN = '', Ct_Manufacture_Name = '', Ct_Manufacture_Year = NULL, Ct_Manufacture_Month = NULL, Ct_SN = NULL, Ct_Model = '', Ct_Type = '', Ct_Abroad = NULL, Ct_Agency = NULL , Ct_Frequency = NULL, Ct_Power = NULL, Ct_Max_ShotCnt = NULL, Ct_Remain_ShotCnt = NULL WHERE PV_SN = '" & td_serial & "'"
|
|
If DBCommand(DBCmd) Then
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
Private Sub lb_depth_DoubleClick(sender As Object, e As EventArgs)
|
|
MsgBox("Depth 높이 설정 - 샷 레디 후 사용할 것" & vbCrLf & "0-원점, 1-1.5mm, 2-2.0mm, 3-2.5mm," & vbCrLf & "4-3.0mm, 5-3.5mm, 6-4.0mm, 7-4.5mm", vbInformation)
|
|
End Sub
|
|
|
|
Private Sub btn_mtr_write_Click(sender As Object, e As EventArgs) Handles btn_mtr_write.Click
|
|
Dim stageCnt As Int16
|
|
Try
|
|
|
|
If nud_motor.Text = "" Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 채워주세요.", vbExclamation)
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
End If
|
|
|
|
txb_motorBox.Visible = True
|
|
txb_motorBox.Text = "RUNNING"
|
|
txb_motorBox.BackColor = Color.GreenYellow
|
|
txb_motorBox.Refresh()
|
|
|
|
td_name = td_name_load()
|
|
|
|
If ckb_db_use.Checked = True And td_name = "1" Or td_name = "0" Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호를 등록하지 않았습니다." & vbCrLf & "TD 시리얼 번호를 먼저 입력하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If ckb_db_use.Checked = True And td_Serial_db(td_name) = 0 Then
|
|
stageCnt = 1
|
|
MsgBox("TD 시리얼 번호가 데이터베이스에 존재하지 않습니다." & vbCrLf & " TD 시리얼 번호를 확인하여 주십시오.", vbExclamation)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If Motor_reg(nud_motor.Text) Then
|
|
If motor_db_reg(nud_motor.Text, td_name) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
stageCnt = 2
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
stageCnt = 1
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 3
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txb_motorBox.Text = "Timeout" + Str(stageCnt)
|
|
txb_motorBox.BackColor = Color.Red
|
|
txb_motorBox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_motorBox.Text = "SUCCESS"
|
|
txb_motorBox.BackColor = Color.Green
|
|
txb_motorBox.Refresh()
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Function motor_db_reg(motor_lv As Int16, pv_sn As String) As Boolean
|
|
DBCmd = "UPDATE " & cartridge_table & " SET Ct_Motor_Lv = '" & motor_lv & "' WHERE PV_SN = '" & pv_sn & "'"
|
|
If DBCommand(DBCmd) Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End Function
|
|
|
|
Private Sub lb_motor_DoubleClick(sender As Object, e As EventArgs) Handles lb_motor.DoubleClick
|
|
MsgBox("Motor 이동 설정" & vbCrLf & "1280펄스 당 1mm 이동", vbInformation)
|
|
End Sub
|
|
|
|
Private Sub btn_all_read_Click(sender As Object, e As EventArgs) Handles btn_all_read.Click
|
|
btn_td_read_Click(sender, e)
|
|
btn_info_read_Click(sender, e)
|
|
btn_area_read_Click(sender, e)
|
|
btn_shot_read_Click(sender, e)
|
|
nud_motor.Text = "0"
|
|
End Sub
|
|
|
|
Private Sub btn_all_write_Click(sender As Object, e As EventArgs) Handles btn_all_write.Click
|
|
If txbFactory.Text = "" Then txbFactory.Text = "jomt"
|
|
|
|
If txbFactory.Text = "" Or nudSN.Text = "" Or nudYear.Text = "" Or nudMonth.Text = "" Or txb_area_code.Text = "" Or txb_abr_code.Text = "" Or txb_tds.Text = "" Or txb_tdf.Text = "" Or txb_tdp.Text = "" Or txb_tds.Text.Length <> td_name_size Or txb_tdf.Text.Length <> td_freq_size Then
|
|
MsgBox("정보가 부족합니다. 빈칸을 모두 채워주세요.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
btn_td_write_Click(sender, e)
|
|
btn_info_write_Click(sender, e)
|
|
btn_area_write_Click(sender, e)
|
|
btn_shot_write_Click(sender, e)
|
|
|
|
End Sub
|
|
|
|
Private Sub btn_text_reset_Click(sender As Object, e As EventArgs) Handles btn_text_reset.Click
|
|
item_refresh()
|
|
four_text_box()
|
|
four_result_visible()
|
|
four_result_color()
|
|
four_btn_refresh()
|
|
vari_reset()
|
|
End Sub
|
|
|
|
Private Sub btnrun_Click(sender As Object, e As EventArgs) Handles btnrun.Click
|
|
Dim SucCheck As Boolean = False
|
|
Dim text_serial, freq, front_name, back_name, year_month As String
|
|
Dim NowDate As String = Format(Now, "yyyy") & "-" & Format(Now, "MM") & "-" & Format(Now, "dd")
|
|
Dim NowTime As String = Format(Now, "HH") & ":" & Format(Now, "mm") & ":" & Format(Now, "ss")
|
|
|
|
CsvRegData = Nothing
|
|
|
|
If thr_run_switch = True Then
|
|
btnreset_Click(sender, e)
|
|
thr_run_switch = False
|
|
End If
|
|
|
|
text_serial = txb_barcode.Text
|
|
|
|
If txbmake.Text = "대기" Or txbarea.Text = "대기" Or txbagen.Text = "대기" Then
|
|
txbresult.Text = "선택항목 미선택"
|
|
txbresult.BackColor = Color.Red
|
|
MsgBox("선택항목을 선택하지 않았습니다. 선택항목을 선택하여 주십시오.", vbCritical)
|
|
Else
|
|
If Maximum_Data.prod_serial = "" Then
|
|
|
|
If td_data_switch = False Then
|
|
If text_serial.Length = prod_text_count Then
|
|
If prod_dup_check(text_serial) Then
|
|
txbresult.Text = "중복된 번호입력"
|
|
txbresult.BackColor = Color.Red
|
|
If MsgBox("데이터베이스에 중복된 시리얼 번호가 존재합니다. 허나 바코드는 재인쇄가 가능합니다." & vbCrLf & "바코드를 재인쇄 하시겠습니까?", vbExclamation + vbYesNo) = MsgBoxResult.Yes Then
|
|
txbpdnum.Text = text_serial
|
|
thr_run_switch = True
|
|
print_OnOff = True
|
|
|
|
txb_barcode.Focus()
|
|
thr_vari_reset()
|
|
reset_box()
|
|
|
|
txbresult.Text = "인쇄 완료"
|
|
txbresult.BackColor = Color.Green
|
|
End If
|
|
Exit Sub
|
|
End If
|
|
|
|
txbpdnum.Text = text_serial
|
|
txbpdnum.BackColor = Color.Green
|
|
|
|
Maximum_Data.prod_code = Mid(text_serial, 1, 2)
|
|
year_month = Mid(text_serial, 3, 4)
|
|
front_name = Mid(text_serial, 7, 3)
|
|
back_name = Mid(text_serial, 10, 3)
|
|
Maximum_Data.prod_serial = year_month & back_name & front_name
|
|
|
|
txbresult.Text = "제품 연결 대기.."
|
|
txbresult.BackColor = Color.Orange
|
|
TH_thread = New Thread(AddressOf thread_func)
|
|
TH_thread.IsBackground = True
|
|
TH_thread.Start()
|
|
thread_type = True
|
|
|
|
Else
|
|
txbresult.Text = "잘못된 번호입력"
|
|
txbresult.BackColor = Color.Red
|
|
txbpdnum.BackColor = Color.Red
|
|
MsgBox("잘못된 시리얼 번호를 입력하였습니다. 다시 확인하여 주십시오.", vbCritical)
|
|
thr_run_switch = True
|
|
txb_barcode.Focus()
|
|
Exit Sub
|
|
End If
|
|
Else
|
|
MsgBox("초기화 오류 발견")
|
|
thr_run_switch = True
|
|
txb_barcode.Focus()
|
|
End If
|
|
|
|
Else
|
|
|
|
If td_data_switch = False Then
|
|
'Maximum_Data.td_serial = td_name_load()
|
|
|
|
|
|
If Maximum_Data.td_serial = "0" Or Maximum_Data.td_serial = "1" Then
|
|
txbresult.Text = "잘못된 번호입력"
|
|
txbtdnum.BackColor = Color.Red
|
|
txbresult.BackColor = Color.Red
|
|
MsgBox("TD 시리얼 번호를 입력하지 않았습니다. TD 시리얼 번호를 입력하여 주십시오.", vbCritical)
|
|
txb_barcode.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
freq = sett_data()
|
|
|
|
If freq = "0" Then
|
|
txbresult.Text = "연결 문제"
|
|
txbtdnum.BackColor = Color.Red
|
|
txbresult.BackColor = Color.Red
|
|
MsgBox("제품과의 연결이 올바르지 않습니다. 연결 상태를 확인하여 주십시오.", vbCritical)
|
|
td_data_switch = False
|
|
thr_run_switch = True
|
|
txb_barcode.Focus()
|
|
Else
|
|
|
|
Maximum_Data.td_power = Mid(freq, InStr(1, freq, ",") + 1, freq.Length)
|
|
Maximum_Data.td_freq = Mid(freq, 1, InStr(1, freq, ",") - 1)
|
|
|
|
If db_td_data(Maximum_Data.td_serial) Then
|
|
|
|
If Maximum_Data.td_step = 23 Or Maximum_Data.td_step = 27 Or Maximum_Data.td_step = 32 Then
|
|
txbtdnum.Text = Maximum_Data.td_serial
|
|
txbfreq.Text = Maximum_Data.td_freq
|
|
txbpower.Text = Maximum_Data.td_power
|
|
txbgread.Text = Maximum_Data.td_grade
|
|
|
|
If Maximum_Data.td_freq <> "0" Then
|
|
txbresult.Text = "TD 정보등록"
|
|
txbresult.BackColor = Color.Green
|
|
|
|
txbtdnum.BackColor = Color.Green
|
|
td_data_switch = True
|
|
Else
|
|
txbresult.Text = "주파수 없음"
|
|
txbresult.BackColor = Color.Red
|
|
txbfreq.BackColor = Color.Red
|
|
MsgBox("제품에 주파수를 입력하지 않았습니다." & vbCrLf & " 주파수를 입력하여 주십시오.", vbCritical)
|
|
td_data_switch = False
|
|
thr_run_switch = True
|
|
End If
|
|
|
|
txb_barcode.Focus()
|
|
|
|
Else
|
|
txbresult.Text = "공정 진행 오류"
|
|
txbresult.BackColor = Color.Red
|
|
txbtdnum.BackColor = Color.Red
|
|
MsgBox("이전 정보 입력 공정을 진행하지 않았습니다." & vbCrLf & " 이전 단계에서 데이터를 입력하여 주십시오.", vbCritical)
|
|
td_data_switch = False
|
|
thr_run_switch = True
|
|
txb_barcode.Focus()
|
|
End If
|
|
|
|
Else
|
|
txbresult.Text = "잘못된 데이터 존재"
|
|
txbresult.BackColor = Color.Red
|
|
txbtdnum.BackColor = Color.Red
|
|
MsgBox("데이터베이스에 데이터가 존재하지 않습니다." & vbCrLf & " 이전 단계에서 데이터를 입력하여 주십시오.", vbCritical)
|
|
td_data_switch = False
|
|
thr_run_switch = True
|
|
txb_barcode.Focus()
|
|
End If
|
|
|
|
End If
|
|
|
|
Else
|
|
If prod_reg_data(txbmake.Text, Maximum_Data.prod_serial, txb_code_front.Text, txbarea.Text, txbagen.Text) Then
|
|
If shot_reg(0) = True Then
|
|
If shot_search() = 0 Then
|
|
If db_prod_reg(txbpdnum.Text, txbmake.Text, txbarea.Text, txbagen.Text, Maximum_Data.td_serial, 0) Then
|
|
|
|
For i = 1 To ShotCheck
|
|
If shot_search() = 0 Then
|
|
SucCheck = True
|
|
Else
|
|
SucCheck = False
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
If SucCheck = True Then
|
|
txbtdnum.BackColor = Color.Green
|
|
txbpdnum.BackColor = Color.Green
|
|
txbresult.Text = "정보입력 완료"
|
|
txbresult.BackColor = Color.Green
|
|
|
|
Save_Csv(NowDate & "," & NowTime & "," & Maximum_Data.prod_serial & "," & Maximum_Data.td_serial & "," & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, False)
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
|
|
thr_run_switch = True
|
|
print_OnOff = True
|
|
|
|
txb_barcode.Focus()
|
|
Else
|
|
txbtdnum.BackColor = Color.Red
|
|
txbpdnum.BackColor = Color.Red
|
|
txbresult.Text = "정보입력 실패"
|
|
txbresult.BackColor = Color.Red
|
|
|
|
Save_Csv(NowDate & "," & NowTime & "," & text_serial & "," & Maximum_Data.prod_serial & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, False)
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
|
|
MsgBox("제품과의 연결이 올바르지 않습니다. 연결 상태를 확인하여 주십시오.", vbCritical)
|
|
txb_barcode.Focus()
|
|
End If
|
|
|
|
Else
|
|
txbtdnum.BackColor = Color.Red
|
|
txbpdnum.BackColor = Color.Red
|
|
txbresult.Text = "정보입력 실패"
|
|
txbresult.BackColor = Color.Red
|
|
|
|
Save_Csv(NowDate & "," & NowTime & "," & text_serial & "," & Maximum_Data.prod_serial & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, False)
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
|
|
MsgBox("정보 입력은 완료되었으나 데이터베이스에 등록하지 못하였습니다. 다시 시도하여 주십시오.", vbExclamation)
|
|
td_data_switch = False
|
|
thr_run_switch = True
|
|
txb_barcode.Focus()
|
|
End If
|
|
|
|
Else
|
|
txbtdnum.BackColor = Color.Red
|
|
txbpdnum.BackColor = Color.Red
|
|
txbresult.Text = "정보입력 실패"
|
|
txbresult.BackColor = Color.Red
|
|
|
|
Save_Csv(NowDate & "," & NowTime & "," & text_serial & "," & Maximum_Data.prod_serial & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, False)
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
|
|
MsgBox("제품과의 연결이 올바르지 않습니다. 연결 상태를 확인하여 주십시오.", vbCritical)
|
|
txb_barcode.Focus()
|
|
End If
|
|
Else
|
|
txbtdnum.BackColor = Color.Red
|
|
txbpdnum.BackColor = Color.Red
|
|
txbresult.Text = "정보입력 실패"
|
|
txbresult.BackColor = Color.Red
|
|
|
|
Save_Csv(NowDate & "," & NowTime & "," & text_serial & "," & Maximum_Data.prod_serial & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, False)
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
|
|
MsgBox("제품과의 연결이 올바르지 않습니다. 연결 상태를 확인하여 주십시오.", vbCritical)
|
|
txb_barcode.Focus()
|
|
End If
|
|
Else
|
|
txbtdnum.BackColor = Color.Red
|
|
txbpdnum.BackColor = Color.Red
|
|
txbresult.Text = "정보입력 실패"
|
|
txbresult.BackColor = Color.Red
|
|
|
|
Save_Csv(NowDate & "," & NowTime & "," & text_serial & "," & Maximum_Data.prod_serial & Maximum_Data.td_freq & "," & Maximum_Data.td_power & "," & Maximum_Data.td_step & "," & CsvRegData, False)
|
|
|
|
thr_vari_reset()
|
|
reset_box()
|
|
|
|
MsgBox("제품과의 연결이 올바르지 않습니다. 연결 상태를 확인하여 주십시오.", vbCritical)
|
|
txb_barcode.Focus()
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Function TDDBRoad() As Boolean
|
|
DBCmd = ""
|
|
End Function
|
|
|
|
Private Function db_prod_reg(prod_id As String, make_name As String, area_code As String, agency_code As String, td_id As String, shot As Int16) As Boolean
|
|
Dim serial_code, p_date, p_time As String
|
|
|
|
serial_code = Mid(Maximum_Data.prod_serial, 5, Maximum_Data.prod_serial.Length)
|
|
p_date = DateTime.Now.ToString("yyyy-MM-dd")
|
|
p_time = DateTime.Now.ToString("HH:mm:ss")
|
|
|
|
DBCmd = "UPDATE " & cartridge_table & " SET TestStep = '31', Product_SN = '" & prod_id & "', Ct_Manufacture_Name='" & make_name & "', Ct_Manufacture_Year='" & Format(Now, "yy") & "', Ct_Manufacture_Month='" & Format(Now, "MM") & "', Ct_SN='" & serial_code & "', Ct_Abroad='" & area_code & "', Ct_Agency='" & agency_code & "',Ct_Max_ShotCnt = '" & shot & "', Ct_Remain_ShotCnt = '" & shot & "', P3_DateTime = '" & p_date & " " & p_time & "' WHERE PV_SN = '" & td_id & "'"
|
|
If DBCommand(DBCmd) Then
|
|
|
|
DBCmd = "SELECT TestStep FROM " & cartridge_table & " Where Product_SN = '" & prod_id & "'"
|
|
If DBQueryScalar(DBCmd) = 31 Then
|
|
Return True
|
|
End If
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
Private Function db_td_data(td_serial As String) As Boolean
|
|
DBCmd = "SELECT TestStep,QC_Grade FROM " & cartridge_table & " WHERE PV_SN = '" & td_serial & "'"
|
|
|
|
If DBQueryReader(DBCmd) Then
|
|
Maximum_Data.td_step = sqlDataQuery(0)
|
|
Maximum_Data.td_grade = sqlDataQuery(1)
|
|
Return True
|
|
|
|
Else
|
|
Maximum_Data.td_step = Nothing
|
|
Maximum_Data.td_grade = Nothing
|
|
Return False
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Sub btn_data_reg_Click(sender As Object, e As EventArgs) Handles btn_data_reg.Click
|
|
Dim StageNum As Int16
|
|
Try
|
|
|
|
txb_regresult.Visible = True
|
|
txb_regresult.BackColor = Color.GreenYellow
|
|
txb_regresult.Text = "RUNNING!"
|
|
txb_regresult.Refresh()
|
|
|
|
If txb_make_reg.Text.Replace(" ", "") = "" Then
|
|
txb_make_reg.Text = "jomt"
|
|
End If
|
|
|
|
If txb_name_reg.Text.Replace(" ", "") = "" Or txb_make_reg.Text.Replace(" ", "") = "" Or nudarea.Text.Replace(" ", "") = "" Or nudagency.Text.Replace(" ", "") = "" Then
|
|
StageNum = 0
|
|
MsgBox("작성하지 않은 항목이 존재합니다." & vbCrLf & "비어있는 부분을 작성하여 주십시오.", vbExclamation)
|
|
GoTo FAILDATA
|
|
End If
|
|
|
|
If name_reg_compare(txb_name_reg.Text) Then
|
|
|
|
dgv_data.Rows.Add(txb_name_reg.Text, txb_make_reg.Text, nudarea.Text, nudagency.Text)
|
|
|
|
txb_name_reg.Text = Nothing
|
|
txb_make_reg.Text = Nothing
|
|
nudarea.Text = 0
|
|
nudagency.Text = 0
|
|
|
|
txb_name_reg.Refresh()
|
|
txb_make_reg.Refresh()
|
|
nudarea.Refresh()
|
|
nudagency.Refresh()
|
|
|
|
txb_regresult.BackColor = Color.Green
|
|
txb_regresult.Text = "SUCCESS"
|
|
txb_regresult.Refresh()
|
|
|
|
option_reg_chk = True
|
|
|
|
Exit Sub
|
|
|
|
Else
|
|
StageNum = 1
|
|
MsgBox("중복된 이벤트명이 존재합니다." & vbCrLf & "이벤트명을 확인하여 주십시오.", vbCritical)
|
|
GoTo FAILDATA
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
StageNum = 2
|
|
MsgBox(Err.Description, vbCritical)
|
|
GoTo FAILDATA
|
|
End Try
|
|
|
|
FAILDATA:
|
|
txb_regresult.BackColor = Color.Red
|
|
txb_regresult.Text = "FAIL" & StageNum
|
|
txb_regresult.Refresh()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Function name_reg_compare(text_name As String) As Boolean
|
|
Try
|
|
For i = 0 To dgv_data.Rows.Count - 2
|
|
If dgv_data.Rows(i).Cells(0).Value.ToString = text_name Then
|
|
Return False
|
|
End If
|
|
Next
|
|
|
|
Return True
|
|
Catch ex As Exception
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Private Sub btn_save_Click(sender As Object, e As EventArgs) Handles btn_save.Click
|
|
|
|
txb_dgv_state.Visible = True
|
|
txb_dgv_state.Text = "RUNNING!"
|
|
txb_dgv_state.BackColor = Color.GreenYellow
|
|
txb_dgv_state.Refresh()
|
|
|
|
If save_comport("event") Then
|
|
|
|
If save_comport("comport") Then
|
|
txb_dgv_state.Text = "SUCCESS"
|
|
txb_dgv_state.BackColor = Color.Green
|
|
txb_dgv_state.Refresh()
|
|
|
|
option_reg_chk = False
|
|
Else
|
|
txb_dgv_state.Text = "ETC FAIL"
|
|
txb_dgv_state.BackColor = Color.Red
|
|
txb_dgv_state.Refresh()
|
|
End If
|
|
|
|
Else
|
|
txb_dgv_state.Text = "EVENT FAIL"
|
|
txb_dgv_state.BackColor = Color.Red
|
|
txb_dgv_state.Refresh()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub btn_row_delete_Click(sender As Object, e As EventArgs) Handles btn_row_delete.Click
|
|
Dim res As Integer
|
|
|
|
txb_dgv_state.Visible = True
|
|
txb_dgv_state.Text = "RUNNING!"
|
|
txb_dgv_state.BackColor = Color.GreenYellow
|
|
txb_dgv_state.Refresh()
|
|
|
|
For i = 0 To dgv_data.Rows.Count - 2
|
|
If dgv_data.Rows(i).Selected = True Then
|
|
res = MsgBox("해당 이벤트를 삭제하시겠습니까?", vbYesNo)
|
|
If res = 6 Then
|
|
dgv_data.Rows.Remove(dgv_data.Rows(i))
|
|
txb_dgv_state.Text = "SUCCESS"
|
|
txb_dgv_state.BackColor = Color.Green
|
|
txb_dgv_state.Refresh()
|
|
option_reg_chk = True
|
|
MsgBox("이벤트 삭제를 완료하였습니다.")
|
|
ElseIf res = 7 Then
|
|
txb_dgv_state.Text = "DELETE STOP"
|
|
txb_dgv_state.BackColor = Color.Red
|
|
txb_dgv_state.Refresh()
|
|
MsgBox("이벤트 삭제를 취소하였습니다.")
|
|
End If
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub btn_alldelete_Click(sender As Object, e As EventArgs) Handles btn_alldelete.Click
|
|
Dim res As Integer
|
|
|
|
txb_dgv_state.Visible = True
|
|
txb_dgv_state.Text = "RUNNING!"
|
|
txb_dgv_state.BackColor = Color.GreenYellow
|
|
txb_dgv_state.Refresh()
|
|
|
|
res = MsgBox(" 등록된 데이터를 모두 삭제하시겠습니까?", vbCritical + vbYesNo, "전체삭제")
|
|
If res = 6 Then
|
|
dgv_data.Rows.Clear()
|
|
txb_dgv_state.Text = "SUCCESS"
|
|
txb_dgv_state.BackColor = Color.Green
|
|
txb_dgv_state.Refresh()
|
|
option_reg_chk = True
|
|
MsgBox("등록된 데이터가 전부 삭제되었습니다.", vbCritical, "전체삭제 완료")
|
|
|
|
ElseIf res = 7 Then
|
|
txb_dgv_state.Text = "DELETE STOP"
|
|
txb_dgv_state.BackColor = Color.Red
|
|
txb_dgv_state.Refresh()
|
|
MsgBox("데이터 모두 삭제를 취소하였습니다.")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub cboselect_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboselect.SelectedIndexChanged
|
|
If cboselect.SelectedIndex <> -1 Then
|
|
txbmake.Text = dgv_data.Rows(cboselect.SelectedIndex).Cells(1).Value
|
|
txbarea.Text = dgv_data.Rows(cboselect.SelectedIndex).Cells(2).Value
|
|
txbagen.Text = dgv_data.Rows(cboselect.SelectedIndex).Cells(3).Value
|
|
End If
|
|
txb_barcode.Focus()
|
|
End Sub
|
|
|
|
Private Sub txb_barcode_TextChanged(sender As Object, e As EventArgs) Handles txb_barcode.TextChanged
|
|
Dim tmpStr As String
|
|
|
|
If InputCnt = 0 And chbUseBarcode.Checked = True Then
|
|
tmpStr = txb_barcode.Text
|
|
If (Len(tmpStr) > 1) Then
|
|
tmpStr = Mid(tmpStr, Len(tmpStr), 1)
|
|
txb_barcode.Clear()
|
|
txb_barcode.AppendText(tmpStr)
|
|
End If
|
|
SetInputCnt()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnreset_Click(sender As Object, e As EventArgs) Handles btnreset.Click
|
|
thr_text_box()
|
|
thr_text_refresh()
|
|
thr_text_color()
|
|
thr_btn_refresh()
|
|
thr_vari_reset()
|
|
|
|
If thr_run_switch = True Then
|
|
cboselect.SelectedIndex = -1
|
|
End If
|
|
|
|
txb_barcode.Focus()
|
|
End Sub
|
|
|
|
''1번 초기화
|
|
Private Sub one_text_box()
|
|
txbPV_SN.Text = Nothing
|
|
txbPV_Date.Text = "N/A"
|
|
txbCapacitor.Text = "N/A"
|
|
txbPV_Z.Text = "N/A"
|
|
txbPV_C.Text = "N/A"
|
|
txbPV_R.Text = "N/A"
|
|
txb_grade.Text = "대기"
|
|
txb_CValue.Text = "대기"
|
|
End Sub
|
|
|
|
Private Sub one_text_refresh()
|
|
txbPV_SN.Refresh()
|
|
txbPV_Date.Refresh()
|
|
txbCapacitor.Refresh()
|
|
txbPV_Z.Refresh()
|
|
txbPV_C.Refresh()
|
|
txbPV_R.Refresh()
|
|
txb_grade.Refresh()
|
|
txb_CValue.Refresh()
|
|
btnc_run.Refresh()
|
|
End Sub
|
|
|
|
Private Sub one_text_color()
|
|
txbPV_SN.BackColor = Color.White
|
|
txbPV_Date.BackColor = Color.White
|
|
txbCapacitor.BackColor = Color.White
|
|
txbPV_Z.BackColor = Color.White
|
|
txbPV_C.BackColor = Color.White
|
|
txbPV_R.BackColor = Color.White
|
|
txb_grade.BackColor = DefaultBackColor
|
|
txb_CValue.BackColor = DefaultBackColor
|
|
End Sub
|
|
|
|
Private Sub one_vari_default()
|
|
For i = 0 To info_data.pv_all
|
|
info_select(info_data.pv_all - i) = Nothing
|
|
Next
|
|
End Sub
|
|
|
|
''2번 초기화
|
|
|
|
Private Sub two_text_box()
|
|
txb_serial_num.Text = Nothing
|
|
txb_prod_state.Text = "대기"
|
|
txb_td_serial.Text = "대기"
|
|
txb_prod_Depth.Text = "대기"
|
|
txb_prod_grade.Text = "대기"
|
|
txb_prod_power.Text = "대기"
|
|
txbStCheck.Text = "대기"
|
|
txbNdCheck.Text = "대기"
|
|
txbRdCheck.Text = "대기"
|
|
End Sub
|
|
|
|
Private Sub two_text_refresh()
|
|
txb_serial_num.Refresh()
|
|
txb_prod_state.Refresh()
|
|
txb_td_serial.Refresh()
|
|
txb_prod_Depth.Refresh()
|
|
txb_prod_grade.Refresh()
|
|
txb_prod_power.Refresh()
|
|
txbStCheck.Refresh()
|
|
txbNdCheck.Refresh()
|
|
txbRdCheck.Refresh()
|
|
End Sub
|
|
|
|
Private Sub two_text_color()
|
|
txb_serial_num.BackColor = Color.White
|
|
txb_prod_state.BackColor = Color.Gold
|
|
txb_td_serial.BackColor = DefaultBackColor
|
|
txb_prod_Depth.BackColor = DefaultBackColor
|
|
txb_prod_grade.BackColor = DefaultBackColor
|
|
txb_prod_power.BackColor = DefaultBackColor
|
|
txbStCheck.BackColor = DefaultBackColor
|
|
txbNdCheck.BackColor = DefaultBackColor
|
|
txbRdCheck.BackColor = DefaultBackColor
|
|
End Sub
|
|
|
|
Private Sub two_btn_refresh()
|
|
btn_reset.Refresh()
|
|
btn_prod.Refresh()
|
|
End Sub
|
|
|
|
|
|
''3번 초기화
|
|
Private Sub thr_text_box()
|
|
'If thr_run_switch = False Then
|
|
' txb_barcode.Text = Nothing
|
|
' txbmake.Text = "대기"
|
|
' txbarea.Text = "대기"
|
|
' txbagen.Text = "대기"
|
|
'End If
|
|
txbresult.Text = "대기"
|
|
txbtdnum.Text = "대기"
|
|
txbfreq.Text = "대기"
|
|
txbgread.Text = "대기"
|
|
txbpower.Text = "대기"
|
|
txbpdnum.Text = "대기"
|
|
End Sub
|
|
|
|
Private Sub thr_text_refresh()
|
|
txb_barcode.Refresh()
|
|
txbresult.Refresh()
|
|
txbtdnum.Refresh()
|
|
txbfreq.Refresh()
|
|
txbgread.Refresh()
|
|
txbpower.Refresh()
|
|
txbpdnum.Refresh()
|
|
txbmake.Refresh()
|
|
txbarea.Refresh()
|
|
txbagen.Refresh()
|
|
End Sub
|
|
|
|
Private Sub thr_text_color()
|
|
txb_barcode.BackColor = Color.White
|
|
txbresult.BackColor = Color.Gold
|
|
txbtdnum.BackColor = DefaultBackColor
|
|
txbfreq.BackColor = DefaultBackColor
|
|
txbgread.BackColor = DefaultBackColor
|
|
txbpower.BackColor = DefaultBackColor
|
|
txbpdnum.BackColor = DefaultBackColor
|
|
txbmake.BackColor = DefaultBackColor
|
|
txbarea.BackColor = DefaultBackColor
|
|
txbagen.BackColor = DefaultBackColor
|
|
End Sub
|
|
|
|
Private Sub thr_btn_refresh()
|
|
btnreset.Refresh()
|
|
btnrun.Refresh()
|
|
End Sub
|
|
|
|
Private Sub thr_vari_reset()
|
|
Maximum_Data.prod_code = Nothing
|
|
Maximum_Data.prod_serial = Nothing
|
|
Maximum_Data.td_freq = Nothing
|
|
Maximum_Data.td_textbox = Nothing
|
|
Maximum_Data.td_step = Nothing
|
|
Maximum_Data.td_grade = Nothing
|
|
Maximum_Data.td_power = Nothing
|
|
Maximum_Data.td_serial = Nothing
|
|
td_data_switch = False
|
|
thr_run_switch = False
|
|
End Sub
|
|
|
|
|
|
'' 4번 화면 초기화
|
|
Private Sub four_text_box()
|
|
txb_tds.Text = "DITI"
|
|
txb_tdf.Text = "0"
|
|
txb_tdp.Text = "0.00"
|
|
txb_tdBox.Text = Nothing
|
|
txbBarcode.Text = Nothing
|
|
txbFactory.Text = "jomt"
|
|
nudYear.Text = Format(Now, "yy")
|
|
nudMonth.Text = Format(Now, "MM")
|
|
nudSN.Text = "0"
|
|
txbInfoBox.Text = Nothing
|
|
txb_area_code.Text = "82"
|
|
txb_abr_code.Text = "0"
|
|
txb_areabox.Text = Nothing
|
|
nud_shot.Text = "0"
|
|
txb_shotbox.Text = Nothing
|
|
nud_motor.Text = "0"
|
|
txb_motorBox.Text = Nothing
|
|
txb_resetbox.Text = Nothing
|
|
End Sub
|
|
|
|
Private Sub four_result_visible()
|
|
txb_tdBox.Visible = False
|
|
txbInfoBox.Visible = False
|
|
txb_areabox.Visible = False
|
|
txb_shotbox.Visible = False
|
|
txb_motorBox.Visible = False
|
|
txb_resetbox.Visible = False
|
|
End Sub
|
|
|
|
Private Sub four_result_color()
|
|
txb_tdBox.BackColor = Color.Green
|
|
txbInfoBox.BackColor = Color.Green
|
|
txb_areabox.BackColor = Color.Green
|
|
txb_shotbox.BackColor = Color.Green
|
|
txb_motorBox.BackColor = Color.Green
|
|
txb_resetbox.BackColor = Color.Green
|
|
End Sub
|
|
|
|
Private Sub four_btn_refresh()
|
|
btn_td_read.Refresh()
|
|
btn_td_write.Refresh()
|
|
btn_info_read.Refresh()
|
|
btn_info_write.Refresh()
|
|
btn_today.Refresh()
|
|
btn_area_read.Refresh()
|
|
btn_area_write.Refresh()
|
|
btn_shot_read.Refresh()
|
|
btn_shot_write.Refresh()
|
|
btn_mtr_write.Refresh()
|
|
btn_flashreset.Refresh()
|
|
btn_all_read.Refresh()
|
|
btn_all_write.Refresh()
|
|
btn_text_reset.Refresh()
|
|
End Sub
|
|
|
|
Private Sub item_refresh()
|
|
txbBarcode.Refresh()
|
|
txbFactory.Refresh()
|
|
btn_today.Refresh()
|
|
nudYear.Refresh()
|
|
nudMonth.Refresh()
|
|
nudSN.Refresh()
|
|
txbInfoBox.Refresh()
|
|
btn_info_read.Refresh()
|
|
btn_info_write.Refresh()
|
|
txb_area_code.Refresh()
|
|
txb_abr_code.Refresh()
|
|
txb_areabox.Refresh()
|
|
btn_area_read.Refresh()
|
|
btn_area_write.Refresh()
|
|
txb_tds.Refresh()
|
|
txb_tdf.Refresh()
|
|
txb_tdp.Refresh()
|
|
txb_tdBox.Refresh()
|
|
btn_td_read.Refresh()
|
|
btn_td_write.Refresh()
|
|
nud_shot.Refresh()
|
|
txb_shotbox.Refresh()
|
|
btn_shot_read.Refresh()
|
|
btn_shot_write.Refresh()
|
|
nud_motor.Refresh()
|
|
txb_motorBox.Refresh()
|
|
btn_mtr_write.Refresh()
|
|
txb_resetbox.Refresh()
|
|
btn_flashreset.Refresh()
|
|
btn_all_read.Refresh()
|
|
btn_all_write.Refresh()
|
|
btn_text_reset.Refresh()
|
|
lb_motor.Refresh()
|
|
End Sub
|
|
|
|
Private Sub vari_reset()
|
|
tmpCmdMessage = Nothing
|
|
cmdMessage = Nothing
|
|
rxMessage = Nothing
|
|
InputCnt = 0
|
|
reserve = False
|
|
DBCmd = Nothing
|
|
InputTimer.Enabled = False
|
|
End Sub
|
|
|
|
''5번창 리셋
|
|
|
|
Private Sub five_text_box()
|
|
txb_5_reg_date.Text = "-"
|
|
txb_5_make.Text = "-"
|
|
txb_5_model.Text = "-"
|
|
txb_5_serial.Text = "-"
|
|
txb_5_type.Text = "-"
|
|
txb_5_agency.Text = "-"
|
|
txb_5_area.Text = "-"
|
|
txb_5_prod_date.Text = "-"
|
|
txb_5_freq.Text = "-"
|
|
txb_5_prod_mod.Text = "0"
|
|
txb_5_power.Text = "-"
|
|
txb_5_prod_motor.Text = "-"
|
|
txb_5_td.Text = "-"
|
|
txb_5_result.Text = "대기"
|
|
End Sub
|
|
|
|
Private Sub five_text_refresh()
|
|
txb_5_reg_date.Refresh()
|
|
txb_5_make.Refresh()
|
|
txb_5_model.Refresh()
|
|
txb_5_serial.Refresh()
|
|
txb_5_type.Refresh()
|
|
txb_5_agency.Refresh()
|
|
txb_5_area.Refresh()
|
|
txb_5_prod_date.Refresh()
|
|
txb_5_freq.Refresh()
|
|
txb_5_prod_mod.Refresh()
|
|
txb_5_power.Refresh()
|
|
txb_5_prod_motor.Refresh()
|
|
txb_5_td.Refresh()
|
|
txb_5_result.Refresh()
|
|
End Sub
|
|
|
|
Private Sub five_text_color()
|
|
txb_5_reg_date.BackColor = Color.White
|
|
txb_5_make.BackColor = Color.White
|
|
txb_5_model.BackColor = Color.White
|
|
txb_5_serial.BackColor = Color.White
|
|
txb_5_type.BackColor = Color.White
|
|
txb_5_agency.BackColor = Color.White
|
|
txb_5_area.BackColor = Color.White
|
|
txb_5_prod_date.BackColor = Color.White
|
|
txb_5_freq.BackColor = Color.White
|
|
txb_5_prod_mod.BackColor = Color.White
|
|
txb_5_power.BackColor = Color.White
|
|
txb_5_prod_motor.BackColor = Color.White
|
|
txb_5_td.BackColor = Color.White
|
|
txb_5_result.BackColor = DefaultBackColor
|
|
End Sub
|
|
|
|
|
|
''등록창 리셋
|
|
|
|
Private Sub reg_text_box()
|
|
txb_name_reg.Text = Nothing
|
|
txb_make_reg.Text = Nothing
|
|
nudarea.Text = 0
|
|
nudagency.Text = 0
|
|
txb_regresult.Text = Nothing
|
|
txb_dgv_state.Text = Nothing
|
|
End Sub
|
|
|
|
Private Sub reg_text_refresh()
|
|
txb_name_reg.Refresh()
|
|
txb_make_reg.Refresh()
|
|
nudarea.Refresh()
|
|
nudagency.Refresh()
|
|
txb_regresult.Refresh()
|
|
txb_dgv_state.Refresh()
|
|
End Sub
|
|
|
|
Private Sub reg_text_color()
|
|
txb_name_reg.BackColor = Color.White
|
|
txb_make_reg.BackColor = Color.White
|
|
nudarea.BackColor = Color.White
|
|
nudagency.BackColor = Color.White
|
|
txb_regresult.BackColor = Color.Khaki
|
|
txb_dgv_state.BackColor = Color.Khaki
|
|
End Sub
|
|
|
|
Private Sub reg_btn_refresh()
|
|
btn_data_reg.Refresh()
|
|
btn_save.Refresh()
|
|
btn_row_delete.Refresh()
|
|
btn_alldelete.Refresh()
|
|
btn_option_exit.Refresh()
|
|
End Sub
|
|
|
|
Private Sub reg_txb_visible()
|
|
txb_dgv_state.Visible = False
|
|
txb_regresult.Visible = False
|
|
End Sub
|
|
|
|
Private Sub txbtdnum_gotfocus(sender As Object, e As EventArgs) Handles txbtdnum.GotFocus, txbfreq.GotFocus, txbpower.GotFocus, txbgread.GotFocus, txbpdnum.GotFocus, txbmake.GotFocus, txbarea.GotFocus, txbagen.GotFocus, txbresult.GotFocus
|
|
txb_barcode.Focus()
|
|
End Sub
|
|
|
|
Private Sub btn_code_reg_Click(sender As Object, e As EventArgs) Handles btn_code_reg.Click
|
|
|
|
If txb_code_front.Text.Replace(" ", "") = "" Then
|
|
txb_code_front.Text = "30"
|
|
End If
|
|
If txb_code_front.Text.Replace(" ", "") = "" Or txb_prod1_code.Text.Replace(" ", "") = "" Or txb_output_6850.Text.Replace(" ", "") = "" Or txb_output_7000.Text.Replace(" ", "") = "" Then
|
|
MsgBox("비어있는 칸이 존재합니다. 모든 정보를 입력하여 주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
|
|
If save_comport("event") Then
|
|
If save_comport("comport") = False Then
|
|
MsgBox("데이터를 저장하는 도중 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
MsgBox("데이터를 저장하는 도중 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
|
|
MsgBox("데이터 저장 완료", vbInformation)
|
|
option_reg_chk = False
|
|
End Sub
|
|
|
|
Private Sub txb_code_front_TextChanged(sender As Object, e As EventArgs) Handles txb_code_front.TextChanged, txb_output_6850.TextChanged, txb_output_7000.TextChanged, txb_prod1_code.TextChanged
|
|
option_reg_chk = True
|
|
End Sub
|
|
|
|
Private Sub btn_mtr_read_Click(sender As Object, e As EventArgs) Handles btn_mtr_read.Click
|
|
Dim stageCnt, motor_level As Int16
|
|
|
|
Try
|
|
txb_motorBox.Visible = True
|
|
txb_motorBox.Text = "RUNNING"
|
|
txb_motorBox.BackColor = Color.GreenYellow
|
|
txb_motorBox.Refresh()
|
|
|
|
motor_level = Motor_Read()
|
|
|
|
If motor_level = 6 Then
|
|
stageCnt = 0
|
|
GoTo FailExit
|
|
End If
|
|
|
|
nud_motor.Text = motor_level
|
|
GoTo SuccessExit
|
|
|
|
|
|
Catch ex As Exception
|
|
stageCnt = 1
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
txb_motorBox.Text = "Timeout" + Str(stageCnt)
|
|
txb_motorBox.BackColor = Color.Red
|
|
txb_motorBox.Refresh()
|
|
Exit Sub
|
|
SuccessExit:
|
|
txb_motorBox.Text = "SUCCESS"
|
|
txb_motorBox.BackColor = Color.Green
|
|
txb_motorBox.Refresh()
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub btn_5_reset_Click(sender As Object, e As EventArgs) Handles btn_5_reset.Click
|
|
write_5_error = False
|
|
TH_thread.Abort()
|
|
five_text_box()
|
|
five_text_color()
|
|
five_text_refresh()
|
|
txb_5_prod_mod.ReadOnly = True
|
|
txb_5_barcode.BackColor = Color.White
|
|
txb_5_barcode.Focus()
|
|
End Sub
|
|
|
|
Private Sub check_data_reset()
|
|
For i = 0 To check_list.max_check
|
|
check_data(i) = Nothing
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub btn_5_check_Click(sender As Object, e As EventArgs) Handles btn_5_check.Click
|
|
Dim prd_code As String
|
|
Dim step_num As Int16
|
|
Dim TDUseCompare As Boolean = False
|
|
|
|
prd_code = txb_5_barcode.Text
|
|
|
|
write_5_error = False
|
|
|
|
five_text_box()
|
|
five_text_color()
|
|
five_text_refresh()
|
|
check_data_reset()
|
|
|
|
txb_5_barcode.BackColor = Color.White
|
|
|
|
|
|
|
|
If Mid(prd_code, 1, 1) = "5" Then
|
|
TDUseCompare = False
|
|
DBCmd = "SELECT count(Product_SN) FROM " & MainNonTDDB & " WHERE Product_SN = '" & prd_code & "'"
|
|
Else
|
|
TDUseCompare = True
|
|
DBCmd = "SELECT count(Product_SN) FROM " & cartridge_table & " WHERE Product_SN = '" & prd_code & "'"
|
|
End If
|
|
|
|
step_num = DBQueryScalar(DBCmd)
|
|
|
|
If step_num = 0 Then
|
|
txb_5_barcode.BackColor = Color.Red
|
|
MsgBox("해당 데이터가 데이터베이스에 존재하지 않습니다.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
|
|
If TDUseCompare = True Then
|
|
DBCmd = "SELECT TestStep,Ct_Manufacture_Name,Ct_SN,Ct_Model,Ct_Type,Ct_Abroad,Ct_Agency,Ct_Frequency,Ct_Power,Ct_Max_ShotCnt,Ct_Motor_Lv, PV_SN,P1_Date,P1_Time,P3_DateTime FROM " & cartridge_table & " WHERE Product_SN = '" & prd_code & "'"
|
|
If DBQueryReader(DBCmd) Then
|
|
For i = 0 To check_list.max_check - 1
|
|
check_data(i) = sqlDataQuery(i).ToString
|
|
Next
|
|
Else
|
|
MsgBox("해당 데이터가 데이터베이스에 존재하지 않습니다.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
|
|
If check_data(check_list.P3_DateTime) = Nothing Or check_data(check_list.P3_DateTime) = "0" Then
|
|
txb_5_reg_date.Text = "-"
|
|
txb_5_reg_date.BackColor = Color.Red
|
|
'error_switch = True
|
|
Else
|
|
txb_5_reg_date.Text = check_data(check_list.P3_DateTime)
|
|
txb_5_reg_date.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.make_name) = Nothing Or check_data(check_list.make_name) = "0" Then
|
|
txb_5_make.Text = "-"
|
|
txb_5_make.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_make.Text = check_data(check_list.make_name)
|
|
txb_5_make.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.model) = Nothing Or check_data(check_list.model) = "0" Then
|
|
txb_5_model.Text = "-"
|
|
txb_5_model.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_model.Text = check_data(check_list.model)
|
|
txb_5_model.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.serial) = Nothing Or check_data(check_list.serial) = "0" Then
|
|
txb_5_serial.Text = "-"
|
|
txb_5_serial.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_serial.Text = check_data(check_list.serial)
|
|
txb_5_serial.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.type) = Nothing Or check_data(check_list.type) = "0" Then
|
|
txb_5_type.Text = "-"
|
|
txb_5_type.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_type.Text = check_data(check_list.type)
|
|
txb_5_type.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.agency) = Nothing Then
|
|
txb_5_agency.Text = "-"
|
|
txb_5_agency.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_agency.Text = check_data(check_list.agency)
|
|
txb_5_agency.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.abroad) = Nothing Then
|
|
txb_5_area.Text = "-"
|
|
txb_5_area.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_area.Text = check_data(check_list.abroad)
|
|
txb_5_area.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.td_serial) = Nothing Or check_data(check_list.td_serial) = "0" Then
|
|
txb_5_td.Text = "-"
|
|
txb_5_td.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_td.Text = check_data(check_list.td_serial)
|
|
txb_5_td.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.p1_date) = Nothing Or check_data(check_list.p1_time) = Nothing Or check_data(check_list.p1_date) = "0" Or check_data(check_list.p1_time) = "0" Then
|
|
txb_5_prod_date.Text = "-"
|
|
txb_5_prod_date.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_prod_date.Text = Mid(check_data(check_list.p1_date), 1, InStr(1, check_data(check_list.p1_date), " ") - 1) & " " & check_data(check_list.p1_time)
|
|
txb_5_prod_date.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.freq) = Nothing Or check_data(check_list.freq) = "0" Then
|
|
txb_5_freq.Text = "-"
|
|
txb_5_freq.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_freq.Text = check_data(check_list.freq)
|
|
txb_5_freq.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.power) = Nothing Then
|
|
txb_5_power.Text = "-"
|
|
txb_5_power.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_power.Text = check_data(check_list.power) / 100
|
|
txb_5_power.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.shotcount) = Nothing Or check_data(check_list.shotcount) = "-1" Then
|
|
txb_5_prod_mod.Text = "0"
|
|
txb_5_prod_mod.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_prod_mod.Text = check_data(check_list.shotcount)
|
|
txb_5_prod_mod.BackColor = Color.Green
|
|
End If
|
|
|
|
txb_5_prod_mod.ReadOnly = True
|
|
|
|
If check_data(check_list.p1_motor) = Nothing Then
|
|
txb_5_prod_motor.Text = "-"
|
|
txb_5_prod_motor.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_prod_motor.Text = check_data(check_list.p1_motor)
|
|
txb_5_prod_motor.BackColor = Color.Green
|
|
End If
|
|
|
|
If write_5_error = True Then
|
|
txb_5_barcode.BackColor = Color.Red
|
|
Else
|
|
txb_5_barcode.BackColor = Color.Green
|
|
End If
|
|
Else
|
|
DBCmd = "SELECT TestStep,Ct_Manufacture_Name,Ct_SN,Ct_Model,Ct_Type,Ct_Abroad,Ct_Agency,PV_SN FROM " & MainNonTDDB & " WHERE Product_SN = '" & prd_code & "'"
|
|
If DBQueryReader(DBCmd) Then
|
|
For i = 0 To check_list.power - 1
|
|
check_data(i) = sqlDataQuery(i).ToString
|
|
Next
|
|
Else
|
|
MsgBox("해당 데이터가 데이터베이스에 존재하지 않습니다.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
|
|
If check_data(check_list.make_name) = Nothing Or check_data(check_list.make_name) = "0" Then
|
|
txb_5_make.Text = "-"
|
|
txb_5_make.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_make.Text = check_data(check_list.make_name)
|
|
txb_5_make.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.model) = Nothing Or check_data(check_list.model) = "0" Then
|
|
txb_5_model.Text = "-"
|
|
txb_5_model.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_model.Text = check_data(check_list.model)
|
|
txb_5_model.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.serial) = Nothing Or check_data(check_list.serial) = "0" Then
|
|
txb_5_serial.Text = "-"
|
|
txb_5_serial.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_serial.Text = check_data(check_list.serial)
|
|
txb_5_serial.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.type) = Nothing Or check_data(check_list.type) = "0" Then
|
|
txb_5_type.Text = "-"
|
|
txb_5_type.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_type.Text = check_data(check_list.type)
|
|
txb_5_type.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.agency) = Nothing Then
|
|
txb_5_agency.Text = "-"
|
|
txb_5_agency.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_agency.Text = check_data(check_list.agency)
|
|
txb_5_agency.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.abroad) = Nothing Then
|
|
txb_5_area.Text = "-"
|
|
txb_5_area.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_area.Text = check_data(check_list.abroad)
|
|
txb_5_area.BackColor = Color.Green
|
|
End If
|
|
|
|
If check_data(check_list.freq) = Nothing Or check_data(check_list.freq) = "0" Then
|
|
txb_5_td.Text = "-"
|
|
txb_5_td.BackColor = Color.Red
|
|
write_5_error = True
|
|
Else
|
|
txb_5_td.Text = check_data(check_list.freq)
|
|
txb_5_td.BackColor = Color.Green
|
|
End If
|
|
|
|
txb_5_prod_mod.ReadOnly = True
|
|
|
|
If write_5_error = True Then
|
|
txb_5_barcode.BackColor = Color.Red
|
|
Else
|
|
txb_5_barcode.BackColor = Color.Green
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub txb_5_reg_date_GotFocus(sender As Object, e As EventArgs) Handles txb_5_reg_date.GotFocus, txb_5_make.GotFocus, txb_5_model.GotFocus, txb_5_serial.GotFocus, txb_5_type.GotFocus, txb_5_agency.GotFocus, txb_5_area.GotFocus, txb_5_prod_date.GotFocus, txb_5_freq.GotFocus, txb_5_power.GotFocus, txb_5_prod_motor.GotFocus, txb_5_td.GotFocus
|
|
txb_5_barcode.Focus()
|
|
End Sub
|
|
|
|
Private Sub txb_5_barcode_Click(sender As Object, e As EventArgs) Handles txb_5_barcode.Click
|
|
txb_5_barcode.Text = ""
|
|
End Sub
|
|
|
|
Private Sub txb_5_barcode_TextChanged(sender As Object, e As EventArgs) Handles txb_5_barcode.TextChanged
|
|
Dim tmpStr As String
|
|
|
|
If InputCnt = 0 And chbUseBarcode.Checked = True Then
|
|
tmpStr = txb_5_barcode.Text
|
|
If (Len(tmpStr) > 1) Then
|
|
tmpStr = Mid(tmpStr, Len(tmpStr), 1)
|
|
txb_5_barcode.Clear()
|
|
txb_5_barcode.AppendText(tmpStr)
|
|
End If
|
|
SetInputCnt()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ckb_db_use_CheckedChanged(sender As Object, e As EventArgs) Handles ckb_db_use.CheckedChanged
|
|
Dim msg_result As Int16 = 0
|
|
If ckb_db_use.Checked = False Then
|
|
msg_result = MsgBox("데이터베이스를 사용하지 않을 시 이후 데이터베이스를 사용할 때 문제가 발생할 수 있습니다." & vbCrLf & "계속 하시겠습니까?", vbExclamation + vbOKCancel)
|
|
If msg_result = 1 Then
|
|
ckb_db_use.Checked = False
|
|
Else
|
|
ckb_db_use.Checked = True
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btn_5_write_Click(sender As Object, e As EventArgs) Handles btn_5_write.Click
|
|
Dim prod_code, prod_serial, serial_num As String
|
|
Dim TDUseCompare As Boolean = False
|
|
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "입력중.."
|
|
txb_5_result.BackColor = Color.Orange
|
|
|
|
If write_5_error = True Then
|
|
MsgBox("등록되지 않은 데이터가 존재합니다. 등록하지 않은 데이터를 등록하여 주십시오.", vbCritical)
|
|
txb_5_barcode.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
prod_code = Mid(txb_5_barcode.Text, 1, 2)
|
|
prod_serial = Mid(txb_5_barcode.Text, 3, 4)
|
|
serial_num = Mid(txb_5_barcode.Text, 10, 3) & Mid(txb_5_barcode.Text, 7, 3)
|
|
|
|
prod_serial = prod_serial & serial_num
|
|
|
|
If Mid(prod_code, 1, 1) = "5" Then
|
|
If prod_reg_data(txb_5_make.Text, prod_serial, prod_code, txb_5_area.Text, txb_5_agency.Text) Then
|
|
If td_reg_data(txb_5_td.Text) Then
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "SUCCESS"
|
|
txb_5_result.BackColor = Color.Green
|
|
Else
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 3"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("TD 정보 입력을 하는데 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 1"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("제품 시리얼 정보 입력을 하는데 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
If prod_reg_data(txb_5_make.Text, prod_serial, prod_code, txb_5_area.Text, txb_5_agency.Text) Then
|
|
If sett_reg(txb_5_freq.Text, Val(txb_5_power.Text) * 100) Then
|
|
If td_reg_data(txb_5_td.Text) Then
|
|
If Motor_reg(txb_5_prod_motor.Text) Then
|
|
If shot_reg(txb_5_prod_mod.Text) Then
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "SUCCESS"
|
|
txb_5_result.BackColor = Color.Green
|
|
Else
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 5"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("샷 수 정보 입력을 하는데 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 4"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("모터 정보 입력을 하는데 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 3"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("TD 정보 입력을 하는데 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 2"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("제품 주파수 및 파워 정보 입력을 하는데 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
Else
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 1"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("제품 시리얼 정보 입력을 하는데 오류가 발생하였습니다.", vbCritical)
|
|
End If
|
|
End If
|
|
|
|
|
|
txb_5_barcode.Focus()
|
|
End Sub
|
|
|
|
Private Sub ckb_auto_write_CheckedChanged(sender As Object, e As EventArgs) Handles ckb_auto_write.CheckedChanged
|
|
If ckb_auto_write.Checked Then
|
|
ckb_auto_delete.Checked = False
|
|
End If
|
|
txb_5_barcode.Focus()
|
|
End Sub
|
|
|
|
Private Sub txb_5_barcode_KeyDown(sender As Object, e As KeyEventArgs) Handles txb_5_barcode.KeyDown
|
|
If e.KeyCode = Keys.Return Then
|
|
btn_5_check_Click(sender, e)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btPrintref_Click(sender As Object, e As EventArgs) Handles btPrintref.Click
|
|
Dim lvi(1) As String
|
|
Dim alList As System.Collections.ArrayList = New System.Collections.ArrayList(PrinterSettings.InstalledPrinters)
|
|
|
|
alList.Sort()
|
|
dgvPrinter.Rows.Clear()
|
|
|
|
For i = 0 To alList.Count - 1
|
|
lvi(0) = i + 1
|
|
lvi(1) = alList(i).ToString
|
|
|
|
dgvPrinter.Rows.Add(lvi)
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub btnName1_Click(sender As Object, e As EventArgs) Handles btnName1.Click
|
|
Dim row As DataGridViewRow = dgvPrinter.SelectedRows(0)
|
|
Dim printname As String = row.Cells(1).Value.ToString
|
|
txbName1.Text = printname
|
|
End Sub
|
|
|
|
Private Sub btnName2_Click(sender As Object, e As EventArgs) Handles btnName2.Click
|
|
Dim row As DataGridViewRow = dgvPrinter.SelectedRows(0)
|
|
Dim printname As String = row.Cells(1).Value.ToString
|
|
txbName2.Text = printname
|
|
End Sub
|
|
|
|
Private Sub btnLabel1_Click(sender As Object, e As EventArgs) Handles btnLabel1.Click
|
|
Dim fileAddress As String = openfile()
|
|
|
|
If fileAddress <> "fail" Then
|
|
txbLabel1.Text = fileAddress
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnLabel2_Click(sender As Object, e As EventArgs) Handles btnLabel2.Click
|
|
Dim fileAddress As String = openfile()
|
|
|
|
If fileAddress <> "fail" Then
|
|
txbLabel2.Text = fileAddress
|
|
End If
|
|
End Sub
|
|
|
|
Private Function openfile() As String
|
|
Dim ofd As OpenFileDialog = New OpenFileDialog
|
|
ofd.Title = "라벨 파일 주소 불러오기"
|
|
ofd.FileName = ""
|
|
ofd.Filter = "라벨 파일(*.lbx) | *.lbx"
|
|
|
|
Dim dr As DialogResult = ofd.ShowDialog
|
|
|
|
If dr = DialogResult.OK Then
|
|
Return ofd.FileName
|
|
End If
|
|
|
|
Return "fail"
|
|
End Function
|
|
|
|
Private Sub ckbAllPnt_CheckedChanged(sender As Object, e As EventArgs) Handles ckbAllPnt.CheckedChanged
|
|
If ckbAllPnt.Checked = True Then
|
|
ckbEachPnt.Enabled = False
|
|
gbPrintEach.Enabled = False
|
|
|
|
ckbEachPnt.Checked = False
|
|
ckbBoxPnt.Checked = True
|
|
ckbWarPnt.Checked = True
|
|
Else
|
|
ckbEachPnt.Enabled = True
|
|
|
|
ckbBoxPnt.Checked = False
|
|
ckbWarPnt.Checked = False
|
|
End If
|
|
|
|
option_print_chk = True
|
|
End Sub
|
|
|
|
Private Sub ckbEachPnt_CheckedChanged(sender As Object, e As EventArgs) Handles ckbEachPnt.CheckedChanged
|
|
If ckbEachPnt.Checked = True Then
|
|
gbPrintEach.Enabled = True
|
|
Else
|
|
gbPrintEach.Enabled = False
|
|
End If
|
|
|
|
ckbBoxPnt.Checked = False
|
|
ckbWarPnt.Checked = False
|
|
|
|
option_print_chk = True
|
|
End Sub
|
|
|
|
Private Sub print_on(printtext As String, code1 As String, text1 As String, text2 As String)
|
|
Try
|
|
|
|
print_OnOff = False
|
|
Dim doc As bpac.Document = New bpac.Document
|
|
|
|
For i = 0 To print_data.GetLength(1) - 1
|
|
If i = 0 Then
|
|
If ckbBoxPnt.Checked = True Then
|
|
If printer_state(print_data(i, 0)) Then
|
|
Dim print_address As String = print_data(i, 1)
|
|
doc.Open(print_address)
|
|
|
|
Dim print_name As Boolean = doc.SetPrinter(print_data(i, 0), True)
|
|
|
|
doc.GetObject(code1).Text = printtext
|
|
doc.GetObject(text1).Text = printtext
|
|
Else
|
|
MsgBox("프린터 연결이 잘못되었습니다. 전원이나 케이블을 확인하여 주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
If ckbWarPnt.Checked = True Then
|
|
|
|
If printer_state(print_data(i, 0)) Then
|
|
Dim printt_address As String = print_data(i, 1)
|
|
doc.Open(printt_address)
|
|
|
|
Dim print_name As Boolean = doc.SetPrinter(print_data(i, 0), True)
|
|
|
|
doc.GetObject(text2).Text = printtext
|
|
Else
|
|
MsgBox("프린터 연결이 잘못되었습니다. 전원이나 케이블을 확인하여 주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
doc.StartPrint("", bpac.PrintOptionConstants.bpoDefault)
|
|
doc.PrintOut(1, bpac.PrintOptionConstants.bpoDefault)
|
|
doc.EndPrint()
|
|
doc.Close()
|
|
|
|
Next
|
|
Catch ex As Exception
|
|
MsgBox("Print Error : " & ex.Message, vbCritical)
|
|
Exit Sub
|
|
End Try
|
|
End Sub
|
|
|
|
Private Function printer_state(printer As String) As Boolean
|
|
Dim scope As ManagementScope = New ManagementScope("\root\cimv2")
|
|
scope.Connect()
|
|
Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_Printer")
|
|
|
|
Dim printName As String = ""
|
|
|
|
For Each printobj As ManagementObject In searcher.Get
|
|
printName = printobj("Name").ToString
|
|
If printName.Equals(printer) Then
|
|
If printobj("WorkOffline").ToString.ToLower.Equals("true") Then
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
Return False
|
|
End Function
|
|
|
|
Private Sub txbName1_TextChanged(sender As Object, e As EventArgs) Handles txbName1.TextChanged, txbLabel1.TextChanged, txbCode1.TextChanged, txbText1.TextChanged, txbName2.TextChanged, txbLabel2.TextChanged, txbText2.TextChanged
|
|
option_print_chk = True
|
|
End Sub
|
|
|
|
Private Sub btnPrintSave_Click(sender As Object, e As EventArgs) Handles btnPrintSave.Click
|
|
If txbName1.Text.Replace(" ", "") = "" Or txbLabel1.Text.Replace(" ", "") = "" Or txbCode1.Text.Replace(" ", "") = "" Or txbText1.Text.Replace(" ", "") = "" Then
|
|
MsgBox("박스 바코드 인쇄 프린터 설정란에 빈 칸이 존재합니다. 빈 칸을 채워주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
|
|
If txbName2.Text.Replace(" ", "") = "" Or txbLabel2.Text.Replace(" ", "") = "" Or txbText2.Text.Replace(" ", "") = "" Then
|
|
MsgBox("워런티 카드 텍스트 인쇄 프린터 설정란에 빈 칸이 존재합니다. 빈 칸을 채워주십시오.", vbExclamation)
|
|
Exit Sub
|
|
End If
|
|
|
|
If save_comport("print") = False Then
|
|
MsgBox("저장하는 도중 오류가 발생하였습니다. 파일을 확인하여 주십시오.", vbCritical)
|
|
Exit Sub
|
|
End If
|
|
|
|
option_print_chk = False
|
|
printOptionData()
|
|
|
|
MsgBox("저장이 완료되었습니다.", vbInformation)
|
|
End Sub
|
|
|
|
Private Sub printOptionData()
|
|
print_data(0, 0) = txbName1.Text
|
|
print_data(0, 1) = txbLabel1.Text
|
|
print_data(1, 0) = txbName2.Text
|
|
print_data(1, 1) = txbLabel2.Text
|
|
End Sub
|
|
|
|
Private Sub txb_5_prod_mod_DoubleClick(sender As Object, e As EventArgs) Handles txb_5_prod_mod.DoubleClick
|
|
txb_5_prod_mod.BackColor = Color.White
|
|
txb_5_prod_mod.ReadOnly = False
|
|
End Sub
|
|
|
|
Private Sub txb_5_prod_mod_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txb_5_prod_mod.KeyPress
|
|
If Not Char.IsDigit(e.KeyChar) And Not Char.IsControl(e.KeyChar) Then
|
|
e.Handled = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ckbfrontprt_CheckedChanged(sender As Object, e As EventArgs) Handles ckbfrontprt.CheckedChanged
|
|
If ckbfrontprt.Checked = True Then
|
|
ckbAllPnt.Checked = True
|
|
Else
|
|
ckbAllPnt.Checked = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnbasic_Click(sender As Object, e As EventArgs) Handles btnbasic.Click
|
|
txbOptBasic.Text = dgv_data.SelectedRows(0).Index
|
|
End Sub
|
|
|
|
Private Sub txbOptBasic_gotFocus(sender As Object, e As EventArgs) Handles txbOptBasic.GotFocus
|
|
btnbasic.Focus()
|
|
End Sub
|
|
|
|
Private Sub ckbselect_CheckedChanged(sender As Object, e As EventArgs) Handles ckbselect.CheckedChanged
|
|
If ckbselect.Checked = True Then
|
|
cboselect.SelectedIndex = txbOptBasic.Text
|
|
'boselect_SelectedIndexChanged(sender, e)
|
|
cboselect.Enabled = False
|
|
Else
|
|
cboselect.Enabled = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ckb_auto_delete_CheckedChanged(sender As Object, e As EventArgs) Handles ckb_auto_delete.CheckedChanged
|
|
If ckb_auto_delete.Checked Then
|
|
ckb_auto_write.Checked = False
|
|
End If
|
|
|
|
txb_5_barcode.Focus()
|
|
End Sub
|
|
|
|
Private Sub btn_5_delete_Click(sender As Object, e As EventArgs) Handles btn_5_delete.Click
|
|
DBCmd = "UPDATE " & cartridge_table & " SET TestStep = '32' ,Product_SN = NULL WHERE Product_SN = '" & txb_5_barcode.Text & "'"
|
|
If DBCommand(DBCmd) Then
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "SUCCESS"
|
|
txb_5_result.BackColor = Color.Green
|
|
|
|
Exit Sub
|
|
End If
|
|
|
|
txb_5_result.Refresh()
|
|
txb_5_result.Text = "FAIL 0"
|
|
txb_5_result.BackColor = Color.Red
|
|
MsgBox("데이터베이스를 설정하는데 오류가 발생하였습니다", vbCritical)
|
|
End Sub
|
|
|
|
Private Sub ckb_info_CheckedChanged(sender As Object, e As EventArgs) Handles ckb_info.CheckedChanged
|
|
txb_serial_num.Focus()
|
|
End Sub
|
|
|
|
Private Function Save_Csv(SaveData As String, SaveType As Boolean) As Boolean
|
|
On Error GoTo WR_File_Error
|
|
Dim objWriter As StreamWriter
|
|
Dim FileName As String
|
|
|
|
Dim syaer As String = DateAndTime.Year(Now)
|
|
Dim smonth As String = DateAndTime.Month(Now)
|
|
Dim sday As String = DateAndTime.Day(Now)
|
|
|
|
Dim FilePath As String = System.AppDomain.CurrentDomain.BaseDirectory & "\LogData"
|
|
|
|
If Dir(FilePath, vbDirectory) = "" Then
|
|
MkDir(FilePath)
|
|
End If
|
|
|
|
If SaveType = True Then
|
|
FileName = FilePath & "\" & DateAndTime.Year(Now) & "_" & DateAndTime.Month(Now) & "_" & DateAndTime.Day(Now) & "(FreqData).csv"
|
|
Else
|
|
FileName = FilePath & "\" & DateAndTime.Year(Now) & "_" & DateAndTime.Month(Now) & "_" & DateAndTime.Day(Now) & "(ProdData).csv"
|
|
End If
|
|
|
|
|
|
If File.Exists(FileName) = True Then
|
|
objWriter = New StreamWriter(FileName, True)
|
|
objWriter.WriteLine(SaveData)
|
|
Else
|
|
objWriter = New StreamWriter(FileName, True)
|
|
objWriter.WriteLine(ItemList)
|
|
objWriter.WriteLine(SaveData)
|
|
End If
|
|
|
|
objWriter.Close()
|
|
|
|
Return False
|
|
|
|
WR_File_Error:
|
|
MsgBox("Logdata save fail!" & Err.Description)
|
|
Return True
|
|
|
|
End Function
|
|
|
|
Private Sub btnDeep_Click(sender As Object, e As EventArgs) Handles btnDeep.Click
|
|
Try
|
|
If dotSerial = Nothing Then
|
|
MsgBox("검사를 진행할 시리얼 번호를 입력하여 주십시오.", vbExclamation)
|
|
btnc_run.Focus()
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If nudDeep.Text.Replace(" ", "") = "" Then
|
|
MsgBox("깊이 정보를 입력하지 않으셨습니다.", vbExclamation)
|
|
nudDeep.Focus()
|
|
GoTo FailExit
|
|
End If
|
|
|
|
nudDeep.BackColor = Color.Yellow
|
|
|
|
If Motor_reg(nudDeep.Value) Then
|
|
If motor_db_reg(nudDeep.Value, dotSerial) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
MsgBox("데이터베이스에 등록하는 과정에서 오류가 발생하였습니다.", vbCritical)
|
|
GoTo FailExit
|
|
End If
|
|
Else
|
|
MsgBox("제품과의 연결이 올바르지 않습니다.")
|
|
GoTo FailExit
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox("오류가 발생하였습니다 : " & vbCrLf & ex.Message)
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
nudDeep.BackColor = Color.Red
|
|
nudDeep.Refresh()
|
|
txbPV_SN.Focus()
|
|
Exit Sub
|
|
|
|
SuccessExit:
|
|
nudDeep.BackColor = Color.Green
|
|
nudDeep.Refresh()
|
|
txbPV_SN.Focus()
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub btnPower_Click(sender As Object, e As EventArgs) Handles btnPower.Click
|
|
Try
|
|
If dotSerial = Nothing Then
|
|
MsgBox("검사를 진행할 시리얼 번호를 입력하여 주십시오.", vbExclamation)
|
|
btnc_run.Focus()
|
|
GoTo FailExit
|
|
End If
|
|
|
|
If nudPower.Text.Replace(" ", "") = "" Then
|
|
MsgBox("깊이 정보를 입력하지 않으셨습니다.", vbExclamation)
|
|
nudPower.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
nudPower.BackColor = Color.Yellow
|
|
|
|
Dim freq As String = txb_CValue.Text
|
|
Dim power As String = nudPower.Value
|
|
|
|
If sett_reg(freq, power) Then
|
|
|
|
If td_serial_update(freq, power, dotSerial) Then
|
|
GoTo SuccessExit
|
|
Else
|
|
MsgBox("데이터 베이스에 저장하는데 오류가 발생하였습니다.", vbCritical)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
Else
|
|
MsgBox("제품 데이터를 전송하는데 오류가 발생하였습니다.", vbCritical)
|
|
GoTo FailExit
|
|
End If
|
|
|
|
|
|
Catch ex As Exception
|
|
MsgBox("오류가 발생하였습니다 : " & vbCrLf & ex.Message)
|
|
GoTo FailExit
|
|
End Try
|
|
|
|
FailExit:
|
|
nudPower.BackColor = Color.Red
|
|
nudPower.Refresh()
|
|
txbPV_SN.Focus()
|
|
Exit Sub
|
|
|
|
SuccessExit:
|
|
nudPower.BackColor = Color.Green
|
|
nudPower.Refresh()
|
|
txbPV_SN.Focus()
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub txb_tdp_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txb_tdp.KeyPress
|
|
If Not (Char.IsDigit(e.KeyChar) Or e.KeyChar = Convert.ToChar(Keys.Back) Or e.KeyChar = "." Or e.KeyChar = "-") Then
|
|
e.Handled = True
|
|
End If
|
|
|
|
If InStr(txb_tdp.Text, "-") = 1 Then
|
|
txb_tdp.MaxLength = 5
|
|
Else
|
|
txb_tdp.MaxLength = 4
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub txb_tdp_KeyDown(sender As Object, e As KeyEventArgs) Handles txb_tdp.KeyDown, txb_tdf.KeyDown, txb_area_code.KeyDown, txb_abr_code.KeyDown
|
|
Dim useText As TextBox = DirectCast(sender, TextBox)
|
|
|
|
If e.Control Then
|
|
If e.KeyCode = Keys.A Then
|
|
useText.SelectAll()
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub txb_tdf_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txb_tdf.KeyPress, txb_area_code.KeyPress, txb_abr_code.KeyPress
|
|
If Not (Char.IsDigit(e.KeyChar) Or e.KeyChar = Convert.ToChar(Keys.Back)) Then
|
|
e.Handled = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ckbNonTD_CheckedChanged(sender As Object, e As EventArgs) Handles ckbNonTD.CheckedChanged
|
|
If ckbNonTD.Checked = True Then
|
|
lb_tdf.Enabled = True
|
|
txb_tdf.Enabled = True
|
|
|
|
lb_tdp.Enabled = True
|
|
txb_tdp.Enabled = True
|
|
|
|
gbShot.Enabled = True
|
|
|
|
gpbLocal.Enabled = True
|
|
|
|
lbMode.Enabled = True
|
|
rdbV1.Enabled = True
|
|
rdbV2.Enabled = True
|
|
|
|
ManagerTDUse = True
|
|
Else
|
|
|
|
lb_tdf.Enabled = False
|
|
txb_tdf.Enabled = False
|
|
|
|
lb_tdp.Enabled = False
|
|
txb_tdp.Enabled = False
|
|
|
|
gbShot.Enabled = False
|
|
|
|
gpbLocal.Enabled = False
|
|
|
|
lbMode.Enabled = False
|
|
rdbV1.Enabled = False
|
|
rdbV2.Enabled = False
|
|
|
|
ManagerTDUse = False
|
|
End If
|
|
End Sub
|
|
End Class
|