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

📄 firlj.frm

📁 一个机械产品(产品、部件、零件)的工时、工资及进度软件
💻 FRM
字号:
VERSION 5.00
Object = "{4F29B06F-16D9-4A0C-9C8A-2F0C02F625FE}#1.0#0"; "FlexCell.ocx"
Begin VB.Form firlj 
   Caption         =   "零件"
   ClientHeight    =   5415
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4875
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   5415
   ScaleWidth      =   4875
   Begin FlexCell.Grid Grid1 
      Height          =   3465
      Left            =   120
      TabIndex        =   8
      Top             =   780
      Width           =   4665
      _ExtentX        =   8229
      _ExtentY        =   6112
      Cols            =   5
      Rows            =   30
   End
   Begin VB.TextBox txtcode 
      Height          =   285
      Left            =   3840
      TabIndex        =   5
      Top             =   240
      Width           =   615
   End
   Begin VB.Frame Frame1 
      Height          =   615
      Left            =   120
      TabIndex        =   0
      Top             =   4740
      Width           =   4515
      Begin VB.CommandButton cmddelete 
         Caption         =   "删行"
         Height          =   255
         Left            =   2064
         TabIndex        =   4
         Top             =   240
         Width           =   795
      End
      Begin VB.CommandButton cmdexit 
         Caption         =   "退出"
         Height          =   255
         Left            =   3180
         TabIndex        =   3
         Top             =   240
         Width           =   795
      End
      Begin VB.CommandButton cmdsave 
         Caption         =   "保存"
         Height          =   255
         Left            =   1092
         TabIndex        =   2
         Top             =   240
         Width           =   795
      End
      Begin VB.CommandButton cmdadd 
         Caption         =   "增加"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   795
      End
   End
   Begin VB.Label Label2 
      Caption         =   "注:编号最长4位,名称最长12位"
      Height          =   315
      Left            =   180
      TabIndex        =   7
      Top             =   4320
      Width           =   4515
   End
   Begin VB.Label Label1 
      Caption         =   "零件去向表"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   435
      Index           =   4
      Left            =   1560
      TabIndex        =   6
      Top             =   120
      Width           =   2055
   End
End
Attribute VB_Name = "firlj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
    Me.Width = 5000
    Me.Height = 6000
    
    Grid1.AutoRedraw = False
    Grid1.AllowUserSort = True
    Grid1.AllowUserResizing = False
    Grid1.DisplayFocusRect = False
    Grid1.ExtendLastCol = True
  
    Grid1.Cols = 3
    Grid1.Rows = 1
    Grid1.FixedRows = 1
    
    Grid1.Column(0).Width = 18
    Grid1.Column(1).Width = 100
    Grid1.Column(2).Width = 100
     
    dogridfill
    Grid1.Column(1).Locked = True
    Grid1.AutoRedraw = True
    Grid1.Refresh
    
    Set rsTempA = oDb.Execute("select max(qxbh) as maxcode from aljqx ")    'code号初始
    If IsNull(rsTempA!maxcode) Then
        txtcode.Text = 1000
        Else
        txtcode.Text = rsTempA!maxcode + 1
    End If
    
    txtcode.Visible = False
    cmddelete.Enabled = False '工序不可删
End Sub

Private Sub dogridfill()
    Grid1.Cell(0, 1).Text = "去向编号"
    Grid1.Cell(0, 2).Text = "去向名称"
    
    szSql = "select * from aljqx  order by qxbh"
    Set rsTempA = oDb.Execute(szSql)
    Do While Not rsTempA.EOF
        Grid1.AddItem (rsTempA!qxbh & Chr(9) & rsTempA!qxmc)
        rsTempA.MoveNext
    Loop
End Sub
Private Sub cmddelete_Click()
    i = Grid1.ActiveCell.Row
    griditem = Grid1.Cell(i, 1).Text
    answer = MsgBox("删除此行?" & griditem, vbYesNo, "删除")
    If answer = 6 Then
        szSql = "delete from aljqx where qxbh='" & griditem & "'"
        oDb.Execute szSql
        Grid1.Selection.DeleteByRow
        Grid1.Rows = 1
        dogridfill
    End If
End Sub
Private Sub cmdexit_Click()
    Unload Me
End Sub
Private Sub cmdadd_Click()
    Grid1.Rows = Grid1.Rows + 1
    Grid1.Cell(Grid1.Rows - 1, 1).Text = txtcode.Text
    txtcode.Text = Val(txtcode.Text) + 1
End Sub
Private Sub cmdsave_Click()
    For i = 1 To Grid1.Rows - 1
        griditem = Grid1.Cell(i, 1).Text
        Set rsTempA = oDb.Execute("select qxbh from aljqx where qxbh='" & griditem & "'")
        If rsTempA.RecordCount < 1 Then  '增加保存
            griditem = "'" & Grid1.Cell(i, 1).Text & "'"
            If Grid1.Cell(i, 2).Text <> "" Then griditem = griditem & ",'" & Grid1.Cell(i, 2).Text & "'" Else griditem = griditem & ",''"
                
            szSql = "insert aljqx (qxbh,qxmc) values (" & griditem & ")"
            oDb.Execute szSql
        Else
            szSql = "UPDATE aljqx SET qxmc='" & Grid1.Cell(i, 2).Text & "' where qxbh='" & Grid1.Cell(i, 1).Text & "'"
            oDb.Execute szSql
        End If
    Next i
    MsgBox "成功保存", vbOKOnly, "保存"
    cmdsave.Enabled = False
End Sub
 
 

⌨️ 快捷键说明

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