以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]标记颜色  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=130348)

--  作者:hahahehe21
--  发布时间:2019/1/19 16:45:00
--  [求助]标记颜色
If e.Row("InDate") > Date.Today.AddDays(-30) Then
     Dim dr As DataRow = DataTables("出库记录").find("工单号 = \'" & e.Row("工单号") & "\'")
    If  dr Is Nothing Then
        Dim cnt As Decimal = DataTables("纸张需求").Compute("Sum(用量)", "PaperName = \'" & e.Row("PaperName") & "\'")
        If cnt > e.Row("库存") Then
            e.Style = "缺料"
        End If
    End If
End If

30天内没有出库的工单,在纸张需求表中标记出合计用量大于库存的行。合计用量小于库存的行不用标记。帮看下代码要怎么改?




[此贴子已经被作者于2019/1/19 16:52:10编辑过]

--  作者:有点蓝
--  发布时间:2019/1/19 17:12:00
--  
在drawcell里使用find,Compute这些用法,效率非常低,可能会导致这个项目卡死。

添加一个辅助列,到datacolchanged事件判断,如果30天内没有出库的工单,在纸张需求表中标记出合计用量大于库存的行,把辅助列设置为true

然后drawcell
If e.Row("辅助列") = true Then
     e.Style = "缺料"
End If