以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  如何实现有条件的批量操作?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=137838)

--  作者:lgz518
--  发布时间:2019/7/17 0:13:00
--  如何实现有条件的批量操作?
1.如何实现自动生成其他记录,如关联表,当前采购主表和明细表登记,经审批后自动生成入库登记(也是关联表,主表和明细表
)记录?
2.窗体上放一个按键"把查询到数据“批量导入其他;如:按审核状态进行查询后,将查询已审核的记录(关联表”采购主表和明细表“)批量导入(关联表”入库主表和明细表“),”入库主表的入库单号和入库日期是入库主表自动成生,不是复制,导入。谢谢,请指教

--  作者:有点蓝
--  发布时间:2019/7/17 8:43:00
--  
参考:http://www.foxtable.com/webhelp/topics/1533.htm
--  作者:lgz518
--  发布时间:2019/7/17 14:10:00
--  
1.用下面代 码,关联表,主表可执行,但明细表执行不了:

Dim Cols1() As String = {"客户名称"}
Dim Cols2() As String = {"客户名称"}
For Each dr1 As DataRow In DataTables("销售主表").Select("[审核] = 1")
    Dim dr2 As DataRow = DataTables("销售退货主表").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next

Dim Cols3() As String = {"产品编号","品名","规格","型号","单位","售价","数量"}
Dim Cols4() As String = {"产品编号","品名","规格","型号","单位","单价","数量"}
For Each dr3 As DataRow In DataTables("销售单").Select("[审核状态] = 1")
    Dim dr4 As DataRow = DataTables("退货单").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr4(Cols4(i)) = dr3(Cols3(i))
    Next
Next




--  作者:lgz518
--  发布时间:2019/7/17 14:19:00
--  
 2.另一个问题,For Each dr3 As DataRow In DataTables("销售单").Select("[审核状态] = 1"),Select("[审核状态] = 1")改为Select("[订单进度] = 已审核"),提示找不到;
3.批量导入后,销售主表和明细表的“订单进度”自动赋值“已退货”;
4.如果导入当前关联表,销售主表和明细表,怎么写?

请老师,指教,谢 谢

--  作者:有点蓝
--  发布时间:2019/7/17 14:45:00
--  
1、代码没有问题,上传实例说明
2、Select("[订单进度] = \'已审核\'") \'条件表达式里面的字符要用单引号引起来
3、导入的同时赋值不就行了
For Each dr1 As DataRow In DataTables("销售主表").Select("[审核] = 1")
    Dim dr2 As DataRow = DataTables("销售退货主表").AddNew()
    dr2("订单进度") = xxxx
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next

4、例如

For Each dr1 As DataRow In DataTables("销售主表").Select("[审核] = 1")
    Dim dr2 As Row = Tables("主表.子表").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next