以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- 增加行 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=145127) |
-- 作者:13775189031 -- 发布时间:2020/1/9 10:51:00 -- 增加行 以下代码是按照到货日期生成行,每到货一批新增加一行 现在想第一次到货时生成一行,后面每到货一次不再增加行,只变更到货数量,到货日期变更为最新的日期,要怎么改? Select Case e.DataCol.Name Case "到货_第一批_日期" If e.DataRow.IsNull("到货_第一批_日期") = True Then DataTables("外购件入厂检验台账").DeleteFor("编号=\'" & e.DataRow("编号") & "\'") Else Dim ndr1 As DataRow = DataTables("外购件入厂检验台账").Find("编号 = \'" & e.DataRow("编号") & "\'") 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("物资说明") = e.DataRow("物资说明") ndr("物资名称") = e.DataRow("物资名称") ndr("规格") = e.DataRow("规格") ndr("材质") = e.DataRow("材质") ndr("单位") = e.DataRow("单位") ndr("代号") = "B" ndr("到货数量") = e.DataRow("到货数量") ndr("到货重量Kg") = e.DataRow("到货重量Kg") ndr("中标情况_中标单位") = e.DataRow("中标情况_中标单位") ndr("送检_送检日期") = e.DataRow("到货_第一批_日期") ndr.Move(0) End If If e.DataRow("物资说明") = "外购件-中广核工程" Then DataTables("外购件入厂检验台账").DeleteFor("编号=\'" & e.DataRow("编号") & "\'") 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("代号") = "B" ndr("到货数量") = e.DataRow("到货数量") ndr("到货重量Kg") = e.DataRow("到货重量Kg") ndr("中标情况_中标单位") = e.DataRow("中标情况_中标单位") ndr("送检_送检日期") = e.DataRow("到货_第一批_日期") ndr.Move(0) End If If e.DataRow("物资说明") = "电气" Then DataTables("外购件入厂检验台账").DeleteFor("编号=\'" & e.DataRow("编号") & "\'") 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("代号") = "B" ndr("到货数量") = e.DataRow("到货数量") ndr("到货重量Kg") = e.DataRow("到货重量Kg") ndr("中标情况_中标单位") = e.DataRow("中标情况_中标单位") ndr("送检_送检日期") = e.DataRow("到货_第一批_日期") ndr.Move(0) End If End If End Select Select Case e.DataCol.Name Case "到货_第二批_日期" If e.DataRow.IsNull("到货_第二批_日期") = True Then DataTables("外购件入厂检验台账").DeleteFor("编号=\'" & e.DataRow("编号") & "\'") Else Dim ndr1 As DataRow = DataTables("外购件入厂检验台账").Find("编号 = \'" & e.DataRow("编号") & "\'") 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("物资说明") = e.DataRow("物资说明") ndr("物资名称") = e.DataRow("物资名称") ndr("规格") = e.DataRow("规格") ndr("材质") = e.DataRow("材质") ndr("单位") = e.DataRow("单位") ndr("代号") = "B" ndr("到货数量") = e.DataRow("到货数量") ndr("到货重量Kg") = e.DataRow("到货重量Kg") ndr("中标情况_中标单位") = e.DataRow("中标情况_中标单位") ndr("送检_送检日期") = e.DataRow("到货_第二批_日期") ndr.Move(0) End If If e.DataRow("物资说明") = "外购件-中广核工程" Then DataTables("外购件入厂检验台账").DeleteFor("编号=\'" & e.DataRow("编号") & "\'") 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("代号") = "B" ndr("到货数量") = e.DataRow("到货数量") ndr("到货重量Kg") = e.DataRow("到货重量Kg") ndr("中标情况_中标单位") = e.DataRow("中标情况_中标单位") ndr("送检_送检日期") = e.DataRow("到货_第二批_日期") ndr.Move(0) End If If e.DataRow("物资说明") = "电气" Then DataTables("外购件入厂检验台账").DeleteFor("编号=\'" & e.DataRow("编号") & "\'") 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("代号") = "B" ndr("到货数量") = e.DataRow("到货数量") ndr("到货重量Kg") = e.DataRow("到货重量Kg") ndr("中标情况_中标单位") = e.DataRow("中标情况_中标单位") ndr("送检_送检日期") = e.DataRow("到货_第二批_日期") ndr.Move(0) End If End If End Select Select Case e.DataCol.Name Case "生产令号","项目名称","物资名称","规格","材质","中标情况_中标单位" Dim Filter As String = "[编号] = \'" & e.DataRow("编号") & "\'" Dim drs As List(Of DataRow) = DataTables("领料清单").Select(Filter) For Each dr4 As DataRow In drs dr4(e.DataCol.Name) = e.NewValue Next End Select |
-- 作者:有点蓝 -- 发布时间:2020/1/9 11:29:00 -- Case "到货_第一批_日期" If e.DataRow.IsNull("到货_第一批_日期") = True Then DataTables("外购件入厂检验台账").DeleteFor("编号=\'" & e.DataRow("编号") & "\'") Else Dim ndr1 As DataRow = DataTables("外购件入厂检验台账").Find("编号 = \'" & e.DataRow("编号") & "\'") If e.DataRow("物资说明") = "外购件" OrElse e.DataRow("物资说明") = "外购件-中广核工程" OrElse e.DataRow("物资说明") = "电气" Then If ndr1 Is Nothing 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("代号") = "B" ndr("到货数量") = e.DataRow("到货数量") ndr("到货重量Kg") = e.DataRow("到货重量Kg") ndr("中标情况_中标单位") = e.DataRow("中标情况_中标单位") ndr("送检_送检日期") = e.DataRow("到货_第一批_日期") ndr.Move(0) Else ndr1("到货数量") = e.DataRow("到货数量") End If End If End Select
|