⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 库存查询.frm

📁 内容摘要:在现代企业中
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select 编号,仓库名称 from 仓库"
      Caption         =   "Adodc2"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "仓库名称:"
      Height          =   195
      Left            =   5760
      TabIndex        =   4
      Top             =   240
      WhatsThisHelpID =   232
      Width           =   855
   End
End
Attribute VB_Name = "库存查询"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private SQL As String
Private 仓库编号 As String

Option Explicit


Private Sub initdatagrid1()

    DataGrid1.Columns(0).width = 500
    DataGrid1.Columns(1).width = 800
    DataGrid1.Columns(2).width = 800
    DataGrid1.Columns(3).width = 800
    DataGrid1.Columns(4).width = 800
    DataGrid1.Columns(5).width = 800
    DataGrid1.Columns(6).width = 800
    DataGrid1.Columns(7).width = 800
    DataGrid1.Columns(8).width = 800
    DataGrid1.Columns(9).width = 0

End Sub

Private Sub updatecolumns()

    Dim d As Integer
    Dim inttype As Integer
    
    If DataGrid1.Columns.count <= 2 Then
        d = 600
    Else
        d = 50
    End If
    
    Dim i As Integer
    For i = 0 To DataGrid1.Columns.count - 1
        DataGrid1.Columns(i).width = Len(DataGrid1.Columns(i).caption) * d

        inttype = Adodc1.Recordset.Fields(i).Type
        
        Select Case inttype
            Case dbBoolean
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 500
            Case dbByte
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 500
            Case dbInteger
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 500
            Case dbLong
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 500
            Case dbCurrency
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 1000
            Case dbSingle
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 600
            Case dbDouble
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 700
            Case dbDate
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 800
            Case dbText
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 900
            Case dbLongBinary
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 1000
            Case dbMemo
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 1000
            Case dbGUID
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 1000
            Case Else
                DataGrid1.Columns(i).width = DataGrid1.Columns(i).width + 1000
        End Select

    Next
    
End Sub

Private Sub DataCombo1_Change()
    
    Option1.Value = False
    Option2.Value = False
    Option3.Value = False
    
End Sub


Private Sub Form_Load()

    Adodc1.ConnectionString = DataConnectString
    SQL = Adodc1.RecordSource
    
    Adodc1.Visible = False
    
    Adodc2.ConnectionString = DataConnectString
    Set DataCombo1.RowSource = Adodc2
    DataCombo1.ListField = "仓库名称"
    
    Adodc2.Refresh
    Adodc2.Visible = False
    
    T库存数量.Text = "无限制"
    
End Sub


Private Sub Option1_Click()
    update
End Sub

Private Sub update()
    
    If DataCombo1.Text = "" Then
        MsgBox "请选择仓库名称!"
        Exit Sub
    End If
    
     On Error GoTo quit
    '获取仓库编号
    fMainForm.m_checkado.RecordSource = "select 编号 from 仓库 where 仓库名称='" + DataCombo1.Text + "'"
    fMainForm.m_checkado.Refresh
    
    仓库编号 = fMainForm.m_checkado.Recordset.Fields("编号").Value
    
    If Option1.Value = True Then
        Adodc1.RecordSource = "select * from 货物信息 where 编号 not in (select 货物编号 from 库存状况 where 仓库编号=" + 仓库编号 + ")"
        Set DataGrid1.DataSource = Adodc1
        Adodc1.Refresh
        updatecolumns
    ElseIf Option2.Value = True Then
        Adodc1.RecordSource = "select 库存状况.货物编号 as 编号,货物信息.货物名称,货物信息.货物类别,货物信息.货物规格,货物信息.计量单位,库存状况.库存数量,货物信息.最低限量,仓库.仓库名称 as 存放仓库,货物信息.备注 from 库存状况,货物信息,仓库 where 货物信息.编号=库存状况.货物编号 and 仓库.编号=库存状况.仓库编号 and 库存数量<=货物信息.最低限量 and 库存状况.仓库编号=" + 仓库编号
        Set DataGrid1.DataSource = Adodc1
        Adodc1.Refresh
        updatecolumns
    ElseIf Option3.Value = True Then
        Adodc1.RecordSource = "select 库存状况.货物编号 as 编号,货物信息.货物名称,货物信息.货物类别,货物信息.货物规格,货物信息.计量单位,库存状况.库存数量,货物信息.最高限量,仓库.仓库名称 as 存放仓库,货物信息.备注 from 库存状况,货物信息,仓库 where 货物信息.编号=库存状况.货物编号 and 仓库.编号=库存状况.仓库编号 and 库存数量>=货物信息.最高限量 and 库存状况.仓库编号=" + 仓库编号
        Set DataGrid1.DataSource = Adodc1
        Adodc1.Refresh
        updatecolumns
    End If
    
quit:
    
End Sub

Private Sub Option2_Click()
    update
End Sub

Private Sub Option3_Click()
    update
End Sub

Private Sub 打印_Click()

   ShowPrintDlg Adodc1, "库存查询"
    
End Sub

Private Sub 货物规格_DblClick()
    
    On Error Resume Next
    Dim sel As New 数据选择
    sel.Adodc1.ConnectionString = DataConnectString
    sel.Adodc1.RecordSource = "select 编号,货物规格 from 货物信息"
    sel.title = "请选择货物规格"
    
    sel.Show vbModal
    
    If sel.result2 <> "" Then 货物规格.Text = sel.result2
    
    Unload sel
End Sub

Private Sub 货物类别_DblClick()
    
    On Error Resume Next
    Dim sel As New 数据选择
    sel.Adodc1.ConnectionString = DataConnectString
    sel.Adodc1.RecordSource = "select 类别名称,备注 from 货物类别"
    sel.title = "请选择货物类别"
    
    sel.Show vbModal
    
    If sel.result1 <> "" Then 货物类别.Text = sel.result1
    
    Unload sel
    
End Sub

Private Sub 货物名称_DblClick()

    On Error Resume Next
    Dim sel As New 数据选择
    sel.Adodc1.ConnectionString = DataConnectString
    sel.Adodc1.RecordSource = "select 编号,货物名称 from 货物信息"
    sel.title = "请选择货物名称"
    
    sel.Show vbModal
    
    If sel.result2 <> "" Then 货物名称.Text = sel.result2
    
    Unload sel
    
End Sub

Private Sub 执行查询_Click()
    
    If DataCombo1.Text = "" Then
        MsgBox "请选择仓库名称!"
        Exit Sub
    End If
    
    On Error GoTo quit
    '获取仓库编号
    fMainForm.m_checkado.RecordSource = "select 编号 from 仓库 where 仓库名称='" + DataCombo1.Text + "'"
    fMainForm.m_checkado.Refresh
    
    仓库编号 = fMainForm.m_checkado.Recordset.Fields("编号").Value
    
    Dim s As String
    
    s = SQL
    
    '处理s
    '加上仓库编号
    s = s + " and 库存状况.仓库编号=" + 仓库编号
    
    If 货物名称.Text <> "" Then
        s = s + " and 货物信息.货物名称 like '%" + 货物名称.Text + "%'"
    End If
    
    If 货物类别.Text <> "" Then
        s = s + " and 货物信息.货物类别 like '%" + 货物类别.Text + "%'"
    End If
    
    If 货物规格.Text <> "" Then
        s = s + " and 货物信息.货物规格 like '%" + 货物规格.Text + "%'"
    End If
    
    If T库存数量.Text <> "无限制" And 库存数量.Text <> "" Then
        s = s + " and 库存状况.库存数量" + T库存数量.Text + 库存数量.Text
    End If
    
    Adodc1.RecordSource = s
    Set DataGrid1.DataSource = Adodc1
    Adodc1.Refresh
    
    initdatagrid1
    
quit:
    
End Sub


'此源码由程序太平洋收集整理发布,任何人都可自由转载,但需保留本站信息
'╭⌒╮┅~ ¤ 欢迎光临程序太平洋╭⌒╮
'╭⌒╭⌒╮╭⌒╮~╭⌒╮  ︶  ,︶︶
',︶︶︶︶,''︶~~ ,''~︶︶  ,''
'╔ ╱◥███◣═╬╬╬╬╬╬╬╬╬╗
'╬ ︱田︱田 田 ︱          ╬
'╬       http://www.5ivb.net ╬
'╬  ╭○╮●                     ╬
'╬  /■\/■\                    ╬
'╬   <| ||    有希望,就有成功! ╬
'╬                 ╬
'╚╬╬╬╬╬╬╬╬╬╬╗  ╔╬╬╬╬╝
'
'说明:
'专业提供VB、.NET、Delphi、ASP、PB源码下载
'包括:程序源码,控件,商业源码,系统方案,开发工具,书籍教程,技术文档


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -