ImportReportJob.cs 53 KB

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