Form1.cs 42 KB

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