ImportReportJob.cs 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  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. return null;
  647. }
  648. #region 利用维德系统服务器上的API获取
  649. // int iTry = 0;
  650. //tryAgain:
  651. // try
  652. // {
  653. // HttpClient http = new HttpClient();
  654. // var bytRespon = http.GetAsync($"{ConfigHelper.GetSectionValue("IPEasySetting:ipEeasyApi")}/api/ipEasy/GetDataFromIPEasy?ReportName={ReportName}&isModifyDate={isModifyDate}").Result;
  655. // if (bytRespon.IsSuccessStatusCode)
  656. // {
  657. // string result = bytRespon.Content.ReadAsStringAsync().Result.Replace("\"", string.Empty);
  658. // byte[] data = Convert.FromBase64String(result);
  659. // //byte[] data = bytRespon.Content.ReadAsByteArrayAsync().Result;//Here is the problem
  660. // XmlSerializer serializer = new XmlSerializer(typeof(System.Data.DataTable));
  661. // MemoryStream memory = new MemoryStream(data);
  662. // DataTable dt = (DataTable)serializer.Deserialize(memory);
  663. // return dt;
  664. // }
  665. // else
  666. // {
  667. // if (iTry < 3)
  668. // {
  669. // iTry++;
  670. // goto tryAgain;
  671. // }
  672. // }
  673. // }
  674. // catch (Exception ex)
  675. // {
  676. // if (iTry < 3)
  677. // {
  678. // iTry++;
  679. // goto tryAgain;
  680. // }
  681. // }
  682. // return null;
  683. #endregion
  684. #region old code 从维德数据库中直接读取
  685. // DataTable dt = new DataTable();
  686. // string strSQL = "";
  687. // switch (ReportName)
  688. // {
  689. // case "每月绩效统计--发客户超过一个月未完成案件":
  690. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  691. // i_apply_type.apply_type_zh_cn as 申请类型,
  692. // i_business_type.business_type_zh_cn as 业务类型,
  693. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  694. // (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage) as 案件阶段,
  695. // i_case_coefficient.case_coefficient_zh_cn as 案件系数,
  696. // i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
  697. // (select proc_coefficient_zh_cn from p_proc_info pr
  698. // left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id
  699. // where case_id=p_case_info.case_id and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  700. // and pr.seq=
  701. // (select max(seq) from p_proc_info pr where case_id=p_case_info.case_id
  702. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
  703. // ) as 前一次OA处理事项系数,
  704. // (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  705. // inner join s_user_info as u on u.user_id = pl.pic_id
  706. // inner join p_proc_info pr1 on pr1.proc_id=pl.obj_id
  707. // where case_id=p_case_info.case_id and
  708. // ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  709. // and pr1.seq=(
  710. // select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id
  711. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  712. // and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')) as 前一次OA处理人,
  713. // STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl
  714. // inner join s_user_info as u on u.user_id = pl.pic_id
  715. // left join i_user_rank ur on ur.rank_id=u.rank_id
  716. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人等级,
  717. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  718. // inner join s_user_info as u on u.user_id = pl.pic_id
  719. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人,
  720. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  721. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  722. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 核稿人,
  723. // c_customer.customer_name as 客户名称,
  724. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  725. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  726. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  727. // p_proc_info.finish_date as 处理事项完成日,
  728. // p_proc_info.finish_doc_date as 定稿日,
  729. // p_proc_info.back_date as 返稿日,
  730. // i_case_type.case_type_zh_cn as 案件类型,
  731. // i_case_status.case_status_zh_cn as 案件状态,
  732. // p_proc_info.proc_note as 处理事项备注,
  733. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  734. // p_case_info.case_name as 案件名称,
  735. // p_case_info.charge_date as 委案日期,
  736. // p_proc_info.cus_due_date as 客户期限,
  737. // p_proc_info.int_due_date as 内部期限,
  738. // p_proc_info.first_doc_date as 初稿日,
  739. // p_case_info.remark as 案件备注,
  740. // p_proc_info.translate_count as 翻译字数,
  741. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  742. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  743. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  744. // i_country.country_zh_cn as '国家(地区)'
  745. // from p_case_info
  746. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  747. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  748. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  749. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  750. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  751. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  752. // left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id
  753. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  754. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  755. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  756. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  757. // left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id
  758. // left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id
  759. // left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id
  760. // where
  761. // p_case_info.is_enabled=1 and p_proc_info.is_enabled=1 and
  762. // s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6') and
  763. // p_proc_info.finish_date is null
  764. // and p_proc_info.back_date<DATEADD(MM,-1,DATEADD(MM, DATEDIFF(MM,0,getdate()), 0)) and
  765. // (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' ) AND
  766. // ( i_ctrl_proc.ctrl_proc_zh_cn='新申请'
  767. // or i_ctrl_proc.ctrl_proc_zh_cn='Non'
  768. // or i_ctrl_proc.ctrl_proc_zh_cn='无效宣告'
  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='Final'
  773. // or i_ctrl_proc.ctrl_proc_zh_cn='复审通知意见陈述'
  774. // or i_ctrl_proc.ctrl_proc_zh_cn='申復'
  775. // or i_ctrl_proc.ctrl_proc_zh_cn='RCE'
  776. // or i_ctrl_proc.ctrl_proc_zh_cn='翻译'
  777. // or i_ctrl_proc.ctrl_proc_zh_cn='提出异议复审'
  778. // or i_ctrl_proc.ctrl_proc_zh_cn='Advisory'
  779. // or i_ctrl_proc.ctrl_proc_zh_cn='复审'
  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. // )";
  789. // break;
  790. // case "每月绩效统计--上个月递交完成案件":
  791. // strSQL = @"SELECT
  792. // p_case_info.case_volume as 我方文号,
  793. // i_apply_type.apply_type_zh_cn as 申请类型,
  794. // i_business_type.business_type_zh_cn as 业务类型,
  795. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  796. // (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage) as 案件阶段,
  797. // i_case_coefficient.case_coefficient_zh_cn as 案件系数,
  798. // i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
  799. // (select
  800. // proc_coefficient_zh_cn from p_proc_info pr
  801. // left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id
  802. // where case_id=p_case_info.case_id
  803. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  804. // and pr.seq=(select max(seq) from p_proc_info pr where case_id=p_case_info.case_id
  805. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
  806. // ) as 前一次OA处理事项系数,
  807. // (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  808. // inner join s_user_info as u on u.user_id = pl.pic_id
  809. // inner join p_proc_info pr1 on pr1.proc_id=pl.obj_id
  810. // where case_id=p_case_info.case_id
  811. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  812. // and pr1.seq=(select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id
  813. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')
  814. // ) as 前一次OA处理人,
  815. // STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl
  816. // inner join s_user_info as u on u.user_id = pl.pic_id
  817. // 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 处理人等级,
  818. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  819. // inner join s_user_info as u on u.user_id = pl.pic_id
  820. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人,
  821. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  822. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  823. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件核稿人,
  824. // c_customer.customer_name as 客户名称,
  825. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  826. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  827. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  828. // p_proc_info.finish_date as 处理事项完成日,
  829. // p_proc_info.finish_doc_date as 定稿日,
  830. // p_proc_info.back_date as 返稿日,
  831. // i_case_type.case_type_zh_cn as 案件类型,
  832. // i_case_status.case_status_zh_cn as 案件状态,
  833. // p_proc_info.proc_note as 处理事项备注,
  834. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  835. // p_case_info.case_name as 案件名称,
  836. // p_case_info.charge_date as 委案日期,
  837. // p_proc_info.cus_due_date as 客户期限,
  838. // p_proc_info.int_due_date as 内部期限,
  839. // p_proc_info.first_doc_date as 初稿日,
  840. // p_case_info.remark as 案件备注,
  841. // p_proc_info.translate_count as 翻译字数,
  842. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  843. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  844. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  845. // i_country.country_zh_cn as '国家(地区)'
  846. // from p_case_info
  847. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  848. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  849. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  850. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  851. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  852. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  853. // left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id
  854. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  855. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  856. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  857. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  858. // left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id
  859. // left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id
  860. // left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id
  861. // where
  862. // p_case_info.is_enabled=1
  863. // and p_proc_info.is_enabled=1
  864. // and s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6')
  865. // and (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' )
  866. // AND ((p_proc_info.finish_date >= @beginTime and p_proc_info.finish_date<@endTime)) ";
  867. // break;
  868. // case "每月绩效统计--中国一次OA授权表":
  869. // strSQL = @"select
  870. // p_case_info.case_volume as 我方文号,
  871. // p_case_info.case_name as 案件名称,
  872. // p_case_info.app_no as 申请号,
  873. // c_customer.customer_name as 客户名称,
  874. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  875. // inner join s_user_info as u on u.user_id = pl.pic_id
  876. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件处理人,
  877. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  878. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  879. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件核稿人,
  880. // p_file_list.post_date as 发文日期,
  881. // p_case_info.case_volume_customer as 客户文号,
  882. // p_case_info.app_date as 申请日,
  883. // i_country.country_zh_cn as '国家(地区)',
  884. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  885. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  886. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  887. // p_file_list.upload_time as 上传日期,
  888. // i_file_desc.file_desc_zh_cn as 文件描述,
  889. // i_apply_type.apply_type_zh_cn as 申请类型,
  890. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  891. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  892. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员
  893. // from p_case_info
  894. // inner join i_apply_type on p_case_info.apply_type_id=i_apply_type.apply_type_id
  895. // inner join p_proc_info on p_case_info.case_id=p_proc_info.case_id
  896. // inner join p_file_list on p_file_list.obj_id=p_proc_info.proc_id
  897. // inner join i_file_desc on i_file_desc.file_desc_id=p_file_list.file_desc_id
  898. // inner join c_customer on p_case_info.customer_id=c_customer.customer_id
  899. // inner join i_country on i_country.country_id=p_case_info.country_id
  900. // where
  901. // p_case_info.is_enabled=1
  902. // and p_proc_info.is_enabled=1 and p_case_info.country_id='CN'
  903. // and p_file_list.file_desc_id='09800D39-D585-49F3-B9DE-50AC689DE9AB'
  904. // and p_file_list.file_name not like '%.zip'
  905. // 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
  906. // and (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' )
  907. // AND ((p_file_list.upload_time >= @beginTime and p_file_list.upload_time<@endTime))";
  908. // break;
  909. // case "每月绩效统计--专案进度跟踪~S卷":
  910. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  911. // p_case_info.case_name as 案件名称,
  912. // i_case_type.case_type_zh_cn as 案件类型,
  913. // i_business_type.business_type_zh_cn as 业务类型,
  914. // i_country.country_zh_cn as '国家(地区)',
  915. // c_customer.customer_name as 客户名称,
  916. // s_dept_info.dept_full_name as 承办部门,
  917. // i_case_status.case_status_zh_cn as 案件状态,
  918. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  919. // p_proc_info.int_due_date as 内部期限,
  920. // p_proc_info.cus_due_date as 客户期限,
  921. // p_proc_info.legal_due_date as 官方期限,
  922. // p_proc_info.finish_doc_date as 定稿日,
  923. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  924. // inner join s_user_info as u on u.user_id = pl.pic_id where pl.obj_id = p_proc_info.proc_id
  925. // FOR XML PATH('') ),1,1,'') as 处理人,
  926. // p_case_info.charge_date as 委案日期,
  927. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  928. // p_proc_info.first_doc_date as 初稿日,
  929. // STUFF((SELECT ',' + u.cn_name from c_customer_user as cu
  930. // inner join s_user_info as u on u.user_id = cu.user_id
  931. // where cu.customer_id = p_case_info.customer_id FOR XML PATH('') ),1,1,'') as 流程负责人,
  932. // p_proc_info.finish_date as 处理事项完成日,
  933. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  934. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  935. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员
  936. // from p_case_info
  937. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  938. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  939. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  940. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  941. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  942. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  943. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  944. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  945. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  946. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  947. // where p_case_info.is_enabled=1 and p_proc_info.is_enabled=1 and
  948. // (isnull (p_proc_info.finish_date,'') ='') AND (i_ctrl_proc.ctrl_proc_zh_cn='提出报告')";
  949. // break;
  950. // case "每月绩效统计--专案开卷报表~S卷":
  951. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  952. // p_case_info.case_volume_customer as 客户文号,
  953. // p_case_info.case_name as 案件名称,
  954. // p_case_info.charge_date as 委案日期,
  955. // i_case_status.case_status_zh_cn as 案件状态,
  956. // i_case_type.case_type_zh_cn as 案件类型,
  957. // p_case_info.app_no as 申请号,
  958. // p_case_info.app_date as 申请日,
  959. // i_business_type.business_type_zh_cn as 业务类型,
  960. // STUFF((SELECT ',' + u.cn_name from c_customer_user as cu
  961. // 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 流程负责人,
  962. // c_customer.customer_name as 客户名称,
  963. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  964. // 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 案件核稿人,
  965. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  966. // 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 案件处理人,
  967. // p_case_info.create_time as 开卷日期,
  968. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  969. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  970. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  971. // i_country.country_zh_cn as '国家(地区)'
  972. // from p_case_info
  973. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  974. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  975. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  976. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  977. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  978. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  979. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  980. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  981. // 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%'
  982. //and i_case_status.case_status_zh_cn<>'已完成' and i_case_status.case_status_zh_cn<>'结案'";
  983. // break;
  984. // }
  985. // using (var conn = new SqlConnection(ConfigHelper.GetSectionValue("IPEasySetting:ConnectionStrings")))
  986. // {
  987. // try
  988. // {
  989. // conn.Open();
  990. // using (var cmd = conn.CreateCommand())
  991. // {
  992. // cmd.CommandText = strSQL;
  993. // cmd.CommandType = CommandType.Text;
  994. // if (isModifyDate)
  995. // {
  996. // cmd.Parameters.Add(new SqlParameter("beginTime", DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01")));
  997. // cmd.Parameters.Add(new SqlParameter("endTime", DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01")));
  998. // }
  999. // using (var reader = cmd.ExecuteReader())
  1000. // {
  1001. // dt.Load(reader);
  1002. // }
  1003. // }
  1004. // }
  1005. // catch (Exception ex)
  1006. // {
  1007. // throw ex;
  1008. // }
  1009. // }
  1010. // return dt;
  1011. #endregion
  1012. }
  1013. }
  1014. }