📄 frmmeteralin.frm
字号:
Begin VB.Label Label3
Caption = "品牌"
ForeColor = &H00800000&
Height = 255
Left = 2760
TabIndex = 10
Top = 840
Width = 495
End
Begin VB.Label Label2
Caption = "供应商"
ForeColor = &H00800000&
Height = 255
Left = 480
TabIndex = 9
Top = 840
Width = 735
End
Begin VB.Label lblPerson
Height = 255
Left = 5760
TabIndex = 8
Top = 390
Width = 1095
End
Begin VB.Label lableperson
Caption = "经办人:"
ForeColor = &H00800000&
Height = 255
Left = 5040
TabIndex = 7
Top = 390
Width = 735
End
Begin VB.Label lblWeight1
Caption = "数量"
ForeColor = &H00800000&
Height = 255
Left = 2760
TabIndex = 6
Top = 390
Width = 375
End
Begin VB.Label lblWeight2
Caption = "kg"
Height = 255
Left = 4560
TabIndex = 5
Top = 390
Width = 375
End
Begin VB.Label Label1
Caption = "原料名称"
ForeColor = &H00800000&
Height = 255
Left = 480
TabIndex = 4
Top = 390
Width = 735
End
End
Attribute VB_Name = "frmMeteralIn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub initCanShuControlors()
Select Case ComboMeteral.Text
Case "低压膜":
ComboLangthDiYa.Text = ""
ComboWidthDiYa.Text = ""
ComboHouDuDiYa.Text = ""
ComboColorDiYa.Text = ""
Case "高压膜":
ComboLangthGaoYa.Text = ""
ComboWidthGaoYa.Text = ""
ComboHouDuGaoYa.Text = ""
ComboColorGaoYa.Text = ""
Case "彩印膜":
ComboLangthCaiYin.Text = ""
ComboWidthCaiYin.Text = ""
ComboHouDuCaiYin.Text = ""
ComboColorCaiYin.Text = ""
ComboTextCaiYin.Text = ""
Case "纸管":
ComboLangthZhiGuan.Text = ""
End Select
End Sub
Private Sub cmdCancle_Click()
Unload Me
End Sub
Private Sub cmdSubmit_Click()
'首先检查各参数的输入是否符合要求
If ComboMeteral.Text = "" Then
MsgBox "请选择原料类型!", , "提示"
Exit Sub
End If
If Not IsNumeric(txtWeight.Text) Then
MsgBox "请输入正确的数量!", , "提示"
Exit Sub
End If
If ComboProvider.Text = "" Then
MsgBox "请选择供应商!", , "提示"
Exit Sub
End If
If ComboPinPai.Text = "" Then
MsgBox "请选择品牌!", , "提示"
Exit Sub
End If
'以下这些参数的判断必须根据产品的类型逐一进行
Select Case ComboMeteral.Text
Case "低压膜":
If ComboLangthDiYa.Text = "" Then
MsgBox "请选择低压膜长度!", , "提示"
Exit Sub
End If
If ComboWidthDiYa.Text = "" Then
MsgBox "请选择低压膜宽度!", , "提示"
Exit Sub
End If
If ComboHouDuDiYa.Text = "" Then
MsgBox "请选择低压膜厚度!", , "提示"
Exit Sub
End If
If ComboColorDiYa.Text = "" Then
MsgBox "请选择低压膜颜色!", , "提示"
Exit Sub
End If
Case "高压膜":
If ComboLangthGaoYa.Text = "" Then
MsgBox "请选择高压膜长度!", , "提示"
Exit Sub
End If
If ComboWidthGaoYa.Text = "" Then
MsgBox "请选择高压膜宽度!", , "提示"
Exit Sub
End If
If ComboHouDuGaoYa.Text = "" Then
MsgBox "请选择高压膜厚度!", , "提示"
Exit Sub
End If
If ComboColorGaoYa.Text = "" Then
MsgBox "请选择高压膜颜色!", , "提示"
Exit Sub
End If
Case "彩印膜":
If ComboLangthCaiYin.Text = "" Then
MsgBox "请选择彩印膜长度!", , "提示"
Exit Sub
End If
If ComboWidthCaiYin.Text = "" Then
MsgBox "请选择彩印膜宽度!", , "提示"
Exit Sub
End If
If ComboHouDuCaiYin.Text = "" Then
MsgBox "请选择彩印膜厚度!", , "提示"
Exit Sub
End If
If ComboColorCaiYin.Text = "" Then
MsgBox "请选择彩印膜颜色!", , "提示"
Exit Sub
End If
If ComboTextCaiYin.Text = "" Then
MsgBox "请选择彩印膜所印文字", , "提示"
Exit Sub
End If
Case "纸管":
If ComboLangthZhiGuan.Text = "" Then
MsgBox "请选择纸管长度!", , "提示"
Exit Sub
End If
End Select
'以下根据所选的原料类型进行录入工作。
'1.更新原料入库记录表
' 记录内容有:原料类型、数量、供应商、品牌、经办人、日期、原料说明
' 其中原料说明的内容因原料的类型不同而不同,它是该原料的规格等信息。
Dim strShuoMing As String '用来记录所选原料的备注信息
Select Case ComboMeteral.Text
Case "低压膜":
strShuoMing = ComboLangthDiYa.Text _
& "X" & ComboWidthDiYa.Text _
& "X" & ComboHouDuDiYa.Text _
& Left(ComboColorDiYa.Text, 1)
Case "高压膜":
strShuoMing = ComboLangthGaoYa.Text _
& "X" & ComboWidthGaoYa.Text _
& "X" & ComboHouDuGaoYa.Text _
& Left(ComboColorGaoYa.Text, 1)
Case "彩印膜":
strShuoMing = ComboLangthCaiYin.Text _
& "X" & ComboWidthCaiYin.Text _
& "X" & ComboHouDuCaiYin.Text _
& Left(ComboColorCaiYin.Text, 1) _
& ",所印文字:" & ComboTextCaiYin.Text
Case "纸管":
strShuoMing = "长度:" & ComboLangthZhiGuan.Text
Case Else
strShuoMing = "无"
End Select
'以下开始将信息写入原料入库记录表中
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open "原料入库记录表"
rs.AddNew
rs!原料名称 = ComboMeteral.Text
rs!供应商 = ComboProvider.Text
rs!品牌 = ComboPinPai.Text
rs!数量 = Val(txtWeight.Text)
rs!经办人 = lblPerson.Caption
rs!日期 = Date
rs!原料说明 = strShuoMing
rs.Update
rs.Close
cn.Close
'2.同步更新库存
Select Case ComboMeteral.Text
Case "低压膜":
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockPessimistic
rs.CursorType = adOpenKeyset
rs.Open "select * from 低压膜库存表 where 长度 = '" & ComboLangthDiYa.Text & "' and 宽度 = '" & ComboWidthDiYa.Text & "' and 厚度 = '" & ComboHouDuDiYa.Text & "' and 颜色 = '" & ComboColorDiYa.Text & "'"
If rs.EOF Then
rs.AddNew
rs!长度 = ComboLangthDiYa.Text
rs!宽度 = ComboWidthDiYa.Text
rs!厚度 = ComboHouDuDiYa.Text
rs!颜色 = ComboColorDiYa.Text
rs!数量 = Val(txtWeight.Text)
Else
rs!数量 = rs!数量 + Val(txtWeight.Text)
End If
rs.Update
rs.Close
cn.Close
Case "高压膜":
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockPessimistic
rs.CursorType = adOpenKeyset
rs.Open "select * from 高压膜库存表 where 长度 = '" & ComboLangthGaoYa.Text & "' and 宽度 = '" & ComboWidthGaoYa.Text & "' and 厚度 = '" & ComboHouDuGaoYa.Text & "' and 颜色 = '" & ComboColorGaoYa.Text & "'"
If rs.EOF Then
rs.AddNew
rs!长度 = ComboLangthGaoYa.Text
rs!宽度 = ComboWidthGaoYa.Text
rs!厚度 = ComboHouDuGaoYa.Text
rs!颜色 = ComboColorGaoYa.Text
rs!数量 = Val(txtWeight.Text)
Else
rs!数量 = rs!数量 + Val(txtWeight.Text)
End If
rs.Update
rs.Close
cn.Close
Case "彩印膜":
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockPessimistic
rs.CursorType = adOpenKeyset
rs.Open "select * from 彩印膜库存表 where 长度 = '" & ComboLangthCaiYin.Text & "' and 宽度 = '" & ComboWidthCaiYin.Text & "' and 厚度 = '" & ComboHouDuCaiYin.Text & "' and 颜色 = '" & ComboColorCaiYin.Text & "' and 所印文字 = '" & ComboTextCaiYin.Text & "'"
If rs.EOF Then
rs.AddNew
rs!长度 = ComboLangthCaiYin.Text
rs!宽度 = ComboWidthCaiYin.Text
rs!厚度 = ComboHouDuCaiYin.Text
rs!颜色 = ComboColorCaiYin.Text
rs!所印文字 = ComboTextCaiYin.Text
rs!数量 = Val(txtWeight.Text)
Else
rs!数量 = rs!数量 + Val(txtWeight.Text)
End If
rs.Update
rs.Close
cn.Close
Case "纸管":
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockPessimistic
rs.CursorType = adOpenKeyset
rs.Open "select * from 纸管库存表 where 长度 = '" & ComboLangthZhiGuan.Text & "'"
If rs.EOF Then
rs.AddNew
rs!长度 = ComboLangthZhiGuan.Text
rs!数量 = Val(txtWeight.Text)
Else
rs!数量 = rs!数量 + Val(txtWeight.Text)
End If
rs.Update
rs.Close
cn.Close
Case Else:
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockPessimistic
rs.CursorType = adOpenKeyset
rs.Open "select * from 其它原料库存表 where 名称 = '" & ComboMeteral.Text & "'"
If rs.EOF Then
rs.AddNew
rs!名称 = ComboMeteral.Text
rs!数量 = Val(txtWeight.Text)
Else
rs!数量 = rs!数量 + Val(txtWeight.Text)
End If
rs.Update
rs.Close
cn.Close
End Select
initCanShuControlors
ComboMeteral.Text = ""
txtWeight.Text = ""
ComboProvider.Text = ""
ComboProvider.Clear
ComboPinPai.Text = ""
ComboPinPai.Clear
SetDataGrid
End Sub
Private Sub ComboMeteral_Click()
Dim i As Integer
For i = 0 To 3
FrameMeteral(i).Visible = False
Next i
If ComboMeteral.ListIndex <= 3 Then
FrameMeteral(ComboMeteral.ListIndex).Visible = True
End If
'设置供应商列表
ComboProvider.Text = ""
ComboProvider.Clear
ComboPinPai.Text = ""
ComboPinPai.Clear
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockReadOnly
rs.CursorType = adOpenForwardOnly
rs.Open "select 供应商 from 原料供应表 where 原料名称 = '" & ComboMeteral.Text & "'"
Do Until rs.EOF
ComboProvider.AddItem rs!供应商
rs.MoveNext
Loop
rs.Close
cn.Close
Select Case ComboMeteral.Text
Case "低压膜":
lblWeight2.Caption = "kg"
'设置低压膜规格参数
setGuiGeList ComboLangthDiYa, "低压膜", "长度"
setGuiGeList ComboWidthDiYa, "低压膜", "宽度"
setGuiGeList ComboHouDuDiYa, "低压膜", "厚度"
setGuiGeList ComboColorDiYa, "低压膜", "颜色"
Case "高压膜":
lblWeight2.Caption = "kg"
'设置高压膜规格参数
setGuiGeList ComboLangthGaoYa, "高压膜", "长度"
setGuiGeList ComboWidthGaoYa, "高压膜", "宽度"
setGuiGeList ComboHouDuGaoYa, "高压膜", "厚度"
setGuiGeList ComboColorGaoYa, "高压膜", "颜色"
Case "彩印膜":
lblWeight2.Caption = "kg"
'设置彩印膜规格参数
setGuiGeList ComboLangthCaiYin, "彩印膜", "长度"
setGuiGeList ComboWidthCaiYin, "彩印膜", "宽度"
setGuiGeList ComboHouDuCaiYin, "彩印膜", "厚度"
setGuiGeList ComboColorCaiYin, "彩印膜", "颜色"
setGuiGeList ComboTextCaiYin, "彩印膜", "所印文字"
Case "纸管"
lblWeight2.Caption = "根"
'设置纸管规格参数
setGuiGeList ComboLangthZhiGuan, "纸管", "长度"
Case "氧气":
lblWeight2.Caption = "瓶"
Case "氮气":
lblWeight2.Caption = "瓶"
Case Else
lblWeight2.Caption = "kg"
End Select
txtWeight.SetFocus
End Sub
Private Sub ComboProvider_Click()
ComboPinPai.Text = ""
ComboPinPai.Clear
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockReadOnly
rs.CursorType = adOpenForwardOnly
rs.Open "select 品牌 from 原料供应表 where 原料名称 = '" & ComboMeteral.Text & "' and 供应商 = '" & ComboProvider.Text & "'"
Do Until rs.EOF
ComboPinPai.AddItem rs!品牌
rs.MoveNext
Loop
rs.Close
cn.Close
End Sub
Private Sub Form_Load()
lblPerson.Caption = userXingMing
Dim i As Integer
For i = 0 To 3
FrameMeteral(i).Visible = False
Next i
cn.Open
Set rs.ActiveConnection = cn
rs.LockType = adLockReadOnly
rs.CursorType = adOpenForwardOnly
rs.Open "select 规格值 from 规格表 where 名称 = '其它原料' and 规格名称 = '原料名称'"
Do Until rs.EOF
ComboMeteral.AddItem rs!规格值
rs.MoveNext
Loop
rs.Close
cn.Close
SetDataGrid
End Sub
Private Sub SetDataGrid()
Dim currentDate As String
currentDate = Str(Year(Date)) & "-" & Str(Month(Date)) & "-" & Str(Day(Date))
AdodcArg.ConnectionString = connectString
AdodcArg.RecordSource = "select 原料名称,数量,供应商,品牌,经办人,原料说明 from 原料入库记录表 where 日期 = " & "#" & currentDate & "#"
Set DataGridArg.DataSource = AdodcArg
AdodcArg.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -