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

📄 checkstandardsingleform.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 2 页
字号:
End Sub
Private Sub Combo1_Click()
    m_checkstandardDAO.Findproduction m_recordset
    With m_recordset
        While Not .EOF
            If Combo1.text = Trim(.Fields("产品名称")) Then
                Combo1.Tag = Trim(.Fields("产品编号"))
            End If
            .MoveNext
        Wend
    End With
    m_recordset.Close
    
    judge_jybj (Combo1.Tag)

End Sub


Private Sub Combo3_Click()
            m_productionDAO.show_checkvaluegroup m_recordset            '获得产品类别ID列表

    With m_recordset

        Do While Not .EOF
            If Combo3.text = Trim(.Fields(1)) Then
               Combo3.Tag = .Fields(0)
            End If
            .MoveNext
        Loop
    End With
    m_recordset.Close
End Sub
Private Sub Combo4_Click()
           m_productionDAO.show_checkoptiongroup m_recordset            '获得产品类别ID列表

    With m_recordset

        Do While Not .EOF
            If Combo4.text = Trim(.Fields(1)) Then
               Combo4.Tag = .Fields(0)
            End If
            .MoveNext
        Loop
    End With
    m_recordset.Close
End Sub

Private Sub Form_Load()
    Set m_checkstandardDAO = New checkstandardDAO
    Set m_recordset = New ADODB.Recordset
    Set m_productionDAO = New productionDAO
    SetToCenter Me
    
    If m_operatorType = 0 Then
        Me.caption = "产品检验要求_新增"
        
        clear
    Else
        Me.caption = "产品检验要求_修改"
        c_new.Visible = False
        FindByIdRefresh
    End If
    
     m_productionDAO.show_checkvaluegroup m_recordset           '获得产品类别ID列表
    With m_recordset

        Do While Not .EOF
            Combo3.AddItem Trim(.Fields(1))
            .MoveNext
        Loop
    End With
    m_recordset.Close

    m_productionDAO.show_checkoptiongroup m_recordset           '获得产品类别ID列表
    With m_recordset

        Do While Not .EOF
            Combo4.AddItem Trim(.Fields(1))
            .MoveNext
        Loop
    End With
    m_recordset.Close

    m_checkstandardDAO.Findproduction m_recordset
    With m_recordset
        While Not .EOF
            Combo1.AddItem Trim(.Fields("产品名称"))
            .MoveNext
        Wend
    End With
    m_recordset.Close
End Sub
'**************************************
'*    功 能 描 述 :检验类型数据处理函数
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Newcheckstandard()
    '
    Dim ret As Boolean
    
    If Not Check Then
        Exit Sub
    End If
'    If Trim(Combo1.text) = "" Then
'        Combo1.Tag = "0"
'    End If
    If Trim(Combo3.text) = "" Then
        Combo3.Tag = "0"
    End If
    If Trim(Combo4.text) = "" Then
        Combo4.Tag = "0"
    End If
    ret = m_checkstandardDAO.Newcheckstandard(m_recordset, Trim(Text1(1).text), _
                   Trim(t1(2).text), Trim(t2(3).text), Trim(t3(4).text), Trim(t4(5).text), _
                   Trim(Text2.text), Trim(Text3.text), Trim(Text4.text), _
                   Trim(Combo1.Tag), Trim(Combo4.Tag), Trim(Combo3.Tag))
End Sub
'**************************************
'*    功 能 描 述 :修改检验类型处理函数
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Modifycheckstandard()
    '
    Dim ret As Boolean
    
    If Not Check Then
        Exit Sub
    End If
'    If InStr(Trim(t3(4).text), "%") = 0 Then
'    End If
'If Trim(Combo1.text) = "" Then
'    Combo1.Tag = "0"
'End If
If Trim(Combo3.text) = "" Then
    Combo3.Tag = "0"
End If
If Trim(Combo4.text) = "" Then
    Combo4.Tag = "0"
End If
    ret = m_checkstandardDAO.Modifycheckstandard(m_recordset, Trim(Text1(1).text), _
                   Trim(t1(2).text), Trim(t2(3).text), Trim(t3(4).text), Trim(t4(5).text), m_checkstandardid, _
                   Trim(Text2.text), Trim(Text3.text), Trim(Text4.text), _
                   Trim(Combo1.Tag), Trim(Combo4.Tag), Trim(Combo3.Tag))
End Sub
'**************************************
'*    功 能 描 述 :检验数据的合法性
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Function Check() As Boolean
    Check = True
    If Trim(Text1(1).text) = "" Then
        MainForm.g_msgText = "检验类型名称不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text1(1).SetFocus
        Check = False
        Exit Function
    End If
    If Not IsNumeric(Replace(Trim(t3(4).text), "%", "")) Then
        MainForm.g_msgText = "精度要求有错误!"
        HMsgBox MainForm.g_msgText, 0, 1
        t3(4).SetFocus
        Check = False
        Exit Function
    End If
    If (7 >= CDbl(Trim(t4(5).text)) >= 0) Then
        MainForm.g_msgText = "小数位只能填0-7!"
        HMsgBox MainForm.g_msgText, 0, 1
        t4(5).SetFocus
        Check = False
        Exit Function
    End If
    If (Trim(Text2.text)) = "" Then
        MainForm.g_msgText = "计测单位不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text2.SetFocus
        Check = False
        Exit Function
    End If
    If (Trim(Text3.text)) = "" Then
        MainForm.g_msgText = "标准器不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text3.SetFocus
        Check = False
        Exit Function
    End If
    If (Trim(Text4.text)) = "" Then
        MainForm.g_msgText = "标准器英文不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text4.SetFocus
        Check = False
        Exit Function
    End If
    
    If Trim(Combo3.text) <> "" Then
        If Trim(Combo4.text) = "" Then
            MainForm.g_msgText = "检验项组不能为空,请您选择一个!"
            HMsgBox MainForm.g_msgText, 0, 1
            Combo4.SetFocus
            Check = False
            Exit Function
        End If
    Else
        If Trim(Combo4.text) <> "" Then
            MainForm.g_msgText = "检验值组不能为空,请您选择一个!"
            HMsgBox MainForm.g_msgText, 0, 1
            Combo3.SetFocus
            Check = False
            Exit Function
        End If
    End If
    If Trim(Combo1.text) = "" Then
        MainForm.g_msgText = "产品名称不能为空,请您选择一个!"
        HMsgBox MainForm.g_msgText, 0, 1
        Combo1.SetFocus
        Check = False
        Exit Function
    End If
End Function
'**************************************
'*    功 能 描 述 :根据检验值ID找到检验值资料并显示在界面上
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub FindByIdRefresh()
    Dim ret As Boolean
    
    ret = m_checkstandardDAO.FindById(m_recordset, Trim(m_checkstandardid))
    
    If ret Then
      With m_recordset
            Text1(0).text = Trim(.Fields("checkStandardId") & " ")
            Text1(1).text = Trim(.Fields("检验要求名称") & " ")
            t1(2).text = Trim(.Fields("量程") & " ")
            t2(3).text = Trim(.Fields("分度值") & " ")
            t3(4).text = Trim(.Fields("精度要求") & " ")
            t4(5).text = Trim(.Fields("小数位") & " ")
            Text2.text = Trim(.Fields("计测单位") & " ")
            Text3.text = Trim(.Fields("标准器") & " ")
            Text4.text = Trim(.Fields("标准器英文") & " ")
            Combo1.text = Trim(.Fields("产品名称") & " ")
            Combo1.Tag = Trim(.Fields("productionid") & " ")
            Combo3.text = Trim(.Fields("检验值名称") & " ")
            Combo3.Tag = Trim(.Fields("检验项值编号") & " ")
            Combo4.text = Trim(.Fields("检验项名称") & " ")
            Combo4.Tag = Trim(.Fields("检验项组编号") & " ")
            m_recordset.Close
      End With
    Else
        MainForm.g_msgText = "检验类型ID不正确,请重新操作!"
        HMsgBox MainForm.g_msgText, 0, 1
        Exit Sub
        Unload Me
    End If
    judge_jybj (Combo1.Tag)
    c_save.Enabled = True
    Combo3.Enabled = False
    Combo4.Enabled = False
    Combo1.Enabled = False
    Text2.Enabled = False
    t1(2).Enabled = False
    t2(3).Enabled = False
    t4(5).Enabled = False
    t3(4).Enabled = False
End Sub
'**************************************
'*    功 能 描 述 :清除界面上文本框里的所有内容
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub clear()
            Text1(0).text = ""
            Text1(1).text = ""
            t1(2).text = ""
            t2(3).text = ""
            t3(4).text = ""
            t4(5).text = ""

End Sub

Private Sub t1_KeyPress(Index As Integer, KeyAscii As Integer)
    InputFieldLimit t1(2), 6, KeyAscii
End Sub

Private Sub t2_KeyPress(Index As Integer, KeyAscii As Integer)
    InputFieldLimit t2(3), 6, KeyAscii
End Sub
Private Sub t3_LostFocus(Index As Integer)
    If InStr(Trim(t3(4).text), "%") = 0 Then
        t3(4).text = Trim(t3(4).text) & "%"
    End If
End Sub

Private Sub t4_KeyPress(Index As Integer, KeyAscii As Integer)
    InputFieldLimit t4(5), 6, KeyAscii
End Sub
Private Sub judge_jybj(productionid As String)
    m_checkstandardDAO.checkstandard_findjybj m_recordset, Trim(productionid)
    If Not m_recordset.EOF Then
        With m_recordset
            Do While Not .EOF
                If Trim(.Fields("jybj")) <> "0" Then
                    c_save.Enabled = False
                    c_new.Enabled = False
                    Exit Do
                End If
                .MoveNext
            Loop
        End With
    End If
    m_recordset.Close
End Sub






⌨️ 快捷键说明

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