以文本方式查看主题

-  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=160482)

--  作者:nuoyan89
--  发布时间:2021/2/4 10:33:00
--  按组别显示

老师,红色字体的检测部门中包含多个组,我想像这样显示,_UserGroup Like "*配刀库*" ,请帮忙看看,谢谢

  With DataTables("来料检测审核_待检处理")
        .LoadFilter = "([检测状态] = \'待处理 \' or [检测状态] = \'驳回\'or [检测状态] = \'转交\' or [检测部门] = \'"& _UserGroup Like "*配刀库*"  & "\' )" \'一定要清除加载条件
        .LoadTop = 500
        .LoadPage = 0
        .Load()
    End With


--  作者:有点蓝
--  发布时间:2021/2/4 10:38:00
--  
.LoadFilter = "([检测状态] = \'待处理 \' or [检测状态] = \'驳回\'or [检测状态] = \'转交\' or  \'" & _UserGroup & "\' Like \'%\'+[检测部门]+\'%\'  & " )"
--  作者:nuoyan89
--  发布时间:2021/2/4 14:06:00
--  

 老师,这个异常请帮忙看看,谢谢!

If _UserGroup Like "*质量部*" Or _UserGroup Like "*配刀库*"  Then
    With DataTables("来料检测审核_待检处理")
        .LoadFilter = "([检测状态] = \'待检测\' or [检测状态] = \'驳回\'or [检测状态] = \'转交\') Or \'" & _UserGroup & "\' Like \'%\'+[检测部门]+\'%\' & "\'" \'一定要清除加载条件
        .LoadTop = 500
        .LoadPage = 0
        .Load()
    End With
Else
    With DataTables("来料检测审核_待检处理")
        .LoadFilter = "([检测状态] = \'待处理 \' or [检测状态] = \'驳回\'or [检测状态] = \'转交\') or [需审核人] = \'" & _UserName & "\'" \'一定要清除加载条件
        .LoadTop = 500
        .LoadPage = 0
        .Load()
    End With
End If


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2021/2/4 14:11:00
--  
.LoadFilter = "[检测状态] = \'待检测\' or [检测状态] = \'驳回\'or [检测状态] = \'转交\' Or \'" & _UserGroup & "\' Like \'%\'+[检测部门]+\'%\' "
--  作者:nuoyan89
--  发布时间:2021/3/10 8:40:00
--  

解决了

[此贴子已经被作者于2021/3/10 8:42:35编辑过]

--  作者:nuoyan89
--  发布时间:2021/3/10 9:43:00
--  

老师,在窗口事件Afterloda 窗口事件中加入了以下代码,出现了如图的提示,请帮忙看看,谢谢!

If _UserGroup Like "*质量部*" Or _UserGroup Like "*配刀库*"  Then
    Dim cnt19 As Integer = DataTables("来料待检明细").SQLCompute("Count(检测状态)","([检测状态] = \'待检测\' or [检测状态] = \'驳回\'or [检测状态] = \'转交\') and \'" & _UserGroup & "\' Like \'%\'+[检测部门]+\'%\'")
    If cnt19 > 0 Then
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核(" & cnt19 & ")"
    Else
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核"
    End If
Else
    Dim cnt19 As Integer = DataTables("来料待检明细").SQLCompute("Count(检测状态)","[需审核人] = \'"& _UserName &"\' And ([检测状态] = \'待检测\' or [检测状态] =  \'驳回\'or [检测状态] =  \'转交\')")
    If cnt19 > 0 Then
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核(" & cnt19 & ")"
    Else
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核"
    End If
End If

 


图片点击可在新窗口打开查看此主题相关图片如下:1.jpg
图片点击可在新窗口打开查看


--  作者:有点蓝
--  发布时间:2021/3/10 9:47:00
--  
上面是afteload完整代码吗?看不出有什么问题
--  作者:nuoyan89
--  发布时间:2021/3/10 9:50:00
--  

老师,完整代码如下:

Dim cnt1 As Integer = DataTables("采购申请明细").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'待审核\'")
If cnt1 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("采购申请业务").Links("采购申请审核").text = "采购申请审核(" & cnt1 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("采购申请业务").Links("采购申请审核").text = "采购申请审核"
End If
Dim cnt5 As Integer = DataTables("采购申请明细").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'驳回\'")
If cnt5 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("采购申请业务").Links("采购申请驳回").text = "采购申请驳回(" & cnt5 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("采购申请业务").Links("采购申请驳回").text = "采购申请驳回"
End If
Dim cnt2 As Integer = DataTables("操作工工时").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'待审核\'")
If cnt2 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("工时业务处理").Links("工时补助审核").text = "工时补助审核(" & cnt2 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("工时业务处理").Links("工时补助审核").text = "工时补助审核"
End If
Dim cnt7 As Integer = DataTables("操作工工时").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'驳回\'")
If cnt7 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("工时业务处理").Links("工时补助驳回").text = "工时补助驳回(" & cnt7 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("工时业务处理").Links("工时补助驳回").text = "工时补助驳回"
End If
Dim cnt3 As Integer = DataTables("管理层杂工总表").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'待审核\'")
If cnt3 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("工时业务处理").Links("管理工时批准").text = "管理工时批准(" & cnt3 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("工时业务处理").Links("管理工时批准").text = "管理工时批准"
End If
Dim cnt4 As Integer = DataTables("异常申请记录").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'待审核\' and 操作类型 = \'修磨处理\'")
If cnt4 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀具修磨审核").text = "刀具修磨审核(" & cnt4 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀具修磨审核").text = "刀具修磨审核"
End If
Dim cnt6 As Integer = DataTables("异常申请记录").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'驳回\'")
If cnt6 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀具过程驳回").text = "刀具过程驳回(" & cnt6 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀具过程驳回").text = "刀具过程驳回"
End If
Dim cnt8 As Integer = DataTables("异常申请记录").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\' and 审核状态 = \'待审核\' and 操作类型 = \'刀盘调试\'")
If cnt8 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀盘调试审核").text = "刀盘调试审核(" & cnt8 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀盘调试审核").text = "刀盘调试审核"
End If
Dim cnt9 As Integer = DataTables("刀具报废明细").SQLCompute("Count(目前状态)","需审核人 = \'"  & _UserName & "\' and ([目前状态] = \'驳回\' or [目前状态] = \'待审核\'or [目前状态] = \'转交\')")
If cnt9 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀具报废审核").text = "刀具报废审核(" & cnt9 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("刀具报废审核").text = "刀具报废审核"
End If
Dim cnt10 As Integer = DataTables("异常申请记录").SQLCompute("Count(审核状态)","需审核人 = \'"  & _UserName & "\'and 审核状态 = \'待审核\' and 操作类型 = \'再利用库\'")
If cnt10 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("再利用库审核").text = "再利用库审核(" & cnt10 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("再利用库审核").text = "再利用库审核"
End If
Dim cnt11 As Integer = DataTables("设备维保记录").SQLCompute("Count(节点状态)","[线别] = \'" & _UserGroup & "\'and [节点状态] = \'维修进行中\'And [计划确认] Is Null")
If cnt11 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("设备管理业务").Links("计划审核确认").text = "计划审核确认(" & cnt11 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("设备管理业务").Links("计划审核确认").text = "计划审核确认"
End If
Dim cnt12 As Integer = DataTables("设备维保记录").SQLCompute("Count(节点状态)","[需审核人] = \'"& _UserName &"\' And ([节点状态] = \'维保总结\' or [节点状态] =  \'维修进行中\'or [节点状态] =  \'待进行维修\')")
If cnt12 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("设备管理业务").Links("设备维修记录").text = "设备维修记录(" & cnt12 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("设备管理业务").Links("设备维修记录").text = "设备维修记录"
End If
Dim cnt13 As Integer = DataTables("设备维保记录").SQLCompute("Count(节点状态)","[线别] in (\'" & _UserGroup.replace(",","\',\'") & "\') and ([节点状态] = \'待设备验收\' or [节点状态] =  \'设备验收中\')")
If cnt13 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("设备管理业务").Links("设备验收操作").text = "设备验收操作(" & cnt13 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("设备管理业务").Links("设备验收操作").text = "设备验收操作"
End If
Dim cnt14 As Integer = DataTables("生产异常停机").SQLCompute("Count(当前状态)","需审核人 = \'"  & _UserName & "\' and 当前状态 = \'待审核\'")
If cnt14 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("生产过程异常").Links("生产异常处理").text = "生产异常处理(" & cnt14 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("生产过程异常").Links("生产异常处理").text = "生产异常处理"
End If
Dim cnt15 As Integer = DataTables("生产异常停机").SQLCompute("Count(当前状态)","需审核人 = \'"  & _UserName & "\' and 当前状态 = \'驳回\'")
If cnt15 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("生产过程异常").Links("生产异常驳回").text = "生产异常驳回(" & cnt15 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("生产过程异常").Links("生产异常驳回").text = "生产异常驳回"
End If
Dim cnt16 As Integer = DataTables("新刀试刀申请").SQLCompute("Count(当前状态)","需审核人 = \'"  & _UserName & "\' and 当前状态 = \'待审核\'")
If cnt16 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("试刀申请处理").text = "试刀申请处理(" & cnt16 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("刀具业务过程").Links("试刀申请处理").text = "试刀申请处理"
End If
Dim cnt17 As Integer = DataTables("联络通知单").SQLCompute("Count(当前状态)","需审核人 = \'"  & _UserName & "\' and 当前状态 = \'驳回\'")
If cnt17 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("通知单据审核").Links("单据明细驳回").text = "单据明细驳回(" & cnt17 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("通知单据审核").Links("单据明细驳回").text = "单据明细驳回"
End If
Dim cnt18 As Integer = DataTables("联络通知单").SQLCompute("Count(当前状态)","需审核人 = \'"  & _UserName & "\' and 当前状态 = \'待审核\'")
If cnt18 > 0 Then
    Forms("导航窗口").Controls("TopicBar1").Pages("通知单据审核").Links("单据明细审核").text = "单据明细审核(" & cnt18 & ")"
Else
    Forms("导航窗口").Controls("TopicBar1").Pages("通知单据审核").Links("单据明细审核").text = "单据明细审核"
End If
If _UserGroup Like "*质量部*" Or _UserGroup Like "*配刀库*"  Then
    Dim cnt19 As Integer = DataTables("来料待检明细").SQLCompute("Count(检测状态)","([检测状态] = \'待检测\' or [检测状态] = \'驳回\'or [检测状态] = \'转交\') and \'" & _UserGroup & "\' Like \'%\'+[检测部门]+\'%\'")
    If cnt19 > 0 Then
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核(" & cnt19 & ")"
    Else
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核"
    End If
Else
    Dim cnt19 As Integer = DataTables("来料待检明细").SQLCompute("Count(检测状态)","[需审核人] = \'"& _UserName &"\' And ([检测状态] = \'待检测\' or [检测状态] =  \'驳回\'or [检测状态] =  \'转交\')")
    If cnt19 > 0 Then
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核(" & cnt19 & ")"
    Else
        Forms("导航窗口").Controls("TopicBar1").Pages("质量检测处理").Links("来料检测审核").text = "来料检测审核"
    End If
End If
If _UserGroup Like "*效率部*" = False  AndAlso _UserGroup Like "*管理员*" = False AndAlso _UserGroup Like "*技术部*" = False   Then
    Dim tab3 As WinForm.TabControl = Forms("导航窗口").Controls("导航")
    tab3.TabPages("产品研发").Visible = False
End If
If _UserGroup Like "*经理*" = False  AndAlso _UserGroup Like "*管理员*" = False AndAlso _UserGroup Like "*财务部*" = False AndAlso _UserGroup Like "*采购部*" = False Then
    Dim tab2 As WinForm.TabControl = Forms("导航窗口").Controls("导航")
    tab2.TabPages("采购业务").Visible = False
End If
If _UserGroup Like "*经理*" = False  AndAlso _UserGroup Like "*管理员*" = False AndAlso _UserGroup Like "*财务部*" = False AndAlso _UserGroup Like "*设备部*" = False Then
    Dim tab2 As WinForm.TabControl = Forms("导航窗口").Controls("导航")
    tab2.TabPages("设备管理").Visible = False
End If
If _UserGroup Like "*经理*" = False  AndAlso _UserGroup Like "*管理员*" = False AndAlso _UserGroup Like "*销售内贸*" = False AndAlso _UserGroup Like "*销售外贸*" = False Then
    Dim tab4 As WinForm.TabControl = Forms("导航窗口").Controls("导航")
    tab4.TabPages("销售业务").Visible = False
End If
If _UserGroup Like "*经理*" = False  AndAlso _UserGroup Like "*管理员*" = False AndAlso _UserGroup Like "*财务部*" = False  Then
    Dim tab As WinForm.TabControl = Forms("导航窗口").Controls("导航")
    tab.TabPages("财务业务").Visible = False
    Dim tab1 As WinForm.TabControl = Forms("导航窗口").Controls("导航")
    tab1.TabPages("系统管理").Visible = False
End If
If _UserGroup Like "*经理*" = False  AndAlso _UserGroup Like "*管理员*" = False AndAlso _UserGroup Like "*质量部*" = False  Then
    Dim tab As WinForm.TabControl = Forms("导航窗口").Controls("导航")
    tab.TabPages("质量管理").Visible = False
End If


--  作者:有点蓝
--  发布时间:2021/3/10 9:53:00
--  
1、备份代码。全部去掉代码,然后一段一段加回来,看是那一段代码出错

2、调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm,看哪一句代码出错

--  作者:nuoyan89
--  发布时间:2021/3/10 10:03:00
--  
试过了,把6楼的代码取消没有任何问题。加上就出现6楼如图的异常。