If e.DataCol.Name = "高度" OrElse e.DataCol.Name = "长度" Then '如果内容发生变动的是品名列
If e.DataRow.IsNull("高度") OrElse e.DataRow.IsNull("长度") Then '如果新值是空白,也就是品名列的内容为空
e.DataRow("CNC长度工时") = Nothing '那么清空此行单价列的内容
Else
Dim dr As DataRow
'否则在产品表查找同名的产品行,将找到的行赋值给变量dr
Dim cc As Double = e.DataRow("长度")
Dim cn As String
If cc <= 20 Then
cn = "AA"
Else If cc > 20 AndAlso cc <= 40
cn = "BB"
Else If cc > 40 AndAlso cc <= 60
cn = "CC"
Else If cc > 60 AndAlso cc <= 80
cn = "DD"
Else If cc > 80 AndAlso cc <= 100
cn = "EE"
Else If cc > 100 AndAlso cc <= 125
cn = "FF"
Else If cc > 125 AndAlso cc <= 150
cn = "GG"
Else If cc > 150 AndAlso cc <= 200
cn = "HH"
Else If cc > 200 AndAlso cc <= 250
cn = "II"
Else If cc > 250 AndAlso cc <= 300
cn = "JJ"
Else If cc > 300 AndAlso cc <= 400
cn = "KK"
Else If cc > 400 AndAlso cc <= 600
cn = "LL"
Else If cc > 600 AndAlso cc <= 800
cn = "MM"
End If
Dim cs As Double = e.DataRow("高度")
Dim css As String
If cs <= 5 Then
css = "≤5"
Else If cs > 5 AndAlso cs <= 10
css = "≤10"
Else If cs > 10 AndAlso cs <= 15
css = "≤15"
Else If cs > 15 AndAlso cs <= 20
css = "≤20"
Else If cs > 20 AndAlso cs <= 25
css = "≤25"
Else If cs > 25 AndAlso cs <= 30
css = "≤30"
Else If cs > 30 AndAlso cs <= 35
css = "≤35"
Else If cs > 35 AndAlso cs <= 40
css = "≤40"
Else If cs > 40 AndAlso cs <= 45
css = "≤45"
Else If cs > 45 AndAlso cs <= 50
css = "≤50"
Else If cs > 50 AndAlso cs <= 55
css = "≤55"
Else If cs > 55 AndAlso cs <= 60
css = "≤60"
End If
dr = DataTables("查询表").Find("[深度] = '" & css & "'")
If dr IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("CNC长度工时") = dr(cn)
End If
End If
End If
If e.DataCol.Name = "高度" OrElse e.DataCol.Name = "宽度" Then '如果内容发生变动的是品名列
If e.DataRow.IsNull("高度") OrElse e.DataRow.IsNull("宽度") Then '如果新值是空白,也就是品名列的内容为空
e.DataRow("CNC宽度工时") = Nothing '那么清空此行单价列的内容
Else
Dim dr As DataRow
'否则在产品表查找同名的产品行,将找到的行赋值给变量dr
Dim cc As Double = e.DataRow("宽度")
Dim cn As String
If cc <= 20 Then
cn = "AA"
Else If cc > 20 AndAlso cc <= 40
cn = "BB"
Else If cc > 40 AndAlso cc <= 60
cn = "CC"
Else If cc > 60 AndAlso cc <= 80
cn = "DD"
Else If cc > 80 AndAlso cc <= 100
cn = "EE"
Else If cc > 100 AndAlso cc <= 125
cn = "FF"
Else If cc > 125 AndAlso cc <= 150
cn = "GG"
Else If cc > 150 AndAlso cc <= 200
cn = "HH"
Else If cc > 200 AndAlso cc <= 250
cn = "II"
Else If cc > 250 AndAlso cc <= 300
cn = "JJ"
Else If cc > 300 AndAlso cc <= 400
cn = "KK"
Else If cc > 400 AndAlso cc <= 600
cn = "LL"
Else If cc > 600 AndAlso cc <= 800
cn = "MM"
End If
Dim cs As Double = e.DataRow("高度")
Dim css As String
If cs <= 5 Then
css = "≤5"
Else If cs > 5 AndAlso cs <= 10
css = "≤10"
Else If cs > 10 AndAlso cs <= 15
css = "≤15"
Else If cs > 15 AndAlso cs <= 20
css = "≤20"
Else If cs > 20 AndAlso cs <= 25
css = "≤25"
Else If cs > 25 AndAlso cs <= 30
css = "≤30"
Else If cs > 30 AndAlso cs <= 35
css = "≤35"
Else If cs > 35 AndAlso cs <= 40
css = "≤40"
Else If cs > 40 AndAlso cs <= 45
css = "≤45"
Else If cs > 45 AndAlso cs <= 50
css = "≤50"
Else If cs > 50 AndAlso cs <= 55
css = "≤55"
Else If cs > 55 AndAlso cs <= 60
css = "≤60"
End If
dr = DataTables("查询表").Find("[深度] = '" & css & "'")
If dr IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("CNC宽度工时") = dr(cn)
End If
End If
End If