📄 出库操作.frm
字号:
Left = 120
TabIndex = 28
Top = 810
Width = 450
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "硬度:"
Height = 180
Index = 0
Left = 3360
TabIndex = 27
Top = 337
Width = 450
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "导电:"
Height = 180
Index = 0
Left = 120
TabIndex = 26
Top = 337
Width = 450
End
End
Begin VB.Frame Frame4
Height = 735
Left = 120
TabIndex = 22
Top = 120
Width = 6615
Begin VB.TextBox Text1
Alignment = 2 'Center
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 0
Left = 720
MaxLength = 20
TabIndex = 0
Text = "Text1"
Top = 263
Width = 2535
End
Begin VB.TextBox Text1
Alignment = 2 'Center
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 1
Left = 3960
MaxLength = 20
TabIndex = 1
Text = "Text1"
Top = 263
Width = 2535
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "规格*:"
Height = 180
Index = 1
Left = 3360
TabIndex = 24
Top = 360
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "品名*:"
Height = 180
Index = 1
Left = 120
TabIndex = 23
Top = 360
Width = 540
End
End
End
End
Attribute VB_Name = "出库操作"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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) = Text1(11)
.Fields(7) = Text1(12)
.Fields(8) = Text1(13)
.Fields(9) = Text1(14)
.Fields(10) = Text1(15)
.Fields(11) = Text1(16)
.Fields(12) = Date
.Fields(13) = Text1(7)
.Fields(14) = Text1(8)
.Fields(15) = Text1(9)
.Fields(16) = Text1(17)
.Fields(17) = 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
End If
'-------------------
Else
'--------------------
If .Fields(4) = 0 Then
MsgBox ("此物品已为空!")
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0))
Text1(0).SetFocus
Exit Sub
Else
.Fields(4) = .Fields(4) - Val(Text1(4))
.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) = Text1(4)
.Fields(5) = Text1(5)
.Fields(6) = Text1(11)
.Fields(7) = Text1(12)
.Fields(8) = Text1(13)
.Fields(9) = Text1(14)
.Fields(10) = Text1(15)
.Fields(11) = Text1(16)
.Fields(12) = Date
.Fields(13) = Text1(7)
.Fields(14) = Text1(8)
.Fields(15) = Text1(9)
.Fields(16) = Text1(17)
.Fields(17) = Text1(10)
.Update
End With
Call list1disp
Call Command2_Click
End If
'--------------------
End If
End With
End If
'---------------------------------------------------------------------
'-------------------------给出库添加信息------------------------------
'---------------------------------------------------------------------
End Sub
Private Sub Command2_Click()
Call clearzore
Text1(6).Text = Date
Text1(9).Text = Operater1
Me.Text1(0).SetFocus
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Top = (主界面.Height - Me.Height) / 2 - 800
Me.Left = (主界面.Width - Me.Width) / 2
Me.Caption = "仓库管理系统→" & "出库操作"
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 list1def
Text1(9).Text = Operater1
Text1(6).Text = Date
Call list1disp
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) = "毛坯尺寸"
list1.TextMatrix(0, 7) = "毛坯数量"
list1.TextMatrix(0, 8) = "成品尺寸"
list1.TextMatrix(0, 9) = "成品数量"
list1.TextMatrix(0, 10) = "余料"
list1.TextMatrix(0, 11) = "报废"
list1.TextMatrix(0, 12) = "出库日期"
list1.TextMatrix(0, 13) = "领料人编号"
list1.TextMatrix(0, 14) = "领料人"
list1.TextMatrix(0, 15) = "经手人"
list1.TextMatrix(0, 16) = "其它用途"
list1.TextMatrix(0, 17) = "说明"
End Sub
Private Sub clearzore() '将数据项初始化
For i = 0 To 17
Text1(i).Text = ""
Text1(i).BackColor = &HFFC0C0
Next i
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 list1disp()
Dim roww As Integer ''行
roww = 1
list1.Clear
list1.rows = 1
Call list1def
outstorehouse.RecordSource = "select * from outstorehouse"
outstorehouse.Refresh
If outstorehouse.Recordset.EOF = False Then
outstorehouse.Recordset.MoveFirst
End If
Do While outstorehouse.Recordset.EOF = False
For i = 0 To 17 '给空值赋值
If IsNull(outstorehouse.Recordset.Fields(i)) = True Then
outstorehouse.Recordset.Fields(i) = ""
End If
Next i
list1.rows = list1.rows + 1
list1.TextMatrix(roww, 0) = outstorehouse.Recordset.Fields(0)
list1.TextMatrix(roww, 1) = outstorehouse.Recordset.Fields(1)
list1.TextMatrix(roww, 2) = outstorehouse.Recordset.Fields(2)
list1.TextMatrix(roww, 3) = outstorehouse.Recordset.Fields(3)
list1.TextMatrix(roww, 4) = outstorehouse.Recordset.Fields(4)
list1.TextMatrix(roww, 5) = outstorehouse.Recordset.Fields(5)
list1.TextMatrix(roww, 6) = outstorehouse.Recordset.Fields(6)
list1.TextMatrix(roww, 7) = outstorehouse.Recordset.Fields(7)
list1.TextMatrix(roww, 8) = outstorehouse.Recordset.Fields(8)
list1.TextMatrix(roww, 9) = outstorehouse.Recordset.Fields(9)
list1.TextMatrix(roww, 10) = outstorehouse.Recordset.Fields(10)
list1.TextMatrix(roww, 11) = outstorehouse.Recordset.Fields(11)
list1.TextMatrix(roww, 12) = outstorehouse.Recordset.Fields(12)
list1.TextMatrix(roww, 13) = outstorehouse.Recordset.Fields(13)
list1.TextMatrix(roww, 14) = outstorehouse.Recordset.Fields(14)
list1.TextMatrix(roww, 15) = outstorehouse.Recordset.Fields(15)
list1.TextMatrix(roww, 16) = outstorehouse.Recordset.Fields(16)
list1.TextMatrix(roww, 17) = outstorehouse.Recordset.Fields(17)
roww = roww + 1
outstorehouse.Recordset.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -