日期:2014-05-17  浏览次数:20966 次

net 或sql
需要进行任务的分配 
 如 有任务量 string formid="123456,654789,4569,87954,65446"; //任务的id
   人员 string agetid="123,456,789,741,852"; //坐席的工号
   还有一个是分配的量, 
   int num   这个是自己输入的
     如果输入 是 2   任务的量有五个  5%2=1 余数去掉, 只去整,就将任务分给前两个坐席 “123”和“456”这两个每人两个任务  如果输入为5 则是每一个人一个任务 net c# 和sql  都行, sql可以以存储过程形式
希望大家帮忙,有用信息,给全分。
   
sql c# 分配

------解决方案--------------------

class Program
    {
        static void Main(string[] args)
        {
            string formid = "123456,654789,4569,87954,65446";
            string agetid = "123,456,789,741,852";
            int task_nums = Regex.Matches(formid, ",").OfType<Match>().Count() + 1;
            int aget_nums = Regex.Matches(agetid, ",").OfType<Match>().Count() + 1;
            Console.WriteLine("请输入任务量");
            int task_auto = Convert.ToInt32(Console.ReadLine());
            int peo = GetPer(task_nums, aget_nums, task_auto);
            agetid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Take(peo).ToList().ForEach(x => Console.WriteLine(x));
            Console.Read();
        }

        static int GetPer(int task_nums, int aget_nums, int task_auto)
        {
            int res = 0;
            for (int i = 0; i < aget_nums; i++)
            {
                if ((i + 1) * task_auto <= task_nums)
                {
                    res++;
                }
                else
                {
                    break;
        &