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

📄 主画面.frm

📁 亚龙高架库控制程序 VB 基本结构为PLC通过驱动器控制步进电机实现启动、停止、加速、减速、匀速、换向等运动轮廓
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         MaskColor       =   &H00E0E0E0&
         Style           =   1  'Graphical
         TabIndex        =   12
         Top             =   2160
         Width           =   1065
      End
      Begin VB.CommandButton Com1 
         BackColor       =   &H8000000A&
         Caption         =   " "
         Height          =   750
         Index           =   9
         Left            =   1920
         MaskColor       =   &H00E0E0E0&
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   2160
         Width           =   1065
      End
      Begin VB.CommandButton Com1 
         BackColor       =   &H8000000A&
         Caption         =   " "
         Height          =   750
         Index           =   10
         Left            =   600
         MaskColor       =   &H00E0E0E0&
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   2160
         Width           =   1065
      End
      Begin VB.CommandButton Com1 
         BackColor       =   &H8000000A&
         Caption         =   " "
         Height          =   750
         Index           =   11
         Left            =   5880
         MaskColor       =   &H00E0E0E0&
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   1320
         Width           =   1065
      End
      Begin VB.CommandButton Com1 
         BackColor       =   &H8000000A&
         Caption         =   " "
         Height          =   750
         Index           =   12
         Left            =   4560
         MaskColor       =   &H00E0E0E0&
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   1320
         Width           =   1065
      End
      Begin VB.CommandButton Com1 
         BackColor       =   &H8000000A&
         Caption         =   " "
         Height          =   750
         Index           =   13
         Left            =   3240
         MaskColor       =   &H00E0E0E0&
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   1320
         Width           =   1065
      End
      Begin VB.CommandButton Com1 
         BackColor       =   &H8000000A&
         Caption         =   " "
         Height          =   750
         Index           =   1
         Left            =   5880
         MaskColor       =   &H00E0E0E0&
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   3000
         Width           =   1065
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "0"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   1
         Left            =   7560
         TabIndex        =   40
         Top             =   3840
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "5"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   0
         Left            =   960
         TabIndex        =   34
         Top             =   3840
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "1"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   15
         Left            =   6480
         TabIndex        =   31
         Top             =   3840
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "4"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   14
         Left            =   240
         TabIndex        =   30
         Top             =   600
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "3"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   13
         Left            =   240
         TabIndex        =   29
         Top             =   1440
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "2"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   12
         Left            =   240
         TabIndex        =   28
         Top             =   2400
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "1"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   11
         Left            =   240
         TabIndex        =   27
         Top             =   3240
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "2"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   10
         Left            =   5040
         TabIndex        =   26
         Top             =   3840
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "3"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   9
         Left            =   3720
         TabIndex        =   25
         Top             =   3840
         Width           =   225
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000004&
         Caption         =   "4"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Index           =   8
         Left            =   2400
         TabIndex        =   24
         Top             =   3840
         Width           =   225
      End
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   7920
      Top             =   600
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
End
Attribute VB_Name = "Form_main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()
MSComm1.PortOpen = True                   '与PLC通讯初始化
MSComm1.Settings = "9600,n,8,1"           '与PLC通讯初始化
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\高架库.mdb"
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\高架库.mdb"
                                        '连接数据库
Call display
End Sub

Private Sub com_yuandian_Click()
Call control(2) '回原点
End Sub

Private Sub com_chushi_Click() '初始化
Dim a As Integer
Dim i As Integer
a = MsgBox("要初始化需要拿走全部托盘!拿走全部托盘了吗?", 4 + 48, "请拿走托盘")
If a = 6 Then
  For i = 0 To 20
      Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & i
      Form_main.Adodc1.Refresh
      Form_main.Adodc1.Recordset.Fields("状态") = "无托盘"
      Form_main.Adodc1.Recordset.Fields("名称") = "无物"
      Form_main.Adodc1.Recordset.Fields("数量") = 0
      Form_main.Adodc1.Recordset.Update
  Next i
End If
Call display
End Sub

Private Sub com_zhuangtai_Click()
   Form_X_kuchun.Show '显示库存状态
End Sub

Private Sub tongji_Click()
Form_X_tongji.Show '显示操作纪录
End Sub

Private Sub com_ruku_Click()
Dim a As Integer
Dim i As Integer
4
Dialog1.Show vbModal
If Not sing Then GoTo 6     '未选入库位置则取消入库操作
Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & ind
Form_main.Adodc1.Refresh
If Form_main.Adodc1.Recordset.Fields("状态") = "有托盘" Then
  MsgBox "这个位置库架上有托盘,不能入库!"
  GoTo 4     '重新选择入库位置
Else
  Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & 0
  Form_main.Adodc1.Refresh
  If Form_main.Adodc1.Recordset.Fields("状态") = "无托盘" Then
    a = MsgBox("进出架上没有托盘,不能入库!要入库必须放好托盘!放好托盘了吗?", 4 + 48, "请放托盘")
    If a = 6 Then  '放好托盘了
       Form_main.Adodc1.Recordset.Fields("状态") = "有托盘"
       Form_main.Adodc1.Recordset.Fields("名称") = "无物"
       Form_main.Adodc1.Recordset.Fields("数量") = 0
       Form_main.Adodc1.Recordset.Update
       Call display
    Else
       GoTo 6 '未放托盘
    End If
  End If
End If
Dialog2.Show vbModal
If Not sing Then GoTo 6  '如果选取消 ,则。。。
Call control(0) '入库
com_ruku.Enabled = False
com_chuku.Enabled = False
For i = 0 To 20
  Com1(i).Enabled = False
Next i
6
End Sub

Private Sub com_chuku_Click()
Dim a As Integer
Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & 0
Form_main.Adodc1.Refresh
If Form_main.Adodc1.Recordset.Fields("状态") = "有托盘" Then
   a = MsgBox("进出架上已有托盘,不能出库!要出库必须拿走托盘!托盘拿走了吗?", 4 + 48, "请拿走托盘")
   If a <> 6 Then GoTo 6   '没有拿走托盘,则取消出库操作
End If
Form_main.Adodc1.Recordset.Fields("状态") = "无托盘"
       Form_main.Adodc1.Recordset.Fields("名称") = "无物"
       Form_main.Adodc1.Recordset.Fields("数量") = 0
       Form_main.Adodc1.Recordset.Update
       Call display

Dialog1.Show vbModal
'Dialog2.Show vbModal
If Not sing Then GoTo 6  '如果未选货架
Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & ind
Form_main.Adodc1.Refresh

If Form_main.Adodc1.Recordset.Fields("状态") = "无托盘" Then
  MsgBox "这个位置库架上没有托盘,不能出库!"
  GoTo 6     '取消出库操作
End If
Call control(1) '出库
6
End Sub

Private Sub Com1_Click(Index As Integer) '如果货架上有托盘,则出库;
Dim a As Integer
If Index = 0 Then GoTo 6
Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & Index
Form_main.Adodc1.Refresh
If Form_main.Adodc1.Recordset.Fields("状态") = "有托盘" Then '如果货架上有托盘,则出库
  Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & 0
  Form_main.Adodc1.Refresh
  If Form_main.Adodc1.Recordset.Fields("状态") = "有托盘" Then
    a = MsgBox("进出架上已有托盘,不能出库!要出库必须拿走托盘!托盘拿走了吗?", 4 + 48, "请拿走托盘")
    If a <> 6 Then GoTo 6   '没有拿走托盘,则取消出库操作
    Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & 0
    Form_main.Adodc1.Refresh
    Form_main.Adodc1.Recordset.Fields("状态") = "无托盘"        '进出架上无托盘
    Form_main.Adodc1.Recordset.Fields("名称") = "无物"
    Form_main.Adodc1.Recordset.Fields("数量") = 0
    Form_main.Adodc1.Recordset.Update
    Call display
  End If
  ind = Index
  Call control(1)
Else  '如果货架上无托盘,则入库
  Form_main.Adodc1.RecordSource = "select * from 库存  where 位置=" & 0
  Form_main.Adodc1.Refresh
  If Form_main.Adodc1.Recordset.Fields("状态") = "无托盘" Then
    a = MsgBox("进出架上没有托盘,不能入库!要入库必须放好托盘!放好托盘了吗?", 4 + 48, "请放托盘")
    If a = 6 Then  '放好托盘了
       Form_main.Adodc1.Recordset.Fields("状态") = "有托盘"  '进出架上有托盘
       Form_main.Adodc1.Recordset.Fields("名称") = "无物"
       Form_main.Adodc1.Recordset.Fields("数量") = 0
       Form_main.Adodc1.Recordset.Update
       Call display
    Else
       GoTo 6 '未放托盘
    End If
  End If
  Dialog2.Show vbModal
  If Not sing Then GoTo 6  '如果选取消 ,则。。。
  ind = Index
  Call control(0) '入库
End If
6
End Sub
Private Sub end_Click()
End
End Sub

⌨️ 快捷键说明

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