红色的代码是我传"出库单号",对方接口给我返回数据。
我想增加超过15s如果还没从对方接口获取数据。那么我就不处理这行dr了,接着处理下一行。
这个超时限制怎么写代码?
Dim drs As List(of DataRow) = DataTables("销售出库单列表").SQLSelect("发货要求 is null")
For Each dr As DataRow In drs
Dim d2 As new ClassLibrary2.Class2()
Dim Multi As String =d2.getInvoiceInfoByONo(dr("出库单号"))
If Multi = "非销售出库单" Or Multi = "非BD订单系统生成的销售发货单" Then
dr("发货要求") = dr("数量")
dr("挪货数量") = dr("数量")
dr("实扫到数量") = 0
dr("比较结果") = dr("实扫到数量") - dr("数量")
dr("U8发货") = True
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
If level2.iall.workInfos.length = 0 Then
dr("发货要求") = dr("数量")
dr.save
Else
For Each level4 As object In level2.iall.workInfos
If level4.whpiDl.workNo = "" And level4.whpiDl.workLineNo = "" Then
dr("发货要求") = dr("数量")
dr.save
Else
Dim str As String
str &= level4.whpiDl.workNo & "_"
str &=level4.whpiDl.workLineNo & "_"
If level2.orderDetail.productNo = dr("存货编码") Then
dr("发货要求") = str & dr("数量")
dr.save
Else
dr("发货要求") = dr("数量")
dr.save
End If
str = ""
End If
Next
End If
Next