Form1.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  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. await InitRules(true);
  150. return;
  151. await ImportUsers();
  152. await InputPerformanceItem("ExcelFiles\\21.01-21.06 工程师绩效报表-总表.xlsx", true, false, 0);
  153. //CalMonth cal = new CalMonth()
  154. //{
  155. // Year = 2021,
  156. // Month = 9,
  157. // Status = 0
  158. //};
  159. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--发客户超过一个月未完成案件.xlsx", true,false,1, cal);
  160. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--上个月递交完成案件.xlsx", true, false, 1, cal);
  161. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--中国一次OA授权表.xlsx", true, false, 1, cal,true);
  162. MessageBox.Show("导入完成!");
  163. }
  164. private PerformanceItem Row2Item_1(DataRow row, List<Staff> Staffs, CalMonth calMonth)
  165. {
  166. PerformanceItem item = new PerformanceItem();
  167. item.ApplicationType = row["申请类型"].ToString().Trim();
  168. if(item.ApplicationType != "发明")
  169. {
  170. return null;
  171. }
  172. item.CaseNo = row["我方文号"].ToString().Trim();
  173. if (calMonth != null)
  174. {
  175. item.CalMonth = calMonth;
  176. }
  177. else
  178. {
  179. if (row.Table.Columns.Contains("绩效核算月份"))
  180. {
  181. string strjxyf = row["绩效核算月份"].ToString().Trim();
  182. string[] temYFs = strjxyf.Split(new char[] { '.' });
  183. item.CalMonth = new CalMonth();
  184. item.CalMonth.Year = int.Parse(temYFs[0]);
  185. item.CalMonth.Month = int.Parse(temYFs[1]);
  186. item.CalMonth.Status = 4;
  187. }
  188. else
  189. {
  190. item.CalMonth = new CalMonth();
  191. item.Status = 0;
  192. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  193. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  194. }
  195. }
  196. item.ApplicationType = row["申请类型"].ToString().Trim();
  197. item.BusinessType = "普通新申请"; // row["业务类型"].ToString().Trim();
  198. item.AgentFeedbackMemo = "发明一次OA授权"; //row["备注(填表注意事项)"].ToString().Trim();
  199. item.DoItem = "发明一次OA授权"; //row["处理事项"].ToString().Trim();
  200. string strHandler = "";
  201. if (row.Table.Columns.Contains("处理人"))
  202. {
  203. strHandler = row["处理人"].ToString().Trim();
  204. }
  205. else
  206. {
  207. if (row.Table.Columns.Contains("案件处理人"))
  208. {
  209. strHandler = row["案件处理人"].ToString().Trim();
  210. }
  211. }
  212. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  213. item.ItemStaffs = new List<ItemStaff>();
  214. foreach (string name in temHandlers)
  215. {
  216. ItemStaff itemStaff = new ItemStaff();
  217. int? iTem = GetStaff(name, Staffs);
  218. if ((iTem != null))
  219. {
  220. //itemStaff.Item = item;
  221. itemStaff.DoPersonId = iTem.Value;
  222. item.ItemStaffs.Add(itemStaff);
  223. }
  224. else
  225. {
  226. itemStaff.DoPerson = new Staff()
  227. {
  228. Name = name,
  229. Account = name,
  230. Password = "12345678",
  231. IsCalPerformsnce = false,
  232. Status = "正式员工",
  233. StaffGradeId = 4
  234. };
  235. item.ItemStaffs.Add(itemStaff);
  236. }
  237. }
  238. if (item.ItemStaffs.Count == 0)
  239. {
  240. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  241. }
  242. if (row.Table.Columns.Contains("核稿人"))
  243. {
  244. item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
  245. }
  246. else
  247. {
  248. if (row.Table.Columns.Contains("案件核稿人"))
  249. {
  250. item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim(), Staffs);
  251. }
  252. }
  253. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  254. item.ApplicationName = row["申请人"].ToString().Trim();
  255. item.CaseName = row["案件名称"].ToString().Trim();
  256. //案件备注
  257. item.CaseMemo = $"发文日期:{row["发文日期"].ToString().Trim()}\r\n客户文号:{row["客户文号"].ToString().Trim()}\r\n上传日期:{row["上传日期"].ToString().Trim()}\r\n文件描述:{row["文件描述"].ToString().Trim()}";
  258. return item;
  259. }
  260. private PerformanceItem Row2Item(DataRow row, List<Staff> Staffs,CalMonth calMonth)
  261. {
  262. PerformanceItem item = new PerformanceItem();
  263. item.CaseNo = row["我方文号"].ToString().Trim();
  264. if (calMonth != null)
  265. {
  266. item.CalMonth = calMonth;
  267. }
  268. else
  269. {
  270. if (row.Table.Columns.Contains("绩效核算月份"))
  271. {
  272. string strjxyf = row["绩效核算月份"].ToString().Trim();
  273. string[] temYFs = strjxyf.Split(new char[] { '.' });
  274. item.CalMonth = new CalMonth();
  275. item.CalMonth.Year = int.Parse(temYFs[0]);
  276. item.CalMonth.Month = int.Parse(temYFs[1]);
  277. item.CalMonth.Status = 4;
  278. }
  279. else
  280. {
  281. item.CalMonth = new CalMonth();
  282. item.Status = 0;
  283. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  284. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  285. }
  286. }
  287. item.ApplicationType = row["申请类型"].ToString().Trim();
  288. item.BusinessType = row["业务类型"].ToString().Trim();
  289. if (row.Table.Columns.Contains("备注(填表注意事项)"))
  290. item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
  291. item.DoItem = row["处理事项"].ToString().Trim();
  292. item.CaseStage = row["案件阶段"].ToString().Trim();
  293. item.CaseCoefficient = row["案件系数"].ToString().Trim();
  294. item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
  295. item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim(), Staffs);
  296. string strHandler = "";
  297. if (row.Table.Columns.Contains("处理人"))
  298. {
  299. strHandler = row["处理人"].ToString().Trim();
  300. }
  301. else
  302. {
  303. if (row.Table.Columns.Contains("案件处理人"))
  304. {
  305. strHandler = row["案件处理人"].ToString().Trim();
  306. }
  307. }
  308. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  309. item.ItemStaffs = new List<ItemStaff>();
  310. foreach (string name in temHandlers)
  311. {
  312. ItemStaff itemStaff = new ItemStaff();
  313. string temName = name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  314. int? iTem = GetStaff(temName, Staffs);
  315. if ((iTem != null))
  316. {
  317. //itemStaff.Item = item;
  318. itemStaff.DoPersonId = iTem.Value;
  319. item.ItemStaffs.Add(itemStaff);
  320. }
  321. else
  322. {
  323. itemStaff.DoPerson = new Staff()
  324. {
  325. Name = temName,
  326. Account = temName,
  327. Password = "12345678",
  328. IsCalPerformsnce = false,
  329. Status = "已离职",
  330. StaffGradeId = 4
  331. };
  332. item.ItemStaffs.Add(itemStaff);
  333. }
  334. }
  335. if (item.ItemStaffs.Count == 0)
  336. {
  337. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  338. }
  339. if (row.Table.Columns.Contains("核稿人"))
  340. {
  341. if (!string.IsNullOrEmpty(row["核稿人"].ToString().Trim()))
  342. {
  343. string temName = row["核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  344. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  345. }
  346. }
  347. else
  348. {
  349. if (row.Table.Columns.Contains("案件核稿人"))
  350. {
  351. if (!string.IsNullOrEmpty(row["案件核稿人"].ToString().Trim()))
  352. {
  353. string temName = row["案件核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  354. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  355. }
  356. }
  357. }
  358. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  359. item.ApplicationName = row["申请人"].ToString().Trim();
  360. DateTime temDate = new DateTime();
  361. if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
  362. {
  363. item.FinishedDate = temDate;
  364. }
  365. //定稿日
  366. if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
  367. {
  368. item.FinalizationDate = temDate;
  369. }
  370. //返稿日
  371. if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
  372. {
  373. item.ReturnDate = temDate;
  374. }
  375. //案件类型
  376. item.CaseType = row["案件类型"].ToString().Trim();
  377. //案件状态
  378. item.CaseState = row["案件状态"].ToString().Trim();
  379. //处理事项备注
  380. item.DoItemMemo = row["处理事项备注"].ToString().Trim();
  381. //处理状态
  382. item.DoItemState = row["处理状态"].ToString().Trim();
  383. //案件名称
  384. item.CaseName = row["案件名称"].ToString().Trim();
  385. //委案日期
  386. if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
  387. {
  388. item.EntrustingDate = temDate;
  389. }
  390. //客户期限
  391. if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
  392. {
  393. item.CustomerLimitDate = temDate;
  394. }
  395. //内部期限
  396. if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
  397. {
  398. item.InternalDate = temDate;
  399. }
  400. //初稿日
  401. if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
  402. {
  403. item.FirstDraftDate = temDate;
  404. }
  405. //备注(发文严重超期是否属客观原因,若为否,请填写原因)
  406. if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
  407. {
  408. item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
  409. }
  410. //案件备注
  411. item.CaseMemo = row["案件备注"].ToString().Trim();
  412. return item;
  413. }
  414. private async Task InputPerformanceItem(string strExcelFile,bool isColumnName,bool ignorHideRows=false,int ColumnNameRow=0,CalMonth calMonth=null,bool isFirstOAFile=false)
  415. {
  416. DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName,ignorHideRows,ColumnNameRow);
  417. #region 删除重复行
  418. DataTable temdt = new DataTable();
  419. foreach (DataColumn col in dt.Columns)
  420. {
  421. DataColumn temCol = new DataColumn();
  422. temCol.ColumnName = col.ColumnName;
  423. temCol.DataType = col.DataType;
  424. temCol.Caption = col.Caption;
  425. temdt.Columns.Add(temCol);
  426. }
  427. new ExcelHelper().MerageDataTable(temdt, dt);
  428. #endregion
  429. List<Staff> Staffs =await GetStaffsAsync();
  430. foreach(DataRow row in temdt.Rows)
  431. {
  432. PerformanceItem item = null;
  433. if (isFirstOAFile)
  434. {
  435. item = Row2Item_1(row, Staffs, calMonth);
  436. }
  437. else
  438. {
  439. item = Row2Item(row, Staffs, calMonth);
  440. }
  441. if (item != null )
  442. {
  443. if (!InValidDoItem.Contains(item.DoItem))
  444. {
  445. await SavePerformanceItem(item);
  446. }
  447. }
  448. }
  449. }
  450. private int? GetStaff(string v, List<Staff> staffs)
  451. {
  452. if (!string.IsNullOrEmpty(v))
  453. {
  454. string[] temNames = v.Trim().Split(new char[] { '-' },StringSplitOptions.RemoveEmptyEntries);
  455. foreach (Staff sf in staffs)
  456. {
  457. if(sf.Name == temNames[0])
  458. {
  459. return sf.Id;
  460. }
  461. }
  462. }
  463. return null;
  464. }
  465. private async Task ImportUsers()
  466. {
  467. DataTable dt = NPOIExcel.ExcelToDataTable(@"C:\temp\用户列表(2021年10月26日).xlsx", true,false,1);
  468. List<StaffGrade> staffGrades = await GetStaffGrades();
  469. foreach (DataRow row in dt.Rows)
  470. {
  471. Staff staff = new Staff();
  472. staff.Account = row["用户名"].ToString().Trim();
  473. staff.Name = row["姓名"].ToString().Trim();
  474. staff.Tel = row["电话号码"].ToString().Trim();
  475. staff.Mobile = row["手机号码"].ToString().Trim();
  476. staff.Sex = row["性别"].ToString().Trim();
  477. staff.Mail = row["邮箱"].ToString().Trim();
  478. string strGrade = row["工程师等级"].ToString().Trim(); // + "级";
  479. foreach (StaffGrade sg in staffGrades)
  480. {
  481. if (strGrade.Trim() == sg.Grade.Trim())
  482. {
  483. staff.StaffGradeId = sg.Id;
  484. break;
  485. }
  486. }
  487. staff.IsOnJob = (row["是否在职"].ToString().Trim()=="是");
  488. staff.Status = row["岗位状态"].ToString().Trim();
  489. staff.Department = row["部门"].ToString();
  490. staff.WorkPlace = row["工作地"].ToString();
  491. DateTime temDate;
  492. if (DateTime.TryParse(row["入职时间"].ToString(), out temDate))
  493. {
  494. staff.EntyDate = temDate;
  495. }
  496. //staff.IsCalPerformsnce = (row["是否核算绩效"].ToString() == "是");
  497. //staff.Memo = row["备注"].ToString().Trim();
  498. staff.Password = MD5Utility.GetMD5("12345678");
  499. //staff.StaffGradeId = row["姓名"].ToString();
  500. await SaveStaff(staff);
  501. }
  502. }
  503. private string getPinYin(string str)
  504. {
  505. string retStr = "";
  506. for(int i = 0; i < str.Length; i++)
  507. {
  508. ChineseChar cc = new ChineseChar(str[i]);
  509. retStr = retStr + cc.Pinyins[0].ToLower().Replace("1","")
  510. .Replace("2", "").Replace("3", "").Replace("4", "");
  511. }
  512. return retStr;
  513. }
  514. private async Task SaveStaff(Staff obj)
  515. {
  516. HttpClient http = new HttpClient();
  517. var data = await http.PostAsJsonAsync<wispro.sp.entity.Staff>($"http://localhost:39476/api/Staff/Save", obj);
  518. if (data.IsSuccessStatusCode)
  519. {
  520. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  521. //await Task.Delay(1000);
  522. if (result.Success)
  523. {
  524. }
  525. else
  526. {
  527. }
  528. }
  529. else
  530. {
  531. }
  532. }
  533. private async Task SaveBasePointRule(BasePointRule obj)
  534. {
  535. HttpClient http = new HttpClient();
  536. var data = await http.PostAsJsonAsync<BasePointRule>($"http://localhost:39476/api/BasePointRule/New", obj);
  537. if (data.IsSuccessStatusCode)
  538. {
  539. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  540. //await Task.Delay(1000);
  541. if (result.Success)
  542. {
  543. }
  544. else
  545. {
  546. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.Rule}\t{obj.PointExpress}\r\n{result.ErrorMessage}");
  547. }
  548. }
  549. else
  550. {
  551. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.Type}\t{obj.Rule}");
  552. }
  553. }
  554. private async Task SavePerformanceItem(PerformanceItem obj)
  555. {
  556. HttpClient http = new HttpClient();
  557. var data = await http.PostAsJsonAsync<PerformanceItem>($"http://localhost:39476/api/PerformanceItem/New", obj);
  558. if (data.IsSuccessStatusCode)
  559. {
  560. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  561. //await Task.Delay(1000);
  562. if (result.Success)
  563. {
  564. }
  565. else
  566. {
  567. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.CaseNo}\t{obj.DoItem}\r\n{result.ErrorMessage}");
  568. }
  569. }
  570. else
  571. {
  572. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.CaseNo}\t{obj.DoItem}");
  573. }
  574. }
  575. private async Task<List<StaffGrade>> GetStaffGrades()
  576. {
  577. HttpClient http = new HttpClient();
  578. var _StaffGrade = await http.GetFromJsonAsync<List<StaffGrade>>($"http://localhost:39476/api/StaffGrade/GetAll");
  579. return _StaffGrade;
  580. }
  581. private async Task<List<Staff>> GetStaffsAsync()
  582. {
  583. HttpClient http = new HttpClient();
  584. ListApiResponse<Staff> data = await http.GetFromJsonAsync<ListApiResponse<Staff>>($"http://localhost:39476/api/Staff/Query?pageIndex=1&pageSize=200");
  585. return data.Results;
  586. }
  587. private void button4_Click(object sender, EventArgs e)
  588. {
  589. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件", true);
  590. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--发客户超过一个月未完成案件", false);
  591. wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--中国一次OA授权表", true);
  592. ////每月绩效统计--发客户超过一个月未完成案件
  593. //NewMethod("506aa7ad-c3f4-4ec6-9ec8-ff6b92dcd7c1", "每月绩效统计--发客户超过一个月未完成案件.xlsx", calMonth);
  594. ////每月绩效统计--上个月递交完成案件
  595. //NewMethod("d7308cd2-71e4-4444-9f47-f4d731ddb26a", "每月绩效统计--上个月递交完成案件.xlsx", calMonth);
  596. ////每月绩效统计--中国一次OA授权表
  597. //NewMethod("72454834-afdd-4b98-b42a-0bc912d07610", "每月绩效统计--中国一次OA授权表.xlsx", calMonth, true);
  598. }
  599. }
  600. }