以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 将多个值组合成字符串赋值 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=127701) |
-- 作者:yetle -- 发布时间:2018/11/20 14:01:00 -- 将多个值组合成字符串赋值 If Forms("下采购订单").opened For Each dr2 As DataRow In DataTables("采购明细表").Select("[采购单号] = \'" & Tables("下采购订单_table1").current("采购单号") & "\'") For Each dr As DataRow In DataTables("采购需求").Select(" [_Identify] = \'" & dr2("行ID") & "\'") dr.Locked = False \'解锁行 dr2("审核") = True If DataTables("采购明细表").Compute("Sum(订料数)", " [行ID] = \'" & dr2("行ID") & "\' and [审核] = \'true\' ") IsNot Nothing Then dr("订料数") = DataTables("采购明细表").Compute("Sum(订料数)", " [行ID] = \'" & dr2("行ID") & "\' and [审核] = \'true\' ") Else dr("订料数")=0 End If dr("采购单号") = dr2("采购单号") 采购明细表产生多个采购单,要将多个采购单号插入到采购需求的采购单号,格式为:(采购单号1,采购单号2……),怎么写? dr.Locked = True \'锁定行 dr2.Locked = True dr.save() Next Next End If
|
-- 作者:有点甜 -- 发布时间:2018/11/20 14:55:00 -- 比如
If Forms("下采购订单").opened |
-- 作者:yetle -- 发布时间:2018/11/21 17:04:00 -- 无法在 System.Int32 和 System.String 上执行“=”操作 检查了一天,确定是黄色代码引起的,但是[行ID] = \'" & dra1("行ID") 两边都是整数, dra("入库数")和cdr("进仓数")是数字,dra("物检入库单号") 和cdr("进仓单号")是字符,真不知道问题在哪 无法在 System.Int32 和 System.String 上执行“=”操作。 If Forms("物检入库").opened For Each dra1 As DataRow In DataTables("物检入库明细表").Select("[进仓单号] = \'" & Tables("物检入库_table1").current("进仓单号") & "\'") For Each dra As DataRow In DataTables("采购需求").Select("[_Identify] = \'" & dra1("行ID") & "\'") dra.Locked = False \'解锁行 Dim drs = DataTables("物检入库明细表").Select("[行ID] = \'" & dra1("行ID") & "\' and [审核] = \'true\'") Dim ids As String = "" Dim dls As Double = 0 For Each cdr As DataRow In drs ids &= cdr("进仓单号") & "," dls += cdr("进仓数") Next dra("入库数")=dls dra("物检入库单号") = ids.trim(",") dra("物检入库日期") = dra1("物检入库日期") dra.Locked = True \'锁定行 dra1.Locked = True dra.save() Next Next End If [此贴子已经被作者于2018/11/21 17:14:40编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/11/21 17:15:00 -- 改成这样
Dim drs = DataTables("物检入库明细表").Select("[行ID] = \'" & val(dra1("行ID")) & "\' and [审核] = \'true\'") |
-- 作者:yetle -- 发布时间:2018/11/21 17:29:00 -- 还是一样啊,同样的代码放在另外一个窗口对采购订单的和采购需求,没有问题 dls += val(cdr("进仓数"))这样写了也不行
[此贴子已经被作者于2018/11/21 17:32:06编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/11/21 17:33:00 -- 以下是引用yetle在2018/11/21 17:29:00的发言:
还是一样啊,同样的代码放在另外一个窗口对采购订单的和采购需求,没有问题
那就修改这个代码
For Each dra1 As DataRow In DataTables("物检入库明细表").Select("[进仓单号] = \'" & val(Tables("物检入库_table1").current("进仓单号")) & "\'")
For Each dra As DataRow In DataTables("采购需求").Select("[_Identify] = \'" & val(dra1("行ID")) & "\'")
|
-- 作者:yetle -- 发布时间:2018/11/21 17:37:00 -- 还是有这个提示!都快崩溃了。 下面是我在另外个窗口的代码,都一样,除了字段改了改了,测试是没有问题的 For Each dr2 As DataRow In DataTables("到货物检明细").Select("[到货单据号] = \'" & Tables("到货物检_table1").current("到货单据号") & "\'") For Each dr As DataRow In DataTables("采购需求").Select("[_Identify] = \'" & dr2("行ID") & "\'") dr.Locked = False \'解锁行 dr2("审核") = True Dim drs = DataTables("到货物检明细").Select("[行ID] = \'" & dr2("行ID") & "\' and [审核] = \'true\'") Dim ids As String = "" Dim dls As Double = 0 For Each cdr As DataRow In drs ids &= cdr("到货单据号") & "," dls += cdr("到货信息_到货数") Next dr("到货数")=dls dr("到货物检单号") = ids.trim(",") dr2("到货信息_可入库数") = dr("到货数") - dr("入库数") dr("到货日期") = dr2("到货日期") dr.Locked = True \'锁定行 dr2.Locked = True dr.save() Next Next [此贴子已经被作者于2018/11/21 17:44:14编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/11/21 17:50:00 -- 1、贴出你最后写好的代码;
2、加上systemready试试;
http://www.foxtable.com/webhelp/scr/2218.htm
3、不会做实例发上来测试。肯定是你其余的代码有问题导致的 |
-- 作者:yetle -- 发布时间:2018/11/22 8:56:00 -- For Each dra1 As DataRow In DataTables("物检入库明细表").Select("[进仓单号] = \'" & val(Tables("物检入库_table1").current("进仓单号")) & "\'") For Each dra As DataRow In DataTables("采购需求").Select("[_Identify] = \'" & val(dra1("行ID")) & "\'") dra.Locked = False \'解锁行 Dim drs = DataTables("物检入库明细表").Select("[行ID] = \'" & val(dra1("行ID")) & "\' and [审核] = \'true\'") Dim ids As String = "" Dim dls As Double = 0 For Each cdr As DataRow In drs ids &= cdr("进仓单号") & "," dls += val(cdr("进仓数")) Next dra("入库数")=dls dra("物检入库单号") = ids.trim(",") dra("物检入库日期") = dra1("物检入库日期") dra.Locked = True \'锁定行 dra1.Locked = True dra.save() Next Next [此贴子已经被作者于2018/11/22 8:56:38编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/11/22 9:02:00 -- 那试试加上systemready
SystemReady = false
\'本来代码
SystemReady = true |