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

📄 frmshelf.frm

📁 一个简单但功能强大的进货系统,同样适合用于毕业论文的设计
💻 FRM
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmShelf 
   Caption         =   "货架管理"
   ClientHeight    =   6180
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5790
   Icon            =   "frmShelf.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   6180
   ScaleWidth      =   5790
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame1 
      Height          =   3030
      Left            =   0
      TabIndex        =   8
      Top             =   0
      Width           =   5775
      Begin VB.CommandButton CmdDep 
         Caption         =   "退出(&X)"
         Height          =   315
         Index           =   5
         Left            =   4320
         TabIndex        =   15
         Top             =   2580
         Width           =   1275
      End
      Begin VB.CommandButton CmdDep 
         Caption         =   "列表(&P)"
         Height          =   315
         Index           =   4
         Left            =   4320
         TabIndex        =   14
         Top             =   2115
         Width           =   1275
      End
      Begin VB.CommandButton CmdDep 
         Caption         =   "删除(&D)"
         Height          =   315
         Index           =   3
         Left            =   4320
         TabIndex        =   13
         Top             =   1650
         Width           =   1275
      End
      Begin VB.CommandButton CmdDep 
         Caption         =   "查询(&F)"
         Height          =   315
         Index           =   2
         Left            =   4320
         TabIndex        =   12
         Top             =   1170
         Width           =   1275
      End
      Begin VB.CommandButton CmdDep 
         Caption         =   "编辑(&E)"
         Height          =   315
         Index           =   1
         Left            =   4320
         TabIndex        =   11
         Top             =   705
         Width           =   1275
      End
      Begin VB.CommandButton CmdDep 
         Caption         =   "增加(&N)"
         Height          =   315
         Index           =   0
         Left            =   4320
         TabIndex        =   10
         Top             =   240
         Width           =   1275
      End
      Begin MSDataGridLib.DataGrid DataGrid1 
         Bindings        =   "frmShelf.frx":1272
         Height          =   2655
         Left            =   120
         TabIndex        =   9
         Top             =   240
         Width           =   3975
         _ExtentX        =   7011
         _ExtentY        =   4683
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         HeadLines       =   1
         RowHeight       =   15
         TabAcrossSplits =   -1  'True
         TabAction       =   2
         WrapCellPointer =   -1  'True
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         DataMember      =   "Com仓库货架表"
         ColumnCount     =   3
         BeginProperty Column00 
            DataField       =   "仓库编号"
            Caption         =   "仓库编号"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "货架编号"
            Caption         =   "货架编号"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "货架类型"
            Caption         =   "货架类型"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               ColumnAllowSizing=   0   'False
               ColumnWidth     =   1005.165
            EndProperty
            BeginProperty Column01 
               ColumnAllowSizing=   0   'False
               ColumnWidth     =   1005.165
            EndProperty
            BeginProperty Column02 
            EndProperty
         EndProperty
      End
   End
   Begin VB.Frame Frame2 
      Height          =   3135
      Left            =   0
      TabIndex        =   3
      Top             =   3050
      Width           =   5775
      Begin MSDataListLib.DataCombo DCStorage 
         Bindings        =   "frmShelf.frx":1287
         DataField       =   "仓库编号"
         DataMember      =   "Com仓库货架表"
         DataSource      =   "DEaccp"
         Height          =   330
         Left            =   2400
         TabIndex        =   0
         Top             =   400
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   582
         _Version        =   393216
         Enabled         =   0   'False
         Appearance      =   0
         Style           =   2
         ListField       =   "仓库名称"
         BoundColumn     =   "仓库编号"
         Text            =   ""
         Object.DataMember      =   "Com仓库表"
      End
      Begin VB.CommandButton CmdAct 
         Caption         =   "恢复(&U)"
         Enabled         =   0   'False
         Height          =   315
         Index           =   1
         Left            =   3360
         TabIndex        =   5
         Top             =   2400
         Width           =   1275
      End
      Begin VB.CommandButton CmdAct 
         Caption         =   "保存(&S)"
         Enabled         =   0   'False
         Height          =   315
         Index           =   0
         Left            =   1200
         TabIndex        =   4
         Top             =   2400
         Width           =   1275
      End
      Begin VB.TextBox TxtType 
         Appearance      =   0  'Flat
         DataField       =   "货架类型"
         DataMember      =   "Com仓库货架表"
         DataSource      =   "DEaccp"
         Height          =   300
         Left            =   2400
         TabIndex        =   2
         Top             =   1665
         Width           =   1575
      End
      Begin VB.TextBox TxtNumber 
         Appearance      =   0  'Flat
         DataField       =   "货架编号"
         DataMember      =   "Com仓库货架表"
         DataSource      =   "DEaccp"
         Height          =   300
         Left            =   2400
         TabIndex        =   1
         Top             =   1000
         Width           =   1575
      End
      Begin VB.Label Label1 
         Caption         =   "仓库名称:"
         Height          =   255
         Left            =   1440
         TabIndex        =   16
         Top             =   480
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "货架编号:"
         Height          =   255
         Left            =   1440
         TabIndex        =   7
         Top             =   1080
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "货架类型:"
         Height          =   255
         Left            =   1440
         TabIndex        =   6
         Top             =   1680
         Width           =   855
      End
   End
End
Attribute VB_Name = "frmShelf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rsShelf As ADODB.Recordset
Dim AddOrEdit As Boolean

Private Sub CmdAct_Click(Index As Integer)
    Dim blnIsTrue As Boolean
    With rsShelf
        Select Case Index
            Case 0
                blnIsTrue = Save()
                If Not blnIsTrue Then
                    Exit Sub
                End If
                .UpdateBatch
                .MoveLast
            Case 1
                .CancelUpdate
                If .RecordCount <> 0 Then
                    .MoveFirst
                End If
        End Select
    End With
    Call IsEdit(False)
    Me.DataGrid1.Refresh
    
End Sub

Private Sub CmdDep_Click(Index As Integer)
    
    Dim intNum As Integer
    Select Case Index
        Case 0
            AddOrEdit = True
            Call AddNew
        Case 1
            AddOrEdit = False
            Call IsEdit(True)
            Me.TxtNumber.SetFocus
        Case 2
            
        Case 3
            intNum = MsgBox("确认删除当前记录吗?", vbYesNo + vbQuestion, "删除确认")
            If intNum = vbYes Then
                With rsShelf
                    .Delete
                    .UpdateBatch
                    If .RecordCount <> 0 Then
                        .MoveFirst
                    Else
                        For intNum = 1 To 4
                            Me.CmdDep(intNum).Enabled = False
                        Next
                    End If
                End With
            End If
        Case 4
            Me.DataGrid1.Refresh
        Case 5
            Unload Me
    End Select
    
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    EnterToTab KeyAscii
End Sub

Private Sub Form_Load()
    
'    Dim SQL As String
'    Set rs = New Recordset
'
'    rs.CursorLocation = adUseClient
'
'    SQL = "select * from 仓库表"
'    Set rs = ExecuteSQL(SQL)
    
    'Set Me.DataGrid1.DataSource = rs
    Set rsShelf = DEaccp.rsCom仓库货架表
    

    Call IsEdit(False)
    
End Sub




Private Sub AddNew()


    
    With rsShelf

        .AddNew
        Call IsEdit(True)
        Me.DCstorage.SetFocus
    End With
    
End Sub

Private Sub IsEdit(blnIsEdit As Boolean)
    
    Dim intNum As Integer
    If AddOrEdit Then
    Me.DCstorage.Enabled = blnIsEdit
    End If
    'Me.TxtID.Enabled = blnIsEdit
    Me.TxtNumber.Enabled = blnIsEdit
    Me.TxtType.Enabled = blnIsEdit

    Me.DataGrid1.Enabled = Not blnIsEdit
    For intNum = 0 To 1
        Me.CmdAct(intNum).Enabled = blnIsEdit
    Next
    For intNum = 0 To 5
        Me.CmdDep(intNum).Enabled = Not blnIsEdit
    Next
    If rsShelf.RecordCount = 0 Then
        For intNum = 1 To 4
            Me.CmdDep(intNum).Enabled = False
        Next
    End If

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If CmdDep(5).Enabled = False Then
        MsgBox "请先退出编辑状态后再退出该程序!", , "提示"
        Cancel = True
    End If
    
End Sub

Public Function Save() As Boolean
    
    If Me.DCstorage.Text = "" Then
        MsgBox "请选择仓库名称!", vbOKOnly + vbCritical, "添加仓库错误"
        Me.DCstorage.SetFocus
        Exit Function
        Save = False
    End If
    
    Dim rsNum As ADODB.Recordset
    Dim SQLNum As String
    SQLNum = "select * from 仓库货架表 where 仓库编号='" & Me.DCstorage.BoundText & "' and 货架编号='" & Me.TxtNumber.Text & "'"
    Set rsNum = New Recordset
    Set rsNum = ExecuteSQL(SQLNum)
    If AddOrEdit Then
        If Not rsNum.EOF Then
            MsgBox "仓库编号 AND 货架编号重复!请重新输入新的货架编号!", vbOKOnly + vbCritical, "添加仓库错误"
            SendKeys "{home}+{end}"
            Me.TxtNumber.SetFocus
            Exit Function
            Save = False
        End If
    End If
    
'    If Trim(Me.TxtNumber.Text) = "" Then
'        MsgBox "货架编号不能为空!", vbOKOnly + vbCritical, "添加仓库错误"
'        Me.TxtNumber.SetFocus
'        Exit Function
'        Save = False
'    End If
    
    If Trim(Me.TxtType.Text) = "" Then
        MsgBox "货架名称不能为空!", vbOKOnly + vbCritical, "添加仓库错误"
        Me.TxtType.SetFocus
        Save = False
        Exit Function
    End If
    
    Save = True
    
End Function

Private Sub Form_Unload(Cancel As Integer)
    rsShelf.Close
    Set rsShelf = Nothing
    
End Sub

⌨️ 快捷键说明

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