改好了你的逻辑,不过不知道怎么去测试。看着头晕。
Select Case e.DataCol.name
Case "工艺状态","粗车计划完成日","钳工热焊计划完成日","外协计划完成日","精车计划完成日","采购计划完成日","设计图计划完成日"
Dim dr As DataRow = e.DataRow
If dr("工艺状态") = "原材料" OrElse dr("工艺状态") = "外购毛坯" Then
Dim dx As Row = Tables("生产明细表").Filter = "[项目编号] = '" & Tables("生产项目表").current("项目编号")& "'"
If dx("粗车计划完成日") = "无" AndAlso dx("钳工热焊计划完成日") = "无" AndAlso dx("外协计划完成日") = "无" AndAlso dx("精车计划完成日") = "无" Then
dr("装配入库计划开始日") = "缺值"
Else
Dim max As Date = IIF(dx("采购计划完成日") = "无", "1900/1/1", dx("采购计划完成日"))
Dim temp As Date = IIF(dx("钳工热焊计划完成日") = "无", "1900/1/1", dx("钳工热焊计划完成日"))
If temp > max Then max = temp
temp = IIF(dx("采购计划完成日") = "无", "1900/1/1", dx("采购计划完成日"))
If temp > max Then max = temp
temp = IIF(dx("精车计划完成日") = "无", "1900/1/1", dx("精车计划完成日"))
If temp > max Then max = temp
dr("装配入库计划开始日") = max
End If
Else
If dr("工艺状态") = "外购成品" OrElse dr("工艺状态") = "库存成品" Then
dr("装配入库计划开始日") = dr("设计图计划完成日")
End If
End If
End Select
[此贴子已经被作者于2012-11-30 16:21:28编辑过]