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

📄 accepttaskbook.aspx.vb

📁 一个很不错的实验室管理系统,用vb+sql编写,功能强大,界面美观
💻 VB
📖 第 1 页 / 共 4 页
字号:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class AcceptTaskBook
    Inherits clsTaskBook
    Protected WithEvents dropdownlisttype As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlistserial As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlistdest As System.Web.UI.WebControls.DropDownList
    Protected WithEvents tablepara As System.Web.UI.HtmlControls.HtmlTable
    Protected WithEvents Tableitem As System.Web.UI.HtmlControls.HtmlTable
    Protected WithEvents btnAccept As System.Web.UI.WebControls.Button
    Protected WithEvents btnReject As System.Web.UI.WebControls.Button
    Protected WithEvents tablehead As System.Web.UI.HtmlControls.HtmlTable
    Protected WithEvents checkboxchar4 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents checkboxchar3 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents checkboxchar2 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents checkboxchar1 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Tablemainpart As System.Web.UI.HtmlControls.HtmlTable
    Protected WithEvents txttype As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtserial As System.Web.UI.WebControls.TextBox
    Protected WithEvents TableBeiZhu As System.Web.UI.HtmlControls.HtmlTable
    Protected WithEvents Tablespecialitem As System.Web.UI.HtmlControls.HtmlTable
    Protected WithEvents RegularExpressionValidator1 As System.Web.UI.WebControls.RegularExpressionValidator
    Protected WithEvents DropDownListaddress As System.Web.UI.WebControls.DropDownList
    Protected WithEvents drpTestID As System.Web.UI.WebControls.DropDownList
    Protected WithEvents txtTestID As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtTestDep As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtIceProvider As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtTestXiaDa As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtTestShengQing As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtTestPiZhun As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtIceModel As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtSignature As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtIceSerial As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtIceNum As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtIceMakePos As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtExecuteStandard As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtTestObjectDescription As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtSampleStep As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtBrand As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtSampleAddress As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtSampleBase As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtSampleBy As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtProductAddress As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtConsumeArea As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtTestObject As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtIceBoxName As System.Web.UI.WebControls.TextBox
    Protected WithEvents chkN As System.Web.UI.WebControls.CheckBox
    Protected WithEvents chkSN As System.Web.UI.WebControls.CheckBox
    Protected WithEvents chkT As System.Web.UI.WebControls.CheckBox
    Protected WithEvents chkST As System.Web.UI.WebControls.CheckBox
    Protected WithEvents txtAcceptPerson As System.Web.UI.WebControls.TextBox
    Protected WithEvents RequiredVALtxtAcceptPerson As System.Web.UI.WebControls.RequiredFieldValidator
    Protected WithEvents RequiredVALtxtTestPiZhun As System.Web.UI.WebControls.RequiredFieldValidator
    Protected WithEvents VALSummary As System.Web.UI.WebControls.ValidationSummary
    Protected WithEvents lblMessage As System.Web.UI.WebControls.Label
    Protected WithEvents RegulartxtTestXiaDa As System.Web.UI.WebControls.RegularExpressionValidator
    Protected WithEvents RangetxtTestXiaDa As System.Web.UI.WebControls.RangeValidator
    Protected WithEvents txtRefuse As System.Web.UI.WebControls.TextBox
    Protected WithEvents tableEnd As System.Web.UI.HtmlControls.HtmlTable
    Protected WithEvents txtBeiZhu As System.Web.UI.WebControls.TextBox
#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region
    '函数名称:tableinit
    '函数功能:显示任务书的明细
    '输入参数:strAddress任务书地址
    'strTestID任务书编号
    Private Sub tableinit(ByVal strAddress As String, ByVal strTestID As String)
        '设置签字默认值        
        txtSignature.Text = Session("userid")
        PubStrSql = "select TestDep,IceProvider,IceBoxName,TestXiaDa,TestShengQing," _
        & "Signature,TestPiZhun,IceModel,IceNum,IceSerial,IceMakePos,ConsumeArea," _
        & "ExecuteStandard,TaskBook.TestObject,TestObjectDescription,SampleStep," _
        & "BeiZhu,ProductAddress,SampleAddress,SampleBase,SampleBy,Brand from " _
        & " taskbook,report where taskbook.testid=report.testid and " _
        & " taskbook.address=report.address and state=1 and acceptFlag=0 and" _
        & " checked<>1 and checked<>3 AND taskbook.address='" & strAddress _
        & "' and taskbook.TestID='" & strTestID & "'"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        Try
            PubDataSet.Tables("taskbook").Clear()
        Catch
        End Try
        PubDataAdapter.Fill(PubDataSet, "taskbook")
        If PubDataSet.Tables("taskbook").Rows.Count <> 0 Then
            btnAccept.Enabled = True
            btnReject.Enabled = True
        Else
            btnAccept.Enabled = False
            btnReject.Enabled = False
            Exit Sub
        End If
        '任务书基本内容    
        DisplayUpperTaskBook(PubStrSql)
        '显示任务书
        DisplayTaskBook(strAddress, strTestID, tablepara, Tablemainpart, Tableitem, Tablespecialitem)
        '自动编号
        Call ZDBH()
    End Sub
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '初始化地点
        If Not Page.IsPostBack Then
            Response.Cache.SetNoServerCaching()
            DisplayAddress(DropDownListaddress)
            For intLoopIndex = 0 To DropDownListaddress.Items.Count - 1
                If DropDownListaddress.Items(intLoopIndex).Text.Trim = Session("UserAddress") Then
                    DropDownListaddress.Items(intLoopIndex).Selected = True
                    Exit For
                End If
            Next
            '取得待接收的任务书
            PubStrSql = "select * from taskbook where state=1 and acceptFlag=0 and" _
            & " checked<>1 and checked<>3 and address='" _
            & DropDownListaddress.SelectedItem.Text.Trim & "'" & " order by testxiada asc"
            PubDataAdapter.SelectCommand.CommandText = PubStrSql
            PubDataAdapter.Fill(PubDataSet, "taskbook")
            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 If
    End Sub

    Private Sub btnAccept_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAccept.Click
        Dim strTaskbookSerial, strTotalIceBoxSerial, strSource, strTestID, strAddress As String
        Dim intNum, AcceptNum, ChangeNum As Int16
        Dim DestFlag, AddressFlag, tempString As String
        Dim IceBoxSerial(CInt(txtIceNum.Text.Trim))
        '原来的编号
        strTestID = drpTestID.SelectedItem.Value.Trim
        strAddress = DropDownListaddress.SelectedItem.Text.Trim
        '取得数据库中的编号、实验目的等信息以准备用来自动编号用
        PubStrSql = "select testid, IceSerial from taskbook" _
        & " where testid='" & strTestID & "'" & " and address='" & strAddress & "'"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        PubDataAdapter.Fill(PubDataSet, "taskbookTestID")

        Select Case strAddress
            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"
            Case "发泡剂"
                DestFlag = "FP"
            Case "温控器"
                DestFlag = "WK"
            Case "主控板"
                DestFlag = "ZK"
            Case "其它"
                DestFlag = "QT"
        End Select
        PubStrSql = "select testid, IceNum,IceSerial,TestObjFlag from taskbook where testid='" _
        & drpTestID.SelectedItem.Value.Trim & "'" & " and address='" _
        & strAddress & "'"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        PubDataAdapter.Fill(PubDataSet, "taskbookobj")
        PubStrSql = "select * from MusterMainPart where testid='" _
        & drpTestID.SelectedItem.Value.Trim & "'" & " and address='" _
        & strAddress & "'"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        PubDataAdapter.Fill(PubDataSet, "MainPart")
        PubStrSql = "select * from MusterTechPara where testid='" _
        & drpTestID.SelectedItem.Value.Trim & "'" & " and address='" _
        & strAddress & "'"
        PubDataAdapter.SelectCommand.CommandText = PubStrSql
        PubDataAdapter.Fill(PubDataSet, "TechPara")
        '更新accepttaskbooknum表,是自动编号的要求
        If InStr(Trim(PubDataSet.Tables("taskbookobj").Rows(0)("testid")), "HR") = 0 Then
            If PubDataSet.Tables("taskbookobj").Rows(0)("testobjflag") = 0 Then
                '试验目的不是其它
                If txtTestObject.Text.Trim = "全新产品" Then
                    PubStrSql = "select * from accepttaskbooknum where BXXH='" _
                    & txtIceModel.Text.Trim & "'" & " and SHYMD='" & txtTestObject.Text.Trim _
                    & "'" & " and DZH='" & strAddress & "'"
                    PubDataAdapter.SelectCommand.CommandText = PubStrSql
                    PubDataAdapter.Fill(PubDataSet, "AcceptNum")
                    If PubDataSet.Tables("AcceptNum").Rows.Count <> 0 Then
                        AcceptNum = PubDataSet.Tables("AcceptNum").Rows(0)("SHYCSH")
                        AcceptNum += 1
                    Else
                        AcceptNum = 1
                    End If
                    If PubDataSet.Tables("AcceptNum").Rows.Count = 0 Then
                        PubStrSql = "insert into AcceptTaskBookNum(BXXH,SHYMD,DZH,ZHGJGG," _
                        & "SHYCSH) values('" & txtIceModel.Text.Trim & "','" _
                        & txtTestObject.Text.Trim & "','" _

⌨️ 快捷键说明

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