以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]for next代码执行问题【已解决】  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=116738)

--  作者:浙江仔
--  发布时间:2018/3/30 10:52:00
--  [求助]for next代码执行问题【已解决】
如下代码,为什么红色代码不执行?(前提是fdr 有)

Dim fileid  As String=args(0) \'fileid
Dim s4 As String=args(1) \'备注
Dim urls As String=args(2) \'网址
Dim fdr As DataRow= DataTables("C_PYH_WorkFile_DTL").SQLFind("Work_id=\'"& fileid &"\' and is_active=\'1\' ")
If fdr IsNot Nothing Then
‘这里能执行

    ‘msgbox("执行成功")
    For Each dr As DataRow In DataTables("S_PYH_WCHACT_INFO").SQLSelect("IS_ACTIVE=\'1\' and enterprise_id > \'\' ")
        If Functions.Execute("getProdCodeByid",dr("enterprise_id")) .contains(fdr("attach_pcode"))   Then
            Dim xdr As DataRow=DataTables("C_PYH_WORK_Process").SQLFind("WORK_id =\'"& fileid &"\' and dept_id= \'"& dr("enterprise_id") &"\' And WORK_STATUS=\'完成\' and IS_ACTIVE=\'1\'  ")
            If xdr Is Nothing Then
                
                \'加入发送队列
                Dim r As DataRow =DataTables("Wechat_TM_Send_List").SQLAddNew()
                r("WCHAT_ID")=dr("WCHAT_ID")
                r("fileid")=fileid
                r("remarks")=s4
                r("urls")=urls
                r("state")=1
                r.save()
                \'立即发送
                \'   Functions.Execute("TemplateMessage_send_File",dr("WCHAT_ID"),fileid,s4,urls)
            End If
        End If
    Next
’这里不执行!
   MyTimers("微信模板消息").Enabled = True
   Functions.Execute("TemplateMessage_send_File","otmQFs6MaQBpfCrkihqi_XMw4V4s",fileid,s4,urls)  \'这是发送到我自己手机的,测试用的
   ’msgbox("执行成功")
End If



[此贴子已经被作者于2018/3/30 11:16:39编辑过]

--  作者:有点甜
--  发布时间:2018/3/30 10:54:00
--  
你定时执行的代码,应该写在计划管理那里。你写在外面,根本就没效果。
--  作者:浙江仔
--  发布时间:2018/3/30 10:57:00
--  
一楼的代码是将要发送的消息,生成在待发送表中,然后启动计划任务
通过这个启动
MyTimers("微信模板消息").Enabled = True

--  作者:有点甜
--  发布时间:2018/3/30 10:59:00
--  
那在计划管理那里,编写代码,从表中读取数据所有,然后发送。
--  作者:浙江仔
--  发布时间:2018/3/30 11:16:00
--  
原来我这个代码有问题,导致代码未执行完成

 Functions.Execute("getProdCodeByid",dr("enterprise_id")) .contains(fdr("attach_pcode"))