以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 分隔符显示 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=96063) |
-- 作者:huhu -- 发布时间:2017/2/12 12:02:00 -- 分隔符显示 Dim drs As List(of DataRow) = DataTables("销售出库单列表").Select("邮箱 is null and 业务员 is not null") For Each dr As DataRow In drs dr("邮箱") = GetPy(dr("业务员")).Replace(" ","") & "@bdcom.com.cn" Dim d2 As new ClassLibrary2.Class2() Dim Multi As String =d2.getInvoiceInfoByONo(dr("出库单号")) If Multi.Length = 0 Then dr("发货要求") = "请采用老的发货方式" dr.save Else Dim data As object Dim JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}" Dim ScriptControl = CreateObject("MSScriptControl.ScriptControl") With ScriptControl .Language = "Javascript" .Timeout = -1 .AddCode(JscriptCode) data = .Run("toObject", Multi) End With For Each level2 As object In data.BDinvoiceBody For Each level4 As object In level2.iall.workInfos dr("发货要求") &= level4.whpiDl.workNo_level4.whpiDl.workLineNo_level4.whpiDl.permitCount & "|" dr.save Next Next End If Next 现在dr("发货要求")最后一个字符肯有"|",不希望最后有"|"。 效果就是想去掉最后一个那个字符"|" A_B_C|A1_B1_C1|A2_B2_C2-------这是想要的。不是A_B_C|A1_B1_C1|A2_B2_C2|
|
-- 作者:有点色 -- 发布时间:2017/2/12 12:16:00 -- 参考
http://www.foxtable.com/webhelp/scr/0231.htm
|
-- 作者:huhu -- 发布时间:2017/2/12 14:45:00 -- 有发货单号和发货要求2列 发货要求的值为:201701_10_10|201702_01_11|201702_02_12 If e.Col.name = "发货单号" Then e.Cancel = True Dim str As String = e.Row("发货要求") Dim gdh,gdhh As String Dim sum As Integer Dim gdsl() As String = str.Split("|") For Index As Integer = 0 To gdsl.Length - 1 Dim gds() As String = gdsl(Index).Split("_") For Index1 As Integer = 0 To gds.Length -1 msgbox(gds(index1))------能正确取出各个值gds(index1),问题是我想把取出来的值存起来,这个怎么弄? Next Next end if |
-- 作者:有点色 -- 发布时间:2017/2/12 15:39:00 -- 你要赋值的列,不是固定的吗?你可以弄一个数组嘛
Dim cs() As String = {"A", "B", "C"}
或者你可以用0、1、2、3那样取出。
|
-- 作者:huhu -- 发布时间:2017/2/13 15:35:00 -- If e.Col.name = "发货单号" Then e.Cancel = True Dim str As String = e.Row("发货要求") If str = "请采用老的发货方式" Then Return Else Dim gdh,gdhh As String Dim msg As String = "" Dim gdsl() As String = str.Split("|") For Index As Integer = 0 To gdsl.Length - 1 Dim gds() As String = gdsl(Index).Split("_") For Index1 As Integer = 0 To gds.Length -1 Dim sum As Integer = DataTables("库位数量统计").SQLCompute("Sum(数量)","物料编码 = \'" & e.Row("存货编码") & "\' and 生产订单号码 = \'" & gds(0) & "\' and 工单行号 = \'" & gds(1) & "\'") If sum < gds(2) Then msg &= "工单号:" & gds(0) & "工单行号:" & gds(1) & "需要发货:" & gds(2) & "库存可用数量:" & sum & "不满足出库条件" & vbcrlf End If Next Next If msg > "" Then MessageBox.show(msg,"下面工单不满足出库条件",MessageBoxButtons.OK,MessageBoxIcon.Error) Else vars("u8fhdh") = e.Row("发货单号") vars("chbm") = e.Row("存货编码") Vars("xsddh") = e.Row("销售订单号") vars("xsckdph") = "发货单号:" & e.Row("发货单号") & "---" & "物料编码:" & e.Row("存货编码") & "- - -" & "需要配货(" & e.Row("挪货数量") & ")" & e.Row("主计量单位") & "分别为:" & e.Row("发货要求") vars("xsckdck") = "发货单号:" & e.Row("发货单号") & "---" & "物料编码:" & e.Row("存货编码") & "- - -" & "需要出库(" & e.Row("挪货数量") & ")" & e.Row("主计量单位") & "分别为:" & e.Row("发货要求") If e.Row("配货状态") = False Then forms("配货整理").open ElseIf e.Row("配货状态") = True And e.Row("出库状态") = False Then Forms("A-Z出库扫描").open End If End If End If End If 请帮忙看看for 循环怎么改,才能避免对以"_"为分隔符的数组多次循环。不然就出现附件的现象,重复循环显示。
|
-- 作者:有点色 -- 发布时间:2017/2/13 16:00:00 -- 这个循环 For Index1 As Integer = 0 To gds.Length -1
根本就不需要加进来。 |