|
@@ -1,4 +1,5 @@
|
|
using DynamicExpresso;
|
|
using DynamicExpresso;
|
|
|
|
+using Microsoft.Data.SqlClient;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Quartz;
|
|
using Quartz;
|
|
using System;
|
|
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授权表
|
|
//每月绩效统计--中国一次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;
|
|
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)
|
|
private void DownloadReport(string ReportName,CalMonth calMonth,bool isModifyDate,bool isFirstOA=false)
|
|
{
|
|
{
|
|
string strFileSavePath = utility.ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
|
|
string strFileSavePath = utility.ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
|
|
@@ -138,9 +157,55 @@ namespace wispro.sp.api.Job
|
|
}
|
|
}
|
|
|
|
|
|
System.Threading.Thread.Sleep(5000);
|
|
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)
|
|
private void DownloadProject(CalMonth calMonth)
|
|
@@ -174,18 +239,38 @@ namespace wispro.sp.api.Job
|
|
string strFilePath = System.IO.Path.Combine(strFileSavePath, filename);
|
|
string strFilePath = System.IO.Path.Combine(strFileSavePath, filename);
|
|
string strFinalPath = System.IO.Path.Combine(strFileSavePath, $"{calMonth.Year}{calMonth.Month}-{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>();
|
|
//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)
|
|
private List<PerformanceItem> GetProjectItem(string strPath,CalMonth calMonth,bool isOpenSheet)
|
|
{
|
|
{
|
|
DataTable dt = NPOIExcel.ExcelToDataTable(strPath, true, true, 1);
|
|
DataTable dt = NPOIExcel.ExcelToDataTable(strPath, true, true, 1);
|
|
|
|
+ return GetProjectItem(calMonth, isOpenSheet, dt);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private List<PerformanceItem> GetProjectItem(CalMonth calMonth, bool isOpenSheet, DataTable dt)
|
|
|
|
+ {
|
|
#region 删除重复行
|
|
#region 删除重复行
|
|
DataTable temdt = new DataTable();
|
|
DataTable temdt = new DataTable();
|
|
foreach (DataColumn col in dt.Columns)
|
|
foreach (DataColumn col in dt.Columns)
|
|
@@ -275,11 +364,14 @@ namespace wispro.sp.api.Job
|
|
return Items;
|
|
return Items;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
private Task InputPerformanceItem(string strExcelFile, bool isColumnName, bool ignorHideRows = false, int ColumnNameRow = 0, CalMonth calMonth = null, bool isFirstOAFile = false)
|
|
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);
|
|
DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName, ignorHideRows, ColumnNameRow);
|
|
|
|
+ return InputPerformanctItem(calMonth, isFirstOAFile, dt);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private Task InputPerformanctItem(CalMonth calMonth, bool isFirstOAFile, DataTable dt)
|
|
|
|
+ {
|
|
#region 删除重复行
|
|
#region 删除重复行
|
|
DataTable temdt = new DataTable();
|
|
DataTable temdt = new DataTable();
|
|
foreach (DataColumn col in dt.Columns)
|
|
foreach (DataColumn col in dt.Columns)
|
|
@@ -305,11 +397,11 @@ namespace wispro.sp.api.Job
|
|
PerformanceItem item = null;
|
|
PerformanceItem item = null;
|
|
if (isFirstOAFile)
|
|
if (isFirstOAFile)
|
|
{
|
|
{
|
|
- item = Row2Item_1(row, calMonth);
|
|
|
|
|
|
+ item = Row2Item_1(row, calMonth);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- item = Row2Item(row, calMonth);
|
|
|
|
|
|
+ item = Row2Item(row, calMonth);
|
|
}
|
|
}
|
|
|
|
|
|
if (item != null)
|
|
if (item != null)
|
|
@@ -322,7 +414,7 @@ namespace wispro.sp.api.Job
|
|
//}
|
|
//}
|
|
|
|
|
|
SavePerformanceItem(item, rules);
|
|
SavePerformanceItem(item, rules);
|
|
-
|
|
|
|
|
|
+
|
|
strDebug = $"{strDebug}\t保存成功";
|
|
strDebug = $"{strDebug}\t保存成功";
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -999,5 +1091,344 @@ namespace wispro.sp.api.Job
|
|
|
|
|
|
return null;
|
|
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;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|