Form1.cs 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  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. public async Task TestQueryFilter()
  228. {
  229. //QueryFilter filter = new QueryFilter();
  230. //filter.ConditionTree = new ExpressTree();
  231. //string ValueType = typeof(PerformanceItem).GetProperty("CaseNo").PropertyType.ToString();
  232. //FieldCondition condition1 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PACN", ValueType = ValueType };
  233. //FieldCondition condition2 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PAUS", ValueType = ValueType };
  234. //filter.ConditionTree.AddCondition(LogicEnum.And,condition1);
  235. //filter.ConditionTree.AddCondition(LogicEnum.Or, condition2);
  236. //System.Diagnostics.Debug.WriteLine(filter.ConditionTree.ToExpressString("s")); ;
  237. }
  238. private async void button3_Click(object sender, EventArgs e)
  239. {
  240. //await TestQueryFilter();
  241. await InitRules();
  242. return;
  243. await ImportUsers();
  244. await InputPerformanceItem("ExcelFiles\\21.01-21.06 工程师绩效报表-总表.xlsx", true, false, 0);
  245. //CalMonth cal = new CalMonth()
  246. //{
  247. // Year = 2021,
  248. // Month = 9,
  249. // Status = 0
  250. //};
  251. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--发客户超过一个月未完成案件.xlsx", true,false,1, cal);
  252. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--上个月递交完成案件.xlsx", true, false, 1, cal);
  253. //await InputPerformanceItem(@"C:\Users\luowen\Downloads\每月绩效统计--中国一次OA授权表.xlsx", true, false, 1, cal,true);
  254. MessageBox.Show("导入完成!");
  255. }
  256. private PerformanceItem Row2Item_1(DataRow row, List<Staff> Staffs, CalMonth calMonth)
  257. {
  258. PerformanceItem item = new PerformanceItem();
  259. item.ApplicationType = row["申请类型"].ToString().Trim();
  260. if(item.ApplicationType != "发明")
  261. {
  262. return null;
  263. }
  264. item.CaseNo = row["我方文号"].ToString().Trim();
  265. if (calMonth != null)
  266. {
  267. item.CalMonth = calMonth;
  268. }
  269. else
  270. {
  271. if (row.Table.Columns.Contains("绩效核算月份"))
  272. {
  273. string strjxyf = row["绩效核算月份"].ToString().Trim();
  274. string[] temYFs = strjxyf.Split(new char[] { '.' });
  275. item.CalMonth = new CalMonth();
  276. item.CalMonth.Year = int.Parse(temYFs[0]);
  277. item.CalMonth.Month = int.Parse(temYFs[1]);
  278. item.CalMonth.Status = 4;
  279. }
  280. else
  281. {
  282. item.CalMonth = new CalMonth();
  283. item.Status = 0;
  284. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  285. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  286. }
  287. }
  288. item.ApplicationType = row["申请类型"].ToString().Trim();
  289. item.BusinessType = "普通新申请"; // row["业务类型"].ToString().Trim();
  290. item.AgentFeedbackMemo = "发明一次OA授权"; //row["备注(填表注意事项)"].ToString().Trim();
  291. item.DoItem = "发明一次OA授权"; //row["处理事项"].ToString().Trim();
  292. string strHandler = "";
  293. if (row.Table.Columns.Contains("处理人"))
  294. {
  295. strHandler = row["处理人"].ToString().Trim();
  296. }
  297. else
  298. {
  299. if (row.Table.Columns.Contains("案件处理人"))
  300. {
  301. strHandler = row["案件处理人"].ToString().Trim();
  302. }
  303. }
  304. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  305. item.ItemStaffs = new List<ItemStaff>();
  306. foreach (string name in temHandlers)
  307. {
  308. ItemStaff itemStaff = new ItemStaff();
  309. int? iTem = GetStaff(name, Staffs);
  310. if ((iTem != null))
  311. {
  312. //itemStaff.Item = item;
  313. itemStaff.DoPersonId = iTem.Value;
  314. item.ItemStaffs.Add(itemStaff);
  315. }
  316. else
  317. {
  318. itemStaff.DoPerson = new Staff()
  319. {
  320. Name = name,
  321. Account = name,
  322. Password = "12345678",
  323. IsCalPerformsnce = false,
  324. Status = "正式员工",
  325. StaffGradeId = 4
  326. };
  327. item.ItemStaffs.Add(itemStaff);
  328. }
  329. }
  330. if (item.ItemStaffs.Count == 0)
  331. {
  332. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  333. }
  334. if (row.Table.Columns.Contains("核稿人"))
  335. {
  336. item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
  337. }
  338. else
  339. {
  340. if (row.Table.Columns.Contains("案件核稿人"))
  341. {
  342. item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim(), Staffs);
  343. }
  344. }
  345. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  346. item.ApplicationName = row["申请人"].ToString().Trim();
  347. item.CaseName = row["案件名称"].ToString().Trim();
  348. //案件备注
  349. item.CaseMemo = $"发文日期:{row["发文日期"].ToString().Trim()}\r\n客户文号:{row["客户文号"].ToString().Trim()}\r\n上传日期:{row["上传日期"].ToString().Trim()}\r\n文件描述:{row["文件描述"].ToString().Trim()}";
  350. return item;
  351. }
  352. private PerformanceItem Row2Item(DataRow row, List<Staff> Staffs,CalMonth calMonth)
  353. {
  354. PerformanceItem item = new PerformanceItem();
  355. item.CaseNo = row["我方文号"].ToString().Trim();
  356. if (calMonth != null)
  357. {
  358. item.CalMonth = calMonth;
  359. }
  360. else
  361. {
  362. if (row.Table.Columns.Contains("绩效核算月份"))
  363. {
  364. string strjxyf = row["绩效核算月份"].ToString().Trim();
  365. string[] temYFs = strjxyf.Split(new char[] { '.' });
  366. item.CalMonth = new CalMonth();
  367. item.CalMonth.Year = int.Parse(temYFs[0]);
  368. item.CalMonth.Month = int.Parse(temYFs[1]);
  369. item.CalMonth.Status = 4;
  370. }
  371. else
  372. {
  373. item.CalMonth = new CalMonth();
  374. item.Status = 0;
  375. item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
  376. item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
  377. }
  378. }
  379. item.ApplicationType = row["申请类型"].ToString().Trim();
  380. item.BusinessType = row["业务类型"].ToString().Trim();
  381. if (row.Table.Columns.Contains("备注(填表注意事项)"))
  382. item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
  383. item.DoItem = row["处理事项"].ToString().Trim();
  384. item.CaseStage = row["案件阶段"].ToString().Trim();
  385. item.CaseCoefficient = row["案件系数"].ToString().Trim();
  386. item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
  387. item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim(), Staffs);
  388. string strHandler = "";
  389. if (row.Table.Columns.Contains("处理人"))
  390. {
  391. strHandler = row["处理人"].ToString().Trim();
  392. }
  393. else
  394. {
  395. if (row.Table.Columns.Contains("案件处理人"))
  396. {
  397. strHandler = row["案件处理人"].ToString().Trim();
  398. }
  399. }
  400. string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  401. item.ItemStaffs = new List<ItemStaff>();
  402. foreach (string name in temHandlers)
  403. {
  404. ItemStaff itemStaff = new ItemStaff();
  405. string temName = name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  406. int? iTem = GetStaff(temName, Staffs);
  407. if ((iTem != null))
  408. {
  409. //itemStaff.Item = item;
  410. itemStaff.DoPersonId = iTem.Value;
  411. item.ItemStaffs.Add(itemStaff);
  412. }
  413. else
  414. {
  415. itemStaff.DoPerson = new Staff()
  416. {
  417. Name = temName,
  418. Account = temName,
  419. Password = "12345678",
  420. IsCalPerformsnce = false,
  421. Status = "已离职",
  422. StaffGradeId = 4
  423. };
  424. item.ItemStaffs.Add(itemStaff);
  425. }
  426. }
  427. if (item.ItemStaffs.Count == 0)
  428. {
  429. System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
  430. }
  431. if (row.Table.Columns.Contains("核稿人"))
  432. {
  433. if (!string.IsNullOrEmpty(row["核稿人"].ToString().Trim()))
  434. {
  435. string temName = row["核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  436. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  437. }
  438. }
  439. else
  440. {
  441. if (row.Table.Columns.Contains("案件核稿人"))
  442. {
  443. if (!string.IsNullOrEmpty(row["案件核稿人"].ToString().Trim()))
  444. {
  445. string temName = row["案件核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
  446. item.ReviewerId = GetStaff(temName.Trim(), Staffs);
  447. }
  448. }
  449. }
  450. item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
  451. item.ApplicationName = row["申请人"].ToString().Trim();
  452. DateTime temDate = new DateTime();
  453. if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
  454. {
  455. item.FinishedDate = temDate;
  456. }
  457. //定稿日
  458. if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
  459. {
  460. item.FinalizationDate = temDate;
  461. }
  462. //返稿日
  463. if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
  464. {
  465. item.ReturnDate = temDate;
  466. }
  467. //案件类型
  468. item.CaseType = row["案件类型"].ToString().Trim();
  469. //案件状态
  470. item.CaseState = row["案件状态"].ToString().Trim();
  471. //处理事项备注
  472. item.DoItemMemo = row["处理事项备注"].ToString().Trim();
  473. //处理状态
  474. item.DoItemState = row["处理状态"].ToString().Trim();
  475. //案件名称
  476. item.CaseName = row["案件名称"].ToString().Trim();
  477. //委案日期
  478. if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
  479. {
  480. item.EntrustingDate = temDate;
  481. }
  482. //客户期限
  483. if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
  484. {
  485. item.CustomerLimitDate = temDate;
  486. }
  487. //内部期限
  488. if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
  489. {
  490. item.InternalDate = temDate;
  491. }
  492. //初稿日
  493. if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
  494. {
  495. item.FirstDraftDate = temDate;
  496. }
  497. //备注(发文严重超期是否属客观原因,若为否,请填写原因)
  498. if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
  499. {
  500. item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
  501. }
  502. //案件备注
  503. item.CaseMemo = row["案件备注"].ToString().Trim();
  504. return item;
  505. }
  506. private async Task InputPerformanceItem(string strExcelFile,bool isColumnName,bool ignorHideRows=false,int ColumnNameRow=0,CalMonth calMonth=null,bool isFirstOAFile=false)
  507. {
  508. DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName,ignorHideRows,ColumnNameRow);
  509. #region 删除重复行
  510. DataTable temdt = new DataTable();
  511. foreach (DataColumn col in dt.Columns)
  512. {
  513. DataColumn temCol = new DataColumn();
  514. temCol.ColumnName = col.ColumnName;
  515. temCol.DataType = col.DataType;
  516. temCol.Caption = col.Caption;
  517. temdt.Columns.Add(temCol);
  518. }
  519. new ExcelHelper().MerageDataTable(temdt, dt);
  520. #endregion
  521. List<Staff> Staffs =await GetStaffsAsync();
  522. foreach(DataRow row in temdt.Rows)
  523. {
  524. PerformanceItem item = null;
  525. if (isFirstOAFile)
  526. {
  527. item = Row2Item_1(row, Staffs, calMonth);
  528. }
  529. else
  530. {
  531. item = Row2Item(row, Staffs, calMonth);
  532. }
  533. if (item != null )
  534. {
  535. if (!InValidDoItem.Contains(item.DoItem))
  536. {
  537. await SavePerformanceItem(item);
  538. }
  539. }
  540. }
  541. }
  542. private int? GetStaff(string v, List<Staff> staffs)
  543. {
  544. if (!string.IsNullOrEmpty(v))
  545. {
  546. string[] temNames = v.Trim().Split(new char[] { '-' },StringSplitOptions.RemoveEmptyEntries);
  547. foreach (Staff sf in staffs)
  548. {
  549. if(sf.Name == temNames[0])
  550. {
  551. return sf.Id;
  552. }
  553. }
  554. }
  555. return null;
  556. }
  557. private async Task ImportUsers()
  558. {
  559. DataTable dt = NPOIExcel.ExcelToDataTable(@"C:\temp\用户列表(2021年10月26日).xlsx", true,false,1);
  560. List<StaffGrade> staffGrades = await GetStaffGrades();
  561. foreach (DataRow row in dt.Rows)
  562. {
  563. Staff staff = new Staff();
  564. staff.Account = row["用户名"].ToString().Trim();
  565. staff.Name = row["姓名"].ToString().Trim();
  566. staff.Tel = row["电话号码"].ToString().Trim();
  567. staff.Mobile = row["手机号码"].ToString().Trim();
  568. staff.Sex = row["性别"].ToString().Trim();
  569. staff.Mail = row["邮箱"].ToString().Trim();
  570. string strGrade = row["工程师等级"].ToString().Trim(); // + "级";
  571. foreach (StaffGrade sg in staffGrades)
  572. {
  573. if (strGrade.Trim() == sg.Grade.Trim())
  574. {
  575. staff.StaffGradeId = sg.Id;
  576. break;
  577. }
  578. }
  579. staff.IsOnJob = (row["是否在职"].ToString().Trim()=="是");
  580. staff.Status = row["岗位状态"].ToString().Trim();
  581. staff.Department = row["部门"].ToString();
  582. staff.WorkPlace = row["工作地"].ToString();
  583. DateTime temDate;
  584. if (DateTime.TryParse(row["入职时间"].ToString(), out temDate))
  585. {
  586. staff.EntyDate = temDate;
  587. }
  588. //staff.IsCalPerformsnce = (row["是否核算绩效"].ToString() == "是");
  589. //staff.Memo = row["备注"].ToString().Trim();
  590. staff.Password = "12345678";
  591. //staff.StaffGradeId = row["姓名"].ToString();
  592. await SaveStaff(staff);
  593. }
  594. }
  595. private string getPinYin(string str)
  596. {
  597. string retStr = "";
  598. for(int i = 0; i < str.Length; i++)
  599. {
  600. ChineseChar cc = new ChineseChar(str[i]);
  601. retStr = retStr + cc.Pinyins[0].ToLower().Replace("1","")
  602. .Replace("2", "").Replace("3", "").Replace("4", "");
  603. }
  604. return retStr;
  605. }
  606. private async Task SaveStaff(Staff obj)
  607. {
  608. HttpClient http = new HttpClient();
  609. var data = await http.PostAsJsonAsync<wispro.sp.entity.Staff>($"http://localhost:39476/api/Staff/Save", obj);
  610. if (data.IsSuccessStatusCode)
  611. {
  612. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  613. //await Task.Delay(1000);
  614. if (result.Success)
  615. {
  616. }
  617. else
  618. {
  619. }
  620. }
  621. else
  622. {
  623. }
  624. }
  625. private async Task SaveBasePointRule(BasePointRule obj)
  626. {
  627. HttpClient http = new HttpClient();
  628. var data = await http.PostAsJsonAsync<BasePointRule>($"http://localhost:39476/api/BasePointRule/New", obj);
  629. if (data.IsSuccessStatusCode)
  630. {
  631. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  632. //await Task.Delay(1000);
  633. if (result.Success)
  634. {
  635. }
  636. else
  637. {
  638. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.Rule}\t{obj.PointExpress}\r\n{result.ErrorMessage}");
  639. }
  640. }
  641. else
  642. {
  643. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.Type}\t{obj.Rule}");
  644. }
  645. }
  646. private async Task SavePerformanceItem(PerformanceItem obj)
  647. {
  648. HttpClient http = new HttpClient();
  649. var data = await http.PostAsJsonAsync<PerformanceItem>($"http://localhost:39476/api/PerformanceItem/New", obj);
  650. if (data.IsSuccessStatusCode)
  651. {
  652. ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
  653. //await Task.Delay(1000);
  654. if (result.Success)
  655. {
  656. }
  657. else
  658. {
  659. System.Diagnostics.Debug.WriteLine($"保存错误: {obj.CaseNo}\t{obj.DoItem}\r\n{result.ErrorMessage}");
  660. }
  661. }
  662. else
  663. {
  664. System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.CaseNo}\t{obj.DoItem}");
  665. }
  666. }
  667. private async Task<List<StaffGrade>> GetStaffGrades()
  668. {
  669. HttpClient http = new HttpClient();
  670. var _StaffGrade = await http.GetFromJsonAsync<List<StaffGrade>>($"http://localhost:39476/api/StaffGrade/GetAll");
  671. return _StaffGrade;
  672. }
  673. private async Task<List<Staff>> GetStaffsAsync()
  674. {
  675. HttpClient http = new HttpClient();
  676. ListApiResponse<Staff> data = await http.GetFromJsonAsync<ListApiResponse<Staff>>($"http://localhost:39476/api/Staff/Query?pageIndex=1&pageSize=200");
  677. return data.Results;
  678. }
  679. }
  680. }