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

📄 productionsingleform.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 3 页
字号:
        ret = m_dao.ModifyImage("a.bmp", imageDataArr, pictureid)
    End If
    ret = m_productionDAO.Newproduction(m_recordset, Trim(Text1(1).text), _
                   Trim(Text1(2).text), Trim(Replace(Trim(T_price(3).text), "¥", "")), Trim(Replace(Trim(T_wxprice(4).text), "$", "")), _
                   Trim(Replace(Trim(T_leveloprice(5).text), "¥", "")), Trim(Replace(Trim(T_lowestjx(6).text), "¥", "")), Trim(Replace(Trim(T_lowestxs(7).text), "¥", "")), _
                   Trim(Combo1.Tag), Trim(Text1(9).text), Trim(Text1(10).text), _
                   Trim(T_selldeduct(11).text), Trim(Text1(12).text), Trim(Replace(Trim(T_productsize(13).text), "¥", "")), _
                   Trim(T_materialcost(14).text), Trim(Text1(15).text), Trim("0"), Trim("0"), Trim("0"), _
                   Trim(Text2.text), Trim(Text3.text), Trim(Text4.text), pictureid)
End Sub
'**************************************
'*    功 能 描 述 :修改产品处理函数
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Modifyproduction()
    '
    Dim ret As Boolean
    Dim imageId As String
    
    If pictureid = "" Then     ' 新增一条记录
        imageId = m_dao.NewImage("a.bmp", imageDataArr)
        pictureid = imageId
    Else                       ' 修改一条记录
        ret = m_dao.ModifyImage("a.bmp", imageDataArr, pictureid)
    End If
    ret = m_productionDAO.Modifyproduction(m_recordset, Trim(Text1(1).text), _
                   Trim(Text1(2).text), Trim(Replace(Trim(T_price(3).text), "¥", "")), Trim(Replace(Trim(T_wxprice(4).text), "$", "")), _
                   Trim(Replace(Trim(T_leveloprice(5).text), "¥", "")), Trim(Replace(Trim(T_lowestjx(6).text), "¥", "")), Trim(Replace(Trim(T_lowestxs(7).text), "¥", "")), _
                   Trim(Combo1.Tag), Trim(Text1(9).text), Trim(Text1(10).text), _
                   Trim(T_selldeduct(11).text), Trim(Text1(12).text), Trim(Replace(Trim(T_productsize(13).text), "¥", "")), _
                   Trim(T_materialcost(14).text), Trim(Text1(15).text), Trim("0"), Trim("0"), Trim("0"), _
                   Trim(Text2.text), Trim(Text3.text), Trim(Text4.text), pictureid, m_productionId)
End Sub
'**************************************
'*    功 能 描 述 :检验数据的合法性
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Check()
    f = "1"
    If Trim(Text1(2).text) = "" Then
        MainForm.g_msgText = "零件名称不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text1(2).SetFocus
        f = "0"
        Exit Sub
        
    End If
    
    If Trim(Text1(1).text) = "" Then
        MainForm.g_msgText = "代号不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text1(1).SetFocus
        f = "0"
        Exit Sub
    End If
    If Trim(Text1(10).text) = "" Then
        MainForm.g_msgText = "型号不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text1(10).SetFocus
        f = "0"
        Exit Sub
    End If
    If Trim(Text3.text) = "" Or Not IsNumeric(Trim(Text3.text)) Then
        MainForm.g_msgText = "序号不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text3.SetFocus
        f = "0"
        Exit Sub
    End If
    If Trim(Text2.text) = "" Then
        MainForm.g_msgText = "规格不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Text2.SetFocus
        f = "0"
        Exit Sub
    End If
    
    
    If Not IsNumeric(Trim(Replace(Trim(T_price(3).text), "¥", ""))) Or InStr(Trim(T_price(3).text), "¥") <> 1 Then
        MainForm.g_msgText = "您输入的格式有错误!"
        HMsgBox MainForm.g_msgText, 0, 1
        T_price(3).SetFocus
        f = "0"
        Exit Sub
    End If
    
        If Not IsNumeric(Trim(Replace(Trim(T_wxprice(4).text), "$", ""))) Or InStr(Trim(T_wxprice(4).text), "$") <> 1 Then
        MainForm.g_msgText = "您输入的格式有错误!"
        HMsgBox MainForm.g_msgText, 0, 1
        T_wxprice(4).SetFocus
        f = "0"
        Exit Sub
    End If
    
    If Not IsNumeric(Trim(Replace(Trim(T_leveloprice(5).text), "¥", ""))) Or InStr(Trim(T_leveloprice(5).text), "¥") <> 1 Then
        MainForm.g_msgText = "您输入的格式有错误!"
        HMsgBox MainForm.g_msgText, 0, 1
        T_leveloprice(5).SetFocus
        f = "0"
        Exit Sub
    End If
    
    If Not IsNumeric(Trim(Replace(Trim(T_lowestjx(6).text), "¥", ""))) Or InStr(Trim(T_lowestjx(6).text), "¥") <> 1 Then
        MainForm.g_msgText = "您输入的格式有错误!"
        HMsgBox MainForm.g_msgText, 0, 1
        T_lowestjx(6).SetFocus
        f = "0"
        Exit Sub
    End If
    
    If Not IsNumeric(Trim(Replace(Trim(T_lowestxs(7).text), "¥", ""))) Or InStr(Trim(T_lowestxs(7).text), "¥") <> 1 Then
        MainForm.g_msgText = "您输入的格式有错误!"
        HMsgBox MainForm.g_msgText, 0, 1
        T_lowestxs(7).SetFocus
        f = "0"
        Exit Sub
    End If
    
    If Not IsNumeric(Trim(Replace(Trim(T_productsize(13).text), "¥", ""))) Or InStr(Trim(T_productsize(13).text), "¥") <> 1 Then
        MainForm.g_msgText = "您输入的格式有错误!"
        HMsgBox MainForm.g_msgText, 0, 1
        T_productsize(13).SetFocus
        f = "0"
        Exit Sub
    End If
    
    m_productionDAO.All m_recordset
    While Not m_recordset.EOF
        If Text1(1).text <> Text1(1).Tag Then
            If Text1(1).text = m_recordset.Fields("代号") Then
                MainForm.g_msgText = "代号已存在,请重新输入!"
                HMsgBox MainForm.g_msgText, 0, 1
                Text1(1).SetFocus
                f = "0"
                m_recordset.Close
                Exit Sub
            End If
        End If
        If Text1(10).text <> Text1(10).Tag Then
            If Text1(10).text = m_recordset.Fields("产品型号") Then
                MainForm.g_msgText = "型号已存在,请重新输入!"
                HMsgBox MainForm.g_msgText, 0, 1
                Text1(10).SetFocus
                f = "0"
                m_recordset.Close
                Exit Sub
            End If
        End If
'        If Text2.text <> Text2.Tag Then
'            If Text2.text = m_recordset.Fields("规格") Then
'                MainForm.g_msgText = "规格已存在,请重新输入!"
'                HMsgBox MainForm.g_msgText, 0, 1
'                Text2.SetFocus
'                f = "0"
'                m_recordset.Close
'                Exit Sub
'            End If
'        End If
        m_recordset.MoveNext
    Wend
    m_recordset.Close
      
    If Trim(Combo1.text) = "" Then
        MainForm.g_msgText = "产品类别不能为空!"
        HMsgBox MainForm.g_msgText, 0, 1
        Combo1.SetFocus
        f = "0"
        Exit Sub
    End If
    
End Sub
'**************************************
'*    功 能 描 述 :根据产品ID找到产品资料并显示在界面上
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub FindByIdRefresh()
    Dim ret As Boolean
    
    ret = m_productionDAO.FindById(m_recordset, m_productionId)
    
    If ret Then
      With m_recordset
            If .Fields(0) <> "" Then Text1(0).text = Trim(.Fields(0))
            If .Fields(1) <> "" Then Text1(1).text = Trim(.Fields(1))
            If .Fields(1) <> "" Then Text1(1).Tag = Trim(.Fields(1))
            If .Fields(2) <> "" Then Text1(2).text = Trim(.Fields(2))
            If .Fields(3) <> "" Then T_price(3).text = "¥" & Trim(.Fields(3))
            If .Fields(4) <> "" Then T_wxprice(4).text = "$" & Trim(.Fields(4))
            If .Fields(5) <> "" Then T_leveloprice(5).text = "¥" & Trim(.Fields(5))
            If .Fields(6) <> "" Then T_lowestjx(6).text = "¥" & Trim(.Fields(6))
            If .Fields(7) <> "" Then T_lowestxs(7).text = "¥" & Trim(.Fields(7))
            If .Fields(8) <> "" Then Combo1.text = Trim(.Fields(8))
            If .Fields(19) <> "" Then Combo1.Tag = Trim(.Fields(19))
            If .Fields(9) <> "" Then Text1(9).text = Trim(.Fields(9))
            If .Fields(10) <> "" Then Text1(10).text = Trim(.Fields(10))
            If .Fields(10) <> "" Then Text1(10).Tag = Trim(.Fields(10))
            If .Fields(11) <> "" Then T_selldeduct(11).text = Trim(.Fields(11))
            If .Fields(12) <> "" Then Text1(12).text = Trim(.Fields(12))
            If .Fields(13) <> "" Then T_productsize(13).text = "¥" & Trim(.Fields(13))
            If .Fields(14) <> "" Then T_materialcost(14).text = Trim(.Fields(14))
            If .Fields(15) <> "" Then Text1(15).text = Trim(.Fields(15))
'            If .Fields(16) <> "" Then Combo2.text = Trim(.Fields(16))
'            If .Fields(20) <> "" Then Combo2.Tag = Trim(.Fields(20))
'            If .Fields(17) <> "" Then Combo3.text = Trim(.Fields(17))
'            If .Fields(21) <> "" Then Combo3.Tag = Trim(.Fields(21))
'            If .Fields(18) <> "" Then Combo4.text = Trim(.Fields(18))
'            If .Fields(22) <> "" Then Combo4.Tag = Trim(.Fields(22))
            If .Fields(23) <> "" Then Text2.text = Trim(.Fields(23))
            If .Fields(23) <> "" Then Text2.Tag = Trim(.Fields(23))
            If .Fields(24) <> "" Then Text3.text = Trim(.Fields(24))
            If .Fields(25) <> "" Then Text4.text = Trim(.Fields(25))
            If .Fields(26) <> "" Then pictureid = Trim(.Fields(26))
            m_recordset.Close
      End With
    Else
        MainForm.g_msgText = "产品ID不正确,请重新操作!"
        HMsgBox MainForm.g_msgText, 0, 1
        Unload Me
    End If
End Sub
'**************************************
'*    功 能 描 述 :清除界面上文本框里的所有内容
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub clear()
            Text1(0).text = ""
            Text1(1).text = ""
            Text1(2).text = ""
            T_price(3).text = "¥" & "0"
            T_wxprice(4).text = "$" & "0"
            T_leveloprice(5).text = "¥" & "0"
            T_lowestjx(6).text = "¥" & "0"
            T_lowestxs(7).text = "¥" & "0"
            Combo1.text = ""
            Text1(9).text = ""
            Text1(10).text = ""
            T_selldeduct(11).text = "0"
            Text1(12).text = ""
            T_productsize(13).text = "¥" & "0"
            T_materialcost(14).text = "0"
            Text1(15).text = ""
            Text2.text = ""
            Text3.text = ""
            Text4.text = ""
            pictureid = ""
End Sub

Private Sub Form_Unload(Cancel As Integer)
    pictureid = ""
End Sub

'Private Sub T_leveloprice_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_leveloprice(5), 6, KeyAscii
'End Sub
'
'Private Sub T_lowestjx_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_lowestjx(6), 6, KeyAscii
'End Sub
'
'Private Sub T_lowestxs_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_lowestxs(7), 6, KeyAscii
'End Sub
'
'Private Sub T_materialcost_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_materialcost(14), 6, KeyAscii
'End Sub

'Private Sub T_price_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_price(3), 6, KeyAscii
'End Sub
'
'Private Sub T_productsize_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_productsize(13), 6, KeyAscii
'End Sub
'
'Private Sub T_selldeduct_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_selldeduct(11), 6, KeyAscii
'End Sub

'Private Sub T_wxprice_KeyPress(Index As Integer, KeyAscii As Integer)
'    InputFieldLimit T_wxprice(4), 6, KeyAscii
'End Sub


'**************************************
'*    功 能 描 述 :载入一个图记录的图片数据
'*    输 入 参 数 :imageId  - 图片ID
'*    输 出 能 数 :无
'**************************************
Private Function LoadPictureid(imageId As String)
    Dim ret As Boolean
    Dim fileLen As Long      ' 图片的长度
    Dim bufferfile As Long
    Dim current As String
    
    
    ret = m_dao.FindImageById(g_recordset, imageId)
    
    If ret Then
        fileLen = g_recordset.Fields("imageDate").ActualSize          '得到office字段中的文件数据的大小
        ReDim imageDataArr(fileLen)
        imageDataArr() = g_recordset.Fields("imageDate").GetChunk(fileLen) '将字段中数据写入动态数组中
        
        bufferfile = FreeFile()
        Open "tempfile.bmp" For Binary Access Read Write As #bufferfile '打开一个临时文件
        Put bufferfile, , imageDataArr '将动态数组FileArr中的数据写入临时文件tempfile中
        current = CurDir & "\tempfile.bmp" '获取临时文件的全路径
    '    WebBrowser1.Navigate current '在WebBrowser控件中显示文件内容
        Picture1.Picture = LoadPicture(current)
    End If
    
    g_recordset.Close
End Function
Private Sub T_leveloprice_LostFocus(Index As Integer)
    If InStr(Trim(T_leveloprice(5).text), "¥") = 0 Then
        T_leveloprice(5).text = "¥" & Trim(T_leveloprice(5).text)
    End If
End Sub
Private Sub T_lowestjx_LostFocus(Index As Integer)
    If InStr(Trim(T_lowestjx(6).text), "¥") = 0 Then
        T_lowestjx(6).text = "¥" & Trim(T_lowestjx(6).text)
    End If
End Sub
Private Sub T_lowestxs_LostFocus(Index As Integer)
    If InStr(Trim(T_lowestxs(7).text), "¥") = 0 Then
        T_lowestxs(7).text = "¥" & Trim(T_lowestxs(7).text)
    End If
End Sub
Private Sub T_price_LostFocus(Index As Integer)
    If InStr(Trim(T_price(3).text), "¥") = 0 Then
        T_price(3).text = "¥" & Trim(T_price(3).text)
    End If
End Sub
Private Sub T_productsize_LostFocus(Index As Integer)
    If InStr(Trim(T_productsize(13).text), "¥") = 0 Then
        T_productsize(13).text = "¥" & Trim(T_productsize(13).text)
    End If
End Sub
Private Sub T_wxprice_LostFocus(Index As Integer)
    If InStr(Trim(T_wxprice(4).text), "$") = 0 Then
        T_wxprice(4).text = "$" & Trim(T_wxprice(4).text)
    End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
    InputFieldLimit T_wxprice(4), 6, KeyAscii
End Sub

⌨️ 快捷键说明

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