-- 作者:姗姗来迟
-- 发布时间:2011/11/29 16:11:00
--
Select Case e.DataCol.name Case "牌号" Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = \'" & e.NewVAlue & "\'") If dr IsNot Nothing Then e.DataRow("原料指标_MgO镁_厂标") = dr("原料指标_MgO镁") e.DataRow("原料指标_SiO2硅_厂标") = dr("原料指标_SiO2硅") e.DataRow("原料指标_CaO钙_厂标") = dr("原料指标_CaO钙") e.DataRow("原料指标_Fe2O3铁_厂标") = dr("原料指标_Fe2O3铁") e.DataRow("原料指标_Al2O3铝_厂标") = dr("原料指标_Al2O3铝") e.DataRow("原料指标_CaO比SiO2_厂标") = dr("原料指标_CaO比SiO2") e.DataRow("原料指标_Cr2O3铬_厂标") = dr("原料指标_Cr2O3铬") e.DataRow("原料指标_FeO加Fe2O3_厂标") = dr("原料指标_FeO加Fe2O3") e.DataRow("原料指标_Na2O氧化钠_厂标") = dr("原料指标_Na2O氧化钠") e.DataRow("原料指标_BD体密_厂标") = dr("原料指标_BD体密") e.DataRow("原料指标_AP气孔_厂标") = dr("原料指标_AP气孔") e.DataRow("原料指标_CR比FE_厂标") = dr("原料指标_CR比FE") e.DataRow("成品指标_MgO镁_厂标") = dr("成品指标_MgO镁") e.DataRow("成品指标_Cr2O3铬_厂标") = dr("成品指标_Cr2O3铬") e.DataRow("成品指标_Fe2O3铁_厂标") = dr("成品指标_Fe2O3铁") e.DataRow("成品指标_Al2O3铝_厂标") = dr("成品指标_Al2O3铝") e.DataRow("成品指标_CaO钙_厂标") = dr("成品指标_CaO钙") e.DataRow("成品指标_SiO2硅_厂标") = dr("成品指标_SiO2硅") e.DataRow("成品指标_BD体密_厂标") = dr("成品指标_BD体密") e.DataRow("成品指标_AP气孔_厂标") = dr("成品指标_AP气孔") e.DataRow("成品指标_LOI烧碱_厂标") = dr("成品指标_LOI烧碱") e.DataRow("成品指标_CCS耐压_厂标") = dr("成品指标_CCS耐压") e.DataRow("成品指标_抗折_常温_厂标") = dr("成品指标_抗折_常温") e.DataRow("成品指标_抗折_高温_厂标") = dr("成品指标_抗折_高温") e.DataRow("成品指标_热震_水泠_厂标") = dr("成品指标_热震_水泠") e.DataRow("成品指标_热震_风泠_厂标") = dr("成品指标_热震_风泠") e.DataRow("成品指标_RUL菏软_厂标") = dr("成品指标_RUL菏软") Else e.DataRow("原料指标_MgO镁_厂标") = Nothing e.DataRow("原料指标_SiO2硅_厂标") = Nothing e.DataRow("原料指标_CaO钙_厂标") = Nothing e.DataRow("原料指标_Fe2O3铁_厂标") = Nothing e.DataRow("原料指标_Al2O3铝_厂标") = Nothing e.DataRow("原料指标_CaO比SiO2_厂标") = Nothing e.DataRow("原料指标_Cr2O3铬_厂标") = Nothing e.DataRow("原料指标_FeO加Fe2O3_厂标") = Nothing e.DataRow("原料指标_Na2O氧化钠_厂标") = Nothing e.DataRow("原料指标_BD体密_厂标") = Nothing e.DataRow("原料指标_AP气孔_厂标") = Nothing e.DataRow("原料指标_CR比FE_厂标") = Nothing e.DataRow("成品指标_MgO镁_厂标") = Nothing e.DataRow("成品指标_Cr2O3铬_厂标") = Nothing e.DataRow("成品指标_Fe2O3铁_厂标") = Nothing e.DataRow("成品指标_Al2O3铝_厂标") = Nothing e.DataRow("成品指标_CaO钙_厂标") = Nothing e.DataRow("成品指标_SiO2硅_厂标") = Nothing e.DataRow("成品指标_BD体密_厂标") = Nothing e.DataRow("成品指标_AP气孔_厂标") = Nothing e.DataRow("成品指标_LOI烧碱_厂标") = Nothing e.DataRow("成品指标_CCS耐压_厂标") = Nothing e.DataRow("成品指标_抗折_常温_厂标") = Nothing e.DataRow("成品指标_抗折_高温_厂标") = Nothing e.DataRow("成品指标_热震_水泠_厂标") = Nothing e.DataRow("成品指标_热震_风泠_厂标") = Nothing e.DataRow("成品指标_RUL菏软_厂标") = Nothing End If Case "原料指标_MgO镁_实测","原料指标_SiO2硅_实测","原料指标_CaO钙_实测","原料指标_Fe2O3铁_实测","原料指标_Al2O3铝_实测","原料指标_CaO比SiO2_实测","原料指标_Cr2O3铬_实测","原料指标_FeO加Fe2O3_实测","原料指标_Na2O氧化钠_实测","原料指标_BD体密_实测","原料指标_AP气孔_实测","原料指标_CR比FE_厂标","成品指标_MgO镁_实测","成品指标_Cr2O3铬_实测","成品指标_Fe2O3铁_实测","成品指标_Al2O3铝_实测","成品指标_CaO钙_实测","成品指标_SiO2硅_实测","成品指标_BD体密_实测","成品指标_AP气孔_实测","成品指标_LOI烧碱_实测","成品指标_CCS耐压_实测","成品指标_抗折_常温_实测","成品指标_抗折_高温_实测","成品指标_热震_水泠_实测","成品指标_热震_风泠_实测","成品指标_RUL菏软_实测" Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = \'" & e.DataRow("牌号") & "\'")
If dr IsNot Nothing AndAlso e.newvalue Then Dim nm As String = e.DataCol.Name.SubString(0,e.DataCol.Name.LastIndexof("_")) Dim ov As String = dr(nm) If Isnumeric(ov) Then Dim v As Double = ov If e.NewValue = v Then e.DataRow(nm & "_" & "厂标" ) = "合格" ElseIf e.NewValue > v Then e.DataRow(nm & "_" & "厂标" ) = e.newvalue -v Else e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue End If ElseIf ov.IndexOf("-") > 0 Then Dim vls() As String = ov.split("-") Dim v1 As Double = vls(0) Dim v2 As Double = vls(1) If e.newvalue >= v1 AndAlso e.newvalue <= v2 Then e.DataRow(nm & "_" & "厂标" ) = "合格" ElseIf e.newvalue < v1 Then e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v1 Else e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v2 End If Else Dim o As String = ov.SubString(0,1) Dim v As Double = val(ov.SubString(1)) If o = ">" Then If e.NewValue > v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue End If ElseIf o = "<" If e.NewValue < v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v End If ElseIf o = "≥" Then If e.NewValue >= v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue End If ElseIf o = "≤" If e.NewValue <= v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v End If End If End If End If End Select
|
-- 作者:狐狸爸爸
-- 发布时间:2011/11/30 9:53:00
--
如果在原料指标_SiO2硅_实测输入值,但是你的理化厂表中原料指标_SiO2硅是空值,而你的代码又没有判断,不出错才奇怪。
加上判断即可:
Select Case e.DataCol.name Case "原料指标_MgO镁_实测","原料指标_SiO2硅_实测","原料指标_CaO钙_实测","原料指标_Fe2O3铁_实测","原料指标_Al2O3铝_实测","原料指标_CaO比SiO2_实测","原料指标_Cr2O3铬_实测","原料指标_FeO加Fe2O3_实测","原料指标_Na2O氧化钠_实测","原料指标_BD体密_实测","原料指标_AP气孔_实测","原料指标_CR比FE_厂标","成品指标_MgO镁_实测","成品指标_Cr2O3铬_实测","成品指标_Fe2O3铁_实测","成品指标_Al2O3铝_实测","成品指标_CaO钙_实测","成品指标_SiO2硅_实测","成品指标_BD体密_实测","成品指标_AP气孔_实测","成品指标_LOI烧碱_实测","成品指标_CCS耐压_实测","成品指标_抗折_常温_实测","成品指标_抗折_高温_实测","成品指标_热震_水泠_实测","成品指标_热震_风泠_实测","成品指标_RUL菏软_实测" Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = \'" & e.DataRow("牌号") & "\'") If dr IsNot Nothing AndAlso e.newvalue Then Dim nm As String = e.DataCol.Name.SubString(0,e.DataCol.Name.LastIndexof("_")) If dr.IsNull(nm) =False Then Dim ov As String = dr(nm) If Isnumeric(ov) Then Dim v As Double = ov If e.NewValue = v Then e.DataRow(nm & "_" & "厂标" ) = "合格" ElseIf e.NewValue > v Then e.DataRow(nm & "_" & "厂标" ) = e.newvalue -v Else e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue End If ElseIf ov.IndexOf("-") > 0 Then Dim vls() As String = ov.split("-") Dim v1 As Double = vls(0) Dim v2 As Double = vls(1) If e.newvalue >= v1 AndAlso e.newvalue <= v2 Then e.DataRow(nm & "_" & "厂标" ) = "合格" ElseIf e.newvalue < v1 Then e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v1 Else e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v2 End If Else Dim o As String = ov.SubString(0,1) Dim v As Double = val(ov.SubString(1)) If o = ">" Then If e.NewValue > v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue End If ElseIf o = "<" If e.NewValue < v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v End If ElseIf o = "≥" Then If e.NewValue >= v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue End If ElseIf o = "≤" If e.NewValue <= v Then e.DataRow(nm & "_" & "厂标" ) = "合格" Else e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v End If End If End If End If End If End Select
建议看看:
http://www.foxtable.com/help/topics/1485.htm
[此贴子已经被作者于2011-11-30 9:54:11编辑过]
|