Explorar el Código

从IPEasy系统中获取数据替换成直接SQL获取

luocaiyang hace 3 años
padre
commit
3e019ed5d3

+ 8 - 2
wispro.sp.api/Controllers/IPEasyController.cs

@@ -121,7 +121,9 @@ namespace wispro.sp.api.Controllers
             }
             else
             {
-                dynamic retObj = wispro.sp.utility.IPEasyUtility.GetPerformanceRecord(CaseNo, DoItem);
+                dynamic retObj = new Job.UpdateJXDataFromIPEasyJob().GetItemFromIPEasyDB(new PerformanceItem() { 
+                    CaseNo = CaseNo,DoItem = DoItem
+                },new spDbContext());// wispro.sp.utility.IPEasyUtility.GetPerformanceRecord(CaseNo, DoItem);
                 PerformanceItem Item = new PerformanceItem();
                 Item.CaseName = retObj.CaseName;
                 Item.CaseNo = retObj.CaseNo;
@@ -204,7 +206,11 @@ namespace wispro.sp.api.Controllers
             }
             else
             {
-                dynamic retObj = wispro.sp.utility.IPEasyUtility.GetPerformanceRecord(CaseNo, DoItem,caseStage);
+                dynamic retObj = new Job.UpdateJXDataFromIPEasyJob().GetItemFromIPEasyDB(
+                    new PerformanceItem() { CaseNo =CaseNo,DoItem=DoItem,CaseStage = caseStage},
+                    new spDbContext()
+                 );  //wispro.sp.utility.IPEasyUtility.GetPerformanceRecord(CaseNo, DoItem,caseStage);
+
                 PerformanceItem Item = new PerformanceItem();
                 Item.CaseName = retObj.CaseName;
                 Item.CaseNo = retObj.CaseNo;

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 248 - 210
wispro.sp.api/Controllers/PerformanceItemController.cs


+ 5 - 3
wispro.sp.api/Controllers/StaffController.cs

@@ -371,9 +371,11 @@ namespace wispro.sp.api.Controllers
 
                             DepartmentPosition dp = new DepartmentPosition();
                             dp.departmentId = saveUser.deptId;
-                            dp.PositionId = saveUser.deptId;
+                            dp.PositionId = saveUser.positionId;
                             dp.StaffId = staff.Id;
                             Context.DepartmentPositions.Add(dp);
+
+                            Context.SaveChanges();
                         }
                     }
                     else
@@ -382,7 +384,7 @@ namespace wispro.sp.api.Controllers
 
                         if (editObject != null)
                         {
-                            editObject.Account = staff.Account;
+                            //editObject.Account = staff.Account;
                             editObject.Department = staff.Department;
                             editObject.EntyDate = staff.EntyDate;
                             editObject.IsCalPerformsnce = staff.IsCalPerformsnce;
@@ -391,7 +393,7 @@ namespace wispro.sp.api.Controllers
                             editObject.Memo = staff.Memo;
                             editObject.Mobile = staff.Mobile;
                             editObject.Name = staff.Name;
-                            editObject.Password = utility.MD5Utility.GetMD5(staff.Password); 
+                            //editObject.Password = utility.MD5Utility.GetMD5(staff.Password); 
                             editObject.Sex = staff.Sex;
                             editObject.StaffGradeId = staff.StaffGradeId;
                             editObject.Status = staff.Status;

+ 45 - 0
wispro.sp.api/Controllers/SystemDataController.cs

@@ -0,0 +1,45 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Quartz;
+using wispro.sp.api.Job;
+using wispro.sp.share;
+
+namespace wispro.sp.api.Controllers
+{
+    [Route("api/[controller]/[action]")]
+    [ApiController]
+    [Authorize]
+    public class SystemDataController : ControllerBase
+    {
+        public ApiSaveResponse StartImportData()
+        {
+            System.Threading.Tasks.Task.Run(() => new ImportReportJob().Execute(null));
+            
+            return new ApiSaveResponse()
+            {
+                Success = true
+            };
+        }
+
+        public ApiSaveResponse UpdateJXData()
+        {
+            System.Threading.Tasks.Task.Run(() => new UpdateJXDataFromIPEasyJob().Execute(null));
+            
+            return new ApiSaveResponse()
+            {
+                Success = true
+            };
+        }
+
+        public ApiSaveResponse SendInvaldDataMessage()
+        {
+            System.Threading.Tasks.Task.Run(() => new InvalidDataMessageJob().Execute(null));
+
+            return new ApiSaveResponse()
+            {
+                Success = true
+            };
+        }
+    }
+}

+ 451 - 20
wispro.sp.api/Job/ImportReportJob.cs

@@ -1,4 +1,5 @@
 using DynamicExpresso;
+using Microsoft.Data.SqlClient;
 using Microsoft.Extensions.DependencyInjection;
 using Quartz;
 using System;
@@ -95,20 +96,38 @@ namespace wispro.sp.api.Job
             }
 
             //每月绩效统计--发客户超过一个月未完成案件
-            DownloadReport( "每月绩效统计--发客户超过一个月未完成案件", calMonth,false);
-            
+            DownloadReport_SQL("每月绩效统计--发客户超过一个月未完成案件", calMonth, false);
+            //DownloadReport( "每月绩效统计--发客户超过一个月未完成案件", calMonth,false);
+
             //每月绩效统计--上个月递交完成案件
-            DownloadReport("每月绩效统计--上个月递交完成案件", calMonth, true);
-            
+            DownloadReport_SQL("每月绩效统计--上个月递交完成案件", calMonth, true);
+            //DownloadReport("每月绩效统计--上个月递交完成案件", calMonth, true);
+
             //每月绩效统计--中国一次OA授权表
-            DownloadReport("每月绩效统计--中国一次OA授权表", calMonth, true,true);
+            DownloadReport_SQL("每月绩效统计--中国一次OA授权表", calMonth, true, true);
+            //DownloadReport("每月绩效统计--中国一次OA授权表", calMonth, true,true);
 
             //专案数据
-            DownloadProject(calMonth);
+            DownloadProject_SQL(calMonth);
+            //DownloadProject(calMonth);
 
             return Task.CompletedTask;
         }
 
+        private void DownloadReport_SQL(string ReportName, CalMonth calMonth, bool isModifyDate, bool isFirstOA = false)
+        {
+        
+            try
+            {
+                DataTable data = GetDataFromIPEasy(ReportName,isModifyDate);
+                InputPerformanctItem(calMonth, isFirstOA, data);
+            }
+            catch
+            {
+                
+            }
+        }
+
         private void DownloadReport(string ReportName,CalMonth calMonth,bool isModifyDate,bool isFirstOA=false)
         {
             string strFileSavePath = utility.ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
@@ -138,9 +157,55 @@ namespace wispro.sp.api.Job
             }
 
             System.Threading.Thread.Sleep(5000);
-            
-            InputPerformanceItem(strFilePath, true, false, 1, calMonth, isFirstOA);
-            System.IO.File.Move(strFilePath, strFinalPath);
+            if (System.IO.File.Exists(strFilePath))
+            {
+                InputPerformanceItem(strFilePath, true, false, 1, calMonth, isFirstOA);
+
+                try
+                {
+                    System.IO.File.Move(strFilePath, strFinalPath);
+                }
+                catch { }
+            }
+            else
+            {
+                tryCount++;
+
+                if (tryCount < 5)
+                {
+                    goto tryAgain;
+                }
+            }
+        }
+
+        private void DownloadProject_SQL(CalMonth calMonth)
+        {
+            string[] ReportNames = new string[] { "每月绩效统计--专案进度跟踪~S卷", "每月绩效统计--专案开卷报表~S卷" };
+
+            List<PerformanceItem> pfItems = new List<PerformanceItem>();
+            foreach (var ReportName in ReportNames)
+            {
+                DataTable data = GetDataFromIPEasy(ReportName, false);
+
+                var Items = GetProjectItem(calMonth, ReportName.Contains("专案开卷报表"),data);
+
+                foreach (var item in Items)
+                {
+                    var temObj = pfItems.FirstOrDefault<PerformanceItem>(s => s.CaseNo == item.CaseNo);
+                    if (temObj == null)
+                    {
+                        item.Type = "专案";
+                        pfItems.Add(item);
+                    }
+                }
+            }
+
+            //List<BasePointRule> rules = spDb.BasePointRules.ToList<BasePointRule>();
+            foreach (var item in pfItems)
+            {
+                SaveProjectItem(item);
+            }
+
         }
 
         private void DownloadProject(CalMonth calMonth)
@@ -174,18 +239,38 @@ namespace wispro.sp.api.Job
                 string strFilePath = System.IO.Path.Combine(strFileSavePath, filename);
                 string strFinalPath = System.IO.Path.Combine(strFileSavePath, $"{calMonth.Year}{calMonth.Month}-{filename}");
 
-                var Items = GetProjectItem(strFilePath, calMonth, ReportName.Contains("专案开卷报表"));
-                foreach(var item in Items)
+                if (System.IO.File.Exists(strFilePath))
                 {
-                    var temObj = pfItems.FirstOrDefault<PerformanceItem>(s => s.CaseNo == item.CaseNo);
-                    if(temObj == null)
+
+                    var Items = GetProjectItem(strFilePath, calMonth, ReportName.Contains("专案开卷报表"));
+
+
+                    foreach (var item in Items)
                     {
-                        item.Type = "专案";
-                        pfItems.Add(item);
+                        var temObj = pfItems.FirstOrDefault<PerformanceItem>(s => s.CaseNo == item.CaseNo);
+                        if (temObj == null)
+                        {
+                            item.Type = "专案";
+                            pfItems.Add(item);
+                        }
+                    }
+
+                    try
+                    {
+                        System.IO.File.Move(strFilePath, strFinalPath);
                     }
+                    catch { }
+
                 }
+                else
+                {
+                    tryCount++;
 
-                System.IO.File.Move(strFilePath, strFinalPath);
+                    if (tryCount < 5)
+                    {
+                        goto tryAgain;
+                    }
+                }
             }
 
             //List<BasePointRule> rules = spDb.BasePointRules.ToList<BasePointRule>();
@@ -232,7 +317,11 @@ namespace wispro.sp.api.Job
         private List<PerformanceItem> GetProjectItem(string strPath,CalMonth calMonth,bool isOpenSheet)
         {
             DataTable dt = NPOIExcel.ExcelToDataTable(strPath, true, true, 1);
+            return GetProjectItem(calMonth, isOpenSheet, dt);
+        }
 
+        private List<PerformanceItem> GetProjectItem(CalMonth calMonth, bool isOpenSheet, DataTable dt)
+        {
             #region 删除重复行
             DataTable temdt = new DataTable();
             foreach (DataColumn col in dt.Columns)
@@ -275,11 +364,14 @@ namespace wispro.sp.api.Job
             return Items;
         }
 
-
         private 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);
+            return InputPerformanctItem(calMonth, isFirstOAFile, dt);
+        }
 
+        private Task InputPerformanctItem(CalMonth calMonth, bool isFirstOAFile, DataTable dt)
+        {
             #region 删除重复行
             DataTable temdt = new DataTable();
             foreach (DataColumn col in dt.Columns)
@@ -305,11 +397,11 @@ namespace wispro.sp.api.Job
                 PerformanceItem item = null;
                 if (isFirstOAFile)
                 {
-                    item = Row2Item_1(row,  calMonth);
+                    item = Row2Item_1(row, calMonth);
                 }
                 else
                 {
-                    item = Row2Item(row,  calMonth);
+                    item = Row2Item(row, calMonth);
                 }
 
                 if (item != null)
@@ -322,7 +414,7 @@ namespace wispro.sp.api.Job
                         //}
 
                         SavePerformanceItem(item, rules);
-                        
+
                         strDebug = $"{strDebug}\t保存成功";
                     }
                     else
@@ -999,5 +1091,344 @@ namespace wispro.sp.api.Job
 
             return null;
         }
+
+        private DataTable GetDataFromIPEasy(string ReportName, bool isModifyDate)
+        {
+            DataTable dt = new DataTable();
+            string strSQL = "";
+            switch (ReportName)
+            {
+                case "每月绩效统计--发客户超过一个月未完成案件":
+                    strSQL = @"SELECT  p_case_info.case_volume as 我方文号,
+		                i_apply_type.apply_type_zh_cn as 申请类型,
+		                i_business_type.business_type_zh_cn as 业务类型,
+		                i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
+		                (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage)  as 案件阶段,
+		                i_case_coefficient.case_coefficient_zh_cn as 案件系数,
+		                i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
+		                (select  proc_coefficient_zh_cn from p_proc_info pr 
+			                left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id 
+			                where case_id=p_case_info.case_id and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+				                and pr.seq=
+					                (select max(seq) from p_proc_info pr where case_id=p_case_info.case_id 
+						                and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
+					                ) as 前一次OA处理事项系数,
+		                (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
+			                inner join s_user_info as u on u.user_id = pl.pic_id 
+			                inner join  p_proc_info pr1 on pr1.proc_id=pl.obj_id 
+				                where case_id=p_case_info.case_id and 
+					                ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+					                and pr1.seq=(
+						                select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id 
+						                and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+						                and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')) as 前一次OA处理人,
+		                STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl   
+			                inner join s_user_info as u on u.user_id = pl.pic_id 
+			                left join i_user_rank ur on ur.rank_id=u.rank_id 
+			                where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as 处理人等级,
+		                STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl   
+			                inner join s_user_info as u on u.user_id = pl.pic_id 
+			                where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as 处理人,
+		                STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl   
+			                inner join s_user_info as u on u.user_id = pl.revise_user_id 
+			                where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as 核稿人,
+		                c_customer.customer_name as 客户名称,
+		                STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al 
+			                inner join i_applicant as a on a.applicant_id = al.applicant_id 
+			                where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
+		                p_proc_info.finish_date as 处理事项完成日,
+		                p_proc_info.finish_doc_date as 定稿日,
+		                p_proc_info.back_date as 返稿日,
+		                i_case_type.case_type_zh_cn as 案件类型,
+		                i_case_status.case_status_zh_cn as 案件状态,
+		                p_proc_info.proc_note as 处理事项备注,
+		                (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
+		                p_case_info.case_name as 案件名称,
+		                p_case_info.charge_date as 委案日期,
+		                p_proc_info.cus_due_date as 客户期限,
+		                p_proc_info.int_due_date as 内部期限,
+		                p_proc_info.first_doc_date as 初稿日,
+		                p_case_info.remark as 案件备注,
+		                p_proc_info.translate_count as 翻译字数,
+		                STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl 
+			                inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id 
+			                where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
+		                i_country.country_zh_cn as '国家(地区)'  
+	                from p_case_info  
+		                inner join   p_case_advance_info  with(nolock)  on p_case_info.case_id=p_case_advance_info.case_id  
+		                inner join   i_apply_type  with(nolock)  on i_apply_type.apply_type_id=p_case_info.apply_type_id  
+		                inner join   i_case_type  with(nolock)  on i_case_type.case_type_id=p_case_info.case_type_id  
+		                inner join   i_country  with(nolock)  on i_country.country_id=p_case_info.country_id  
+		                inner join   i_case_status  with(nolock)  on i_case_status.case_status_id=p_case_info.case_status_id  
+		                inner join   c_customer  with(nolock)  on c_customer.customer_id=p_case_info.customer_id 
+		                left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id  
+		                inner join   p_proc_info  with(nolock)  on p_case_info.case_id=p_proc_info.case_id  
+		                inner join   i_ctrl_proc  with(nolock)  on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id 
+		                inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id 
+		                inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id 
+		                left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id 
+		                left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id 
+		                left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id 
+	                where 
+		                p_case_info.is_enabled=1 and p_proc_info.is_enabled=1 and 
+		                s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6') and 
+		                p_proc_info.finish_date is null 
+		                and p_proc_info.back_date<DATEADD(MM,-1,DATEADD(MM, DATEDIFF(MM,0,getdate()), 0)) and  
+		                (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A'   ) AND  
+		                ( i_ctrl_proc.ctrl_proc_zh_cn='新申请'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='Non'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='无效宣告'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='意见陈述'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='专利挖掘与布局'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='处理审查意见'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='Final'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='复审通知意见陈述'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='申復'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='RCE'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='翻译'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='提出异议复审'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='Advisory'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='复审'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='请求复审'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='提出报告'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='提出公众意见'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='诉讼'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='提出异议'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='补充理由和证据'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='无效分析'    
+			                or  i_ctrl_proc.ctrl_proc_zh_cn='无效答辩'   
+		                )";
+                    break;
+                case "每月绩效统计--上个月递交完成案件":
+                    strSQL = @"SELECT  
+	                    p_case_info.case_volume as 我方文号,
+	                    i_apply_type.apply_type_zh_cn as 申请类型,
+	                    i_business_type.business_type_zh_cn as 业务类型,
+	                    i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
+	                    (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage)  as 案件阶段,
+	                    i_case_coefficient.case_coefficient_zh_cn as 案件系数,
+	                    i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
+	                    (select  
+		                    proc_coefficient_zh_cn from p_proc_info pr 
+		                    left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id 
+	                    where case_id=p_case_info.case_id 
+		                    and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+		                    and pr.seq=(select max(seq) from p_proc_info pr where case_id=p_case_info.case_id 
+		                    and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
+	                    ) as 前一次OA处理事项系数,
+	                    (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl   
+		                    inner join s_user_info as u on u.user_id = pl.pic_id 
+		                    inner join  p_proc_info pr1 on pr1.proc_id=pl.obj_id 
+	                    where case_id=p_case_info.case_id 
+		                    and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+		                    and pr1.seq=(select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id 
+		                    and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')
+	                    ) as 前一次OA处理人,
+	                    STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl   
+		                    inner join s_user_info as u on u.user_id = pl.pic_id 
+		                    left join i_user_rank ur on ur.rank_id=u.rank_id where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as 处理人等级,
+	                    STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl   
+		                    inner join s_user_info as u on u.user_id = pl.pic_id 
+		                    where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as 处理人,
+	                    STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl   
+		                    inner join s_user_info as u on u.user_id = pl.revise_user_id 
+		                    where pl.obj_id = p_case_info.case_id   FOR XML PATH('') ),1,1,'') as 案件核稿人,
+	                    c_customer.customer_name as 客户名称,
+	                    STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al 
+		                    inner join i_applicant as a on a.applicant_id = al.applicant_id 
+	                    where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
+	                    p_proc_info.finish_date as 处理事项完成日,
+	                    p_proc_info.finish_doc_date as 定稿日,
+	                    p_proc_info.back_date as 返稿日,
+	                    i_case_type.case_type_zh_cn as 案件类型,
+	                    i_case_status.case_status_zh_cn as 案件状态,
+	                    p_proc_info.proc_note as 处理事项备注,
+	                    (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
+	                    p_case_info.case_name as 案件名称,
+	                    p_case_info.charge_date as 委案日期,
+	                    p_proc_info.cus_due_date as 客户期限,
+	                    p_proc_info.int_due_date as 内部期限,
+	                    p_proc_info.first_doc_date as 初稿日,
+	                    p_case_info.remark as 案件备注,
+	                    p_proc_info.translate_count as 翻译字数,
+	                    STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl 
+		                    inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id 
+	                    where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
+	                    i_country.country_zh_cn as '国家(地区)'  
+                    from p_case_info  
+	                    inner join   p_case_advance_info  with(nolock)  on p_case_info.case_id=p_case_advance_info.case_id  
+	                    inner join   i_apply_type  with(nolock)  on i_apply_type.apply_type_id=p_case_info.apply_type_id  
+	                    inner join   i_case_type  with(nolock)  on i_case_type.case_type_id=p_case_info.case_type_id  
+	                    inner join   i_country  with(nolock)  on i_country.country_id=p_case_info.country_id  
+	                    inner join   i_case_status  with(nolock)  on i_case_status.case_status_id=p_case_info.case_status_id  
+	                    inner join   c_customer  with(nolock)  on c_customer.customer_id=p_case_info.customer_id 
+	                    left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id  
+	                    inner join   p_proc_info  with(nolock)  on p_case_info.case_id=p_proc_info.case_id  
+	                    inner join   i_ctrl_proc  with(nolock)  on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id 
+	                    inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id 
+	                    inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id 
+	                    left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id 
+	                    left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id 
+	                    left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id 
+                    where 
+	                    p_case_info.is_enabled=1 
+	                    and p_proc_info.is_enabled=1 
+	                    and s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6') 
+	                    and  (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A'   ) 
+	                    AND  ((p_proc_info.finish_date >= @beginTime  and p_proc_info.finish_date<@endTime)) ";
+                    break;
+                case "每月绩效统计--中国一次OA授权表":
+                    strSQL = @"select 	
+	                    p_case_info.case_volume as 我方文号, 
+	                    p_case_info.case_name as 案件名称,
+	                    p_case_info.app_no as 申请号,
+	                    c_customer.customer_name as 客户名称,
+	                    STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl   
+		                    inner join s_user_info as u on u.user_id = pl.pic_id 
+		                    where pl.obj_id = p_case_info.case_id   FOR XML PATH('') ),1,1,'') as 案件处理人,
+	                    STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl   
+		                    inner join s_user_info as u on u.user_id = pl.revise_user_id 
+		                    where pl.obj_id = p_case_info.case_id   FOR XML PATH('') ),1,1,'') as 案件核稿人,
+	                    p_file_list.post_date as 发文日期,
+	                    p_case_info.case_volume_customer as 客户文号,
+	                    p_case_info.app_date as 申请日,
+	                    i_country.country_zh_cn as '国家(地区)',
+	                    STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al 
+		                    inner join i_applicant as a on a.applicant_id = al.applicant_id 
+		                    where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
+	                    p_file_list.upload_time as 上传日期,
+	                    i_file_desc.file_desc_zh_cn as 文件描述,
+	                    i_apply_type.apply_type_zh_cn as 申请类型,
+	                    STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl 
+		                    inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id 
+		                    where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员 
+                    from p_case_info 
+	                    inner join i_apply_type on p_case_info.apply_type_id=i_apply_type.apply_type_id 
+	                    inner join p_proc_info on p_case_info.case_id=p_proc_info.case_id 
+	                    inner join p_file_list on p_file_list.obj_id=p_proc_info.proc_id 
+	                    inner join i_file_desc on i_file_desc.file_desc_id=p_file_list.file_desc_id 
+	                    inner join c_customer on p_case_info.customer_id=c_customer.customer_id 
+	                    inner join i_country on i_country.country_id=p_case_info.country_id 
+                    where 
+	                    p_case_info.is_enabled=1 
+	                    and p_proc_info.is_enabled=1 and p_case_info.country_id='CN' 
+	                    and p_file_list.file_desc_id='09800D39-D585-49F3-B9DE-50AC689DE9AB' 
+	                    and p_file_list.file_name not like '%.zip' 
+	                    and (select count(*) from p_proc_info where case_id=p_case_info.case_id and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5')=1 
+	                    and  (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A'   ) 
+	                    AND  ((p_file_list.post_date >= @beginTime  and p_file_list.post_date<@endTime))";
+                    break;
+                case "每月绩效统计--专案进度跟踪~S卷":
+                    strSQL = @"SELECT  p_case_info.case_volume as 我方文号,
+                            p_case_info.case_name as 案件名称,
+                            i_case_type.case_type_zh_cn as 案件类型,
+                            i_business_type.business_type_zh_cn as 业务类型,
+                            i_country.country_zh_cn as '国家(地区)',
+                            c_customer.customer_name as 客户名称,
+                            s_dept_info.dept_full_name as 承办部门,
+                            i_case_status.case_status_zh_cn as 案件状态,
+                            i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
+                            p_proc_info.int_due_date as 内部期限,
+                            p_proc_info.cus_due_date as 客户期限,
+                            p_proc_info.legal_due_date as 官方期限,
+                            p_proc_info.finish_doc_date as 定稿日,
+                            STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
+                               inner join s_user_info as u on u.user_id = pl.pic_id where pl.obj_id = p_proc_info.proc_id
+                               FOR XML PATH('') ),1,1,'') as 处理人,
+                            p_case_info.charge_date as 委案日期,
+                            (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
+                            p_proc_info.first_doc_date as 初稿日,
+                            STUFF((SELECT ',' + u.cn_name from c_customer_user as cu
+                             inner join s_user_info as u on u.user_id = cu.user_id 
+                             where cu.customer_id = p_case_info.customer_id FOR XML PATH('') ),1,1,'') as 流程负责人,
+                            p_proc_info.finish_date as 处理事项完成日,
+                            STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
+                             inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id 
+                             where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员
+                            from p_case_info
+                              inner join   p_case_advance_info  with(nolock)  on p_case_info.case_id=p_case_advance_info.case_id
+                              inner join   i_apply_type  with(nolock)  on i_apply_type.apply_type_id=p_case_info.apply_type_id
+                              inner join   i_case_type  with(nolock)  on i_case_type.case_type_id=p_case_info.case_type_id
+                              inner join   i_country  with(nolock)  on i_country.country_id=p_case_info.country_id
+                              inner join   i_case_status  with(nolock)  on i_case_status.case_status_id=p_case_info.case_status_id
+                              inner join   c_customer  with(nolock)  on c_customer.customer_id=p_case_info.customer_id
+                              inner join   p_proc_info  with(nolock)  on p_case_info.case_id=p_proc_info.case_id
+                              inner join   i_ctrl_proc  with(nolock)  on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
+                              inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
+                              inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id 
+                             where p_case_info.is_enabled=1 and p_proc_info.is_enabled=1  and  
+                             (isnull (p_proc_info.finish_date,'') ='') AND  (i_ctrl_proc.ctrl_proc_zh_cn='提出报告')";
+                    break;
+                case "每月绩效统计--专案开卷报表~S卷":
+                    strSQL = @"SELECT  p_case_info.case_volume as 我方文号,
+	                        p_case_info.case_volume_customer as 客户文号,
+	                        p_case_info.case_name as 案件名称,
+	                        p_case_info.charge_date as 委案日期,
+	                        i_case_status.case_status_zh_cn as 案件状态,
+	                        i_case_type.case_type_zh_cn as 案件类型,
+	                        p_case_info.app_no as 申请号,
+	                        p_case_info.app_date as 申请日,
+	                        i_business_type.business_type_zh_cn as 业务类型,
+	                        STUFF((SELECT ',' + u.cn_name from c_customer_user as cu 
+		                        inner join s_user_info as u on u.user_id = cu.user_id where cu.customer_id = p_case_info.customer_id FOR XML PATH('') ),1,1,'') as 流程负责人,
+	                        c_customer.customer_name as 客户名称,
+	                        STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
+		                        inner join s_user_info as u on u.user_id = pl.revise_user_id where pl.obj_id = p_case_info.case_id   FOR XML PATH('') ),1,1,'') as 案件核稿人,
+	                        STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
+		                        inner join s_user_info as u on u.user_id = pl.pic_id where pl.obj_id = p_case_info.case_id   FOR XML PATH('') ),1,1,'') as 案件处理人,
+	                        p_case_info.create_time as 开卷日期,
+	                        STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl 
+		                        inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id 
+		                        where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
+	                        i_country.country_zh_cn as '国家(地区)'  
+                        from p_case_info
+	                        inner join   p_case_advance_info  with(nolock)  on p_case_info.case_id=p_case_advance_info.case_id  
+	                        inner join   i_apply_type  with(nolock)  on i_apply_type.apply_type_id=p_case_info.apply_type_id  
+	                        inner join   i_case_type  with(nolock)  on i_case_type.case_type_id=p_case_info.case_type_id  
+	                        inner join   i_country  with(nolock)  on i_country.country_id=p_case_info.country_id  
+	                        inner join   i_case_status  with(nolock)  on i_case_status.case_status_id=p_case_info.case_status_id  
+	                        inner join   c_customer  with(nolock)  on c_customer.customer_id=p_case_info.customer_id  
+	                        inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id 
+	                        inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id 
+                        where p_case_info.is_enabled=1 and  
+                        (p_case_info.business_type_id='ad0d4c8f-7c2d-4cbf-a5b4-cc1a64d4c384'    
+	                        or p_case_info.business_type_id='20184cc4-1dd8-4d5b-81bd-4b39ca3700f4'
+	                        or p_case_info.business_type_id='94713100-f013-4444-a5a1-1dd1b78d8cdf'
+	                        or p_case_info.business_type_id='f2d4d629-b7a5-4fa5-888d-91029ce7a3f5'
+	                        or p_case_info.business_type_id='32144fb3-2ce0-4ed9-ae6f-a6a09fb66e60') AND  
+	                        (DATEDIFF(dd,p_case_info.create_time,getdate())<='31') ";
+                    break;
+            }
+            
+
+            using (var conn = new SqlConnection(ConfigHelper.GetSectionValue("IPEasySetting:ConnectionStrings")))
+            {
+
+                try
+                {
+                    conn.Open();
+                    using (var cmd = conn.CreateCommand())
+                    {
+                        cmd.CommandText = strSQL;
+                        cmd.CommandType = CommandType.Text;
+
+                        if (isModifyDate)
+                        {
+                            cmd.Parameters.Add(new SqlParameter("beginTime", DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01")));
+                            cmd.Parameters.Add(new SqlParameter("endTime", DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01")));
+                        }
+                        using (var reader = cmd.ExecuteReader())
+                        {
+                            dt.Load(reader);
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    throw ex;
+                }
+            }
+            return dt;
+        }
     }
 }

+ 2 - 1
wispro.sp.api/Job/InvalidDataMessageJob.cs

@@ -18,7 +18,8 @@ namespace wispro.sp.api.Job
             
             var lstItem = spDb.PerformanceItems.Where<PerformanceItem>(p =>
                 (p.AgentFeedbackMemo != "已算绩效"  && p.CalMonth.Status == 0 && !p.CaseNo.StartsWith("J") 
-                && (p.BasePoint ==null || (string.IsNullOrEmpty(p.CaseCoefficient) && p.Type =="新申请"))))
+                && (p.BasePoint ==null || (string.IsNullOrEmpty(p.CaseCoefficient) && p.Type =="新申请")
+                || (p.Type =="OA" && string.IsNullOrEmpty(p.CaseCoefficient) && p.DoItemCoefficient =="实质"))))
                 .Include(p => p.Reviewer)
                 .Include(p => p.CalMonth)
                 .Include(p => p.Customer)

+ 189 - 114
wispro.sp.api/Job/UpdateJXDataFromIPEasyJob.cs

@@ -1,20 +1,205 @@
-using Microsoft.EntityFrameworkCore;
+using Microsoft.Data.SqlClient;
+using Microsoft.EntityFrameworkCore;
 using Quartz;
 using System;
 using System.Collections.Generic;
+using System.Data;
+using System.Diagnostics;
+using System.Dynamic;
 using System.IO;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
 using wispro.sp.entity;
+using wispro.sp.utility;
 
 namespace wispro.sp.api.Job
 {
     public class UpdateJXDataFromIPEasyJob : IJob
     {
+       
+        public dynamic  GetItemFromIPEasyDB(PerformanceItem Item, spDbContext spDb)
+        {
+            dynamic retItem = new ExpandoObject();
+
+            var dt = new DataTable();
+            using (var conn = new SqlConnection(ConfigHelper.GetSectionValue("IPEasySetting:ConnectionStrings")))
+            {
+                
+                try
+                {
+                    conn.Open();
+
+                    string strSql = @"SELECT distinct  p_case_info.case_volume as case_volume,
+		            i_apply_type.apply_type_zh_cn as apply_type_zh_cn,
+		            i_business_type.business_type_zh_cn as business_type_zh_cn,
+		            i_ctrl_proc.ctrl_proc_zh_cn as ctrl_proc_zh_cn,
+		            (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage)  as review_stage,
+		            i_case_coefficient.case_coefficient_zh_cn as case_coefficient,
+		            i_proc_coefficient.proc_coefficient_zh_cn as proc_coefficient,
+		            (select  proc_coefficient_zh_cn from p_proc_info pr 
+			            left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id 
+			            where case_id=p_case_info.case_id and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+				            and pr.seq=
+					            (select max(seq) from p_proc_info pr where case_id=p_case_info.case_id 
+						            and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
+					            ) as oa_proc_coefficient,
+		            (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
+			            inner join s_user_info as u on u.user_id = pl.pic_id 
+			            inner join  p_proc_info pr1 on pr1.proc_id=pl.obj_id 
+				            where case_id=p_case_info.case_id and 
+					            ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+					            and pr1.seq=(
+						            select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id 
+						            and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5' 
+						            and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')) 
+		            as oa_pic_list,
+		            STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl   
+			            inner join s_user_info as u on u.user_id = pl.pic_id 
+			            left join i_user_rank ur on ur.rank_id=u.rank_id 
+			            where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as user_rank,
+		            STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl   
+			            inner join s_user_info as u on u.user_id = pl.pic_id 
+			            where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as pic,
+		            STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl   
+			            inner join s_user_info as u on u.user_id = pl.revise_user_id 
+			            where pl.obj_id = p_proc_info.proc_id   FOR XML PATH('') ),1,1,'') as reviser,
+		            c_customer.customer_name as customer_name,
+		            STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al 
+			            inner join i_applicant as a on a.applicant_id = al.applicant_id 
+			            where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as applicants,
+		            p_proc_info.finish_date as finish_date,
+		            p_proc_info.finish_doc_date as finish_doc_date,
+		            p_proc_info.back_date as back_date,
+		            i_case_type.case_type_zh_cn as case_type_zh_cn,
+		            i_case_status.case_status_zh_cn as case_status_zh_cn,
+		            p_proc_info.proc_note as proc_note,
+		            (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as proc_status_zh_cn,
+		            p_case_info.case_name as case_name,
+		            p_case_info.charge_date as charge_date,
+		            p_proc_info.cus_due_date as cus_due_date,
+		            p_proc_info.int_due_date as int_due_date,
+		            p_proc_info.first_doc_date as first_doc_date,
+		            p_case_info.remark as case_remark,
+		            p_proc_info.translate_count as translate_count,
+		            STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl 
+			            inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id 
+			            where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as sales,
+		            i_country.country_zh_cn as country_zh_cn  
+	            from p_case_info  
+		            inner join   p_case_advance_info  with(nolock)  on p_case_info.case_id=p_case_advance_info.case_id  
+		            inner join   i_apply_type  with(nolock)  on i_apply_type.apply_type_id=p_case_info.apply_type_id  
+		            inner join   i_case_type  with(nolock)  on i_case_type.case_type_id=p_case_info.case_type_id  
+		            inner join   i_country  with(nolock)  on i_country.country_id=p_case_info.country_id  
+		            inner join   i_case_status  with(nolock)  on i_case_status.case_status_id=p_case_info.case_status_id  
+		            inner join   c_customer  with(nolock)  on c_customer.customer_id=p_case_info.customer_id 
+		            left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id  
+		            inner join   p_proc_info  with(nolock)  on p_case_info.case_id=p_proc_info.case_id  
+		            inner join   i_ctrl_proc  with(nolock)  on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id 
+		            inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id 
+		            left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id 
+		            left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id 
+		            left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id 
+	            where 
+		            p_case_info.is_enabled=1 and 
+		            p_proc_info.is_enabled=1 and 
+		            s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6') and 
+		            (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A') AND  
+		            i_ctrl_proc.ctrl_proc_zh_cn=@DoItem and 
+		            p_case_info.case_volume =@CaseNo";
+
+                    if (!string.IsNullOrEmpty(Item.CaseStage))
+                    {
+                        strSql = $"{strSql} and review_stage=@CaseStage";
+                    }
+
+
+                    using (var cmd = conn.CreateCommand())
+                    {
+                        cmd.CommandText = strSql;
+                        cmd.CommandType = CommandType.Text;
+                        cmd.Parameters.Add(new SqlParameter("DoItem", Item.DoItem));
+                        cmd.Parameters.Add(new SqlParameter("CaseNo", Item.CaseNo));
+                        if (!string.IsNullOrEmpty(Item.CaseStage))
+                        {
+                            cmd.Parameters.Add(new SqlParameter("CaseStage", Item.CaseStage));
+                        }
+
+                        using (var reader = cmd.ExecuteReader())
+                        {
+                            dt.Load(reader);
+
+
+
+                            if (dt.Rows.Count > 1)
+                            {
+                                bool bRet = false;
+                                foreach (DataRow row in dt.Rows)
+                                {
+                                    retItem.FinishedDate = row["finish_date"].ToString();
+                                    DateTime temDate = DateTime.Now;
+                                    DateTime.TryParse(retItem.FinishedDate,out temDate);
+                                    if (Item.FinishedDate.HasValue && Item.FinishedDate.Value == temDate)
+                                    {
+                                        retItem.CaseNo = row["case_volume"].ToString();
+                                        retItem.CaseCoefficient = row["case_coefficient"].ToString();
+                                        retItem.DoItemCoefficient = row["proc_coefficient"].ToString();
+                                        retItem.Reviewer = row["reviser"].ToString();
+                                        retItem.FinishedDate = row["finish_date"].ToString();
+                                        retItem.WordCount = row["translate_count"].ToString();
+
+                                        bRet = true;
+                                        break;
+                                    }
+                                    
+                                }
+
+                                if (!bRet)
+                                {
+                                    DataRow row = dt.Rows[0];
+                                    retItem.CaseNo = row["case_volume"].ToString();
+                                    retItem.CaseCoefficient = row["case_coefficient"].ToString();
+                                    retItem.DoItemCoefficient = row["proc_coefficient"].ToString();
+                                    retItem.Reviewer = row["reviser"].ToString();
+                                    retItem.FinishedDate = row["finish_date"].ToString();
+                                    retItem.WordCount = row["translate_count"].ToString();
+                                }
+                            }
+                            else
+                            {
+                                if (dt.Rows.Count > 0)
+                                {
+                                    DataRow row = dt.Rows[0];
+                                    retItem.CaseNo = row["case_volume"].ToString();
+                                    retItem.CaseCoefficient = row["case_coefficient"].ToString();
+                                    retItem.DoItemCoefficient = row["proc_coefficient"].ToString();
+                                    retItem.Reviewer = row["reviser"].ToString();
+                                    retItem.FinishedDate = row["finish_date"].ToString();
+                                    retItem.WordCount = row["translate_count"].ToString();
+                                }
+
+                            }
+
+
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    // error handling
+                    throw;
+                }
+                finally
+                {
+                    conn.Close();
+                }
+            }
+
+            return retItem;
+        }
         public void UpdateFromIPEasy(PerformanceItem Item,spDbContext spDb)
         {
-            dynamic retObj = utility.IPEasyUtility.GetPerformanceRecord(Item.CaseNo, Item.DoItem, string.IsNullOrEmpty(Item.CaseStage) ? null : Item.CaseStage);
+            dynamic retObj = GetItemFromIPEasyDB(Item, spDb); //utility.IPEasyUtility.GetPerformanceRecord(Item.CaseNo, Item.DoItem, string.IsNullOrEmpty(Item.CaseStage) ? null : Item.CaseStage);
 
             var appealAJXS = spDb.AppealTypes.FirstOrDefault(p => p.Name.Contains("案件系数"));
             var appealCLSXXS = spDb.AppealTypes.FirstOrDefault(p => p.Name.Contains("处理事项系数"));
@@ -30,92 +215,6 @@ namespace wispro.sp.api.Job
             }
 
 
-            //if (keyValuePairs.ContainsKey("DoItemMemo") && Item.DoItemMemo != retObj.DoItemMemo && !string.IsNullOrEmpty(retObj.DoItemMemo))
-            //{
-            //    Item.DoItemMemo = retObj.DoItemMemo;
-            //}
-
-            //if (keyValuePairs.ContainsKey("DoItemState") && Item.DoItemState != retObj.DoItemState && !string.IsNullOrEmpty(retObj.DoItemState))
-            //{
-            //    Item.DoItemState = retObj.DoItemState;
-            //}
-
-            //if (keyValuePairs.ContainsKey("CustomerLimitDate"))
-            //{
-            //    if (!string.IsNullOrEmpty(retObj.CustomerLimitDate))
-            //    {
-            //        DateTime date = DateTime.Parse(retObj.CustomerLimitDate);
-
-            //        if (date != Item.CustomerLimitDate)
-            //            Item.CustomerLimitDate = date;
-            //    }
-            //}
-
-            //if (keyValuePairs.ContainsKey("EntrustingDate"))
-            //{
-            //    if (!string.IsNullOrEmpty(retObj.EntrustingDate))
-            //    {
-            //        DateTime date = DateTime.Parse(retObj.EntrustingDate);
-
-            //        if (date != Item.EntrustingDate)
-            //            Item.EntrustingDate = date;
-            //    }
-            //}
-
-            //if (keyValuePairs.ContainsKey("FinalizationDate"))
-            //{
-            //    if (!string.IsNullOrEmpty(retObj.FinalizationDate))
-            //    {
-            //        DateTime date = DateTime.Parse(retObj.FinalizationDate);
-
-            //        if (date != Item.FinalizationDate)
-            //            Item.FinalizationDate = date;
-            //    }
-            //}
-
-            //if (keyValuePairs.ContainsKey("FinishedDate"))
-            //{
-            //    if (!string.IsNullOrEmpty(retObj.FinishedDate))
-            //    {
-            //        DateTime date = DateTime.Parse(retObj.FinishedDate);
-
-            //        if (date != Item.FinishedDate)
-            //            Item.FinishedDate = date;
-            //    }
-            //}
-
-            //if (keyValuePairs.ContainsKey("FirstDraftDate"))
-            //{
-            //    if (!string.IsNullOrEmpty(retObj.FirstDraftDate))
-            //    {
-            //        DateTime date = DateTime.Parse(retObj.FirstDraftDate);
-
-            //        if (date != Item.FirstDraftDate)
-            //            Item.FirstDraftDate = date;
-            //    }
-            //}
-
-            //if (keyValuePairs.ContainsKey("InternalDate"))
-            //{
-            //    if (!string.IsNullOrEmpty(retObj.InternalDate))
-            //    {
-            //        DateTime date = DateTime.Parse(retObj.InternalDate);
-
-            //        if (date != Item.InternalDate)
-            //            Item.InternalDate = date;
-            //    }
-            //}
-
-            //if (keyValuePairs.ContainsKey("ReturnDate"))
-            //{
-            //    if (!string.IsNullOrEmpty(retObj.ReturnDate))
-            //    {
-            //        DateTime date = DateTime.Parse(retObj.ReturnDate);
-
-            //        if (date != Item.ReturnDate)
-            //            Item.ReturnDate = date;
-            //    }
-            //}
 
             if (keyValuePairs.ContainsKey("WordCount"))
             {
@@ -159,10 +258,6 @@ namespace wispro.sp.api.Job
                 Item.ApplicationType = retObj.ApplicationType;
             }
 
-            //if (keyValuePairs.ContainsKey("BusinessType") && Item.BusinessType != retObj.BusinessType && !string.IsNullOrEmpty(retObj.BusinessType))
-            //{
-            //    Item.BusinessType = retObj.BusinessType;
-            //}
 
             if (keyValuePairs.ContainsKey("CaseCoefficient") && Item.CaseCoefficient != retObj.CaseCoefficient && caseXS)
             {
@@ -170,20 +265,6 @@ namespace wispro.sp.api.Job
                     Item.CaseCoefficient = retObj.CaseCoefficient;
             }
 
-            //if (keyValuePairs.ContainsKey("CaseMemo") && Item.CaseMemo != retObj.CaseMemo && !string.IsNullOrEmpty(retObj.CaseMemo))
-            //{
-            //    Item.CaseMemo = retObj.CaseMemo;
-            //}
-
-            //if (keyValuePairs.ContainsKey("CaseStage") && Item.CaseStage != retObj.CaseStage && !string.IsNullOrEmpty(retObj.CaseStage))
-            //{
-            //    Item.CaseStage = retObj.CaseStage;
-            //}
-
-            //if (keyValuePairs.ContainsKey("CaseState") && Item.CaseState != retObj.CaseState && !string.IsNullOrEmpty(retObj.CaseState))
-            //{
-            //    Item.CaseState = retObj.CaseState;
-            //}
 
             if (keyValuePairs.ContainsKey("CaseType") && Item.CaseType != retObj.CaseType && !string.IsNullOrEmpty(retObj.CaseType))
             {
@@ -194,10 +275,6 @@ namespace wispro.sp.api.Job
             {
                 if (Item.AgentFeedbackMemo != "特殊点数申诉")
                 {
-                    //Utility.Utility.CalBasePoint(Item, spDb.BasePointRules.ToList());
-
-                    //spDb.SaveChanges();
-
                     new Controllers.PerformanceItemController(spDb, new Services.FileTaskCacheService()).RefreshPoint(Item);
                 }
             }
@@ -288,22 +365,20 @@ namespace wispro.sp.api.Job
                 .Include(p=>p.ItemStaffs).ThenInclude(p=>p.DoPerson)
                 .ToList<PerformanceItem>();
 
-            
-
             if (lstItem != null)
             {
                 int i = 0;
                 foreach (var Item in lstItem)
                 {
-                    
+                    System.Threading.Thread.Sleep(100);
                     int iTryCount = 0;    
                 TryAgain:
                     try
                     {
                         iTryCount++;
-
                         
                         UpdateFromIPEasy(Item, spDb);
+                        
 
                         Log($"{DateTime.Now}\t{++i}/{lstItem.Count}\t{Item.CaseNo}");
                         System.Diagnostics.Debug.WriteLine($"{DateTime.Now}\t{i}/{lstItem.Count}\t{Item.CaseNo}");

+ 3 - 14
wispro.sp.api/Utility/Utility.cs

@@ -31,35 +31,24 @@ namespace wispro.sp.api.Utility
                 var interpreter = new Interpreter(options)
                     .Reference(typeof(System.Linq.Enumerable));
 
-                //if (rule.Rule.Contains("Appeal Decision"))
-                //{
-                //    System.Diagnostics.Debug.WriteLine(rule.Rule);
-                //}
-
                 try
                 {
-                    //item.ApplicationType
+                    
                     Func<PerformanceItem,Customer, bool> func = interpreter.ParseAsDelegate<Func<PerformanceItem,Customer,bool>>(rule.Rule, "p","Customer");
 
                     bool result = func.Invoke(item,item.Customer);
 
                     if (result)
                     {
-                        //if ((( item.Customer.Name.Contains("OPPO") && (item.CaseNo.StartsWith("PAUS") || item.ApplicationType=="实用新型")) || rule.PointExpress.Contains("p.WordCount")) && item.DoItem == "新申请")
-                        //{
-                        //    System.Diagnostics.Debug.WriteLine("");
-                        //}
                         var temString = rule.PointExpress;
+
                         if (!rule.PointExpress.Contains("."))
                         {
                             temString = $"{rule.PointExpress.Trim()}.0";
                         }
 
                         var target = new Interpreter().SetVariable("p", item);
-                        //target.SetVariable("Customer", item.Customer);
-
                         
-
                         double? temPoint = (double?)target.Eval(temString);
                         string temType = rule.Type;
                         if(temString.Contains("p.WordCount") && item.DoItem == "新申请" && temPoint.HasValue)
@@ -92,7 +81,7 @@ namespace wispro.sp.api.Utility
                             }
                         }
 
-                        if(item.BasePoint != temPoint)
+                        if(item.BasePoint != temPoint || item.Type !=temType)
                         {
                             item.BasePoint = temPoint;
                             item.Type = temType;

+ 5 - 4
wispro.sp.api/appsettings.json

@@ -11,8 +11,8 @@
     "DefaultConnect": "Data Source=(local);Initial Catalog=spDB;User ID=sa;Password=Lqftiu807005"
   },
 
-  "UpdateScheduleSetting": "00 31 20 1-9 * ? *",
-  "InvalidDataScheduleSetting": "00 14 09 1-6 * ? *",
+  "UpdateScheduleSetting": "00 45 15 1-9 * ? *",
+  "InvalidDataScheduleSetting": "00 29 16 1-6 * ? *",
   "AgentMessageScheduleSetting": "00 10 06 7 * ? *",
 
   "ValidAudience": "StaffPerformance",
@@ -25,12 +25,13 @@
     "Issuer": "http://localhost:39476"
   },
   "IPEasySetting": {
+    "ConnectionStrings": "Data Source=(local);Initial Catalog=IPEasy;User ID=sa;Password=Lqftiu807005",
     "DownloadFileSavePath": "c:\\temp",
     "isHeadless": "true",
     "Account": "caiyangl",
     "Password": "j)wx*lier*@3",
-    "ChormeDriverPath": "D:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\99.0.4844.51",
-    "ScheduleSetting": "00 36 08 1 * ? *",
+    "ChormeDriverPath": "D:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\100.0.4896.60",
+    "ScheduleSetting": "00 19 19 4 * ? *",
     "IPEasyWeb": "http://47.106.221.167/Login.aspx"
   },
 

+ 5 - 5
wispro.sp.share/NanduStatics.cs

@@ -9,10 +9,10 @@ namespace wispro.sp.share
     public class NanduStatics
     {
         public double NanduXS { get; set; }
-        public double S { get; set; }
-        public double A { get; set; }
-        public double B { get; set; }
-        public double C { get; set; }
-        public double D { get; set; }
+        public decimal S { get; set; }
+        public decimal  A { get; set; }
+        public decimal B { get; set; }
+        public decimal C { get; set; }
+        public decimal D { get; set; }
     }
 }

+ 294 - 222
wispro.sp.utility/IPEasyUtility.cs

@@ -1,8 +1,10 @@
 using System;
 using System.Data;
+using System.Diagnostics;
 using System.Dynamic;
 using System.Linq;
 using OpenQA.Selenium;
+using OpenQA.Selenium.Chrome;
 
 namespace wispro.sp.utility
 {
@@ -28,55 +30,67 @@ namespace wispro.sp.utility
 
             using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath"), options))
             {
-                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(50);
-                driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(500);
-
-                //进入登录界面
-                driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
+                try
+                {
+                    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(50);
+                    driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(500);
 
-                //输入用户名和密码
-                driver.FindElement(By.Id("txtUser")).SendKeys(Account);
-                driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
+                    //进入登录界面
+                    driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
 
-                //点击登录按钮
-                driver.FindElement(By.Id("btnLogin")).Click();
+                    //输入用户名和密码
+                    driver.FindElement(By.Id("txtUser")).SendKeys(Account);
+                    driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
 
-                //关闭提示遮罩层
-                driver.FindElement(By.Id("jpwClose")).Click();
+                    //点击登录按钮
+                    driver.FindElement(By.Id("btnLogin")).Click();
 
-                //点击顶部菜单栏中的报表管理菜单
-                driver.FindElement(By.Name("970d33d5-c728-41b8-a060-4330610706b9")).Click();
+                    //关闭提示遮罩层
+                    driver.FindElement(By.Id("jpwClose")).Click();
 
-                //点击左侧 自定义报表 菜单
-                driver.FindElement(By.Name("642fa96f-1e1f-46fd-aaa4-cb461ee8df5b")).Click();
+                    //点击顶部菜单栏中的报表管理菜单
+                    driver.FindElement(By.Name("970d33d5-c728-41b8-a060-4330610706b9")).Click();
 
-                //切换到自定义报表Frame
-                driver.SwitchTo().Frame(1);
+                    //点击左侧 自定义报表 菜单
+                    driver.FindElement(By.Name("642fa96f-1e1f-46fd-aaa4-cb461ee8df5b")).Click();
 
-                //调用报表导出JS
-                ((IJavaScriptExecutor)driver).ExecuteScript($"Report.Export('{strId}');");
+                    //切换到自定义报表Frame
+                    driver.SwitchTo().Frame(1);
 
-                //切换到弹出的导出报表窗口,点击导出按钮
-                driver.SwitchTo().DefaultContent();
-                var ihg_export = driver.FindElement(By.Name("ihg_export"));
-                driver.SwitchTo().Frame(ihg_export);
-                driver.FindElement(By.Id("btnSubmit")).Click();
+                    //调用报表导出JS
+                    ((IJavaScriptExecutor)driver).ExecuteScript($"Report.Export('{strId}');");
 
-                string strFilePath = System.IO.Path.Combine(strFileSavePath, filename);
+                    //切换到弹出的导出报表窗口,点击导出按钮
+                    driver.SwitchTo().DefaultContent();
+                    var ihg_export = driver.FindElement(By.Name("ihg_export"));
+                    driver.SwitchTo().Frame(ihg_export);
+                    driver.FindElement(By.Id("btnSubmit")).Click();
 
+                    string strFilePath = System.IO.Path.Combine(strFileSavePath, filename);
 
-                while (true)
-                {
 
-                    System.IO.FileInfo file = new System.IO.FileInfo(strFilePath);
-                    if (!file.Exists || file.Length == 0) { 
-                        System.Threading.Thread.Sleep(5000);
-                    }
-                    else
+                    while (true)
                     {
-                        break;
+
+                        System.IO.FileInfo file = new System.IO.FileInfo(strFilePath);
+                        if (!file.Exists || file.Length == 0)
+                        {
+                            System.Threading.Thread.Sleep(5000);
+                        }
+                        else
+                        {
+                            break;
+                        }
                     }
                 }
+                catch (Exception ex)
+                {
+                    throw new Exception(ex.Message);
+                }
+                finally
+                {
+                    killChromProcess();
+                }
 
             }
         }
@@ -106,109 +120,119 @@ namespace wispro.sp.utility
 
             using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath"), options))
             {
+                try
+                {
+                    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(50);
+                    driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(500);
 
-                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(50);
-                driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(500);
+                    //进入登录界面
+                    driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
 
-                //进入登录界面
-                driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
+                    //输入用户名和密码
+                    driver.FindElement(By.Id("txtUser")).SendKeys(Account);
+                    driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
 
-                //输入用户名和密码
-                driver.FindElement(By.Id("txtUser")).SendKeys(Account);
-                driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
+                    //点击登录按钮
+                    driver.FindElement(By.Id("btnLogin")).Click();
 
-                //点击登录按钮
-                driver.FindElement(By.Id("btnLogin")).Click();
+                    //关闭提示遮罩层
+                    driver.FindElement(By.Id("jpwClose")).Click();
 
-                //关闭提示遮罩层
-                driver.FindElement(By.Id("jpwClose")).Click();
+                    //点击顶部菜单栏中的报表管理菜单
+                    driver.FindElement(By.Name("970d33d5-c728-41b8-a060-4330610706b9")).Click();
 
-                //点击顶部菜单栏中的报表管理菜单
-                driver.FindElement(By.Name("970d33d5-c728-41b8-a060-4330610706b9")).Click();
+                    //点击左侧 自定义报表 菜单
+                    driver.FindElement(By.Name("642fa96f-1e1f-46fd-aaa4-cb461ee8df5b")).Click();
 
-                //点击左侧 自定义报表 菜单
-                driver.FindElement(By.Name("642fa96f-1e1f-46fd-aaa4-cb461ee8df5b")).Click();
+                    //切换到自定义报表Frame
+                    driver.SwitchTo().Frame(1);
 
-                //切换到自定义报表Frame
-                driver.SwitchTo().Frame(1);
+                    var inputSearch = driver.FindElement(By.Id("customizedList_TxtSheetSearchKey"));
 
-                var inputSearch = driver.FindElement(By.Id("customizedList_TxtSheetSearchKey"));
+                    inputSearch.SendKeys(ReportName);
+                    var btnSearch = driver.FindElement(By.ClassName("btn-search"));
+                    btnSearch.Click();
 
-                inputSearch.SendKeys(ReportName);
-                var btnSearch = driver.FindElement(By.ClassName("btn-search"));
-                btnSearch.Click();
+                    var reportRecord = driver.FindElement(By.XPath($"//td[contains(text(),'{ReportName}')]"));
+                    reportRecord.Click();
 
-                var reportRecord = driver.FindElement(By.XPath($"//td[contains(text(),'{ReportName}')]"));
-                reportRecord.Click();
+                    System.Threading.Thread.Sleep(1000);
 
-                System.Threading.Thread.Sleep(1000);
+                    if (isModifyDate)
+                    {
+                        var btnEdit = driver.FindElement(By.ClassName("edit"));
+                        btnEdit.Click();
+                        System.Threading.Thread.Sleep(500);
 
-                if (isModifyDate)
-                {
-                    var btnEdit = driver.FindElement(By.ClassName("edit"));
-                    btnEdit.Click();
-                    System.Threading.Thread.Sleep(500);
+                        var doItemFinished = driver.FindElement(By.XPath("//span[contains(@objcvalue,'_date') and contains(@id,'ST;')]"));
+                        doItemFinished.Click();
+                        System.Threading.Thread.Sleep(500);
 
-                    var doItemFinished = driver.FindElement(By.XPath("//span[contains(@objcvalue,'_date') and contains(@id,'ST;')]"));
-                    doItemFinished.Click();
-                    System.Threading.Thread.Sleep(500);
+                        var startDate = driver.FindElement(By.XPath("//input[contains(@id,'dt_s_')]"));
 
-                    var startDate = driver.FindElement(By.XPath("//input[contains(@id,'dt_s_')]"));
-                    
-                    startDate.Click();
-                    System.Threading.Thread.Sleep(500);
-                    
-                    startDate.SendKeys(new DateTime(DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month, 1).ToString("yyyy-MM-dd"));
+                        startDate.Click();
+                        System.Threading.Thread.Sleep(500);
 
-                    var endDate = driver.FindElement(By.XPath("//input[contains(@id,'dt_e_')]"));//.Id("dt_e_4F8FE88D-9040-45F1-9723-45699BCD4CAF"));
-                    endDate.Click();
-                    System.Threading.Thread.Sleep(500);
-                    endDate.SendKeys(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays(-1).ToString("yyyy-MM-dd"));
+                        startDate.SendKeys(new DateTime(DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month, 1).ToString("yyyy-MM-dd"));
 
-                    var addDate = driver.FindElement(By.XPath("//a[contains(@onclick,'ReportSub.ConditionDTSelect')]"));
-                    addDate.Click();
-                    System.Threading.Thread.Sleep(500);
+                        var endDate = driver.FindElement(By.XPath("//input[contains(@id,'dt_e_')]"));//.Id("dt_e_4F8FE88D-9040-45F1-9723-45699BCD4CAF"));
+                        endDate.Click();
+                        System.Threading.Thread.Sleep(500);
+                        endDate.SendKeys(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays(-1).ToString("yyyy-MM-dd"));
 
-                    var btnSave = driver.FindElement(By.Id("save"));
-                    btnSave.Click();
-                    System.Threading.Thread.Sleep(3000);
+                        var addDate = driver.FindElement(By.XPath("//a[contains(@onclick,'ReportSub.ConditionDTSelect')]"));
+                        addDate.Click();
+                        System.Threading.Thread.Sleep(500);
 
-                }
+                        var btnSave = driver.FindElement(By.Id("save"));
+                        btnSave.Click();
+                        System.Threading.Thread.Sleep(3000);
 
-                var linkExport = driver.FindElement(By.XPath("//a[contains(@onclick,'-') and @class='tbexcel']"));
-                linkExport.Click();
-                
+                    }
 
-                //切换到弹出的导出报表窗口,点击导出按钮
-                driver.SwitchTo().DefaultContent();
-                var ihg_export = driver.FindElement(By.Name("ihg_export"));
-                driver.SwitchTo().Frame(ihg_export);
-                driver.FindElement(By.Id("btnSubmit")).Click();
+                    var linkExport = driver.FindElement(By.XPath("//a[contains(@onclick,'-') and @class='tbexcel']"));
+                    linkExport.Click();
 
-                string strFilePath = System.IO.Path.Combine(strFileSavePath, $"{ReportName.Trim()}.xlsx");
 
-                int iwaiting = 0;
-                while (true)
-                {
+                    //切换到弹出的导出报表窗口,点击导出按钮
+                    driver.SwitchTo().DefaultContent();
+                    var ihg_export = driver.FindElement(By.Name("ihg_export"));
+                    driver.SwitchTo().Frame(ihg_export);
+                    driver.FindElement(By.Id("btnSubmit")).Click();
+
+                    string strFilePath = System.IO.Path.Combine(strFileSavePath, $"{ReportName.Trim()}.xlsx");
 
-                    System.IO.FileInfo file = new System.IO.FileInfo(strFilePath.Replace("~","_"));
-                    if (!file.Exists || file.Length == 0)
+                    int iwaiting = 0;
+                    while (true)
                     {
-                        System.Threading.Thread.Sleep(5000);
 
-                        iwaiting += 5000;
+                        System.IO.FileInfo file = new System.IO.FileInfo(strFilePath.Replace("~", "_"));
+                        if (!file.Exists || file.Length == 0)
+                        {
+                            System.Threading.Thread.Sleep(5000);
+
+                            iwaiting += 5000;
 
-                        if(iwaiting > 360000)
+                            if (iwaiting > 360000)
+                            {
+                                break;
+                            }
+                        }
+                        else
                         {
                             break;
                         }
                     }
-                    else
-                    {
-                        break;
-                    }
                 }
-            }
+                catch (Exception ex)
+                {
+                    throw new Exception(ex.Message, ex);
+                }
+                finally
+                {
+                    killChromProcess();
+                }
+        }
         }
 
         /// <summary>
@@ -242,61 +266,70 @@ namespace wispro.sp.utility
 
             using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath"), options))
             {
+                try
+                {
+                    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
+                    driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(100);
 
-                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
-                driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(100);
-
-                //进入登录界面
-                driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
+                    //进入登录界面
+                    driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
 
-                //输入用户名和密码
-                driver.FindElement(By.Id("txtUser")).SendKeys(Account);
-                driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
+                    //输入用户名和密码
+                    driver.FindElement(By.Id("txtUser")).SendKeys(Account);
+                    driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
 
-                //点击登录按钮
-                driver.FindElement(By.Id("btnLogin")).Click();
+                    //点击登录按钮
+                    driver.FindElement(By.Id("btnLogin")).Click();
 
-                //关闭提示遮罩层
-                driver.FindElement(By.Id("jpwClose")).Click();
+                    //关闭提示遮罩层
+                    driver.FindElement(By.Id("jpwClose")).Click();
 
-                //点击顶部菜单栏中的案件管理菜单
-                driver.FindElement(By.Name("71A7CC35-F597-40E1-9FEF-BE622A3A3B63")).Click();
+                    //点击顶部菜单栏中的案件管理菜单
+                    driver.FindElement(By.Name("71A7CC35-F597-40E1-9FEF-BE622A3A3B63")).Click();
 
-                //点击左侧 查询 菜单
-                driver.FindElement(By.Name("c3266ab3-521a-4815-8aaf-7dd0bc5a76af")).Click();
+                    //点击左侧 查询 菜单
+                    driver.FindElement(By.Name("c3266ab3-521a-4815-8aaf-7dd0bc5a76af")).Click();
 
-                //切换到自定义报表Frame
-                driver.SwitchTo().Frame(1);
+                    //切换到自定义报表Frame
+                    driver.SwitchTo().Frame(1);
 
-                var inputSearch = driver.FindElement(By.Id("case_volume"));
-                inputSearch.SendKeys(caseNo);
+                    var inputSearch = driver.FindElement(By.Id("case_volume"));
+                    inputSearch.SendKeys(caseNo);
 
-                var btnSearch = driver.FindElement(By.Id("btn_Search"));
-                btnSearch.Click();
+                    var btnSearch = driver.FindElement(By.Id("btn_Search"));
+                    btnSearch.Click();
 
-                var caseLink = driver.FindElement(By.XPath($"//a[contains(text(),'{caseNo}')]"));
-                caseLink.Click();
-                System.Threading.Thread.Sleep(500);
+                    var caseLink = driver.FindElement(By.XPath($"//a[contains(text(),'{caseNo}')]"));
+                    caseLink.Click();
+                    System.Threading.Thread.Sleep(500);
 
-                driver.SwitchTo().ParentFrame().SwitchTo().Frame(2);
-                
-                driver.FindElement(By.Id("libase")).Click();
-                retObject.CaseName = driver.FindElement(By.Id("p_case_info__case_name")).GetAttribute("value");  //案件名称
-                retObject.CustomerName = driver.FindElement(By.Id("p_case_info__customer_id")).GetAttribute("value");  //客户名称
-                retObject.BusinessType = driver.FindElement(By.Id("p_case_info__business_type_id")).GetAttribute("value");     //业务类型
+                    driver.SwitchTo().ParentFrame().SwitchTo().Frame(2);
 
-                retObject.CaseState = GetSelectText(driver.FindElement(By.Id("p_case_info__case_status_id")));
-                retObject.ApplicationType = GetSelectText(driver.FindElement(By.Id("p_case_info__apply_type_id")));
+                    driver.FindElement(By.Id("libase")).Click();
+                    retObject.CaseName = driver.FindElement(By.Id("p_case_info__case_name")).GetAttribute("value");  //案件名称
+                    retObject.CustomerName = driver.FindElement(By.Id("p_case_info__customer_id")).GetAttribute("value");  //客户名称
+                    retObject.BusinessType = driver.FindElement(By.Id("p_case_info__business_type_id")).GetAttribute("value");     //业务类型
 
+                    retObject.CaseState = GetSelectText(driver.FindElement(By.Id("p_case_info__case_status_id")));
+                    retObject.ApplicationType = GetSelectText(driver.FindElement(By.Id("p_case_info__apply_type_id")));
 
-                retObject.CaseType = driver.FindElement(By.Id("p_case_info__case_type_id")).GetAttribute("value");  //案件类型
-                retObject.EntrustingDate = driver.FindElement(By.Id("p_case_info__charge_date")).GetAttribute("value"); //委案日期
-                retObject.CaseMemo = driver.FindElement(By.Id("p_case_info__remark")).GetAttribute("value");    //案件备注
 
-                driver.FindElement(By.XPath($"//span[contains(text(),'扩展信息')]")).Click();
-                //select[@id='p_case_info__case_coefficient_id']
-                retObject.CaseCoefficient = GetSelectText(driver.FindElement(By.Id("p_case_info__case_coefficient_id")));
+                    retObject.CaseType = driver.FindElement(By.Id("p_case_info__case_type_id")).GetAttribute("value");  //案件类型
+                    retObject.EntrustingDate = driver.FindElement(By.Id("p_case_info__charge_date")).GetAttribute("value"); //委案日期
+                    retObject.CaseMemo = driver.FindElement(By.Id("p_case_info__remark")).GetAttribute("value");    //案件备注
 
+                    driver.FindElement(By.XPath($"//span[contains(text(),'扩展信息')]")).Click();
+                    //select[@id='p_case_info__case_coefficient_id']
+                    retObject.CaseCoefficient = GetSelectText(driver.FindElement(By.Id("p_case_info__case_coefficient_id")));
+                }
+                catch (Exception ex)
+                {
+                    throw new Exception(ex.Message, ex);
+                }
+                finally
+                {
+                    killChromProcess();
+                }
             }
 
             return retObject;
@@ -331,60 +364,80 @@ namespace wispro.sp.utility
 
             retObject.CaseNo = caseNo;
             retObject.DoItem = doItemName;
-            
-            
-            using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath"), options))
+
+            using (var Service = ChromeDriverService.CreateDefaultService(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath")))
             {
 
-                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
-                driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(100);
+                Service.Start();
+                using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(Service, options))
+                {
+                    try
+                    {
+                        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
+                        driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(100);
 
-                
-                //进入登录界面
-                driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
 
-                //输入用户名和密码
-                driver.FindElement(By.Id("txtUser")).SendKeys(Account);
-                driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
+                        //进入登录界面
+                        driver.Navigate().GoToUrl(ConfigHelper.GetSectionValue("IPEasySetting:IPEasyWeb"));
 
-                //点击登录按钮
-                driver.FindElement(By.Id("btnLogin")).Click();
+                        //输入用户名和密码
+                        driver.FindElement(By.Id("txtUser")).SendKeys(Account);
+                        driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
 
-                //关闭提示遮罩层
-                driver.FindElement(By.Id("jpwClose")).Click();
+                        //点击登录按钮
+                        driver.FindElement(By.Id("btnLogin")).Click();
 
-                //点击顶部菜单栏中的案件管理菜单
-                driver.FindElement(By.Name("71A7CC35-F597-40E1-9FEF-BE622A3A3B63")).Click();
-                System.Threading.Thread.Sleep(500);
+                        //关闭提示遮罩层
+                        driver.FindElement(By.Id("jpwClose")).Click();
 
-                //点击左侧 查询 菜单
-                driver.FindElement(By.Name("c3266ab3-521a-4815-8aaf-7dd0bc5a76af")).Click();
-                System.Threading.Thread.Sleep(500);
-                //切换到自定义报表Frame
-                driver.SwitchTo().Frame(1);
+                        //点击顶部菜单栏中的案件管理菜单
+                        driver.FindElement(By.Name("71A7CC35-F597-40E1-9FEF-BE622A3A3B63")).Click();
+                        System.Threading.Thread.Sleep(500);
 
-                var inputSearch = driver.FindElement(By.Id("case_volume"));
-                inputSearch.SendKeys(caseNo);
+                        //点击左侧 查询 菜单
+                        driver.FindElement(By.Name("c3266ab3-521a-4815-8aaf-7dd0bc5a76af")).Click();
+                        System.Threading.Thread.Sleep(500);
+                        //切换到自定义报表Frame
+                        driver.SwitchTo().Frame(1);
 
-                var btnSearch = driver.FindElement(By.Id("btn_Search"));
-                btnSearch.Click();
-                System.Threading.Thread.Sleep(500);
+                        var inputSearch = driver.FindElement(By.Id("case_volume"));
+                        inputSearch.SendKeys(caseNo);
 
-                var caseLink = driver.FindElement(By.XPath($"//a[normalize-space()='{caseNo}']"));
-                caseLink.Click();
-                System.Threading.Thread.Sleep(500);
+                        var btnSearch = driver.FindElement(By.Id("btn_Search"));
+                        btnSearch.Click();
+                        System.Threading.Thread.Sleep(500);
 
-                driver.SwitchTo().ParentFrame().SwitchTo().Frame(2);
-                var DoItemLinks = driver.FindElements(By.XPath($"//td[@colname='ctrl_proc'][normalize-space()='{doItemName}']"));
-                if (DoItemLinks.Count > 0)
-                {
-                    if (!string.IsNullOrEmpty(caseStage))
-                    {
-                        foreach(var DoItemLink in DoItemLinks)
+                        var caseLink = driver.FindElement(By.XPath($"//a[normalize-space()='{caseNo}']"));
+                        caseLink.Click();
+                        System.Threading.Thread.Sleep(500);
+
+                        driver.SwitchTo().ParentFrame().SwitchTo().Frame(2);
+                        var DoItemLinks = driver.FindElements(By.XPath($"//td[@colname='ctrl_proc'][normalize-space()='{doItemName}']"));
+                        if (DoItemLinks.Count > 0)
                         {
-                            var temCaseStage = DoItemLink.FindElement(By.XPath("following-sibling::td[1]")).Text;
-                            if(temCaseStage == caseStage)
+                            if (!string.IsNullOrEmpty(caseStage))
+                            {
+                                foreach (var DoItemLink in DoItemLinks)
+                                {
+                                    var temCaseStage = DoItemLink.FindElement(By.XPath("following-sibling::td[1]")).Text;
+                                    if (temCaseStage == caseStage)
+                                    {
+                                        retObject.CaseStage = DoItemLink.FindElement(By.XPath("following-sibling::td[1]")).Text; //案件阶段
+                                        retObject.DoItemState = DoItemLink.FindElement(By.XPath("following-sibling::td[2]")).Text;    //处理事项处理状态
+                                        retObject.InternalDate = DoItemLink.FindElement(By.XPath("following-sibling::td[4]")).Text;   //内部期限
+                                        retObject.CustomerLimitDate = DoItemLink.FindElement(By.XPath("following-sibling::td[5]")).Text;   //客户期限
+                                        retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text;   //处理事项完成日
+                                        retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text;   //处理人
+                                        retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text;   //处理事项备注
+
+                                        DoItemLink.Click();
+                                        break;
+                                    }
+                                }
+                            }
+                            else
                             {
+                                var DoItemLink = DoItemLinks[DoItemLinks.Count - 1];
                                 retObject.CaseStage = DoItemLink.FindElement(By.XPath("following-sibling::td[1]")).Text; //案件阶段
                                 retObject.DoItemState = DoItemLink.FindElement(By.XPath("following-sibling::td[2]")).Text;    //处理事项处理状态
                                 retObject.InternalDate = DoItemLink.FindElement(By.XPath("following-sibling::td[4]")).Text;   //内部期限
@@ -393,59 +446,78 @@ namespace wispro.sp.utility
                                 retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text;   //处理人
                                 retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text;   //处理事项备注
 
+
                                 DoItemLink.Click();
-                                break;
                             }
                         }
-                    }
-                    else
-                    {
-                        var DoItemLink = DoItemLinks[DoItemLinks.Count - 1];
-                        retObject.CaseStage = DoItemLink.FindElement(By.XPath("following-sibling::td[1]")).Text; //案件阶段
-                        retObject.DoItemState = DoItemLink.FindElement(By.XPath("following-sibling::td[2]")).Text;    //处理事项处理状态
-                        retObject.InternalDate = DoItemLink.FindElement(By.XPath("following-sibling::td[4]")).Text;   //内部期限
-                        retObject.CustomerLimitDate = DoItemLink.FindElement(By.XPath("following-sibling::td[5]")).Text;   //客户期限
-                        retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text;   //处理事项完成日
-                        retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text;   //处理人
-                        retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text;   //处理事项备注
-                        
-
-                        DoItemLink.Click();
-                    }
-                }
-                
-                System.Threading.Thread.Sleep(500);
 
-                retObject.FinalizationDate = driver.FindElement(By.Id("p_proc_info__finish_doc_date")).GetAttribute("value");   //定稿日
-                retObject.ReturnDate = driver.FindElement(By.Id("p_proc_info__back_date")).GetAttribute("value");               //返稿日
-                retObject.Reviewer = driver.FindElement(By.Id("p_proc_info__revise_user")).GetAttribute("value");               //核稿人
-                retObject.DoItemCoefficient = driver.FindElement(By.Id("p_proc_info__proc_coefficient")).GetAttribute("value"); //处理事项系数
-                retObject.WordCount = driver.FindElement(By.Id("p_proc_info__translate_count")).GetAttribute("value");          //翻译字数
+                        System.Threading.Thread.Sleep(500);
+
+                        retObject.FinalizationDate = driver.FindElement(By.Id("p_proc_info__finish_doc_date")).GetAttribute("value");   //定稿日
+                        retObject.ReturnDate = driver.FindElement(By.Id("p_proc_info__back_date")).GetAttribute("value");               //返稿日
+                        retObject.Reviewer = driver.FindElement(By.Id("p_proc_info__revise_user")).GetAttribute("value");               //核稿人
+                        retObject.DoItemCoefficient = driver.FindElement(By.Id("p_proc_info__proc_coefficient")).GetAttribute("value"); //处理事项系数
+                        retObject.WordCount = driver.FindElement(By.Id("p_proc_info__translate_count")).GetAttribute("value");          //翻译字数
+
 
+                        driver.FindElement(By.Id("libase")).Click();
+                        System.Threading.Thread.Sleep(500);
+                        retObject.CaseName = driver.FindElement(By.Id("p_case_info__case_name")).GetAttribute("value");  //案件名称
+                        retObject.CustomerName = driver.FindElement(By.Id("p_case_info__customer_id")).GetAttribute("value");  //客户名称
+                        retObject.BusinessType = driver.FindElement(By.Id("p_case_info__business_type_id")).GetAttribute("value");     //业务类型
 
-                driver.FindElement(By.Id("libase")).Click();
-                System.Threading.Thread.Sleep(500);
-                retObject.CaseName = driver.FindElement(By.Id("p_case_info__case_name")).GetAttribute("value");  //案件名称
-                retObject.CustomerName = driver.FindElement(By.Id("p_case_info__customer_id")).GetAttribute("value");  //客户名称
-                retObject.BusinessType = driver.FindElement(By.Id("p_case_info__business_type_id")).GetAttribute("value");     //业务类型
+                        retObject.CaseState = GetSelectText(driver.FindElement(By.Id("p_case_info__case_status_id")));
+                        retObject.ApplicationType = GetSelectText(driver.FindElement(By.Id("p_case_info__apply_type_id")));
 
-                retObject.CaseState = GetSelectText(driver.FindElement(By.Id("p_case_info__case_status_id")));
-                retObject.ApplicationType = GetSelectText(driver.FindElement(By.Id("p_case_info__apply_type_id")));
-                
 
-                retObject.CaseType = driver.FindElement(By.Id("p_case_info__case_type_id")).GetAttribute("value");  //案件类型
-                retObject.EntrustingDate = driver.FindElement(By.Id("p_case_info__charge_date")).GetAttribute("value"); //委案日期
-                retObject.CaseMemo = driver.FindElement(By.Id("p_case_info__remark")).GetAttribute("value");    //案件备注
+                        retObject.CaseType = driver.FindElement(By.Id("p_case_info__case_type_id")).GetAttribute("value");  //案件类型
+                        retObject.EntrustingDate = driver.FindElement(By.Id("p_case_info__charge_date")).GetAttribute("value"); //委案日期
+                        retObject.CaseMemo = driver.FindElement(By.Id("p_case_info__remark")).GetAttribute("value");    //案件备注
+
+                        driver.FindElement(By.XPath($"//span[contains(text(),'扩展信息')]")).Click();
+                        //select[@id='p_case_info__case_coefficient_id']
+                        retObject.CaseCoefficient = GetSelectText(driver.FindElement(By.Id("p_case_info__case_coefficient_id")));
+                    }
+                    catch (Exception ex)
+                    {
+                        throw new Exception(ex.Message, ex);
+                    }
+                    finally
+                    {
+                        killChromProcess();
 
-                driver.FindElement(By.XPath($"//span[contains(text(),'扩展信息')]")).Click();
-                //select[@id='p_case_info__case_coefficient_id']
-                retObject.CaseCoefficient = GetSelectText(driver.FindElement(By.Id("p_case_info__case_coefficient_id")));
+                    }
+                }
 
+                Service.Dispose();
             }
 
             return retObject;
         }
 
+        private static void killChromProcess()
+        {
+            try
+            {
+                Process[] workers = Process.GetProcessesByName("Chrome");
+                foreach (Process worker in workers)
+                {
+                    worker.Kill();
+                    worker.WaitForExit();
+                    worker.Dispose();
+                }
+
+                workers = Process.GetProcessesByName("Chromedriver");
+                foreach (Process worker in workers)
+                {
+                    worker.Kill();
+                    worker.WaitForExit();
+                    worker.Dispose();
+                }
+            }
+            catch { }
+        }
+
         private static string GetSelectText(IWebElement element)
         {
             var strValue = element.GetAttribute("value");

+ 4 - 0
wispro.sp.web/Pages/Organization/Department.razor

@@ -147,6 +147,10 @@
             <Switch @bind-Value="@context.IsCalPerformsnce" />
         </FormItem>
 
+        <FormItem Label="是否在职">
+            <Switch @bind-Value="@context.IsOnJob" />
+        </FormItem>
+
         <FormItem Label="工程师等级">
             <wispro.sp.web.Components.UserGradeSelect @bind-StaffGradeId="@EditingStaff.StaffGradeId" />
         </FormItem>

+ 52 - 19
wispro.sp.winClient/Form1.Designer.cs

@@ -32,14 +32,17 @@ namespace wispro.sp.winClient
             this.button1 = new System.Windows.Forms.Button();
             this.button2 = new System.Windows.Forms.Button();
             this.button3 = new System.Windows.Forms.Button();
-            this.button4 = new System.Windows.Forms.Button();
+            this.button5 = new System.Windows.Forms.Button();
+            this.button6 = new System.Windows.Forms.Button();
+            this.button7 = new System.Windows.Forms.Button();
             this.SuspendLayout();
             // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(52, 69);
+            this.button1.Location = new System.Drawing.Point(61, 80);
+            this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(257, 68);
+            this.button1.Size = new System.Drawing.Size(304, 79);
             this.button1.TabIndex = 0;
             this.button1.Text = "合并反馈文档";
             this.button1.UseVisualStyleBackColor = true;
@@ -47,9 +50,10 @@ namespace wispro.sp.winClient
             // 
             // button2
             // 
-            this.button2.Location = new System.Drawing.Point(351, 69);
+            this.button2.Location = new System.Drawing.Point(415, 80);
+            this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button2.Name = "button2";
-            this.button2.Size = new System.Drawing.Size(257, 68);
+            this.button2.Size = new System.Drawing.Size(304, 79);
             this.button2.TabIndex = 0;
             this.button2.Text = "输入绩效基本点数";
             this.button2.UseVisualStyleBackColor = true;
@@ -57,34 +61,61 @@ namespace wispro.sp.winClient
             // 
             // button3
             // 
-            this.button3.Location = new System.Drawing.Point(634, 69);
+            this.button3.Location = new System.Drawing.Point(749, 80);
+            this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(257, 68);
+            this.button3.Size = new System.Drawing.Size(304, 79);
             this.button3.TabIndex = 0;
             this.button3.Text = "计算绩效";
             this.button3.UseVisualStyleBackColor = true;
             this.button3.Click += new System.EventHandler(this.button3_Click);
             // 
-            // button4
+            // button5
             // 
-            this.button4.Location = new System.Drawing.Point(295, 164);
-            this.button4.Name = "button4";
-            this.button4.Size = new System.Drawing.Size(171, 45);
-            this.button4.TabIndex = 1;
-            this.button4.Text = "测试IPEasy";
-            this.button4.UseVisualStyleBackColor = true;
-            this.button4.Click += new System.EventHandler(this.button4_Click);
+            this.button5.Location = new System.Drawing.Point(318, 186);
+            this.button5.Margin = new System.Windows.Forms.Padding(4);
+            this.button5.Name = "button5";
+            this.button5.Size = new System.Drawing.Size(202, 52);
+            this.button5.TabIndex = 1;
+            this.button5.Text = "获取绩效报表";
+            this.button5.UseVisualStyleBackColor = true;
+            this.button5.Click += new System.EventHandler(this.button5_Click);
+            // 
+            // button6
+            // 
+            this.button6.Location = new System.Drawing.Point(584, 186);
+            this.button6.Margin = new System.Windows.Forms.Padding(4);
+            this.button6.Name = "button6";
+            this.button6.Size = new System.Drawing.Size(202, 52);
+            this.button6.TabIndex = 1;
+            this.button6.Text = "更新绩效数据";
+            this.button6.UseVisualStyleBackColor = true;
+            this.button6.Click += new System.EventHandler(this.button6_Click);
+            // 
+            // button7
+            // 
+            this.button7.Location = new System.Drawing.Point(850, 186);
+            this.button7.Margin = new System.Windows.Forms.Padding(4);
+            this.button7.Name = "button7";
+            this.button7.Size = new System.Drawing.Size(202, 52);
+            this.button7.TabIndex = 1;
+            this.button7.Text = "发送疑似问题通知";
+            this.button7.UseVisualStyleBackColor = true;
+            this.button7.Click += new System.EventHandler(this.button7_Click);
             // 
             // Form1
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 28F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(925, 215);
-            this.Controls.Add(this.button4);
+            this.ClientSize = new System.Drawing.Size(1093, 251);
+            this.Controls.Add(this.button7);
+            this.Controls.Add(this.button6);
+            this.Controls.Add(this.button5);
             this.Controls.Add(this.button3);
             this.Controls.Add(this.button2);
             this.Controls.Add(this.button1);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "Form1";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "人力绩效计算工具";
@@ -97,7 +128,9 @@ namespace wispro.sp.winClient
         private System.Windows.Forms.Button button1;
         private System.Windows.Forms.Button button2;
         private System.Windows.Forms.Button button3;
-        private System.Windows.Forms.Button button4;
+        private System.Windows.Forms.Button button5;
+        private System.Windows.Forms.Button button6;
+        private System.Windows.Forms.Button button7;
     }
 }
 

+ 47 - 2
wispro.sp.winClient/Form1.cs

@@ -188,8 +188,9 @@ namespace wispro.sp.winClient
        
         private async void button3_Click(object sender, EventArgs e)
         {
+            await StartImport();
             //await RemoveDBNotFinishedDate();
-            await CalJXPoint();
+            //await CalJXPoint();
             //await RefreshPerformanceItem(3);
             //await UpdateStaff();
 
@@ -587,6 +588,19 @@ namespace wispro.sp.winClient
 
         }
 
+        private async Task StartImport()
+        {
+            if (Token == null)
+            {
+                await Login();
+            }
+
+            HttpClient http = CreateHttp();//
+            http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
+            var data = await http.GetFromJsonAsync<ApiSaveResponse>($"{strAPIBaseUri}/api/SystemData/StartImportData");
+            
+        }
+
         private async Task CalJXPoint()
         {
             if (Token == null)
@@ -940,7 +954,7 @@ namespace wispro.sp.winClient
             return retStr;
         }
 
-        string strAPIBaseUri = "http://47.106.221.167:8081"; //  "http://localhost:39476";// 
+        string strAPIBaseUri = "http://47.106.221.167:8081"; //   "http://localhost:39476";// 
 
         userToken Token;
 
@@ -1296,5 +1310,36 @@ namespace wispro.sp.winClient
             ////每月绩效统计--中国一次OA授权表
             //NewMethod("72454834-afdd-4b98-b42a-0bc912d07610", "每月绩效统计--中国一次OA授权表.xlsx", calMonth, true);
         }
+
+        private async void button5_Click(object sender, EventArgs e)
+        {
+            await StartImport();
+        }
+
+        private async void button6_Click(object sender, EventArgs e)
+        {
+            if (Token == null)
+            {
+                await Login();
+            }
+
+            HttpClient http = CreateHttp();//
+            http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
+            var data = await http.GetFromJsonAsync<ApiSaveResponse>($"{strAPIBaseUri}/api/SystemData/UpdateJXData");
+
+        }
+
+        private async void button7_Click(object sender, EventArgs e)
+        {
+            if (Token == null)
+            {
+                await Login();
+            }
+
+            HttpClient http = CreateHttp();//
+            http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
+            var data = await http.GetFromJsonAsync<ApiSaveResponse>($"{strAPIBaseUri}/api/SystemData/SendInvaldDataMessage");
+
+        }
     }
 }