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

📄 producefinish.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 3 页
字号:
    MainForm.g_application.m_databaseCon.m_adoConnection.RollbackTrans
    Me.MousePointer = 0         '设置鼠标形状为正常状态
End Sub
'**************************************
'*    功 能 描 述 :把整数值转换成产品的序列号 8位的字符串
'*    输 入 参 数 :serial  - 序列号整数
'*    输 出 能 数 :8位的字符串的产品序列号
'**************************************
Public Function ChangeToSerialStr(serial As Integer) As String
    Dim tempSerialStr As String      ' 4位的产品序列号
    Dim tempSerialNum As String      ' 转换成字符串的整数序列号
    Dim serialLen As Integer         ' 字符串序列号的长度
    
    If serial >= 10000 Then
        serial = serial - 10000
    End If
    
    tempSerialStr = "0000"
    tempSerialNum = CStr(serial)
    serialLen = Len(tempSerialNum)
    
    tempSerialStr = Left(tempSerialStr, Len(tempSerialStr) - serialLen) + tempSerialNum
    
    ChangeToSerialStr = tempSerialStr
    
End Function
Private Sub Form_Unload(Cancel As Integer)
    m_cooperateFinishId = ""
End Sub

Private Sub Text3_Change()
    On Error GoTo EXITSUB
    If CDbl(Trim(Text4.text)) <> 0 Then
       Text5.text = CDbl(CDbl(Trim(quantity)) - CDbl(Trim(Text3.text)) - CDbl(Trim(Text4.text))) - finishNum
    Else
       Text5.text = CDbl(CDbl(Trim(quantity)) - CDbl(Trim(Text3.text))) - finishNum
    End If
EXITSUB:
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
    InputFieldLimit Text3, 6, KeyAscii
End Sub

Private Sub Text4_Change()
    On Error GoTo EXITSUB
    If CDbl(Trim(Text3.text)) <> 0 Then
       Text5.text = CDbl(CDbl(Trim(quantity)) - CDbl(Trim(Text4.text)) - CDbl(Trim(Text3.text))) - finishNum
    Else
       Text5.text = CDbl(CDbl(Trim(quantity)) - CDbl(Trim(Text4.text))) - finishNum
    End If
EXITSUB:
End Sub

Private Sub Text5_Change()
    On Error GoTo EXITSUB
    Text6.text = "¥" & CDbl(CDbl(Trim(Text5.text)) * CDbl(Trim(quote)))
EXITSUB:
End Sub
'**************************************
'*    功 能 描 述 :判断输入文本框数据的合法性
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Function Check() As Boolean
    Check = True
    
    If Len(Trim(Text5.text)) = 0 Then                       ' 判断完成数量是否为空
        MainForm.g_msgText = "完成数量不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text5.SetFocus
        Check = False
        Exit Function
    End If
    
    If CDbl(Text5.text) <= 0 Then                       ' 判断完成数量是否小于零
        MainForm.g_msgText = "完成数量不能小于 0 !"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text5.SetFocus
        Check = False
        Exit Function
    End If
    
    If Len(Trim(Text1.text)) = 0 Then                       ' 判断完成数量是否为空
        MainForm.g_msgText = "生产编号不能为空!请双击生产编号!!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text5.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text4.text)) = 0 Then                       ' 判断完成数量是否为空
        MainForm.g_msgText = "返工数量不能为空!,或者您填一个0的数字"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text4.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text3.text)) = 0 Then                       ' 判断完成数量是否为空
        MainForm.g_msgText = "报损数量不能为空!,或者您填一个0的数字"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text3.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text7.text)) = 0 Then                       ' 判断完成数量是否为空
        MainForm.g_msgText = "完成时间不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text5.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Combo1.text)) = 0 Then                       ' 判断完成数量是否为空
        MainForm.g_msgText = "库位不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text5.SetFocus
        Check = False
        Exit Function
    End If
    If Not IsNumeric(Text5.text) Then
        MainForm.g_msgText = "完成数量,你输入的数字格式有错误!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text5.SetFocus
        Check = False
        Exit Function
    End If
    If Not IsNumeric(Text3.text) Then
        MainForm.g_msgText = "报损数量,你输入的数字格式有错误!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text3.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text6.text)) = 0 Then                       ' 判断完成数量是否为空
        MainForm.g_msgText = "加工费用不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text5.SetFocus
        Check = False
        Exit Function
    End If
    If Not IsNumeric(Text4.text) Then
        MainForm.g_msgText = "返工数量,你输入的数字格式有错误!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text4.SetFocus
        Check = False
        Exit Function
    End If
    If CDbl(Trim(Text3.text)) + CDbl(Trim(Text4.text)) + CDbl(Trim(Text5.text)) > CDbl(Trim(quantity)) Then
        MainForm.g_msgText = "您的输入数不能大于要生产的数量!" + "总的生产数量是" + Trim(quantity)
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        'Text6.SetFocus
        Check = False
        Exit Function
    End If
    '----------------查看所有的生产产品是否检验完----------------------
    Dim h As Double
    Dim rst1 As Boolean
    Dim Y As Integer
'    Dim count As Integer
'    Dim p As Integer
'    Dim rstnum As ADODB.Recordset
'    Set rstnum = New ADODB.Recordset
    Y = 0
'    m_ProduceFinishDAO.checkrecord_findnum rstnum, Trim(Text1.Tag)
'
'    For p = 1 To CInt(Trim(rstnum.Fields("num")))
    For h = minserial To maxserial
        rst1 = m_ProduceFinishDAO.check_findproduction(m_recordset, Trim(Text1.Tag), CDbl(Trim(h)))

        If rst1 Then
            If Trim(m_recordset.Fields("jybj")) = "3" Or Trim(m_recordset.Fields("jybj")) = "5" Then
                Y = Y + 1
            End If
        End If
        
        m_recordset.Close
    Next h
'    Next p
    
    If CInt(maxserial) - CInt(minserial) + 1 > Y Then
        MainForm.g_msgText = "该产品没有全部检验合格!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        
        Check = False
        Exit Function
    End If
    '-------------------------------------------------------------------------
    
   '判断领料是否已经领完了
   Dim ret As Boolean
   Dim ret1 As Boolean
    ret = m_produceDAO.FindProduceDetailById(m_recordset, Trim(Text1.Tag))
    Dim sum As Double
    sum = 0
    ret1 = m_produceDAO.ProduceDrawMaterial_findtotalnum(g_recordset, Trim(m_recordset.Fields("materialId")), Trim(m_recordset.Fields("bomid")), Trim(Text1.Tag))

    If ret1 Then
        Do While Not g_recordset.EOF
            sum = sum + Trim(g_recordset.Fields("totalNum"))
            g_recordset.MoveNext
        Loop
    End If
    g_recordset.Close
    If CDbl(sum) <> CDbl(Trim(m_recordset.Fields("totalnum"))) Then
        MainForm.g_msgText = "该产品还没有全部领完料!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        m_recordset.Close
        Check = False
        Exit Function
    End If
    m_recordset.Close
End Function
Private Sub cooperatefinish_show()
    Dim ret As String
    ' 找到外协生产单资料
'    ret = m_cooperateDAO.FindCooperateById(m_recordset, m_cooperateId)
    ret = m_produceDAO.produce_print(m_recordset, m_cooperateId)            '外协
    If ret Then
        Text1.Tag = Trim(m_recordset.Fields("produceId"))
        Text1.text = Trim(m_recordset.Fields("pocessno"))
        Text10.text = Trim(m_recordset.Fields("exeEmployeeName"))
        Text2.text = Trim(m_recordset.Fields("bomName"))
        Text11.text = CDbl(m_recordset.Fields("quantity")) - CDbl(m_recordset.Fields("finishNum"))
        minserial = CInt(Trim(m_recordset.Fields("最小序列号")))
        maxserial = CInt(Trim(m_recordset.Fields("最大序列号")))
        
        Text7.text = CDate(Trim(m_recordset.Fields("finishdate")))
        quote = CDbl(Trim(m_recordset.Fields("fee")))
        quantity = CDbl(Trim(m_recordset.Fields("quantity")))
        finishNum = CDbl(m_recordset.Fields("finishNum"))
        Text5.text = CDbl(m_recordset.Fields("quantity")) - CDbl(m_recordset.Fields("finishNum"))
    Else
        MainForm.g_msgText = "你查找的生产单质量检验还没有全部合格或者还没有检验,请重新选择其他的生产单!"
        HMsgBox MainForm.g_msgText, 0, 1

    End If
    
    m_recordset.Close
    
    ' 查找完工单
    ret = m_ProduceFinishDAO.ProduceFinishFindById(m_recordset, m_cooperateFinishId)
    If ret Then
       
        Text3.text = Trim(m_recordset.Fields("lossPartNum"))
        Text4.text = Trim(m_recordset.Fields("backPartNum"))
        Text5.text = Trim(m_recordset.Fields("finishPartNum"))
        Text6.text = "¥" & Trim(m_recordset.Fields("processFee"))
        Text7.text = Trim(m_recordset.Fields("finishDate"))
        Text8.text = Trim(m_recordset.Fields("memo"))
        Combo1.text = Trim(m_recordset.Fields("warehouseName"))
        Combo1.Tag = Trim(m_recordset.Fields("warehouseid"))
    Else
        MainForm.g_msgText = "你查找的生产单质量检验还没有全部合格或者还没有检验,请重新选择其他的生产单!"
        HMsgBox MainForm.g_msgText, 0, 1

    End If
    
    m_recordset.Close
'    With CooperateFinishlist
'        Text1.text = Trim(.MSHFlexGrid1.TextMatrix(.rowname, 1))
'        Text2.text = Trim(.MSHFlexGrid1.TextMatrix(.rowname, 2))
'        Text3.text = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.rowname, 3)))
'        Text4.text = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.rowname, 4)))
'        Text5.text = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.rowname, 5)))
'        Text6.text = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.rowname, 6)))
'        Text7.text = CDate(Trim(.MSHFlexGrid1.TextMatrix(.rowname, 7)))
'        Text8.text = Trim(.MSHFlexGrid1.TextMatrix(.rowname, 8))
'        Text9.text = Trim(.MSHFlexGrid1.TextMatrix(.rowname, 9))
'  End With
End Sub
'*******************************************************
'*    模 块 名 称 :检查保存入库内容的有效性
'*    最后修改时间:2005/09/09
'*    备        注:
'*******************************************************
Private Function judge_position() As Boolean
    judge_position = True
    Dim judge As Boolean
    Dim ret As Boolean
'    m_recordset.Close
    ret = m_produceDAO.produce_findById_c(g_recordset, m_cooperateId)
    If ret Then
        judge = m_cooperatefinishDAO.judge_position1(m_recordset, Trim(Combo1.Tag), _
                                                   Trim(g_recordset.Fields("materialId")), _
                                                   Trim(g_recordset.Fields("materialType")))
        If Not judge Then
             Dim i As String
                 i = MsgBox("仓库里没有该商品的库位,你确定要添加吗?", vbOKCancel + vbInformation, "选择供应商提示")
                 If i = vbOK Then
'                    cooperate_addposition.m_materialId = Trim(g_recordset.Fields("materialId"))
'                    cooperate_addposition.m_materialType = Trim(g_recordset.Fields("materialType"))
'                    cooperate_addposition.m_warehouseId = Text9.Tag
'                    cooperate_addposition.m_warehouseName = Text9.text
'                    cooperate_addposition.show 1
                    positionsingleform.articleid = Trim(g_recordset.Fields("materialId"))
                    positionsingleform.articletype = Trim(g_recordset.Fields("materialType"))
                    positionsingleform.m_operatorType = 2
                    positionsingleform.warehouseid = Combo1.Tag
                    positionsingleform.show 1
                    positionsingleform.articleid = ""
                    positionsingleform.articletype = ""
                    positionsingleform.warehouseid = ""
                 Else
                    judge_position = False
                 End If
        End If
        g_recordset.Close
        m_recordset.Close
    End If
End Function

Private Sub Text5_KeyPress(KeyAscii As Integer)
    InputFieldLimit Text5, 6, KeyAscii
End Sub

⌨️ 快捷键说明

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