123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437 |
- using AntDesign;
- using DynamicExpresso;
- using Microsoft.International.Converters.PinYinConverter;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Configuration;
- using System.Data;
- using System.Diagnostics;
- using System.Drawing;
- using System.Drawing.Imaging;
- using System.Dynamic;
- using System.IO;
- using System.Linq;
- using System.Net.Http;
- using System.Net.Http.Json;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Text;
- using System.Text.Json;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Xml.Serialization;
- using wispro.sp.entity;
- using wispro.sp.entity.workflowDefine;
- using wispro.sp.share;
- using wispro.sp.share.Utility;
- using wispro.sp.share.webViewObject;
- using wispro.sp.utility;
- namespace wispro.sp.winClient
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- DateTime startTime = DateTime.Now;
- frmMerageExcel frm = new frmMerageExcel();
- if (frm.ShowDialog() == DialogResult.OK)
- {
- MessageBox.Show($"合并完成,合并后文件保存在:\r\n{frm.SaveFilePath}\r\n用时:{DateTime.Now - startTime }");
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog()
- {
- Multiselect = false,
- Filter = "*.xls|*.xlsx"
- };
- string strDinashuRegularFile = ConfigurationSettings.AppSettings["DinashuRegularFile"];
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- new ExcelHelper().FillDianShu(ofd.FileName, strDinashuRegularFile);
- }
- MessageBox.Show("完成点数输入!");
- }
- private string[] InValidDoItem = new string[]
- {
- "案件异常-催缴年费",
- "案件异常-视为放弃取得专利权",
- "办理登记手续",
- "办理登记手续-确认客户是否委托",
- "代理所变更",
- "绘图",
- "技术确认",
- "缴年费",
- "请求保密审查",
- "请求费减",
- "请求实审",
- "取得申请号",
- "取得证书",
- "取得专利权评价报告",
- "确认官方审查状况",
- "询问放弃或复审",
- "知识点总结",
- "专利权人发明人申请人信息变更",
- "专利挖掘与布局",
- "我方文号前缀带J",
- "开卷",
- "请求提前公开",
- "取得国际检索报告",
- "委外检索",
- "中止程序",
- "终止",
- "案件异常-视为撤回",
- "进入国家阶段提醒",
- "请求恢复权利",
- "请求优先权",
- "取得【无效宣告请求审查决定】",
- "撤回",
- "请求退款",
- "确认是否委托申请与类型",
- "专利交易",
- "专利权评价报告",
- "专利权人发明人申请人信息变更+代理所变更"
- };
- private async Task InitRules(bool isSave)
- {
- List<BasePointRule> rules = new List<BasePointRule>();
- DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("ExcelFiles\\20211109-绩效点数规则-lcy-v1.xlsx", true);
- PerformanceItem item = new PerformanceItem() { CaseNo = "PAEPO2016277", DoItem= "提交检索主题声明", };
- foreach(DataRow row in dt.Rows)
- {
- BasePointRule rule = new BasePointRule()
- {
- Rule = row["规则"].ToString(),
- PointExpress = row["点数计算"].ToString(),
- Priority = int.Parse(row["优先级修订"].ToString()),
- Type = row["类型"].ToString()
- };
- try
- {
- var interpreter = new Interpreter();
-
- //item.ApplicationType
- Func<PerformanceItem, bool> func = interpreter.ParseAsDelegate<Func<PerformanceItem, bool>>(rule.Rule, "p");
- bool result = func.Invoke(item);
- if (result)
- {
- item.BasePoint = (double?)interpreter.Eval(rule.PointExpress);
- item.Type = rule.Type;
- System.Diagnostics.Debug.WriteLine("");
- }
- rules.Add(rule);
- }
- catch(Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(rule.Rule + "\r\n" + ex.ToString());
- }
-
- }
- if (isSave)
- {
- foreach (BasePointRule rule in rules)
- {
- double d;
- if(double.TryParse(rule.PointExpress,out d))
- {
- rule.PointExpress = d.ToString("0.00");
- }
- await SaveBasePointRule(rule);
- }
- }
- }
- public async Task TestQueryFilter()
- {
- //QueryFilter filter = new QueryFilter();
- //filter.ConditionTree = new ExpressTree();
- //string ValueType = typeof(PerformanceItem).GetProperty("CaseNo").PropertyType.ToString();
- //FieldCondition condition1 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PACN", ValueType = ValueType };
- //FieldCondition condition2 = new FieldCondition() { FieldName = "CaseNo", Operator = OperatorEnum.Contains, Value = "PAUS", ValueType = ValueType };
- //filter.ConditionTree.AddCondition(LogicEnum.And,condition1);
- //filter.ConditionTree.AddCondition(LogicEnum.Or, condition2);
- //System.Diagnostics.Debug.WriteLine(filter.ConditionTree.ToExpressString("s")); ;
- }
- enum enumTest
- {
- [Description("男")]
- man,
- [Description("女")]
- woman
- }
-
-
- private async void button3_Click(object sender, EventArgs e)
- {
-
- //await StartImport();
- //await RemoveDBNotFinishedDate();
- await CalJXPoint();
- //await RefreshPerformanceItem(3);
- //await UpdateStaff();
- //await InitDepartment();
- //await GetTest();
- //await Compare2DB();
- //await RefreshPerformanceItem(1);
- //await RefreshPerformanceItem(2);
- //await RefreshPerformanceItem(3);
- //await UserField2String(lstAJQL);
- //await UserField2String(lstAJXS);
- //await UserField2String(lstDoItemXS);
- //await UserField2String(lstJXBL);
- //await UserField2String(lstRXSX);
- //await UserField2String(lstYZCQ);
- //await ImportUsers();
- //await InputPerformanceItem("c:\\temp\\21.01-21.11 工程师绩效报表-总表.xlsx", true, false, 0);
- }
- private PerformanceItem Row2Item_1(DataRow row, List<Staff> Staffs, CalMonth calMonth)
- {
- PerformanceItem item = new PerformanceItem();
- item.ApplicationType = row["申请类型"].ToString().Trim();
- if(item.ApplicationType != "发明")
- {
- return null;
- }
- item.CaseNo = row["我方文号"].ToString().Trim();
- if (calMonth != null)
- {
- item.CalMonth = calMonth;
- }
- else
- {
- if (row.Table.Columns.Contains("绩效核算月份"))
- {
- string strjxyf = row["绩效核算月份"].ToString().Trim();
- string[] temYFs = strjxyf.Split(new char[] { '.' });
- item.CalMonth = new CalMonth();
- item.CalMonth.Year = int.Parse(temYFs[0]);
- item.CalMonth.Month = int.Parse(temYFs[1]);
- item.CalMonth.Status = 4;
- }
- else
- {
- item.CalMonth = new CalMonth();
- item.Status = 0;
- item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
- item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
- }
- }
- item.ApplicationType = row["申请类型"].ToString().Trim();
- item.BusinessType = "普通新申请"; // row["业务类型"].ToString().Trim();
- item.AgentFeedbackMemo = "发明一次OA授权"; //row["备注(填表注意事项)"].ToString().Trim();
- item.DoItem = "发明一次OA授权"; //row["处理事项"].ToString().Trim();
- string strHandler = "";
- if (row.Table.Columns.Contains("处理人"))
- {
- strHandler = row["处理人"].ToString().Trim();
- }
- else
- {
- if (row.Table.Columns.Contains("案件处理人"))
- {
- strHandler = row["案件处理人"].ToString().Trim();
- }
- }
-
- string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- item.ItemStaffs = new List<ItemStaff>();
- foreach (string name in temHandlers)
- {
- ItemStaff itemStaff = new ItemStaff();
- int? iTem = GetStaff(name, Staffs);
- if ((iTem != null))
- {
- //itemStaff.Item = item;
- itemStaff.DoPersonId = iTem.Value;
- item.ItemStaffs.Add(itemStaff);
- }
- else
- {
- itemStaff.DoPerson = new Staff()
- {
- Name = name,
- Account = name,
- Password = "12345678",
- IsCalPerformsnce = false,
- Status = "正式员工",
- StaffGradeId = 4
- };
- item.ItemStaffs.Add(itemStaff);
- }
- }
- if (item.ItemStaffs.Count == 0)
- {
- System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
- }
- if (row.Table.Columns.Contains("核稿人"))
- {
- item.ReviewerId = GetStaff(row["核稿人"].ToString().Trim(), Staffs);
- }
- else
- {
- if (row.Table.Columns.Contains("案件核稿人"))
- {
- item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim(), Staffs);
- }
- }
- item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
- item.ApplicationName = row["申请人"].ToString().Trim();
- item.CaseName = row["案件名称"].ToString().Trim();
-
- //案件备注
- item.CaseMemo = $"发文日期:{row["发文日期"].ToString().Trim()}\r\n客户文号:{row["客户文号"].ToString().Trim()}\r\n上传日期:{row["上传日期"].ToString().Trim()}\r\n文件描述:{row["文件描述"].ToString().Trim()}";
- return item;
- }
- private PerformanceItem Row2Item(DataRow row, List<Staff> Staffs,CalMonth calMonth)
- {
- PerformanceItem item = new PerformanceItem();
- item.CaseNo = row["我方文号"].ToString().Trim();
- if (calMonth != null)
- {
- item.CalMonth = calMonth;
- }
- else
- {
- if (row.Table.Columns.Contains("绩效核算月份"))
- {
- string strjxyf = row["绩效核算月份"].ToString().Trim();
- string[] temYFs = strjxyf.Split(new char[] { '.' });
- item.CalMonth = new CalMonth();
- item.CalMonth.Year = int.Parse(temYFs[0]);
- if (temYFs[1] == "1")
- {
- temYFs[1] = "10";
- }
- item.CalMonth.Month = int.Parse(temYFs[1]);
- item.CalMonth.Status = 4;
- }
- else
- {
- item.CalMonth = new CalMonth();
- item.Status = 0;
- item.CalMonth.Year = DateTime.Now.AddMonths(-1).Year;
- item.CalMonth.Month = DateTime.Now.AddMonths(-1).Month;
- }
- }
- item.ApplicationType = row["申请类型"].ToString().Trim();
- item.BusinessType = row["业务类型"].ToString().Trim();
- if (row.Table.Columns.Contains("备注(填表注意事项)"))
- item.AgentFeedbackMemo = row["备注(填表注意事项)"].ToString().Trim();
- item.DoItem = row["处理事项"].ToString().Trim();
- item.CaseStage = row["案件阶段"].ToString().Trim();
- item.CaseCoefficient = row["案件系数"].ToString().Trim();
- item.DoItemCoefficient = row["处理事项系数"].ToString().Trim();
- item.PreOastaffId = GetStaff(row["前一次OA处理人"].ToString().Trim(), Staffs);
- string strHandler = "";
- if (row.Table.Columns.Contains("处理人"))
- {
- strHandler = row["处理人"].ToString().Trim();
- }
- else
- {
- if (row.Table.Columns.Contains("案件处理人"))
- {
- strHandler = row["案件处理人"].ToString().Trim();
- }
- }
- string[] temHandlers = strHandler.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- item.ItemStaffs = new List<ItemStaff>();
- foreach (string name in temHandlers)
- {
- ItemStaff itemStaff = new ItemStaff();
- string temName = name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
- int? iTem = GetStaff(temName, Staffs);
- if ((iTem != null))
- {
- //itemStaff.Item = item;
- itemStaff.DoPersonId = iTem.Value;
- item.ItemStaffs.Add(itemStaff);
- }
- else
- {
- itemStaff.DoPerson = new Staff()
- {
- Name = temName,
- Account = temName,
- Password = "12345678",
- IsCalPerformsnce = false,
- Status = "已离职",
- StaffGradeId = 4
- };
- item.ItemStaffs.Add(itemStaff);
- }
- }
- if (item.ItemStaffs.Count == 0)
- {
- System.Diagnostics.Debug.WriteLine($"没有处理人: {item.CaseNo}\t{item.DoItem}");
- }
- if (row.Table.Columns.Contains("核稿人"))
- {
- if (!string.IsNullOrEmpty(row["核稿人"].ToString().Trim()))
- {
- string temName = row["核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
- item.ReviewerId = GetStaff(temName.Trim(), Staffs);
- }
- }
- else
- {
- if (row.Table.Columns.Contains("案件核稿人"))
- {
- if (!string.IsNullOrEmpty(row["案件核稿人"].ToString().Trim()))
- {
- string temName = row["案件核稿人"].ToString().Trim().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
- item.ReviewerId = GetStaff(temName.Trim(), Staffs);
- }
-
- }
- }
- if (!string.IsNullOrEmpty(row["点数"].ToString().Trim())) {
- item.BasePoint = double.Parse(row["点数"].ToString().Trim());
- }
- item.Customer = new Customer() { Name = row["客户名称"].ToString().Trim() };
- item.ApplicationName = row["申请人"].ToString().Trim();
- DateTime temDate = new DateTime();
- if (DateTime.TryParse(row["处理事项完成日"].ToString().Trim(), out temDate))
- {
- item.FinishedDate = temDate;
- }
- //定稿日
- if (DateTime.TryParse(row["定稿日"].ToString().Trim(), out temDate))
- {
- item.FinalizationDate = temDate;
- }
- //返稿日
- if (DateTime.TryParse(row["返稿日"].ToString().Trim(), out temDate))
- {
- item.ReturnDate = temDate;
- }
- //案件类型
- item.CaseType = row["案件类型"].ToString().Trim();
- //案件状态
- item.CaseState = row["案件状态"].ToString().Trim();
- //处理事项备注
- item.DoItemMemo = row["处理事项备注"].ToString().Trim();
- //处理状态
- item.DoItemState = row["处理状态"].ToString().Trim();
- //案件名称
- item.CaseName = row["案件名称"].ToString().Trim();
- //委案日期
- if (DateTime.TryParse(row["委案日期"].ToString().Trim(), out temDate))
- {
- item.EntrustingDate = temDate;
- }
- //客户期限
- if (DateTime.TryParse(row["客户期限"].ToString().Trim(), out temDate))
- {
- item.CustomerLimitDate = temDate;
- }
- //内部期限
- if (DateTime.TryParse(row["内部期限"].ToString().Trim(), out temDate))
- {
- item.InternalDate = temDate;
- }
- //初稿日
- if (DateTime.TryParse(row["初稿日"].ToString().Trim(), out temDate))
- {
- item.FirstDraftDate = temDate;
- }
- //备注(发文严重超期是否属客观原因,若为否,请填写原因)
- if (row.Table.Columns.Contains("备注(发文严重超期是否属客观原因,若为否,请填写原因)"))
- {
- item.OverDueMemo = row["备注(发文严重超期是否属客观原因,若为否,请填写原因)"].ToString().Trim();
- }
- //案件备注
- item.CaseMemo = row["案件备注"].ToString().Trim();
- return item;
- }
- private async Task InputPerformanceItem(string strExcelFile,bool isColumnName,bool ignorHideRows=false,int ColumnNameRow=0,CalMonth calMonth=null,bool isFirstOAFile=false)
- {
- DataTable dt = NPOIExcel.ExcelToDataTable(strExcelFile, isColumnName,ignorHideRows,ColumnNameRow);
- #region 删除重复行
- DataTable temdt = new DataTable();
- foreach (DataColumn col in dt.Columns)
- {
- DataColumn temCol = new DataColumn();
- temCol.ColumnName = col.ColumnName;
- temCol.DataType = col.DataType;
- temCol.Caption = col.Caption;
- temdt.Columns.Add(temCol);
- }
-
- new ExcelHelper().MerageDataTable(temdt, dt);
- #endregion
- List<Staff> Staffs =await GetStaffsAsync();
- foreach(DataRow row in temdt.Rows)
- {
- PerformanceItem item = null;
- if (isFirstOAFile)
- {
- item = Row2Item_1(row, Staffs, calMonth);
- }
- else
- {
- item = Row2Item(row, Staffs, calMonth);
- }
- if (item != null )
- {
- System.Diagnostics.Debug.WriteLine($"{DateTime.Now}\t{item.CaseNo}\t{item.CaseName}");
- if (!InValidDoItem.Contains(item.DoItem))
- {
- await SavePerformanceItem(item);
- }
- }
- }
- }
- private async Task Compare2DB()
- {
-
- if (Token == null)
- {
- await Login();
- }
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/CompareExcel2DB");
- //await GetDoItemInfo("PACN2027395", "处理审查意见", "一通");
- }
- private async Task RefreshPerformanceItem(int Type)
- {
- if (Token == null)
- {
- await Login();
- }
- await RefreshItemAsync(Type);
- //await GetDoItemInfo("PACN2027395", "处理审查意见", "一通");
- }
- private async Task StartImport()
- {
- if (Token == null)
- {
- await Login();
- }
- HttpClient http = CreateHttp();//
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.GetFromJsonAsync<ApiSaveResponse>($"{strAPIBaseUri}/api/SystemData/StartImportData");
-
- }
- private async Task CalJXPoint()
- {
- if (Token == null)
- {
- await Login();
- }
- //await CalJXPointAsync(2022,2);
- await CalJXPointAsync(2022, 6);
- }
- private async Task RemoveDBNotFinishedDate()
- {
- if (Token == null)
- {
- await Login();
- }
- await DeleteDBNotFinishedTimeAsync(2022, 2);
- //await CalJXPointAsync(2022, 1);
- }
- List<string> lstJXBL = new List<string>() {
- "柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
- ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","钟子敏"
- };
- List<string> lstAJXS = new List<string>() {
- "柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
- ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","钟子敏","邢丽霞",
- "李庆波","黄瑜","程利","黎坚怡","舒丽亚","管自英","张晓薇","刘希"
- };
- List<string> lstDoItemXS = new List<string>() {
- "吴继红","赖玲玲","郭竟微","陈鹤","王本鼎","高凌云","周煜祥","何丹风",
- "田婵玉","孙心洁","陈舒敏","邢丽霞"
- };
- List<string> lstAJQL = new List<string>() {
- "柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
- ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","吴继红","赖玲玲","郭竟微","陈鹤",
- "王本鼎","高凌云","周煜祥","何丹风","田婵玉","孙心洁","陈舒敏","钟子敏",
- "李庆波","黄瑜","程利","黎坚怡","舒丽亚","管自英","张晓薇","刘希"
- };
- List<string> lstYZCQ = new List<string>() {
- "吴继红","赖玲玲","郭竟微","陈鹤","王本鼎","高凌云","周煜祥","何丹风",
- "田婵玉","孙心洁","陈舒敏"
- };
- List<string> lstRXSX = new List<string>() {
- "夏敏","柳芳","杨超","何倚雯","李姣","张庆玲","李建民","李申","李莉","刘桂兰"
- ,"唐双","瞿璨","张鹏","钟锦光","翁旋艺","钟子敏","李庆波","黄瑜","程利",
- "黎坚怡","舒丽亚","管自英","张晓薇","刘希"
- };
- private async Task UserField2String(List<string> lstList)
- {
- if (Token == null)
- {
- await Login();
- }
- //List<Staff> Reviewers = await getReviewers(14232, 1);
- //Reviewers = await getReviewers(14232, 5);
- List<Staff> Staffs = await GetStaffsAsync();
- List<UserField> lstUsers = new List<UserField>();
- foreach(var name in lstList)
- {
- lstUsers.Add(new UserField()
- {
- UserConditionType = UserConditionType.Staff,
- UserType = UserType.Staff,
- UserValue = GetStaff(name, Staffs).ToString()
- });
- }
-
- JsonSerializerOptions options = new() { IgnoreNullValues = true };
- var strJson = System.Text.Json.JsonSerializer.Serialize(lstUsers, lstUsers.GetType(), options);
- System.Diagnostics.Debug.WriteLine(strJson);
-
- }
- private int? GetStaff(string v, List<Staff> staffs)
- {
- if (!string.IsNullOrEmpty(v))
- {
- string[] temNames = v.Trim().Split(new char[] { '-' },StringSplitOptions.RemoveEmptyEntries);
- foreach (Staff sf in staffs)
- {
- if(sf.Name == temNames[0])
- {
- return sf.Id;
- }
- }
- }
- return null;
- }
- private async Task InitDepartment()
- {
- if (Token == null)
- {
- await Login();
- }
- string strUrl = $"{strAPIBaseUri}/api/Organization/InitUserDepartment";
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var response = await http.GetAsync(strUrl);
- }
- private async Task UpdateStaff()
- {
- OpenFileDialog ofd = new OpenFileDialog();
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- string fileName = ofd.FileName;
- DataTable dt = NPOIExcel.ExcelToDataTable(fileName, true, false,0);
- if (Token == null)
- {
- await Login();
- }
- foreach(DataRow row in dt.Rows)
- {
- Staff staff = new Staff();
- staff.Account = row["Account"].ToString();
- staff.Name = row["Name"].ToString().Trim();
- staff.Sex = row["Sex"].ToString().Trim();
- staff.Status = row["Status"].ToString().Trim();
-
- staff.Tel = row["Tel"].ToString();
- if (staff.Tel == "NULL")
- {
- staff.Tel = null;
- }
- staff.Mobile = row["Mobile"].ToString().Trim();
- if (staff.Mobile == "NULL")
- {
- staff.Mobile = null;
- }
- string temStatus = row["xm备注1"].ToString();
- if(!string.IsNullOrEmpty(temStatus) && temStatus != staff.Status)
- {
- staff.Status = temStatus;
- }
- if (staff.Status == "NULL")
- {
- staff.Status = null;
- }
- staff.IsOnJob = (row["IsOnJob"].ToString() == "1");
- staff.IsCalPerformsnce = (row["IsCalPerformsnce"].ToString() == "1");
- staff.IsCalPerformsnce = (row["是否计算绩效"].ToString() == "是");
- staff.Department = row["Department"].ToString().Trim();
- if (staff.Department == "NULL")
- {
- staff.Department = null;
- }
- staff.WorkPlace = row["WorkPlace"].ToString().Trim();
- if (staff.WorkPlace == "NULL")
- {
- staff.WorkPlace = null;
- }
- staff.Mail = row["Mail"].ToString().Trim();
- if (staff.Mail == "NULL")
- {
- staff.Mail = null;
- }
- staff.Memo = row["Memo"].ToString().Trim();
- if (staff.Memo == "NULL")
- {
- staff.Memo = null;
- }
- int temSGID;
- if (int.TryParse(row["StaffGradeId"].ToString().Trim(), out temSGID)){
- staff.StaffGradeId = temSGID;
- }
- DateTime temDate;
- if(DateTime.TryParse(row["EntyDate"].ToString(),out temDate))
- {
- staff.EntyDate = temDate;
- }
- // xm备注2 StaffGradeId EntyDate
- var temStaff = await GetStaff(staff.Name);
- bool isSaved = false;
- if (temStaff == null)
- {
- isSaved = true;
- //staff.Password = MD5Utility.GetMD5("12345678");
- }
- else
- {
- staff.Id = temStaff.Id;
- //staff.Password = temStaff.Password;
- isSaved =
- (staff.Name != temStaff.Name) ||
- (staff.Account != temStaff.Account) ||
- (staff.Department != temStaff.Department) ||
- (staff.EntyDate != temStaff.EntyDate) ||
- (staff.IsOnJob != temStaff.IsOnJob) ||
- (staff.Mail != temStaff.Mail) ||
- (staff.Mobile != temStaff.Mobile) ||
- (staff.Sex != temStaff.Sex) ||
- (staff.Status != temStaff.Status) ||
- (staff.Tel != temStaff.Tel) ||
- (staff.WorkPlace != temStaff.WorkPlace) ||
- (staff.StaffGradeId != temStaff.StaffGradeId) ||
- (staff.IsCalPerformsnce != temStaff.IsCalPerformsnce );
- }
- if (isSaved)
- {
- //staff.IsCalPerformsnce = (row["是否核算绩效"].ToString() == "是");
- //staff.Memo = row["备注"].ToString().Trim();
- //staff.StaffGradeId = row["姓名"].ToString();
- await SaveStaff(staff);
- }
- System.Diagnostics.Debug.WriteLine($"{staff.Account}\t{staff.Name}");
- }
- }
- }
- private async Task ImportUsers()
- {
- OpenFileDialog ofd = new OpenFileDialog();
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- string fileName = ofd.FileName;
- DataTable dt = NPOIExcel.ExcelToDataTable(fileName, true, false, 1);
- if(Token == null)
- {
- await Login();
- }
- List<StaffGrade> staffGrades = await GetStaffGrades();
- foreach (DataRow row in dt.Rows)
- {
- Staff staff = new Staff();
- staff.Account = row["用户名"].ToString().Trim();
- staff.Name = row["姓名"].ToString().Trim();
- staff.Tel = row["电话号码"].ToString().Trim();
- staff.Mobile = row["手机号码"].ToString().Trim();
- staff.Sex = row["性别"].ToString().Trim();
- staff.Mail = row["邮箱"].ToString().Trim();
- string strGrade = row["工程师等级"].ToString().Trim(); // + "级";
- foreach (StaffGrade sg in staffGrades)
- {
- if (strGrade.Trim() == sg.Grade.Trim())
- {
- staff.StaffGradeId = sg.Id;
- break;
- }
- }
- staff.IsOnJob = (row["是否在职"].ToString().Trim() == "是");
- staff.Status = row["岗位状态"].ToString().Trim();
- staff.Department = row["部门"].ToString();
- staff.WorkPlace = row["工作地"].ToString();
- DateTime temDate;
- if (DateTime.TryParse(row["入职时间"].ToString(), out temDate))
- {
- staff.EntyDate = temDate;
- }
- var temStaff = await GetStaff(staff.Name);
- bool isSaved = false;
- if (temStaff == null)
- {
- isSaved = true;
- staff.Password = MD5Utility.GetMD5("12345678");
- }
- else
- {
- staff.Id = temStaff.Id;
- staff.Password = temStaff.Password;
- isSaved =
- (staff.Name != temStaff.Name) ||
- (staff.Account != temStaff.Account) ||
- (staff.Department != temStaff.Department) ||
- (staff.EntyDate != temStaff.EntyDate) ||
- (staff.IsOnJob != temStaff.IsOnJob) ||
- (staff.Mail != temStaff.Mail) ||
- (staff.Mobile != temStaff.Mobile) ||
- (staff.Sex != temStaff.Sex) ||
- (staff.Status != temStaff.Status) ||
- (staff.Tel != temStaff.Tel) ||
- (staff.WorkPlace != temStaff.WorkPlace) ||
- (staff.StaffGradeId != temStaff.StaffGradeId);
- }
- if (isSaved)
- {
- //staff.IsCalPerformsnce = (row["是否核算绩效"].ToString() == "是");
- //staff.Memo = row["备注"].ToString().Trim();
-
- //staff.StaffGradeId = row["姓名"].ToString();
- await SaveStaff(staff);
- }
- }
- }
- }
- private string getPinYin(string str)
- {
- string retStr = "";
-
- for(int i = 0; i < str.Length; i++)
- {
- ChineseChar cc = new ChineseChar(str[i]);
-
- retStr = retStr + cc.Pinyins[0].ToLower().Replace("1","")
- .Replace("2", "").Replace("3", "").Replace("4", "");
- }
- return retStr;
- }
- string strAPIBaseUri = "http://1.116.113.26:081";// "http://47.106.221.167:8081"; // "http://localhost:39476";//
- userToken Token;
- public async Task GetTest()
- {
- await Login();
- string strUrl = $"{strAPIBaseUri}/api/PerformanceItem/CurrentData2Excel";
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var response = await http.GetFromJsonAsync<FileProcessTask>(strUrl);
- while (!response.Finished)
- {
- response = await http.GetFromJsonAsync<FileProcessTask>($"{strAPIBaseUri}/api/FileProcesTask/Get?Id={response.Id}");
- System.Diagnostics.Debug.WriteLine($"{response.Processed}/{response.Size}");
- System.Threading.Thread.Sleep(2000);
- }
- byte[] data = await http.GetByteArrayAsync($"{strAPIBaseUri}/api/FileProcesTask/Download?Id={response.Id}");
- using (var file = System.IO.File.Create(response.FilePath))
- {
- file.Write(data, 0, data.Length);
- }
-
-
- #region aaa
- //DataTable dt = utility.NPOIExcel.ExcelToDataTable("C:\\temp\\userList.xlsx", true, false, 0);
- //foreach (DataRow row in dt.Rows)
- //{
-
- // string strAccount = row["Account"].ToString();
- // System.Diagnostics.Debug.WriteLine(strAccount);
- // string strStatus = row["Status"].ToString();
- // if (string.IsNullOrEmpty(strStatus))
- // {
- // strStatus = "未知";
- // }
- // string strMail = row["Mail"].ToString();
-
- // if (strAccount != "陈金勇" && strAccount!="南通流程邮箱")
- // {
- // string strUrl = $"{strAPIBaseUri}/api/Account/Modify?accountName={strAccount}&status={strStatus}&mail={strMail}";
- // var response = await CreateHttp().GetFromJsonAsync<ApiSaveResponse>(strUrl);
- // }
- // else
- // {
- // Console.WriteLine("");
- // }
-
- //}
- #endregion
- //var strUrl = "https://47.106.221.167/api/PerformanceItem/CalMyStatistics?userid=98&year=2021&month=12";
- //var response =await CreateHttp().GetFromJsonAsync<List<StaffStatistics>>(strUrl);
- }
- public async Task Login()
- {
- share.webViewObject.loginDto dto = new share.webViewObject.loginDto();
- dto.Name = "caiyangl";
- dto.Password = "Lqftiu807005";
- var response =await CreateHttp().PostAsJsonAsync<loginDto>($"{strAPIBaseUri}/api/account/Login", dto);
- if (response.IsSuccessStatusCode)
- {
- Token = await response.Content.ReadFromJsonAsync<userToken>();
- }
- }
- private async Task StatisticsLevelCount(int year, int month)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- await http.GetAsync($"{strAPIBaseUri}/api/PerformanceItem/StatisticsLevelCount?year={year}&month={month}");
- }
- public async Task<entity.workflowDefine.Workflow> GetWorkflow(int Id, HttpClient _httpClient)
- {
- var ret = await _httpClient.GetFromJsonAsync<entity.workflowDefine.Workflow>($"{strAPIBaseUri}/api/WorkflowEngine/GetWorkflow?workflowId={Id}");
-
- return ret;
- }
- public async Task<List<entity.workflowDefine.Step>> GetSteps(int Id, HttpClient _httpClient)
- {
- var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Step>>($"{strAPIBaseUri}/api/WorkflowEngine/GetSteps?workflowId={Id}");
- return ret;
- }
- public async Task<List<entity.workflowDefine.Action>> GetActions(int workflowId, HttpClient _httpClient)
- {
- var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Action>>($"{strAPIBaseUri}/api/WorkflowEngine/GetActions?workflowId={workflowId}");
- return ret;
- }
- public async Task<List<entity.workflowDefine.TrasferCondition>> GetTransfers(int workflowId, HttpClient _httpClient)
- {
- var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.TrasferCondition>>($"{strAPIBaseUri}/api/WorkflowEngine/GetTrasfers?workflowId={workflowId}");
- return ret;
- }
- private async Task SaveStaff(Staff obj)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.PostAsJsonAsync<wispro.sp.entity.Staff>($"{strAPIBaseUri}/api/Staff/Save", obj);
- if (data.IsSuccessStatusCode)
- {
- ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
- //await Task.Delay(1000);
- if (result.Success)
- {
- }
- else
- {
- }
- }
- else
- {
- }
- }
- private async Task<Staff> GetStaff(string strName)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- try
- {
- var data = await http.GetFromJsonAsync<wispro.sp.entity.Staff>($"{strAPIBaseUri}/api/Staff/GetByName?Name={strName}");
- return data;
- }
- catch
- {
- return null;
- }
- }
- private async Task SaveBasePointRule(BasePointRule obj)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.PostAsJsonAsync<BasePointRule>($"{strAPIBaseUri}/api/BasePointRule/New", obj);
- if (data.IsSuccessStatusCode)
- {
- ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
- //await Task.Delay(1000);
- if (result.Success)
- {
- }
- else
- {
- System.Diagnostics.Debug.WriteLine($"保存错误: {obj.Rule}\t{obj.PointExpress}\r\n{result.ErrorMessage}");
- }
- }
- else
- {
- System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.Type}\t{obj.Rule}");
- }
- }
- private async Task SavePerformanceItem(PerformanceItem obj)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- if (obj.CalMonth.Month == 10)
- {
- System.Diagnostics.Debug.WriteLine($"{obj.CalMonth.Year}-{obj.CalMonth.Month}\t{obj.CaseNo}");
- }
-
- var isExist = await http.PostAsJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/IsExist", obj);
- if (isExist.IsSuccessStatusCode && await isExist.Content.ReadFromJsonAsync<bool>()==false)
- {
- var data = await http.PostAsJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/New", obj);
- if (data.IsSuccessStatusCode)
- {
- ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
- //await Task.Delay(1000);
- if (result.Success)
- {
- }
- else
- {
- System.Diagnostics.Debug.WriteLine($"保存错误: {obj.CaseNo}\t{obj.DoItem}\r\n{result.ErrorMessage}");
- }
- }
- else
- {
- System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.CaseNo}\t{obj.DoItem}");
- }
- }
- }
- private HttpClient CreateHttp()
- {
- HttpClientHandler clientHandler = new HttpClientHandler();
- clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
- return new HttpClient(clientHandler);
- }
- private async Task<List<StaffGrade>> GetStaffGrades()
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var _StaffGrade = await http.GetFromJsonAsync<List<StaffGrade>>($"{strAPIBaseUri}/api/StaffGrade/GetAll");
- return _StaffGrade;
- }
- private async Task<List<Staff>> GetStaffsAsync()
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- ListApiResponse<Staff> data = await http.GetFromJsonAsync<ListApiResponse<Staff>>($"{strAPIBaseUri}/api/Staff/Query?pageIndex=1&pageSize=1000");
- return data.Results;
- }
- private async Task<PerformanceItem> CalJXPointAsync(int year,int month)
- {
- HttpClient http = CreateHttp();//
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.GetFromJsonAsync<ApiSaveResponse>($"{strAPIBaseUri}/api/PerformanceItem/RefreshBasePoint");
- //var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/CalJXPoint?year={year}&month={month}");
- return null;//data;
- }
- private async Task<PerformanceItem> DeleteDBNotFinishedTimeAsync(int year, int month)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/RemoveDBNotFinishDate?year={year}&month={month}");
- return data;
- }
- private async Task<PerformanceItem> RefreshItemAsync(int type)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/RefreshFromIPEasy_Batch?type={type}");
- return data;
- }
- private async Task<List<Staff>> getReviewers(int itemId,int appealTypeId)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- List<Staff> data = await http.GetFromJsonAsync<List<Staff>>($"{strAPIBaseUri}/api/Staff/GetReviewers?itemId={itemId}&appealTypeId={appealTypeId}");
- return data;
- }
- private async Task<PerformanceItem> GetDoItemInfo(string CaseNo, string DoItem, string caseStage)
- {
- HttpClient http = CreateHttp();
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- PerformanceItem data = await http.GetFromJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/IPEasy/GetDoItemInfo?CaseNo={CaseNo}&DoItem={DoItem}&caseStage={caseStage}");
- return data;
- }
- private void button4_Click(object sender, EventArgs e)
- {
- Stopwatch watch = new Stopwatch();
- watch.Start();
- //每月绩效统计--发客户超过一个月未完成案件
- //DownloadReport("每月绩效统计--发客户超过一个月未完成案件", calMonth, false);
- //每月绩效统计--上个月递交完成案件
- //DownloadReport("每月绩效统计--上个月递交完成案件", calMonth, true);
- //每月绩效统计--中国一次OA授权表
- //DownloadReport("每月绩效统计--中国一次OA授权表", calMonth, true, true);
- //"每月绩效统计--专案进度跟踪~S卷", "每月绩效统计--专案开卷报表~S卷"
- wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--发客户超过一个月未完成案件", false);
- wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件", true);
- wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--中国一次OA授权表", true);
- wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--专案进度跟踪~S卷", false);
- wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--专案开卷报表~S卷", false);
- #region aaa
- //dynamic retObj = wispro.sp.utility.IPEasyUtility.GetPerformanceRecord("S2112392-洗碗机调查分析","提出报告");
- //PerformanceItem Item = new PerformanceItem();
- //Item.CaseName = retObj.CaseName;
- //Item.CaseNo = retObj.CaseNo;
- //Item.DoItem = retObj.DoItem;
- //Item.CustomerLimitDate = string.IsNullOrEmpty(retObj.CustomerLimitDate) ? null : DateTime.Parse(retObj.CustomerLimitDate);
- //Item.Customer = new Customer();
- //Item.Customer.Name = retObj.CustomerName;
- //Item.DoItemCoefficient = retObj.DoItemCoefficient;
- //Item.DoItemMemo = retObj.DoItemMemo;
- //Item.DoItemState = retObj.DoItemState;
- //Item.EntrustingDate = string.IsNullOrEmpty(retObj.EntrustingDate) ? null : DateTime.Parse(retObj.EntrustingDate);
- //Item.FinalizationDate = string.IsNullOrEmpty(retObj.FinalizationDate) ? null : DateTime.Parse(retObj.FinalizationDate);
- //Item.FinishedDate = string.IsNullOrEmpty(retObj.FinishedDate) ? null : DateTime.Parse(retObj.FinishedDate);
- ////Item.FirstDraftDate = string.IsNullOrEmpty(retObj.FirstDraftDate) ? null : DateTime.Parse(retObj.FirstDraftDate);
- //Item.InternalDate = string.IsNullOrEmpty(retObj.InternalDate) ? null : DateTime.Parse(retObj.InternalDate);
- //if (!string.IsNullOrEmpty(retObj.DoPersons))
- //{
- // Item.ItemStaffs = new List<ItemStaff>();
- // string[] names = retObj.DoPersons.ToString().Split(new char[] { ','},StringSplitOptions.RemoveEmptyEntries);
- // foreach(var name in names)
- // {
- // ItemStaff iStaff = new ItemStaff();
- // iStaff.DoPerson = new Staff() { Name = name };
- // Item.ItemStaffs.Add(iStaff);
- // }
- //}
- //Item.ReturnDate = string.IsNullOrEmpty(retObj.ReturnDate) ? null : DateTime.Parse(retObj.ReturnDate);
- //if (!string.IsNullOrEmpty(retObj.Reviewer))
- //{
- // Item.Reviewer = new Staff() { Name = retObj.Reviewer };
- //}
- //Item.ApplicationType = retObj.ApplicationType;
- //Item.BusinessType = retObj.BusinessType;
- //Item.CaseCoefficient = retObj.CaseCoefficient;
- //Item.CaseMemo = retObj.CaseMemo;
- //Item.CaseStage = retObj.CaseStage;
- //Item.CaseState = retObj.CaseState;
- //Item.CaseType = retObj.CaseType;
- #endregion
- watch.Stop();
- System.Diagnostics.Debug.WriteLine("用时{0}毫秒", watch.ElapsedMilliseconds);//获取当前实例测量得出的总运行时间(以毫秒为单位)
- //wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件", true);
- //wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--发客户超过一个月未完成案件", false);
- //wispro.sp.utility.IPEasyUtility.DownloadReport("每月绩效统计--中国一次OA授权表", true);
- ////每月绩效统计--发客户超过一个月未完成案件
- //NewMethod("506aa7ad-c3f4-4ec6-9ec8-ff6b92dcd7c1", "每月绩效统计--发客户超过一个月未完成案件.xlsx", calMonth);
- ////每月绩效统计--上个月递交完成案件
- //NewMethod("d7308cd2-71e4-4444-9f47-f4d731ddb26a", "每月绩效统计--上个月递交完成案件.xlsx", calMonth);
- ////每月绩效统计--中国一次OA授权表
- //NewMethod("72454834-afdd-4b98-b42a-0bc912d07610", "每月绩效统计--中国一次OA授权表.xlsx", calMonth, true);
- }
- private async void button5_Click(object sender, EventArgs e)
- {
- await StartImport();
- }
- private async void button6_Click(object sender, EventArgs e)
- {
- if (Token == null)
- {
- await Login();
- }
- HttpClient http = CreateHttp();//
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.GetFromJsonAsync<ApiSaveResponse>($"{strAPIBaseUri}/api/SystemData/UpdateJXData");
- }
- private async void button7_Click(object sender, EventArgs e)
- {
- if (Token == null)
- {
- await Login();
- }
- HttpClient http = CreateHttp();//
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
- var data = await http.GetFromJsonAsync<ApiSaveResponse>($"{strAPIBaseUri}/api/SystemData/SendInvaldDataMessage");
- }
- private async Task<dynamic> GetPerformanceItemFromIPEasy()
- {
- HttpClient http = new HttpClient();
- var response = http.GetFromJsonAsync<Object>($"http://localhost:22468/api/ipEasy/GetItemFromIPEasyDB?CaseNo=PADE1510724&DoItem=处理审查意见").Result;
-
- dynamic retItem = new ExpandoObject();
- JsonElement json = ((System.Text.Json.JsonElement)response);
- retItem.CaseNo = json.GetProperty("CaseNo").GetString();
- retItem.ApplicationType = json.GetProperty("ApplicationType").GetString();
- retItem.BusinessType = json.GetProperty("BusinessType").GetString();
- retItem.DoItem = json.GetProperty("DoItem").GetString();
- retItem.CaseStage = json.GetProperty("CaseStage").GetString();
- retItem.CaseCoefficient = json.GetProperty("CaseCoefficient").GetString();
- retItem.DoItemCoefficient = json.GetProperty("DoItemCoefficient").GetString();
- retItem.DoPersons = json.GetProperty("DoPersons").GetString();
- retItem.Reviewer = json.GetProperty("Reviewer").GetString();
- retItem.CustomerName = json.GetProperty("CustomerName").GetString();
- retItem.FinishedDate = json.GetProperty("FinishedDate").GetString();
- retItem.WordCount = json.GetProperty("WordCount").GetString();
- retItem.ReturnDate = json.GetProperty("ReturnDate").GetString();
- retItem.CaseType = json.GetProperty("CaseType").GetString();
- retItem.CaseState = json.GetProperty("CaseState").GetString();
- retItem.DoItemMemo = json.GetProperty("DoItemMemo").GetString();
- retItem.DoItemState = json.GetProperty("DoItemState").GetString();
- retItem.CaseName = json.GetProperty("CaseName").GetString();
- retItem.EntrustingDate = json.GetProperty("EntrustingDate").GetString();
- retItem.CustomerLimitDate = json.GetProperty("CustomerLimitDate").GetString();
- retItem.InternalDate = json.GetProperty("InternalDate").GetString();
- retItem.FirstDraftDate = json.GetProperty("FirstDraftDate").GetString();
- retItem.CaseMemo = json.GetProperty("CaseMemo").GetString();
- retItem.FinalizationDate = json.GetProperty("FinalizationDate").GetString();
- var bytRespon =http.GetAsync($"http://localhost:22468/api/ipEasy/GetDataFromIPEasy?ReportName=每月绩效统计--发客户超过一个月未完成案件&isModifyDate=true").Result;
- //byte[] data = await http.GetByteArrayAsync($"http://localhost:22468/api/ipEasy/GetDataFromIPEasy?ReportName=每月绩效统计--发客户超过一个月未完成案件&isModifyDate=true");
- if (bytRespon.IsSuccessStatusCode)
- {
- string result = bytRespon.Content.ReadAsStringAsync().Result.Replace("\"", string.Empty);
- byte[] data = Convert.FromBase64String(result);
- //byte[] data = bytRespon.Content.ReadAsByteArrayAsync().Result;//Here is the problem
- XmlSerializer serializer = new XmlSerializer(typeof(System.Data.DataTable));
- MemoryStream memory = new MemoryStream(data);
- DataTable dt = (DataTable)serializer.Deserialize(memory);
- }
-
- return response;
- }
- private async void button4_Click_1(object sender, EventArgs e)
- {
- dynamic ret = await GetPerformanceItemFromIPEasy();
- //if (ret != null)
- {
- //System.Diagnostics.Debug.WriteLine(ret.ToString());
- }
- return;
- if (Token == null)
- {
- await Login();
- }
- //await StatisticsLevelCount(2022,2);
- //await StatisticsLevelCount(2022, 3);
- await StatisticsLevelCount(2022, 4);
- await StatisticsLevelCount(2022, 5);
- await StatisticsLevelCount(2022, 6);
- }
- }
- }
|