瀏覽代碼

添加导入数据代码

luocaiyang 4 年之前
父節點
當前提交
df15365c5c

+ 1 - 1
wispro.sp.api/Controllers/AccountController.cs

@@ -88,7 +88,7 @@ namespace wispro.sp.api.Controllers
 
             var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["jwt:Key"]));
             var credential = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
-            var expireTime = DateTime.Now.AddMinutes(2);
+            var expireTime = DateTime.Now.AddMinutes(20);
             
             var token = new JwtSecurityToken(
                 issuer: Configuration["jwt:Issuer"],

+ 1 - 18
wispro.sp.api/Migrations/20211020061916_CalMonth.Designer.cs

@@ -10,7 +10,7 @@ using wispro.sp.api;
 namespace wispro.sp.api.Migrations
 {
     [DbContext(typeof(spDbContext))]
-    [Migration("20211020061916_CalMonth")]
+    [Migration("20211021045210_CalMonth")]
     partial class CalMonth
     {
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -292,9 +292,6 @@ namespace wispro.sp.api.Migrations
                     b.Property<DateTime?>("InternalDate")
                         .HasColumnType("date");
 
-                    b.Property<int>("Month")
-                        .HasColumnType("int");
-
                     b.Property<string>("OverDueMemo")
                         .HasMaxLength(100)
                         .HasColumnType("nvarchar(100)");
@@ -309,15 +306,9 @@ namespace wispro.sp.api.Migrations
                     b.Property<int?>("ReviewerId")
                         .HasColumnType("int");
 
-                    b.Property<int?>("StaffId")
-                        .HasColumnType("int");
-
                     b.Property<int?>("Status")
                         .HasColumnType("int");
 
-                    b.Property<int>("Year")
-                        .HasColumnType("int");
-
                     b.HasKey("Id");
 
                     b.HasIndex("CalMonthId");
@@ -328,8 +319,6 @@ namespace wispro.sp.api.Migrations
 
                     b.HasIndex("ReviewerId");
 
-                    b.HasIndex("StaffId");
-
                     b.ToTable("PerformanceItem");
                 });
 
@@ -793,10 +782,6 @@ namespace wispro.sp.api.Migrations
                         .HasForeignKey("ReviewerId")
                         .HasConstraintName("FK_PerformanceItem_Reviewer");
 
-                    b.HasOne("wispro.sp.entity.Staff", null)
-                        .WithMany("PerformanceItems")
-                        .HasForeignKey("StaffId");
-
                     b.Navigation("CalMonth");
 
                     b.Navigation("Customer");
@@ -864,8 +849,6 @@ namespace wispro.sp.api.Migrations
 
                     b.Navigation("ItemStaffs");
 
-                    b.Navigation("PerformanceItems");
-
                     b.Navigation("ReviewerItems");
                 });
 

+ 1 - 15
wispro.sp.api/Migrations/20211020061916_CalMonth.cs

@@ -173,8 +173,6 @@ namespace wispro.sp.api.Migrations
                 {
                     Id = table.Column<int>(type: "int", nullable: false)
                         .Annotation("SqlServer:Identity", "1, 1"),
-                    Year = table.Column<int>(type: "int", nullable: false),
-                    Month = table.Column<int>(type: "int", nullable: false),
                     CaseNo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                     ApplicationType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                     BusinessType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
@@ -203,8 +201,7 @@ namespace wispro.sp.api.Migrations
                     BasePoint = table.Column<decimal>(type: "numeric(18,2)", nullable: true),
                     Status = table.Column<int>(type: "int", nullable: true),
                     CaseMemo = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    CalMonthId = table.Column<int>(type: "int", nullable: false),
-                    StaffId = table.Column<int>(type: "int", nullable: true)
+                    CalMonthId = table.Column<int>(type: "int", nullable: false)
                 },
                 constraints: table =>
                 {
@@ -233,12 +230,6 @@ namespace wispro.sp.api.Migrations
                         principalTable: "Staff",
                         principalColumn: "Id",
                         onDelete: ReferentialAction.Restrict);
-                    table.ForeignKey(
-                        name: "FK_PerformanceItem_Staff_StaffId",
-                        column: x => x.StaffId,
-                        principalTable: "Staff",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Restrict);
                 });
 
             migrationBuilder.CreateTable(
@@ -432,11 +423,6 @@ namespace wispro.sp.api.Migrations
                 column: "ReviewerId");
 
             migrationBuilder.CreateIndex(
-                name: "IX_PerformanceItem_StaffId",
-                table: "PerformanceItem",
-                column: "StaffId");
-
-            migrationBuilder.CreateIndex(
                 name: "IX_Staff_StaffGradeId",
                 table: "Staff",
                 column: "StaffGradeId");

+ 0 - 17
wispro.sp.api/Migrations/spDbContextModelSnapshot.cs

@@ -290,9 +290,6 @@ namespace wispro.sp.api.Migrations
                     b.Property<DateTime?>("InternalDate")
                         .HasColumnType("date");
 
-                    b.Property<int>("Month")
-                        .HasColumnType("int");
-
                     b.Property<string>("OverDueMemo")
                         .HasMaxLength(100)
                         .HasColumnType("nvarchar(100)");
@@ -307,15 +304,9 @@ namespace wispro.sp.api.Migrations
                     b.Property<int?>("ReviewerId")
                         .HasColumnType("int");
 
-                    b.Property<int?>("StaffId")
-                        .HasColumnType("int");
-
                     b.Property<int?>("Status")
                         .HasColumnType("int");
 
-                    b.Property<int>("Year")
-                        .HasColumnType("int");
-
                     b.HasKey("Id");
 
                     b.HasIndex("CalMonthId");
@@ -326,8 +317,6 @@ namespace wispro.sp.api.Migrations
 
                     b.HasIndex("ReviewerId");
 
-                    b.HasIndex("StaffId");
-
                     b.ToTable("PerformanceItem");
                 });
 
@@ -791,10 +780,6 @@ namespace wispro.sp.api.Migrations
                         .HasForeignKey("ReviewerId")
                         .HasConstraintName("FK_PerformanceItem_Reviewer");
 
-                    b.HasOne("wispro.sp.entity.Staff", null)
-                        .WithMany("PerformanceItems")
-                        .HasForeignKey("StaffId");
-
                     b.Navigation("CalMonth");
 
                     b.Navigation("Customer");
@@ -862,8 +847,6 @@ namespace wispro.sp.api.Migrations
 
                     b.Navigation("ItemStaffs");
 
-                    b.Navigation("PerformanceItems");
-
                     b.Navigation("ReviewerItems");
                 });
 

+ 1 - 1
wispro.sp.utility/ExcelHelper.cs

@@ -289,7 +289,7 @@ namespace wispro.sp.utility
             return retDt;
         }
 
-        private void MerageDataTable(DataTable retDt, DataTable dt)
+        public void MerageDataTable(DataTable retDt, DataTable dt)
         {
             int iRow = 0;
             foreach (DataRow row in dt.Rows)

+ 7 - 5
wispro.sp.utility/NPOIExcle.cs

@@ -17,10 +17,11 @@ namespace wispro.sp.utility
         /// 将excel导入到datatable
         /// </summary>
         /// <param name="filePath">excel路径</param>
-        /// <param name="isColumnName">第一行是否是列名</param>
+        /// <param name="isColumnName">是否有列名</param>
+        /// <param name="ColumnNameRow">列名的所在行,0为第一行</param>
         /// <param name="IgnoreZeroHightRow">是否忽略隐藏行</param>
         /// <returns>返回datatable</returns>
-        public static DataTable ExcelToDataTable(string filePath, bool isColumnName,bool IgnoreZeroHightRow = false)
+        public static DataTable ExcelToDataTable(string filePath, bool isColumnName,bool IgnoreZeroHightRow = false,int ColumnNameRow=0)
         {
             DataTable dataTable = null;
             FileStream fs = null;
@@ -51,13 +52,13 @@ namespace wispro.sp.utility
                             int rowCount = sheet.LastRowNum;//总行数
                             if (rowCount > 0)
                             {
-                                IRow firstRow = sheet.GetRow(0);//第一
+                                IRow firstRow = sheet.GetRow(ColumnNameRow);//列头
                                 int cellCount = firstRow.LastCellNum;//列数
 
                                 //构建datatable的列
                                 if (isColumnName)
                                 {
-                                    startRow = 1;//如果第一行是列名,则从第二行开始读取
+                                    startRow = ColumnNameRow+1;//如果有列名,则从第列头行的下一行开始读取
                                     for (int i = firstRow.FirstCellNum; i < cellCount; ++i)
                                     {
                                         cell = firstRow.GetCell(i);
@@ -113,8 +114,9 @@ namespace wispro.sp.utility
                                                     break;
                                                 case CellType.Numeric:
                                                     short format = cell.CellStyle.DataFormat;
+                                                    
                                                     //对时间格式(2015.12.5、2015/12/5、2015-12-5等)的处理
-                                                    if (format == 14 || format == 31 || format == 57 || format == 58 || format == 177 || format == 176)
+                                                    if (DateUtil.IsCellDateFormatted(cell))// || format == 14 || format == 31 || format == 57 || format == 58 || format == 165 || format == 177 || format == 176)
                                                         try
                                                         {
                                                             dataRow[j] = cell.DateCellValue;

+ 339 - 89
wispro.sp.winClient/Form1.cs

@@ -52,133 +52,383 @@ namespace wispro.sp.winClient
             MessageBox.Show("完成点数输入!");
         }
 
+        private string[] InValidDoItem = new string[]
+        {
+            "案件异常-催缴年费",
+            "案件异常-视为放弃取得专利权",
+            "办理登记手续",
+            "办理登记手续-确认客户是否委托",
+            "代理所变更",
+            "绘图",
+            "技术确认",
+            "缴年费",
+            "请求保密审查",
+            "请求费减",
+            "请求实审",
+            "取得申请号",
+            "取得证书",
+            "取得专利权评价报告",
+            "确认官方审查状况",
+            "询问放弃或复审",
+            "知识点总结",
+            "专利权人发明人申请人信息变更",
+            "专利挖掘与布局",
+            "我方文号前缀带J",
+            "开卷",
+            "请求提前公开",
+            "取得国际检索报告",
+            "委外检索",
+            "中止程序",
+            "终止",
+            "案件异常-视为撤回",
+            "进入国家阶段提醒",
+            "请求恢复权利",
+            "请求优先权",
+            "取得【无效宣告请求审查决定】",
+            "撤回",
+            "请求退款",
+            "确认是否委托申请与类型",
+            "专利交易",
+            "专利权评价报告",
+            "专利权人发明人申请人信息变更+代理所变更"
+        };
+
         private async void button3_Click(object sender, EventArgs e)
         {
-            //await NewMethod();
-            await InputPerformanceItem();
+            await NewMethod();
+            await InputPerformanceItem("ExcelFiles\\21.01-21.06 工程师绩效报表-总表.xlsx", true, false, 0);
+
+            CalMonth cal = new CalMonth()
+            {
+                Year = 2021,
+                Month = 9,
+                Status = 0
+            };
+
+            await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--发客户超过一个月未完成案件.xlsx", true,false,1, cal);
+
+            await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--上个月递交完成案件.xlsx", true, false, 1, cal);
+
+            await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--中国一次OA授权表.xlsx", true, false, 1, cal,true);
+
+            MessageBox.Show("导入完成!");
         }
 
-        private async Task InputPerformanceItem()
+        private PerformanceItem Row2Item_1(DataRow row, List<Staff> Staffs, CalMonth calMonth)
         {
-            DataTable dt = NPOIExcel.ExcelToDataTable("ExcelFiles\\21.01-21.06 工程师绩效报表-总表.xlsx", true);
+            PerformanceItem item = new PerformanceItem();
+            item.ApplicationType = row["申请类型"].ToString().Trim();
 
-            List<Staff> Staffs =await GetStaffsAsync();
-
-            foreach(DataRow row in dt.Rows)
+            if(item.ApplicationType != "发明")
             {
-                PerformanceItem item = new PerformanceItem();
-                item.CaseNo = row["我方文号"].ToString().Trim();
-                string strjxyf = row["绩效核算月份"].ToString().Trim();
-                string[] temYFs = strjxyf.Split(new char[] { '.' });
-                item.CalMonth = new CalMonth();
-                item.CalMonth.Year = int.Parse(temYFs[0]);
-                item.CalMonth.Month = int.Parse(temYFs[1]);
-                item.CalMonth.Status = 4;
-
-                item.ApplicationType = row["申请类型"].ToString().Trim();
-                item.BusinessType = row["业务类型"].ToString().Trim();
-                item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
-                item.DoItem = row["处理事项"].ToString().Trim();
-                item.CaseStage = row["案件阶段"].ToString().Trim();
-                item.CaseCoefficient = row["案件系数"].ToString().Trim();
-                item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
-                item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim(),Staffs );
+                return null;
+            }
 
-                string strHandler = row["处理人"].ToString().Trim();
-                string[] temHandlers = strHandler.Split(new char[] { ',' },StringSplitOptions.RemoveEmptyEntries);
-                item.ItemStaffs = new List<ItemStaff>();
+            item.CaseNo = row["我方文号"].ToString().Trim();
 
-                foreach (string name in temHandlers)
+            if (calMonth != null)
+            {
+                item.CalMonth = calMonth;
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("绩效核算月份"))
                 {
-                    ItemStaff itemStaff = new ItemStaff();
-                    int? iTem = GetStaff(name,Staffs);
-                    if ((iTem != null))
-                    {
-                        //itemStaff.Item = item;
-                        itemStaff.DoPersonId = iTem.Value;
-                        item.ItemStaffs.Add(itemStaff);
-                    }
-                    else
-                    {
-                        itemStaff.DoPerson = new Staff() { Name = name,
-                            Account =name,
-                            Password = "12345678",
-                            IsCalPerformsnce = false,
-                            Status = "已离职",
-                            StaffGradeId = 4
-                        };
-                        item.ItemStaffs.Add(itemStaff);
-                    }
+                    string strjxyf = row["绩效核算月份"].ToString().Trim();
+                    string[] temYFs = strjxyf.Split(new char[] { '.' });
+                    item.CalMonth = new CalMonth();
+                    item.CalMonth.Year = int.Parse(temYFs[0]);
+                    item.CalMonth.Month = int.Parse(temYFs[1]);
+                    item.CalMonth.Status = 4;
                 }
-
-                if(item.ItemStaffs.Count == 0)
+                else
                 {
-                    System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
+                    item.CalMonth = new CalMonth();
+                    item.Status = 0;
+                    item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
+                    item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
                 }
+            }
 
-                item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
+            item.ApplicationType = row["申请类型"].ToString().Trim();
+            item.BusinessType = "普通新申请"; // row["业务类型"].ToString().Trim();
+            item.AgentFeedbackMemo = "发明一次OA授权"; //row["备注(填表注意事项)"].ToString().Trim();
+            item.DoItem = "发明一次OA授权"; //row["处理事项"].ToString().Trim();
 
+            string strHandler = "";
+            if (row.Table.Columns.Contains("处理人"))
+            {
+                strHandler = row["处理人"].ToString().Trim();
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("案件处理人"))
+                {
+                    strHandler = row["案件处理人"].ToString().Trim();
+                }
+            }
+            
+            string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+            item.ItemStaffs = new List<ItemStaff>();
 
+            foreach (string name in temHandlers)
+            {
+                ItemStaff itemStaff = new ItemStaff();
+                int? iTem = GetStaff(name, Staffs);
+                if ((iTem != null))
+                {
+                    //itemStaff.Item = item;
+                    itemStaff.DoPersonId = iTem.Value;
+                    item.ItemStaffs.Add(itemStaff);
+                }
+                else
+                {
+                    itemStaff.DoPerson = new Staff()
+                    {
+                        Name = name,
+                        Account = name,
+                        Password = "12345678",
+                        IsCalPerformsnce = false,
+                        Status = "正式员工",
+                        StaffGradeId = 4
+                    };
+                    item.ItemStaffs.Add(itemStaff);
+                }
+            }
 
-                item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
-                item.ApplicationName = row["申请人"].ToString().Trim();
+            if (item.ItemStaffs.Count == 0)
+            {
+                System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
+            }
 
-                DateTime temDate = new DateTime();
-                if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(),out temDate))
+            if (row.Table.Columns.Contains("核稿人"))
+            {
+                item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("案件核稿人"))
                 {
-                    item.FinishedDate = temDate;
+                    item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim(), Staffs);
                 }
+            }
 
+            item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
+            item.ApplicationName = row["申请人"].ToString().Trim();
+            item.CaseName = row["案件名称"].ToString().Trim();
+            
+            //案件备注
+            item.CaseMemo = $"发文日期:{row["发文日期"].ToString().Trim()}\r\n客户文号:{row["客户文号"].ToString().Trim()}\r\n上传日期:{row["上传日期"].ToString().Trim()}\r\n文件描述:{row["文件描述"].ToString().Trim()}";
+
+            return item;
+        }
+
+        private PerformanceItem Row2Item(DataRow row, List<Staff> Staffs,CalMonth calMonth)
+        {
+            PerformanceItem item = new PerformanceItem();
+            item.CaseNo = row["我方文号"].ToString().Trim();
 
-                //定稿日
-                if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
+            if (calMonth != null)
+            {
+                item.CalMonth = calMonth;
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("绩效核算月份"))
                 {
-                    item.FinalizationDate  = temDate;
+                    string strjxyf = row["绩效核算月份"].ToString().Trim();
+                    string[] temYFs = strjxyf.Split(new char[] { '.' });
+                    item.CalMonth = new CalMonth();
+                    item.CalMonth.Year = int.Parse(temYFs[0]);
+                    item.CalMonth.Month = int.Parse(temYFs[1]);
+                    item.CalMonth.Status = 4;
                 }
-                //返稿日
-                if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
+                else
                 {
-                    item.ReturnDate  = temDate;
+                    item.CalMonth = new CalMonth();
+                    item.Status = 0;
+                    item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
+                    item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
                 }
-                //案件类型
-                item.CaseType = row["案件类型"].ToString().Trim();
-
-                //案件状态
-                item.CaseState = row["案件状态"].ToString().Trim();
-                //处理事项备注
-                item.DoItemMemo = row["处理事项备注"].ToString().Trim();
-                //处理状态
-                item.DoItemState = row["处理状态"].ToString().Trim();
-                //案件名称
-                item.CaseName = row["案件名称"].ToString().Trim();
-                //委案日期
-                if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
+            }
+
+            item.ApplicationType = row["申请类型"].ToString().Trim();
+            item.BusinessType = row["业务类型"].ToString().Trim();
+
+            if (row.Table.Columns.Contains("备注(填表注意事项)"))
+                item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
+
+            item.DoItem = row["处理事项"].ToString().Trim();
+            item.CaseStage = row["案件阶段"].ToString().Trim();
+            item.CaseCoefficient = row["案件系数"].ToString().Trim();
+            item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
+            item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim(), Staffs);
+
+            string strHandler = "";
+            if (row.Table.Columns.Contains("处理人"))
+            {
+                strHandler = row["处理人"].ToString().Trim();
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("案件处理人"))
                 {
-                    item.EntrustingDate = temDate;
+                    strHandler = row["案件处理人"].ToString().Trim();
                 }
-                //客户期限
-                if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
+            }
+            string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+            item.ItemStaffs = new List<ItemStaff>();
+
+            foreach (string name in temHandlers)
+            {
+                ItemStaff itemStaff = new ItemStaff();
+                int? iTem = GetStaff(name, Staffs);
+                if ((iTem != null))
                 {
-                    item.CustomerLimitDate = temDate;
+                    //itemStaff.Item = item;
+                    itemStaff.DoPersonId = iTem.Value;
+                    item.ItemStaffs.Add(itemStaff);
                 }
-                //内部期限
-                if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
+                else
                 {
-                    item.InternalDate = temDate;
+                    itemStaff.DoPerson = new Staff()
+                    {
+                        Name = name,
+                        Account = name,
+                        Password = "12345678",
+                        IsCalPerformsnce = false,
+                        Status = "已离职",
+                        StaffGradeId = 4
+                    };
+                    item.ItemStaffs.Add(itemStaff);
                 }
-                //初稿日
-                if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
+            }
+
+            if (item.ItemStaffs.Count == 0)
+            {
+                System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
+            }
+
+            if (row.Table.Columns.Contains("核稿人"))
+            {
+                item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("案件核稿人"))
                 {
-                    item.FirstDraftDate = temDate;
+                    item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim(), Staffs);
                 }
-                //备注(发文严重超期是否属客观原因,若为否,请填写原因)
+            }
+
+
+
+
+            item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
+            item.ApplicationName = row["申请人"].ToString().Trim();
+
+            DateTime temDate = new DateTime();
+            if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
+            {
+                item.FinishedDate = temDate;
+            }
+
+
+            //定稿日
+            if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
+            {
+                item.FinalizationDate = temDate;
+            }
+            //返稿日
+            if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
+            {
+                item.ReturnDate = temDate;
+            }
+            //案件类型
+            item.CaseType = row["案件类型"].ToString().Trim();
+
+            //案件状态
+            item.CaseState = row["案件状态"].ToString().Trim();
+            //处理事项备注
+            item.DoItemMemo = row["处理事项备注"].ToString().Trim();
+            //处理状态
+            item.DoItemState = row["处理状态"].ToString().Trim();
+            //案件名称
+            item.CaseName = row["案件名称"].ToString().Trim();
+            //委案日期
+            if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
+            {
+                item.EntrustingDate = temDate;
+            }
+            //客户期限
+            if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
+            {
+                item.CustomerLimitDate = temDate;
+            }
+            //内部期限
+            if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
+            {
+                item.InternalDate = temDate;
+            }
+            //初稿日
+            if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
+            {
+                item.FirstDraftDate = temDate;
+            }
+
+            //备注(发文严重超期是否属客观原因,若为否,请填写原因)
+            if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
+            {
                 item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
+            }
+            //案件备注
+            item.CaseMemo = row["案件备注"].ToString().Trim();
+
+            return item;
+
+        }
+
+        private async Task InputPerformanceItem(string strExcelFile,bool isColumnName,bool ignorHideRows=false,int ColumnNameRow=0,CalMonth calMonth=null,bool isFirstOAFile=false)
+        {
+            DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName,ignorHideRows,ColumnNameRow);
 
-                //案件备注
-                item.CaseMemo = row["案件备注"].ToString().Trim();
+            #region 删除重复行
+            DataTable temdt = new DataTable();
+            foreach (DataColumn col in dt.Columns)
+            {
 
-                await SavePerformanceItem(item);
+                DataColumn temCol = new DataColumn();
+                temCol.ColumnName = col.ColumnName;
+                temCol.DataType = col.DataType;
+                temCol.Caption = col.Caption;
 
+                temdt.Columns.Add(temCol);
+            }
+            
+            new ExcelHelper().MerageDataTable(temdt, dt);
+            #endregion
+
+            List<Staff> Staffs =await GetStaffsAsync();
+
+            foreach(DataRow row in temdt.Rows)
+            {
+                PerformanceItem item = null;
+                if (isFirstOAFile)
+                {
+                    item = Row2Item_1(row, Staffs, calMonth);
+                }
+                else
+                {
+                    item = Row2Item(row, Staffs, calMonth);
+                }
+
+                if (item != null )
+                {
+                    if (!InValidDoItem.Contains(item.DoItem))
+                    {
+                        await SavePerformanceItem(item);
+                    }
+                }
             }
 
         }

+ 5 - 5
wospro.sp.entity/PerformanceItem.cs

@@ -211,22 +211,22 @@ namespace wispro.sp.entity
                 }
                 else
                 {
-                    if (InternalDate !=null)
+                    if (InternalDate != null)
                     {
                         dt2 = InternalDate.Value;
                     }
                     else
                     {
-                        if (EntrustingDate !=null)
+                        if (EntrustingDate != null)
                         {
                             dt2 = EntrustingDate.Value;
                         }
                     }
                 }
-                
-                if ((dt1 - dt2).TotalDays > 30 )
+
+                if ((dt1 - dt2).TotalDays > 30)
                 {
-                    
+
                     return true;
                 }
                 else

+ 0 - 7
wospro.sp.entity/Staff.cs

@@ -14,7 +14,6 @@ namespace wispro.sp.entity
         {
             Customers = new HashSet<Customer>();
             ItemStaffs = new HashSet<ItemStaff>();
-            PerformanceItems = new HashSet<PerformanceItem>();
         }
 
         
@@ -91,12 +90,6 @@ namespace wispro.sp.entity
         public virtual ICollection<ItemStaff> ItemStaffs { get; set; }
 
 
-        /// <summary>
-        /// 绩效记录
-        /// </summary>
-        [JsonIgnore]
-        public virtual ICollection<PerformanceItem> PerformanceItems { get; set; }
-
         [JsonIgnore]
         /// <summary>
         /// 核稿记录