📄 出库.frm
字号:
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 9
Top = 5880
Width = 1215
End
Begin VB.Label Label8
BackColor = &H00C00000&
Caption = "出库单位名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 8
Top = 5280
Width = 1575
End
Begin VB.Label Label7
BackColor = &H00C00000&
Caption = "时间"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 7
Top = 4680
Width = 1215
End
Begin VB.Label Label6
BackColor = &H00C00000&
Caption = "日期"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 6
Top = 4080
Width = 1215
End
Begin VB.Label Label5
BackColor = &H00C00000&
Caption = "数量"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 5
Top = 3480
Width = 1215
End
Begin VB.Label Label4
BackColor = &H00C00000&
Caption = "规格"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 4
Top = 2880
Width = 1095
End
Begin VB.Label Label3
BackColor = &H00C00000&
Caption = "型号"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 3
Top = 2280
Width = 1095
End
Begin VB.Label Label2
BackColor = &H00C00000&
Caption = "生产厂家"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 2
Top = 1680
Width = 1095
End
Begin VB.Label Label1
BackColor = &H00C00000&
Caption = "商品名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 240
TabIndex = 1
Top = 1080
Width = 1095
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo4_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection
rs.CursorLocation = adUseClient
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
sql1 = "select distinct 商品名称 from 入库单 where 仓库编号='" & Combo4.Text & "' group by 商品名称 "
rs.Open sql1, conn, 1, 3
For i = 0 To rs.RecordCount - 1
Combo1.List(i) = rs.Fields(0).Value
rs.MoveNext
Next
End Sub
Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
sql = "select * from 客户信息 where 客户类型='购货商'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open sql, conn, 1, 3
Set Me.DataGrid2.DataSource = rs
For i = 0 To rs.RecordCount - 1
Combo2.List(i) = rs.Fields(1).Value
Combo3.List(i) = rs.Fields(3).Value
rs.MoveNext
Next
Set rs2 = New ADODB.Recordset
rs2.CursorLocation = adUseClient
sql2 = "select * from 仓库信息 "
rs2.Open sql2, conn, 1, 3
For k = 0 To rs2.RecordCount - 1
Combo4.List(k) = rs2.Fields(0)
rs2.MoveNext
Next
'rs2.Close
End Sub
Private Sub Combo1_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
sql = "select * from 商品 where 名称='" & Combo1.Text & "'"
rs.Open sql, conn, 1, 3
Text2.Text = rs.Fields(1).Value
Text3.Text = rs.Fields(2).Value
Text4.Text = rs.Fields(3).Value
End Sub
Private Sub Combo2_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
sql = "select * from 客户信息 where 客户名称='" & Combo2.Text & "'"
rs.Open sql, conn, 1, 3
Combo3.Text = rs.Fields(3).Value
End Sub
Private Sub Command1_Click()
'--------------------------添加信息----------------------------------------------------
If Combo1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Combo2.Text = "" Or Combo3.Text = "" Then
MsgBox "请输入完整信息!", , "库存管理系统"
Exit Sub
Else
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = Combo1.Text
Adodc1.Recordset.Fields(1) = Text2.Text
Adodc1.Recordset.Fields(2) = Text3.Text
Adodc1.Recordset.Fields(3) = Text4.Text
Adodc1.Recordset.Fields(4) = Val(Text5.Text)
Adodc1.Recordset.Fields(5) = Text6.Text
Adodc1.Recordset.Fields(6) = Text7.Text
Adodc1.Recordset.Fields(7) = Combo2.Text
Adodc1.Recordset.Fields(8) = Combo3.Text
Adodc1.Recordset.Fields(9) = Combo4.Text
Adodc1.Recordset.update
MsgBox "已经成功入库!", , "库存管理系统"
End If
Adodc1.Refresh
DataGrid1.Refresh
'------------------------------现有库存信息------------------------------------------
Set rst = New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
Text10.Text = Combo1.Text
sql = "select * from 现有库存表 where 商品名称='" & Text10.Text & "'"
rst.Open sql, conn, 1, 3
'-----------------判断现有库中是否有此商品!若没有需向商品单中添加此商品信息!--------------------------------------------
If rst.BOF = True And rst.EOF = True Then
MsgBox "现有库存表中无此商品信息!", , "库存管理系统"
Text10.Text = Combo1.Text
Else
rst.Fields(1).Value = rst.Fields(1).Value - Val(Text5.Text)
rst.update
Text11.Text = rst.Fields(1)
Text12.Text = rst.Fields(2)
Text13.Text = rst.Fields(3)
'----------------------------判断是否越界!若越界需重新修改数据!-----------------------------------------------
If rst(1).Value > rst(2).Value Then
MsgBox "危险啊!!已超过最大库存!!!需尽快出库操作!!!", , "库存管理系统"
End If
If rst(1).Value < rst(3).Value Then
MsgBox "危险啊!库存不足!!需修改出库数量!!!", , "库存管理系统"
Adodc1.Recordset.MoveLast
Form10.Show
End If
End If
End Sub
Private Sub Command2_Click()
Form10.Show
End Sub
Private Sub Command3_Click()
Adodc1.Recordset.Delete
End Sub
Private Sub Command4_Click()
Form2.Hide
End Sub
Private Sub Command5_Click()
Form3.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -