搜索部分:
Func _SOKEY()
If $SOKEY < 1 Then
AdlibUnRegister("_SOKEY")
If StringLen($SoItemName) > 0 Then
If StringLen($SoItemName) > 0 Then
If Not $HGUI_QUICK_ListView_SO_OFF Then
GUICtrlSetState($HGUI_QUICK_ListView_SO, $GUI_SHOW)
GUICtrlSetState($HGUI_QUICK_ListView, $GUI_HIDE)
$HGUI_QUICK_ListView_SO_OFF = True
EndIf
_SoItemName($SoItemName)
EndIf
Else
If $HGUI_QUICK_ListView_SO_OFF Then
GUICtrlSetState($HGUI_QUICK_ListView, $GUI_SHOW)
GUICtrlSetState($HGUI_QUICK_ListView_SO, $GUI_HIDE)
$HGUI_QUICK_ListView_SO_OFF = False
EndIf
EndIf
EndIf
$SOKEY -= 1
EndFunc ;==>_SOKEY
Func _SoItemName($soname_str = "")
If $soname_str <> "" Then
$soname_str = StringLower($soname_str)
Dim $soname_len = StringLen($soname_str)
Dim $SO_ERROR = False
Dim $soname_str_check = $soname_str
Dim $IsDigit = False
$soname_str_check = StringLower($soname_str_check)
Dim $soname_str_type = _checkzw($soname_str_check)
If $soname_str_type Then
If $soname_len > 0 Then $SO_ERROR = True
Else
If $soname_len > 1 Then $SO_ERROR = True
EndIf
If $soname_len > 3 And StringIsDigit($soname_str) Then
$IsDigit = True
$SO_ERROR = True
EndIf
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($HGUI_QUICK_ListView_SO))
If $SO_ERROR Then
GUISetState(@SW_LOCK, $HGUI_QUICK)
ReDim $SO_QUICK_DB[1][6]
Dim $iUBound = 0
$SO_QUICK_DB[$iUBound][0] = ""
$SO_QUICK_DB[$iUBound][1] = ""
$SO_QUICK_DB[$iUBound][2] = ""
$SO_QUICK_DB[$iUBound][3] = ""
$SO_QUICK_DB[$iUBound][4] = ""
$SO_QUICK_DB[$iUBound][5] = ""
If IsArray($ITEM_DB) Then
If UBound($ITEM_DB) > 1 Then
Dim $Q1 = -1, $Q2 = -1, $Q3 = -1, $Q4 = -1, $Q5 = 0
For $i = 0 To UBound($ITEM_DB) - 1
$Q1 = StringRegExp($ITEM_DB[$i][2], $soname_str)
$Q2 = StringRegExp(StringLower($ITEM_DB[$i][8]), $soname_str)
$Q3 = StringRegExp(StringLower($ITEM_DB[$i][0]), $soname_str)
$Q4 = StringRegExp($ITEM_DB[$i][1], $soname_str)
If $Q1 = 1 Or $Q2 = 1 Or $Q3 = 1 Or $Q4 = 1 Then
$Q5 += 1
If $Q4 > 29 Then ExitLoop
If $SO_QUICK_DB[0][0] = "" Then
Dim $iUBound = 0
ReDim $SO_QUICK_DB[$iUBound + 1][6]
$SO_QUICK_DB[$iUBound][0] = $ITEM_DB[$i][0]
$SO_QUICK_DB[$iUBound][1] = $ITEM_DB[$i][1]
$SO_QUICK_DB[$iUBound][2] = $ITEM_DB[$i][2]
$SO_QUICK_DB[$iUBound][3] = $ITEM_DB[$i][4]
$SO_QUICK_DB[$iUBound][4] = $ITEM_DB[$i][7]
$SO_QUICK_DB[$iUBound][5] = 0
Else
Dim $iUBound = UBound($SO_QUICK_DB)
ReDim $SO_QUICK_DB[$iUBound + 1][6]
$SO_QUICK_DB[$iUBound][0] = $ITEM_DB[$i][0]
$SO_QUICK_DB[$iUBound][1] = $ITEM_DB[$i][1]
$SO_QUICK_DB[$iUBound][2] = $ITEM_DB[$i][2]
$SO_QUICK_DB[$iUBound][3] = $ITEM_DB[$i][4]
$SO_QUICK_DB[$iUBound][4] = $ITEM_DB[$i][7]
$SO_QUICK_DB[$iUBound][5] = 0
EndIf
EndIf
Next
If UBound($SO_QUICK_DB) = 1 And Not StringIsDigit($soname_str) Then
_ADDGUI_POS($SO_QUICK_DB[0][0])
Echo("查询条形码:" & $SO_QUICK_DB[0][0])
EndIf
EndIf
EndIf
If IsArray($SO_QUICK_DB) Then
_ArraySort($SO_QUICK_DB, 1, 0, 0, 1)
_GUICtrlListView_AddArray($HGUI_QUICK_ListView_SO, $SO_QUICK_DB)
EndIf
GUISetState(@SW_UNLOCK, $HGUI_QUICK)
EndIf
EndIf
EndFunc ;==>_SoItemName
Func _checkzw($str = "")
If $str <> "" Then
Dim $str1 = StringSplit($str, "")
If IsArray($str1) Then
For $i = 1 To UBound($str1) - 1
If StringIsASCII($str1[$i]) = 0 Then
Return True
EndIf
Next
EndIf
EndIf
Return False
EndFunc ;==>_checkzw
|