319 lines
8.4 KiB
Plaintext
319 lines
8.4 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 PartsRecords
|
|
Private _serialnum As String
|
|
Private _ionicspn As String
|
|
Private _epsonpn As String
|
|
Private _supplierpn As String
|
|
Private _description As String
|
|
Private _lotno As String
|
|
Private _rack As String
|
|
Private _qty As Integer
|
|
Private _status As String
|
|
Private _mfgdate As DateTime
|
|
Private _rcvdate As DateTime
|
|
Private _printeddate As DateTime
|
|
Private _printedby As String
|
|
Private _exist As Boolean
|
|
Private _remarks As String
|
|
Private cnstr As String
|
|
#Region "Properties"
|
|
|
|
Public Property SerialNum As String
|
|
Get
|
|
Return _serialnum
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_serialnum = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property IonicsPN As String
|
|
Get
|
|
Return _ionicspn
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_ionicspn = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property EpsonPN As String
|
|
Get
|
|
Return _epsonpn
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_epsonpn = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property SupplierPN As String
|
|
Get
|
|
Return _supplierpn
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_supplierpn = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Description As String
|
|
Get
|
|
Return _description
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_description = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property LotNo As String
|
|
Get
|
|
Return _lotno
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_lotno = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Rack As String
|
|
Get
|
|
Return _rack
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_rack = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Quantity As Integer
|
|
Get
|
|
Return _qty
|
|
End Get
|
|
Set(ByVal value As Integer)
|
|
_qty = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Status As String
|
|
Get
|
|
Return _status
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_status = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MFGDate As DateTime
|
|
Get
|
|
Return _mfgdate
|
|
End Get
|
|
Set(ByVal value As DateTime)
|
|
_mfgdate = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property RCVDate As DateTime
|
|
Get
|
|
Return _rcvdate
|
|
End Get
|
|
Set(ByVal value As DateTime)
|
|
_rcvdate = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property PrintedDate As DateTime
|
|
Get
|
|
Return _printeddate
|
|
End Get
|
|
Set(ByVal value As DateTime)
|
|
_printeddate = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property PrintedBy As String
|
|
Get
|
|
Return _printedby
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_printedby = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Remarks As String
|
|
Get
|
|
Return _remarks
|
|
End Get
|
|
Set(ByVal value As String)
|
|
_remarks = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Exist As Boolean
|
|
Get
|
|
Return _exist
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
_exist = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
#Region "Methods"
|
|
|
|
Public Sub New()
|
|
cnstr = mainForm.cnstr
|
|
End Sub
|
|
|
|
Public Sub New(ByVal serial As String)
|
|
cnstr = mainForm.cnstr
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim myQuery As String
|
|
|
|
myQuery = "SELECT * from PartsRecords WHERE SerialNum = '" & serial & "'"
|
|
|
|
Dim mycommand As SqlCommand
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
Try
|
|
conn.Open()
|
|
|
|
Dim reader = mycommand.ExecuteReader
|
|
If reader.HasRows Then
|
|
reader.Read()
|
|
SerialNum = reader("SerialNum")
|
|
IonicsPN = reader("IonicsPN")
|
|
EpsonPN = reader("EpsonPN")
|
|
SupplierPN = reader("SupplierPN")
|
|
Description = reader("Description")
|
|
LotNo = reader("LotNo")
|
|
Rack = reader("Rack")
|
|
Quantity = reader("Qty")
|
|
Status = reader("Status")
|
|
MFGDate = reader("MFGDate")
|
|
RCVDate = reader("RCVDate")
|
|
PrintedDate = reader("PrintedDate")
|
|
PrintedBy = reader("PrintedBy")
|
|
Remarks = reader("Remarks")
|
|
Exist = True
|
|
Else
|
|
Exist = False
|
|
End If
|
|
reader.Close()
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
End Sub
|
|
|
|
Public Function issue(ByVal serial As String, ByVal pn As String, ByVal dval As DateTime)
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim myQuery As String
|
|
Dim success As Boolean = False
|
|
|
|
|
|
Dim mycommand As SqlCommand
|
|
myQuery = "SELECT * from PartsRecords WHERE IonicsPN = '" & pn & "' AND Status = 'WHS' AND MFGDate < '" & dval & "'"
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
Try
|
|
conn.Open()
|
|
Dim reader = mycommand.ExecuteReader
|
|
If reader.HasRows Then
|
|
reader.Close()
|
|
Else
|
|
reader.Close()
|
|
myQuery = "UPDATE PartsRecords SET Status = 'PDN' WHERE SerialNum = '" & serial & "'"
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
mycommand.ExecuteNonQuery()
|
|
success = True
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
|
|
Return success
|
|
End Function
|
|
|
|
Public Function issue2(ByVal serial As String, ByVal pn As String, ByVal dval As DateTime)
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim myQuery As String
|
|
Dim success As Boolean = True
|
|
|
|
|
|
Dim mycommand As SqlCommand
|
|
Try
|
|
conn.Open()
|
|
myQuery = "UPDATE PartsRecords SET Status = 'PDN' WHERE SerialNum = '" & serial & "'"
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
mycommand.ExecuteNonQuery()
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
|
|
Return success
|
|
End Function
|
|
|
|
Public Function updateStatus(ByVal serial As String, ByVal status As String, ByVal remarks As String)
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim myQuery As String
|
|
Dim success As Boolean = False
|
|
|
|
|
|
Dim mycommand As SqlCommand
|
|
|
|
Try
|
|
conn.Open()
|
|
myQuery = "UPDATE PartsRecords SET Status = '" & status & "', Remarks = '" & remarks & "' WHERE SerialNum = '" & serial & "'"
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
mycommand.ExecuteNonQuery()
|
|
success = True
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
|
|
Return success
|
|
End Function
|
|
|
|
Public Function mount(ByVal serial As String)
|
|
Dim conn As New SqlConnection(cnstr)
|
|
Dim myQuery As String
|
|
Dim success As Boolean = False
|
|
|
|
|
|
Dim mycommand As SqlCommand
|
|
Try
|
|
conn.Open()
|
|
myQuery = "UPDATE PartsRecords SET Status = 'SMT' WHERE SerialNum = '" & serial & "'"
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
mycommand.ExecuteNonQuery()
|
|
success = True
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
|
|
Return success
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
End Class
|