ImportReportJob.cs 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  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 = row["业务人员"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  533. if (!name.Contains("君龙"))
  534. {
  535. temName = name.Trim();
  536. }
  537. item.WorkflowUserId = GetStaff(temName);
  538. }
  539. }
  540. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  541. item.ApplicationName = row["申请人"].ToString().Trim();
  542. DateTime temDate = new DateTime();
  543. if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
  544. {
  545. item.FinishedDate = temDate;
  546. }
  547. //定稿日
  548. if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
  549. {
  550. item.FinalizationDate = temDate;
  551. }
  552. //返稿日
  553. if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
  554. {
  555. item.ReturnDate = temDate;
  556. }
  557. //案件类型
  558. item.CaseType = row["案件类型"].ToString().Trim();
  559. //案件状态
  560. item.CaseState = row["案件状态"].ToString().Trim();
  561. //处理事项备注
  562. item.DoItemMemo = row["处理事项备注"].ToString().Trim();
  563. //处理状态
  564. item.DoItemState = row["处理状态"].ToString().Trim();
  565. //案件名称
  566. item.CaseName = row["案件名称"].ToString().Trim();
  567. //委案日期
  568. if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
  569. {
  570. item.EntrustingDate = temDate;
  571. }
  572. //客户期限
  573. if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
  574. {
  575. item.CustomerLimitDate = temDate;
  576. }
  577. //内部期限
  578. if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
  579. {
  580. item.InternalDate = temDate;
  581. }
  582. //初稿日
  583. if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
  584. {
  585. item.FirstDraftDate = temDate;
  586. }
  587. //备注(发文严重超期是否属客观原因,若为否,请填写原因)
  588. if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
  589. {
  590. item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
  591. }
  592. //案件备注
  593. item.CaseMemo = row["案件备注"].ToString().Trim();
  594. if (row.Table.Columns.Contains("翻译字数"))
  595. {
  596. //item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim());
  597. var strWordCount = row["翻译字数"].ToString().Trim();
  598. if (string.IsNullOrEmpty(strWordCount))
  599. {
  600. try
  601. {
  602. item.WordCount = int.Parse(strWordCount);
  603. }
  604. catch { }
  605. }
  606. }
  607. return item;
  608. }
  609. private int? GetStaff(string v)
  610. {
  611. if (!string.IsNullOrEmpty(v))
  612. {
  613. string temName = v.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  614. if (!v.Contains("君龙"))
  615. {
  616. temName = v;
  617. }
  618. var staff = spDb.Staffs.Where<Staff>(s => s.Name == temName).FirstOrDefault();
  619. if (staff != null)
  620. {
  621. return staff.Id;
  622. }
  623. }
  624. return null;
  625. }
  626. private DataTable GetDataFromIPEasy(string ReportName, bool isModifyDate)
  627. {
  628. try
  629. {
  630. return wispro.sp.utility.IPEasyUtility.DownloadReport(ReportName, isModifyDate);
  631. }
  632. catch {
  633. return null;
  634. }
  635. #region 利用维德系统服务器上的API获取
  636. // int iTry = 0;
  637. //tryAgain:
  638. // try
  639. // {
  640. // HttpClient http = new HttpClient();
  641. // var bytRespon = http.GetAsync($"{ConfigHelper.GetSectionValue("IPEasySetting:ipEeasyApi")}/api/ipEasy/GetDataFromIPEasy?ReportName={ReportName}&isModifyDate={isModifyDate}").Result;
  642. // if (bytRespon.IsSuccessStatusCode)
  643. // {
  644. // string result = bytRespon.Content.ReadAsStringAsync().Result.Replace("\"", string.Empty);
  645. // byte[] data = Convert.FromBase64String(result);
  646. // //byte[] data = bytRespon.Content.ReadAsByteArrayAsync().Result;//Here is the problem
  647. // XmlSerializer serializer = new XmlSerializer(typeof(System.Data.DataTable));
  648. // MemoryStream memory = new MemoryStream(data);
  649. // DataTable dt = (DataTable)serializer.Deserialize(memory);
  650. // return dt;
  651. // }
  652. // else
  653. // {
  654. // if (iTry < 3)
  655. // {
  656. // iTry++;
  657. // goto tryAgain;
  658. // }
  659. // }
  660. // }
  661. // catch (Exception ex)
  662. // {
  663. // if (iTry < 3)
  664. // {
  665. // iTry++;
  666. // goto tryAgain;
  667. // }
  668. // }
  669. // return null;
  670. #endregion
  671. #region old code 从维德数据库中直接读取
  672. // DataTable dt = new DataTable();
  673. // string strSQL = "";
  674. // switch (ReportName)
  675. // {
  676. // case "每月绩效统计--发客户超过一个月未完成案件":
  677. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  678. // i_apply_type.apply_type_zh_cn as 申请类型,
  679. // i_business_type.business_type_zh_cn as 业务类型,
  680. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  681. // (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage) as 案件阶段,
  682. // i_case_coefficient.case_coefficient_zh_cn as 案件系数,
  683. // i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
  684. // (select proc_coefficient_zh_cn from p_proc_info pr
  685. // left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id
  686. // where case_id=p_case_info.case_id and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  687. // and pr.seq=
  688. // (select max(seq) from p_proc_info pr where case_id=p_case_info.case_id
  689. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
  690. // ) as 前一次OA处理事项系数,
  691. // (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  692. // inner join s_user_info as u on u.user_id = pl.pic_id
  693. // inner join p_proc_info pr1 on pr1.proc_id=pl.obj_id
  694. // where case_id=p_case_info.case_id and
  695. // ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  696. // and pr1.seq=(
  697. // select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id
  698. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  699. // and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')) as 前一次OA处理人,
  700. // STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl
  701. // inner join s_user_info as u on u.user_id = pl.pic_id
  702. // left join i_user_rank ur on ur.rank_id=u.rank_id
  703. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人等级,
  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. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人,
  707. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  708. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  709. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 核稿人,
  710. // c_customer.customer_name as 客户名称,
  711. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  712. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  713. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  714. // p_proc_info.finish_date as 处理事项完成日,
  715. // p_proc_info.finish_doc_date as 定稿日,
  716. // p_proc_info.back_date as 返稿日,
  717. // i_case_type.case_type_zh_cn as 案件类型,
  718. // i_case_status.case_status_zh_cn as 案件状态,
  719. // p_proc_info.proc_note as 处理事项备注,
  720. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  721. // p_case_info.case_name as 案件名称,
  722. // p_case_info.charge_date as 委案日期,
  723. // p_proc_info.cus_due_date as 客户期限,
  724. // p_proc_info.int_due_date as 内部期限,
  725. // p_proc_info.first_doc_date as 初稿日,
  726. // p_case_info.remark as 案件备注,
  727. // p_proc_info.translate_count as 翻译字数,
  728. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  729. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  730. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  731. // i_country.country_zh_cn as '国家(地区)'
  732. // from p_case_info
  733. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  734. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  735. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  736. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  737. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  738. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  739. // left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id
  740. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  741. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  742. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  743. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  744. // left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id
  745. // left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id
  746. // left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id
  747. // where
  748. // p_case_info.is_enabled=1 and p_proc_info.is_enabled=1 and
  749. // s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6') and
  750. // p_proc_info.finish_date is null
  751. // and p_proc_info.back_date<DATEADD(MM,-1,DATEADD(MM, DATEDIFF(MM,0,getdate()), 0)) and
  752. // (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' ) AND
  753. // ( i_ctrl_proc.ctrl_proc_zh_cn='新申请'
  754. // or i_ctrl_proc.ctrl_proc_zh_cn='Non'
  755. // or i_ctrl_proc.ctrl_proc_zh_cn='无效宣告'
  756. // or i_ctrl_proc.ctrl_proc_zh_cn='意见陈述'
  757. // or i_ctrl_proc.ctrl_proc_zh_cn='专利挖掘与布局'
  758. // or i_ctrl_proc.ctrl_proc_zh_cn='处理审查意见'
  759. // or i_ctrl_proc.ctrl_proc_zh_cn='Final'
  760. // or i_ctrl_proc.ctrl_proc_zh_cn='复审通知意见陈述'
  761. // or i_ctrl_proc.ctrl_proc_zh_cn='申復'
  762. // or i_ctrl_proc.ctrl_proc_zh_cn='RCE'
  763. // or i_ctrl_proc.ctrl_proc_zh_cn='翻译'
  764. // or i_ctrl_proc.ctrl_proc_zh_cn='提出异议复审'
  765. // or i_ctrl_proc.ctrl_proc_zh_cn='Advisory'
  766. // or i_ctrl_proc.ctrl_proc_zh_cn='复审'
  767. // or i_ctrl_proc.ctrl_proc_zh_cn='请求复审'
  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='补充理由和证据'
  773. // or i_ctrl_proc.ctrl_proc_zh_cn='无效分析'
  774. // or i_ctrl_proc.ctrl_proc_zh_cn='无效答辩'
  775. // )";
  776. // break;
  777. // case "每月绩效统计--上个月递交完成案件":
  778. // strSQL = @"SELECT
  779. // p_case_info.case_volume as 我方文号,
  780. // i_apply_type.apply_type_zh_cn as 申请类型,
  781. // i_business_type.business_type_zh_cn as 业务类型,
  782. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  783. // (select case_status_zh_cn from i_case_status where case_status_id=p_proc_info.review_stage) as 案件阶段,
  784. // i_case_coefficient.case_coefficient_zh_cn as 案件系数,
  785. // i_proc_coefficient.proc_coefficient_zh_cn as 处理事项系数,
  786. // (select
  787. // proc_coefficient_zh_cn from p_proc_info pr
  788. // left join i_proc_coefficient pc on pc.proc_coefficient_id=pr.proc_coefficient_id
  789. // where case_id=p_case_info.case_id
  790. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  791. // and pr.seq=(select max(seq) from p_proc_info pr where case_id=p_case_info.case_id
  792. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq)
  793. // ) as 前一次OA处理事项系数,
  794. // (STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  795. // inner join s_user_info as u on u.user_id = pl.pic_id
  796. // inner join p_proc_info pr1 on pr1.proc_id=pl.obj_id
  797. // where case_id=p_case_info.case_id
  798. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'
  799. // and pr1.seq=(select max(seq) from p_proc_info pr2 where case_id=p_case_info.case_id
  800. // and ctrl_proc_id='8b96378e-05a0-4a8d-b3d1-39af92fddaf5'and seq<p_proc_info.seq) FOR XML PATH('') ),1,1,'')
  801. // ) as 前一次OA处理人,
  802. // STUFF((SELECT ',' + ur.rank_zh_cn from p_proc_pic_list as pl
  803. // inner join s_user_info as u on u.user_id = pl.pic_id
  804. // 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 处理人等级,
  805. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  806. // inner join s_user_info as u on u.user_id = pl.pic_id
  807. // where pl.obj_id = p_proc_info.proc_id FOR XML PATH('') ),1,1,'') as 处理人,
  808. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  809. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  810. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件核稿人,
  811. // c_customer.customer_name as 客户名称,
  812. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  813. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  814. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  815. // p_proc_info.finish_date as 处理事项完成日,
  816. // p_proc_info.finish_doc_date as 定稿日,
  817. // p_proc_info.back_date as 返稿日,
  818. // i_case_type.case_type_zh_cn as 案件类型,
  819. // i_case_status.case_status_zh_cn as 案件状态,
  820. // p_proc_info.proc_note as 处理事项备注,
  821. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  822. // p_case_info.case_name as 案件名称,
  823. // p_case_info.charge_date as 委案日期,
  824. // p_proc_info.cus_due_date as 客户期限,
  825. // p_proc_info.int_due_date as 内部期限,
  826. // p_proc_info.first_doc_date as 初稿日,
  827. // p_case_info.remark as 案件备注,
  828. // p_proc_info.translate_count as 翻译字数,
  829. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  830. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  831. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  832. // i_country.country_zh_cn as '国家(地区)'
  833. // from p_case_info
  834. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  835. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  836. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  837. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  838. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  839. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  840. // left join i_case_coefficient on i_case_coefficient.case_coefficient_id=p_case_info.case_coefficient_id
  841. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  842. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  843. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  844. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  845. // left join p_proc_pic_list with(nolock) on p_proc_pic_list.obj_id=p_proc_info.proc_id
  846. // left join s_user_info with(nolock) on s_user_info.user_id=p_proc_pic_list.pic_id
  847. // left join i_proc_coefficient on i_proc_coefficient.proc_coefficient_id=p_proc_info.proc_coefficient_id
  848. // where
  849. // p_case_info.is_enabled=1
  850. // and p_proc_info.is_enabled=1
  851. // and s_user_info.dept_id not in ('60e09ee0-fcc7-446f-badc-af9973079fee','34d0e351-71dc-418f-9b6b-bcb67af62fed','599cbe0c-044e-4ffc-9411-96dd9019d8a6')
  852. // and (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' )
  853. // AND ((p_proc_info.finish_date >= @beginTime and p_proc_info.finish_date<@endTime)) ";
  854. // break;
  855. // case "每月绩效统计--中国一次OA授权表":
  856. // strSQL = @"select
  857. // p_case_info.case_volume as 我方文号,
  858. // p_case_info.case_name as 案件名称,
  859. // p_case_info.app_no as 申请号,
  860. // c_customer.customer_name as 客户名称,
  861. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  862. // inner join s_user_info as u on u.user_id = pl.pic_id
  863. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件处理人,
  864. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  865. // inner join s_user_info as u on u.user_id = pl.revise_user_id
  866. // where pl.obj_id = p_case_info.case_id FOR XML PATH('') ),1,1,'') as 案件核稿人,
  867. // p_file_list.post_date as 发文日期,
  868. // p_case_info.case_volume_customer as 客户文号,
  869. // p_case_info.app_date as 申请日,
  870. // i_country.country_zh_cn as '国家(地区)',
  871. // STUFF((SELECT ',' + a.applicant_name_cn from p_applicant_list as al
  872. // inner join i_applicant as a on a.applicant_id = al.applicant_id
  873. // where al.obj_id = p_case_info.case_id order by al.seq FOR XML PATH('') ),1,1,'') as 申请人,
  874. // p_file_list.upload_time as 上传日期,
  875. // i_file_desc.file_desc_zh_cn as 文件描述,
  876. // i_apply_type.apply_type_zh_cn as 申请类型,
  877. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  878. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  879. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员
  880. // from p_case_info
  881. // inner join i_apply_type on p_case_info.apply_type_id=i_apply_type.apply_type_id
  882. // inner join p_proc_info on p_case_info.case_id=p_proc_info.case_id
  883. // inner join p_file_list on p_file_list.obj_id=p_proc_info.proc_id
  884. // inner join i_file_desc on i_file_desc.file_desc_id=p_file_list.file_desc_id
  885. // inner join c_customer on p_case_info.customer_id=c_customer.customer_id
  886. // inner join i_country on i_country.country_id=p_case_info.country_id
  887. // where
  888. // p_case_info.is_enabled=1
  889. // and p_proc_info.is_enabled=1 and p_case_info.country_id='CN'
  890. // and p_file_list.file_desc_id='09800D39-D585-49F3-B9DE-50AC689DE9AB'
  891. // and p_file_list.file_name not like '%.zip'
  892. // 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
  893. // and (p_case_info.case_type_id='31D1A147-2931-43B5-94AE-B72B1525BA8A' )
  894. // AND ((p_file_list.upload_time >= @beginTime and p_file_list.upload_time<@endTime))";
  895. // break;
  896. // case "每月绩效统计--专案进度跟踪~S卷":
  897. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  898. // p_case_info.case_name as 案件名称,
  899. // i_case_type.case_type_zh_cn as 案件类型,
  900. // i_business_type.business_type_zh_cn as 业务类型,
  901. // i_country.country_zh_cn as '国家(地区)',
  902. // c_customer.customer_name as 客户名称,
  903. // s_dept_info.dept_full_name as 承办部门,
  904. // i_case_status.case_status_zh_cn as 案件状态,
  905. // i_ctrl_proc.ctrl_proc_zh_cn as 处理事项,
  906. // p_proc_info.int_due_date as 内部期限,
  907. // p_proc_info.cus_due_date as 客户期限,
  908. // p_proc_info.legal_due_date as 官方期限,
  909. // p_proc_info.finish_doc_date as 定稿日,
  910. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  911. // inner join s_user_info as u on u.user_id = pl.pic_id where pl.obj_id = p_proc_info.proc_id
  912. // FOR XML PATH('') ),1,1,'') as 处理人,
  913. // p_case_info.charge_date as 委案日期,
  914. // (select proc_status_zh_cn from i_proc_status where proc_status_id=p_proc_info.proc_status_id) as 处理状态,
  915. // p_proc_info.first_doc_date as 初稿日,
  916. // STUFF((SELECT ',' + u.cn_name from c_customer_user as cu
  917. // inner join s_user_info as u on u.user_id = cu.user_id
  918. // where cu.customer_id = p_case_info.customer_id FOR XML PATH('') ),1,1,'') as 流程负责人,
  919. // p_proc_info.finish_date as 处理事项完成日,
  920. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  921. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  922. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员
  923. // from p_case_info
  924. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  925. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  926. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  927. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  928. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  929. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  930. // inner join p_proc_info with(nolock) on p_case_info.case_id=p_proc_info.case_id
  931. // inner join i_ctrl_proc with(nolock) on p_proc_info.ctrl_proc_id=i_ctrl_proc.ctrl_proc_id
  932. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  933. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  934. // where p_case_info.is_enabled=1 and p_proc_info.is_enabled=1 and
  935. // (isnull (p_proc_info.finish_date,'') ='') AND (i_ctrl_proc.ctrl_proc_zh_cn='提出报告')";
  936. // break;
  937. // case "每月绩效统计--专案开卷报表~S卷":
  938. // strSQL = @"SELECT p_case_info.case_volume as 我方文号,
  939. // p_case_info.case_volume_customer as 客户文号,
  940. // p_case_info.case_name as 案件名称,
  941. // p_case_info.charge_date as 委案日期,
  942. // i_case_status.case_status_zh_cn as 案件状态,
  943. // i_case_type.case_type_zh_cn as 案件类型,
  944. // p_case_info.app_no as 申请号,
  945. // p_case_info.app_date as 申请日,
  946. // i_business_type.business_type_zh_cn as 业务类型,
  947. // STUFF((SELECT ',' + u.cn_name from c_customer_user as cu
  948. // 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 流程负责人,
  949. // c_customer.customer_name as 客户名称,
  950. // STUFF((SELECT ',' + u.cn_name from p_revise_user_list as pl
  951. // 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 案件核稿人,
  952. // STUFF((SELECT ',' + u.cn_name from p_proc_pic_list as pl
  953. // 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 案件处理人,
  954. // p_case_info.create_time as 开卷日期,
  955. // STUFF((SELECT ',' + ui.cn_name from p_sales_list as sl
  956. // inner join dbo.s_user_info as ui on ui.user_id = sl.sales_user_id
  957. // where sl.obj_id = p_case_info.case_id AND sl.is_enabled=1 order by sl.seq FOR XML PATH('') ),1,1,'') as 业务人员,
  958. // i_country.country_zh_cn as '国家(地区)'
  959. // from p_case_info
  960. // inner join p_case_advance_info with(nolock) on p_case_info.case_id=p_case_advance_info.case_id
  961. // inner join i_apply_type with(nolock) on i_apply_type.apply_type_id=p_case_info.apply_type_id
  962. // inner join i_case_type with(nolock) on i_case_type.case_type_id=p_case_info.case_type_id
  963. // inner join i_country with(nolock) on i_country.country_id=p_case_info.country_id
  964. // inner join i_case_status with(nolock) on i_case_status.case_status_id=p_case_info.case_status_id
  965. // inner join c_customer with(nolock) on c_customer.customer_id=p_case_info.customer_id
  966. // inner join i_business_type on i_business_type.business_type_id = p_case_info.business_type_id
  967. // inner join s_dept_info on s_dept_info.dept_id = p_case_info.charge_dept_id
  968. // 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%'
  969. //and i_case_status.case_status_zh_cn<>'已完成' and i_case_status.case_status_zh_cn<>'结案'";
  970. // break;
  971. // }
  972. // using (var conn = new SqlConnection(ConfigHelper.GetSectionValue("IPEasySetting:ConnectionStrings")))
  973. // {
  974. // try
  975. // {
  976. // conn.Open();
  977. // using (var cmd = conn.CreateCommand())
  978. // {
  979. // cmd.CommandText = strSQL;
  980. // cmd.CommandType = CommandType.Text;
  981. // if (isModifyDate)
  982. // {
  983. // cmd.Parameters.Add(new SqlParameter("beginTime", DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01")));
  984. // cmd.Parameters.Add(new SqlParameter("endTime", DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01")));
  985. // }
  986. // using (var reader = cmd.ExecuteReader())
  987. // {
  988. // dt.Load(reader);
  989. // }
  990. // }
  991. // }
  992. // catch (Exception ex)
  993. // {
  994. // throw ex;
  995. // }
  996. // }
  997. // return dt;
  998. #endregion
  999. }
  1000. }
  1001. }