以文本方式查看主题

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

--  作者:zoudezhao
--  发布时间:2017/11/7 10:47:00
--  [求助]平均分配数据并提醒

此主题相关图片如下:qq截图20171107103537.png
按此在新窗口浏览图片

Dim t As Table = Tables("资源分配_Table1")
Dim dic As new Dictionary(Of String, Integer)
For Each r As Row In t.GetCheckedRows
    r("工号") = Forms("资源分配").Controls("CheckedListBox1").SelectedValue
    If Forms("资源分配").Controls("_mtxz").Value = Nothing Then
    Else
        r("媒体") = Forms("资源分配").Controls("_mtxz").Value
    End If
    r("分配日期") = Forms("资源分配").Controls("DateTimePicker1").Value
    r.save
    Dim nm As String =  r("部门") & "." & r("工号")
    If dic.ContainsKey(nm) = False Then
        dic.Add(nm, 1)
    Else
        dic(nm) += 1
    End If
Next
For Each key As String In dic.Keys
    QQClient.SendChatMessage(key, "{!} 已收到" & dic(key) & "条新的客户资源请及时处理!")
Next
Syscmd.Project.Save()
这段代码是图片中确认分配的。效果就如图一样可以批量将数据的工号修改为CheckedListBox1控件中打勾的人。同时给这个人发去OpenQQ的弹窗告诉他接收导XX条新的客户资源。
但是这段代码只能给一个人分配同时只会提醒一个人。如果我想改成CheckedListBox1控件选择多个人时会将Table中勾选中的数据工号列中平均填入CheckedListBox1控件选择的多个人的工号并给这些人发送接收XX条新的客户资源应该怎么做。自己绕的有点晕麻烦各位老师了。。

--  作者:有点甜
--  发布时间:2017/11/7 12:06:00
--  
Dim t As Table = Tables("资源分配_Table1")
Dim dic As new Dictionary(Of String, Integer)
Dim ary() As String = Forms("资源分配").Controls("CheckedListBox1").Value.split(",")
Dim i As Integer = 0
For Each r As Row In t.GetCheckedRows
    r("工号") = ary(i)
    If Forms("资源分配").Controls("_mtxz").Value = Nothing Then
    Else
        r("媒体") = Forms("资源分配").Controls("_mtxz").Value
    End If
    r("分配日期") = Forms("资源分配").Controls("DateTimePicker1").Value
    r.save
    Dim nm As String =  r("部门") & "." & r("工号")
    If dic.ContainsKey(nm) = False Then
        dic.Add(nm, 1)
    Else
        dic(nm) += 1
    End If
    i += 1
    If i = ary.length Then
        i = 0
    End If
Next
For Each key As String In dic.Keys
    QQClient.SendChatMessage(key, "{!} 已收到" & dic(key) & "条新的客户资源请及时处理!")
Next
Syscmd.Project.Save()

--  作者:zoudezhao
--  发布时间:2017/11/7 13:59:00
--  
感谢甜老师,没问题图片点击可在新窗口打开查看