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

📄 taskbookdetail.aspx.vb

📁 一个很不错的实验室管理系统,用vb+sql编写,功能强大,界面美观
💻 VB
📖 第 1 页 / 共 4 页
字号:
                        Next
                    Else
                        For intLoopIndex = 0 To ggDCF.Items.Count - 1
                            If ggDCF.Items(intLoopIndex).Text.Trim = "无" Then
                                ggDCF.Items(intLoopIndex).Selected = True
                                Exit For
                            End If
                        Next
                        For intLoopIndex = 0 To gyDCF.Items.Count - 1
                            If gyDCF.Items(intLoopIndex).Text.Trim = "无" Then
                                gyDCF.Items(intLoopIndex).Selected = True
                                Exit For
                            End If
                        Next
                    End If
                End With               
            Else
                PubStrSql = "select * from musterMainPart where testid='" & SHYBH.Text.Trim _
                & "'" & " and address='" & CSDD.SelectedItem.Text.Trim & "'"
                PubDataAdapter.SelectCommand.CommandText = PubStrSql
                PubDataAdapter.Fill(PubDataSet, "tblMainPart")
                With PubDataSet.Tables("tblMainPart")
                    ttYJ.Text = Trim(.Rows(0)("GuiGe"))
                    ggYJ.Visible = False
                    tyYJ.Text = Trim(.Rows(0)("Provider"))
                    gyYJ.Visible = False
                    ttWKQ.Text = Trim(.Rows(1)("GuiGe"))
                    ggWKQ.Visible = False
                    tyWKQ.Text = Trim(.Rows(1)("Provider"))
                    gyWKQ.Visible = False
                    ttZHKB.Text = Trim(.Rows(2)("GuiGe"))
                    ggZHKB.Visible = False
                    tyZHKB.Text = Trim(.Rows(2)("Provider"))
                    gyZHKB.Visible = False
                    ttLC.Text = Trim(.Rows(3)("GuiGe"))
                    ggLC.Visible = False
                    tyLC.Text = Trim(.Rows(3)("Provider"))
                    gyLC.Visible = False
                    ttJRS.Text = Trim(.Rows(4)("GuiGe"))
                    ggJRS.Visible = False
                    tyJRS.Text = Trim(.Rows(4)("Provider"))
                    gyJRS.Visible = False
                    ttLD.Text = Trim(.Rows(5)("GuiGe"))
                    ggLD.Visible = False
                    tyLD.Text = Trim(.Rows(5)("Provider"))
                    gyLD.Visible = False
                    ttLNQ.Text = Trim(.Rows(6)("GuiGe"))
                    ggLNQ.Visible = False
                    tyLNQ.Text = Trim(.Rows(6)("Provider"))
                    gyLNQ.Visible = False
                    ttGLQ.Text = Trim(.Rows(7)("GuiGe"))
                    ggGLQ.Visible = False
                    tyGLQ.Text = Trim(.Rows(7)("Provider"))
                    gyGLQ.Visible = False
                    ttFJ.Text = Trim(.Rows(8)("GuiGe"))
                    ggFJ.Visible = False
                    tyFJ.Text = Trim(.Rows(8)("Provider"))
                    gyFJ.Visible = False
                    ttDKG.Text = Trim(.Rows(9)("GuiGe"))
                    ggDKG.Visible = False
                    tyDKG.Text = Trim(.Rows(9)("Provider"))
                    gyDKG.Visible = False
                    If .Rows.Count = 11 Then
                        ttDCF.Text = Trim(.Rows(10)("GuiGe"))
                        tyDCF.Text = Trim(.Rows(10)("Provider"))
                    Else
                        ttDCF.Text = "无"
                        tyDCF.Text = "无"
                    End If
                    ggDCF.Visible = False
                    gyDCF.Visible = False
                End With                
            End If
            '实验项目
            PubStrSql = "select distinct T2.project,T2.teststandard as standardserial," _
            & "T2.period,testproject.standardtemplate,testproject.methodtemplate," _
            & "testproject.period from taskbookprj T2,testproject where" _
            & " T2.Teststandard=testproject.standardserial and T2.project=testproject.project" _
            & "  and T2.testid='" & strSerial & "'" & " and T2.address='" & strAddress & "'"
            Session("tempPubStrSql") = PubStrSql
            PubStrSql += " order by T2.standardserial"
            PubDataAdapter.SelectCommand.CommandText = PubStrSql
            Try
                PubDataSet.Tables("tempTable").Clear()
            Catch
            End Try
            PubDataAdapter.Fill(PubDataSet, "tempTable")
            dgTestProject.DataSource = PubDataSet.Tables("tempTable").DefaultView
            dgTestProject.DataBind()
            '特殊项目
            PubStrSql = "select distinct testid,ProjectName,ProjectMethod,Period from" _
            & " SpecialProject where Testid='" & SHYBH.Text.Trim & "'" & " and address='" _
            & CSDD.SelectedItem.Text.Trim & "'"
            PubDataAdapter.SelectCommand.CommandText = PubStrSql
            PubDataAdapter.Fill(PubDataSet, "SpecialProject")
            With PubDataSet.Tables("SpecialProject")
                If Not Page.IsPostBack Then
                    Session("num") = .Rows.Count
                    For intLoopIndex = 1 To .Rows.Count
                        With Tablespecialitem
                            .Rows(intLoopIndex).Cells(0).InnerHtml = "T" & intLoopIndex
                            objtextbox = CType(.Controls(1).FindControl("TBProject" & intLoopIndex), TextBox)
                        End With
                        objtextbox.Text = .Rows(intLoopIndex - 1)("ProjectName")
                        With Tablespecialitem
                            objtextbox = CType(.Controls(1).FindControl("TBMethod" & intLoopIndex), TextBox)
                        End With
                        objtextbox.Text = .Rows(intLoopIndex - 1)("ProjectMethod")
                        With Tablespecialitem
                            objtextbox = CType(.Controls(1).FindControl("TBPeriod" & intLoopIndex), TextBox)
                        End With
                        objtextbox.Text = .Rows(intLoopIndex - 1)("Period")
                    Next
                End If
            End With            
        End If
    End Sub

    Private Sub SHYMD_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SHYMD.SelectedIndexChanged
        Dim tempString As String
        Session("change") = "true"
        paneladd.Visible = False
        If SHYMD.SelectedItem.Text.Trim <> "其它" Then
            PubStrSql = "TestProject.StandardSerial=StandardSerial.StandardSerial" _
            & " and StandardSerial.StandardClass=Standard.StandardClass and" _
            & " TestProject.MethodChecked=1 and TestProject.StandardChecked=1" _
            & " and TestProject.testobj='" & SHYMD.SelectedItem.Text.Trim & "'" _
            & " and Standard.ConsumArea like '%" & XFDQ.SelectedItem.Text.Trim & "%'"
            txtSHYMD.Visible = False
            txtSHYMD.Text = "NotQiTa"
        Else
            PubStrSql = "TestProject.StandardSerial=StandardSerial.StandardSerial" _
            & " and StandardSerial.StandardClass=Standard.StandardClass and" _
            & " TestProject.MethodChecked=1 and TestProject.StandardChecked=1" _
            & " and Standard.ConsumArea like '%" & XFDQ.SelectedItem.Text.Trim & "%'"
            txtSHYMD.Visible = True
            txtSHYMD.Text = ""
        End If
        '冰箱名称
        Select Case BXMCH.SelectedItem.Text.Trim
            Case "家用制冷器具冷藏箱"
                PubStrSql += " and lcx=1"
            Case "家用制冷器具冷冻箱"
                PubStrSql += " and ldx=1"
            Case "家用制冷器具冷藏冷冻箱"
                PubStrSql += " and lcldx=1"
            Case "家用制冷器具无霜冷藏箱"
                PubStrSql += " and Wslcx=1"
            Case "家用制冷器具无霜冷冻箱"
                PubStrSql += " and Wsldx=1"
            Case "家用制冷器具无霜冷藏冷冻箱"
                PubStrSql += " and Wslcldx=1"
            Case "家用制冷器具无霜冷冻食品储藏箱"
                PubStrSql += " and Wsldspccx=1"
            Case "家用制冷器具无霜食品冷冻箱"
                PubStrSql += " and Wsspldx=1"
        End Select
        '气候类型
        If LXN.Checked = True Then
            tempString = " and (N=1"
        End If
        If LXSN.Checked = True Then
            If tempString <> "" Then
                tempString = tempString & " or SN=1"
            Else
                tempString = " and (SN=1"
            End If
        End If
        If LXST.Checked = True Then
            If tempString <> "" Then
                tempString = tempString & " or ST=1"
            Else
                tempString = " and (ST=1"
            End If
        End If
        If LXT.Checked = True Then
            If tempString <> "" Then
                tempString = tempString & " or T=1"
            Else
                tempString = " and (ST=1"
            End If
        End If
        If tempString <> "" Then
            tempString = tempString & ")"
        End If
        PubStrSql += tempString
        Session("tempPubStrSql") = Replace(PubStrSql, "TestProject", "T2")
        PubStrSql += " order by TestProject.StandardSerial"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        PubDataAdapter.Fill(PubDataSet, "testproject")
        dgTestProject.DataSource = PubDataSet.Tables("testproject").DefaultView
        dgTestProject.DataBind()
    End Sub
    Private Sub dgTestProject_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgTestProject.ItemDataBound
        Dim cb As CheckBox
        Dim hl As HyperLink
        If e.Item.ItemIndex > -1 Then
            cb = e.Item.Cells(0).Controls(1)
            If Not Page.IsPostBack Then
                cb.Checked = True
            End If
            cb.Text = (e.Item.ItemIndex + 1).ToString
        End If
    End Sub
    Public Sub SaveTable(ByVal flag As Int16)   'flag=0 保存 flag=1下达             
        Dim strSource As String
        Dim strTestStandard, strStandardClass, strSHYMD, strTestID, strXZH As String
        Dim intNum, secondintloop As Int16
        Dim ProjectNum, SpecialProjectNum, totalProjectNum As Int16
        Dim cb As CheckBox
        Dim objtextbox1, objtextbox2, objtextbox3 As TextBox
        Dim intN, intSN, intST, intT, intCHeck, intJaJ, intObj As Int16
        Dim TechPara(20), ShuoMing(20), MainPart(20), GuiGe(20) As String
        Dim GongYingShang(20), IceBoxSerial(3) As String
        If InStr(Trim(SHYBH.Text), "HR") = 0 Then
            strTestID = Format(DateTime.Now, "yyyy-MM-dd") & " " & DateTime.Now.ToLongTimeString
        Else
            strTestID = SHYBH.Text.Trim
        End If
        strTestStandard = ""
        For intLoopIndex = 0 To dgTestProject.Items.Count - 1
            cb = dgTestProject.Items(intLoopIndex).Cells(0).Controls(1)
            If InStr(strTestStandard, dgTestProject.Items(intLoopIndex).Cells(2).Text.Trim) = 0 _
            And cb.Checked = True Then
                strTestStandard += dgTestProject.Items(intLoopIndex).Cells(2).Text.Trim & "、"
            End If
        Next

        If strTestStandard <> "" Then
            strTestStandard = Left(strTestStandard, Len(strTestStandard) - 1)
        End If
        PubStrSql = "select * from standard where consumarea like '%" _
        & XFDQ.SelectedItem.Text.Trim & "%'"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        PubDataAdapter.Fill(PubDataSet, "Standard")
        strStandardClass = PubDataSet.Tables("standard").Rows(0)("StandardClass")
        If SHYMD.SelectedItem.Text.Trim <> "其它" Then
            strSHYMD = SHYMD.SelectedItem.Text.Trim
        Else
            strSHYMD = txtSHYMD.Text.Trim
            intObj = 1
        End If
        If LXN.Checked = True Then
            intN = 1
        Else
            intN = 0
        End If
        If LXSN.Checked = True Then
            intSN = 1
        Else
            intSN = 0
        End If
        If LXST.Checked = True Then
            intST = 1
        Else
            intST = 0
        End If
        If LXT.Checked = True Then
            intT = 1
        Else
            intT = 0
        End If
        If SHFJJ.Checked = True Then
            intJaJ = 1
        Else
            intJaJ = 0
        End If
        For intLoopIndex = 0 To dgTestProject.Items.Count - 1
            cb = dgTestProject.Items(intLoopIndex).Cells(0).Controls(1)
            If cb.Checked = False Then
                intCHeck = 1
                Exit For
            End If
        Next
        '使用事务保存信息
        Try
            PubSqlTransaction = PubSqlConn.BeginTransaction()
            PubSqlCmd.Transaction = PubSqlTransaction
            '任务书
            PubStrSql = "insert into taskbook(TestID,IceBoxName,TestDep,IceProvider," _
            & "TestXiaDa,TestShengQing,IceModel,IceNum,IceSerial,IceMakePos,ConsumeArea," _
            & "ExecuteStandard,StandardClass,TestObject,State,N,SN,T,ST,Checked,BeiZhu," _
            & "TestObjectDescription,SampleStep,JiaJi,Address,TestObjFlag) values('" _
            & strTestID & "','" & BXMCH.SelectedItem.Text.Trim & "','" & SHYBM.Text.Trim & "','" _
            & BXTZHZH.Text.Trim & "','" & XDRQ.Text.Trim & "','" & WCHRQ.Text.Trim & "','" _
            & BXXH.Text.Trim & "','" & BXSHL.SelectedItem.Text.Trim & "','" & BXBH.Text.Trim _
            & "','" & BXCHD.SelectedItem.Text.Trim & "','" & XFDQ.SelectedItem.Text.Trim _
            & "','" & strTestStandard & "','" & strStandardClass & "','" & strSHYMD & "'," _

⌨️ 快捷键说明

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