ImportReportJob.cs 53 KB

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