Form1.cs 50 KB

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