Form1.cs 45 KB

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