以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 老师您好,请帮忙修改一段代码,谢谢 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=174731) |
||||
-- 作者:段虎成 -- 发布时间:2022/1/28 14:35:00 -- 老师您好,请帮忙修改一段代码,谢谢 老师您好,请帮忙修改一段代码,谢谢!
|
||||
-- 作者:有点蓝 -- 发布时间:2022/1/28 15:01:00 -- 选择的订单 -- 哪种方式选择的?使用鼠标在表格里拖动选择? |
||||
-- 作者:段虎成 -- 发布时间:2022/1/28 15:07:00 -- 鼠标选中的行 |
||||
-- 作者:有点蓝 -- 发布时间:2022/1/28 15:08:00 -- 遍历选定的行,参考:http://www.foxtable.com/webhelp/topics/1597.htm |
||||
-- 作者:段虎成 -- 发布时间:2022/1/29 14:13:00 -- 一、遍历行代码 With Tables("采购订单管理") 二、采购入库单下推代码 Select Case e.StripItem.Name Case "下推采购入库" \'下推入库单汇总 Dim Cols1() As String = {"日期","订单编号","仓库","供应商","收货地址","收货人","收货电话","是否有返利","供应商编号"} Dim Cols2() As String = {"日期","入库单编号","仓库","供应商","收货地址","收货人","收货人电话","是否有返利","供应商编号"} For Each dr1 As DataRow In DataTables("采购订单管理").Select("") 老师您教我的我还是没搞懂,上面的遍历选定的行代码怎么在这段代码里设置?这里只下推选中的一行。 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("") (当上面的订单下推生成入库单时,同步在【采购订单明细】中查询与【采购订单管理】相同订单号的所有行下推生成入库明细) Dim dr4 As DataRow = DataTables("采购入库明细").AddNew() For i As Integer = 0 To Cols3.Length -1 dr4(Cols4(i)) = dr3(Cols3(i)) Next Next End Select 请老师帮忙改一下上面两个标注颜色部分的代码,谢谢了! |
||||
-- 作者:有点蓝 -- 发布时间:2022/1/29 14:18:00 -- With Tables("采购订单管理") For i as Integer = .TopPosition To .BottomPosition dim dr1 As Row = .rows(i) Dim dr2 As DataRow = DataTables("采购入库管理").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next For Each dr3 As DataRow In DataTables("采购订单明细").Select("订单编号=\'" & dr1(“订单编号”) & "\'") Dim dr4 As DataRow = DataTables("采购入库明细").AddNew() For i As Integer = 0 To Cols3.Length -1 dr4(Cols4(i)) = dr3(Cols3(i)) Next Next End With
|
||||
-- 作者:段虎成 -- 发布时间:2022/1/29 14:43:00 -- 感谢老师! |
||||
-- 作者:段虎成 -- 发布时间:2022/1/29 23:50:00 -- 老师您好,下面的代码,在运行的时候系统就自动退出,请您再帮忙看一下,哪里有问题,谢谢! Select Case e.StripItem.Name Case "下推采购入库" \'下推入库单汇总 Dim Cols1() As String = {"订单编号","仓库","供应商","收货地址","收货人","收货电话","是否有返利","供应商编号"} Dim Cols2() As String = {"入库单编号","仓库","供应商","收货地址","收货人","收货人电话","是否有返利","供应商编号"} With Tables("采购订单管理") For i As Integer = .TopPosition To .BottomPosition Dim dr1 As Row = .rows(i) Dim dr2 As DataRow = DataTables("采购入库管理").AddNew() For i2 As Integer = 0 To Cols1.Length -1 dr2(Cols2(i2)) = dr1(Cols1(i2)) Next \'下推入库单明细 Dim Cols3() As String = {"商品编号","商品类别","商品名称","采购计量单位","数量","单价","金额","订单编号","仓库"} Dim Cols4() As String = {"商品编号","商品类别","商品名称","采购计量单位","数量","单价","金额","入库单编号","仓库"} For Each dr3 As DataRow In DataTables("采购订单明细").Select("订单编号=\'" & dr1("订单编号") & "\'") Dim dr4 As DataRow = DataTables("采购入库明细").AddNew() For i3 As Integer = 0 To Cols3.Length -1 dr4(Cols4(i3)) = dr3(Cols3(i3)) Next Next Next End With End Select
|
||||
-- 作者:有点蓝 -- 发布时间:2022/2/5 11:15:00 -- 应该是表事件有代码,导致死循环了 |
||||
-- 作者:段虎成 -- 发布时间:2022/2/8 11:20:00 -- 谢谢老师 ! |