仓库管理系统源代码数据库实训 第7页
list2.TextMatrix(0, 2) = "领料人"
list2.TextMatrix(0, 3) = "出库日期"
list2.TextMatrix(0, 4) = "编号"
End Sub
Private Sub list1def() '将list1的表头初始化
list1.TextMatrix(0, 0) = "品名"
list1.TextMatrix(0, 1) = "规格"
list1.TextMatrix(0, 2) = "导电"
list1.TextMatrix(0, 3) = "硬度"
list1.TextMatrix(0, 4) = "数量"
list1.TextMatrix(0, 5) = "单位"
list1.TextMatrix(0, 6) = "入料日期"
End Sub
Private Sub option1def() '按option1屏蔽补充出库信息项
list2.Enabled = False
Frame6.Enabled = False
Frame5.Enabled = False
End Sub
Private Sub option2def() '按option2打开补充出库信息项
list2.Enabled = True
Frame6.Enabled = True
Frame5.Enabled = True
End Sub
Private Sub clearzore() '将数据项初始化
For i = 0 To 16
Text1(i).Text = ""
Text1(i).BackColor = &HFFC0C0
Next i
Option1.Value = True
rk = "初次入库"
End Sub
Private Sub list2disp()
Dim roww As Integer ''行
list2.Clear
Call list2def
roww = 1
list2.rows = 1
outstorehouse.RecordSource = "select * from outstorehouse where 品名 ='" + Trim(Text1(11).Text) + _
"' and 规格 ='" + Trim(Text1(12).Text) + "'"
outstorehouse.Refresh
If outstorehouse.Recordset.EOF = True Then
list2.Enabled = False '屏蔽list2的单击事件
Exit Sub
Else
list2.Enabled = True
End If
outstorehouse.Recordset.MoveFirst
Do While outstorehouse.Recordset.EOF = False
list2.rows = list2.rows + 1
list2.TextMatrix(roww, 0) = outstorehouse.Recordset.Fields(0)
list2.TextMatrix(roww, 1) = outstorehouse.Recordset.Fields(1)
list2.TextMatrix(roww, 2) = outstorehouse.Recordset.Fields(7)
list2.TextMatrix(roww, 3) = outstorehouse.Recordset.Fields(6)
list2.TextMatrix(roww, 4) = outstorehouse.Recordset.Fields(11)
roww = roww + 1
outstorehouse.Recordset.MoveNext
Loop
reccount = outstorehouse.Recordset.RecordCount
End Sub
Private Sub list1disp()
Dim roww As Integer ''行
roww = 1
list1.Clear
list1.rows = 1
Call list1def
instorehouse.RecordSource = "instorehouse"
instorehouse.Refresh
If instorehouse.Recordset.EOF = False Then
instorehouse.Recordset.MoveFirst
End If
Do While instorehouse.Recordset.EOF = False
list1.rows = list1.rows + 1
list1.TextMatrix(roww, 0) = instorehouse.Recordset.Fields(0)
list1.TextMatrix(roww, 1) = instorehouse.Recordset.Fields(1)
list1.TextMatrix(roww, 2) = instorehouse.Recordset.Fields(2)
list1.TextMatrix(roww, 3) = instorehouse.Recordset.Fields(3)
list1.TextMatrix(roww, 4) = instorehouse.Recordset.Fields(4)
list1.TextMatrix(roww, 5) = instorehouse.Recordset.Fields(5)
list1.TextMatrix(roww, 6) = instorehouse.Recordset.Fields(6)
roww = roww + 1
instorehouse.Recordset.MoveNext
Loop
End Sub
5.2.5出库界面设置
图5.5出库界面设置
与出库界面相关的代码
Private Sub Command1_Click()
Dim YesNo As String
'-------------------------------判断输入----------------------------
If Trim(Text1(0).Text) = "" Or Trim(Text1(1).Text) = "" Then '当不要补充出库的信息时
MsgBox ("品名与规格不能为空!")
Text1(0).SetFocus
Exit Sub
End If
If Trim(Text1(8).Text) = "" Then
MsgBox ("请输入领料人!")
Text1(7).SetFocus
Exit Sub
End If
If IsNumeric(Text1(4)) = False Then '判断数量是否为数值
MsgBox ("你输入的数量有误,请输入数值!")
Text1(4).Text = ""
Text1(4).SetFocus
Exit Sub
End If
'---------------------------------------------------------------------
'-------------------------修改库存中的信息----------------------------
stock.RecordSource = "select * from stock where 品名='" + Trim(Text1(0)) + "' and 规格='" + Trim(Text1(1)) + "'"
stock.Refresh
If stock.Recordset.EOF = True Then
MsgBox ("仓库中无此物品,请采购!")
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0).Text)
Text1(0).SetFocus
Exit Sub
Else '存在此物,判断它的数量值
With stock.Recordset
If .Fields(4) < Val(Text1(4)) And .Fields(4) <> 0 Then
YesNo = MsgBox("数量超出库存数量【" + Trim(Str(.Fields(4))) + "】是否全取!", vbYesNo)
'------------------- '根据操作来进行操作
If YesNo = "6" Then
temp = .Fields(4)
.Fields(4) = 0
.Update
'给出库加信息
outstorehouse.RecordSource = "outstorehouse"
outstorehouse.Refresh
With outstorehouse.Recordset
.AddNew
.Fields(0) = Text1(0)
.Fields(1) = Text1(1)
.Fields(2) = Text1(2)
.Fields(3) = Text1(3)
.Fields(4) = temp
.Fields(5) = Text1(5)
.Fields(6) = Date
.Fields(7) = Text1(7)
.Fields(8) = Text1(8)
.Fields(9) = Text1(9)
.Fields(10) = Text1(10)
.Update
End With
Call list1disp
Call Command2_Click
'------------------------------
Else
Text1(4).SelStart = 0
Text1(4).SelLength = Len(Text1(4))
Text1(4).SetFocus
Exit Sub