예제 #1
0
        /// <summary>
        /// 导入数据
        /// </summary>
        /// <param name="taskManagerInfoArg"></param>
        public virtual void Do(TaskManagerInfoArg taskManagerInfoArg)
        {
            var processInfo = (FileExcelTaskTypeInfo as IProcessInfo);

            processInfo.SetProcessTotalRow(Dtos.Count);
            ThreadPool.SetMaxThreads(maxThreaderCount, maxThreaderCount);
            foreach (var dto in Dtos)
            {
                try
                {
                    ExcelTask.Do(dto, taskManagerInfoArg);
                }
                catch (MgExcelException mgExcelException)
                {
                    taskManagerInfoArg.AggregateExcelMessage.Add(dto.Row.RowIndex, mgExcelException.ColumnIndex, mgExcelException.Message, "", ExcelMessageType.Exception, FileExcelTaskTypeInfo);
                }
                catch (MgException mgException)
                {
                    taskManagerInfoArg.AggregateExcelMessage.Add(dto.Row.RowIndex, 0, mgException.Message, "", ExcelMessageType.Exception, FileExcelTaskTypeInfo);
                }
                catch (Exception exception)
                {
                    log.Error(exception.Message + "\n" + exception.StackTrace);
                    taskManagerInfoArg.AggregateExcelMessage.Add(dto.Row?.RowIndex, 0, exception.Message, exception.StackTrace, ExcelMessageType.Exception, FileExcelTaskTypeInfo);
                }
                finally
                {
                    processInfo.SetProcessRow();
                }
            }
        }