Kaynağa Gözat

添加定期自动从流程管理系统中获取绩效数据功能

luocaiyang 4 yıl önce
ebeveyn
işleme
1c0f052855

+ 76 - 0
wispro.sp.api/Controllers/BasePointRuleController.cs

@@ -0,0 +1,76 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using wispro.sp.entity;
+using wispro.sp.share;
+
+// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
+
+namespace wispro.sp.api.Controllers
+{
+    [Route("api/[controller]/[action]")]
+    [ApiController]
+    public class BasePointRuleController : ControllerBase
+    {
+        spDbContext Context;
+        public BasePointRuleController(spDbContext context)
+        {
+            Context = context;
+        }
+        // GET: api/<BasePointRuleController>
+        [HttpGet]
+        public IEnumerable<BasePointRule> Get()
+        {
+
+            return Context.BasePointRules.ToList<BasePointRule>();
+        }
+
+        
+        [HttpGet("{id}")]
+        public BasePointRule Get(int id)
+        {
+            return Context.BasePointRules.Where<BasePointRule>(b => b.Id == id).FirstOrDefault<BasePointRule>();
+        }
+
+        // POST api/<BasePointRuleController>
+        [HttpPost]
+        public ApiSaveResponse New(BasePointRule value)
+        {
+            ApiSaveResponse ret = new ApiSaveResponse();
+
+            try
+            {
+                Context.BasePointRules.Add(value);
+                Context.SaveChanges();
+                ret.Success = true;
+            }
+            catch(Exception ex)
+            {
+                ret.Success = false;
+                ret.ErrorMessage = ex.Message;
+            }
+
+            return ret;
+        }
+
+        
+        [HttpPost]
+        public void Update(int id, string field,string value)
+        {
+            string strSQL = $"update basepointrule set {field}={value} where id={id}";
+            Context.Database.ExecuteSqlRaw(strSQL);
+        }
+
+        
+        [HttpDelete("{id}")]
+        public bool Delete(int id)
+        {
+            Context.BasePointRules.Remove(new BasePointRule() { Id = id });
+            Context.SaveChanges();
+            return true;
+        }
+    }
+}

+ 28 - 0
wispro.sp.api/Controllers/SceduleController.cs

@@ -0,0 +1,28 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using wispro.sp.api.Job;
+
+namespace wispro.sp.api.Controllers
+{
+    [Route("api/[controller]/[action]")]
+    [ApiController]
+    public class ScheduleController : ControllerBase
+    {
+        public void Start()
+        {
+            JobKey jobKey = new JobKey("ImportReportData");
+            var trigger = TriggerBuilder.Create()
+                .WithDescription("导入每月报表")
+                .WithSchedule(CronScheduleBuilder.CronSchedule("0 0/2 * * * ? *").WithMisfireHandlingInstructionDoNothing())
+                .Build();
+
+
+            QuartzUtil.Add(typeof(ImportReportJob), jobKey, trigger);
+        }
+    }
+}

+ 490 - 0
wispro.sp.api/Job/ImportReportJob.cs

@@ -0,0 +1,490 @@
+using DynamicExpresso;
+using Microsoft.Extensions.DependencyInjection;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using wispro.sp.entity;
+using wispro.sp.utility;
+
+namespace wispro.sp.api.Job
+{
+    public class ImportReportJob : Quartz.IJob
+    {
+        
+        /// <summary>
+        /// 不需要计算绩效的处理事项
+        /// </summary>
+        private string[] InValidDoItem = new string[]
+        {
+            "案件异常-催缴年费",
+            "案件异常-视为放弃取得专利权",
+            "办理登记手续",
+            "办理登记手续-确认客户是否委托",
+            "代理所变更",
+            "绘图",
+            "技术确认",
+            "缴年费",
+            "请求保密审查",
+            "请求费减",
+            "请求实审",
+            "取得申请号",
+            "取得证书",
+            "取得专利权评价报告",
+            "确认官方审查状况",
+            "询问放弃或复审",
+            "知识点总结",
+            "专利权人发明人申请人信息变更",
+            "专利挖掘与布局",
+            "我方文号前缀带J",
+            "开卷",
+            "请求提前公开",
+            "取得国际检索报告",
+            "委外检索",
+            "中止程序",
+            "终止",
+            "案件异常-视为撤回",
+            "进入国家阶段提醒",
+            "请求恢复权利",
+            "请求优先权",
+            "取得【无效宣告请求审查决定】",
+            "撤回",
+            "请求退款",
+            "确认是否委托申请与类型",
+            "专利交易",
+            "专利权评价报告",
+            "专利权人发明人申请人信息变更+代理所变更"
+        };
+
+        
+        spDbContext spDb = new spDbContext();
+        
+        
+        public Task Execute(IJobExecutionContext context)
+        {
+            CalMonth calMonth = new CalMonth()
+            {
+                Year = DateTime.Now.AddMonths(-1).Year,
+                Month = DateTime.Now.AddMonths(-1).Month,
+                Status = 0
+            };
+
+
+            var temCalMonth = spDb.CalMonths.Where<CalMonth>(x => x.Year == calMonth.Year && x.Month == calMonth.Month).FirstOrDefault();
+
+            if (temCalMonth != null)
+            {
+                var iCount = spDb.PerformanceItems.Where<PerformanceItem>(p => p.CalMonthId == temCalMonth.Id).Count<PerformanceItem>();
+
+                if (iCount > 0)
+                {
+                    return Task.CompletedTask;
+                }
+            }
+            else
+            {
+
+                spDb.CalMonths.Add(calMonth);
+                spDb.SaveChanges();
+
+            }
+
+            
+            //每月绩效统计--发客户超过一个月未完成案件
+            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);
+           
+            return Task.CompletedTask;
+        }
+
+        private void NewMethod(string reportId,string filename, CalMonth calMonth,bool isFirstOA = false)
+        {
+            string strFileSavePath = utility.ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
+            
+            wispro.sp.utility.IPEasyUtility.DownloadReport(reportId, filename);
+            string strFilePath = System.IO.Path.Combine(strFileSavePath, filename);
+            string strFinalPath = System.IO.Path.Combine(strFileSavePath, $"{calMonth.Year}{calMonth.Month}-{filename}");
+            InputPerformanceItem(strFilePath, true, false, 1, calMonth,isFirstOA);
+            System.IO.File.Move(strFilePath, strFinalPath);
+        }
+
+        private 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<BasePointRule> rules = spDb.BasePointRules.ToList<BasePointRule>();
+
+            foreach (DataRow row in temdt.Rows)
+            {
+                PerformanceItem item = null;
+                if (isFirstOAFile)
+                {
+                    item = Row2Item_1(row,  calMonth);
+                }
+                else
+                {
+                    item = Row2Item(row,  calMonth);
+                }
+
+                if (item != null)
+                {
+                    if (!InValidDoItem.Contains(item.DoItem))
+                    {
+                        SavePerformanceItem(item,rules);
+                    }
+                }
+            }
+
+            return Task.CompletedTask;
+        }
+        private Task SavePerformanceItem(PerformanceItem item,List<BasePointRule> rules)
+        {
+            try
+            {
+                
+
+                #region 计算基本点数值及绩效类型
+                
+                rules.Sort((a, b) => {
+                    var o = b.Priority - a.Priority;
+                    return o;
+                });
+
+                Func<BasePointRule, PerformanceItem, double> pow = (x, y) => (y.WordCount == null) ? x.Point : (double)y.WordCount / 1000.00 * 0.18;
+
+                foreach (BasePointRule rule in rules)
+                {
+                    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 = pow.Invoke(rule, item);
+                        item.Type = rule.Type;
+                        break;
+                    }
+                }
+                #endregion
+
+                new Controllers.PerformanceItemController(spDb).New(item);
+            }
+            catch(Exception ex)
+            {
+
+            }
+
+            return Task.CompletedTask;
+        }
+        private PerformanceItem Row2Item_1(DataRow row,  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);
+                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());
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("案件核稿人"))
+                {
+                    item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim());
+                }
+            }
+
+            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,  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]);
+                    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());
+
+            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);
+                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());
+            }
+            else
+            {
+                if (row.Table.Columns.Contains("案件核稿人"))
+                {
+                    item.ReviewerId = GetStaff(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 int? GetStaff(string v)
+        {
+            var staff = spDb.Staffs.Where<Staff>(s => s.Name == v).FirstOrDefault();
+
+            if(staff != null)
+            {
+                return staff.Id;
+            }
+
+            return null;
+        }
+    }
+}

+ 76 - 0
wispro.sp.api/Job/QuartzUtil.cs

@@ -0,0 +1,76 @@
+using Microsoft.Extensions.DependencyInjection;
+using Quartz;
+using Quartz.Impl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace wispro.sp.api.Job
+{
+    public class QuartzUtil
+    {
+        private static ISchedulerFactory _schedulerFactory;
+        private static IScheduler _scheduler;
+
+        /// <summary>
+        /// 添加任务
+        /// </summary>
+        /// <param name="type">类</param>
+        /// <param name="jobKey">键</param>
+        /// <param name="trigger">触发器</param>
+        public static async Task Add(Type type, JobKey jobKey, ITrigger trigger = null)
+        {
+            Init();
+            _scheduler = await _schedulerFactory.GetScheduler();
+
+            await _scheduler.Start();
+
+            if (trigger == null)
+            {
+                trigger = TriggerBuilder.Create()
+                    .WithIdentity("april.trigger")
+                    .WithDescription("default")
+                    .WithSimpleSchedule(x => x.WithMisfireHandlingInstructionFireNow().WithRepeatCount(-1))
+                    .Build();
+            }
+            var job = JobBuilder.Create(type)
+                .WithIdentity(jobKey)
+                .Build();
+
+            await _scheduler.ScheduleJob(job, trigger);
+        }
+        /// <summary>
+        /// 恢复任务
+        /// </summary>
+        /// <param name="jobKey">键</param>
+        public static async Task Resume(JobKey jobKey)
+        {
+            Init();
+            _scheduler = await _schedulerFactory.GetScheduler();
+            //LogUtil.Debug($"恢复任务{jobKey.Group},{jobKey.Name}");
+            await _scheduler.ResumeJob(jobKey);
+        }
+        /// <summary>
+        /// 停止任务
+        /// </summary>
+        /// <param name="jobKey">键</param>
+        public static async Task Stop(JobKey jobKey)
+        {
+            Init();
+            _scheduler = await _schedulerFactory.GetScheduler();
+            //LogUtil.Debug($"暂停任务{jobKey.Group},{jobKey.Name}");
+            await _scheduler.PauseJob(jobKey);
+        }
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        private static void Init()
+        {
+            if (_schedulerFactory == null)
+            {
+                _schedulerFactory = new StdSchedulerFactory();// ServiceLocator.Services.GetService<ISchedulerFactory>();
+            }
+        }
+    }
+}

+ 878 - 0
wispro.sp.api/Migrations/20211022045200_basePointRule.Designer.cs

@@ -0,0 +1,878 @@
+// <auto-generated />
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using wispro.sp.api;
+
+namespace wispro.sp.api.Migrations
+{
+    [DbContext(typeof(spDbContext))]
+    [Migration("20211022045200_basePointRule")]
+    partial class basePointRule
+    {
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("Relational:MaxIdentifierLength", 128)
+                .HasAnnotation("ProductVersion", "5.0.9")
+                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+            modelBuilder.Entity("wispro.sp.entity.AttachFile", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("SavePath")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<int>("UploadUserId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UploadUserId");
+
+                    b.ToTable("AttachFile");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.BasePointRule", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<double>("Point")
+                        .HasColumnType("float");
+
+                    b.Property<int>("Priority")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Rule")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Type")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("BasePointRules");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.CalMonth", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<int>("Month")
+                        .HasColumnType("int")
+                        .HasColumnName("month");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int")
+                        .HasColumnName("status");
+
+                    b.Property<int>("Year")
+                        .HasColumnType("int")
+                        .HasColumnName("year");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("CalMonth");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Customer", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<string>("Address")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("ContactMan")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("Phone")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int?>("ResponseManId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ResponseManId");
+
+                    b.ToTable("Customer");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.ItemStaff", b =>
+                {
+                    b.Property<int>("ItemId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("DoPersonId")
+                        .HasColumnType("int");
+
+                    b.Property<double>("PerformancePoint")
+                        .HasColumnType("float");
+
+                    b.HasKey("ItemId", "DoPersonId");
+
+                    b.HasIndex("DoPersonId");
+
+                    b.ToTable("ItemStaff");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Message", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("FromId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("MessageInfo")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("FromId");
+
+                    b.ToTable("Message");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.MessagePerformanceItem", b =>
+                {
+                    b.Property<int>("ItemId")
+                        .HasColumnType("int");
+
+                    b.Property<Guid>("MessageId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.HasKey("ItemId", "MessageId");
+
+                    b.HasIndex("MessageId");
+
+                    b.ToTable("MessagePerformanceItems");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.MessageReadRecord", b =>
+                {
+                    b.Property<Guid>("MessageId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("StaffId")
+                        .HasColumnType("int");
+
+                    b.Property<Guid?>("MessageId1")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<bool>("isReaded")
+                        .HasColumnType("bit");
+
+                    b.HasKey("MessageId", "StaffId");
+
+                    b.HasIndex("MessageId1");
+
+                    b.HasIndex("StaffId");
+
+                    b.ToTable("MessageReadRecord");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.PerformanceItem", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<string>("AgentFeedbackMemo")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ApplicationName")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("ApplicationType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<decimal?>("BasePoint")
+                        .HasColumnType("numeric(18,2)");
+
+                    b.Property<string>("BusinessType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("CalMonthId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("CaseCoefficient")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)");
+
+                    b.Property<string>("CaseMemo")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CaseName")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("CaseNo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CaseStage")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CaseState")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CaseType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int?>("CustomerId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime?>("CustomerLimitDate")
+                        .HasColumnType("date");
+
+                    b.Property<string>("DoItem")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("DoItemCoefficient")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("DoItemMemo")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("DoItemState")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("EntrustingDate")
+                        .HasColumnType("date");
+
+                    b.Property<DateTime?>("FinalizationDate")
+                        .HasColumnType("date");
+
+                    b.Property<DateTime?>("FinishedDate")
+                        .HasColumnType("date");
+
+                    b.Property<DateTime?>("FirstDraftDate")
+                        .HasColumnType("date");
+
+                    b.Property<DateTime?>("InternalDate")
+                        .HasColumnType("date");
+
+                    b.Property<string>("OverDueMemo")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<int?>("PreOastaffId")
+                        .HasColumnType("int")
+                        .HasColumnName("PreOAStaffId");
+
+                    b.Property<DateTime?>("ReturnDate")
+                        .HasColumnType("date");
+
+                    b.Property<int?>("ReviewerId")
+                        .HasColumnType("int");
+
+                    b.Property<int?>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Type")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int?>("WordCount")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CalMonthId");
+
+                    b.HasIndex("CustomerId");
+
+                    b.HasIndex("PreOastaffId");
+
+                    b.HasIndex("ReviewerId");
+
+                    b.ToTable("PerformanceItem");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Staff", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<string>("Account")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Department")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("EntyDate")
+                        .HasColumnType("date");
+
+                    b.Property<bool>("IsCalPerformsnce")
+                        .HasColumnType("bit")
+                        .HasColumnName("isCalPerformsnce");
+
+                    b.Property<string>("Mail")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Memo")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Password")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("StaffGradeId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Status")
+                        .IsRequired()
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("WorkPlace")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("StaffGradeId");
+
+                    b.ToTable("Staff");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.StaffGrade", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<double>("Coefficient")
+                        .HasColumnType("float");
+
+                    b.Property<string>("Grade")
+                        .IsRequired()
+                        .HasMaxLength(5)
+                        .HasColumnType("nchar(5)")
+                        .IsFixedLength(true);
+
+                    b.HasKey("Id");
+
+                    b.ToTable("StaffGrade");
+
+                    b.HasData(
+                        new
+                        {
+                            Id = 1,
+                            Coefficient = 1.2,
+                            Grade = "S级"
+                        },
+                        new
+                        {
+                            Id = 2,
+                            Coefficient = 1.1000000000000001,
+                            Grade = "A3级"
+                        },
+                        new
+                        {
+                            Id = 3,
+                            Coefficient = 1.1000000000000001,
+                            Grade = "A2级"
+                        },
+                        new
+                        {
+                            Id = 4,
+                            Coefficient = 1.1000000000000001,
+                            Grade = "A1级"
+                        },
+                        new
+                        {
+                            Id = 5,
+                            Coefficient = 1.0,
+                            Grade = "B3级"
+                        },
+                        new
+                        {
+                            Id = 6,
+                            Coefficient = 1.0,
+                            Grade = "B2级"
+                        },
+                        new
+                        {
+                            Id = 7,
+                            Coefficient = 0.90000000000000002,
+                            Grade = "B1级"
+                        },
+                        new
+                        {
+                            Id = 8,
+                            Coefficient = 0.90000000000000002,
+                            Grade = "C3级"
+                        },
+                        new
+                        {
+                            Id = 9,
+                            Coefficient = 0.69999999999999996,
+                            Grade = "C2级"
+                        },
+                        new
+                        {
+                            Id = 10,
+                            Coefficient = 0.69999999999999996,
+                            Grade = "C1级"
+                        },
+                        new
+                        {
+                            Id = 11,
+                            Coefficient = 0.59999999999999998,
+                            Grade = "D3级"
+                        },
+                        new
+                        {
+                            Id = 12,
+                            Coefficient = 0.59999999999999998,
+                            Grade = "D2级"
+                        },
+                        new
+                        {
+                            Id = 13,
+                            Coefficient = 0.5,
+                            Grade = "D1级"
+                        });
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.VerifyCoefficient", b =>
+                {
+                    b.Property<int>("CheckerId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("DoPersonId")
+                        .HasColumnType("int");
+
+                    b.Property<double>("Coefficient")
+                        .HasColumnType("float");
+
+                    b.HasKey("CheckerId", "DoPersonId");
+
+                    b.HasIndex("DoPersonId");
+
+                    b.ToTable("VerifyCoefficient");
+
+                    b.HasData(
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 5,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 6,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 7,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 8,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 9,
+                            Coefficient = 0.29999999999999999
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 10,
+                            Coefficient = 0.29999999999999999
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 11,
+                            Coefficient = 0.40000000000000002
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 12,
+                            Coefficient = 0.40000000000000002
+                        },
+                        new
+                        {
+                            CheckerId = 2,
+                            DoPersonId = 13,
+                            Coefficient = 0.5
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 5,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 6,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 7,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 8,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 9,
+                            Coefficient = 0.29999999999999999
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 10,
+                            Coefficient = 0.29999999999999999
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 11,
+                            Coefficient = 0.40000000000000002
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 12,
+                            Coefficient = 0.40000000000000002
+                        },
+                        new
+                        {
+                            CheckerId = 3,
+                            DoPersonId = 13,
+                            Coefficient = 0.5
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 5,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 6,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 7,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 8,
+                            Coefficient = 0.20000000000000001
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 9,
+                            Coefficient = 0.29999999999999999
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 10,
+                            Coefficient = 0.29999999999999999
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 11,
+                            Coefficient = 0.40000000000000002
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 12,
+                            Coefficient = 0.40000000000000002
+                        },
+                        new
+                        {
+                            CheckerId = 4,
+                            DoPersonId = 13,
+                            Coefficient = 0.5
+                        });
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.AttachFile", b =>
+                {
+                    b.HasOne("wispro.sp.entity.Staff", "UploadUser")
+                        .WithMany()
+                        .HasForeignKey("UploadUserId")
+                        .HasConstraintName("FK_AttachFile_UpdateUser")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("UploadUser");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Customer", b =>
+                {
+                    b.HasOne("wispro.sp.entity.Staff", "ResponseMan")
+                        .WithMany("Customers")
+                        .HasForeignKey("ResponseManId")
+                        .HasConstraintName("FK_Customer_Staff");
+
+                    b.Navigation("ResponseMan");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.ItemStaff", b =>
+                {
+                    b.HasOne("wispro.sp.entity.Staff", "DoPerson")
+                        .WithMany("ItemStaffs")
+                        .HasForeignKey("DoPersonId")
+                        .HasConstraintName("FK_ItemStaff_Staff")
+                        .IsRequired();
+
+                    b.HasOne("wispro.sp.entity.PerformanceItem", "Item")
+                        .WithMany("ItemStaffs")
+                        .HasForeignKey("ItemId")
+                        .HasConstraintName("FK_ItemStaff_PerformanceItem")
+                        .IsRequired();
+
+                    b.Navigation("DoPerson");
+
+                    b.Navigation("Item");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Message", b =>
+                {
+                    b.HasOne("wispro.sp.entity.Staff", "From")
+                        .WithMany()
+                        .HasForeignKey("FromId")
+                        .HasConstraintName("FK_From_Staff")
+                        .IsRequired();
+
+                    b.Navigation("From");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.MessagePerformanceItem", b =>
+                {
+                    b.HasOne("wispro.sp.entity.PerformanceItem", "Item")
+                        .WithMany()
+                        .HasForeignKey("ItemId")
+                        .HasConstraintName("FK_MessagePerformanceItem_Item")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("wispro.sp.entity.Message", "Message")
+                        .WithMany("RelatedItem")
+                        .HasForeignKey("MessageId")
+                        .HasConstraintName("FK_MessagePerformanceItem_Message")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Item");
+
+                    b.Navigation("Message");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.MessageReadRecord", b =>
+                {
+                    b.HasOne("wispro.sp.entity.Message", "Message")
+                        .WithMany()
+                        .HasForeignKey("MessageId")
+                        .HasConstraintName("FK_MessageReadRecord_Message")
+                        .IsRequired();
+
+                    b.HasOne("wispro.sp.entity.Message", null)
+                        .WithMany("To")
+                        .HasForeignKey("MessageId1");
+
+                    b.HasOne("wispro.sp.entity.Staff", "Staff")
+                        .WithMany()
+                        .HasForeignKey("StaffId")
+                        .HasConstraintName("FK_MessageReadRecord_Staff")
+                        .IsRequired();
+
+                    b.Navigation("Message");
+
+                    b.Navigation("Staff");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.PerformanceItem", b =>
+                {
+                    b.HasOne("wispro.sp.entity.CalMonth", "CalMonth")
+                        .WithMany("PerformanceItems")
+                        .HasForeignKey("CalMonthId")
+                        .HasConstraintName("FK_PerformanceItem_CalMonth")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("wispro.sp.entity.Customer", "Customer")
+                        .WithMany("PerformanceItems")
+                        .HasForeignKey("CustomerId")
+                        .HasConstraintName("FK_PerformanceItem_Customer");
+
+                    b.HasOne("wispro.sp.entity.Staff", "PreOastaff")
+                        .WithMany()
+                        .HasForeignKey("PreOastaffId")
+                        .HasConstraintName("FK_PerformanceItem_Staff");
+
+                    b.HasOne("wispro.sp.entity.Staff", "Reviewer")
+                        .WithMany("ReviewerItems")
+                        .HasForeignKey("ReviewerId")
+                        .HasConstraintName("FK_PerformanceItem_Reviewer");
+
+                    b.Navigation("CalMonth");
+
+                    b.Navigation("Customer");
+
+                    b.Navigation("PreOastaff");
+
+                    b.Navigation("Reviewer");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Staff", b =>
+                {
+                    b.HasOne("wispro.sp.entity.StaffGrade", "StaffGrade")
+                        .WithMany("Staff")
+                        .HasForeignKey("StaffGradeId")
+                        .HasConstraintName("FK_Staff_StaffGrade")
+                        .IsRequired();
+
+                    b.Navigation("StaffGrade");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.VerifyCoefficient", b =>
+                {
+                    b.HasOne("wispro.sp.entity.StaffGrade", "Checker")
+                        .WithMany("VerifyCoefficientCheckers")
+                        .HasForeignKey("CheckerId")
+                        .HasConstraintName("FK_VerifyCoefficient_StaffGrade")
+                        .IsRequired();
+
+                    b.HasOne("wispro.sp.entity.StaffGrade", "DoPerson")
+                        .WithMany("VerifyCoefficientDoPeople")
+                        .HasForeignKey("DoPersonId")
+                        .HasConstraintName("FK_VerifyCoefficient_StaffGrade1")
+                        .IsRequired();
+
+                    b.Navigation("Checker");
+
+                    b.Navigation("DoPerson");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.CalMonth", b =>
+                {
+                    b.Navigation("PerformanceItems");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Customer", b =>
+                {
+                    b.Navigation("PerformanceItems");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Message", b =>
+                {
+                    b.Navigation("RelatedItem");
+
+                    b.Navigation("To");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.PerformanceItem", b =>
+                {
+                    b.Navigation("ItemStaffs");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.Staff", b =>
+                {
+                    b.Navigation("Customers");
+
+                    b.Navigation("ItemStaffs");
+
+                    b.Navigation("ReviewerItems");
+                });
+
+            modelBuilder.Entity("wispro.sp.entity.StaffGrade", b =>
+                {
+                    b.Navigation("Staff");
+
+                    b.Navigation("VerifyCoefficientCheckers");
+
+                    b.Navigation("VerifyCoefficientDoPeople");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 54 - 0
wispro.sp.api/Migrations/20211022045200_basePointRule.cs

@@ -0,0 +1,54 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace wispro.sp.api.Migrations
+{
+    public partial class basePointRule : Migration
+    {
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<string>(
+                name: "Type",
+                table: "PerformanceItem",
+                type: "nvarchar(max)",
+                nullable: true);
+
+            migrationBuilder.AddColumn<int>(
+                name: "WordCount",
+                table: "PerformanceItem",
+                type: "int",
+                nullable: true);
+
+            migrationBuilder.AddColumn<int>(
+                name: "Priority",
+                table: "BasePointRules",
+                type: "int",
+                nullable: false,
+                defaultValue: 0);
+
+            migrationBuilder.AddColumn<string>(
+                name: "Type",
+                table: "BasePointRules",
+                type: "nvarchar(max)",
+                nullable: true);
+        }
+
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropColumn(
+                name: "Type",
+                table: "PerformanceItem");
+
+            migrationBuilder.DropColumn(
+                name: "WordCount",
+                table: "PerformanceItem");
+
+            migrationBuilder.DropColumn(
+                name: "Priority",
+                table: "BasePointRules");
+
+            migrationBuilder.DropColumn(
+                name: "Type",
+                table: "BasePointRules");
+        }
+    }
+}

+ 12 - 0
wispro.sp.api/Migrations/spDbContextModelSnapshot.cs

@@ -53,9 +53,15 @@ namespace wispro.sp.api.Migrations
                     b.Property<double>("Point")
                         .HasColumnType("float");
 
+                    b.Property<int>("Priority")
+                        .HasColumnType("int");
+
                     b.Property<string>("Rule")
                         .HasColumnType("nvarchar(max)");
 
+                    b.Property<string>("Type")
+                        .HasColumnType("nvarchar(max)");
+
                     b.HasKey("Id");
 
                     b.ToTable("BasePointRules");
@@ -307,6 +313,12 @@ namespace wispro.sp.api.Migrations
                     b.Property<int?>("Status")
                         .HasColumnType("int");
 
+                    b.Property<string>("Type")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int?>("WordCount")
+                        .HasColumnType("int");
+
                     b.HasKey("Id");
 
                     b.HasIndex("CalMonthId");

+ 14 - 13
wispro.sp.api/Program.cs

@@ -2,8 +2,10 @@ using Microsoft.AspNetCore.Hosting;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
+using Quartz;
 using System;
 using System.Linq;
+using wispro.sp.api.Job;
 
 namespace wispro.sp.api
 {
@@ -11,18 +13,6 @@ namespace wispro.sp.api
     {
         public static void Main(string[] args)
         {
-            //spDbContext context = new spDbContext();
-
-            ////判断是否有待迁移
-            //if (context.Database.GetPendingMigrations().Any())
-            //{
-            //    //Console.WriteLine("Migrating...");
-            //    ////执行迁移
-            //    //context.Database.Migrate();
-            //    //Console.WriteLine("Migrated");
-            //}
-
-            
             var host = CreateHostBuilder(args).Build();
 
             using (var serviceScope = host.Services.CreateScope())
@@ -43,7 +33,7 @@ namespace wispro.sp.api
                     {
                         System.Diagnostics.Debug.Write("数据库创建失败!");
                     }
-                    
+
                 }
                 catch (Exception ex)
                 {
@@ -51,6 +41,17 @@ namespace wispro.sp.api
                     //logger.LogError(ex, "An error occurred.");
                 }
             }
+            
+
+            JobKey jobKey = new JobKey("ImportReportData");
+            var trigger = TriggerBuilder.Create()
+                .WithDescription("导入每月报表")
+                .WithSchedule(CronScheduleBuilder.CronSchedule(utility.ConfigHelper.GetSectionValue("IPEasySetting:ScheduleSetting")).WithMisfireHandlingInstructionDoNothing())
+                .Build();
+
+
+            QuartzUtil.Add(typeof(ImportReportJob), jobKey, trigger);
+            
 
             host.Run();
         }

+ 15 - 16
wispro.sp.api/Startup.cs

@@ -6,8 +6,11 @@ using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
 using Microsoft.IdentityModel.Tokens;
+using Quartz;
+using Quartz.Impl;
 using System;
 using System.Text;
+using wispro.sp.api.Job;
 
 namespace wispro.sp.api
 {
@@ -36,21 +39,6 @@ namespace wispro.sp.api
             });
 
             
-            //services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
-            //    .AddJwtBearer(options =>
-            //    {
-            //        options.TokenValidationParameters = new TokenValidationParameters
-            //        {
-            //            ValidateIssuer = true,//是否验证Issuer
-            //            ValidateAudience = true,//是否验证Audience
-            //            ValidateLifetime = true,//是否验证失效时间
-            //            ValidateIssuerSigningKey = true,//是否验证SecurityKey
-            //            ValidAudience = Configuration["jwt:Audience"],//Audience
-            //            ValidIssuer = Configuration["jwt:Issuer"],//Issuer,这两项和签发jwt的设置一致
-            //            IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["jwt:Key"]))//拿到SecurityKey
-            //        };
-            //    });
-
             services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(option =>
             {
                 option.TokenValidationParameters = new TokenValidationParameters
@@ -69,7 +57,9 @@ namespace wispro.sp.api
             services.AddDbContext<spDbContext>(optionsAction =>
                 optionsAction.UseSqlServer(Configuration.GetConnectionString("DefaultConnect"))
             );
-            
+
+            services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
+
         }
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -95,6 +85,15 @@ namespace wispro.sp.api
             });
 
             
+
+            //JobKey jobKey = new JobKey("ImportReportData");
+            //var trigger = TriggerBuilder.Create()
+            //    .WithDescription("导入每月报表")
+            //    .WithSchedule(CronScheduleBuilder.CronSchedule("0 0/2 * * * ? *").WithMisfireHandlingInstructionDoNothing())
+            //    .Build();
+
+
+            //QuartzUtil.Add(typeof(ImportReportJob), jobKey, trigger);
         }
     }
 }

+ 9 - 0
wispro.sp.api/appsettings.json

@@ -19,5 +19,14 @@
     "Key": "fef3d2e1Edwfw43312321edszaSd",
     "Audience": "StaffPerformance",
     "Issuer": "http://localhost:39476"
+  },
+  "IPEasySetting": {
+    "DownloadFileSavePath": "c:\\temp",
+    "isHeadless": "false",
+    "Account": "caiyangl",
+    "Password": "j)wx*lier*@3",
+    "ChormeDriverPath": "D:\\source\\repos\\ConsoleApp2\\ConsoleApp2\\bin\\Debug",
+    "ScheduleSetting": "30 35 17 25 * ? *"
+
   }
 }

+ 1 - 1
wispro.sp.api/spDbContext.cs

@@ -39,7 +39,7 @@ namespace wispro.sp.api
         {
             if (!optionsBuilder.IsConfigured)
             {
-                optionsBuilder.UseSqlServer("Data Source=(local);Initial Catalog=spDB;User ID=sa;Password=Lqftiu807005");// Configuration.GetConnectionString("DefaultConnect"));
+                optionsBuilder.UseSqlServer(utility.ConfigHelper.GetSectionValue("ConnectionStrings:DefaultConnect"));// "Data Source=(local);Initial Catalog=spDB;User ID=sa;Password=Lqftiu807005");// Configuration.GetConnectionString("DefaultConnect"));
                 //ConfigurationManager.AppSettings["ValidAudience"]
             }
         }

+ 2 - 0
wispro.sp.api/wispro.sp.api.csproj

@@ -6,6 +6,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="DynamicExpresso.Core" Version="2.9.3" />
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.18" />
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.10" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
@@ -14,6 +15,7 @@
     </PackageReference>
     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
     <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
+    <PackageReference Include="Quartz" Version="3.3.3" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
wispro.sp.share/wispro.sp.share.csproj

@@ -6,7 +6,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="AntDesign.ProLayout" Version="0.1.4" />
+    <PackageReference Include="AntDesign.ProLayout" Version="0.1.8" />
   </ItemGroup>
 
   <ItemGroup>

+ 38 - 0
wispro.sp.utility/ConfigHelper.cs

@@ -0,0 +1,38 @@
+using Microsoft.Extensions.Configuration;
+using System;
+using System.IO;
+
+namespace wispro.sp.utility
+{
+    public class ConfigHelper
+    {
+        private static IConfiguration _configuration;
+
+        static ConfigHelper()
+        {
+            //在当前目录或者根目录中寻找appsettings.json文件
+            var fileName = "appsettings.json";
+
+            var directory = AppContext.BaseDirectory;
+            directory = directory.Replace("\\", "/");
+
+            var filePath = $"{directory}/{fileName}";
+            if (!File.Exists(filePath))
+            {
+                var length = directory.IndexOf("/bin");
+                filePath = $"{directory.Substring(0, length)}/{fileName}";
+            }
+
+            var builder = new ConfigurationBuilder()
+                .AddJsonFile(filePath, false, true);
+
+            _configuration = builder.Build();
+        }
+
+        //获取值
+        public static string GetSectionValue(string key)
+        {
+            return _configuration.GetSection(key).Value;
+        }
+    }
+}

+ 82 - 0
wispro.sp.utility/IPEasyUtility.cs

@@ -0,0 +1,82 @@
+using System;
+using System.Linq;
+using OpenQA.Selenium;
+
+namespace wispro.sp.utility
+{
+    public class IPEasyUtility
+    {
+        public static void DownloadReport(string strId,string filename)
+        {
+            string strFileSavePath = ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
+            bool isheadless = (ConfigHelper.GetSectionValue("IPEasySetting:isHeadless") == "true");
+            string Account = ConfigHelper.GetSectionValue("IPEasySetting:Account");
+            string Password = ConfigHelper.GetSectionValue("IPEasySetting:Password");
+
+            OpenQA.Selenium.Chrome.ChromeOptions options = new OpenQA.Selenium.Chrome.ChromeOptions();
+
+
+            options.AddUserProfilePreference("download.default_directory", strFileSavePath);
+            options.AddUserProfilePreference("intl.accept_languages", "nl");
+            options.AddUserProfilePreference("disable-popup-blocking", "true");
+            if (isheadless)
+            {
+                options.AddArgument("headless");
+            }
+
+            using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath"), options))
+            {
+                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(50);
+                driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(500);
+
+                //进入登录界面
+                driver.Navigate().GoToUrl("http://47.106.221.167/Login.aspx");
+
+                //输入用户名和密码
+                driver.FindElement(By.Id("txtUser")).SendKeys(Account);
+                driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
+
+                //点击登录按钮
+                driver.FindElement(By.Id("btnLogin")).Click();
+
+                //关闭提示遮罩层
+                driver.FindElement(By.Id("jpwClose")).Click();
+
+                //点击顶部菜单栏中的报表管理菜单
+                driver.FindElement(By.Name("970d33d5-c728-41b8-a060-4330610706b9")).Click();
+
+                //点击左侧 自定义报表 菜单
+                driver.FindElement(By.Name("642fa96f-1e1f-46fd-aaa4-cb461ee8df5b")).Click();
+
+                //切换到自定义报表Frame
+                driver.SwitchTo().Frame(1);
+
+                //调用报表导出JS
+                ((IJavaScriptExecutor)driver).ExecuteScript($"Report.Export('{strId}');");
+
+                //切换到弹出的导出报表窗口,点击导出按钮
+                driver.SwitchTo().DefaultContent();
+                var ihg_export = driver.FindElement(By.Name("ihg_export"));
+                driver.SwitchTo().Frame(ihg_export);
+                driver.FindElement(By.Id("btnSubmit")).Click();
+
+                string strFilePath = System.IO.Path.Combine(strFileSavePath, filename);
+
+
+                while (true)
+                {
+
+                    System.IO.FileInfo file = new System.IO.FileInfo(strFilePath);
+                    if (!file.Exists || file.Length == 0) { 
+                        System.Threading.Thread.Sleep(5000);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+
+            }
+        }
+    }
+}

+ 5 - 0
wispro.sp.utility/wispro.sp.utility.csproj

@@ -6,7 +6,12 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.10" />
+    <PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
     <PackageReference Include="NPOI" Version="2.5.4" />
+    <PackageReference Include="Selenium.Chrome.WebDriver" Version="85.0.0" />
+    <PackageReference Include="Selenium.Support" Version="4.0.1" />
+    <PackageReference Include="Selenium.WebDriver" Version="4.0.1" />
   </ItemGroup>
 
 </Project>

+ 3 - 0
wispro.sp.winClient/App.config

@@ -4,5 +4,8 @@
     <add key="CalculatedFile" value ="ExcelFiles\21.01-21.06 工程师绩效报表-总表.xlsx"/>
     <add key="DinashuRegularFile" value ="ExcelFiles\20210903-威世博常用绩效点数计算规则-v3-lcy.xls"/>
     <add key="PersonListFile" value ="ExcelFiles\210730-威世博人员清单v1r01-xm"/>
+	<add key ="ReportTempPath" value ="c:\temp"/>
+	<add key ="IPEasyAccount" value ="caiyangl"/>
+	<add key ="IPEasyPassword" value ="j)wx*lier*@3"/>
   </appSettings>
 </configuration>

+ 158 - 0
wispro.sp.winClient/Form1.cs

@@ -93,8 +93,144 @@ namespace wispro.sp.winClient
             "专利权人发明人申请人信息变更+代理所变更"
         };
 
+        private async Task InitRules()
+        {
+            List<BasePointRule> rules = new List<BasePointRule>()
+            {
+                new BasePointRule(){Rule="p.ApplicationType==\"外观设计\"",Point=0.2,Type="新申请",Priority=1},
+                new BasePointRule(){Rule="p.AgentFeedbackMemo==\"检索结案\"",Point=0.2,Type="新申请",Priority=1},
+                new BasePointRule(){Rule="p.AgentFeedbackMemo==\"撰写中客户取消申请\"",Point=0,Type="新申请",Priority=2},
+                new BasePointRule(){Rule="p.ApplicationType==\"实用新型\" && p.CaseNo.StartsWith(\"PACN\") && p.AgentFeedbackMemo==\"发文后客户取消申请\"",Point=0.49,Type="新申请",Priority=3},
+                new BasePointRule(){Rule="p.ApplicationType==\"发明\" && p.CaseNo.StartsWith(\"PACN\") && p.AgentFeedbackMemo==\"发文后客户取消申请\"",Point=0.7,Type="新申请",Priority=4},
+                new BasePointRule(){Rule="p.CaseNo.StartsWith(\"PADE\")  && p.AgentFeedbackMemo==\"发文后客户原因取消申请,系统结案\"",Point=1.33,Type="新申请",Priority=5},
+                new BasePointRule(){Rule="p.CaseNo.StartsWith(\"PAUS\")  && p.AgentFeedbackMemo==\"发文后客户原因取消申请,系统结案\"",Point=1.26,Type="新申请",Priority=6},
+                new BasePointRule(){Rule="p.AgentFeedbackMemo==\"我方代交\"",Point=0,Type="新申请",Priority=7},
+                new BasePointRule(){Rule="p.AgentFeedbackMemo==\"我方转格式、复核\"",Point=0.2,Type="新申请",Priority=8},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.AgentFeedbackMemo==\"PCT首次英文案\"",Point=1.8,Type="新申请",Priority=9},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.AgentFeedbackMemo==\"改权\"",Point=0.3,Type="新申请",Priority=11},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.AgentFeedbackMemo==\"改权+改说明书\"",Point=0.5,Type="新申请",Priority=12},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.AgentFeedbackMemo==\"涉外实质改权\"",Point=0.7,Type="新申请",Priority=13},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.AgentFeedbackMemo==\"首次中文案\"",Point=1,Type="新申请",Priority=14},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.AgentFeedbackMemo==\"外-内首次申请\"",Point=1.5,Type="新申请",Priority=15},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.AgentFeedbackMemo==\"转格式\"",Point=0.1,Type="新申请",Priority=16},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\"  && p.CaseNo.StartsWith(\"PATW\") && p.AgentFeedbackMemo==\"同套大陆+台湾\"",Point=0.1,Type="新申请",Priority=17},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"实用新型\" && p.CaseNo.StartsWith(\"PACN\") && p.AgentFeedbackMemo==\"同套大陆+台湾\"",Point=0.7,Type="新申请",Priority=18},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"实用新型\" && p.CaseNo.StartsWith(\"PATW\") && p.AgentFeedbackMemo==\"同套大陆+台湾\"",Point=0.1,Type="新申请",Priority=19},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.CaseNo.StartsWith(\"PACN\") && p.AgentFeedbackMemo==\"台湾案转大陆案\"",Point=0.2,Type="新申请",Priority=20},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\"  && p.CaseNo.StartsWith(\"PACN\") && p.AgentFeedbackMemo==\"同套大陆+台湾\"",Point=1,Type="新申请",Priority=21},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.CaseNo.StartsWith(\"PATW\") && p.AgentFeedbackMemo==\"大陆案转台湾案\"",Point=0.2,Type="新申请",Priority=22},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PAEPO\")",Point=1.8,Type="新申请",Priority=23},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PACN\") && p.CaseNo.EndsWith(\"-分案\")",Point=0.3,Type="新申请",Priority=24},
+                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},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\"  && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PACN\") && p.CaseNo.EndsWith(\"-TS\")",Point=1,Type="新申请",Priority=26},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"实用新型\" &&  p.CaseNo.StartsWith(\"PACN\") && p.CaseNo.EndsWith(\"-TS\")",Point=0.1,Type="新申请",Priority=27},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" && p.CaseNo.StartsWith(\"PACN\")",Point=1,Type="新申请",Priority=28},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"实用新型\" &&  p.CaseNo.StartsWith(\"PACN\") && p.Customer.Name.Contains(\"OPPO\")",Point=1,Type="新申请",Priority=30},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"实用新型\" &&  p.CaseNo.StartsWith(\"PACN\")",Point=0.7,Type="新申请",Priority=29},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PADE\")",Point=1.9,Type="新申请",Priority=31},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"实用新型\" &&  p.CaseNo.StartsWith(\"PADE\")",Point=1.9,Type="新申请",Priority=32},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PAEPO\")",Point=0.2,Type="新申请",Priority=33},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PAGB\")",Point=1.8,Type="新申请",Priority=34},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PAUS\") && p.Customer.Name.Contains(\"OPPO\")",Point=1.7,Type="新申请",Priority=36},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PAUS\")",Point=1.8,Type="新申请",Priority=35},
+                new BasePointRule(){Rule="p.DoItem==\"新申请\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PCTCN\")",Point=1.5,Type="新申请",Priority=37},
+                new BasePointRule(){Rule="(p.ApplicationType==\"实用新型\" || p.ApplicationType==\"发明\") && p.CaseNo.StartsWith(\"PACN\") && p.AgentFeedbackMemo==\"客户不进行答辩\"",Point=0,Type="新申请",Priority=38},
+                new BasePointRule(){Rule="p.AgentFeedbackMemo==\"涉外OA不答辩,发报导函结案\"",Point=0.1,Type="OA",Priority=39},
+                new BasePointRule(){Rule="p.ApplicationType==\"外观设计\"",Point=0.2,Type="OA",Priority=40},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"实用新型\"  && p.AgentFeedbackMemo==\"不请款\"",Point=0,Type="OA",Priority=41},
+                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},
+                new BasePointRule(){Rule="p.ApplicationType==\"实用新型\"  && p.DoItemCoefficient==\"实质\" && p.CaseStage==\"二通\" && p.AgentFeedbackMemo==\"请款\"",Point=0.14,Type="OA",Priority=43},
+                new BasePointRule(){Rule="p.ApplicationType==\"实用新型\"  && p.DoItemCoefficient==\"实质\" && p.CaseStage==\"一通\" && p.AgentFeedbackMemo==\"请款\"",Point=0.35,Type="OA",Priority=44},
+                new BasePointRule(){Rule="p.DoItem==\"请求复审\" && p.ApplicationType==\"实用新型\"  && p.AgentFeedbackMemo==\"请款\"",Point=0.35,Type="OA",Priority=45},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" && p.DoItemCoefficient==\"非实质\"  && p.AgentFeedbackMemo==\"外所/他人首次转入OA\"",Point=0.3,Type="OA",Priority=46},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" && p.DoItemCoefficient==\"实质\" && p.AgentFeedbackMemo==\"外所/他人首次转入OA\"",Point=0.5,Type="OA",Priority=47},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" && p.DoItemCoefficient==\"形式\" && p.AgentFeedbackMemo==\"外所/他人首次转入OA\"",Point=0.2,Type="OA",Priority=48},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.AgentFeedbackMemo==\"客户提供答辩点,撰写英文报导函\"",Point=0.5,Type="OA",Priority=49},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.AgentFeedbackMemo==\"客户未提供答辩点,撰写英文报导函\"",Point=0.8,Type="OA",Priority=50},
+                new BasePointRule(){Rule="p.DoItem==\"Advisory Action\" && p.DoItemCoefficient==\"实质\"",Point=1.5,Type="OA",Priority=51},
+                new BasePointRule(){Rule="p.DoItem==\"Advisory Action\" && p.DoItemCoefficient==\"形式\"",Point=0.2,Type="OA",Priority=52},
+                new BasePointRule(){Rule="p.DoItem==\"Final Action\" && p.DoItemCoefficient==\"实质\"",Point=1.5,Type="OA",Priority=53},
+                new BasePointRule(){Rule="p.DoItem==\"Final Action\" && p.DoItemCoefficient==\"形式\"",Point=0.2,Type="OA",Priority=54},
+                new BasePointRule(){Rule="p.DoItem==\"form 3\"",Point=0.1,Type="OA",Priority=55},
+                new BasePointRule(){Rule="p.DoItem==\"form 3-8(2)\" ||  p.DoItem==\"Form 3-8(2)\"",Point=0.1,Type="OA",Priority=56},
+                new BasePointRule(){Rule="p.DoItem==\"Non Final Action\" && p.DoItemCoefficient==\"实质\"",Point=1.5,Type="OA",Priority=57},
+                new BasePointRule(){Rule="p.DoItem==\"Non Final Action\" && p.DoItemCoefficient==\"形式\"",Point=0.2,Type="OA",Priority=58},
+                new BasePointRule(){Rule="p.DoItem==\"RCE\" && p.DoItemCoefficient==\"实质\"",Point=1.5,Type="OA",Priority=59},
+                new BasePointRule(){Rule="p.DoItem==\"RCE\" && p.DoItemCoefficient==\"形式\"",Point=0.2,Type="OA",Priority=60},
+                new BasePointRule(){Rule="p.DoItem==\"欧洲案答辩\" && p.DoItemCoefficient==\"实质\"",Point=1.5,Type="OA",Priority=61},
+                new BasePointRule(){Rule="p.DoItem==\"欧洲案答辩\" && p.DoItemCoefficient==\"形式\"",Point=0.2,Type="OA",Priority=62},
+                new BasePointRule(){Rule="p.DoItem==\"口审评估\" && p.DoItemCoefficient==\"非实质\"",Point=0.2,Type="OA",Priority=63},
+                new BasePointRule(){Rule="p.DoItem==\"口审评估\" && p.DoItemCoefficient==\"实质\"",Point=1.5,Type="OA",Priority=64},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PAUS\")",Point=1.5,Type="OA",Priority=65},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PAUS\")",Point=0.2,Type="OA",Priority=66},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PAAU\")",Point=1.5,Type="OA",Priority=67},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PADE\")",Point=1.6,Type="OA",Priority=68},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PAEPO\")",Point=1.5,Type="OA",Priority=69},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PAGB\")",Point=1.5,Type="OA",Priority=70},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PAIN\")",Point=1.5,Type="OA",Priority=71},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PAAU\")",Point=0.2,Type="OA",Priority=72},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PADE\")",Point=0.3,Type="OA",Priority=73},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PAEPO\")",Point=0.2,Type="OA",Priority=74},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PAGB\")",Point=0.2,Type="OA",Priority=75},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PAIN\")",Point=0.2,Type="OA",Priority=76},
+                new BasePointRule(){Rule="p.DoItem==\"申復\" && p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PATW\")",Point=0.5,Type="OA",Priority=77},
+                new BasePointRule(){Rule="p.DoItem==\"申復\" && p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PATW\")",Point=0.2,Type="OA",Priority=78},
+                new BasePointRule(){Rule="p.DoItem==\"请求复审\" && p.ApplicationType==\"发明\" && p.CaseNo.StartsWith(\"PACN\")",Point=0.5,Type="OA",Priority=79},
+                new BasePointRule(){Rule="p.DoItem==\"意见陈述\" && p.ApplicationType==\"发明\" && p.CaseNo.StartsWith(\"PACN\") && p.CaseStage==\"复审\"",Point=0.2,Type="OA",Priority=80},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.DoItemCoefficient==\"非实质\" && p.CaseNo.StartsWith(\"PACN\") && p.CaseStage==\"一通\"",Point=0.3,Type="OA",Priority=81},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PACN\")  && p.CaseStage==\"一通\"",Point=0.5,Type="OA",Priority=82},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PACN\") && p.CaseStage==\"一通\"",Point=0.2,Type="OA",Priority=83},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.DoItemCoefficient==\"非实质\" && p.CaseNo.StartsWith(\"PCTCN\") && p.CaseStage==\"一通\"",Point=0.3,Type="OA",Priority=84},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.DoItemCoefficient==\"实质\" && p.CaseNo.StartsWith(\"PCTCN\")  && p.CaseStage==\"一通\"",Point=0.5,Type="OA",Priority=85},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.DoItemCoefficient==\"形式\" && p.CaseNo.StartsWith(\"PCTCN\") && p.CaseStage==\"一通\"",Point=0.2,Type="OA",Priority=86},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PACN\") && p.CaseStage==\"二通\"",Point=0.2,Type="OA",Priority=87},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" &&  p.CaseNo.StartsWith(\"PCTCN\") && p.CaseStage==\"二通\"",Point=0.2,Type="OA",Priority=88},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" && p.CaseNo.StartsWith(\"PACN\") &&  (p.CaseStage==\"三通\" || p.CaseStage==\"四通\" || p.CaseStage==\"五通\")",Point=0,Type="OA",Priority=89},
+                new BasePointRule(){Rule="p.DoItem==\"处理审查意见\" && p.ApplicationType==\"发明\" && p.CaseNo.StartsWith(\"PCTCN\") &&  (p.CaseStage==\"三通\" || p.CaseStage==\"四通\" || p.CaseStage==\"五通\")",Point=0,Type="OA",Priority=90},
+                new BasePointRule(){Rule="p.DoItem==\"发明一次OA授权\" && p.ApplicationType==\"发明\"",Point=0.2,Type="一次OA授权",Priority=91},
+                new BasePointRule(){Rule="p.DoItem==\"翻译校核\" && p.DoItemCoefficient==\"实质\" && p.AgentFeedbackMemo==\"内-外\"",Point=0.7,Type="其它",Priority=92},
+                new BasePointRule(){Rule="p.DoItem==\"翻译校核\" && p.DoItemCoefficient==\"实质\" && p.AgentFeedbackMemo==\"外-内\"",Point=0.5,Type="其它",Priority=93},
+                new BasePointRule(){Rule="p.DoItem==\"翻译校核\" && p.DoItemCoefficient==\"形式\" && p.AgentFeedbackMemo==\"内-外\"",Point=0.3,Type="其它",Priority=94},
+                new BasePointRule(){Rule="p.DoItem==\"翻译校核\" && p.DoItemCoefficient==\"形式\" && p.AgentFeedbackMemo==\"外-内\"",Point=0.2,Type="其它",Priority=95},
+                new BasePointRule(){Rule="p.AgentFeedbackMemo==\"检索结案\"",Point=0.1,Type="其它",Priority=96},
+                new BasePointRule(){Rule="p.DoItem==\"内部检索\"",Point=0,Type="其它",Priority=97},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PAAU\")",Point=0.2,Type="其它",Priority=98},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PACN\")",Point=0,Type="其它",Priority=99},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PCTCN\")",Point=0,Type="其它",Priority=100},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"WOCN\")",Point=0,Type="其它",Priority=101},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PADE\")",Point=0.2,Type="其它",Priority=102},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PAEPO\")",Point=0.2,Type="其它",Priority=103},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PAGB\")",Point=0.2,Type="其它",Priority=104},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PAIN\")",Point=0.2,Type="其它",Priority=105},
+                new BasePointRule(){Rule="p.DoItem.Contains(\"补正\")  && p.CaseNo.StartsWith(\"PAUS\")",Point=0.2,Type="其它",Priority=106},
+                new BasePointRule(){Rule="p.DoItem==\"Election Action\"",Point=0.2,Type="其它",Priority=107},
+                new BasePointRule(){Rule="p.DoItem==\"OA答辩校核\"",Point=0.2,Type="其它",Priority=108},
+                new BasePointRule(){Rule="p.DoItem==\"PPH\"",Point=0.1,Type="其它",Priority=109},
+                new BasePointRule(){Rule="p.DoItem==\"电询\"  && p.CaseNo.StartsWith(\"PACN\")",Point=0,Type="其它",Priority=110},
+                new BasePointRule(){Rule="p.DoItem==\"电询\"  && p.CaseNo.StartsWith(\"PAEPO\") ",Point=0.2,Type="其它",Priority=111},
+                new BasePointRule(){Rule="p.DoItem==\"电询\"  && p.CaseNo.StartsWith(\"PAUS\")",Point=0.2,Type="其它",Priority=112},
+                new BasePointRule(){Rule="p.DoItem==\"分案评估\"",Point=0.1,Type="其它",Priority=113},
+                new BasePointRule(){Rule="p.DoItem==\"分案评估+分案\"",Point=0.2,Type="其它",Priority=114},
+                new BasePointRule(){Rule="p.DoItem==\"绘图\"",Point=0,Type="其它",Priority=115},
+                new BasePointRule(){Rule="p.DoItem==\"技术确认\"",Point=0,Type="其它",Priority=116},
+                new BasePointRule(){Rule="p.DoItem==\"提交ids\"",Point=0.1,Type="其它",Priority=117},
+                new BasePointRule(){Rule="p.DoItem==\"询问放弃或复审\"",Point=0,Type="其它",Priority=118},
+                new BasePointRule(){Rule="p.DoItem==\"知识点总结\"",Point=0,Type="其它",Priority=119},
+                new BasePointRule(){Rule="p.DoItem==\"专利挖掘与布局\"",Point=0,Type="其它",Priority=120},
+                new BasePointRule(){Rule="p.ApplicationType==\"外观设计\"",Point=0.2,Type="其它",Priority=121},
+                new BasePointRule(){Rule="p.DoItem==\"提交ids\"",Point=0,Type="其它",Priority=122},
+                new BasePointRule(){Rule="p.DoItem==\"请求优先审查\"",Point=0,Type="其它",Priority=123}
+            };
+
+            foreach(BasePointRule rule in rules)
+            {
+                await SaveBasePointRule(rule);
+            }
+        }
         private async void button3_Click(object sender, EventArgs e)
         {
+
+            //await InitRules();
             await NewMethod();
             await InputPerformanceItem("ExcelFiles\\21.01-21.06 工程师绩效报表-总表.xlsx", true, false, 0);
 
@@ -524,6 +660,28 @@ namespace wispro.sp.winClient
             }
         }
 
+        private async Task SaveBasePointRule(BasePointRule obj)
+        {
+            HttpClient http = new HttpClient();
+            var data = await http.PostAsJsonAsync<BasePointRule>($"http://localhost:39476/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.Point}\r\n{result.ErrorMessage}");
+                }
+            }
+            else
+            {
+                System.Diagnostics.Debug.WriteLine($"调用API错误: {obj.Type}\t{obj.Rule}");
+            }
+        }
         private async Task SavePerformanceItem(PerformanceItem obj)
         {
             HttpClient http = new HttpClient();

+ 10 - 0
wospro.sp.entity/BasePointRule.cs

@@ -22,5 +22,15 @@ namespace wispro.sp.entity
         /// 基础点数
         /// </summary>
         public double Point { get; set; }
+
+        /// <summary>
+        /// 优先级
+        /// </summary>
+        public int Priority { get; set; }
+
+        /// <summary>
+        /// 绩效类型
+        /// </summary>
+        public string Type { get; set; }
     }
 }

+ 10 - 0
wospro.sp.entity/PerformanceItem.cs

@@ -174,6 +174,16 @@ namespace wispro.sp.entity
         public string CaseMemo { get; set; }
 
         /// <summary>
+        /// 按翻译字数计算设定的字数值
+        /// </summary>
+        public int? WordCount { get; set; }
+
+        /// <summary>
+        /// 绩效类型
+        /// </summary>
+        public string Type { get; set; }
+
+        /// <summary>
         /// 客户
         /// </summary>
         public virtual Customer Customer { get; set; }