316 lines
9.1 KiB
Plaintext
316 lines
9.1 KiB
Plaintext
Imports System
|
|
Imports System.Data
|
|
Imports System.Data.SqlClient
|
|
Imports System.IO
|
|
Imports System.Security
|
|
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
Public Class Mounting
|
|
Private _date As DateTime
|
|
Private _sequence As String
|
|
Private _revision As String
|
|
Private _feeder As String
|
|
Private _partNo As String
|
|
Private _quantity As Double
|
|
Private _lotNumber As String
|
|
Private _operator As String
|
|
Private _verify As Integer
|
|
Private _3pL As String
|
|
Private cnstr As String
|
|
Private _sequenceno As String
|
|
Private _lblserial As String
|
|
|
|
Public Property mDate() As DateTime
|
|
Get
|
|
Return _date
|
|
End Get
|
|
Set(ByVal value As DateTime)
|
|
_date = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property machine() As String
|
|
Get
|
|
Return _sequence
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_sequence = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
|
|
Public Property lblserial() As String
|
|
Get
|
|
Return _lblserial
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_lblserial = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Public Property sequenceno() As String
|
|
Get
|
|
Return _sequenceno
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_sequenceno = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property revision() As String
|
|
Get
|
|
Return _revision
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_revision = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property feeder() As String
|
|
Get
|
|
Return _feeder
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_feeder = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partno() As String
|
|
Get
|
|
Return _partNo
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_partNo = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property quantity() As Double
|
|
Get
|
|
Return _quantity
|
|
End Get
|
|
Set(ByVal value As Double)
|
|
_quantity = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property lotNumber As String
|
|
Get
|
|
Return _lotNumber
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_lotNumber = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property mOperator() As String
|
|
Get
|
|
Return _operator
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_operator = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property verify() As Integer
|
|
Get
|
|
Return _verify
|
|
End Get
|
|
Set(ByVal value As Integer)
|
|
_verify = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property threePL() As String
|
|
Get
|
|
Return _3pL
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_3pL = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub New()
|
|
cnstr = mainForm.cnstr
|
|
End Sub
|
|
|
|
Public Sub add(ByVal reload As Boolean, ByVal qacheck As Boolean, ByVal status As Boolean)
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim active As Integer = 0
|
|
|
|
Dim myQuery As String
|
|
Dim myStatus As String = ""
|
|
|
|
If status = False Then
|
|
myStatus = "fail"
|
|
Else
|
|
myStatus = "pass"
|
|
End If
|
|
|
|
|
|
If qacheck Then
|
|
myQuery = "INSERT INTO kmounting VALUES (" & _
|
|
"'" & Me.mDate & "'," & _
|
|
"'" & Me.machine & "'," & _
|
|
"'" & Me.revision & "'," & _
|
|
"'" & Me.feeder & "'," & _
|
|
"'" & Me.partno & "'," & _
|
|
Me.quantity & "," & _
|
|
"'" & Me.lotNumber & "'," & _
|
|
"'" & Me.mOperator & "'," & _
|
|
Me.verify & "," & _
|
|
"'qa-" & myStatus & "'," & _
|
|
"'" & Me.sequenceno & "'," & _
|
|
"'" & Me.lblserial & "')"
|
|
Else
|
|
If reload Then
|
|
myQuery = "INSERT INTO kmounting VALUES (" & _
|
|
"'" & Me.mDate & "'," & _
|
|
"'" & Me.machine & "'," & _
|
|
"'" & Me.revision & "'," & _
|
|
"'" & Me.feeder & "'," & _
|
|
"'" & Me.partno & "'," & _
|
|
Me.quantity & "," & _
|
|
"'" & Me.lotNumber & "'," & _
|
|
"'" & Me.mOperator & "'," & _
|
|
Me.verify & "," & _
|
|
"'reload-" & myStatus & "'," & _
|
|
"'" & Me.sequenceno & "'," & _
|
|
"'" & Me.lblserial & "')"
|
|
Else
|
|
myQuery = "INSERT INTO kmounting VALUES (" & _
|
|
"'" & Me.mDate & "'," & _
|
|
"'" & Me.machine & "'," & _
|
|
"'" & Me.revision & "'," & _
|
|
"'" & Me.feeder & "'," & _
|
|
"'" & Me.partno & "'," & _
|
|
Me.quantity & "," & _
|
|
"'" & Me.lotNumber & "'," & _
|
|
"'" & Me.mOperator & "'," & _
|
|
Me.verify & "," & _
|
|
"'op-" & myStatus & "'," & _
|
|
"'" & Me.sequenceno & "'," & _
|
|
"'" & Me.lblserial & "')"
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
Dim mycommand As SqlCommand
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
|
|
Try
|
|
conn.Open()
|
|
mycommand.ExecuteNonQuery()
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
End Sub
|
|
|
|
Public Sub add_hist(ByVal reload As Boolean, ByVal qacheck As Boolean, ByVal status As Boolean)
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim active As Integer = 0
|
|
|
|
Dim myQuery As String
|
|
Dim myStatus As String = ""
|
|
|
|
If status = False Then
|
|
myStatus = "-fail"
|
|
End If
|
|
|
|
If reload = True And qacheck = False Then
|
|
myQuery = "INSERT INTO kmounting_hist VALUES (" & _
|
|
"'" & Me.mDate & "'," & _
|
|
"'" & Me.machine & "'," & _
|
|
"'" & Me.revision & "'," & _
|
|
"'" & Me.feeder & "'," & _
|
|
"'" & Me.partno & "'," & _
|
|
Me.quantity & "," & _
|
|
"'" & Me.lotNumber & "'," & _
|
|
"'" & Me.mOperator & "'," & _
|
|
Me.verify & "," & _
|
|
"'reload" & myStatus & "')"
|
|
ElseIf reload = False And qacheck = True Then
|
|
myQuery = "INSERT INTO kmounting_hist VALUES (" & _
|
|
"'" & Me.mDate & "'," & _
|
|
"'" & Me.machine & "'," & _
|
|
"'" & Me.revision & "'," & _
|
|
"'" & Me.feeder & "'," & _
|
|
"'" & Me.partno & "'," & _
|
|
"0," & _
|
|
"''," & _
|
|
"'" & Me.mOperator & "'," & _
|
|
Me.verify & "," & _
|
|
"'check" & myStatus & "')"
|
|
Else
|
|
myQuery = "INSERT INTO kmounting_hist VALUES (" & _
|
|
"'" & Me.mDate & "'," & _
|
|
"'" & Me.machine & "'," & _
|
|
"'" & Me.revision & "'," & _
|
|
"'" & Me.feeder & "'," & _
|
|
"'" & Me.partno & "'," & _
|
|
Me.quantity & "," & _
|
|
"'" & Me.lotNumber & "'," & _
|
|
"'" & Me.mOperator & "'," & _
|
|
Me.verify & "," & _
|
|
"'" & Me.threePL & myStatus & "')"
|
|
End If
|
|
|
|
|
|
Dim mycommand As SqlCommand
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
|
|
Try
|
|
conn.Open()
|
|
mycommand.ExecuteNonQuery()
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
End Sub
|
|
|
|
Public Sub addSettings(ByVal line As String, ByVal ksequence As String)
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim active As Integer = 0
|
|
|
|
Dim myQuery As String
|
|
Dim myStatus As String = ""
|
|
|
|
myQuery = "SELECT * from KSETTINGS WHERE line = '" & line & "'"
|
|
|
|
Dim mycommand As SqlCommand
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
|
|
Try
|
|
conn.Open()
|
|
Dim reader = mycommand.ExecuteReader
|
|
If reader.HasRows Then
|
|
reader.Close()
|
|
myQuery = "UPDATE KSETTINGS SET ksequence = '" & ksequence & "' WHERE line = '" & line & "'"
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
mycommand.ExecuteNonQuery()
|
|
Else
|
|
reader.Close()
|
|
myQuery = "INSERT INTO KSETTINGS(line,ksequence) VALUES(" & line & ",'" & ksequence & "')"
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
mycommand.ExecuteNonQuery()
|
|
End If
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
|
|
End Class
|