133 lines
4.0 KiB
VB.net
133 lines
4.0 KiB
VB.net
|
|
Public Class CMaterialInOut
|
|||
|
|
Dim m_SQL As New CSQLInterface
|
|||
|
|
Public Shared cst_TABLE_NAME As String = "原料库存表"
|
|||
|
|
|
|||
|
|
'=====================新增库位库存
|
|||
|
|
Public Shared m_COLS_NAME() As String = {
|
|||
|
|
"序号",
|
|||
|
|
"入库出库",
|
|||
|
|
"料号PN",
|
|||
|
|
"订单号",
|
|||
|
|
"日期",
|
|||
|
|
"时间",
|
|||
|
|
"数量",
|
|||
|
|
"操作员ID",
|
|||
|
|
"仓库",
|
|||
|
|
"库位",
|
|||
|
|
"用途",
|
|||
|
|
"库位库存"}
|
|||
|
|
|
|||
|
|
Public Enum COLS
|
|||
|
|
序号
|
|||
|
|
入库出库
|
|||
|
|
料号PN
|
|||
|
|
订单号
|
|||
|
|
日期
|
|||
|
|
时间
|
|||
|
|
数量
|
|||
|
|
操作员ID
|
|||
|
|
仓库
|
|||
|
|
库位
|
|||
|
|
用途
|
|||
|
|
库位库存
|
|||
|
|
max
|
|||
|
|
End Enum
|
|||
|
|
|
|||
|
|
'入库或者出库标志
|
|||
|
|
Private IsOutStore As Boolean = False
|
|||
|
|
Public Property OutStore() As Boolean
|
|||
|
|
Get
|
|||
|
|
Return IsOutStore
|
|||
|
|
End Get
|
|||
|
|
Set(ByVal value As Boolean)
|
|||
|
|
IsOutStore = value
|
|||
|
|
End Set
|
|||
|
|
End Property
|
|||
|
|
|
|||
|
|
'权限
|
|||
|
|
Public Shared AccessRight As Integer = RIGHTS.NONE
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Sub New()
|
|||
|
|
IsOutStore = False
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Public Function AddItem(ByVal 入库出库 As Boolean,
|
|||
|
|
ByVal 料号PN As String,
|
|||
|
|
ByVal 订单号 As String,
|
|||
|
|
ByVal 日期 As String,
|
|||
|
|
ByVal 时间 As String,
|
|||
|
|
ByVal 数量 As Integer,
|
|||
|
|
ByVal 操作员ID As String,
|
|||
|
|
ByVal 仓库 As String,
|
|||
|
|
ByVal 库位 As String,
|
|||
|
|
ByVal 用途 As String,
|
|||
|
|
ByVal 库位库存 As Integer
|
|||
|
|
) As ERROR_CODE
|
|||
|
|
If CBool(AccessRight And RIGHTS.WRITE) = False Then
|
|||
|
|
Return ERROR_CODE.NORIGHT
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
'"INSERT INTO [dbo].[TABLE1] ([11],[22],[33],[44],[55]) VALUES ('11','2','3','4','5')"
|
|||
|
|
Dim strSql As String = "INSERT INTO `" & cst_TABLE_NAME & "` ("
|
|||
|
|
'加入列名
|
|||
|
|
Dim isFirst As Boolean = True
|
|||
|
|
For i As Integer = COLS.入库出库 To m_COLS_NAME.Length - 1
|
|||
|
|
If isFirst = True Then
|
|||
|
|
isFirst = False
|
|||
|
|
Else
|
|||
|
|
strSql &= ","
|
|||
|
|
End If
|
|||
|
|
strSql &= "`" & m_COLS_NAME(i) & "`"
|
|||
|
|
Next
|
|||
|
|
strSql &= ") VALUES ("
|
|||
|
|
strSql &= "'" & IIf(入库出库, 1, 0) & "',"
|
|||
|
|
strSql &= "'" & 料号PN & "',"
|
|||
|
|
strSql &= "'" & 订单号 & "',"
|
|||
|
|
strSql &= "'" & 日期 & "',"
|
|||
|
|
strSql &= "'" & 时间 & "',"
|
|||
|
|
strSql &= "'" & 数量 & "',"
|
|||
|
|
strSql &= "'" & 操作员ID & "',"
|
|||
|
|
strSql &= "'" & 仓库 & "',"
|
|||
|
|
strSql &= "'" & 库位 & "',"
|
|||
|
|
strSql &= "'" & 用途 & "',"
|
|||
|
|
strSql &= "'" & 库位库存 & "'"
|
|||
|
|
strSql &= ")"
|
|||
|
|
|
|||
|
|
If SQL_ExeCommand(COL_RIGHTS.原料库存管理, strSql) = True Then
|
|||
|
|
Return ERROR_CODE.SUCCESS
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Return ERROR_CODE.ACCESS
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Public Function QueryInformation(ByRef Count As Integer, ByRef minIndex As Integer, ByRef maxIndex As Integer
|
|||
|
|
) As ERROR_CODE
|
|||
|
|
If CBool(AccessRight And RIGHTS.READ) = False Then
|
|||
|
|
Return ERROR_CODE.NORIGHT
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Dim strSQL As String = "SELECT " &
|
|||
|
|
"COUNT(`" & m_COLS_NAME(COLS.序号) & "`), " &
|
|||
|
|
"MIN(`" & m_COLS_NAME(COLS.序号) & "`), " &
|
|||
|
|
"MAX(`" & m_COLS_NAME(COLS.序号) & "`) " &
|
|||
|
|
" FROM `" & cst_TABLE_NAME & "`"
|
|||
|
|
|
|||
|
|
Dim rValueTable(0) As Object
|
|||
|
|
If SQL_DataReader(COL_RIGHTS.原料库存管理, strSQL, rValueTable) = True Then
|
|||
|
|
Try
|
|||
|
|
Count = rValueTable(0)
|
|||
|
|
minIndex = rValueTable(1)
|
|||
|
|
maxIndex = rValueTable(2)
|
|||
|
|
Return ERROR_CODE.SUCCESS
|
|||
|
|
Catch ex As Exception
|
|||
|
|
|
|||
|
|
End Try
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Return ERROR_CODE.ACCESS
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
|
|||
|
|
End Class
|