Form1.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  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.Drawing;
  9. using System.Linq;
  10. using System.Net.Http;
  11. using System.Net.Http.Json;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15. using wispro.sp.entity;
  16. using wispro.sp.share;
  17. using wispro.sp.utility;
  18. namespace wispro.sp.winClient
  19. {
  20. public partial class Form1 : Form
  21. {
  22. public Form1()
  23. {
  24. InitializeComponent();
  25. }
  26. private void button1_Click(object sender, EventArgs e)
  27. {
  28. DateTime startTime = DateTime.Now;
  29. frmMerageExcel frm = new frmMerageExcel();
  30. if (frm.ShowDialog() == DialogResult.OK)
  31. {
  32. MessageBox.Show($"合并完成,合并后文件保存在:\r\n{frm.SaveFilePath}\r\n用时:{DateTime.Now - startTime }");
  33. }
  34. }
  35. private void button2_Click(object sender, EventArgs e)
  36. {
  37. OpenFileDialog ofd = new OpenFileDialog()
  38. {
  39. Multiselect = false,
  40. Filter = "*.xls|*.xlsx"
  41. };
  42. string strDinashuRegularFile = ConfigurationSettings.AppSettings["DinashuRegularFile"];
  43. if (ofd.ShowDialog() == DialogResult.OK)
  44. {
  45. new ExcelHelper().FillDianShu(ofd.FileName, strDinashuRegularFile);
  46. }
  47. MessageBox.Show("完成点数输入!");
  48. }
  49. private string[] InValidDoItem = new string[]
  50. {
  51. "案件异常-催缴年费",
  52. "案件异常-视为放弃取得专利权",
  53. "办理登记手续",
  54. "办理登记手续-确认客户是否委托",
  55. "代理所变更",
  56. "绘图",
  57. "技术确认",
  58. "缴年费",
  59. "请求保密审查",
  60. "请求费减",
  61. "请求实审",
  62. "取得申请号",
  63. "取得证书",
  64. "取得专利权评价报告",
  65. "确认官方审查状况",
  66. "询问放弃或复审",
  67. "知识点总结",
  68. "专利权人发明人申请人信息变更",
  69. "专利挖掘与布局",
  70. "我方文号前缀带J",
  71. "开卷",
  72. "请求提前公开",
  73. "取得国际检索报告",
  74. "委外检索",
  75. "中止程序",
  76. "终止",
  77. "案件异常-视为撤回",
  78. "进入国家阶段提醒",
  79. "请求恢复权利",
  80. "请求优先权",
  81. "取得【无效宣告请求审查决定】",
  82. "撤回",
  83. "请求退款",
  84. "确认是否委托申请与类型",
  85. "专利交易",
  86. "专利权评价报告",
  87. "专利权人发明人申请人信息变更+代理所变更"
  88. };
  89. private async Task InitRules(bool isSave)
  90. {
  91. List<BasePointRule> rules = new List<BasePointRule>();
  92. DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("ExcelFiles\\20211109-绩效点数规则-lcy-v1.xlsx", true);
  93. PerformanceItem item = new PerformanceItem() { CaseNo = "PAEPO2016277", DoItem= "提交检索主题声明", };
  94. foreach(DataRow row in dt.Rows)
  95. {
  96. BasePointRule rule = new BasePointRule()
  97. {
  98. Rule = row["规则"].ToString(),
  99. PointExpress = row["点数计算"].ToString(),
  100. Priority = int.Parse(row["优先级修订"].ToString()),
  101. Type = row["类型"].ToString()
  102. };
  103. try
  104. {
  105. var interpreter = new Interpreter();
  106. //item.ApplicationType
  107. Func<PerformanceItem, bool> func = interpreter.ParseAsDelegate<Func<PerformanceItem, bool>>(rule.Rule, "p");
  108. bool result = func.Invoke(item);
  109. if (result)
  110. {
  111. item.BasePoint = (double?)interpreter.Eval(rule.PointExpress);
  112. item.Type = rule.Type;
  113. System.Diagnostics.Debug.WriteLine("");
  114. }
  115. rules.Add(rule);
  116. }
  117. catch(Exception ex)
  118. {
  119. System.Diagnostics.Debug.WriteLine(rule.Rule + "\r\n" + ex.ToString());
  120. }
  121. }
  122. if (isSave)
  123. {
  124. foreach (BasePointRule rule in rules)
  125. {
  126. double d;
  127. if(double.TryParse(rule.PointExpress,out d))
  128. {
  129. rule.PointExpress = d.ToString("0.00");
  130. }
  131. await SaveBasePointRule(rule);
  132. }
  133. }
  134. }
  135. public async Task TestQueryFilter()
  136. {
  137. //QueryFilter filter = new QueryFilter();
  138. //filter.ConditionTree = new ExpressTree();
  139. //string ValueType = typeof(PerformanceItem).GetProperty("CaseNo").PropertyType.ToString();
  140. //FieldCondition condition1 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PACN", ValueType = ValueType };
  141. //FieldCondition condition2 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PAUS", ValueType = ValueType };
  142. //filter.ConditionTree.AddCondition(LogicEnum.And,condition1);
  143. //filter.ConditionTree.AddCondition(LogicEnum.Or, condition2);
  144. //System.Diagnostics.Debug.WriteLine(filter.ConditionTree.ToExpressString("s")); ;
  145. }
  146. private async void button3_Click(object sender, EventArgs e)
  147. {
  148. //await TestQueryFilter();
  149. List<PerformanceItem> retList = new List<PerformanceItem>();
  150. var test= retList.Where<PerformanceItem>(p => p.isDanger());
  151. await InitRules(true);
  152. //return;
  153. await ImportUsers();
  154. await InputPerformanceItem("ExcelFiles\\21.01-21.06 工程师绩效报表-总表.xlsx", true, false, 0);
  155. //CalMonth cal = new CalMonth()
  156. //{
  157. // Year = 2021,
  158. // Month = 9,
  159. // Status = 0
  160. //};
  161. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--发客户超过一个月未完成案件.xlsx", true,false,1, cal);
  162. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--上个月递交完成案件.xlsx", true, false, 1, cal);
  163. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--中国一次OA授权表.xlsx", true, false, 1, cal,true);
  164. MessageBox.Show("导入完成!");
  165. }
  166. private PerformanceItem Row2Item_1(DataRow row, List<Staff> Staffs, CalMonth calMonth)
  167. {
  168. PerformanceItem item = new PerformanceItem();
  169. item.ApplicationType = row["申请类型"].ToString().Trim();
  170. if(item.ApplicationType != "发明")
  171. {
  172. return null;
  173. }
  174. item.CaseNo = row["我方文号"].ToString().Trim();
  175. if (calMonth != null)
  176. {
  177. item.CalMonth = calMonth;
  178. }
  179. else
  180. {
  181. if (row.Table.Columns.Contains("绩效核算月份"))
  182. {
  183. string strjxyf = row["绩效核算月份"].ToString().Trim();
  184. string[] temYFs = strjxyf.Split(new char[] { '.' });
  185. item.CalMonth = new CalMonth();
  186. item.CalMonth.Year = int.Parse(temYFs[0]);
  187. item.CalMonth.Month = int.Parse(temYFs[1]);
  188. item.CalMonth.Status = 4;
  189. }
  190. else
  191. {
  192. item.CalMonth = new CalMonth();
  193. item.Status = 0;
  194. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  195. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  196. }
  197. }
  198. item.ApplicationType = row["申请类型"].ToString().Trim();
  199. item.BusinessType = "普通新申请"; // row["业务类型"].ToString().Trim();
  200. item.AgentFeedbackMemo = "发明一次OA授权"; //row["备注(填表注意事项)"].ToString().Trim();
  201. item.DoItem = "发明一次OA授权"; //row["处理事项"].ToString().Trim();
  202. string strHandler = "";
  203. if (row.Table.Columns.Contains("处理人"))
  204. {
  205. strHandler = row["处理人"].ToString().Trim();
  206. }
  207. else
  208. {
  209. if (row.Table.Columns.Contains("案件处理人"))
  210. {
  211. strHandler = row["案件处理人"].ToString().Trim();
  212. }
  213. }
  214. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  215. item.ItemStaffs = new List<ItemStaff>();
  216. foreach (string name in temHandlers)
  217. {
  218. ItemStaff itemStaff = new ItemStaff();
  219. int? iTem = GetStaff(name, Staffs);
  220. if ((iTem != null))
  221. {
  222. //itemStaff.Item = item;
  223. itemStaff.DoPersonId = iTem.Value;
  224. item.ItemStaffs.Add(itemStaff);
  225. }
  226. else
  227. {
  228. itemStaff.DoPerson = new Staff()
  229. {
  230. Name = name,
  231. Account = name,
  232. Password = "12345678",
  233. IsCalPerformsnce = false,
  234. Status = "正式员工",
  235. StaffGradeId = 4
  236. };
  237. item.ItemStaffs.Add(itemStaff);
  238. }
  239. }
  240. if (item.ItemStaffs.Count == 0)
  241. {
  242. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  243. }
  244. if (row.Table.Columns.Contains("核稿人"))
  245. {
  246. item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
  247. }
  248. else
  249. {
  250. if (row.Table.Columns.Contains("案件核稿人"))
  251. {
  252. item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim(), Staffs);
  253. }
  254. }
  255. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  256. item.ApplicationName = row["申请人"].ToString().Trim();
  257. item.CaseName = row["案件名称"].ToString().Trim();
  258. //案件备注
  259. item.CaseMemo = $"发文日期:{row["发文日期"].ToString().Trim()}\r\n客户文号:{row["客户文号"].ToString().Trim()}\r\n上传日期:{row["上传日期"].ToString().Trim()}\r\n文件描述:{row["文件描述"].ToString().Trim()}";
  260. return item;
  261. }
  262. private PerformanceItem Row2Item(DataRow row, List<Staff> Staffs,CalMonth calMonth)
  263. {
  264. PerformanceItem item = new PerformanceItem();
  265. item.CaseNo = row["我方文号"].ToString().Trim();
  266. if (calMonth != null)
  267. {
  268. item.CalMonth = calMonth;
  269. }
  270. else
  271. {
  272. if (row.Table.Columns.Contains("绩效核算月份"))
  273. {
  274. string strjxyf = row["绩效核算月份"].ToString().Trim();
  275. string[] temYFs = strjxyf.Split(new char[] { '.' });
  276. item.CalMonth = new CalMonth();
  277. item.CalMonth.Year = int.Parse(temYFs[0]);
  278. item.CalMonth.Month = int.Parse(temYFs[1]);
  279. item.CalMonth.Status = 4;
  280. }
  281. else
  282. {
  283. item.CalMonth = new CalMonth();
  284. item.Status = 0;
  285. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  286. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  287. }
  288. }
  289. item.ApplicationType = row["申请类型"].ToString().Trim();
  290. item.BusinessType = row["业务类型"].ToString().Trim();
  291. if (row.Table.Columns.Contains("备注(填表注意事项)"))
  292. item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
  293. item.DoItem = row["处理事项"].ToString().Trim();
  294. item.CaseStage = row["案件阶段"].ToString().Trim();
  295. item.CaseCoefficient = row["案件系数"].ToString().Trim();
  296. item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
  297. item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim(), Staffs);
  298. string strHandler = "";
  299. if (row.Table.Columns.Contains("处理人"))
  300. {
  301. strHandler = row["处理人"].ToString().Trim();
  302. }
  303. else
  304. {
  305. if (row.Table.Columns.Contains("案件处理人"))
  306. {
  307. strHandler = row["案件处理人"].ToString().Trim();
  308. }
  309. }
  310. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  311. item.ItemStaffs = new List<ItemStaff>();
  312. foreach (string name in temHandlers)
  313. {
  314. ItemStaff itemStaff = new ItemStaff();
  315. string temName = name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  316. int? iTem = GetStaff(temName, Staffs);
  317. if ((iTem != null))
  318. {
  319. //itemStaff.Item = item;
  320. itemStaff.DoPersonId = iTem.Value;
  321. item.ItemStaffs.Add(itemStaff);
  322. }
  323. else
  324. {
  325. itemStaff.DoPerson = new Staff()
  326. {
  327. Name = temName,
  328. Account = temName,
  329. Password = "12345678",
  330. IsCalPerformsnce = false,
  331. Status = "已离职",
  332. StaffGradeId = 4
  333. };
  334. item.ItemStaffs.Add(itemStaff);
  335. }
  336. }
  337. if (item.ItemStaffs.Count == 0)
  338. {
  339. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  340. }
  341. if (row.Table.Columns.Contains("核稿人"))
  342. {
  343. if (!string.IsNullOrEmpty(row["核稿人"].ToString().Trim()))
  344. {
  345. string temName = row["核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  346. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  347. }
  348. }
  349. else
  350. {
  351. if (row.Table.Columns.Contains("案件核稿人"))
  352. {
  353. if (!string.IsNullOrEmpty(row["案件核稿人"].ToString().Trim()))
  354. {
  355. string temName = row["案件核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  356. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  357. }
  358. }
  359. }
  360. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  361. item.ApplicationName = row["申请人"].ToString().Trim();
  362. DateTime temDate = new DateTime();
  363. if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
  364. {
  365. item.FinishedDate = temDate;
  366. }
  367. //定稿日
  368. if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
  369. {
  370. item.FinalizationDate = temDate;
  371. }
  372. //返稿日
  373. if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
  374. {
  375. item.ReturnDate = temDate;
  376. }
  377. //案件类型
  378. item.CaseType = row["案件类型"].ToString().Trim();
  379. //案件状态
  380. item.CaseState = row["案件状态"].ToString().Trim();
  381. //处理事项备注
  382. item.DoItemMemo = row["处理事项备注"].ToString().Trim();
  383. //处理状态
  384. item.DoItemState = row["处理状态"].ToString().Trim();
  385. //案件名称
  386. item.CaseName = row["案件名称"].ToString().Trim();
  387. //委案日期
  388. if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
  389. {
  390. item.EntrustingDate = temDate;
  391. }
  392. //客户期限
  393. if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
  394. {
  395. item.CustomerLimitDate = temDate;
  396. }
  397. //内部期限
  398. if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
  399. {
  400. item.InternalDate = temDate;
  401. }
  402. //初稿日
  403. if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
  404. {
  405. item.FirstDraftDate = temDate;
  406. }
  407. //备注(发文严重超期是否属客观原因,若为否,请填写原因)
  408. if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
  409. {
  410. item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
  411. }
  412. //案件备注
  413. item.CaseMemo = row["案件备注"].ToString().Trim();
  414. return item;
  415. }
  416. private async Task InputPerformanceItem(string strExcelFile,bool isColumnName,bool ignorHideRows=false,int ColumnNameRow=0,CalMonth calMonth=null,bool isFirstOAFile=false)
  417. {
  418. DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName,ignorHideRows,ColumnNameRow);
  419. #region 删除重复行
  420. DataTable temdt = new DataTable();
  421. foreach (DataColumn col in dt.Columns)
  422. {
  423. DataColumn temCol = new DataColumn();
  424. temCol.ColumnName = col.ColumnName;
  425. temCol.DataType = col.DataType;
  426. temCol.Caption = col.Caption;
  427. temdt.Columns.Add(temCol);
  428. }
  429. new ExcelHelper().MerageDataTable(temdt, dt);
  430. #endregion
  431. List<Staff> Staffs =await GetStaffsAsync();
  432. foreach(DataRow row in temdt.Rows)
  433. {
  434. PerformanceItem item = null;
  435. if (isFirstOAFile)
  436. {
  437. item = Row2Item_1(row, Staffs, calMonth);
  438. }
  439. else
  440. {
  441. item = Row2Item(row, Staffs, calMonth);
  442. }
  443. if (item != null )
  444. {
  445. if (!InValidDoItem.Contains(item.DoItem))
  446. {
  447. await SavePerformanceItem(item);
  448. }
  449. }
  450. }
  451. }
  452. private int? GetStaff(string v, List<Staff> staffs)
  453. {
  454. if (!string.IsNullOrEmpty(v))
  455. {
  456. string[] temNames = v.Trim().Split(new char[] { '-' },StringSplitOptions.RemoveEmptyEntries);
  457. foreach (Staff sf in staffs)
  458. {
  459. if(sf.Name == temNames[0])
  460. {
  461. return sf.Id;
  462. }
  463. }
  464. }
  465. return null;
  466. }
  467. private async Task ImportUsers()
  468. {
  469. DataTable dt = NPOIExcel.ExcelToDataTable(@"C:\temp\用户列表(2021年10月26日).xlsx", true,false,1);
  470. List<StaffGrade> staffGrades = await GetStaffGrades();
  471. foreach (DataRow row in dt.Rows)
  472. {
  473. Staff staff = new Staff();
  474. staff.Account = row["用户名"].ToString().Trim();
  475. staff.Name = row["姓名"].ToString().Trim();
  476. staff.Tel = row["电话号码"].ToString().Trim();
  477. staff.Mobile = row["手机号码"].ToString().Trim();
  478. staff.Sex = row["性别"].ToString().Trim();
  479. staff.Mail = row["邮箱"].ToString().Trim();
  480. string strGrade = row["工程师等级"].ToString().Trim(); // + "级";
  481. foreach (StaffGrade sg in staffGrades)
  482. {
  483. if (strGrade.Trim() == sg.Grade.Trim())
  484. {
  485. staff.StaffGradeId = sg.Id;
  486. break;
  487. }
  488. }
  489. staff.IsOnJob = (row["是否在职"].ToString().Trim()=="是");
  490. staff.Status = row["岗位状态"].ToString().Trim();
  491. staff.Department = row["部门"].ToString();
  492. staff.WorkPlace = row["工作地"].ToString();
  493. DateTime temDate;
  494. if (DateTime.TryParse(row["入职时间"].ToString(), out temDate))
  495. {
  496. staff.EntyDate = temDate;
  497. }
  498. //staff.IsCalPerformsnce = (row["是否核算绩效"].ToString() == "是");
  499. //staff.Memo = row["备注"].ToString().Trim();
  500. staff.Password = MD5Utility.GetMD5("12345678");
  501. //staff.StaffGradeId = row["姓名"].ToString();
  502. await SaveStaff(staff);
  503. }
  504. }
  505. private string getPinYin(string str)
  506. {
  507. string retStr = "";
  508. for(int i = 0; i < str.Length; i++)
  509. {
  510. ChineseChar cc = new ChineseChar(str[i]);
  511. retStr = retStr + cc.Pinyins[0].ToLower().Replace("1","")
  512. .Replace("2", "").Replace("3", "").Replace("4", "");
  513. }
  514. return retStr;
  515. }
  516. private async Task SaveStaff(Staff obj)
  517. {
  518. HttpClient http = new HttpClient();
  519. var data = await http.PostAsJsonAsync<wispro.sp.entity.Staff>($"http://localhost:39476/api/Staff/Save", obj);
  520. if (data.IsSuccessStatusCode)
  521. {
  522. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  523. //await Task.Delay(1000);
  524. if (result.Success)
  525. {
  526. }
  527. else
  528. {
  529. }
  530. }
  531. else
  532. {
  533. }
  534. }
  535. private async Task SaveBasePointRule(BasePointRule obj)
  536. {
  537. HttpClient http = new HttpClient();
  538. var data = await http.PostAsJsonAsync<BasePointRule>($"http://localhost:39476/api/BasePointRule/New", obj);
  539. if (data.IsSuccessStatusCode)
  540. {
  541. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  542. //await Task.Delay(1000);
  543. if (result.Success)
  544. {
  545. }
  546. else
  547. {
  548. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.Rule}\t{obj.PointExpress}\r\n{result.ErrorMessage}");
  549. }
  550. }
  551. else
  552. {
  553. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.Type}\t{obj.Rule}");
  554. }
  555. }
  556. private async Task SavePerformanceItem(PerformanceItem obj)
  557. {
  558. HttpClient http = new HttpClient();
  559. var data = await http.PostAsJsonAsync<PerformanceItem>($"http://localhost:39476/api/PerformanceItem/New", obj);
  560. if (data.IsSuccessStatusCode)
  561. {
  562. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  563. //await Task.Delay(1000);
  564. if (result.Success)
  565. {
  566. }
  567. else
  568. {
  569. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.CaseNo}\t{obj.DoItem}\r\n{result.ErrorMessage}");
  570. }
  571. }
  572. else
  573. {
  574. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.CaseNo}\t{obj.DoItem}");
  575. }
  576. }
  577. private async Task<List<StaffGrade>> GetStaffGrades()
  578. {
  579. HttpClient http = new HttpClient();
  580. var _StaffGrade = await http.GetFromJsonAsync<List<StaffGrade>>($"http://localhost:39476/api/StaffGrade/GetAll");
  581. return _StaffGrade;
  582. }
  583. private async Task<List<Staff>> GetStaffsAsync()
  584. {
  585. HttpClient http = new HttpClient();
  586. ListApiResponse<Staff> data = await http.GetFromJsonAsync<ListApiResponse<Staff>>($"http://localhost:39476/api/Staff/Query?pageIndex=1&pageSize=200");
  587. return data.Results;
  588. }
  589. private void button4_Click(object sender, EventArgs e)
  590. {
  591. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件", true);
  592. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--发客户超过一个月未完成案件", false);
  593. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--中国一次OA授权表", true);
  594. ////每月绩效统计--发客户超过一个月未完成案件
  595. //NewMethod("506aa7ad-c3f4-4ec6-9ec8-ff6b92dcd7c1", "每月绩效统计--发客户超过一个月未完成案件.xlsx", calMonth);
  596. ////每月绩效统计--上个月递交完成案件
  597. //NewMethod("d7308cd2-71e4-4444-9f47-f4d731ddb26a", "每月绩效统计--上个月递交完成案件.xlsx", calMonth);
  598. ////每月绩效统计--中国一次OA授权表
  599. //NewMethod("72454834-afdd-4b98-b42a-0bc912d07610", "每月绩效统计--中国一次OA授权表.xlsx", calMonth, true);
  600. }
  601. }
  602. }