Form1.cs 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299
  1. using DynamicExpresso;
  2. using Microsoft.International.Converters.PinYinConverter;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Configuration;
  7. using System.Data;
  8. using System.Diagnostics;
  9. using System.Drawing;
  10. using System.Drawing.Imaging;
  11. using System.Dynamic;
  12. using System.IO;
  13. using System.Linq;
  14. using System.Net.Http;
  15. using System.Net.Http.Json;
  16. using System.Text;
  17. using System.Text.Json;
  18. using System.Threading.Tasks;
  19. using System.Windows.Forms;
  20. using wispro.sp.entity;
  21. using wispro.sp.entity.workflowDefine;
  22. using wispro.sp.share;
  23. using wispro.sp.share.Utility;
  24. using wispro.sp.share.webViewObject;
  25. using wispro.sp.utility;
  26. namespace wispro.sp.winClient
  27. {
  28. public partial class Form1 : Form
  29. {
  30. public Form1()
  31. {
  32. InitializeComponent();
  33. }
  34. private void button1_Click(object sender, EventArgs e)
  35. {
  36. DateTime startTime = DateTime.Now;
  37. frmMerageExcel frm = new frmMerageExcel();
  38. if (frm.ShowDialog() == DialogResult.OK)
  39. {
  40. MessageBox.Show($"合并完成,合并后文件保存在:\r\n{frm.SaveFilePath}\r\n用时:{DateTime.Now - startTime }");
  41. }
  42. }
  43. private void button2_Click(object sender, EventArgs e)
  44. {
  45. OpenFileDialog ofd = new OpenFileDialog()
  46. {
  47. Multiselect = false,
  48. Filter = "*.xls|*.xlsx"
  49. };
  50. string strDinashuRegularFile = ConfigurationSettings.AppSettings["DinashuRegularFile"];
  51. if (ofd.ShowDialog() == DialogResult.OK)
  52. {
  53. new ExcelHelper().FillDianShu(ofd.FileName, strDinashuRegularFile);
  54. }
  55. MessageBox.Show("完成点数输入!");
  56. }
  57. private string[] InValidDoItem = new string[]
  58. {
  59. "案件异常-催缴年费",
  60. "案件异常-视为放弃取得专利权",
  61. "办理登记手续",
  62. "办理登记手续-确认客户是否委托",
  63. "代理所变更",
  64. "绘图",
  65. "技术确认",
  66. "缴年费",
  67. "请求保密审查",
  68. "请求费减",
  69. "请求实审",
  70. "取得申请号",
  71. "取得证书",
  72. "取得专利权评价报告",
  73. "确认官方审查状况",
  74. "询问放弃或复审",
  75. "知识点总结",
  76. "专利权人发明人申请人信息变更",
  77. "专利挖掘与布局",
  78. "我方文号前缀带J",
  79. "开卷",
  80. "请求提前公开",
  81. "取得国际检索报告",
  82. "委外检索",
  83. "中止程序",
  84. "终止",
  85. "案件异常-视为撤回",
  86. "进入国家阶段提醒",
  87. "请求恢复权利",
  88. "请求优先权",
  89. "取得【无效宣告请求审查决定】",
  90. "撤回",
  91. "请求退款",
  92. "确认是否委托申请与类型",
  93. "专利交易",
  94. "专利权评价报告",
  95. "专利权人发明人申请人信息变更+代理所变更"
  96. };
  97. private async Task InitRules(bool isSave)
  98. {
  99. List<BasePointRule> rules = new List<BasePointRule>();
  100. DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("ExcelFiles\\20211109-绩效点数规则-lcy-v1.xlsx", true);
  101. PerformanceItem item = new PerformanceItem() { CaseNo = "PAEPO2016277", DoItem= "提交检索主题声明", };
  102. foreach(DataRow row in dt.Rows)
  103. {
  104. BasePointRule rule = new BasePointRule()
  105. {
  106. Rule = row["规则"].ToString(),
  107. PointExpress = row["点数计算"].ToString(),
  108. Priority = int.Parse(row["优先级修订"].ToString()),
  109. Type = row["类型"].ToString()
  110. };
  111. try
  112. {
  113. var interpreter = new Interpreter();
  114. //item.ApplicationType
  115. Func<PerformanceItem, bool> func = interpreter.ParseAsDelegate<Func<PerformanceItem, bool>>(rule.Rule, "p");
  116. bool result = func.Invoke(item);
  117. if (result)
  118. {
  119. item.BasePoint = (double?)interpreter.Eval(rule.PointExpress);
  120. item.Type = rule.Type;
  121. System.Diagnostics.Debug.WriteLine("");
  122. }
  123. rules.Add(rule);
  124. }
  125. catch(Exception ex)
  126. {
  127. System.Diagnostics.Debug.WriteLine(rule.Rule + "\r\n" + ex.ToString());
  128. }
  129. }
  130. if (isSave)
  131. {
  132. foreach (BasePointRule rule in rules)
  133. {
  134. double d;
  135. if(double.TryParse(rule.PointExpress,out d))
  136. {
  137. rule.PointExpress = d.ToString("0.00");
  138. }
  139. await SaveBasePointRule(rule);
  140. }
  141. }
  142. }
  143. public async Task TestQueryFilter()
  144. {
  145. //QueryFilter filter = new QueryFilter();
  146. //filter.ConditionTree = new ExpressTree();
  147. //string ValueType = typeof(PerformanceItem).GetProperty("CaseNo").PropertyType.ToString();
  148. //FieldCondition condition1 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PACN", ValueType = ValueType };
  149. //FieldCondition condition2 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PAUS", ValueType = ValueType };
  150. //filter.ConditionTree.AddCondition(LogicEnum.And,condition1);
  151. //filter.ConditionTree.AddCondition(LogicEnum.Or, condition2);
  152. //System.Diagnostics.Debug.WriteLine(filter.ConditionTree.ToExpressString("s")); ;
  153. }
  154. enum enumTest
  155. {
  156. [Description("男")]
  157. man,
  158. [Description("女")]
  159. woman
  160. }
  161. private async void button3_Click(object sender, EventArgs e)
  162. {
  163. //await RemoveDBNotFinishedDate();
  164. await CalJXPoint();
  165. //await RefreshPerformanceItem(3);
  166. //await UpdateStaff();
  167. //await InitDepartment();
  168. //await GetTest();
  169. //await Compare2DB();
  170. //await RefreshPerformanceItem(1);
  171. //await RefreshPerformanceItem(2);
  172. //await RefreshPerformanceItem(3);
  173. //await UserField2String(lstAJQL);
  174. //await UserField2String(lstAJXS);
  175. //await UserField2String(lstDoItemXS);
  176. //await UserField2String(lstJXBL);
  177. //await UserField2String(lstRXSX);
  178. //await UserField2String(lstYZCQ);
  179. //await ImportUsers();
  180. //await InputPerformanceItem("c:\\temp\\21.01-21.11 工程师绩效报表-总表.xlsx", true, false, 0);
  181. }
  182. private PerformanceItem Row2Item_1(DataRow row, List<Staff> Staffs, CalMonth calMonth)
  183. {
  184. PerformanceItem item = new PerformanceItem();
  185. item.ApplicationType = row["申请类型"].ToString().Trim();
  186. if(item.ApplicationType != "发明")
  187. {
  188. return null;
  189. }
  190. item.CaseNo = row["我方文号"].ToString().Trim();
  191. if (calMonth != null)
  192. {
  193. item.CalMonth = calMonth;
  194. }
  195. else
  196. {
  197. if (row.Table.Columns.Contains("绩效核算月份"))
  198. {
  199. string strjxyf = row["绩效核算月份"].ToString().Trim();
  200. string[] temYFs = strjxyf.Split(new char[] { '.' });
  201. item.CalMonth = new CalMonth();
  202. item.CalMonth.Year = int.Parse(temYFs[0]);
  203. item.CalMonth.Month = int.Parse(temYFs[1]);
  204. item.CalMonth.Status = 4;
  205. }
  206. else
  207. {
  208. item.CalMonth = new CalMonth();
  209. item.Status = 0;
  210. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  211. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  212. }
  213. }
  214. item.ApplicationType = row["申请类型"].ToString().Trim();
  215. item.BusinessType = "普通新申请"; // row["业务类型"].ToString().Trim();
  216. item.AgentFeedbackMemo = "发明一次OA授权"; //row["备注(填表注意事项)"].ToString().Trim();
  217. item.DoItem = "发明一次OA授权"; //row["处理事项"].ToString().Trim();
  218. string strHandler = "";
  219. if (row.Table.Columns.Contains("处理人"))
  220. {
  221. strHandler = row["处理人"].ToString().Trim();
  222. }
  223. else
  224. {
  225. if (row.Table.Columns.Contains("案件处理人"))
  226. {
  227. strHandler = row["案件处理人"].ToString().Trim();
  228. }
  229. }
  230. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  231. item.ItemStaffs = new List<ItemStaff>();
  232. foreach (string name in temHandlers)
  233. {
  234. ItemStaff itemStaff = new ItemStaff();
  235. int? iTem = GetStaff(name, Staffs);
  236. if ((iTem != null))
  237. {
  238. //itemStaff.Item = item;
  239. itemStaff.DoPersonId = iTem.Value;
  240. item.ItemStaffs.Add(itemStaff);
  241. }
  242. else
  243. {
  244. itemStaff.DoPerson = new Staff()
  245. {
  246. Name = name,
  247. Account = name,
  248. Password = "12345678",
  249. IsCalPerformsnce = false,
  250. Status = "正式员工",
  251. StaffGradeId = 4
  252. };
  253. item.ItemStaffs.Add(itemStaff);
  254. }
  255. }
  256. if (item.ItemStaffs.Count == 0)
  257. {
  258. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  259. }
  260. if (row.Table.Columns.Contains("核稿人"))
  261. {
  262. item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
  263. }
  264. else
  265. {
  266. if (row.Table.Columns.Contains("案件核稿人"))
  267. {
  268. item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim(), Staffs);
  269. }
  270. }
  271. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  272. item.ApplicationName = row["申请人"].ToString().Trim();
  273. item.CaseName = row["案件名称"].ToString().Trim();
  274. //案件备注
  275. item.CaseMemo = $"发文日期:{row["发文日期"].ToString().Trim()}\r\n客户文号:{row["客户文号"].ToString().Trim()}\r\n上传日期:{row["上传日期"].ToString().Trim()}\r\n文件描述:{row["文件描述"].ToString().Trim()}";
  276. return item;
  277. }
  278. private PerformanceItem Row2Item(DataRow row, List<Staff> Staffs,CalMonth calMonth)
  279. {
  280. PerformanceItem item = new PerformanceItem();
  281. item.CaseNo = row["我方文号"].ToString().Trim();
  282. if (calMonth != null)
  283. {
  284. item.CalMonth = calMonth;
  285. }
  286. else
  287. {
  288. if (row.Table.Columns.Contains("绩效核算月份"))
  289. {
  290. string strjxyf = row["绩效核算月份"].ToString().Trim();
  291. string[] temYFs = strjxyf.Split(new char[] { '.' });
  292. item.CalMonth = new CalMonth();
  293. item.CalMonth.Year = int.Parse(temYFs[0]);
  294. if (temYFs[1] == "1")
  295. {
  296. temYFs[1] = "10";
  297. }
  298. item.CalMonth.Month = int.Parse(temYFs[1]);
  299. item.CalMonth.Status = 4;
  300. }
  301. else
  302. {
  303. item.CalMonth = new CalMonth();
  304. item.Status = 0;
  305. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  306. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  307. }
  308. }
  309. item.ApplicationType = row["申请类型"].ToString().Trim();
  310. item.BusinessType = row["业务类型"].ToString().Trim();
  311. if (row.Table.Columns.Contains("备注(填表注意事项)"))
  312. item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
  313. item.DoItem = row["处理事项"].ToString().Trim();
  314. item.CaseStage = row["案件阶段"].ToString().Trim();
  315. item.CaseCoefficient = row["案件系数"].ToString().Trim();
  316. item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
  317. item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim(), Staffs);
  318. string strHandler = "";
  319. if (row.Table.Columns.Contains("处理人"))
  320. {
  321. strHandler = row["处理人"].ToString().Trim();
  322. }
  323. else
  324. {
  325. if (row.Table.Columns.Contains("案件处理人"))
  326. {
  327. strHandler = row["案件处理人"].ToString().Trim();
  328. }
  329. }
  330. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  331. item.ItemStaffs = new List<ItemStaff>();
  332. foreach (string name in temHandlers)
  333. {
  334. ItemStaff itemStaff = new ItemStaff();
  335. string temName = name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  336. int? iTem = GetStaff(temName, Staffs);
  337. if ((iTem != null))
  338. {
  339. //itemStaff.Item = item;
  340. itemStaff.DoPersonId = iTem.Value;
  341. item.ItemStaffs.Add(itemStaff);
  342. }
  343. else
  344. {
  345. itemStaff.DoPerson = new Staff()
  346. {
  347. Name = temName,
  348. Account = temName,
  349. Password = "12345678",
  350. IsCalPerformsnce = false,
  351. Status = "已离职",
  352. StaffGradeId = 4
  353. };
  354. item.ItemStaffs.Add(itemStaff);
  355. }
  356. }
  357. if (item.ItemStaffs.Count == 0)
  358. {
  359. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  360. }
  361. if (row.Table.Columns.Contains("核稿人"))
  362. {
  363. if (!string.IsNullOrEmpty(row["核稿人"].ToString().Trim()))
  364. {
  365. string temName = row["核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  366. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  367. }
  368. }
  369. else
  370. {
  371. if (row.Table.Columns.Contains("案件核稿人"))
  372. {
  373. if (!string.IsNullOrEmpty(row["案件核稿人"].ToString().Trim()))
  374. {
  375. string temName = row["案件核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  376. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  377. }
  378. }
  379. }
  380. if (!string.IsNullOrEmpty(row["点数"].ToString().Trim())) {
  381. item.BasePoint = double.Parse(row["点数"].ToString().Trim());
  382. }
  383. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  384. item.ApplicationName = row["申请人"].ToString().Trim();
  385. DateTime temDate = new DateTime();
  386. if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
  387. {
  388. item.FinishedDate = temDate;
  389. }
  390. //定稿日
  391. if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
  392. {
  393. item.FinalizationDate = temDate;
  394. }
  395. //返稿日
  396. if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
  397. {
  398. item.ReturnDate = temDate;
  399. }
  400. //案件类型
  401. item.CaseType = row["案件类型"].ToString().Trim();
  402. //案件状态
  403. item.CaseState = row["案件状态"].ToString().Trim();
  404. //处理事项备注
  405. item.DoItemMemo = row["处理事项备注"].ToString().Trim();
  406. //处理状态
  407. item.DoItemState = row["处理状态"].ToString().Trim();
  408. //案件名称
  409. item.CaseName = row["案件名称"].ToString().Trim();
  410. //委案日期
  411. if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
  412. {
  413. item.EntrustingDate = temDate;
  414. }
  415. //客户期限
  416. if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
  417. {
  418. item.CustomerLimitDate = temDate;
  419. }
  420. //内部期限
  421. if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
  422. {
  423. item.InternalDate = temDate;
  424. }
  425. //初稿日
  426. if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
  427. {
  428. item.FirstDraftDate = temDate;
  429. }
  430. //备注(发文严重超期是否属客观原因,若为否,请填写原因)
  431. if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
  432. {
  433. item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
  434. }
  435. //案件备注
  436. item.CaseMemo = row["案件备注"].ToString().Trim();
  437. return item;
  438. }
  439. private async Task InputPerformanceItem(string strExcelFile,bool isColumnName,bool ignorHideRows=false,int ColumnNameRow=0,CalMonth calMonth=null,bool isFirstOAFile=false)
  440. {
  441. DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName,ignorHideRows,ColumnNameRow);
  442. #region 删除重复行
  443. DataTable temdt = new DataTable();
  444. foreach (DataColumn col in dt.Columns)
  445. {
  446. DataColumn temCol = new DataColumn();
  447. temCol.ColumnName = col.ColumnName;
  448. temCol.DataType = col.DataType;
  449. temCol.Caption = col.Caption;
  450. temdt.Columns.Add(temCol);
  451. }
  452. new ExcelHelper().MerageDataTable(temdt, dt);
  453. #endregion
  454. List<Staff> Staffs =await GetStaffsAsync();
  455. foreach(DataRow row in temdt.Rows)
  456. {
  457. PerformanceItem item = null;
  458. if (isFirstOAFile)
  459. {
  460. item = Row2Item_1(row, Staffs, calMonth);
  461. }
  462. else
  463. {
  464. item = Row2Item(row, Staffs, calMonth);
  465. }
  466. if (item != null )
  467. {
  468. System.Diagnostics.Debug.WriteLine($"{DateTime.Now}\t{item.CaseNo}\t{item.CaseName}");
  469. if (!InValidDoItem.Contains(item.DoItem))
  470. {
  471. await SavePerformanceItem(item);
  472. }
  473. }
  474. }
  475. }
  476. private async Task Compare2DB()
  477. {
  478. if (Token == null)
  479. {
  480. await Login();
  481. }
  482. HttpClient http = CreateHttp();
  483. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  484. var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/CompareExcel2DB");
  485. //await GetDoItemInfo("PACN2027395", "处理审查意见", "一通");
  486. }
  487. private async Task RefreshPerformanceItem(int Type)
  488. {
  489. if (Token == null)
  490. {
  491. await Login();
  492. }
  493. await RefreshItemAsync(Type);
  494. //await GetDoItemInfo("PACN2027395", "处理审查意见", "一通");
  495. }
  496. private async Task CalJXPoint()
  497. {
  498. if (Token == null)
  499. {
  500. await Login();
  501. }
  502. await CalJXPointAsync(2022,2);
  503. //await CalJXPointAsync(2022, 1);
  504. }
  505. private async Task RemoveDBNotFinishedDate()
  506. {
  507. if (Token == null)
  508. {
  509. await Login();
  510. }
  511. await DeleteDBNotFinishedTimeAsync(2022, 2);
  512. //await CalJXPointAsync(2022, 1);
  513. }
  514. List<string> lstJXBL = new List<string>() {
  515. "柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
  516. ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","钟子敏"
  517. };
  518. List<string> lstAJXS = new List<string>() {
  519. "柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
  520. ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","钟子敏","邢丽霞",
  521. "李庆波","黄瑜","程利","黎坚怡","舒丽亚","管自英","张晓薇","刘希"
  522. };
  523. List<string> lstDoItemXS = new List<string>() {
  524. "吴继红","赖玲玲","郭竟微","陈鹤","王本鼎","高凌云","周煜祥","何丹风",
  525. "田婵玉","孙心洁","陈舒敏","邢丽霞"
  526. };
  527. List<string> lstAJQL = new List<string>() {
  528. "柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
  529. ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","吴继红","赖玲玲","郭竟微","陈鹤",
  530. "王本鼎","高凌云","周煜祥","何丹风","田婵玉","孙心洁","陈舒敏","钟子敏",
  531. "李庆波","黄瑜","程利","黎坚怡","舒丽亚","管自英","张晓薇","刘希"
  532. };
  533. List<string> lstYZCQ = new List<string>() {
  534. "吴继红","赖玲玲","郭竟微","陈鹤","王本鼎","高凌云","周煜祥","何丹风",
  535. "田婵玉","孙心洁","陈舒敏"
  536. };
  537. List<string> lstRXSX = new List<string>() {
  538. "夏敏","柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
  539. ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","钟子敏","李庆波","黄瑜","程利",
  540. "黎坚怡","舒丽亚","管自英","张晓薇","刘希"
  541. };
  542. private async Task UserField2String(List<string> lstList)
  543. {
  544. if (Token == null)
  545. {
  546. await Login();
  547. }
  548. //List<Staff> Reviewers = await getReviewers(14232, 1);
  549. //Reviewers = await getReviewers(14232, 5);
  550. List<Staff> Staffs = await GetStaffsAsync();
  551. List<UserField> lstUsers = new List<UserField>();
  552. foreach(var name in lstList)
  553. {
  554. lstUsers.Add(new UserField()
  555. {
  556. UserConditionType = UserConditionType.Staff,
  557. UserType = UserType.Staff,
  558. UserValue = GetStaff(name, Staffs).ToString()
  559. });
  560. }
  561. JsonSerializerOptions options = new() { IgnoreNullValues = true };
  562. var strJson = System.Text.Json.JsonSerializer.Serialize(lstUsers, lstUsers.GetType(), options);
  563. System.Diagnostics.Debug.WriteLine(strJson);
  564. }
  565. private int? GetStaff(string v, List<Staff> staffs)
  566. {
  567. if (!string.IsNullOrEmpty(v))
  568. {
  569. string[] temNames = v.Trim().Split(new char[] { '-' },StringSplitOptions.RemoveEmptyEntries);
  570. foreach (Staff sf in staffs)
  571. {
  572. if(sf.Name == temNames[0])
  573. {
  574. return sf.Id;
  575. }
  576. }
  577. }
  578. return null;
  579. }
  580. private async Task InitDepartment()
  581. {
  582. if (Token == null)
  583. {
  584. await Login();
  585. }
  586. string strUrl = $"{strAPIBaseUri}/api/Organization/InitUserDepartment";
  587. HttpClient http = CreateHttp();
  588. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  589. var response = await http.GetAsync(strUrl);
  590. }
  591. private async Task UpdateStaff()
  592. {
  593. OpenFileDialog ofd = new OpenFileDialog();
  594. if (ofd.ShowDialog() == DialogResult.OK)
  595. {
  596. string fileName = ofd.FileName;
  597. DataTable dt = NPOIExcel.ExcelToDataTable(fileName, true, false,0);
  598. if (Token == null)
  599. {
  600. await Login();
  601. }
  602. foreach(DataRow row in dt.Rows)
  603. {
  604. Staff staff = new Staff();
  605. staff.Account = row["Account"].ToString();
  606. staff.Name = row["Name"].ToString().Trim();
  607. staff.Sex = row["Sex"].ToString().Trim();
  608. staff.Status = row["Status"].ToString().Trim();
  609. staff.Tel = row["Tel"].ToString();
  610. if (staff.Tel == "NULL")
  611. {
  612. staff.Tel = null;
  613. }
  614. staff.Mobile = row["Mobile"].ToString().Trim();
  615. if (staff.Mobile == "NULL")
  616. {
  617. staff.Mobile = null;
  618. }
  619. string temStatus = row["xm备注1"].ToString();
  620. if(!string.IsNullOrEmpty(temStatus) && temStatus != staff.Status)
  621. {
  622. staff.Status = temStatus;
  623. }
  624. if (staff.Status == "NULL")
  625. {
  626. staff.Status = null;
  627. }
  628. staff.IsOnJob = (row["IsOnJob"].ToString() == "1");
  629. staff.IsCalPerformsnce = (row["IsCalPerformsnce"].ToString() == "1");
  630. staff.IsCalPerformsnce = (row["是否计算绩效"].ToString() == "是");
  631. staff.Department = row["Department"].ToString().Trim();
  632. if (staff.Department == "NULL")
  633. {
  634. staff.Department = null;
  635. }
  636. staff.WorkPlace = row["WorkPlace"].ToString().Trim();
  637. if (staff.WorkPlace == "NULL")
  638. {
  639. staff.WorkPlace = null;
  640. }
  641. staff.Mail = row["Mail"].ToString().Trim();
  642. if (staff.Mail == "NULL")
  643. {
  644. staff.Mail = null;
  645. }
  646. staff.Memo = row["Memo"].ToString().Trim();
  647. if (staff.Memo == "NULL")
  648. {
  649. staff.Memo = null;
  650. }
  651. int temSGID;
  652. if (int.TryParse(row["StaffGradeId"].ToString().Trim(), out temSGID)){
  653. staff.StaffGradeId = temSGID;
  654. }
  655. DateTime temDate;
  656. if(DateTime.TryParse(row["EntyDate"].ToString(),out temDate))
  657. {
  658. staff.EntyDate = temDate;
  659. }
  660. // xm备注2 StaffGradeId EntyDate
  661. var temStaff = await GetStaff(staff.Name);
  662. bool isSaved = false;
  663. if (temStaff == null)
  664. {
  665. isSaved = true;
  666. //staff.Password = MD5Utility.GetMD5("12345678");
  667. }
  668. else
  669. {
  670. staff.Id = temStaff.Id;
  671. //staff.Password = temStaff.Password;
  672. isSaved =
  673. (staff.Name != temStaff.Name) ||
  674. (staff.Account != temStaff.Account) ||
  675. (staff.Department != temStaff.Department) ||
  676. (staff.EntyDate != temStaff.EntyDate) ||
  677. (staff.IsOnJob != temStaff.IsOnJob) ||
  678. (staff.Mail != temStaff.Mail) ||
  679. (staff.Mobile != temStaff.Mobile) ||
  680. (staff.Sex != temStaff.Sex) ||
  681. (staff.Status != temStaff.Status) ||
  682. (staff.Tel != temStaff.Tel) ||
  683. (staff.WorkPlace != temStaff.WorkPlace) ||
  684. (staff.StaffGradeId != temStaff.StaffGradeId) ||
  685. (staff.IsCalPerformsnce != temStaff.IsCalPerformsnce );
  686. }
  687. if (isSaved)
  688. {
  689. //staff.IsCalPerformsnce = (row["是否核算绩效"].ToString() == "是");
  690. //staff.Memo = row["备注"].ToString().Trim();
  691. //staff.StaffGradeId = row["姓名"].ToString();
  692. await SaveStaff(staff);
  693. }
  694. System.Diagnostics.Debug.WriteLine($"{staff.Account}\t{staff.Name}");
  695. }
  696. }
  697. }
  698. private async Task ImportUsers()
  699. {
  700. OpenFileDialog ofd = new OpenFileDialog();
  701. if (ofd.ShowDialog() == DialogResult.OK)
  702. {
  703. string fileName = ofd.FileName;
  704. DataTable dt = NPOIExcel.ExcelToDataTable(fileName, true, false, 1);
  705. if(Token == null)
  706. {
  707. await Login();
  708. }
  709. List<StaffGrade> staffGrades = await GetStaffGrades();
  710. foreach (DataRow row in dt.Rows)
  711. {
  712. Staff staff = new Staff();
  713. staff.Account = row["用户名"].ToString().Trim();
  714. staff.Name = row["姓名"].ToString().Trim();
  715. staff.Tel = row["电话号码"].ToString().Trim();
  716. staff.Mobile = row["手机号码"].ToString().Trim();
  717. staff.Sex = row["性别"].ToString().Trim();
  718. staff.Mail = row["邮箱"].ToString().Trim();
  719. string strGrade = row["工程师等级"].ToString().Trim(); // + "级";
  720. foreach (StaffGrade sg in staffGrades)
  721. {
  722. if (strGrade.Trim() == sg.Grade.Trim())
  723. {
  724. staff.StaffGradeId = sg.Id;
  725. break;
  726. }
  727. }
  728. staff.IsOnJob = (row["是否在职"].ToString().Trim() == "是");
  729. staff.Status = row["岗位状态"].ToString().Trim();
  730. staff.Department = row["部门"].ToString();
  731. staff.WorkPlace = row["工作地"].ToString();
  732. DateTime temDate;
  733. if (DateTime.TryParse(row["入职时间"].ToString(), out temDate))
  734. {
  735. staff.EntyDate = temDate;
  736. }
  737. var temStaff = await GetStaff(staff.Name);
  738. bool isSaved = false;
  739. if (temStaff == null)
  740. {
  741. isSaved = true;
  742. staff.Password = MD5Utility.GetMD5("12345678");
  743. }
  744. else
  745. {
  746. staff.Id = temStaff.Id;
  747. staff.Password = temStaff.Password;
  748. isSaved =
  749. (staff.Name != temStaff.Name) ||
  750. (staff.Account != temStaff.Account) ||
  751. (staff.Department != temStaff.Department) ||
  752. (staff.EntyDate != temStaff.EntyDate) ||
  753. (staff.IsOnJob != temStaff.IsOnJob) ||
  754. (staff.Mail != temStaff.Mail) ||
  755. (staff.Mobile != temStaff.Mobile) ||
  756. (staff.Sex != temStaff.Sex) ||
  757. (staff.Status != temStaff.Status) ||
  758. (staff.Tel != temStaff.Tel) ||
  759. (staff.WorkPlace != temStaff.WorkPlace) ||
  760. (staff.StaffGradeId != temStaff.StaffGradeId);
  761. }
  762. if (isSaved)
  763. {
  764. //staff.IsCalPerformsnce = (row["是否核算绩效"].ToString() == "是");
  765. //staff.Memo = row["备注"].ToString().Trim();
  766. //staff.StaffGradeId = row["姓名"].ToString();
  767. await SaveStaff(staff);
  768. }
  769. }
  770. }
  771. }
  772. private string getPinYin(string str)
  773. {
  774. string retStr = "";
  775. for(int i = 0; i < str.Length; i++)
  776. {
  777. ChineseChar cc = new ChineseChar(str[i]);
  778. retStr = retStr + cc.Pinyins[0].ToLower().Replace("1","")
  779. .Replace("2", "").Replace("3", "").Replace("4", "");
  780. }
  781. return retStr;
  782. }
  783. string strAPIBaseUri = "http://47.106.221.167:8081"; // "http://localhost:39476";//
  784. userToken Token;
  785. public async Task GetTest()
  786. {
  787. await Login();
  788. string strUrl = $"{strAPIBaseUri}/api/PerformanceItem/CurrentData2Excel";
  789. HttpClient http = CreateHttp();
  790. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  791. var response = await http.GetFromJsonAsync<FileProcessTask>(strUrl);
  792. while (!response.Finished)
  793. {
  794. response = await http.GetFromJsonAsync<FileProcessTask>($"{strAPIBaseUri}/api/FileProcesTask/Get?Id={response.Id}");
  795. System.Diagnostics.Debug.WriteLine($"{response.Processed}/{response.Size}");
  796. System.Threading.Thread.Sleep(2000);
  797. }
  798. byte[] data = await http.GetByteArrayAsync($"{strAPIBaseUri}/api/FileProcesTask/Download?Id={response.Id}");
  799. using (var file = System.IO.File.Create(response.FilePath))
  800. {
  801. file.Write(data, 0, data.Length);
  802. }
  803. #region aaa
  804. //DataTable dt = utility.NPOIExcel.ExcelToDataTable("C:\\temp\\userList.xlsx", true, false, 0);
  805. //foreach (DataRow row in dt.Rows)
  806. //{
  807. // string strAccount = row["Account"].ToString();
  808. // System.Diagnostics.Debug.WriteLine(strAccount);
  809. // string strStatus = row["Status"].ToString();
  810. // if (string.IsNullOrEmpty(strStatus))
  811. // {
  812. // strStatus = "未知";
  813. // }
  814. // string strMail = row["Mail"].ToString();
  815. // if (strAccount != "陈金勇" && strAccount!="南通流程邮箱")
  816. // {
  817. // string strUrl = $"{strAPIBaseUri}/api/Account/Modify?accountName={strAccount}&status={strStatus}&mail={strMail}";
  818. // var response = await CreateHttp().GetFromJsonAsync<ApiSaveResponse>(strUrl);
  819. // }
  820. // else
  821. // {
  822. // Console.WriteLine("");
  823. // }
  824. //}
  825. #endregion
  826. //var strUrl = "https://47.106.221.167/api/PerformanceItem/CalMyStatistics?userid=98&year=2021&month=12";
  827. //var response =await CreateHttp().GetFromJsonAsync<List<StaffStatistics>>(strUrl);
  828. }
  829. public async Task Login()
  830. {
  831. share.webViewObject.loginDto dto = new share.webViewObject.loginDto();
  832. dto.Name = "caiyangl";
  833. dto.Password = "Lqftiu807005";
  834. var response =await CreateHttp().PostAsJsonAsync<loginDto>($"{strAPIBaseUri}/api/account/Login", dto);
  835. if (response.IsSuccessStatusCode)
  836. {
  837. Token = await response.Content.ReadFromJsonAsync<userToken>();
  838. }
  839. }
  840. public async Task<entity.workflowDefine.Workflow> GetWorkflow(int Id, HttpClient _httpClient)
  841. {
  842. var ret = await _httpClient.GetFromJsonAsync<entity.workflowDefine.Workflow>($"{strAPIBaseUri}/api/WorkflowEngine/GetWorkflow?workflowId={Id}");
  843. return ret;
  844. }
  845. public async Task<List<entity.workflowDefine.Step>> GetSteps(int Id, HttpClient _httpClient)
  846. {
  847. var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Step>>($"{strAPIBaseUri}/api/WorkflowEngine/GetSteps?workflowId={Id}");
  848. return ret;
  849. }
  850. public async Task<List<entity.workflowDefine.Action>> GetActions(int workflowId, HttpClient _httpClient)
  851. {
  852. var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Action>>($"{strAPIBaseUri}/api/WorkflowEngine/GetActions?workflowId={workflowId}");
  853. return ret;
  854. }
  855. public async Task<List<entity.workflowDefine.TrasferCondition>> GetTransfers(int workflowId, HttpClient _httpClient)
  856. {
  857. var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.TrasferCondition>>($"{strAPIBaseUri}/api/WorkflowEngine/GetTrasfers?workflowId={workflowId}");
  858. return ret;
  859. }
  860. private async Task SaveStaff(Staff obj)
  861. {
  862. HttpClient http = CreateHttp();
  863. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  864. var data = await http.PostAsJsonAsync<wispro.sp.entity.Staff>($"{strAPIBaseUri}/api/Staff/Save", obj);
  865. if (data.IsSuccessStatusCode)
  866. {
  867. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  868. //await Task.Delay(1000);
  869. if (result.Success)
  870. {
  871. }
  872. else
  873. {
  874. }
  875. }
  876. else
  877. {
  878. }
  879. }
  880. private async Task<Staff> GetStaff(string strName)
  881. {
  882. HttpClient http = CreateHttp();
  883. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  884. try
  885. {
  886. var data = await http.GetFromJsonAsync<wispro.sp.entity.Staff>($"{strAPIBaseUri}/api/Staff/GetByName?Name={strName}");
  887. return data;
  888. }
  889. catch
  890. {
  891. return null;
  892. }
  893. }
  894. private async Task SaveBasePointRule(BasePointRule obj)
  895. {
  896. HttpClient http = CreateHttp();
  897. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  898. var data = await http.PostAsJsonAsync<BasePointRule>($"{strAPIBaseUri}/api/BasePointRule/New", obj);
  899. if (data.IsSuccessStatusCode)
  900. {
  901. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  902. //await Task.Delay(1000);
  903. if (result.Success)
  904. {
  905. }
  906. else
  907. {
  908. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.Rule}\t{obj.PointExpress}\r\n{result.ErrorMessage}");
  909. }
  910. }
  911. else
  912. {
  913. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.Type}\t{obj.Rule}");
  914. }
  915. }
  916. private async Task SavePerformanceItem(PerformanceItem obj)
  917. {
  918. HttpClient http = CreateHttp();
  919. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  920. if (obj.CalMonth.Month == 10)
  921. {
  922. System.Diagnostics.Debug.WriteLine($"{obj.CalMonth.Year}-{obj.CalMonth.Month}\t{obj.CaseNo}");
  923. }
  924. var isExist = await http.PostAsJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/IsExist", obj);
  925. if (isExist.IsSuccessStatusCode && await isExist.Content.ReadFromJsonAsync<bool>()==false)
  926. {
  927. var data = await http.PostAsJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/New", obj);
  928. if (data.IsSuccessStatusCode)
  929. {
  930. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  931. //await Task.Delay(1000);
  932. if (result.Success)
  933. {
  934. }
  935. else
  936. {
  937. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.CaseNo}\t{obj.DoItem}\r\n{result.ErrorMessage}");
  938. }
  939. }
  940. else
  941. {
  942. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.CaseNo}\t{obj.DoItem}");
  943. }
  944. }
  945. }
  946. private HttpClient CreateHttp()
  947. {
  948. HttpClientHandler clientHandler = new HttpClientHandler();
  949. clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
  950. return new HttpClient(clientHandler);
  951. }
  952. private async Task<List<StaffGrade>> GetStaffGrades()
  953. {
  954. HttpClient http = CreateHttp();
  955. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  956. var _StaffGrade = await http.GetFromJsonAsync<List<StaffGrade>>($"{strAPIBaseUri}/api/StaffGrade/GetAll");
  957. return _StaffGrade;
  958. }
  959. private async Task<List<Staff>> GetStaffsAsync()
  960. {
  961. HttpClient http = CreateHttp();
  962. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  963. ListApiResponse<Staff> data = await http.GetFromJsonAsync<ListApiResponse<Staff>>($"{strAPIBaseUri}/api/Staff/Query?pageIndex=1&pageSize=1000");
  964. return data.Results;
  965. }
  966. private async Task<PerformanceItem> CalJXPointAsync(int year,int month)
  967. {
  968. HttpClient http = CreateHttp();
  969. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  970. var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/CalJXPoint?year={year}&month={month}");
  971. return data;
  972. }
  973. private async Task<PerformanceItem> DeleteDBNotFinishedTimeAsync(int year, int month)
  974. {
  975. HttpClient http = CreateHttp();
  976. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  977. var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/RemoveDBNotFinishDate?year={year}&month={month}");
  978. return data;
  979. }
  980. private async Task<PerformanceItem> RefreshItemAsync(int type)
  981. {
  982. HttpClient http = CreateHttp();
  983. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  984. var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/RefreshFromIPEasy_Batch?type={type}");
  985. return data;
  986. }
  987. private async Task<List<Staff>> getReviewers(int itemId,int appealTypeId)
  988. {
  989. HttpClient http = CreateHttp();
  990. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  991. List<Staff> data = await http.GetFromJsonAsync<List<Staff>>($"{strAPIBaseUri}/api/Staff/GetReviewers?itemId={itemId}&appealTypeId={appealTypeId}");
  992. return data;
  993. }
  994. private async Task<PerformanceItem> GetDoItemInfo(string CaseNo, string DoItem, string caseStage)
  995. {
  996. HttpClient http = CreateHttp();
  997. http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
  998. PerformanceItem data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/IPEasy/GetDoItemInfo?CaseNo={CaseNo}&DoItem={DoItem}&caseStage={caseStage}");
  999. return data;
  1000. }
  1001. private void button4_Click(object sender, EventArgs e)
  1002. {
  1003. Stopwatch watch = new Stopwatch();
  1004. watch.Start();
  1005. //每月绩效统计--发客户超过一个月未完成案件
  1006. //DownloadReport("每月绩效统计--发客户超过一个月未完成案件", calMonth, false);
  1007. //每月绩效统计--上个月递交完成案件
  1008. //DownloadReport("每月绩效统计--上个月递交完成案件", calMonth, true);
  1009. //每月绩效统计--中国一次OA授权表
  1010. //DownloadReport("每月绩效统计--中国一次OA授权表", calMonth, true, true);
  1011. //"每月绩效统计--专案进度跟踪~S卷", "每月绩效统计--专案开卷报表~S卷"
  1012. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--发客户超过一个月未完成案件", false);
  1013. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件", true);
  1014. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--中国一次OA授权表", true);
  1015. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--专案进度跟踪~S卷", false);
  1016. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--专案开卷报表~S卷", false);
  1017. #region aaa
  1018. //dynamic retObj = wispro.sp.utility.IPEasyUtility.GetPerformanceRecord("S2112392-洗碗机调查分析","提出报告");
  1019. //PerformanceItem Item = new PerformanceItem();
  1020. //Item.CaseName = retObj.CaseName;
  1021. //Item.CaseNo = retObj.CaseNo;
  1022. //Item.DoItem = retObj.DoItem;
  1023. //Item.CustomerLimitDate = string.IsNullOrEmpty(retObj.CustomerLimitDate) ? null : DateTime.Parse(retObj.CustomerLimitDate);
  1024. //Item.Customer = new Customer();
  1025. //Item.Customer.Name = retObj.CustomerName;
  1026. //Item.DoItemCoefficient = retObj.DoItemCoefficient;
  1027. //Item.DoItemMemo = retObj.DoItemMemo;
  1028. //Item.DoItemState = retObj.DoItemState;
  1029. //Item.EntrustingDate = string.IsNullOrEmpty(retObj.EntrustingDate) ? null : DateTime.Parse(retObj.EntrustingDate);
  1030. //Item.FinalizationDate = string.IsNullOrEmpty(retObj.FinalizationDate) ? null : DateTime.Parse(retObj.FinalizationDate);
  1031. //Item.FinishedDate = string.IsNullOrEmpty(retObj.FinishedDate) ? null : DateTime.Parse(retObj.FinishedDate);
  1032. ////Item.FirstDraftDate = string.IsNullOrEmpty(retObj.FirstDraftDate) ? null : DateTime.Parse(retObj.FirstDraftDate);
  1033. //Item.InternalDate = string.IsNullOrEmpty(retObj.InternalDate) ? null : DateTime.Parse(retObj.InternalDate);
  1034. //if (!string.IsNullOrEmpty(retObj.DoPersons))
  1035. //{
  1036. // Item.ItemStaffs = new List<ItemStaff>();
  1037. // string[] names = retObj.DoPersons.ToString().Split(new char[] { ','},StringSplitOptions.RemoveEmptyEntries);
  1038. // foreach(var name in names)
  1039. // {
  1040. // ItemStaff iStaff = new ItemStaff();
  1041. // iStaff.DoPerson = new Staff() { Name = name };
  1042. // Item.ItemStaffs.Add(iStaff);
  1043. // }
  1044. //}
  1045. //Item.ReturnDate = string.IsNullOrEmpty(retObj.ReturnDate) ? null : DateTime.Parse(retObj.ReturnDate);
  1046. //if (!string.IsNullOrEmpty(retObj.Reviewer))
  1047. //{
  1048. // Item.Reviewer = new Staff() { Name = retObj.Reviewer };
  1049. //}
  1050. //Item.ApplicationType = retObj.ApplicationType;
  1051. //Item.BusinessType = retObj.BusinessType;
  1052. //Item.CaseCoefficient = retObj.CaseCoefficient;
  1053. //Item.CaseMemo = retObj.CaseMemo;
  1054. //Item.CaseStage = retObj.CaseStage;
  1055. //Item.CaseState = retObj.CaseState;
  1056. //Item.CaseType = retObj.CaseType;
  1057. #endregion
  1058. watch.Stop();
  1059. System.Diagnostics.Debug.WriteLine("用时{0}毫秒", watch.ElapsedMilliseconds);//获取当前实例测量得出的总运行时间(以毫秒为单位)
  1060. //wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件", true);
  1061. //wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--发客户超过一个月未完成案件", false);
  1062. //wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--中国一次OA授权表", true);
  1063. ////每月绩效统计--发客户超过一个月未完成案件
  1064. //NewMethod("506aa7ad-c3f4-4ec6-9ec8-ff6b92dcd7c1", "每月绩效统计--发客户超过一个月未完成案件.xlsx", calMonth);
  1065. ////每月绩效统计--上个月递交完成案件
  1066. //NewMethod("d7308cd2-71e4-4444-9f47-f4d731ddb26a", "每月绩效统计--上个月递交完成案件.xlsx", calMonth);
  1067. ////每月绩效统计--中国一次OA授权表
  1068. //NewMethod("72454834-afdd-4b98-b42a-0bc912d07610", "每月绩效统计--中国一次OA授权表.xlsx", calMonth, true);
  1069. }
  1070. }
  1071. }