请老师帮忙看看,下面的代码,红色部分实现不了,是什么原因?
Select Case e.DataCol.name
Case "领料情况_分机组"
If e.newvalue = False Then
DataTables("领料清单").DeleteFor("编号='" & e.DataRow("编号") & "'")
Else
If e.DataRow("物资说明") = "原材料" Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "原材料"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = "Kg"
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("物资说明") = "辅材" Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "辅材"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量") / 2
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("物资说明") = "项目消耗品" Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "项目消耗品"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量") / 2
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("物资说明") = "焊材" Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "焊材"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量") / 2
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("物资说明") = "外购件" Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "外购件"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量") / 2
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("物资说明") = "电气" Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "电气"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量") / 2
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("物资说明") = "紧固件" Then
Dim ndr1 As DataRow = DataTables("领料清单").Find("预算编号 = '" & e.DataRow("预算编号") & "'")
If ndr1 Is Nothing Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "紧固件"
ndr("物资名称") = "紧固件"
ndr("规格") = "/"
ndr("材质") = "/"
ndr("单位") = e.DataRow("单位")
ndr("单位") = "批"
ndr("领料数量") = "0.5"
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("物资说明") = "核电-紧固件" Then
Dim ndr2 As DataRow = DataTables("领料清单").Find("预算编号 = '" & e.DataRow("预算编号") & "'")
If ndr2 Is Nothing Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = "核电-紧固件"
ndr("物资名称") = "核电-紧固件"
ndr("规格") = "/"
ndr("材质") = "/"
ndr("单位") = e.DataRow("单位")
ndr("单位") = "批"
ndr("领料数量") = "0.5"
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
End If
End If
End If
Case "领料情况_不分机组"
If e.newvalue = False Then
DataTables("领料清单").DeleteFor("编号='" & e.DataRow("编号") & "'")
Else
If e.DataRow("物资说明") = "原材料" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "原材料"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = "Kg"
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "辅材" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "辅材"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "项目消耗品" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "项目消耗品"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "外购件" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "外购件"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "电气" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "电气"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "焊材" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "焊材"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "消耗品" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "消耗品"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "劳保用品" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "劳保用品"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "办公用品" Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "办公用品"
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("单位") = e.DataRow("单位")
ndr("领料数量") = e.DataRow("到货数量")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
If e.DataRow("物资说明") = "紧固件" Then
Dim ndr As DataRow = DataTables("领料清单").Find("预算编号 = '" & e.DataRow("预算编号") & "'")
If ndr Is Nothing Then
Dim nr As Row = Tables("领料清单").AddNew
nr.Move(0)
ndr = nr.DataRow
End If
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "紧固件"
ndr("物资名称") = "紧固件"
ndr("规格") = "/"
ndr("材质") = "/"
ndr("单位") = "批"
ndr("领料数量") = "1"
ndr("领料日期") = Date.today
End If
If e.DataRow("物资说明") = "核电-紧固件" Then
Dim ndr As DataRow = DataTables("领料清单").Find("预算编号 = '" & e.DataRow("预算编号") & "'")
If ndr Is Nothing Then
Dim nr As Row = Tables("领料清单").AddNew
nr.Move(0)
ndr = nr.DataRow
End If
ndr("序号") = e.DataRow("序号")
ndr("编号") = e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = "核电-紧固件"
ndr("物资名称") = "核电-紧固件"
ndr("规格") = "/"
ndr("材质") = "/"
ndr("单位") = "批"
ndr("领料数量") = "1"
ndr("领料日期") = Date.today
End If
End If
Case "领料情况_预领余额"
If e.newvalue = False Then
DataTables("领料清单").DeleteFor("编号='余额" & e.DataRow("编号") & "'")
Else
If e.DataRow("领料情况_分机组") = True Then
For i As Integer = 1 To 2
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") ="余额" & e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("物资说明") = e.DataRow("物资说明")
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
Next
End If
If e.DataRow("领料情况_不分机组") = True Then
Dim ndr As Row = Tables("领料清单").AddNew
ndr("序号") = e.DataRow("序号")
ndr("编号") ="余额" & e.DataRow("编号")
ndr("预算编号") = e.DataRow("预算编号")
ndr("生产令号") = e.DataRow("生产令号")
ndr("项目名称") = e.DataRow("项目名称")
ndr("物资说明") = e.DataRow("物资说明")
ndr("物资名称") = e.DataRow("物资名称")
ndr("规格") = e.DataRow("规格")
ndr("材质") = e.DataRow("材质")
ndr("送货单位") = e.DataRow("中标情况_中标单位")
ndr("领料日期") = Date.today
ndr.Move(0)
End If
End If
End Select