예제 #1
0
파일: OutputWord.cs 프로젝트: onejune/DFS
    // 重新运行失败的任务
    private void ReRunFailedWork()
    {
        Log.RecordLog("重新运行失败的任务.......................");
        int i = 0;
        List<Thread> startedThreadList = new List<Thread>();
        string typeName = "";
        int sumDevice = 0;
        if(groupName.Equals("隶属"))
        {
            if(localProvinceNames.ContainsKey(typeName))
            {
                sumDevice = localProvinceNames[typeName];
            }
            else
            {
                sumDevice = centralDepartmentNames[typeName];
            }
        }
        else
        {
            sumDevice = allTypeNames[typeName];
        }

        for (i = 0; i < SharedData.failedWorkList.Count; i++)
        {
            typeName = SharedData.failedWorkList[i];
            string statisticsString = GetStatisticString(typeName);
            WordGeneration work = new WordGeneration(typeName, sumDevice, displayedColumns, groupName, statisticsString, columnsWidth, fromValue, toValue);
            Thread th = new Thread(new ThreadStart(work.GeneratePages));
            if (groupName.Equals("隶属"))
            {
                work.SetExtraSQL(strSql);
                work.SetOrgNamesSQL(sqlForOrgNames);
            }
            th.Name = "thread-" + typeName;
            th.Start();
            startedThreadList.Add(th);
        }
        foreach (var v in startedThreadList)
        {
            v.Join();
        }
    }
예제 #2
0
파일: OutputWord.cs 프로젝트: onejune/DFS
    private void RunThreadToCreatePages(Dictionary<string, int> typeNames)
    {
        string displayedColumnString = getDisplayedColumnString();
        List<Thread> unStartedThreadList = new List<Thread>();
        List<Thread> startedThreadList = new List<Thread>();
        int i = 0;

        //每个分类建立一个线程
        foreach (KeyValuePair<string, int> p in typeNames)
        {
            //debug
            if (!p.Key.Equals("上海市"))
            {
                continue;
            }

            i++;
            string statisticsString = GetStatisticString(p.Key);
            WordGeneration work = new WordGeneration(p.Key, p.Value, displayedColumns, groupName, statisticsString, columnsWidth, fromValue, toValue);
            if (groupName.Equals("隶属"))
            {
                work.SetExtraSQL(strSql);
                work.SetOrgNamesSQL(sqlForOrgNames);
            }
            Thread th = new Thread(new ThreadStart(work.GeneratePages));
            th.Name = "thread-" + p.Key;

            th.Start();
            startedThreadList.Add(th);
        }
        foreach (var v in startedThreadList)
        {
            v.Join();
        }

        // 重新运行失败的任务
        if (SharedData.failedWorkList.Count > 0)
        {
            //重新运行失败的任务
            ReRunFailedWork();
        }
    }