入库.frm

来自「此为库存管理系统!使用了VB开发工具开发」· FRM 代码 · 共 956 行 · 第 1/3 页

FRM
956
字号
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FF00&
         Height          =   360
         Left            =   2160
         TabIndex        =   11
         Top             =   2160
         Width           =   1695
      End
      Begin VB.TextBox Text2 
         BackColor       =   &H00000000&
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FF00&
         Height          =   360
         Left            =   2160
         TabIndex        =   1
         Top             =   1560
         Width           =   1695
      End
      Begin VB.Label Label14 
         BackColor       =   &H00C00000&
         Caption         =   "仓库编号:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   36
         Top             =   480
         Width           =   1335
      End
      Begin VB.Label Label7 
         BackColor       =   &H00C00000&
         Caption         =   "时间:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   10
         Top             =   4560
         Width           =   975
      End
      Begin VB.Label Label6 
         BackColor       =   &H00C00000&
         Caption         =   "日期:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   9
         Top             =   3960
         Width           =   855
      End
      Begin VB.Label Label9 
         BackColor       =   &H00C00000&
         Caption         =   "送货人名称:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   8
         Top             =   5760
         Width           =   1575
      End
      Begin VB.Label Label8 
         BackColor       =   &H00C00000&
         Caption         =   "入库单位名称:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   7
         Top             =   5160
         Width           =   1815
      End
      Begin VB.Label Label5 
         BackColor       =   &H00C00000&
         Caption         =   "数量:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   3480
         Width           =   855
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C00000&
         Caption         =   "规格:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   5
         Top             =   2880
         Width           =   855
      End
      Begin VB.Label Label3 
         BackColor       =   &H00C00000&
         Caption         =   "型号:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   2280
         Width           =   855
      End
      Begin VB.Label Label2 
         BackColor       =   &H00C00000&
         Caption         =   "生产厂家:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   1680
         Width           =   1335
      End
      Begin VB.Label Label1 
         BackColor       =   &H00C00000&
         Caption         =   "商品名称:"
         ForeColor       =   &H0000FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   1080
         Width           =   1335
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection

conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
sql = "select * from 商品 where 名称='" & Combo1.Text & "'"
rs.Open sql, conn, 1, 3
Text2.Text = rs.Fields(1).Value
Text3.Text = rs.Fields(2).Value
Text4.Text = rs.Fields(3).Value

End Sub

Private Sub Combo2_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection

conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
sql = "select * from 客户信息 where 客户名称='" & Combo2.Text & "'"
rs.Open sql, conn, 1, 3
Combo3.Text = rs.Fields(3).Value


End Sub

Private Sub Command1_Click()

'--------------------------添加信息----------------------------------------------------
    If Combo1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Combo2.Text = "" Or Combo3.Text = "" Then
        MsgBox "请输入完整信息!", , "库存管理系统"
        Exit Sub
     Else
 
     
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields(0) = Combo1.Text
    Adodc1.Recordset.Fields(1) = Text2.Text
    Adodc1.Recordset.Fields(2) = Text3.Text
    Adodc1.Recordset.Fields(3) = Text4.Text
    Adodc1.Recordset.Fields(4) = Val(Text5.Text)
    Adodc1.Recordset.Fields(5) = Text6.Text
    Adodc1.Recordset.Fields(6) = Text7.Text
    Adodc1.Recordset.Fields(7) = Combo2.Text
    Adodc1.Recordset.Fields(8) = Combo3.Text
    Adodc1.Recordset.Fields(9) = Combo4.Text
     Adodc1.Recordset.update
    
   
     MsgBox "已经成功入库!", , "库存管理系统"
  
     
    End If
    Adodc1.Refresh
    DataGrid1.Refresh
    
    
 '------------------------------现有库存信息------------------------------------------
    
     
Set rst = New ADODB.Recordset
Set conn = New ADODB.Connection

conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open

 Text10.Text = Combo1.Text
 
 sql = "select * from 现有库存表 where 商品名称='" & Text10.Text & "'"
 
 rst.Open sql, conn, 1, 3
 
 '-----------------判断现有库中是否有此商品--------------------------------------------
 
 If rst.BOF = True And rst.EOF = True Then
 
 MsgBox "现有库存表中无此商品信息!将此商品信息加入到商品表中!", , "库存管理系统"
 Form8.Text1.Text = Form1.Combo1.Text
Form8.Text2.Text = Form1.Text2.Text
Form8.Text3.Text = Form1.Text3.Text
Form8.Text4.Text = Form1.Text4.Text
 
 Form8.Show
rst.AddNew
 rst.Fields(0).Value = Combo1.Text
 rst.Fields(1).Value = Val(Text5.Text)
 rst.Fields(2).Value = Val(Text5.Text) + 200
 rst.Fields(3).Value = Val(Text5.Text)
 rst.update
 Text11.Text = rst.Fields(1)
 Text12.Text = rst.Fields(2)
 Text13.Text = rst.Fields(3)
 Else
 
 rst.Fields(1).Value = Val(Text5.Text) + rst.Fields(1).Value
 rst.update
 
 Text11.Text = rst.Fields(1)
 Text12.Text = rst.Fields(2)
 Text13.Text = rst.Fields(3)
    
    End If
 '----------------------------判断是否越界!-----------------------------------------------
    
If rst(1).Value > rst(2).Value Then
MsgBox "危险啊!!已超过最大库存!!!需修改入库数量!!!", , "库存管理系统"
Adodc1.Recordset.MoveLast

Form9.Show

End If
If rst(1).Value < rst(3).Value Then
MsgBox "库存不足!!急需加货啊!!!", , "库存管理系统"
End If


End Sub

Private Sub Command2_Click()
Form9.Show
End Sub

Private Sub Command3_Click()
Adodc1.Recordset.Delete

End Sub

Private Sub Command4_Click()
Form1.Hide

End Sub

Private Sub Command5_Click()
Form3.Show
End Sub

Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Set rs2 = New ADODB.Recordset
Set conn = New ADODB.Connection
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open

sql = "select * from 客户信息 where 客户类型='供应商'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open sql, conn, 1, 3
Set Me.DataGrid2.DataSource = rs

sql1 = "select * from 商品"
rs1.Open sql1, conn, 1, 3
For j = 0 To rs1.RecordCount - 1
Combo1.List(j) = rs1.Fields(0)
rs1.MoveNext
Next

For i = 0 To rs.RecordCount - 1
Combo2.List(i) = rs.Fields(1).Value
Combo3.List(i) = rs.Fields(3).Value
rs.MoveNext
Next

sql2 = "select * from 仓库信息"
rs2.CursorLocation = adUseClient
rs2.Open sql2, conn, 1, 3
For k = 0 To rs2.RecordCount - 1
Combo4.List(k) = rs2.Fields(0).Value
rs2.MoveNext
Next

End Sub

⌨️ 快捷键说明

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