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

📄 货物出库.frm

📁 仓库查询系统的管理软件的源代码
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form 货物出库 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "货物出库"
   ClientHeight    =   5355
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7815
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5355
   ScaleWidth      =   7815
   StartUpPosition =   2  '屏幕中心
   Visible         =   0   'False
   Begin VB.TextBox txt7 
      Height          =   375
      Left            =   3240
      TabIndex        =   19
      Text            =   "Text1"
      Top             =   3360
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.TextBox txt1 
      Height          =   375
      Left            =   1440
      TabIndex        =   8
      Top             =   1320
      Width           =   1455
   End
   Begin VB.TextBox txt2 
      Height          =   375
      Left            =   1455
      TabIndex        =   7
      Top             =   2820
      Width           =   1455
   End
   Begin VB.TextBox txt3 
      Height          =   375
      Left            =   1455
      TabIndex        =   6
      Top             =   3660
      Width           =   1455
   End
   Begin VB.TextBox txt4 
      Height          =   1335
      Left            =   5280
      TabIndex        =   5
      Top             =   2760
      Width           =   1815
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "确定出库"
      Default         =   -1  'True
      Height          =   330
      Left            =   1200
      TabIndex        =   4
      Top             =   4440
      Width           =   1530
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退 出"
      Height          =   330
      Left            =   5760
      TabIndex        =   3
      Top             =   4440
      Width           =   1530
   End
   Begin VB.CommandButton cmdFresh 
      Caption         =   "刷 新"
      Height          =   330
      Left            =   3480
      TabIndex        =   2
      Top             =   4440
      Width           =   1530
   End
   Begin VB.TextBox txt5 
      Height          =   375
      Left            =   5280
      TabIndex        =   1
      Top             =   1320
      Width           =   1695
   End
   Begin VB.TextBox txt6 
      Height          =   375
      Left            =   1440
      TabIndex        =   0
      Top             =   2040
      Width           =   1455
   End
   Begin MSComCtl2.DTPicker DT_RegeditDate 
      Height          =   330
      Left            =   5280
      TabIndex        =   9
      Top             =   2040
      Width           =   1785
      _ExtentX        =   3149
      _ExtentY        =   582
      _Version        =   393216
      CustomFormat    =   "yyy-MM-dd"
      Format          =   21364736
      CurrentDate     =   37111
   End
   Begin VB.Label Label23 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "货物出库"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000E&
      Height          =   495
      Left            =   2160
      TabIndex        =   18
      Top             =   240
      Width           =   3255
   End
   Begin VB.Label lblNowDate 
      Caption         =   "今天日期:"
      BeginProperty DataFormat 
         Type            =   0
         Format          =   "gg yyyy""斥"" M""岿"" d""老"""
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   0
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   4680
      TabIndex        =   17
      Top             =   840
      Width           =   2415
   End
   Begin VB.Label Label9 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "货物名称:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   0
      TabIndex        =   16
      Top             =   1440
      Width           =   1455
   End
   Begin VB.Label Label8 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "仓管员:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   0
      TabIndex        =   15
      Top             =   2880
      Width           =   1455
   End
   Begin VB.Label Label12 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "出库数量:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   0
      TabIndex        =   14
      Top             =   3720
      Width           =   1455
   End
   Begin VB.Label Label_Type 
      Alignment       =   1  'Right Justify
      BackColor       =   &H80000013&
      BackStyle       =   0  'Transparent
      Caption         =   "出库人:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   0
      TabIndex        =   13
      Top             =   2040
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "备  注:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4320
      TabIndex        =   12
      Top             =   2880
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "出库时间:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4080
      TabIndex        =   11
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "货物编码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   4080
      TabIndex        =   10
      Top             =   1440
      Width           =   1455
   End
End
Attribute VB_Name = "货物出库"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
    
Private Sub cmdAdd_Click()
    kucun_panduan
End Sub

Private Sub cmdAddType_Click()
    frmType.Show
End Sub


Private Sub cmdExit_Click()
    Unload Me
End Sub


Private Sub Initial_Add()
    Dim Rst  As New ADODB.Recordset
    
    
    Me.txt1.Text = ""
    Me.txt2.Text = ""
    Me.txt3.Text = ""
    Me.txt5.Text = ""
    Me.txt4.Text = ""
    Me.txt6.Text = ""
    Me.lblNowDate.Caption = "今天日期: " & Format(Date, "yyyy年m月d日")
    Me.DT_RegeditDate.Value = Date
    
    
End Sub

Private Sub cmdFresh_Click()
        Initial_Add
    
End Sub

Private Sub Form_Load()
On Error GoTo ErrorExit
      
    
        Me.cmdAdd.Default = True
        Initial_Add
        Exit Sub
    
    End
ErrorExit:
    MsgBox Err.Description, vbCritical, Me.Caption
End Sub

Private Function SuppInfo_Add() As Boolean
    Dim Rst As New ADODB.Recordset
    Dim strSQL As String
    Dim intRst As Integer
    SuppInfo_Add = False
    If CheckFaceIsOk = False Then
        Exit Function
    End If
    strSQL = "SELECT * FROM 出库 where 编号 =" & Me.txt5.Text & ""
    Rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
    
    Rst.AddNew
    Rst.Fields("名称").Value = Me.txt1.Text
    Rst.Fields("出库时间").Value = Me.DT_RegeditDate.Value
    Rst.Fields("仓管员").Value = Me.txt2.Text
    Rst.Fields("出库数量").Value = Me.txt3.Text
    Rst.Fields("编号").Value = Me.txt5.Text
    Rst.Fields("出库人").Value = Me.txt6.Text
    
    If Me.txt4.Text = "" Then
        Rst.Fields("备注").Value = "无"
    Else
        Rst.Fields("备注").Value = Me.txt4.Text
    End If
    Rst.Update
    MsgBox "新的货物出库信息添加成功!", vbInformation, "操作成功-"
    Set Rst = Nothing
    kucun_Add
    
    SuppInfo_Add = False
    Exit Function

End Function





Private Function CheckFaceIsOk() As Boolean
    Dim intText As Integer
    Dim strText As String
    CheckFaceIsOk = True
    If Me.txt1 = "" Then
        MsgBox "货物名称不能为空!", vbCritical, Me.Caption
        Me.txt1.SetFocus
        CheckFaceIsOk = False
        Exit Function
    End If
    If Me.txt5 = "" Then
        MsgBox "货物编号不能为空!", vbCritical, Me.Caption
        Me.txt5.SetFocus
        CheckFaceIsOk = False
        Exit Function
    End If
    If Me.txt2 = "" Then
        MsgBox "仓管员不能为空!", vbCritical, Me.Caption
        Me.txt2.SetFocus
        CheckFaceIsOk = False
        Exit Function
    End If
    If Me.txt3 = "" Then
        MsgBox "出库数量不能为空!", vbCritical, Me.Caption
        Me.txt3.SetFocus
        CheckFaceIsOk = False
        Exit Function
    End If
    If Me.txt6.Text = "" Then
        MsgBox "出库人不能为空!", vbCritical, Me.Caption
        Me.txt6.SetFocus
        CheckFaceIsOk = False
        Exit Function
    End If
    
    For intText = 1 To Len(Me.txt5.Text)
        strText = Asc(Mid(Me.txt5.Text, intText, 1))
        If strText < 48 Or strText > 57 Then
            MsgBox "请用数字填写货物编号!", vbCritical, Me.Caption
            Me.txt5.Text = ""
            Me.txt5.SetFocus
            CheckFaceIsOk = False
            Exit Function
        End If
    Next
    For intText = 1 To Len(Me.txt3.Text)
        strText = Asc(Mid(Me.txt3.Text, intText, 1))
        If strText < 48 Or strText > 57 Then
            MsgBox "请用数字填写出库数量!", vbCritical, Me.Caption
            Me.txt3.Text = ""
            Me.txt3.SetFocus
            CheckFaceIsOk = False
            Exit Function
        End If
    Next
End Function

Private Function kucun_Add() As Boolean
    Dim Rst As New ADODB.Recordset
    Dim strCheck As String
    Dim strSQL As String
    Dim strItem As String
    kucun_Add = False
    If CheckFaceIsOk = False Then
        Exit Function
    End If
     If Me.txt1.Text <> "" Then
        strCheck = " 名称 LIKE '" & Me.txt1.Text & "'"
        If Me.txt5.Text <> "" Then
        strCheck = " 编号 LIKE '" & Me.txt5.Text & "'"
        End If
    
    End If
    strSQL = "select * from 库存"
    If strCheck <> "" Then
       strSQL = strSQL & " where " & strCheck
    End If
    Rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
       Me.txt7.Text = Rst.Fields("库存总量").Value
       Me.txt7.Text = Val(Me.txt7.Text) - Val(Me.txt3.Text)
       Rst.Fields("库存总量").Value = Me.txt7.Text
       Rst.Update
    
    Set Rst = Nothing
        Initial_Add
    kucun_Add = False
 Exit Function

End Function

Private Function kucun_panduan() As Boolean
Dim Rst As New ADODB.Recordset
    Dim strCheck As String
    Dim strSQL As String
    Dim strItem As String
    kucun_panduan = False
    If CheckFaceIsOk = False Then
        Exit Function
    End If
     If Me.txt1.Text <> "" Then
        strCheck = " 名称 LIKE '" & Me.txt1.Text & "'"
        If Me.txt5.Text <> "" Then
        strCheck = " 编号 LIKE '" & Me.txt5.Text & "'"
        End If
    End If
    
    strSQL = "select * from 库存"
    If strCheck <> "" Then
       strSQL = strSQL & " where " & strCheck
    End If
    Rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
    If Rst.RecordCount = 0 Then
      MsgBox "无库存!", vbCritical, Me.Caption
      Exit Function
    Else
      Me.txt7.Text = Rst.Fields("库存总量").Value
      If Val(Me.txt7.Text) < Val(Me.txt3.Text) Then
         MsgBox "库存不足!", vbCritical, Me.Caption
         Me.txt3.Text = ""
         Me.txt3.SetFocus
      Else
       Set Rst = Nothing
       SuppInfo_Add
      End If
       
    End If
    Set Rst = Nothing
    kucun_panduan = False
 Exit Function
End Function

⌨️ 快捷键说明

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