415 lines
15 KiB
VB.net
415 lines
15 KiB
VB.net
Imports System.Text
|
|
|
|
Public Class NewKitting
|
|
|
|
Private Sub NewKitting_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
|
Me.MdiParent = mainForm
|
|
Control.CheckForIllegalCrossThreadCalls = False
|
|
getLines()
|
|
End Sub
|
|
|
|
Private Sub cmbLine_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbLine.SelectedIndexChanged
|
|
cmbModel.Enabled = True
|
|
getModels()
|
|
End Sub
|
|
|
|
Private Sub cmbModel_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbModel.SelectedIndexChanged
|
|
cmbType.Enabled = True
|
|
getTypes()
|
|
End Sub
|
|
|
|
Private Sub cmbType_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbType.SelectedIndexChanged
|
|
cmbRev.Enabled = True
|
|
getRevisions()
|
|
End Sub
|
|
|
|
Private Sub cmbRev_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbRev.SelectedIndexChanged
|
|
If (cmbRev.Text = "") Then
|
|
cmbRev.Focus()
|
|
Else
|
|
cmbSeq.Enabled = True
|
|
getSequence()
|
|
|
|
Dim seq As New Sequence
|
|
txtSerial.Enabled = True
|
|
txtSerial.Focus()
|
|
ClearButton.Enabled = True
|
|
'Dim feederval() As String
|
|
'feederval = cmbSeq.Text.Split("-")
|
|
'PartLabel.Text = seq.getPartno(cmbSeq.SelectedItem, feederval(0), feederval(1)
|
|
cmbModel.Enabled = False
|
|
cmbType.Enabled = False
|
|
cmbRev.Enabled = False
|
|
cmbSeq.Enabled = False
|
|
cmbLine.Enabled = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub cmbSeq_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)
|
|
'cmbFeeder.Enabled = True
|
|
'getFeeder()
|
|
|
|
'If (cmbSeq.Text = "") Then
|
|
' cmbSeq.Focus()
|
|
'Else
|
|
' Dim seq As New Sequence
|
|
' txtSerial.Enabled = True
|
|
' txtSerial.Focus()
|
|
' ClearButton.Enabled = True
|
|
' 'Dim feederval() As String
|
|
' 'feederval = cmbSeq.Text.Split("-")
|
|
' 'PartLabel.Text = seq.getPartno(cmbSeq.SelectedItem, feederval(0), feederval(1)
|
|
' cmbModel.Enabled = False
|
|
' cmbType.Enabled = False
|
|
' cmbRev.Enabled = False
|
|
' cmbSeq.Enabled = False
|
|
' cmbLine.Enabled = False
|
|
'End If
|
|
End Sub
|
|
|
|
Public Sub getLines()
|
|
Dim rev As New Sequence
|
|
Dim revList As New List(Of String)
|
|
Dim i As Integer = 0
|
|
|
|
revList = rev.getLines("Toshiba")
|
|
cmbLine.Items.Clear()
|
|
While i < revList.Count
|
|
cmbLine.Items.Add(revList(i))
|
|
i = i + 1
|
|
End While
|
|
End Sub
|
|
|
|
Public Sub getModels()
|
|
Dim rev As New Sequence
|
|
Dim revList As New List(Of String)
|
|
Dim i As Integer = 0
|
|
|
|
revList = rev.getModel("Toshiba", cmbLine.SelectedItem)
|
|
cmbModel.Items.Clear()
|
|
While i < revList.Count
|
|
cmbModel.Items.Add(revList(i))
|
|
i = i + 1
|
|
End While
|
|
End Sub
|
|
|
|
Public Sub getTypes()
|
|
Dim rev As New Sequence
|
|
Dim revList As New List(Of String)
|
|
Dim i As Integer = 0
|
|
|
|
revList = rev.getTypes("Toshiba", cmbLine.SelectedItem, cmbModel.SelectedItem)
|
|
cmbType.Items.Clear()
|
|
While i < revList.Count
|
|
cmbType.Items.Add(revList(i))
|
|
i = i + 1
|
|
End While
|
|
End Sub
|
|
|
|
Public Sub getRevisions()
|
|
Dim rev As New Sequence
|
|
Dim revList As New List(Of String)
|
|
Dim i As Integer = 0
|
|
|
|
revList = rev.getRevisions("Toshiba", cmbLine.SelectedItem, cmbModel.SelectedItem, cmbType.SelectedItem)
|
|
cmbRev.Items.Clear()
|
|
While i < revList.Count
|
|
cmbRev.Items.Add(revList(i))
|
|
i = i + 1
|
|
End While
|
|
End Sub
|
|
|
|
Public Sub getSequence()
|
|
Dim rev As New Sequence
|
|
Dim revList As String = ""
|
|
Dim i As Integer = 0
|
|
|
|
revList = rev.getSeq("Toshiba", cmbLine.SelectedItem, cmbModel.SelectedItem, cmbType.SelectedItem, cmbRev.SelectedItem)
|
|
cmbSeq.Clear()
|
|
'While i < revList.Count
|
|
'cmbSeq.Items.Add(revList(i))
|
|
cmbSeq.Text = revList
|
|
i = i + 1
|
|
'End While
|
|
'cmbSeq.SelectedIndex = 0
|
|
End Sub
|
|
|
|
'Public Sub getFeeder()
|
|
' Dim rev As New Sequence
|
|
' Dim revList As New List(Of String)
|
|
' Dim i As Integer = 0
|
|
|
|
' revList = rev.getFeederno(cmbSeq.SelectedItem)
|
|
' cmbFeeder.Items.Clear()
|
|
' While i < revList.Count
|
|
' cmbFeeder.Items.Add(revList(i))
|
|
' i = i + 1
|
|
' End While
|
|
'End Sub
|
|
|
|
|
|
|
|
Private Sub btnReset_Click(sender As System.Object, e As System.EventArgs) Handles btnReset.Click
|
|
cmbLine.SelectedIndex = -1
|
|
getLines()
|
|
cmbModel.SelectedIndex = -1
|
|
cmbType.SelectedIndex = -1
|
|
cmbRev.SelectedIndex = -1
|
|
'cmbSeq.SelectedIndex = -1
|
|
cmbSeq.Text = ""
|
|
'cmbFeeder.SelectedIndex = -1
|
|
txtSerial.Text = ""
|
|
txtPN.Text = ""
|
|
txtDesc.Text = ""
|
|
txtLot.Text = ""
|
|
txtQuantity.Text = ""
|
|
txtMC.Text = ""
|
|
SupplierTextBox.Text = ""
|
|
lblStatus.Text = ""
|
|
|
|
'lblMFGDate.Text = parts.MFGDate
|
|
'lblRCVDate.Text = parts.RCVDate
|
|
lblPDate.Text = ""
|
|
lblBy.Text = ""
|
|
lblFam.Text = ""
|
|
txtMC.Text = ""
|
|
btnKit.Enabled = False
|
|
cmbLine.Enabled = True
|
|
cmbModel.Enabled = False
|
|
cmbType.Enabled = False
|
|
cmbRev.Enabled = False
|
|
cmbSeq.Enabled = False
|
|
txtSerial.Enabled = False
|
|
ClearButton.Enabled = False
|
|
'cmbFeeder.Enabled = False
|
|
txtfinalSerial.Text = ""
|
|
StatusPanel.BackColor = Color.Transparent
|
|
statuslabel.Text = "IDLE"
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub btnIssue_Click(sender As System.Object, e As System.EventArgs) Handles btnKit.Click
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub txtSerial_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtSerial.KeyPress
|
|
If Asc(e.KeyChar) = 13 Then
|
|
StatusPanel.BackColor = Color.Transparent
|
|
statuslabel.Text = "IDLE"
|
|
Dim fChar As String = String.Empty
|
|
Dim entry As String = txtSerial.Text
|
|
fChar = Mid(entry, 1, 1)
|
|
If (txtSerial.Text <> "") Then
|
|
|
|
If entry.Contains("*") Then
|
|
Dim str() As String
|
|
txtFeeder.Text = entry.Replace("*", "")
|
|
str = Split(txtFeeder.Text, "-")
|
|
Dim seq As New Sequence
|
|
Try
|
|
PartLabel.Text = seq.Part(cmbSeq.Text, str(0), str(1))
|
|
Catch ex As Exception
|
|
StatusPanel.BackColor = Color.Red
|
|
statuslabel.Text = "FEEDER NOT EXIST"
|
|
clear()
|
|
End Try
|
|
|
|
txtSerial.Text = String.Empty
|
|
txtSerial.Focus()
|
|
ElseIf fChar = "@" Then
|
|
txtOperator.Text = Mid(entry, 2, Len(entry))
|
|
txtSerial.Text = String.Empty
|
|
txtSerial.Focus()
|
|
Else
|
|
If (txtSerial.TextLength = 10 Or txtSerial.TextLength = 13) Then
|
|
|
|
|
|
If Not entry.StartsWith("LA") Then
|
|
|
|
txtSerial.Text = entry.Substring(0, 10)
|
|
Else
|
|
|
|
txtSerial.Text = entry
|
|
End If
|
|
|
|
Dim parts = New PartsRecords(txtSerial.Text)
|
|
If parts.Exist Then
|
|
txtPN.Text = parts.IonicsPN
|
|
txtDesc.Text = parts.Description
|
|
txtLot.Text = parts.LotNo
|
|
'txtLot.Text = parts.Rack
|
|
txtQuantity.Text = parts.Quantity
|
|
SupplierTextBox.Text = parts.SupplierPN
|
|
lblStatus.Text = parts.Status
|
|
'lblMFGDate.Text = parts.MFGDate
|
|
'lblRCVDate.Text = parts.RCVDate
|
|
lblPDate.Text = parts.PrintedDate
|
|
lblBy.Text = parts.PrintedBy
|
|
lblFam.Text = parts.Family
|
|
txtMC.Text = parts.MakerCode
|
|
txtfinalSerial.Text = txtSerial.Text
|
|
|
|
|
|
txtSerial.Text = ""
|
|
Else
|
|
StatusPanel.BackColor = Color.Red
|
|
statuslabel.Text = "DID NOT EXIST"
|
|
clear()
|
|
End If
|
|
Else
|
|
StatusPanel.BackColor = Color.Red
|
|
statuslabel.Text = "DID NOT EXIST"
|
|
clear()
|
|
End If
|
|
txtSerial.Text = ""
|
|
txtSerial.Focus()
|
|
End If
|
|
|
|
If (txtOperator.Text <> "" And txtFeeder.Text <> "" And txtfinalSerial.Text <> "") Then
|
|
|
|
If (txtPN.Text = PartLabel.Text) Then
|
|
|
|
If (lblStatus.Text = "WHS") Then
|
|
|
|
If (lblFam.Text.Trim() = "Enterprise") Then
|
|
|
|
'Dim csvFilePath1 As String = "\\192.168.1.54\Material ID-Toshiba\" & txtfinalSerial.Text & ".csv"
|
|
Dim csvFilePath1 As String = "C:\Users\rito.balaquiao\Desktop\sample log\New folder\" & txtfinalSerial.Text & ".csv"
|
|
Dim outFile1 As IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(csvFilePath1, False, Encoding.ASCII)
|
|
outFile1.WriteLine(txtfinalSerial.Text + "," + txtPN.Text + "," + SupplierTextBox.Text + "," + txtLot.Text + "," + txtDesc.Text.Trim() + "," + txtMC.Text + "," + " " + "," + " " + "," + " " + "," + txtQuantity.Text)
|
|
outFile1.Close()
|
|
|
|
'Dim csvFilePath3 As String = "\\192.168.1.81\Shared\MaterialID\" & txtfinalSerial.Text & ".csv"
|
|
Dim csvFilePath3 As String = "C:\Users\rito.balaquiao\Desktop\sample log\New folder (2)\" & txtfinalSerial.Text & ".csv"
|
|
Dim outFile3 As IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(csvFilePath3, False, Encoding.ASCII)
|
|
outFile3.WriteLine(txtfinalSerial.Text + "," + txtPN.Text + "," + SupplierTextBox.Text + "," + txtLot.Text + "," + txtDesc.Text.Trim() + "," + txtMC.Text + "," + " " + "," + " " + "," + " " + "," + txtQuantity.Text)
|
|
outFile3.Close()
|
|
End If
|
|
|
|
Dim parts = New PartsRecords()
|
|
|
|
parts.issue3(txtfinalSerial.Text, txtPN.Text, DateTime.Parse(lblPDate.Text), loginForm.username, cmbLine.SelectedItem.ToString, cmbRev.SelectedItem.ToString, txtOperator.Text)
|
|
|
|
|
|
btnKit.Enabled = True
|
|
StatusPanel.BackColor = Color.Green
|
|
statuslabel.Text = "PASS"
|
|
MessageBox.Show("Parts Successfully Kit.", "Success")
|
|
clear2()
|
|
|
|
ElseIf (lblStatus.Text = "PDN") Then
|
|
StatusPanel.BackColor = Color.Red
|
|
statuslabel.Text = "PARTNO ALREADY ISSUED"
|
|
ElseIf (lblStatus.Text = "SMT") Then
|
|
StatusPanel.BackColor = Color.Red
|
|
statuslabel.Text = "PARTNO ALREADY MOUNTED"
|
|
End If
|
|
Else
|
|
StatusPanel.BackColor = Color.Red
|
|
statuslabel.Text = "PARTNO NOT EQUAL"
|
|
End If
|
|
|
|
End If
|
|
Else
|
|
txtSerial.Text = ""
|
|
txtSerial.Focus()
|
|
End If
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles ClearButton.Click
|
|
txtSerial.Text = ""
|
|
txtPN.Text = ""
|
|
txtDesc.Text = ""
|
|
txtLot.Text = ""
|
|
txtQuantity.Text = ""
|
|
txtMC.Text = ""
|
|
SupplierTextBox.Text = ""
|
|
lblStatus.Text = ""
|
|
'lblMFGDate.Text = parts.MFGDate
|
|
'lblRCVDate.Text = parts.RCVDate
|
|
lblPDate.Text = ""
|
|
lblBy.Text = ""
|
|
lblFam.Text = ""
|
|
txtMC.Text = ""
|
|
txtSerial.Enabled = True
|
|
txtSerial.Focus()
|
|
txtfinalSerial.Text = ""
|
|
txtOperator.Text = ""
|
|
txtFeeder.Text = ""
|
|
btnKit.Enabled = False
|
|
StatusPanel.BackColor = Color.Transparent
|
|
statuslabel.Text = "IDLE"
|
|
End Sub
|
|
|
|
Private Sub clear()
|
|
txtSerial.Text = ""
|
|
txtPN.Text = ""
|
|
txtDesc.Text = ""
|
|
txtLot.Text = ""
|
|
txtQuantity.Text = ""
|
|
txtMC.Text = ""
|
|
SupplierTextBox.Text = ""
|
|
lblStatus.Text = ""
|
|
'lblMFGDate.Text = parts.MFGDate
|
|
'lblRCVDate.Text = parts.RCVDate
|
|
lblPDate.Text = ""
|
|
lblBy.Text = ""
|
|
lblFam.Text = ""
|
|
txtMC.Text = ""
|
|
txtSerial.Enabled = True
|
|
txtSerial.Focus()
|
|
txtfinalSerial.Text = ""
|
|
btnKit.Enabled = False
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub clear2()
|
|
txtSerial.Text = ""
|
|
txtPN.Text = ""
|
|
txtDesc.Text = ""
|
|
txtLot.Text = ""
|
|
txtQuantity.Text = ""
|
|
txtMC.Text = ""
|
|
SupplierTextBox.Text = ""
|
|
lblStatus.Text = ""
|
|
'lblMFGDate.Text = parts.MFGDate
|
|
'lblRCVDate.Text = parts.RCVDate
|
|
lblPDate.Text = ""
|
|
lblBy.Text = ""
|
|
lblFam.Text = ""
|
|
txtMC.Text = ""
|
|
txtSerial.Enabled = True
|
|
txtSerial.Focus()
|
|
txtfinalSerial.Text = ""
|
|
btnKit.Enabled = False
|
|
txtFeeder.Text = ""
|
|
txtOperator.Text = ""
|
|
PartLabel.Text = ""
|
|
|
|
End Sub
|
|
'Private Sub cmbFeeder_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbFeeder.SelectedIndexChanged
|
|
' If (cmbFeeder.Text = "") Then
|
|
' cmbFeeder.Focus()
|
|
' Else
|
|
' Dim seq As New Sequence
|
|
' txtSerial.Enabled = True
|
|
' txtSerial.Focus()
|
|
' ClearButton.Enabled = True
|
|
' Dim feederval() As String
|
|
' feederval = cmbFeeder.Text.Split("-")
|
|
' PartLabel.Text = seq.getPartno(cmbSeq.SelectedItem, feederval(0), feederval(1))
|
|
|
|
' End If
|
|
'End Sub
|
|
|
|
|
|
Private Sub NewKitting_Click(sender As System.Object, e As System.EventArgs) Handles MyBase.Click
|
|
txtSerial.Focus()
|
|
End Sub
|
|
End Class |