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

📄 gpinwxlj.frm

📁 一个机械产品(产品、部件、零件)的工时、工资及进度软件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Index           =   0
      Left            =   3780
      TabIndex        =   27
      Top             =   1860
      Width           =   1635
   End
   Begin VB.Label lblcp 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   1
      Left            =   6360
      TabIndex        =   26
      Top             =   1320
      Width           =   1635
   End
   Begin VB.Label lblcp 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   2
      Left            =   9000
      TabIndex        =   25
      Top             =   1320
      Width           =   1635
   End
   Begin VB.Label lblbj 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   1
      Left            =   6360
      TabIndex        =   24
      Top             =   1860
      Width           =   1635
   End
   Begin VB.Label lblbj 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   2
      Left            =   9000
      TabIndex        =   23
      Top             =   1860
      Width           =   1635
   End
   Begin VB.Label lbldh 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   0
      Left            =   6360
      TabIndex        =   22
      Top             =   2340
      Width           =   1155
   End
   Begin VB.Label lbldh 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Index           =   1
      Left            =   8580
      TabIndex        =   21
      Top             =   2340
      Width           =   2055
   End
   Begin VB.Label lblgpbh 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   315
      Left            =   9120
      TabIndex        =   20
      Top             =   240
      Width           =   1635
   End
   Begin VB.Label Label1 
      Caption         =   "工票号码"
      Height          =   195
      Index           =   17
      Left            =   8220
      TabIndex        =   19
      Top             =   840
      Width           =   735
   End
End
Attribute VB_Name = "gpinwxlj"
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 = 13
    Grid1.Rows = 7
    
    Grid1.FixedRows = 1
    Grid1.FixedCols = 2
    Grid1.Column(0).Width = 1
    Grid1.Column(1).Width = 1
    Grid1.Column(2).Width = 1
    Grid1.Column(3).Width = 380
    Grid1.Column(4).Width = 2
    Grid1.Column(5).Width = 40
    Grid1.Column(6).Width = 2
    Grid1.Column(7).Width = 70
    Grid1.Column(8).Width = 60
    Grid1.Column(9).Width = 100
    Grid1.Column(10).Width = 100
    Grid1.Column(11).Width = 100
    Grid1.Column(12).Width = 2
    dogridfill
    Grid1.AutoRedraw = True
    Grid1.Refresh
    '填列产品
    Set rsTempA = oDb.Execute("select * from acp where cpyn='Y'")    '只显示需统计的产品Y
    Do Until rsTempA.EOF
        cmbcp.AddItem rsTempA!cpbh & "," & rsTempA!cpmc & ";" & rsTempA!cpxh
        rsTempA.MoveNext
    Loop
    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(7).AddItem rsTempC!gxmc
            rsTempC.MoveNext
        Loop
        Grid1.ComboBox(7).Locked = True
        
    mskdate.Text = NOWDate
    MonthView1.Visible = False
    MonthView1.Value = NOWDate
     '工票编号
    Set rsTempA = oDb.Execute("select max(code) as maxcode from gpwxh 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()
    'gpwxb按表格中零件名称、工序名称的选择,填入相关的编号,图号
    If txtbzbh.Text = "" Then
        MsgBox "请选择班组/个人", vbOKOnly, "选择"
        Exit Sub
    End If
    
    For i = 1 To Grid1.Rows - 1
        griditem = Trim(Grid1.Cell(i, 3).Text)
        If griditem <> "" Then
            instrI = InStr(griditem, ",")
            instrJ = InStr(griditem, ";")
            Grid1.Cell(i, 12).Text = Left(griditem, instrI - 1)
            Grid1.Cell(i, 2).Text = Mid(griditem, instrJ + 1)
            Grid1.Cell(i, 4).Text = Mid(griditem, instrI + 1, instrJ - instrI - 1)
            
         End If
         
         griditem = Trim(Grid1.Cell(i, 7).Text)
         If griditem <> "" Then
            Set rsTempA = oDb.Execute("select * from agx where gxmc='" & griditem & "'")
            Grid1.Cell(i, 6).Text = rsTempA!gxbh
         End If
    
        '表体内容
        If (Val(Grid1.Cell(i, 8).Text) <> 0) And (Grid1.Cell(i, 2).Text <> "") And (Grid1.Cell(i, 6).Text <> "") Then '有工时数据,保存
            '工票编号+部件编号+零件编号+零件名称+图号
            '+数量+工序编号+工序名称+工时+备注+备注+备注
            griditem = "'" & lblgpbh.Caption & "','" & lblcp(0).Caption & "','" & lblbj(0).Caption & "','" & Grid1.Cell(i, 2).Text & "','" & Grid1.Cell(i, 12).Text & " ','" & Grid1.Cell(i, 4).Text & "'"
            If Grid1.Cell(i, 5).Text <> "" Then
                griditem = griditem & "," & 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 & "','" & Grid1.Cell(i, 11).Text & "'"
            Else
                griditem = griditem & ",0,'" & 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 & "','" & Grid1.Cell(i, 11).Text & "'"
            End If
            szSql = "insert gpwxb(gpbh,gpcpbh,gpbjbh,gpljbh,gpljmc,gpljth,gpsl,gpgxbh,gpgxmc,gpgs,gpbz,gpbz1,gpbz2) values ( " & griditem & ")"
            oDb.Execute szSql
        End If
    Next i
        'gpwxh
            '工票编号+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 gpwxh (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, ",")
    j = InStr(cmbcp.Text, ";")
    lblcp(0).Caption = Left(cmbcp.Text, i - 1)
    lblcp(1).Caption = Mid(cmbcp.Text, i + 1, j - i - 1)
    lblcp(2).Caption = Mid(cmbcp.Text, j + 1)
    '单位编号、名称
    Set rsTempB = oDb.Execute("select * from acp where cpbh='" & Left(cmbcp.Text, i - 1) & "'")
    lbldh(0).Caption = rsTempB!dhbh
    lbldh(1).Caption = rsTempB!dhmc

    cmbbj.Clear
    Set rsTempB = oDb.Execute("select * from abj where cpbh='" & Left(cmbcp.Text, i - 1) & "' order by code")
    Do Until rsTempB.EOF
        cmbbj.AddItem rsTempB!bjbh & "," & rsTempB!bjmc & ";" & rsTempB!bjth
        rsTempB.MoveNext
    Loop
    lblbj(0).Caption = ""
    lblbj(1).Caption = ""
    lblbj(2).Caption = ""
End Sub
Private Sub cmbbj_LostFocus()
      '选取部件后,相应零件信息填入进度表表格。
      '添加是否有保存的
    'MousePointer = vbHourglass
    i = InStr(cmbbj.Text, ",")
    j = 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, j - i - 1)
    lblbj(2).Caption = Mid(cmbbj.Text, j + 1)
    Grid1.Rows = 1   '清空原有数据
    Grid1.Rows = 7
    Grid1.ComboBox(3).Clear
    '选定部件后填入零件下拉内容
    Set rsTempC = oDb.Execute("select * from  alj where bjbh='" & Left(cmbbj.Text, i - 1) & "' order by code")
        Do Until rsTempC.EOF
            Grid1.ComboBox(3).AddItem rsTempC!ljmc & "," & rsTempC!ljth & ";" & rsTempC!ljbh   '零件名称+图号+编号
            rsTempC.MoveNext
        Loop
        'Grid1.ComboBox(3).Locked = True
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(7).Clear
    Set rsTempC = oDb.Execute("select * from agx where gxtj='Y' and gxcjbh=" & txtcjbh.Text & " order by gxbh")
        Do Until rsTempC.EOF
            Grid1.ComboBox(7).AddItem rsTempC!gxmc
            rsTempC.MoveNext
        Loop
        Grid1.ComboBox(7).Locked = True
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 gpwxh 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.Cell(0, 11).Text = "  备   注"
    Grid1.Cell(0, 12).Text = "零件名称"  '临时需用
    Grid1.Column(3).CellType = cellComboBox
    Grid1.Column(7).CellType = cellComboBox
End Sub
 

⌨️ 快捷键说明

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