ImportReportJob.cs 57 KB

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