📄 frmitemhelplist.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmItemHelpList
BorderStyle = 1 'Fixed Single
Caption = "商品帮助列表"
ClientHeight = 4008
ClientLeft = 36
ClientTop = 324
ClientWidth = 5028
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmItemHelpList.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4008
ScaleWidth = 5028
StartUpPosition = 3 'Windows Default
Begin MSComctlLib.ListView lvwShower
Height = 2652
Left = 120
TabIndex = 7
Top = 1272
Width = 4764
_ExtentX = 8403
_ExtentY = 4678
View = 3
Arrange = 1
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.Frame Frame1
BeginProperty Font
Name = "MS Sans Serif"
Size = 7.8
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1116
Left = 120
TabIndex = 2
Top = 72
Width = 3708
Begin VB.TextBox txtStripeCode
Height = 264
Left = 672
TabIndex = 8
Text = "txtStripeCode"
Top = 768
Width = 2868
End
Begin VB.TextBox txtCode
Height = 264
Left = 672
TabIndex = 4
Text = "txtCode"
Top = 168
Width = 2868
End
Begin VB.TextBox txtName
Height = 264
Left = 672
TabIndex = 3
Text = "txtName"
Top = 468
Width = 2868
End
Begin VB.Label lblStripeCode
BackStyle = 0 'Transparent
Caption = "条码:"
Height = 180
Left = 144
TabIndex = 9
Top = 792
Width = 540
End
Begin VB.Label lblCode
BackStyle = 0 'Transparent
Caption = "代码:"
Height = 204
Left = 144
TabIndex = 6
Top = 192
Width = 540
End
Begin VB.Label lblName
BackStyle = 0 'Transparent
Caption = "名称:"
Height = 228
Left = 144
TabIndex = 5
Top = 480
Width = 540
End
End
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 276
Left = 3960
TabIndex = 1
Top = 600
Width = 900
End
Begin VB.CommandButton cmdOk
Caption = "确定(&O)"
Height = 276
Left = 3960
TabIndex = 0
Top = 180
Width = 900
End
End
Attribute VB_Name = "frmItemHelpList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public psQryCondition As String '** 查询过滤条件 **
Public plQryType As genufindtype '** 查询方式 **
Public plStructID As Long '** 部门ID **
Public psCode As String
Private Sub cmdCancel_Click()
Me.Tag = vbCancel
Me.Hide
End Sub
Private Sub cmdOK_Click()
Me.Tag = vbOK
Me.Hide
End Sub
Private Sub Form_Activate()
lvwShower.SetFocus
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then cmdCancel = True
End Sub
Private Sub Form_Load()
Me.Tag = vbCancel
InitListView
End Sub
Private Sub InitListView()
With lvwShower
.FullRowSelect = True
.LabelEdit = lvwAutomatic
.ListItems.Clear
.ColumnHeaders.Add , , GetCodeName(gnFindType), 1500
.ColumnHeaders.Add , , "商品代码", IIf(gnFindType = genufindtype.CST_FINDTYPE_CODE, 0, 1300)
.ColumnHeaders.Add , , "商品名称", 2200
.ColumnHeaders.Add , , "商品简称", 1200
End With
End Sub
Public Function ShowItem()
Dim ssql As String
Dim rstItem As ADODB.Recordset
Dim ItemX As MSComctlLib.ListItem
ssql = " select * from p_item where" & IIf(psQryCondition = "", "", psQryCondition & " and ")
Select Case plQryType
Case genufindtype.CST_FINDTYPE_CODE
ssql = ssql & " code like '" & psCode & "%'"
Case genufindtype.CST_FINDTYPE_HELPCODE
ssql = ssql & " helpcode like '" & psCode & "%'"
Case genufindtype.CST_FINDTYPE_NAME
ssql = ssql & " name like '" & psCode & "%'"
Case genufindtype.CST_FINDTYPE_SHORTNAME
ssql = ssql & " shortname like '" & psCode & "%'"
Case genufindtype.CST_FINDTYPE_STRIPECODE
ssql = ssql & " stripecode like '" & psCode & "%'"
End Select
ssql = ssql & " and p_itemid <> " & gSystemItemID
ssql = ssql & " and tag2<>'Delete' and status in (0,1,4)"
ssql = ssql & " order by code"
Set rstItem = gComMesaStub.Query(ssql)
With rstItem
txtCode = "": txtCode.Tag = -1
txtName = "": txtStripeCode = ""
lvwShower.ListItems.Clear
Do While Not .EOF
Set ItemX = lvwShower.ListItems.Add(, , GetFldCode(rstItem))
ItemX.Text = .Fields("code")
ItemX.SubItems(1) = .Fields("code")
ItemX.SubItems(2) = .Fields("name")
ItemX.SubItems(3) = .Fields("shortname")
ItemX.Tag = .Fields("p_itemID")
.MoveNext
Loop
End With
With lvwShower
If .ListItems.count > 0 Then
.ListItems(1).Selected = True
FillTxt
End If
End With
If Not rstItem Is Nothing Then Set rstItem = Nothing
End Function
Private Sub FillTxt()
Dim ItemX As MSComctlLib.ListItem
Set ItemX = lvwShower.SelectedItem
If ItemX Is Nothing Then Exit Sub
txtCode = ItemX.SubItems(1)
txtCode.Tag = ItemX.Tag
txtName = ItemX.SubItems(2)
txtStripeCode = ItemX.Text
End Sub
Private Sub lvwShower_Click()
FillTxt
End Sub
Private Sub lvwShower_DblClick()
FillTxt
cmdOk = True
End Sub
Private Sub lvwShower_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
FillTxt
cmdOk = True
End If
End Sub
Private Sub lvwShower_KeyUp(KeyCode As Integer, Shift As Integer)
' If KeyCode = vbKeyReturn Then
' FillTxt
' cmdOk = True
' End If
End Sub
Private Sub txtCode_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
psCode = txtCode
ShowItem
lvwShower.SetFocus
End If
End Sub
Private Function GetFldCode(ByVal rstItem As ADODB.Recordset)
Select Case gnFindType
Case genufindtype.CST_FINDTYPE_BM
Case genufindtype.CST_FINDTYPE_CODE
Case genufindtype.CST_FINDTYPE_HELPCODE
Case genufindtype.CST_FINDTYPE_ID
Case genufindtype.CST_FINDTYPE_NAME
Case genufindtype.CST_FINDTYPE_SHORTNAME
Case genufindtype.CST_FINDTYPE_STRIPECODE
GetFldCode = rstItem("stripecode")
End Select
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -