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

📄 gpinlx.frm

📁 一个机械产品(产品、部件、零件)的工时、工资及进度软件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   End
   Begin VB.Label lblcp 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   1
      Left            =   7560
      TabIndex        =   22
      Top             =   1260
      Width           =   1635
   End
   Begin VB.Label lblbj 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   1
      Left            =   7560
      TabIndex        =   21
      Top             =   1800
      Width           =   1635
   End
   Begin VB.Label lblgpbh 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Left            =   9180
      TabIndex        =   20
      Top             =   180
      Width           =   1635
   End
   Begin VB.Label Label1 
      Caption         =   "工票号码"
      Height          =   195
      Index           =   17
      Left            =   6780
      TabIndex        =   19
      Top             =   2340
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "零星工票"
      ForeColor       =   &H000000FF&
      Height          =   255
      Index           =   16
      Left            =   1080
      TabIndex        =   18
      Top             =   720
      Width           =   915
   End
End
Attribute VB_Name = "gpinlx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'工票编号 =填制日期+code,在保存时反映
Option Explicit
Dim instrI As Integer, instrJ As Integer
Private Sub Form_Load()
    Me.Width = 11100
    Me.Height = 6800
    
    Grid1.AutoRedraw = False
    Grid1.DisplayFocusRect = False
   
    Grid1.Cols = 11
    Grid1.Rows = 7
    
    Grid1.FixedRows = 1
    Grid1.FixedCols = 2
    Grid1.Column(0).Width = 1
    Grid1.Column(1).Width = 30
    Grid1.Column(2).Width = 120
    Grid1.Column(3).Width = 120
    Grid1.Column(4).Width = 40
    Grid1.Column(5).Width = 1
    Grid1.Column(6).Width = 80
    Grid1.Column(7).Width = 40
    Grid1.Column(8).Width = 70
    Grid1.Column(9).Width = 70
    Grid1.Column(10).Width = 70
   
    dogridfill
    Grid1.AutoRedraw = True
    Grid1.Refresh
    '填列产品
    Set rsTempA = oDb.Execute("select * from acplx ")
    Do Until rsTempA.EOF
        cmbcp.AddItem rsTempA!cpbh & "," & rsTempA!cpmc
        rsTempA.MoveNext
    Loop
    cmbcp.ListIndex = 0
    
    i = InStr(cmbcp.Text, ",")                      '20071113加入,防止对方不选部件名称,而产生空
    lblcp(0).Caption = Left(cmbcp.Text, i - 1)
    lblcp(1).Caption = Mid(cmbcp.Text, i + 1)

    Set rsTempB = oDb.Execute("select * from abjlx where cpbh='" & Left(cmbcp.Text, i - 1) & "' order by code")
    Do Until rsTempB.EOF
        cmbbj.AddItem rsTempB!bjbh & "," & rsTempB!bjmc
        rsTempB.MoveNext
    Loop
    cmbbj.ListIndex = 0
    
    i = InStr(cmbbj.Text, ",")
   
    If i < 1 Then Exit Sub
    lblbj(0).Caption = Left(cmbbj.Text, i - 1)
    lblbj(1).Caption = Mid(cmbbj.Text, i + 1)
    
    cmbcp.ListIndex = 0
    '填列车间
    Set rsTempA = oDb.Execute("select * from acj ")
    Do Until rsTempA.EOF
        cmbcj.AddItem rsTempA!cjbh & "," & rsTempA!cjmc
        rsTempA.MoveNext
    Loop
    cmbcj.ListIndex = 0
    
    i = InStr(cmbcj.Text, ",")
    txtcjbh.Text = Left(cmbcj.Text, i - 1)
    txtcjmc.Text = Mid(cmbcj.Text, i + 1)
    Set rsTempB = oDb.Execute("select * from abz where bzyn='Y' and cjbh='" & Left(cmbcj.Text, i - 1) & "'")
    Do Until rsTempB.EOF
        cmbbz.AddItem rsTempB!bzbh & "," & rsTempB!bzmc
        rsTempB.MoveNext
    Loop
    
          '工序编号下拉填列
    Set rsTempC = oDb.Execute("select * from agx where gxtj='Y' and gxcjbh=" & txtcjbh.Text & " order by gxbh")
        Do Until rsTempC.EOF
            Grid1.ComboBox(6).AddItem rsTempC!gxmc
            rsTempC.MoveNext
        Loop
        Grid1.ComboBox(6).Locked = True
        
    mskdate.Text = NOWDate
    MonthView1.Visible = False
    MonthView1.Value = NOWDate
    
     '工票编号
    Set rsTempA = oDb.Execute("select max(code) as maxcode from gplxh where gprq='" & mskdate.Text & "'")
    If IsNull(rsTempA!maxcode) Then
        txtcode.Text = 1
        Else
        txtcode.Text = rsTempA!maxcode + 1
    End If
    lblgpbh.Caption = Left(mskdate.Text, 4) & Mid(mskdate.Text, 6, 2) & Mid(mskdate.Text, 9) & Format$(txtcode.Text, "0000")
    
    txtcode.Visible = False
    txtcjbh.Visible = False
    txtcjmc.Visible = False
    txtbzbh.Visible = False
    txtbzmc.Visible = False
    
    txtkp.AddItem "周建军"
    txtkp.AddItem "罗长有"
    txtkp.AddItem "戚福金"
End Sub
Private Sub cmdsave_Click()
    'gpdnb按表格中零件名称、工序名称的选择,填入相关的编号,图号
    If txtbzbh.Text = "" Then
        MsgBox "请选择班组/个人", vbOKOnly, "选择"
        Exit Sub
    End If
    
    '确保多用户录入工票,编号不重复,工票编号在保存时重新认定
    Set rsTempA = oDb.Execute("select max(code) as maxcode from gplxh where gprq='" & mskdate.Text & "'")
    If IsNull(rsTempA!maxcode) Then
        txtcode.Text = 1
        Else
        txtcode.Text = rsTempA!maxcode + 1
    End If
    lblgpbh.Caption = Left(mskdate.Text, 4) & Mid(mskdate.Text, 6, 2) & Mid(mskdate.Text, 9) & Format$(txtcode.Text, "0000")
    
    For i = 1 To Grid1.Rows - 1
        griditem = Trim(Grid1.Cell(i, 2).Text)
        If griditem <> "" Then
            griditem = Trim(Grid1.Cell(i, 6).Text)
            If griditem <> "" Then
               Set rsTempA = oDb.Execute("select * from agx where gxmc='" & griditem & "'")
               Grid1.Cell(i, 5).Text = rsTempA!gxbh
            End If
    
            '表体内容
            If (Val(Grid1.Cell(i, 7).Text) <> 0) Then  '有工时数据,保存
                '工票编号+部件编号+零件编号+零件名称+图号
                '+数量+工序编号+工序名称+工时+备注+备注+备注
                griditem = "'" & lblgpbh.Caption & "','" & lblcp(0).Caption & "','" & lblbj(0).Caption & "','" & Grid1.Cell(i, 2).Text & "','" & Grid1.Cell(i, 3).Text & "'"
                If Grid1.Cell(i, 4).Text <> "" Then
                    griditem = griditem & "," & Grid1.Cell(i, 4).Text & ",'" & Grid1.Cell(i, 5).Text & "','" & Grid1.Cell(i, 6).Text & "'," & Grid1.Cell(i, 7).Text & ",'" & Grid1.Cell(i, 8).Text & "','" & Grid1.Cell(i, 9).Text & "','" & Grid1.Cell(i, 10).Text & "'"
                    Else
                    griditem = griditem & ",0,'" & Grid1.Cell(i, 5).Text & "','" & Grid1.Cell(i, 6).Text & "'," & Grid1.Cell(i, 7).Text & ",'" & Grid1.Cell(i, 8).Text & "','" & Grid1.Cell(i, 9).Text & "','" & Grid1.Cell(i, 10).Text & "'"
                End If
                szSql = "insert gplxb(gpbh,gpcpbh,gpbjbh,gpljmc,gpljth,gpsl,gpgxbh,gpgxmc,gpgs,gpbz,gpbz1,gpbz2) values ( " & griditem & ")"
                oDb.Execute szSql
            End If
        End If
    Next i
        'gpdnh
            '工票编号+code+票日期+产品编号+部件编号
        griditem = "'" & lblgpbh.Caption & "'," & txtcode.Text & ",'" & txtgphm.Text & "','" & mskdate.Text & "','" & lblcp(0).Caption & "','" & lblbj(0).Caption & "',"
        griditem = griditem & txtcjbh.Text & ",'" & txtcjmc & "'," & txtbzbh.Text & ",'" & txtbzmc.Text & "','" & txtsh.Text & "','" & txtkp.Text & "'"
        szSql = "insert gplxh (gpbh,code,gphm,gprq,gpcpbh,gpbjbh,gpcjbh,gpcjmc,gpbzbh,gpbzmc,gpsh,gpkp) values ( " & griditem & ")"
        oDb.Execute szSql
    
    MsgBox "工票数据已保存完毕!", vbOKOnly, "数据保存"
    
    '编号更新
    txtcode.Text = Val(txtcode.Text) + 1
    lblgpbh.Caption = Left(mskdate.Text, 4) & Mid(mskdate.Text, 6, 2) & Mid(mskdate.Text, 9) & Format$(txtcode.Text, "0000")
 End Sub
Private Sub cmdexit_Click()
    Unload Me
End Sub
Private Sub cmbcp_LostFocus()
    '选取产品后,相应部件填入cmbbj下拉框
    i = InStr(cmbcp.Text, ",")
    lblcp(0).Caption = Left(cmbcp.Text, i - 1)
    lblcp(1).Caption = Mid(cmbcp.Text, i + 1)
    
    cmbbj.Clear
    Set rsTempB = oDb.Execute("select * from abjlx where cpbh='" & Left(cmbcp.Text, i - 1) & "' order by code")
    Do Until rsTempB.EOF
        cmbbj.AddItem rsTempB!bjbh & "," & rsTempB!bjmc
        rsTempB.MoveNext
    Loop
    lblbj(0).Caption = ""
    lblbj(1).Caption = ""
End Sub
Private Sub cmbbj_LostFocus()
      '选取部件后,相应零件信息填入进度表表格。
      '添加是否有保存的
    'MousePointer = vbHourglass
    i = InStr(cmbbj.Text, ",")
   
    If i < 1 Then Exit Sub
    lblbj(0).Caption = Left(cmbbj.Text, i - 1)
    lblbj(1).Caption = Mid(cmbbj.Text, i + 1)
 
    Grid1.Rows = 1   '清空原有数据
    Grid1.Rows = 7
End Sub
Private Sub cmbcj_LostFocus()
        '取得车间编号并填列班组/个人名称
    i = InStr(cmbcj.Text, ",")
    txtcjbh.Text = Left(cmbcj.Text, i - 1)
    txtcjmc.Text = Mid(cmbcj.Text, i + 1)
    cmbbz.Clear
    Set rsTempB = oDb.Execute("select * from abz where bzyn='Y' and cjbh='" & Left(cmbcj.Text, i - 1) & "'")
    Do Until rsTempB.EOF
        cmbbz.AddItem rsTempB!bzbh & "," & rsTempB!bzmc
        rsTempB.MoveNext
    Loop
    
          '工序编号下拉填列
    Grid1.ComboBox(6).Clear
    Set rsTempC = oDb.Execute("select * from agx where gxtj='Y' and gxcjbh=" & txtcjbh.Text & " order by gxbh")
        Do Until rsTempC.EOF
            Grid1.ComboBox(6).AddItem rsTempC!gxmc
            rsTempC.MoveNext
        Loop
End Sub
Private Sub cmbbz_LostFocus()
        '取得 班组/个人编号
    i = InStr(cmbbz.Text, ",")
    txtbzbh.Text = Left(cmbbz.Text, i - 1)
    txtbzmc.Text = Mid(cmbbz.Text, i + 1)
End Sub
Private Sub cmddate_Click()
    MonthView1.Visible = True
End Sub

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
    MonthView1.Visible = False
    mskdate.Text = Format(MonthView1.Value, "YYYY-MM-DD")
    '工票编号
    Set rsTempA = oDb.Execute("select max(code) as maxcode from gplxh where gprq='" & mskdate.Text & "'")
    If IsNull(rsTempA!maxcode) Then
        txtcode.Text = 1
        Else
        txtcode.Text = rsTempA!maxcode + 1
    End If
    lblgpbh.Caption = Left(mskdate.Text, 4) & Mid(mskdate.Text, 6, 2) & Mid(mskdate.Text, 9) & Format$(txtcode.Text, "0000")
    
End Sub
Private Sub dogridfill()
    Grid1.Cell(0, 1).Text = "序号"
    Grid1.Cell(0, 2).Text = "零件名称"
    Grid1.Cell(0, 3).Text = "图号"
    Grid1.Cell(0, 4).Text = "零件数量"
    Grid1.Cell(0, 5).Text = "工序编号"
    Grid1.Cell(0, 6).Text = "工序名称"
    Grid1.Cell(0, 7).Text = "工时(分)"
    Grid1.Cell(0, 8).Text = "  备   注"
    Grid1.Cell(0, 9).Text = "  备   注"
    Grid1.Cell(0, 10).Text = "  备   注"
     
    Grid1.Column(6).CellType = cellComboBox
End Sub
 

⌨️ 快捷键说明

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