以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 代码调整 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=177397) |
-- 作者:nuoyan89 -- 发布时间:2022/5/20 9:27:00 -- 代码调整 老师,我想把代码一改成代码二那种格式,线别不知道怎么改合适,请帮忙看看,谢谢! 代码一 With DataTables("加工不良审核_不良明细") Dim filter = "[异常类型] = \'加工不良\' and [线长处理] Is Null" Dim str = "" For Each s As String In _UserGroup.split(",") str &= " or [线别] = \'" & s & "\'" Next filter &= " and (" & str.Substring(3) & ")" .LoadFilter = filter .LoadTop = 1000 .LoadPage = 0 .Load() End With 代码二: Case "管理工时批准" r.Group = "工时业务处理" Dim cnt As Integer = DataTables("管理层杂工总表").SQLCompute("Count(审核状态)","需审核人 = \'" & _UserName & "\' and 审核状态 = \'待审核\'") If cnt > 0 Then fl = Functions.Execute("addimage",fl,cnt) End If |
-- 作者:有点蓝 -- 发布时间:2022/5/20 9:35:00 -- 没看懂。这2段代码有什么关系? |
-- 作者:nuoyan89 -- 发布时间:2022/5/20 9:40:00 -- 我想把代码一的代码放到代码二红色字体的那个位置,可以怎么改呢,谢谢 代码一: Dim str = "" For Each s As String In _UserGroup.split(",") str &= " or [线别] = \'" & s & "\'" Next filter &= " and (" & str.Substring(3) & ")" 代码二: Case "不良品处理" r.Group = "生产过程处理" Dim cnt As Integer = DataTables("过程异常明细").SQLCompute("Count(线别)","[生产批次] like \'22%\' And [异常类型] = \'加工不良\' And [线长处理] Is Null And \'," & _UserGroup & ",\' like \'%生产部%\'") If cnt > 0 Then fl = Functions.Execute("addimage",fl,cnt) End If |
-- 作者:有点蓝 -- 发布时间:2022/5/20 9:45:00 -- 还是没看懂,是要判断[线别]?还是判断用户组? Dim cnt As Integer = DataTables("过程异常明细").SQLCompute("Count(线别)","[生产批次] like \'22%\' And [异常类型] = \'加工不良\' And [线长处理] Is Null And \'," & _UserGroup & ",\' like \'%,生产部,%\'")
|
-- 作者:nuoyan89 -- 发布时间:2022/5/20 9:52:00 -- 是这样的,我有一列列名为线别的列,我想让里面的数据根据我登录人员的用户组分类自动在线别中显示我要的明细。比如:我的过程异常明细这个表中,线别列里有机加A线,机加C线、装配线等,登录名张三的用户组中包含有机加A线、机加C线,那过程明细表中只需要显示机加A线、机加C线,装配线的不需要显示。 |
-- 作者:有点蓝 -- 发布时间:2022/5/20 9:58:00 -- Dim cnt As Integer = DataTables("过程异常明细").SQLCompute("Count(线别)","[生产批次] like \'22%\' And [异常类型] = \'加工不良\' And [线长处理] Is Null And \'," & _UserGroup & ",\' like \'%,\' + [线别] + \',%\'") |