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

📄 货物入库.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    =   4920
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7170
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   4920
   ScaleWidth      =   7170
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txt7 
      Height          =   375
      Left            =   3000
      TabIndex        =   19
      Top             =   3120
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.TextBox txt6 
      Height          =   375
      Left            =   1320
      TabIndex        =   18
      Top             =   1920
      Width           =   1455
   End
   Begin VB.TextBox txt5 
      Height          =   375
      Left            =   4920
      TabIndex        =   16
      Top             =   1200
      Width           =   1695
   End
   Begin VB.CommandButton cmdFresh 
      Caption         =   "刷 新"
      Height          =   450
      Left            =   3000
      TabIndex        =   12
      Top             =   4200
      Width           =   1410
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退 出"
      Height          =   450
      Left            =   4920
      TabIndex        =   11
      Top             =   4200
      Width           =   1410
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添 加"
      Default         =   -1  'True
      Height          =   450
      Left            =   1080
      TabIndex        =   10
      Top             =   4200
      Width           =   1410
   End
   Begin VB.TextBox txt4 
      Height          =   1095
      Left            =   4920
      TabIndex        =   9
      Top             =   2640
      Width           =   1695
   End
   Begin VB.TextBox txt3 
      Height          =   375
      Left            =   1335
      TabIndex        =   4
      Top             =   3360
      Width           =   1455
   End
   Begin VB.TextBox txt2 
      Height          =   375
      Left            =   1335
      TabIndex        =   3
      Top             =   2640
      Width           =   1455
   End
   Begin VB.TextBox txt1 
      Height          =   375
      Left            =   1320
      TabIndex        =   2
      Top             =   1200
      Width           =   1455
   End
   Begin MSComCtl2.DTPicker DT_RegeditDate 
      Height          =   330
      Left            =   4920
      TabIndex        =   15
      Top             =   1920
      Width           =   1785
      _ExtentX        =   3149
      _ExtentY        =   582
      _Version        =   393216
      CustomFormat    =   "yyy-MM-dd"
      Format          =   21364736
      CurrentDate     =   37111
   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            =   3840
      TabIndex        =   17
      Top             =   1320
      Width           =   1455
   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            =   3840
      TabIndex        =   14
      Top             =   1920
      Width           =   1335
   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            =   4080
      TabIndex        =   13
      Top             =   2640
      Width           =   855
   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            =   -120
      TabIndex        =   8
      Top             =   1920
      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            =   -120
      TabIndex        =   7
      Top             =   3360
      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            =   -120
      TabIndex        =   6
      Top             =   2640
      Width           =   1455
   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            =   -120
      TabIndex        =   5
      Top             =   1320
      Width           =   1455
   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            =   4560
      TabIndex        =   1
      Top             =   720
      Width           =   2415
   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            =   1800
      TabIndex        =   0
      Top             =   120
      Width           =   3255
   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()
    SuppInfo_Add

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.txt7.Text = ""
    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()

      
    
        Me.cmdAdd.Default = True
        Initial_Add
        Exit Sub
    
    End

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 "添加新的货物信息成功!"
    Set Rst = Nothing
    
    kucun_Add
    
    Initial_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
    If Rst.RecordCount = 0 Then
       Rst.AddNew
       Rst.Fields("名称").Value = Me.txt1.Text
       Rst.Fields("编号").Value = Me.txt5.Text
       Rst.Fields("库存总量").Value = Me.txt3.Text
       Rst.Update
    Exit Function
    Else
       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
    End If
    
    Set Rst = Nothing
        Initial_Add
    kucun_Add = False
 Exit Function

End Function

⌨️ 快捷键说明

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