📄 dg_singlexg.frm
字号:
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
TabIndex = 7
Top = 540
Width = 555
End
Begin VB.Label Label3
Caption = "并且字段:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 300
TabIndex = 5
Top = 540
Width = 1155
End
Begin VB.Label Label2
Caption = "为:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
TabIndex = 4
Top = 120
Width = 495
End
Begin VB.Label Label1
Caption = "请选择字段:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 60
TabIndex = 3
Top = 120
Width = 1515
End
End
Attribute VB_Name = "dg_singlexg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Const SND_SYNC = &H0
Private Sub Command1_Click()
Dim field1 As String
Dim field2 As String
Dim ordstr As String
Dim sqlstr As String
Dim sqllast1 As String
Dim sqllast2 As String
Dim sqllast3 As String
On Error Resume Next
field1 = Combo1.Text
field2 = Combo2.Text
ordstr = Combo3.Text
sqlstr = "select * from 预采数据 "
If Text1.Text = "" Then
sqllast1 = ""
Else
If field1 = "ISBN号" Then sqllast1 = "isbn like '" & Text1.Text & "*'"
If field1 = "书 名" Then sqllast1 = "bookname like '*" & Text1.Text & "*'"
If field1 = "作 者" Then sqllast1 = "author like '*" & Text1.Text & "*'"
If field1 = "出版社" Then sqllast1 = "bms like '*" & Text1.Text & "*'"
If field1 = "出版年" Then sqllast1 = "bmn like '*" & Text1.Text & "*'"
If field1 = "备注" Then sqllast1 = "other like '*" & Text1.Text & "*'"
If field1 = "提供商" Then sqllast1 = "provide like '*" & Text1.Text & "*'"
sqlstr = sqlstr & " where " & sqllast1
End If
If Text2.Text = "" Then
sqllast2 = ""
Else
If field2 = "ISBN号" Then sqllast2 = "isbn like '" & Text2.Text & "*'"
If field2 = "书 名" Then sqllast2 = "bookname like '*" & Text2.Text & "*'"
If field2 = "作 者" Then sqllast2 = "author like '*" & Text2.Text & "*'"
If field2 = "出版社" Then sqllast2 = "bms like '*" & Text2.Text & "*'"
If field2 = "出版年" Then sqllast2 = "bmn like '*" & Text2.Text & "*'"
If field2 = "备注" Then sqllast2 = "other like '*" & Text2.Text & "*'"
If field2 = "提供商" Then sqllast2 = "provide like '*" & Text1.Text & "*'"
If Text1.Text = "" Then
sqlstr = sqlstr & " where " & sqllast2
Else
sqlstr = sqlstr & " and " & sqllast2
End If
End If
If ordstr = "控制号" Then sqllast3 = "order by ID"
If ordstr = "ISBN号" Then sqllast3 = "order by isbn"
If ordstr = "书 名" Then sqllast3 = "order by bookname"
If ordstr = "作 者" Then sqllast3 = "order by author"
If ordstr = "出版社" Then sqllast3 = "order by bms"
If ordstr = "出版年" Then sqllast3 = "order by bmn"
If ordstr = "价 格" Then sqllast3 = "order by jg desc"
If ordstr = "选书数" Then sqllast3 = "order by fbl desc"
If ordstr = "时 间" Then sqllast3 = "order by modidate desc"
sqlstr = sqlstr & " " & sqllast3
'MsgBox sqlstr
Data3.RecordSource = sqlstr
Data3.Refresh
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
'图书扫描典藏。上面窗口显示所有库存,按时间;下面窗口显示当前ISBN号的记录.可对上面更新
'提示信号
Dim flag As Integer
On Error Resume Next
If Text1.Text = "" Then Exit Sub
If Combo1.Text <> "ISBN号" Then Exit Sub
Data3.RecordSource = "select * from 预采数据 where fbl>0 order by modidate desc"
Data3.Refresh
isbntext = isbndel(Text1.Text)
sqlstr = "select * from 预采数据 where isbn='" & isbntext & "'"
Data1.RecordSource = sqlstr
Data1.Refresh
topint = Data1.Recordset.RecordCount '预采数据查重
'与预采查重
'--------------------------------------
If topint = 0 Then '没有数据,增加新的
If Text4.Text = "" Then
MsgBox "请输入此书存放架位!"
Exit Sub
End If
Data3.Recordset.AddNew
Data3.Recordset.Fields("isbn") = isbntext
Data3.Recordset.Fields("bookname") = ""
Data3.Recordset.Fields("author") = ""
Data3.Recordset.Fields("bms") = ""
Data3.Recordset.Fields("bmn") = ""
Data3.Recordset.Fields("modidate") = Now()
Data3.Recordset.Fields("bjh") = Text4.Text
Data3.Recordset.Fields("jg") = 0
Data3.Recordset.Fields("fbl") = Str(Text3.Text)
If Len(Text5.Text) <> 0 Then
Data3.Recordset.Fields("other") = Data3.Recordset.Fields("other").Value & "/" & Text5.Text
End If
Data3.Recordset.Update
'MsgBox "选书成功", vbOKOnly
'加声音:选书成功,(新增图书入库成功)
sndPlaySound "d:\cbssys\wav\hgcg.wav", SND_SYNC
Data3.Refresh
Data3.Recordset.MoveFirst
Data1.Refresh
Label8.Caption = "原来无记录,新增成功!(本数:" + Text3.Text + ")"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = 20
Exit Sub
End If
'---------------------------------------------------------------
'有数据情况
'数据库中有多条数据
If topint > 1 Then
'提示,手工处理.
MsgBox "此书可能是丛书或多卷书,请在下面表格中手工修改入库数."
Label8.Caption = "此书为从书,请在下面修改!"
End If
'---------------------------------------------
'数据库中存在1条数据
If topint = 1 Then
'处理有1记录,但库存为0
If Data1.Recordset.Fields("fbl").Value = 0 Then
Data1.Recordset.MoveFirst
'处理排架号
If Text4.Text = "" Then
If Data1.Recordset("bjh").Value = "" Then
MsgBox "请输入排架号!"
Exit Sub
End If
End If
Data1.Recordset.Edit
Data1.Recordset.Fields("fbl") = Str(Text3.Text)
Data1.Recordset.Fields("modidate") = Now()
If (Text4.Text <> "") And (Len(Data1.Recordset("bjh").Value) = 0) Then
Data1.Recordset.Fields("bjh") = Text4.Text
End If
If Len(Text5.Text) <> 0 Then
Data1.Recordset.Fields("other") = Data1.Recordset.Fields("other").Value & "/" & Text5.Text
End If
Data1.Recordset.Update
Data3.Refresh
Data3.Recordset.FindFirst ("isbn='" & isbntext & "'")
sndPlaySound "d:\cbssys\wav\hgcg.wav", SND_SYNC
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = 20
Label8.Caption = "原来有记录,库存为0,新增成功!(本数:" + Text3.Text + ")"
Exit Sub
End If
'处理有1记录但库存不为0----------------------------------
kz = Data1.Recordset.Fields("fbl").Value
If Data1.Recordset.Fields("fbl").Value > 0 Then
Data1.Recordset.MoveFirst
'处理排架号
If Text4.Text = "" Then
If Data1.Recordset("bjh").Value = "" Then
MsgBox "请输入排架号!"
Exit Sub
End If
End If
Data1.Recordset.Edit
Data1.Recordset.Fields("fbl") = Str(Val(Data1.Recordset.Fields("fbl")) + Val(Text3.Text))
Data1.Recordset.Fields("modidate") = Now()
If Len(Text5.Text) <> 0 Then
Data1.Recordset.Fields("other") = Data1.Recordset.Fields("other").Value & "/" & Text5.Text
End If
If (Text4.Text <> "") And (Len(Data1.Recordset("bjh").Value) = 0) Then
Data1.Recordset.Fields("bjh") = Text4.Text
End If
Data1.Recordset.Update
Data3.Refresh
Data3.Recordset.FindFirst ("isbn='" & isbntext & "'")
sndPlaySound "d:\cbssys\wav\hgcg.wav", SND_SYNC
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = 20
Label8.Caption = "原来有记录,库存为" & kz & ",新增本数(" + Text3.Text + ")成功!"
End If
End If
'----------------------------------------------
End Sub
Private Sub Command7_Click()
On Error Resume Next
recnum2 = Data1.Recordset.RecordCount
If recnum2 = 0 Then
MsgBox "下表中无数据!,没做处理."
Exit Sub
Else
Data1.Recordset.MoveFirst
For i = 1 To recnum2
Data1.Recordset.Edit
Data1.Recordset.Fields("modidate") = Now()
Data1.Recordset.Update
Data1.Recordset.MoveNext
Next i
Data3.Refresh
Label8.Caption = "数据更新成功!"
End If
End Sub
Private Sub Form_Load()
Me.Top = 0
Label8.Caption = "提示信息!"
Combo2.Text = "书 名"
Combo1.Text = "ISBN号"
Combo3.Text = "控制号"
Data3.RecordSource = "select * from 预采数据 order by fbl desc"
Data3.Refresh
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then '回车
Call Command3_Click '选购
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -