📄 reportinput.aspx.vb
字号:
.Rows(0)("TestResult") = SelectTestResult.Value.Trim
If CheckBoxReportInputFinish.Checked = True Then
.Rows(0)("Finished") = 1
'将结果写入到报告中去,同时将报告中的TempSheet页分隔成几个Sheet页
Else
.Rows(0)("Finished") = 0
End If
End With
PubDataAdapter.Update(PubDataSet, "Report")
If CheckBoxReportInputFinish.Checked Then '所有的结果已经录入完毕
PubStrSql = "Select * from TaskBookPrj where TestID='" _
& DropDownListReportID.SelectedItem.Text.Trim & "' and Address='" _
& DropDownListAddress.SelectedItem.Text.Trim & "'"
PubDataAdapter.SelectCommand.CommandText = PubStrSql
PubSqlCmdBuilder.Dispose()
PubSqlCmdBuilder.DataAdapter = PubDataAdapter
PubDataAdapter.Fill(PubDataSet, "TableTaskBookPrj")
Dim intUpdateFlag As Int16
With PubDataSet.Tables("TableTaskBookPrj")
For i = 0 To .Rows.Count - 1
If .Rows(i)("State") <> 2 Then
intUpdateFlag = 1
.Rows(i)("State") = 2
.Rows(i)("TestEndTime") = Now.ToString("yyyy-MM-dd") _
& " " & Now.ToLongTimeString
'判断是否超周期
If Not IsDBNull(.Rows(i)("TestBeginTime")) Then
If Trim(.Rows(i)("TestBeginTime")) <> "" Then
If DateDiff(DateInterval.Hour, CDate(Trim(.Rows(i)("TestBeginTime"))), CDate(Trim(.Rows(i)("TestEndTime")))) > .Rows(i)("Period") Then
.Rows(i)("ExpireStandardFlag") = 1
End If
End If
End If
End If
Next
End With
If intUpdateFlag = 1 Then
PubDataAdapter.Update(PubDataSet, "TableTaskBookPrj")
End If
'结束任务书
PubStrSql = "Select * from TaskBook where Testid='" _
& DropDownListReportID.SelectedItem.Text.Trim _
& "' and State=2 and Address='" _
& DropDownListAddress.SelectedItem.Text.Trim & "'"
PubDataAdapter.SelectCommand.CommandText = PubStrSql
PubSqlCmdBuilder.Dispose()
PubSqlCmdBuilder.DataAdapter = PubDataAdapter
PubDataAdapter.Fill(PubDataSet, "TableTaskBook")
With PubDataSet.Tables("TableTaskBook")
For i = 0 To .Rows.Count - 1
.Rows(i)("State") = 3
.Rows(i)("TaskBookEndTime") = Now.ToString("yyyy-MM-dd") _
& " " & Now.ToLongTimeString
Next
End With
If PubDataSet.Tables("TableTaskBook").Rows.Count <> 0 Then
PubDataAdapter.Update(PubDataSet, "TableTaskBook")
End If
End If
Dim objTextArea As HtmlTextArea
Dim objDropDown As DropDownList
'更新TaskBookPrj表中的TestResult字段
PubStrSql = "Select * from TaskBookPrj where TestID='" _
& DropDownListReportID.SelectedItem.Text.Trim & "' and Address='" _
& DropDownListAddress.SelectedItem.Text.Trim & "' order by IceBoxSerial,Project"
PubDataAdapter.SelectCommand.CommandText = PubStrSql
PubDataAdapter.Fill(PubDataSet, "TableForUpdateTaskBookPrj")
Dim sqlCmdBulder3 As New SqlCommandBuilder(PubDataAdapter)
With PubDataSet.Tables("TableForUpdateTaskBookPrj")
For i = 1 To .Rows.Count
strControlID = "TextArea_Result_" & i
strControlValue = Request.Form(strControlID)
If strControlValue <> "" Then
strControlValue = Replace(strControlValue, vbCrLf, "")
Else
strControlValue = ""
End If
If strControlValue <> "" Then
'补充开测时间
If IsDBNull(.Rows(i - 1)("TestBeginTime")) Then
.Rows(i - 1)("TestBeginTime") = DateAdd(DateInterval.Hour, -12, Now)
ElseIf Trim(.Rows(i - 1)("TestBeginTime")) = "" Then
.Rows(i - 1)("TestBeginTime") = DateAdd(DateInterval.Hour, -12, Now)
End If
'补充结束时间
If IsDBNull(.Rows(i - 1)("TestEndTime")) Then
.Rows(i - 1)("TestEndTime") = Now
ElseIf Trim(.Rows(i - 1)("TestEndTime")) = "" Then
.Rows(i - 1)("TestEndTime") = Now
End If
End If
.Rows(i - 1)("TestResult") = strControlValue
strControlID = "DangXiangPanDing_" & i
strControlValue = Request.Form(strControlID)
'单项判定
Select Case strControlValue
Case "不合格"
.Rows(i - 1)("Qualified") = 0
Case "合格"
.Rows(i - 1)("Qualified") = 1
Case "不判定"
.Rows(i - 1)("Qualified") = 2
End Select
'备注
strControlID = "BeiZhu_" & i
strControlValue = Request.Form(strControlID)
If strControlValue <> "" Then
strControlValue = Replace(strControlValue, vbCrLf, "")
Else
strControlValue = ""
End If
.Rows(i - 1)("Remark") = strControlValue
Next
End With
PubDataAdapter.Update(PubDataSet, "TableForUpdateTaskBookPrj")
'更新SpecialProject表中的字段
PubStrSql = "Select * from SpecialProject where TestID='" _
& DropDownListReportID.SelectedItem.Text.Trim & "' and Address='" _
& DropDownListAddress.SelectedItem.Text.Trim & "'order by IceBoxSerial,ProjectName"
PubDataAdapter.SelectCommand.CommandText = PubStrSql
PubDataAdapter.Fill(PubDataSet, "SpecialProjectForUpDate")
PubSqlCmdBuilder.Dispose()
PubSqlCmdBuilder.DataAdapter = PubDataAdapter
With PubDataSet.Tables("SpecialProjectForUpDate")
For i = 1 To .Rows.Count
strControlID = "Spec_Result_" & i
strControlValue = Request.Form(strControlID)
If strControlValue <> "" Then
strControlValue = Replace(strControlValue, vbCrLf, "")
Else
strControlValue = ""
End If
If strControlValue <> "" Then
'补充开测时间
If IsDBNull(.Rows(i - 1)("TestBeginTime")) Then
.Rows(i - 1)("TestBeginTime") = DateAdd(DateInterval.Hour, -12, Now)
ElseIf Trim(.Rows(i - 1)("TestBeginTime")) = "" Then
.Rows(i - 1)("TestBeginTime") = DateAdd(DateInterval.Hour, -12, Now)
End If
.Rows(i - 1)("State") = 2
'补充结束时间
If IsDBNull(.Rows(i - 1)("TestEndTime")) Then
.Rows(i - 1)("TestEndTime") = Now
ElseIf Trim(.Rows(i - 1)("TestEndTime")) = "" Then
.Rows(i - 1)("TestEndTime") = Now
End If
End If
.Rows(i - 1)("TestResult") = strControlValue
strControlID = "Spec_DanXiangPanDing_" & i
strControlValue = Request.Form(strControlID)
Select Case strControlValue
Case "不合格"
.Rows(i - 1)("Qualified") = 0
Case "合格"
.Rows(i - 1)("Qualified") = 1
Case "不判定"
.Rows(i - 1)("Qualified") = 2
End Select
strControlID = "Spec_BeiZhu_" & i
strControlValue = Request.Form(strControlID)
If strControlValue <> "" Then
strControlValue = Replace(strControlValue, vbCrLf, "")
Else
strControlValue = ""
End If
.Rows(i - 1)("Remark") = strControlValue
Next
End With
PubDataAdapter.Update(PubDataSet, "SpecialProjectForUpDate")
'更新TaskBookStatistics
PubStrSql = "Select * from TaskbookStatistics where TestID='" _
& DropDownListReportID.SelectedItem.Text.Trim & "' and Address='" _
& DropDownListAddress.SelectedItem.Text.Trim & "'"
PubDataAdapter.SelectCommand.CommandText = PubStrSql
PubDataAdapter.Fill(PubDataSet, "TableIceBoxSerial")
Dim sqlCmdBuilder4 As New SqlCommandBuilder(PubDataAdapter)
Dim intHeGe, intBuHeGe As Int16
Dim tempSqlCmd As New SqlCommand()
tempSqlCmd.Connection = PubSqlConn
tempSqlCmd.Transaction = PubSqlTransaction
Dim tempDataAdapter As New SqlDataAdapter(tempSqlCmd)
With PubDataSet.Tables("TableIceBoxSerial")
For i = 1 To .Rows.Count
'不合格项数量
PubStrSql = "Select * from TaskBookPrj where Qualified=0 and IceBoxSerial='" _
& Trim(.Rows(i - 1)("IceBoxSerial")) & "' and Address='" _
& DropDownListAddress.SelectedItem.Text.Trim & "'"
tempDataAdapter.SelectCommand.CommandText = PubStrSql
tempDataAdapter.Fill(PubDataSet, "TableForUpDateTaskBookStatistics")
intBuHeGe = PubDataSet.Tables("TableForUpDateTaskBookStatistics").Rows.Count
PubDataSet.Tables("TableForUpDateTaskBookStatistics").Clear()
PubStrSql = "Select * from SpecialProject where Qualified=0 and" _
& " IceBoxSerial='" & Trim(.Rows(i - 1)("IceBoxSerial")) _
& "' and Address='" & DropDownListAddress.SelectedItem.Text.Trim & "'"
tempDataAdapter.SelectCommand.CommandText = PubStrSql
tempDataAdapter.Fill(PubDataSet, "TableForUpDateTaskBookStatistics")
intBuHeGe += PubDataSet.Tables("TableForUpDateTaskBookStatistics").Rows.Count
.Rows(i - 1)("UnQualified") = intBuHeGe
'合格项的数量
PubDataSet.Tables("TableForUpDateTaskBookStatistics").Clear()
PubStrSql = "Select * from TaskBookPrj where Qualified=1 and IceBoxSerial='" _
& Trim(.Rows(i - 1)("IceBoxSerial")) & "' and Address='" _
& DropDownListAddress.SelectedItem.Text.Trim & "'"
tempDataAdapter.SelectCommand.CommandText = PubStrSql
tempDataAdapter.Fill(PubDataSet, "TableForUpDateTaskBookStatistics")
intHeGe = PubDataSet.Tables("TableForUpDateTaskBookStatistics").Rows.Count
PubDataSet.Tables("TableForUpDateTaskBookStatistics").Clear()
PubStrSql = "Select * from SpecialProject where Qualified=1 and" _
& " IceBoxSerial='" & Trim(.Rows(i - 1)("IceBoxSerial")) _
& "' and Address='" & DropDownListAddress.SelectedItem.Text.Trim & "'"
tempDataAdapter.SelectCommand.CommandText = PubStrSql
tempDataAdapter.Fill(PubDataSet, "TableForUpDateTaskBookStatistics")
intHeGe += PubDataSet.Tables("TableForUpDateTaskBookStatistics").Rows.Count
.Rows(i - 1)("Qualified") = intHeGe
PubDataSet.Tables("TableForUpDateTaskBookStatistics").Clear()
Next
End With
PubDataAdapter.Update(PubDataSet, "TableIceBoxSerial")
newTr = New HtmlTableRow()
newTr.Align = HorizontalAlign.Center
newTd = New HtmlTableCell()
newTd.ColSpan = 5
newTr.Cells.Add(newTd)
TableDetail.Rows.Add(newTr)
If CheckBoxReportInputFinish.Checked = True Then
DropDownListReportID.Items.Remove(DropDownListReportID.SelectedItem.Text)
End If
PubSqlTransaction.Commit() '提交事务
newTd.InnerText = "保存成功"
Catch MyExp As Exception
Response.Write(MyExp.Message)
PubSqlTransaction.Rollback() '回滚事务
End Try
ButtonOk.Enabled = False
End Sub
Private Sub DropDownListReportID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownListReportID.SelectedIndexChanged
DisplayInputInterFace(DropDownListReportID.SelectedItem.Value, DropDownListAddress.SelectedItem.Text.Trim)
ButtonOk.Enabled = True
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -