ImportReportJob.cs 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  1. using DynamicExpresso;
  2. using Microsoft.Data.SqlClient;
  3. using Microsoft.Extensions.DependencyInjection;
  4. using NPOI.SS.Formula.Functions;
  5. using Quartz;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Configuration;
  9. using System.Data;
  10. using System.IO;
  11. using System.Linq;
  12. using System.Net.Http;
  13. using System.Threading.Tasks;
  14. using System.Xml.Serialization;
  15. using wispro.sp.entity;
  16. using wispro.sp.utility;
  17. using static System.Net.WebRequestMethods;
  18. namespace wispro.sp.api.Job
  19. {
  20. public class ImportReportJob : Quartz.IJob
  21. {
  22. /// <summary>
  23. /// 不需要计算绩效的处理事项
  24. /// </summary>
  25. private string[] InValidDoItem = new string[]
  26. {
  27. "案件异常-催缴年费",
  28. "案件异常-视为放弃取得专利权",
  29. "办理登记手续",
  30. "办理登记手续-确认客户是否委托",
  31. "代理所变更",
  32. "绘图",
  33. "技术确认",
  34. "缴年费",
  35. "请求保密审查",
  36. "请求费减",
  37. "请求实审",
  38. "取得申请号",
  39. "取得证书",
  40. "取得专利权评价报告",
  41. "确认官方审查状况",
  42. "询问放弃或复审",
  43. "知识点总结",
  44. "专利权人发明人申请人信息变更",
  45. "专利挖掘与布局",
  46. "我方文号前缀带J",
  47. "开卷",
  48. "请求提前公开",
  49. "取得国际检索报告",
  50. "委外检索",
  51. "中止程序",
  52. "终止",
  53. "案件异常-视为撤回",
  54. "进入国家阶段提醒",
  55. "请求恢复权利",
  56. "请求优先权",
  57. "取得【无效宣告请求审查决定】",
  58. "撤回",
  59. "请求退款",
  60. "确认是否委托申请与类型",
  61. "专利交易",
  62. "专利权评价报告",
  63. "专利权人发明人申请人信息变更+代理所变更",
  64. "补缴费用"
  65. };
  66. spDbContext spDb = new spDbContext();
  67. public Task ImportData(int i)
  68. {
  69. CalMonth calMonth = new CalMonth()
  70. {
  71. Year = DateTime.Now.AddMonths(-1).Year,
  72. Month = DateTime.Now.AddMonths(-1).Month,
  73. Status = 0
  74. };
  75. var temCalMonth = spDb.CalMonths.Where<CalMonth>(x => x.Year == calMonth.Year && x.Month == calMonth.Month).FirstOrDefault();
  76. if (temCalMonth != null)
  77. {
  78. var iCount = spDb.PerformanceItems.Where<PerformanceItem>(p => p.CalMonthId == temCalMonth.Id).Count<PerformanceItem>();
  79. calMonth = temCalMonth;
  80. }
  81. else
  82. {
  83. spDb.CalMonths.Add(calMonth);
  84. spDb.SaveChanges();
  85. }
  86. switch (i)
  87. {
  88. case 0:
  89. DownloadReport_SQL("每月绩效统计--发客户超过一个月未完成案件", calMonth, false);
  90. break;
  91. case 1:
  92. DownloadReport_SQL("每月绩效统计--上个月递交完成案件", calMonth, true);
  93. break;
  94. case 2:
  95. DownloadReport_SQL("每月绩效统计--中国一次OA授权表", calMonth, true, true);
  96. break;
  97. }
  98. return Task.CompletedTask;
  99. }
  100. public Task Execute(IJobExecutionContext context)
  101. {
  102. CalMonth calMonth = new CalMonth()
  103. {
  104. Year = DateTime.Now.AddMonths(-1).Year,
  105. Month = DateTime.Now.AddMonths(-1).Month,
  106. Status = 0
  107. };
  108. var temCalMonth = spDb.CalMonths.Where<CalMonth>(x => x.Year == calMonth.Year && x.Month == calMonth.Month).FirstOrDefault();
  109. if (temCalMonth != null)
  110. {
  111. var iCount = spDb.PerformanceItems.Where<PerformanceItem>(p => p.CalMonthId == temCalMonth.Id).Count<PerformanceItem>();
  112. if (iCount > 0)
  113. {
  114. return Task.CompletedTask;
  115. }
  116. calMonth = temCalMonth;
  117. }
  118. else
  119. {
  120. spDb.CalMonths.Add(calMonth);
  121. spDb.SaveChanges();
  122. }
  123. //每月绩效统计--发客户超过一个月未完成案件
  124. //DownloadReport_SQL("每月绩效统计--发客户超过一个月未完成案件", calMonth, false);
  125. //DownloadReport( "每月绩效统计--发客户超过一个月未完成案件", calMonth,false);
  126. //每月绩效统计--上个月递交完成案件
  127. DownloadReport_SQL("每月绩效统计--上个月递交完成案件", calMonth, true);
  128. //DownloadReport("每月绩效统计--上个月递交完成案件", calMonth, true);
  129. //每月绩效统计--中国一次OA授权表
  130. DownloadReport_SQL("每月绩效统计--中国一次OA授权表", calMonth, true, true);
  131. //DownloadReport("每月绩效统计--中国一次OA授权表", calMonth, true,true);
  132. return Task.CompletedTask;
  133. }
  134. private void DownloadReport_SQL(string ReportName, CalMonth calMonth, bool isModifyDate, bool isFirstOA = false)
  135. {
  136. try
  137. {
  138. DataTable data = GetDataFromIPEasy(ReportName,isModifyDate);
  139. InputPerformanctItem(calMonth, isFirstOA, data);
  140. }
  141. catch
  142. {
  143. }
  144. }
  145. private Task InputPerformanceItem(string strExcelFile, bool isColumnName, bool ignorHideRows = false, int ColumnNameRow = 0, CalMonth calMonth = null, bool isFirstOAFile = false)
  146. {
  147. DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName, ignorHideRows, ColumnNameRow);
  148. return InputPerformanctItem(calMonth, isFirstOAFile, dt);
  149. }
  150. private Task InputPerformanctItem(CalMonth calMonth, bool isFirstOAFile, DataTable dt)
  151. {
  152. if(dt == null)
  153. {
  154. return Task.CompletedTask;
  155. }
  156. #region 删除重复行
  157. DataTable temdt = new DataTable();
  158. foreach (DataColumn col in dt.Columns)
  159. {
  160. DataColumn temCol = new DataColumn();
  161. temCol.ColumnName = col.ColumnName;
  162. temCol.DataType = col.DataType;
  163. temCol.Caption = col.Caption;
  164. temdt.Columns.Add(temCol);
  165. }
  166. new ExcelHelper().MerageDataTable(temdt, dt);
  167. #endregion
  168. List<BasePointRule> rules = spDb.BasePointRules.ToList<BasePointRule>();
  169. int iRow = 0;
  170. foreach (DataRow row in temdt.Rows)
  171. {
  172. string strDebug = $"{++iRow}\t{row["我方文号"]}";
  173. PerformanceItem item = null;
  174. if (isFirstOAFile)
  175. {
  176. item = Row2Item_1(row, calMonth);
  177. }
  178. else
  179. {
  180. item = Row2Item(row, calMonth);
  181. }
  182. if (item != null)
  183. {
  184. if (!InValidDoItem.Contains(item.DoItem) && !isDBNotFinishedDate(item))
  185. {
  186. //foreach(var temObj in item.ItemStaffs)
  187. //{
  188. // temObj.DoPerson.Name = temObj.DoPerson.Name.Replace("-君龙", "");
  189. //}
  190. SavePerformanceItem(item, rules);
  191. strDebug = $"{strDebug}\t保存成功";
  192. }
  193. else
  194. {
  195. strDebug = $"{strDebug}\t无效处理事项";
  196. }
  197. }
  198. else
  199. {
  200. strDebug = $"{strDebug}\t转换Item为Null";
  201. }
  202. System.Diagnostics.Debug.WriteLine(strDebug);
  203. }
  204. return Task.CompletedTask;
  205. }
  206. private bool isDBNotFinishedDate(PerformanceItem item)
  207. {
  208. return (item.DoItem == "处理审查意见" && item.FinishedDate == null);
  209. }
  210. private Task SavePerformanceItem(PerformanceItem item,List<BasePointRule> rules)
  211. {
  212. try
  213. {
  214. Utility.Utility.CalBasePoint(item, rules);
  215. var ret= new Controllers.PerformanceItemController(new spDbContext(),new Services.FileTaskCacheService()).New(item);
  216. if (ret.Success == false)
  217. {
  218. System.Diagnostics.Debug.WriteLine(ret.ErrorMessage);
  219. }
  220. }
  221. catch (Exception ex)
  222. {
  223. System.Diagnostics.Debug.WriteLine(ex.Message);
  224. }
  225. return Task.CompletedTask;
  226. }
  227. private PerformanceItem Row2Item_1(DataRow row, CalMonth calMonth)
  228. {
  229. PerformanceItem item = new PerformanceItem();
  230. item.ApplicationType = row["申请类型"].ToString().Trim();
  231. if (item.ApplicationType != "发明")
  232. {
  233. return null;
  234. }
  235. item.CaseNo = row["我方文号"].ToString().Trim();
  236. if (item.CaseNo.StartsWith("S"))
  237. {
  238. return null;
  239. }
  240. if (calMonth != null)
  241. {
  242. item.CalMonth = calMonth;
  243. }
  244. else
  245. {
  246. if (row.Table.Columns.Contains("绩效核算月份"))
  247. {
  248. string strjxyf = row["绩效核算月份"].ToString().Trim();
  249. string[] temYFs = strjxyf.Split(new char[] { '.' });
  250. item.CalMonth = new CalMonth();
  251. item.CalMonth.Year = int.Parse(temYFs[0]);
  252. item.CalMonth.Month = int.Parse(temYFs[1]);
  253. item.CalMonth.Status = 4;
  254. }
  255. else
  256. {
  257. item.CalMonth = new CalMonth();
  258. item.Status = 0;
  259. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  260. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  261. }
  262. }
  263. item.ApplicationType = row["申请类型"].ToString().Trim();
  264. item.BusinessType = "普通新申请"; // row["业务类型"].ToString().Trim();
  265. item.AgentFeedbackMemo = "发明一次OA授权"; //row["备注(填表注意事项)"].ToString().Trim();
  266. item.DoItem = "发明一次OA授权"; //row["处理事项"].ToString().Trim();
  267. string strHandler = "";
  268. if (row.Table.Columns.Contains("处理人"))
  269. {
  270. strHandler = row["处理人"].ToString().Trim();
  271. }
  272. else
  273. {
  274. if (row.Table.Columns.Contains("案件处理人"))
  275. {
  276. strHandler = row["案件处理人"].ToString().Trim();
  277. }
  278. else
  279. {
  280. if (row.Table.Columns.Contains("处理事项处理人"))
  281. {
  282. strHandler = row["处理事项处理人"].ToString().Trim();
  283. }
  284. }
  285. }
  286. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  287. item.ItemStaffs = new List<ItemStaff>();
  288. foreach (string name in temHandlers)
  289. {
  290. ItemStaff itemStaff = new ItemStaff();
  291. string temName = name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  292. if (!name.Contains("君龙"))
  293. {
  294. temName = name.Trim();
  295. }
  296. int? iTem = GetStaff(temName);
  297. if ((iTem != null))
  298. {
  299. //itemStaff.Item = item;
  300. itemStaff.DoPersonId = iTem.Value;
  301. item.ItemStaffs.Add(itemStaff);
  302. }
  303. else
  304. {
  305. itemStaff.DoPerson = new Staff()
  306. {
  307. Name = temName,
  308. Account = temName,
  309. Password = utility.MD5Utility.GetMD5("12345678"),
  310. IsCalPerformsnce = false,
  311. Status = "试用期",
  312. StaffGradeId = 4
  313. };
  314. item.ItemStaffs.Add(itemStaff);
  315. }
  316. }
  317. if (item.ItemStaffs.Count == 0)
  318. {
  319. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  320. }
  321. if (row.Table.Columns.Contains("核稿人"))
  322. {
  323. item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim());
  324. }
  325. else
  326. {
  327. if (row.Table.Columns.Contains("案件核稿人"))
  328. {
  329. item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim());
  330. }
  331. }
  332. if (row.Table.Columns.Contains("业务人员"))
  333. {
  334. if (!string.IsNullOrEmpty(row["业务人员"].ToString().Trim()))
  335. {
  336. string name = row["业务人员"].ToString();
  337. string temName = row["业务人员"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  338. if (!name.Contains("君龙"))
  339. {
  340. temName = name.Trim();
  341. }
  342. item.WorkflowUserId = GetStaff(temName);
  343. }
  344. }
  345. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  346. item.ApplicationName = row["申请人"].ToString().Trim();
  347. item.CaseName = row["案件名称"].ToString().Trim();
  348. if (row.Table.Columns.Contains("国家(地区)"))
  349. {
  350. item.Country = row["国家(地区)"].ToString().Trim();
  351. }
  352. //案件备注
  353. item.CaseMemo = $"发文日期:{row["发文日期"].ToString().Trim()}\r\n客户文号:{row["客户文号"].ToString().Trim()}\r\n上传日期:{row["上传日期"].ToString().Trim()}\r\n文件描述:{row["文件描述"].ToString().Trim()}";
  354. if (row.Table.Columns.Contains("翻译字数"))
  355. {
  356. //item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim());
  357. var strWordCount = row["翻译字数"].ToString().Trim();
  358. if (string.IsNullOrEmpty(strWordCount))
  359. {
  360. try
  361. {
  362. item.WordCount = int.Parse(strWordCount);
  363. }
  364. catch { }
  365. }
  366. }
  367. return item;
  368. }
  369. private PerformanceItem Row2Item(DataRow row, CalMonth calMonth)
  370. {
  371. PerformanceItem item = new PerformanceItem();
  372. item.CaseNo = row["我方文号"].ToString().Trim();
  373. if (item.CaseNo.StartsWith("S"))
  374. {
  375. return null;
  376. }
  377. if (calMonth != null)
  378. {
  379. item.CalMonth = calMonth;
  380. }
  381. else
  382. {
  383. if (row.Table.Columns.Contains("绩效核算月份"))
  384. {
  385. string strjxyf = row["绩效核算月份"].ToString().Trim();
  386. string[] temYFs = strjxyf.Split(new char[] { '.' });
  387. item.CalMonth = new CalMonth();
  388. item.CalMonth.Year = int.Parse(temYFs[0]);
  389. item.CalMonth.Month = int.Parse(temYFs[1]);
  390. item.CalMonth.Status = 4;
  391. }
  392. else
  393. {
  394. item.CalMonth = new CalMonth();
  395. item.Status = 0;
  396. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  397. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  398. }
  399. }
  400. item.ApplicationType = row["申请类型"].ToString().Trim();
  401. item.BusinessType = row["业务类型"].ToString().Trim();
  402. if (row.Table.Columns.Contains("国家(地区)"))
  403. {
  404. item.Country = row["国家(地区)"].ToString().Trim();
  405. }
  406. if (row.Table.Columns.Contains("备注(填表注意事项)"))
  407. item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
  408. item.DoItem = row["处理事项"].ToString().Trim();
  409. item.CaseStage = row["案件阶段"].ToString().Trim();
  410. item.CaseCoefficient = row["案件系数"].ToString().Trim();
  411. item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
  412. item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim());
  413. string strHandler = "";
  414. if (row.Table.Columns.Contains("处理人"))
  415. {
  416. strHandler = row["处理人"].ToString().Trim();
  417. }
  418. else
  419. {
  420. if (row.Table.Columns.Contains("案件处理人"))
  421. {
  422. strHandler = row["案件处理人"].ToString().Trim();
  423. }
  424. }
  425. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  426. item.ItemStaffs = new List<ItemStaff>();
  427. foreach (string name in temHandlers)
  428. {
  429. ItemStaff itemStaff = new ItemStaff();
  430. string temName = name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  431. if (!name.Contains("君龙"))
  432. {
  433. temName = name.Trim();
  434. }
  435. int? iTem = GetStaff(temName);
  436. if ((iTem != null))
  437. {
  438. //itemStaff.Item = item;
  439. itemStaff.DoPersonId = iTem.Value;
  440. item.ItemStaffs.Add(itemStaff);
  441. }
  442. else
  443. {
  444. itemStaff.DoPerson = new Staff()
  445. {
  446. Name = temName,
  447. Account = temName,
  448. Password = utility.MD5Utility.GetMD5("12345678"),
  449. IsCalPerformsnce = false,
  450. Status = "试用期",
  451. StaffGradeId = 4
  452. };
  453. item.ItemStaffs.Add(itemStaff);
  454. }
  455. }
  456. if (item.ItemStaffs.Count == 0)
  457. {
  458. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  459. }
  460. if (row.Table.Columns.Contains("核稿人"))
  461. {
  462. if (!string.IsNullOrEmpty(row["核稿人"].ToString().Trim()))
  463. {
  464. string name = row["核稿人"].ToString();
  465. string temName = name.Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  466. if (!name.Contains("君龙"))
  467. {
  468. temName = name.Trim();
  469. }
  470. item.ReviewerId = GetStaff(temName);
  471. }
  472. }
  473. else
  474. {
  475. if (row.Table.Columns.Contains("案件核稿人"))
  476. {
  477. if (!string.IsNullOrEmpty(row["案件核稿人"].ToString().Trim()))
  478. {
  479. string name = row["案件核稿人"].ToString();
  480. string temName = row["案件核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  481. if (!name.Contains("君龙"))
  482. {
  483. temName = name.Trim();
  484. }
  485. item.ReviewerId = GetStaff(temName);
  486. }
  487. }
  488. }
  489. if (row.Table.Columns.Contains("业务人员"))
  490. {
  491. if (!string.IsNullOrEmpty(row["业务人员"].ToString().Trim()))
  492. {
  493. string name = row["业务人员"].ToString();
  494. string temName = row["业务人员"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  495. if (!name.Contains("君龙"))
  496. {
  497. temName = name.Trim();
  498. }
  499. item.WorkflowUserId = GetStaff(temName);
  500. }
  501. }
  502. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  503. item.ApplicationName = row["申请人"].ToString().Trim();
  504. DateTime temDate = new DateTime();
  505. if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
  506. {
  507. item.FinishedDate = temDate;
  508. }
  509. //定稿日
  510. if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
  511. {
  512. item.FinalizationDate = temDate;
  513. }
  514. //返稿日
  515. if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
  516. {
  517. item.ReturnDate = temDate;
  518. }
  519. //案件类型
  520. item.CaseType = row["案件类型"].ToString().Trim();
  521. //案件状态
  522. item.CaseState = row["案件状态"].ToString().Trim();
  523. //处理事项备注
  524. item.DoItemMemo = row["处理事项备注"].ToString().Trim();
  525. //处理状态
  526. item.DoItemState = row["处理状态"].ToString().Trim();
  527. //案件名称
  528. item.CaseName = row["案件名称"].ToString().Trim();
  529. //委案日期
  530. if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
  531. {
  532. item.EntrustingDate = temDate;
  533. }
  534. //客户期限
  535. if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
  536. {
  537. item.CustomerLimitDate = temDate;
  538. }
  539. //内部期限
  540. if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
  541. {
  542. item.InternalDate = temDate;
  543. }
  544. //初稿日
  545. if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
  546. {
  547. item.FirstDraftDate = temDate;
  548. }
  549. //备注(发文严重超期是否属客观原因,若为否,请填写原因)
  550. if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
  551. {
  552. item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
  553. }
  554. //案件备注
  555. item.CaseMemo = row["案件备注"].ToString().Trim();
  556. if (row.Table.Columns.Contains("翻译字数"))
  557. {
  558. //item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim());
  559. var strWordCount = row["翻译字数"].ToString().Trim();
  560. if (string.IsNullOrEmpty(strWordCount))
  561. {
  562. try
  563. {
  564. item.WordCount = int.Parse(strWordCount);
  565. }
  566. catch { }
  567. }
  568. }
  569. return item;
  570. }
  571. private int? GetStaff(string v)
  572. {
  573. if (!string.IsNullOrEmpty(v))
  574. {
  575. string temName = v.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  576. if (!v.Contains("君龙"))
  577. {
  578. temName = v;
  579. }
  580. var staff = spDb.Staffs.Where<Staff>(s => s.Name == temName).FirstOrDefault();
  581. if (staff != null)
  582. {
  583. return staff.Id;
  584. }
  585. }
  586. return null;
  587. }
  588. private DataTable GetDataFromIPEasy(string ReportName, bool isModifyDate)
  589. {
  590. try
  591. {
  592. return wispro.sp.utility.IPEasyUtility.DownloadReport(ReportName, isModifyDate);
  593. }
  594. catch {
  595. return null;
  596. }
  597. #region 利用维德系统服务器上的API获取
  598. // int iTry = 0;
  599. //tryAgain:
  600. // try
  601. // {
  602. // HttpClient http = new HttpClient();
  603. // var bytRespon = http.GetAsync($"{ConfigHelper.GetSectionValue("IPEasySetting:ipEeasyApi")}/api/ipEasy/GetDataFromIPEasy?ReportName={ReportName}&isModifyDate={isModifyDate}").Result;
  604. // if (bytRespon.IsSuccessStatusCode)
  605. // {
  606. // string result = bytRespon.Content.ReadAsStringAsync().Result.Replace("\"", string.Empty);
  607. // byte[] data = Convert.FromBase64String(result);
  608. // //byte[] data = bytRespon.Content.ReadAsByteArrayAsync().Result;//Here is the problem
  609. // XmlSerializer serializer = new XmlSerializer(typeof(System.Data.DataTable));
  610. // MemoryStream memory = new MemoryStream(data);
  611. // DataTable dt = (DataTable)serializer.Deserialize(memory);
  612. // return dt;
  613. // }
  614. // else
  615. // {
  616. // if (iTry < 3)
  617. // {
  618. // iTry++;
  619. // goto tryAgain;
  620. // }
  621. // }
  622. // }
  623. // catch (Exception ex)
  624. // {
  625. // if (iTry < 3)
  626. // {
  627. // iTry++;
  628. // goto tryAgain;
  629. // }
  630. // }
  631. // return null;
  632. #endregion
  633. #region old code 从维德数据库中直接读取
  634. // DataTable dt = new DataTable();
  635. // string strSQL = "";
  636. // switch (ReportName)
  637. // {
  638. // case "每月绩效统计--发客户超过一个月未完成案件":
  639. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  640. // i_apply_type.apply_type_zh_cn as 申请类型,
  641. // i_business_type.business_type_zh_cn as 业务类型,
  642. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  643. // (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage) as 案件阶段,
  644. // i_case_coefficient.case_coefficient_zh_cn as 案件系数,
  645. // i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
  646. // (select proc_coefficient_zh_cn from p_proc_info pr
  647. // left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id
  648. // where case_id=p_case_info.case_id and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  649. // and pr.seq=
  650. // (select max(seq) from p_proc_info pr where case_id=p_case_info.case_id
  651. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
  652. // ) as 前一次OA处理事项系数,
  653. // (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  654. // inner join s_user_info as u on u.user_id = pl.pic_id
  655. // inner join p_proc_info pr1 on pr1.proc_id=pl.obj_id
  656. // where case_id=p_case_info.case_id and
  657. // ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  658. // and pr1.seq=(
  659. // select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id
  660. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  661. // and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')) as 前一次OA处理人,
  662. // STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl
  663. // inner join s_user_info as u on u.user_id = pl.pic_id
  664. // left join i_user_rank ur on ur.rank_id=u.rank_id
  665. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人等级,
  666. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  667. // inner join s_user_info as u on u.user_id = pl.pic_id
  668. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人,
  669. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  670. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  671. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 核稿人,
  672. // c_customer.customer_name as 客户名称,
  673. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  674. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  675. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  676. // p_proc_info.finish_date as 处理事项完成日,
  677. // p_proc_info.finish_doc_date as 定稿日,
  678. // p_proc_info.back_date as 返稿日,
  679. // i_case_type.case_type_zh_cn as 案件类型,
  680. // i_case_status.case_status_zh_cn as 案件状态,
  681. // p_proc_info.proc_note as 处理事项备注,
  682. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  683. // p_case_info.case_name as 案件名称,
  684. // p_case_info.charge_date as 委案日期,
  685. // p_proc_info.cus_due_date as 客户期限,
  686. // p_proc_info.int_due_date as 内部期限,
  687. // p_proc_info.first_doc_date as 初稿日,
  688. // p_case_info.remark as 案件备注,
  689. // p_proc_info.translate_count as 翻译字数,
  690. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  691. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  692. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  693. // i_country.country_zh_cn as '国家(地区)'
  694. // from p_case_info
  695. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  696. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  697. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  698. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  699. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  700. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  701. // left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id
  702. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  703. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  704. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  705. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  706. // left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id
  707. // left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id
  708. // left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id
  709. // where
  710. // p_case_info.is_enabled=1 and p_proc_info.is_enabled=1 and
  711. // s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6') and
  712. // p_proc_info.finish_date is null
  713. // and p_proc_info.back_date<DATEADD(MM,-1,DATEADD(MM, DATEDIFF(MM,0,getdate()), 0)) and
  714. // (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' ) AND
  715. // ( i_ctrl_proc.ctrl_proc_zh_cn='新申请'
  716. // or i_ctrl_proc.ctrl_proc_zh_cn='Non'
  717. // or i_ctrl_proc.ctrl_proc_zh_cn='无效宣告'
  718. // or i_ctrl_proc.ctrl_proc_zh_cn='意见陈述'
  719. // or i_ctrl_proc.ctrl_proc_zh_cn='专利挖掘与布局'
  720. // or i_ctrl_proc.ctrl_proc_zh_cn='处理审查意见'
  721. // or i_ctrl_proc.ctrl_proc_zh_cn='Final'
  722. // or i_ctrl_proc.ctrl_proc_zh_cn='复审通知意见陈述'
  723. // or i_ctrl_proc.ctrl_proc_zh_cn='申復'
  724. // or i_ctrl_proc.ctrl_proc_zh_cn='RCE'
  725. // or i_ctrl_proc.ctrl_proc_zh_cn='翻译'
  726. // or i_ctrl_proc.ctrl_proc_zh_cn='提出异议复审'
  727. // or i_ctrl_proc.ctrl_proc_zh_cn='Advisory'
  728. // or i_ctrl_proc.ctrl_proc_zh_cn='复审'
  729. // or i_ctrl_proc.ctrl_proc_zh_cn='请求复审'
  730. // or i_ctrl_proc.ctrl_proc_zh_cn='提出报告'
  731. // or i_ctrl_proc.ctrl_proc_zh_cn='提出公众意见'
  732. // or i_ctrl_proc.ctrl_proc_zh_cn='诉讼'
  733. // or i_ctrl_proc.ctrl_proc_zh_cn='提出异议'
  734. // or i_ctrl_proc.ctrl_proc_zh_cn='补充理由和证据'
  735. // or i_ctrl_proc.ctrl_proc_zh_cn='无效分析'
  736. // or i_ctrl_proc.ctrl_proc_zh_cn='无效答辩'
  737. // )";
  738. // break;
  739. // case "每月绩效统计--上个月递交完成案件":
  740. // strSQL = @"SELECT
  741. // p_case_info.case_volume as 我方文号,
  742. // i_apply_type.apply_type_zh_cn as 申请类型,
  743. // i_business_type.business_type_zh_cn as 业务类型,
  744. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  745. // (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage) as 案件阶段,
  746. // i_case_coefficient.case_coefficient_zh_cn as 案件系数,
  747. // i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
  748. // (select
  749. // proc_coefficient_zh_cn from p_proc_info pr
  750. // left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id
  751. // where case_id=p_case_info.case_id
  752. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  753. // and pr.seq=(select max(seq) from p_proc_info pr where case_id=p_case_info.case_id
  754. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
  755. // ) as 前一次OA处理事项系数,
  756. // (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  757. // inner join s_user_info as u on u.user_id = pl.pic_id
  758. // inner join p_proc_info pr1 on pr1.proc_id=pl.obj_id
  759. // where case_id=p_case_info.case_id
  760. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  761. // and pr1.seq=(select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id
  762. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')
  763. // ) as 前一次OA处理人,
  764. // STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl
  765. // inner join s_user_info as u on u.user_id = pl.pic_id
  766. // 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 处理人等级,
  767. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  768. // inner join s_user_info as u on u.user_id = pl.pic_id
  769. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人,
  770. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  771. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  772. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件核稿人,
  773. // c_customer.customer_name as 客户名称,
  774. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  775. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  776. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  777. // p_proc_info.finish_date as 处理事项完成日,
  778. // p_proc_info.finish_doc_date as 定稿日,
  779. // p_proc_info.back_date as 返稿日,
  780. // i_case_type.case_type_zh_cn as 案件类型,
  781. // i_case_status.case_status_zh_cn as 案件状态,
  782. // p_proc_info.proc_note as 处理事项备注,
  783. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  784. // p_case_info.case_name as 案件名称,
  785. // p_case_info.charge_date as 委案日期,
  786. // p_proc_info.cus_due_date as 客户期限,
  787. // p_proc_info.int_due_date as 内部期限,
  788. // p_proc_info.first_doc_date as 初稿日,
  789. // p_case_info.remark as 案件备注,
  790. // p_proc_info.translate_count as 翻译字数,
  791. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  792. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  793. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  794. // i_country.country_zh_cn as '国家(地区)'
  795. // from p_case_info
  796. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  797. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  798. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  799. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  800. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  801. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  802. // left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id
  803. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  804. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  805. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  806. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  807. // left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id
  808. // left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id
  809. // left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id
  810. // where
  811. // p_case_info.is_enabled=1
  812. // and p_proc_info.is_enabled=1
  813. // and s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6')
  814. // and (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' )
  815. // AND ((p_proc_info.finish_date >= @beginTime and p_proc_info.finish_date<@endTime)) ";
  816. // break;
  817. // case "每月绩效统计--中国一次OA授权表":
  818. // strSQL = @"select
  819. // p_case_info.case_volume as 我方文号,
  820. // p_case_info.case_name as 案件名称,
  821. // p_case_info.app_no as 申请号,
  822. // c_customer.customer_name as 客户名称,
  823. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  824. // inner join s_user_info as u on u.user_id = pl.pic_id
  825. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件处理人,
  826. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  827. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  828. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件核稿人,
  829. // p_file_list.post_date as 发文日期,
  830. // p_case_info.case_volume_customer as 客户文号,
  831. // p_case_info.app_date as 申请日,
  832. // i_country.country_zh_cn as '国家(地区)',
  833. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  834. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  835. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  836. // p_file_list.upload_time as 上传日期,
  837. // i_file_desc.file_desc_zh_cn as 文件描述,
  838. // i_apply_type.apply_type_zh_cn as 申请类型,
  839. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  840. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  841. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员
  842. // from p_case_info
  843. // inner join i_apply_type on p_case_info.apply_type_id=i_apply_type.apply_type_id
  844. // inner join p_proc_info on p_case_info.case_id=p_proc_info.case_id
  845. // inner join p_file_list on p_file_list.obj_id=p_proc_info.proc_id
  846. // inner join i_file_desc on i_file_desc.file_desc_id=p_file_list.file_desc_id
  847. // inner join c_customer on p_case_info.customer_id=c_customer.customer_id
  848. // inner join i_country on i_country.country_id=p_case_info.country_id
  849. // where
  850. // p_case_info.is_enabled=1
  851. // and p_proc_info.is_enabled=1 and p_case_info.country_id='CN'
  852. // and p_file_list.file_desc_id='09800D39-D585-49F3-B9DE-50AC689DE9AB'
  853. // and p_file_list.file_name not like '%.zip'
  854. // 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
  855. // and (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' )
  856. // AND ((p_file_list.upload_time >= @beginTime and p_file_list.upload_time<@endTime))";
  857. // break;
  858. // case "每月绩效统计--专案进度跟踪~S卷":
  859. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  860. // p_case_info.case_name as 案件名称,
  861. // i_case_type.case_type_zh_cn as 案件类型,
  862. // i_business_type.business_type_zh_cn as 业务类型,
  863. // i_country.country_zh_cn as '国家(地区)',
  864. // c_customer.customer_name as 客户名称,
  865. // s_dept_info.dept_full_name as 承办部门,
  866. // i_case_status.case_status_zh_cn as 案件状态,
  867. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  868. // p_proc_info.int_due_date as 内部期限,
  869. // p_proc_info.cus_due_date as 客户期限,
  870. // p_proc_info.legal_due_date as 官方期限,
  871. // p_proc_info.finish_doc_date as 定稿日,
  872. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  873. // inner join s_user_info as u on u.user_id = pl.pic_id where pl.obj_id = p_proc_info.proc_id
  874. // FOR XML PATH('') ),1,1,'') as 处理人,
  875. // p_case_info.charge_date as 委案日期,
  876. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  877. // p_proc_info.first_doc_date as 初稿日,
  878. // STUFF((SELECT ',' + u.cn_name from c_customer_user as cu
  879. // inner join s_user_info as u on u.user_id = cu.user_id
  880. // where cu.customer_id = p_case_info.customer_id FOR XML PATH('') ),1,1,'') as 流程负责人,
  881. // p_proc_info.finish_date as 处理事项完成日,
  882. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  883. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  884. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员
  885. // from p_case_info
  886. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  887. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  888. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  889. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  890. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  891. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  892. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  893. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  894. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  895. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  896. // where p_case_info.is_enabled=1 and p_proc_info.is_enabled=1 and
  897. // (isnull (p_proc_info.finish_date,'') ='') AND (i_ctrl_proc.ctrl_proc_zh_cn='提出报告')";
  898. // break;
  899. // case "每月绩效统计--专案开卷报表~S卷":
  900. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  901. // p_case_info.case_volume_customer as 客户文号,
  902. // p_case_info.case_name as 案件名称,
  903. // p_case_info.charge_date as 委案日期,
  904. // i_case_status.case_status_zh_cn as 案件状态,
  905. // i_case_type.case_type_zh_cn as 案件类型,
  906. // p_case_info.app_no as 申请号,
  907. // p_case_info.app_date as 申请日,
  908. // i_business_type.business_type_zh_cn as 业务类型,
  909. // STUFF((SELECT ',' + u.cn_name from c_customer_user as cu
  910. // 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 流程负责人,
  911. // c_customer.customer_name as 客户名称,
  912. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  913. // 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 案件核稿人,
  914. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  915. // 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 案件处理人,
  916. // p_case_info.create_time as 开卷日期,
  917. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  918. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  919. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  920. // i_country.country_zh_cn as '国家(地区)'
  921. // from p_case_info
  922. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  923. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  924. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  925. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  926. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  927. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  928. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  929. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  930. // where p_case_info.is_enabled=1 p_case_info.is_enabled=1 and p_case_info.case_volume like 'S%' and not p_case_info.case_volume like 'SC%'
  931. //and i_case_status.case_status_zh_cn<>'已完成' and i_case_status.case_status_zh_cn<>'结案'";
  932. // break;
  933. // }
  934. // using (var conn = new SqlConnection(ConfigHelper.GetSectionValue("IPEasySetting:ConnectionStrings")))
  935. // {
  936. // try
  937. // {
  938. // conn.Open();
  939. // using (var cmd = conn.CreateCommand())
  940. // {
  941. // cmd.CommandText = strSQL;
  942. // cmd.CommandType = CommandType.Text;
  943. // if (isModifyDate)
  944. // {
  945. // cmd.Parameters.Add(new SqlParameter("beginTime", DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01")));
  946. // cmd.Parameters.Add(new SqlParameter("endTime", DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01")));
  947. // }
  948. // using (var reader = cmd.ExecuteReader())
  949. // {
  950. // dt.Load(reader);
  951. // }
  952. // }
  953. // }
  954. // catch (Exception ex)
  955. // {
  956. // throw ex;
  957. // }
  958. // }
  959. // return dt;
  960. #endregion
  961. }
  962. }
  963. }