代码修正为如下:
能够实现信息拆分发送了 但是发送的顺序不能控制 导致信息不会按照原来的排版顺序 依次发送 出现了倒序发送
麻烦老师多多指导一下,让拆分后的内容也能够按照正序发送
第二:如下代码是否还可以简化,感觉太繁琐!
Dim lsts As New List(Of String)
lsts= DataTables("告知内容").SQLGetValues("姓名" ,"操作单位='" & _usergroup & "' And ( 是否告知 is null or 是否告知<> '是')")
For Each lst As String In lsts
Dim dr21 As DataRow = DataTables("告知内容").sqlfind("姓名 = '" & lst & "'and 操作单位='" & _usergroup & "' " )
If dr21 IsNot Nothing Then '如果不存在同编号的订单
If dr21("手机号码") IsNot Nothing Then
Dim ab As DataRow = DataTables("参数表").sqlFind("使用单位 = '" & _usergroup & "'")
Dim drs1 = DataTables("告知内容").sqlSelect("姓名 = '" & lst & "' and 操作单位='" & _usergroup & "' And ( 是否告知 is null or 是否告知<> '是')")
For Each dr1 As DataRow In drs1
If dr1("告知内容") <>"" Then
Dim t As Date= Date.Now
Dim t1 As String =Format(Date.Now, "yyyMMddHHmmss")
Dim Val As String = Rand.Next(1000) '
Dim s As String = val.PadLeft(4, "0")
Dim password As String= ab("移动平台密码") '接入密码
Dim t2 As String = password & t1 & s
Dim account As String = ab("移动平台账号") '接入账号
Dim serviceCode As String = ab("移动平台接入号") '接入号
Dim authCode As String = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(t2, "MD5")
Dim reqNo As String = t1 & s
Dim msisdn As String =dr1("手机号码")
Dim sem As String =dr1("告知内容")
Do While sem.Length > 500
Dim s1 As String = sem.SubString(0,500)
sem = sem.SubString(500)
Output.Show(s1) '改为发送的代码'
Dim content1 As String =Functions.Execute("utf8",s1)
Dim hc1 As New HttpClient("http://218.201.202.174:8900/smstemp/http/sendSms?account="&account.Trim()&"&reqNo="&reqNo.Trim()&"&authCode="&authCode.Trim()&"&serviceCode="&serviceCode.Trim()&"&msisdn="&msisdn.Trim()&"&c&msgType=0")
Dim ret1 As String = hc1.GetData()
Dim Tel1 As String = ret1
Dim Parts1() As String = Tel1.Split("=")
Dim Tel11 As String = Parts1(1)
Dim Parts11() As String = Tel11.Split(",")
'MessageBox.Show(parts1(0))
If parts11(0)=0 Then
'MessageBox.Show(parts1(0))
dr1("是否告知")="是"
dr1("状态码")=parts11(0)
Else
'MessageBox.Show(parts1(0))
dr1("是否告知")="否"
dr1("状态码")=parts11(0)
End If
dr1.Save
Loop
Output.Show(sem) '改为发送的代码'
Dim content As String =Functions.Execute("utf8",sem)
Dim hc As New HttpClient("http://218.201.202.174:8900/smstemp/http/sendSms?account="&account.Trim()&"&reqNo="&reqNo.Trim()&"&authCode="&authCode.Trim()&"&serviceCode="&serviceCode.Trim()&"&msisdn="&msisdn.Trim()&"&c&msgType=0")
Dim ret As String = hc.GetData()
Dim Tel As String = ret
Dim Parts() As String = Tel.Split("=")
Dim Tel2 As String = Parts(1)
Dim Parts2() As String = Tel2.Split(",")
'MessageBox.Show(parts1(0))
If parts2(0)=0 Then
'MessageBox.Show(parts1(0))
dr1("是否告知")="是"
dr1("状态码")=parts2(0)
Else
'MessageBox.Show(parts1(0))
dr1("是否告知")="否"
dr1("状态码")=parts2(0)
End If
dr1.Save
End If
Next
End If
End If
Next