以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 再谈仓储月结问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=178525) |
-- 作者:13315253800 -- 发布时间:2022/7/8 10:15:00 -- 再谈仓储月结问题 蓝老师您好!请求指导一下,我不知道怎么修改 DataTables("产品月结").DataRows.Clear Dim dt1 As DataTable = DataTables("产品入库") Dim dt2 As DataTable = DataTables("产品出库") Dim str As String = e.Form.Controls("月").Text Dim d As Date = New Date(str.SubString(0, 4), str.SubString(4, 2), 1) \'获取本月的第1天 Dim ls As List(Of String) = dt1.GetValues("产品代码", "月 = \'" & str & "\'") For Each s As String In dt2.GetValues("产品代码", "月 = \'" & str & "\'") If ls.Contains(s) = False Then ls.add(s) End If MessageBox.Show(1) Next For Each s As String In DataTables("产品上月结存").GetValues("产品代码", "月 = \'" & Format(d.AddMonths( - 1), "yyyyMM") & "\'") If ls.Contains(s) = False Then ls.add(s) End If MessageBox.Show(2) Next For Each cl As String In ls Dim dr As DataRow = DataTables("产品月结").AddNew dr("月") = str dr("产品代码") = cl Dim Filter As String = "产品代码 = \'" & cl & "\' And 月 = \'" & str & "\'" Dim dr1 As DataRow = DataTables("产品上月结存").Find("产品代码 = \'" & cl & "\' and 月 = \'" & Format(d.AddMonths( - 1), "yyyyMM") & "\'") \'Dim dr1 As DataRow = DataTables("产品上月结存").Find("产品代码 = \'" & cl & "\' and 月 = \'" & Format(d.AddMonths(0), "yyyyMM") & "\'") If dr1 IsNot Nothing Then dr("上月结存") = dr1("上月结存") MessageBox.Show(3) End If dr("本月入仓") = dt1.Compute("Sum(入仓数量)", Filter) dr("本月出仓") = dt2.Compute("Sum(出仓数量)", Filter) dr("本月结存") = dr("上月结存") + dr("本月入仓") - dr("本月出仓") MessageBox.Show(4) Next MessageBox.Show(5)
出现了:1、2、3、4、3后出现了有如下提示: .NET Framework 版本:4.0.30319.36543 Foxtable 版本:2022.7.3.1 错误所在事件:窗口,产品月结,Button1,Click 详细错误信息: Conversion from string "" to type \'Double\' is not valid. Input string was not in a correct format. |
-- 作者:有点蓝 -- 发布时间:2022/7/8 10:34:00 -- dim a as double = dt1.Compute("Sum(入仓数量)", Filter) dr("本月入仓") = a dim b as double = dt2.Compute("Sum(出仓数量)", Filter) dr("本月出仓") = b |
-- 作者:13315253800 -- 发布时间:2022/7/8 16:45:00 -- 好,谢谢蓝老师!我试试 |