📄 instorehouse.frm
字号:
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "出库表"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc instorehouse
Height = 375
Left = 600
Top = 7920
Width = 2295
_ExtentX = 4048
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "进库表"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "FrmInstorehouse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rk As String '入库的类型
Public reccount As Integer '记录条数
Public row1 As Integer '单击list2时返回的行数
Private Sub Command1_Click() '补充数据
'判断输入的数据是否都为空
'-----------------------------------------------补充出库信息 --------------------------
If Trim(Text1(13)) <> "" Or Trim(Text1(14)) <> "" Or Trim(Text1(15)) <> "" Or Trim(Text1(16)) <> "" Then
outstorehouse.RecordSource = "select * from outstorehouse where 编号=" + list2.TextMatrix(row1, 4)
outstorehouse.Refresh
With outstorehouse.Recordset
.Fields(8) = Text1(13)
.Fields(9) = Text1(14)
.Fields(10) = Text1(15)
.Fields(11) = Text1(16)
.Update
End With
Call Command2_Click
Command1.Enabled = False
Else
MsgBox ("请输入数据!")
End If
'---------------------------------------------
End Sub
Private Sub Command2_Click() '补充出库信息时的数据清零
For i = 13 To 16
Text1(i).Text = ""
Next i
End Sub
Private Sub Command3_Click() '按确定按钮
'-------------------------------判断输入----------------------------
If Option2.Value = False Then
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
Else
If Trim(Text1(0).Text) = "" Or Trim(Text1(1).Text) = "" Then '入库的关键信息
MsgBox ("品名与规格不能为空!")
Text1(0).SetFocus
Exit Sub
End If
If Trim(Text1(11).Text) = "" Or Trim(Text1(12).Text) = "" Then '当要补充出库的信息时
MsgBox ("品名与规格不能为空!")
Text1(11).SetFocus
Exit Sub
End If
If Trim(Text1(8).Text) = "" Then
MsgBox ("请输入领料人!")
Text1(7).SetFocus
Exit Sub
End If
End If
If IsNumeric(Text1(4)) = False Then '判断数量是否为数值
MsgBox ("你输入的数量有误,请输入数值!")
Text1(4).Text = ""
Text1(4).SetFocus
Exit Sub
End If
'-------------------------- -----------------------------------------
Text1(9).Text = Operater1
'----------给进库表增加信息
instorehouse.RecordSource = "select * from instorehouse"
instorehouse.Refresh
With instorehouse.Recordset
.AddNew
.Fields(0) = Text1(0).Text
.Fields(1) = Text1(1).Text
.Fields(2) = Text1(2).Text
.Fields(3) = Text1(3).Text
.Fields(4) = Val(Text1(4).Text)
.Fields(5) = Text1(5).Text
.Fields(6) = Date
.Fields(7) = Text1(7).Text
.Fields(8) = Text1(8).Text
.Fields(9) = Text1(9).Text
.Fields(10) = Text1(10).Text
.Fields(11) = rk
.Update
End With
Call list1disp
'--------------------
'----------给库存表增加信息
stock.RecordSource = "select * from stock where 品名 ='" + Trim(Text1(0)) _
+ "' and 规格 = '" + Trim(Text1(1).Text) + "'" '查找库中是否有该物品
stock.Refresh
If stock.Recordset.EOF = True Then
With stock.Recordset
.AddNew
.Fields(0) = Text1(0).Text
.Fields(1) = Text1(1).Text
.Fields(2) = Text1(2).Text
.Fields(3) = Text1(3).Text
.Fields(4) = Val(Text1(4).Text)
.Fields(5) = Text1(5).Text
.Update
End With
Else
With stock.Recordset
.Fields(4) = .Fields(4) + Text1(4)
.Update
End With
End If
'--------------------
'----------给出库表增加信息
outstorehouse.RecordSource = "select * from stock where 品名 ='" + Trim(Text1(0)) _
+ "' and 规格 = '" + Trim(Text1(1).Text) + "'" '查找库中是否有该物品
outstorehouse.Refresh
'--------------------
Call clearzore
Text1(6) = Date
Text1(9) = Operater1
Text1(0).SetFocus
End Sub
Private Sub Command4_Click() '取消
Call clearzore
Text1(0).SetFocus
End Sub
Private Sub Command5_Click() '返回
Unload Me
End Sub
Private Sub command6_Click() '出库材料的查询
'---------------------判断出库查询输入的数据--------------
If Trim(Text1(11).Text) = "" Or Trim(Text1(12).Text) = "" Then '当要补充出库的信息时
MsgBox ("品名与规格不能为空!")
Text1(11).SetFocus
Exit Sub
End If
Call list2disp
Command1.Enabled = False
'-------------------------------------------------
End Sub
Private Sub Form_Load()
Me.Top = (Mainform.Height - Me.Height) / 2 - 800
Me.Left = (Mainform.Width - Me.Width) / 2
Me.Caption = "仓库管理系统→" & "入库操作"
instorehouse.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
outstorehouse.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
person.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
stock.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
Call clearzore
Call option1def
Call list2def
Call list1def
Call list1disp
Text1(6).Text = Date
Text1(9).Text = Operater1
Command1.Enabled = False
End Sub
Private Sub list2_Click()
row1 = list2.Row '返回单击的行值
If row1 <> 0 Then
Command1.Enabled = True
End If
outstorehouse.RecordSource = "select * from outstorehouse where 编号=" + list2.TextMatrix(row1, 4)
outstorehouse.Refresh
If outstorehouse.Recordset.EOF = False Then '此if 为了判断LIST1中是否有数据
Frame6.Enabled = True
With outstorehouse.Recordset
If IsNull(.Fields(8)) = True Then
Text1(13).Text = ""
Else
Text1(13).Text = .Fields(8)
End If
If IsNull(.Fields(9)) = True Then
Text1(14).Text = ""
Else
Text1(14).Text = .Fields(9)
End If
If IsNull(.Fields(10)) = True Then
Text1(15).Text = ""
Else
Text1(15).Text = .Fields(10)
End If
If IsNull(.Fields(11)) = True Then
Text1(16).Text = ""
Else
Text1(16).Text = .Fields(11)
End If
End With
Else
Frame6.Enabled = False
End If
End Sub
Private Sub Option1_Click()
rk = "初次入库"
Call option1def
End Sub
Private Sub Option2_Click()
rk = "余料入库"
Command1.Enabled = False
Call option2def
list2.Enabled = False '一开始就屏蔽list2的单击事件
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HC0FFFF
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = &HFFC0C0
If Index = 7 Then
person.RecordSource = "select * from person where 编号 = '" + Trim(Text1(7)) + "'"
person.Refresh
If person.Recordset.EOF Then
MsgBox ("库中无此人,请重新输入编号!")
Text1(7).Text = ""
Text1(8).Text = ""
'Text1(7).SetFocus
Else
Text1(8).Text = person.Recordset.Fields(1)
End If
End If
End Sub
Private Sub list2def() '将list2的表头初始化
list2.TextMatrix(0, 0) = "品名"
list2.TextMatrix(0, 1) = "规格"
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(14)
list2.TextMatrix(roww, 3) = outstorehouse.Recordset.Fields(12)
list2.TextMatrix(roww, 4) = Str(outstorehouse.Recordset.Fields(18))
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(8)
roww = roww + 1
instorehouse.Recordset.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -