📄 frmproedit.frm
字号:
VERSION 5.00
Begin VB.Form FrmProEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑产品信息"
ClientHeight = 3720
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
Icon = "FrmProEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3720
ScaleWidth = 6495
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 3675
MouseIcon = "FrmProEdit.frx":0CCA
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 11
Top = 3120
Width = 1300
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 400
Left = 1515
MouseIcon = "FrmProEdit.frx":0FD4
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 10
Top = 3120
Width = 1300
End
Begin VB.Frame Frame1
Height = 2775
Left = 240
TabIndex = 12
Top = 120
Width = 6015
Begin VB.TextBox txtAlarm
Height = 270
Left = 4320
MaxLength = 20
TabIndex = 9
Top = 2400
Width = 1455
End
Begin VB.TextBox txtValid
Height = 270
Left = 1320
MaxLength = 20
TabIndex = 8
Top = 2400
Width = 1455
End
Begin VB.TextBox txtMax
Height = 270
Left = 4320
MaxLength = 20
TabIndex = 7
Top = 1950
Width = 1455
End
Begin VB.ComboBox ComboType2
Height = 300
ItemData = "FrmProEdit.frx":12DE
Left = 2880
List = "FrmProEdit.frx":12E0
Style = 2 'Dropdown List
TabIndex = 2
Top = 600
Width = 1455
End
Begin VB.TextBox txtUnit
Height = 270
Left = 4320
MaxLength = 20
TabIndex = 4
Top = 1049
Width = 1455
End
Begin VB.TextBox txtStyle
Height = 270
Left = 1320
MaxLength = 200
TabIndex = 3
Top = 1049
Width = 1455
End
Begin VB.TextBox txtPro
Height = 270
Left = 1320
MaxLength = 100
TabIndex = 0
Top = 210
Width = 4455
End
Begin VB.ComboBox ComboType1
Height = 300
ItemData = "FrmProEdit.frx":12E2
Left = 1320
List = "FrmProEdit.frx":12E4
Style = 2 'Dropdown List
TabIndex = 1
Top = 607
Width = 1455
End
Begin VB.TextBox txtPrice
Height = 270
Left = 1320
MaxLength = 200
TabIndex = 5
Top = 1476
Width = 1455
End
Begin VB.TextBox txtMin
Height = 270
Left = 1320
MaxLength = 20
TabIndex = 6
Top = 1950
Width = 1455
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "警告期(天)"
Height = 180
Left = 3240
TabIndex = 21
Top = 2445
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "有效期(天)"
Height = 180
Left = 240
TabIndex = 20
Top = 2445
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数量上限"
Height = 180
Left = 3240
TabIndex = 19
Top = 1995
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "计量单位"
Height = 180
Left = 3240
TabIndex = 18
Top = 1095
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "产品型号"
Height = 180
Left = 240
TabIndex = 17
Top = 1095
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "产品名称"
Height = 180
Left = 240
TabIndex = 16
Top = 240
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "产品类目"
Height = 180
Left = 240
TabIndex = 15
Top = 660
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "参与价格"
Height = 180
Left = 240
TabIndex = 14
Top = 1515
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数量下限"
Height = 180
Left = 240
TabIndex = 13
Top = 1995
Width = 720
End
End
End
Attribute VB_Name = "FrmProEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As Long
Public OriName As String
Public OriType1, OriType2 As String
Private Function Check() As Boolean
If Trim(txtPro) = "" Then
MsgBox "请输入产品名称"
txtPro.SetFocus
Check = False
Exit Function
End If
If ComboType1.Text = "" Or ComboType2.Text = "" Then
MsgBox "请选择产品类目"
ComboType1.SetFocus
Check = False
Exit Function
End If
Check = True
End Function
Private Sub Cmd_OK_Click()
If Check = False Then
Exit Sub
End If
With MyPro
.ProName = MakeStr(txtPro)
If ComboType2.Text <> "" Then
.TypeId = MyProType.GetId(ComboType2.Text)
Else
.TypeId = MyProType.GetId(ComboType1.Text)
End If
.ProStyle = MakeStr(txtStyle)
.ProUnit = MakeStr(txtUnit)
.ProPrice = Val(txtPrice)
.ProLow = Val(txtMin)
.ProHigh = Val(txtMax)
.Valid = Val(txtValid)
.AlarmDays = Val(txtAlarm)
'判断仓库名称是否存在
If Modify = False Or OriName <> Trim(txtPro) Then
If .In_DB(MakeStr(txtPro)) = True Then
MsgBox "产品名称已经存在,请重新输入"
txtPro.SetFocus
txtPro.SelStart = 0
txtPro.SelLength = Len(txtPro)
Exit Sub
End If
End If
If Modify = False Then
.Insert
MsgBox "添加成功"
Else
.Update (OriId)
MsgBox "修改成功"
End If
End With
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub txtContact_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtDescribe_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub ComboType1_Click()
'装入二级类目
TmpType = MyProType.GetId(ComboType1.Text)
MyProType.Load_by_Upper (TmpType)
ComboType2.Clear
i = 0
Do While Arr_ProType(i) <> ""
ComboType2.AddItem Arr_ProType(i)
i = i + 1
Loop
If ComboType2.ListCount > 0 Then
ComboType2.ListIndex = 0
End If
End Sub
Private Sub Form_Load()
Dim TmpType As Long
Dim i As Integer
'装入一级类目
MyProType.Load_by_Upper (0)
i = 0
Do While Arr_ProType(i) <> ""
ComboType1.AddItem Arr_ProType(i)
i = i + 1
Loop
If OriType1 = "" Then
If ComboType1.ListCount > 0 Then
ComboType1.ListIndex = 0
End If
Else
If InCombo(OriType1, ComboType1) = True Then
ComboType1.Text = OriType1
End If
End If
'装入二级类目
TmpType = MyProType.GetId(ComboType1.Text)
MyProType.Load_by_Upper (TmpType)
ComboType2.Clear
i = 0
Do While Arr_ProType(i) <> ""
ComboType2.AddItem Arr_ProType(i)
i = i + 1
Loop
If OriType2 = "" Then
If ComboType2.ListCount > 0 Then
ComboType2.ListIndex = 0
End If
Else
If InCombo(OriType2, ComboType2) = True Then
ComboType2.Text = OriType2
End If
End If
End Sub
Private Sub txtAlarm_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtMax_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtMin_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtPro_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtStyle_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtUnit_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPrice_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtValid_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -