刷新代码如下,第二句出错,应该和后面的代码没关系。Load出错后,保存也会出错,同样的错误提示。打开软件第一次刷新时是没有错误提示的,第二次就会出错
DataTables("Shippingforecast").LoadFilter = "[closed] = False "
DataTables("Shippingforecast").Load()
Dim a As Date = Date.today.AddMonths(-1)
Dim b As Date = DataTables("Shippingforecast").Compute("Max(DeliveryDate)","Closed = False")
Dim c As Date = a
If DataTables("Shippingforecast").DataCols.Contains("往期_后期") = False Then
DataTables("Shippingforecast").DataCols.Add("往期_后期", Gettype(Double))
End If
a = a.Year & "-" & a.Month & "-01"
Dim Coldd As String = "|往期_后期|60"
Do
Dim nm As String =a.Year & "年_" & a.Month & "月"
If DataTables("Shippingforecast").DataCols.Contains(nm) = False Then
DataTables("Shippingforecast").DataCols.Add(nm, Gettype(Double))
End If
Coldd = Coldd &"|"& nm &"|60"
a = a.AddMonths(1)
If a > b Then
Exit Do
End If
Loop
Tables("Shippingforecast").Sort = "DeliveryDate ASC"
For Each v As Row In Tables("Shippingforecast")
Dim r As DataRow = DataTables("Shippingforecast").Find("_identify = " & v("_identify"))
For Each dc As DataCol In DataTables("Shippingforecast").DataCols
If dc.Name.Contains("_") Then
r(dc.Name) = Nothing
End If
Next
Dim qj As String = v("期间")
Dim qj1 As String =Left(qj,5) & "_" & qj.Replace(Left(qj,5) ,"")
Dim qj2 As String
If Tables(e.form.name & "_Table1").Cols.Contains(qj1) = True Then
r(qj1) = v("Amount")
qj2 = qj1
Else
r("往期_后期") = v("Amount")
qj2 = "往期_后期"
End If
Dim alrs As List(Of DataRow) = DataTables("Shippingal").Select("OrderNo = '"& v("OrderNo") &"'")
For Each alr As DataRow In alrs
Dim aqj As String =alr("期间")
If aqj.Length > 6 Then
Dim aqj1 As String =Left(aqj,5) & "_" & aqj.Replace(Left(aqj,5) ,"")
If Tables(e.form.name & "_Table1").Cols.Contains(aqj1) = True Then
r(aqj1) = alr("金额")
r(qj2) = r(qj2) - alr("金额")
Else
r(qj2) = r(qj2) - alr("金额")
r("往期_后期") = r("往期_后期") + alr("金额")
End If
End If
Next
Next
c = c.Year & "-" & c.Month & "-01"
Do
Dim nm As String =c.Year & "年_" & c.Month & "月"
Tables(e.form.name & "_Table1").Cols(nm).GrandTotal = True
c = c.AddMonths(1)
If c > b Then
Exit Do
End If
Loop
Tables(e.form.name & "_Table1").Cols("Amount").GrandTotal = True
Tables(e.form.name & "_Table1").Cols("QTY").GrandTotal = True
Tables(e.form.name & "_Table1").Cols("待出库").GrandTotal = True
Tables(e.form.name & "_Table1").Cols("往期_后期").GrandTotal = True
Tables(e.form.name & "_Table1").GrandTotal = True
Tables(e.form.name & "_Table1").Cols.Frozen = 8
Tables(e.Form.name & "_Table1").SetColVisibleWidth("OrderNo|112|ProductLine|49|OrderDate|73|DeliveryDate|70|QTY|44|Amount|75|Important|40|Status|122|Remark|215|NewDeliveryDate|76|StatusDate|85|R|31|期间|79|待出库|47" & Coldd & "|Customer|189|OrderRemark|228")
'Tables(e.form.name & "_Table1").AutoSizeCols