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

📄 frm_part_out_add.frm

📁 前些年帮人写的毕业设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm_Part_Out_Add 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "出库记录添加"
   ClientHeight    =   2865
   ClientLeft      =   3600
   ClientTop       =   2835
   ClientWidth     =   5745
   Icon            =   "Frm_Part_Out_Add.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2865
   ScaleWidth      =   5745
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   900
      Style           =   2  'Dropdown List
      TabIndex        =   6
      Top             =   180
      Width           =   1755
   End
   Begin VB.ComboBox Combo2 
      Height          =   300
      Left            =   3780
      Style           =   2  'Dropdown List
      TabIndex        =   5
      Top             =   180
      Width           =   1755
   End
   Begin VB.ComboBox Combo3 
      Height          =   300
      Left            =   3780
      Style           =   2  'Dropdown List
      TabIndex        =   4
      Top             =   1020
      Width           =   1755
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Left            =   900
      TabIndex        =   3
      Top             =   1440
      Width           =   1755
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   1200
      TabIndex        =   2
      Top             =   2340
      Width           =   1035
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   3540
      TabIndex        =   1
      Top             =   2340
      Width           =   1035
   End
   Begin VB.TextBox Text2 
      Height          =   300
      Left            =   3780
      TabIndex        =   0
      Top             =   1440
      Width           =   1755
   End
   Begin VB.Label Label13 
      BackColor       =   &H80000009&
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Left            =   900
      TabIndex        =   19
      Top             =   1860
      Width           =   1755
   End
   Begin VB.Label Label12 
      Caption         =   "库 存"
      Height          =   195
      Left            =   180
      TabIndex        =   18
      Top             =   1920
      Width           =   555
   End
   Begin VB.Label Label1 
      Caption         =   "供应商"
      Height          =   315
      Left            =   180
      TabIndex        =   17
      Top             =   240
      Width           =   615
   End
   Begin VB.Label Label2 
      Caption         =   "药 品"
      Height          =   195
      Left            =   2940
      TabIndex        =   16
      Top             =   240
      Width           =   495
   End
   Begin VB.Label Label3 
      Caption         =   "出库类型"
      Height          =   255
      Left            =   2940
      TabIndex        =   15
      Top             =   1080
      Width           =   795
   End
   Begin VB.Label Label4 
      Caption         =   "数 量"
      Height          =   255
      Left            =   180
      TabIndex        =   14
      Top             =   1500
      Width           =   555
   End
   Begin VB.Label Label5 
      Caption         =   "出 价"
      Height          =   255
      Left            =   3000
      TabIndex        =   13
      Top             =   1440
      Width           =   555
   End
   Begin VB.Label Label6 
      Caption         =   "药 种"
      Height          =   255
      Left            =   180
      TabIndex        =   12
      Top             =   660
      Width           =   495
   End
   Begin VB.Label Label7 
      BackColor       =   &H80000009&
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Left            =   900
      TabIndex        =   11
      Top             =   600
      Width           =   1755
   End
   Begin VB.Label Label8 
      Caption         =   "规 格"
      Height          =   255
      Left            =   2940
      TabIndex        =   10
      Top             =   660
      Width           =   495
   End
   Begin VB.Label Label9 
      BackColor       =   &H80000009&
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Left            =   3780
      TabIndex        =   9
      Top             =   600
      Width           =   1755
   End
   Begin VB.Label Label10 
      Caption         =   "包 装"
      Height          =   255
      Left            =   180
      TabIndex        =   8
      Top             =   1080
      Width           =   555
   End
   Begin VB.Label Label11 
      BackColor       =   &H80000009&
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Left            =   900
      TabIndex        =   7
      Top             =   1020
      Width           =   1755
   End
End
Attribute VB_Name = "Frm_Part_Out_Add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
    Combo2.Clear
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    
    rst.Open "select name,part_id from standard where stop=0 and supply_id=" & Combo1.ItemData(Combo1.ListIndex), cn, 0, 1
    
    If rst.BOF And rst.EOF Then
        MsgBox "请先添加药品信息!", vbExclamation, "提示"
        rst.Close
        cn.Close
        Command1.Enabled = False
        Exit Sub
    End If
    Do While Not rst.EOF
        Combo2.AddItem rst(0)
        Combo2.ItemData(Combo2.NewIndex) = rst(1)
        rst.MoveNext
    Loop
    rst.Close
    Combo2.ListIndex = 0
    
End Sub

Private Sub Combo2_Click()
    Combo3.Clear
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    
    rst.Open "select type_name,id from out_type where type_name<>'退货'", cn, 0, 1
    If rst.BOF And rst.EOF Then
        MsgBox "请先添加出库类型!", vbExclamation, "提示"
        rst.Close
        cn.Close
        Command1.Enabled = False
        Exit Sub
    End If
        Do While Not rst.EOF
        Combo3.AddItem rst(0)
        Combo3.ItemData(Combo3.NewIndex) = rst(1)
        rst.MoveNext
    Loop
    rst.Close
    Combo3.ListIndex = 0
    rst.Open "select model,normal,packing,in_price from standard where part_id=" & Combo2.ItemData(Combo2.ListIndex), cn, 0, 1
    Label7.Caption = rst(0)
    Label9.Caption = rst(1)
    Label11.Caption = rst(2)
    Text2 = rst(3)
    rst.Close
    rst.Open "select stock from part where part_id=" & Combo2.ItemData(Combo2.ListIndex)
    If rst.BOF And rst.EOF Then
        Label13.Caption = rst(0)
    Else
        Label13.Caption = rst(0)
    End If
    rst.Close
    cn.Close
    
End Sub

Private Sub Command1_Click()
    Dim lt As ListItem
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    If Not IsNumeric(Text1) Or Not IsNumeric(Text2) Then
        MsgBox "请正确输入数值!", vbExclamation, "提示"
        Exit Sub
    End If
    If Val(Label13.Caption) < Val(Text1) Then
        If MsgBox("该零件个数小于出库数,是否继续出库?" & vbCrLf & "如出库则产生负数库存!", vbYesNo + vbQuestion, "提示") = vbNo Then Exit Sub
    End If
    
    Set lt = Frm_Part_Out.ListView1.ListItems.Add(, , Combo2, 8, 8)
    lt.SubItems(1) = Combo1
    lt.SubItems(2) = Label7.Caption
    lt.SubItems(3) = Label9.Caption
    lt.SubItems(4) = Label11.Caption
    lt.SubItems(5) = Combo3
    lt.SubItems(6) = Text1
    lt.SubItems(7) = Text2
    lt.SubItems(8) = Combo2.ItemData(Combo2.ListIndex)
    lt.SubItems(9) = Combo3.ItemData(Combo3.ListIndex)
    Text1 = ""
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select distinct a.short_name,a.supply_id from supply a inner join standard b on a.supply_id=b.supply_id where a.stop=0", cn, 0, 1
    If rst.BOF And rst.EOF Then
        MsgBox "请先添加供应商信息!", vbExclamation, "提示"
        rst.Close
        cn.Close
        Command1.Enabled = False
        Exit Sub
    End If
    Do While Not rst.EOF
        Combo1.AddItem Trim(rst(0) & "")
        Combo1.ItemData(Combo1.NewIndex) = rst(1)
        rst.MoveNext
    Loop
    rst.Close
    Combo1.ListIndex = 0
   

End Sub


⌨️ 快捷键说明

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