以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 错误在哪 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=80264) |
-- 作者:shiliang -- 发布时间:2016/1/19 16:15:00 -- 错误在哪 把入库单复制到库存表的代码,错误在哪?谢谢!! Select Case e.DataCol.Name Case "入库单号","物料代码" Dim rkdhs As List (of DataRow) rkdhs = DataTables("库存材料表").Select("[入库单号] = \'" & e.NewValue & "\' And [物料代码] = \'" & e.NewValue & "\'") For Each rkdh As DataRow In rkdhs If rkdhs Is Nothing Then If e.DataRow("记账") = True Then Dim nma() As String = {"仓库代码","仓库名称","入库日期","物料代码","物料名称","规格型号","常用计量单位","材料单价","入库数量","入库金额","入库单号"} \'A表数据来源列 Dim nmb() As String = {"仓库代码","仓库名称","入库日期","物料代码","物料名称","规格型号","常用计量单位","材料单价","入库数量","入库金额","入库单号"} \'B表数据接收列 Dim dr As DataRow = DataTables("库存材料表").AddNew() For i As Integer = 0 To nma.Length - 1 dr(nmb(i)) = e.DataRow(nma(i)) Next End If End If Next End Select |
-- 作者:大红袍 -- 发布时间:2016/1/19 16:16:00 -- rkdhs = DataTables("库存材料表").Select("[入库单号] = \'" & e.Datarow("入库单号") & "\' And [物料代码] = \'" & e.DataRow("物料代码") & "\'") |
-- 作者:shiliang -- 发布时间:2016/1/19 16:24:00 -- 还是不行,不复制数据 |
-- 作者:大红袍 -- 发布时间:2016/1/19 16:25:00 -- Select Case e.DataCol.Name
Case "入库单号","物料代码"
Dim rkdhs As List (of DataRow)
rkdhs = DataTables("入库单").Select("[入库单号] = \'" & e.Datarow("入库单号") & "\' And [物料代码] = \'" & e.DataRow("物料代码") & "\'")
For Each rkdh As DataRow In rkdhs
If rkdhs Is Nothing Then
If e.DataRow("记账") = True Then
Dim nma() As String = {"仓库代码","仓库名称","入库日期","物料代码","物料名称","规格型号","常用计量单位","材料单价","入库数量","入库金额","入库单号"} \'A表数据来源列
Dim nmb() As String = {"仓库代码","仓库名称","入库日期","物料代码","物料名称","规格型号","常用计量单位","材料单价","入库数量","入库金额","入库单号"} \'B表数据接收列
Dim dr As DataRow = DataTables("库存材料表").AddNew()
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
End If
End If
Next
End Select
|
-- 作者:大红袍 -- 发布时间:2016/1/19 16:26:00 -- 加上msgbox,看是否进入触发了代码。 |
-- 作者:shiliang -- 发布时间:2016/1/19 16:36:00 -- 可以复制,但重复复制,如何加代码禁止重复? |
-- 作者:大红袍 -- 发布时间:2016/1/19 16:50:00 -- Select Case e.DataCol.Name |
-- 作者:shiliang -- 发布时间:2016/1/19 16:53:00 -- 非常感谢!!! |
-- 作者:shiliang -- 发布时间:2016/1/20 8:23:00 -- 不能输入重复物料代码,代码如何修改,谢谢! Select Case e.DataCol.Name Case "物料代码" Dim rkdhs As List (of DataRow) rkdhs = DataTables("材料入库明细表").Select("[入库单号] = \'" & e.DataRow("入库单号") & "\' And [物料代码] = \'" & e.DataRow("物料代码") & "\'") For Each rkdh As DataRow In rkdhs If rkdhs IsNot Nothing Then If rkdh(e.DataRow("物料代码"))= e.DataRow("物料代码") Then msgbox("同一入库单物料代码不能重复") e.Cancel = True End If End If Next End Select |
-- 作者:大红袍 -- 发布时间:2016/1/20 9:35:00 -- DataColChanged
Select Case e.DataCol.Name |