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

📄 accepttaskbook.aspx.vb

📁 一个很不错的实验室管理系统,用vb+sql编写,功能强大,界面美观
💻 VB
📖 第 1 页 / 共 4 页
字号:
                    PubStrSql = "insert into AcceptTaskBookNum(BXXH,SHYMD," _
                    & "DZH,ZHGJGG,SHYCSH)" _
                    & " values('" & txtIceModel.Text.Trim & "','其它','" & strAddress _
                    & "','其它',1)"
                Else
                    PubStrSql = "update acceptTaskbookNum set SHYCSH=" & AcceptNum _
                    & " where BXXH='" & txtIceModel.Text.Trim & "'" & " and SHYMD='其它'" _
                    & " and DZH='" & strAddress & "'"
                End If
                If InStr(Trim(PubDataSet.Tables("taskbookobj").Rows(0)("testid")), "HR") = 0 Then
                    PubSqlCmd.CommandText = PubStrSql
                    PubSqlCmd.ExecuteNonQuery()
                End If
            End If
        End If

        '得到现在的编号
        strTaskbookSerial = txtTestID.Text.Trim
        strTotalIceBoxSerial = Replace(txtIceSerial.Text, vbCrLf, "")
        '分隔冰箱编号
        strSource = strTotalIceBoxSerial
        intNum = 0
        Do While InStr(strSource, "#")
            intNum = intNum + 1
            i = InStr(strSource, "#")
            IceBoxSerial(intNum) = Left(strSource, i - 1)
            strSource = Mid(strSource, i + 1)
        Loop
        IceBoxSerial(intNum + 1) = strSource
        Try
            PubSqlTransaction = PubSqlConn.BeginTransaction
            PubSqlCmd.Transaction = PubSqlTransaction
            '更新taskbook中的数据            
            PubStrSql = "update taskbook set AcceptPerson='" & Trim(txtAcceptPerson.Text) _
            & "'" & ",AcceptFlag=1," & "AcceptTime='" & DateTime.Now.ToString("yyyy-MM-dd") _
            & " " & DateTime.Now.ToLongTimeString & "',TestPiZhun='" & txtTestPiZhun.Text.Trim _
            & "',Signature='" & txtSignature.Text.Trim & "'" & " where testid='" _
            & strTestID & "'" & " and address='" _
            & strAddress & "'"
            PubSqlCmd.CommandText = PubStrSql
            PubSqlCmd.ExecuteNonQuery()
            '更新库中数据
            '更新实验编号
            If InStr(Trim(PubDataSet.Tables("taskbookTestID").Rows(0)("testid")), "HR") = 0 Then
                PubStrSql = "update taskbook set testid='" & strTaskbookSerial & "'" _
                & " where testid='" & strTestID & "'" & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                PubStrSql = "update report set testid='" & strTaskbookSerial & "'" _
                & " where testid='" & strTestID & "'" & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                PubStrSql = "update mustertechpara set testid='" & strTaskbookSerial _
                & "'" & " where testid='" & strTestID & "'" _
                & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                PubStrSql = "update mustermainpart set testid='" _
                & strTaskbookSerial & "'" & " where testid='" & strTestID _
                & "'" & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                PubStrSql = "update TestObjDescription set testid='" _
                & strTaskbookSerial & "'" & " where testid='" & strTestID _
                & "'" & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                PubStrSql = "update taskbookprj set testid='" _
                & strTaskbookSerial & "'" & " where testid='" & strTestID _
                & "'" & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                PubStrSql = "update specialproject set testid='" _
                & strTaskbookSerial & "'" & " where testid='" & strTestID _
                & "'" & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                PubStrSql = "update TaskbookStatistics set testid='" _
                & strTaskbookSerial & "'" & " where testid='" & strTestID _
                & "'" & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
            End If
            '更新冰箱编号
            If Trim(PubDataSet.Tables("taskbookTestID").Rows(0)("IceSerial")) = "" Then
                PubStrSql = "update taskbook set iceserial='" & strTotalIceBoxSerial _
                & "'" & " where testid='" & strTaskbookSerial & "'" _
                & " and address='" & strAddress & "'"
                PubSqlCmd.CommandText = PubStrSql
                PubSqlCmd.ExecuteNonQuery()
                For intLoopIndex = 1 To CInt(txtIceNum.Text.Trim)
                    PubStrSql = "update taskbookprj set IceBoxSerial='" _
                    & IceBoxSerial(intLoopIndex) & "'" & " where testid='" _
                    & strTaskbookSerial & "'" & " and address='" & strAddress _
                    & "'" & " and IceBoxSerial='" & intLoopIndex.ToString & "'"
                    PubSqlCmd.CommandText = PubStrSql
                    PubSqlCmd.ExecuteNonQuery()
                    PubStrSql = "update specialproject set IceBoxSerial='" _
                    & IceBoxSerial(intLoopIndex) & "'" & " where testid='" _
                    & strTaskbookSerial & "'" & " and address='" & strAddress _
                    & "'" & " and IceBoxSerial='" & intLoopIndex.ToString & "'"
                    PubSqlCmd.CommandText = PubStrSql
                    PubSqlCmd.ExecuteNonQuery()
                    PubStrSql = "update TaskbookStatistics set IceBoxSerial='" _
                    & IceBoxSerial(intLoopIndex) & "'" & " where testid='" _
                    & strTaskbookSerial & "'" & " and address='" & strAddress _
                    & "'" & " and IceBoxSerial='" & intLoopIndex.ToString & "'"
                    PubSqlCmd.CommandText = PubStrSql
                    PubSqlCmd.ExecuteNonQuery()
                Next
            End If
            PubSqlTransaction.Commit()
        Catch objerror As Exception
            PubSqlTransaction.Rollback()
            lblMessage.Text = objerror.ToString
            'lblMessage.Text = "任务书没有接收"
            Exit Sub
        End Try
        '显示下一个任务书
        drpTestID.Items.Remove(drpTestID.SelectedItem)
        If (drpTestID.Items.Count > 0) Then
            Call tableinit(strAddress, drpTestID.SelectedItem.Value.Trim)
        End If
    End Sub

    Private Sub btnReject_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReject.Click
        PubStrSql = "select * from taskbook  where AcceptFlag=0" & " and testid='" _
        & Trim(drpTestID.SelectedItem.Value) & "'" & " and address='" _
        & DropDownListaddress.SelectedItem.Text.Trim & "'"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        PubDataAdapter.Fill(PubDataSet, "taskbook")
        PubSqlCmdBuilder.DataAdapter = PubDataAdapter
        lblMessage.Text = ""
        If txtAcceptPerson.Text.Trim = "" Then
            lblMessage.Text = "请签字"
            Call tableinit(DropDownListaddress.SelectedItem.Text.Trim, drpTestID.SelectedItem.Value.Trim)
            Exit Sub
        End If
        lblMessage.Text = ""
        If txtRefuse.Text.Trim = "" Then
            lblMessage.Text = "请输入拒收原因"
            Call tableinit(DropDownListaddress.SelectedItem.Text.Trim, drpTestID.SelectedItem.Value.Trim)
            Exit Sub
        End If
        With PubDataSet.Tables("taskbook")
            .Rows(0)("AcceptPerson") = Trim(txtAcceptPerson.Text)
            .Rows(0)("AcceptFlag") = 2
            .Rows(0)("AcceptTime") = DateTime.Now.ToString("yyyy-MM-dd") _
            & " " & DateTime.Now.ToLongTimeString
            .Rows(0)("Refuse") = txtRefuse.Text.Trim
        End With
        txtRefuse.Text = "                                         "
        PubDataAdapter.Update(PubDataSet, "taskbook")
        drpTestID.Items.Remove(drpTestID.SelectedItem)
        '显示下一个任务书
        If drpTestID.Items.Count > 0 Then
            Call tableinit(DropDownListaddress.SelectedItem.Text.Trim, drpTestID.SelectedItem.Value.Trim)
        End If
    End Sub

    Private Sub drpTestID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpTestID.SelectedIndexChanged
        Dim objDataAdapter As SqlDataAdapter
        Dim mydataset As New DataSet()
        Dim taskbookDA As SqlDataAdapter
        '设置签字默认值       
        txtAcceptPerson.Text = Session("userid")
        '显示任务书
        tableinit(DropDownListaddress.SelectedItem.Text.Trim, drpTestID.SelectedItem.Value.Trim)
    End Sub

    Private Sub DropDownListaddress_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownListaddress.SelectedIndexChanged
        '显示任务书编号
        PubStrSql = "select * from taskbook where state=1 and acceptFlag=0 and address='" _
        & DropDownListaddress.SelectedItem.Text.Trim & "'" & " order by testxiada asc"
        PubDataAdapter.Fill(PubDataSet, "taskbook")
        drpTestID.Items.Clear()
        For intLoopIndex = 0 To PubDataSet.Tables("taskbook").Rows.Count - 1
            drpTestID.Items.Add("任务书" & CStr(intLoopIndex + 1))
            drpTestID.Items(intLoopIndex).Value = _
            Trim(PubDataSet.Tables("taskbook").Rows(intLoopIndex)("testid"))
        Next
        If drpTestID.Items.Count > 0 Then
            Call tableinit(DropDownListaddress.SelectedItem.Text.Trim, drpTestID.SelectedItem.Value.Trim)
        End If
    End Sub
    Private Sub ZDBH()
        '自动编号函数,对实验编号自动编号
        Dim tempString, TaskBookSerial, IceBoxSerial(3), TotalIceBoxSerial As String
        Dim tempIceBoxSerial As String
        Dim AcceptNum As Int16
        Dim ChangeNum As Int16
        Dim intloopindex As Int16
        Dim AddressFlag, DestFlag As String
        Dim strDate As String
        strDate = Right(DateTime.Now.Year, 2) & DateTime.Now.Month.ToString("00") _
        & DateTime.Now.Day.ToString("00")
        Select Case DropDownListaddress.SelectedItem.Text.Trim
            Case "北京"
                AddressFlag = "BXZ"
            Case "武汉"
                AddressFlag = "QBZ"
            Case "天津"
                AddressFlag = "TBZ"
            Case "大连"
                AddressFlag = "DLZ"
            Case "上海"
                AddressFlag = "PDZ"
            Case "贵州"
                AddressFlag = "GZZ"
            Case "河北"
                AddressFlag = "LGZ"
        End Select
        Select Case txtTestObject.Text.Trim
            Case "全新产品"
                DestFlag = "QX"
            Case "压机匹配"
                DestFlag = "YJ"
            Case "蒸发器\冷凝器改进"
                DestFlag = "ZF"
            Case "制冷剂"
                DestFlag = "ZL"

⌨️ 快捷键说明

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