Form1.cs 46 KB

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