luocaiyang 3 gadi atpakaļ
vecāks
revīzija
13fa0c1d3c

+ 49 - 11
wispro.sp.api/Controllers/PerformanceItemController.cs

@@ -463,22 +463,65 @@ namespace wispro.sp.api.Controllers
                     switch (strCaseCeoffcient)
                     {
                         case "S":
-                            retObj.S += 1;
+                            if(item.Type == "专案")
+                            {
+                                retObj.S += item.BasePoint.Value;
+                            }
+                            else
+                            {
+                                retObj.S += 1;
+                            }
+                            
                             break;
                         case "A":
-                            retObj.A += 1;
+                            if (item.Type == "专案")
+                            {
+                                retObj.A += item.BasePoint.Value;
+                            }
+                            else
+                            {
+                                retObj.A += 1;
+                            }
                             break;
                         case "B":
-                            retObj.B += 1;
+                            if (item.Type == "专案")
+                            {
+                                retObj.B += item.BasePoint.Value;
+                            }
+                            else
+                            {
+                                retObj.B += 1;
+                            }
                             break;
                         case "C":
-                            retObj.C += 1;
+                            if (item.Type == "专案")
+                            {
+                                retObj.C += item.BasePoint.Value;
+                            }
+                            else
+                            {
+                                retObj.C += 1;
+                            }
                             break;
                         case "D":
-                            retObj.D += 1;
+                            if (item.Type == "专案")
+                            {
+                                retObj.D += item.BasePoint.Value;
+                            }
+                            else
+                            {
+                                retObj.D += 1;
+                            }
                             break;
                         default:
-                            retObj.B += 1;
+                            if (item.Type == "专案")
+                            {
+                                retObj.B += item.BasePoint.Value;
+                            }
+                            else
+                            {
+                                retObj.B += 1;
+                            }
                             break;
 
                     }
@@ -521,8 +564,6 @@ namespace wispro.sp.api.Controllers
 
         private List<StaffStatistics> _CalMyStatistics(CalMonth calMonth, int? userid = null)
         {
-            
-
             //未归档,从绩效记录中统计数据
             var results = Context.PerformanceItems.Where<PerformanceItem>(s => s.CalMonth.Id == calMonth.Id);
 
@@ -598,9 +639,6 @@ namespace wispro.sp.api.Controllers
                 retList = retList.Where<StaffStatistics>(s => s.StaffId == userid.Value).ToList();
             }
 
-           
-
-
             return retList;
 
         }

+ 12 - 8
wispro.sp.api/Job/ImportReportJob.cs

@@ -316,10 +316,10 @@ namespace wispro.sp.api.Job
                 {
                     if (!InValidDoItem.Contains(item.DoItem))
                     {
-                        foreach(var temObj in item.ItemStaffs)
-                        {
-                            temObj.DoPerson.Name = temObj.DoPerson.Name.Replace("-君龙", "");
-                        }
+                        //foreach(var temObj in item.ItemStaffs)
+                        //{
+                        //    temObj.DoPerson.Name = temObj.DoPerson.Name.Replace("-君龙", "");
+                        //}
 
                         SavePerformanceItem(item, rules);
                         
@@ -929,11 +929,15 @@ namespace wispro.sp.api.Job
 
         private int? GetStaff(string v)
         {
-            var staff = spDb.Staffs.Where<Staff>(s => s.Name == v).FirstOrDefault();
-
-            if(staff != null)
+            if (!string.IsNullOrEmpty(v))
             {
-                return staff.Id;
+                string temName = v.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)[0];
+                var staff = spDb.Staffs.Where<Staff>(s => s.Name == temName).FirstOrDefault();
+
+                if (staff != null)
+                {
+                    return staff.Id;
+                }
             }
 
             return null;

+ 4 - 1
wispro.sp.api/Job/InvalidDataMessageJob.cs

@@ -21,13 +21,15 @@ namespace wispro.sp.api.Job
                 .Include(p => p.Reviewer)
                 .Include(p => p.CalMonth)
                 .Include(p => p.Customer)
+                .Include(p => p.WorkflowUser)
                 .ToList<PerformanceItem>();
 
             if (lstItem.Count > 0)
             {
                 DataTable dt = new DataTable();
                 dt.Columns.Add("我方文号");
-
+                dt.Columns.Add("业务人员");
+                dt.Columns.Add("申请国家");
                 dt.Columns.Add("专利类型");
                 dt.Columns.Add("处理事项");
                 dt.Columns.Add("案件阶段");
@@ -53,6 +55,7 @@ namespace wispro.sp.api.Job
                     row["基础点数"] = p.BasePoint;
                     row["绩效类型"] = p.Type;
                     row["备注"] = p.CaseMemo;
+                    row["申请国家"] = p.Country;
 
                     if (p.WorkflowUser != null)
                     {

+ 29 - 30
wispro.sp.api/Job/UpdateJXDataFromIPEasyJob.cs

@@ -24,6 +24,7 @@ namespace wispro.sp.api.Job
                 Item.DoItemCoefficient = retObj.DoItemCoefficient;
             }
 
+
             //if (keyValuePairs.ContainsKey("DoItemMemo") && Item.DoItemMemo != retObj.DoItemMemo && !string.IsNullOrEmpty(retObj.DoItemMemo))
             //{
             //    Item.DoItemMemo = retObj.DoItemMemo;
@@ -123,41 +124,39 @@ namespace wispro.sp.api.Job
             }
 
 
-            //if (keyValuePairs.ContainsKey("Reviewer") && (Item.Reviewer == null || Item.Reviewer.Name != retObj.Reviewer) && !string.IsNullOrEmpty(retObj.Reviewer))
-            //{
-            //    string name = retObj.Reviewer;
+            if (keyValuePairs.ContainsKey("Reviewer") && (Item.Reviewer == null || Item.Reviewer.Name != retObj.Reviewer) && !string.IsNullOrEmpty(retObj.Reviewer))
+            {
+                string name = retObj.Reviewer;
 
-            //    if (!string.IsNullOrEmpty(name))
-            //    {
-            //        var temReviewer = spDb.Staffs.Where<Staff>(s => s.Name == name).FirstOrDefault();
-            //        if (temReviewer == null)
-            //        {
-            //            //Item.Reviewer = new Staff() { Name = retObj.Reviewer };
-            //        }
-            //        else
-            //        {
-            //            //Item.Reviewer = temReviewer;
-            //            Item.ReviewerId = temReviewer.Id;
-            //        }
-            //    }
-            //}
+                if (!string.IsNullOrEmpty(name))
+                {
+                    string temName = name.Split('-')[0].Trim();
+                    var temReviewer = spDb.Staffs.Where<Staff>(s => s.Name == name).FirstOrDefault();
+                    if (temReviewer == null)
+                    {
+                        //Item.Reviewer = new Staff() { Name = retObj.Reviewer };
+                    }
+                    else
+                    {
+                        //Item.Reviewer = temReviewer;
+                        Item.ReviewerId = temReviewer.Id;
+                    }
+                }
+            }
 
-            //if (keyValuePairs.ContainsKey("ApplicationType") && Item.ApplicationType != retObj.ApplicationType && !string.IsNullOrEmpty(retObj.ApplicationType))
-            //{
-            //    Item.ApplicationType = retObj.ApplicationType;
-            //}
+            if (keyValuePairs.ContainsKey("ApplicationType") && Item.ApplicationType != retObj.ApplicationType && !string.IsNullOrEmpty(retObj.ApplicationType))
+            {
+                Item.ApplicationType = retObj.ApplicationType;
+            }
 
             //if (keyValuePairs.ContainsKey("BusinessType") && Item.BusinessType != retObj.BusinessType && !string.IsNullOrEmpty(retObj.BusinessType))
             //{
             //    Item.BusinessType = retObj.BusinessType;
             //}
 
-            if (keyValuePairs.ContainsKey("CaseCoefficient") && Item.CaseCoefficient != retObj.CaseCoefficient && !string.IsNullOrEmpty(retObj.CaseCoefficient))
+            if (keyValuePairs.ContainsKey("CaseCoefficient") && Item.CaseCoefficient != retObj.CaseCoefficient)
             {
-                if (string.IsNullOrEmpty(Item.CaseCoefficient) &&  !string.IsNullOrEmpty(retObj.CaseCoefficient))
-                {
-                    Item.CaseCoefficient = retObj.CaseCoefficient;
-                }
+                Item.CaseCoefficient = retObj.CaseCoefficient;
             }
 
             //if (keyValuePairs.ContainsKey("CaseMemo") && Item.CaseMemo != retObj.CaseMemo && !string.IsNullOrEmpty(retObj.CaseMemo))
@@ -175,10 +174,10 @@ namespace wispro.sp.api.Job
             //    Item.CaseState = retObj.CaseState;
             //}
 
-            //if (keyValuePairs.ContainsKey("CaseType") && Item.CaseType != retObj.CaseType && !string.IsNullOrEmpty(retObj.CaseType))
-            //{
-            //    Item.CaseType = retObj.CaseType;
-            //}
+            if (keyValuePairs.ContainsKey("CaseType") && Item.CaseType != retObj.CaseType && !string.IsNullOrEmpty(retObj.CaseType))
+            {
+                Item.CaseType = retObj.CaseType;
+            }
 
             if (spDb.Entry(Item).State != EntityState.Unchanged)
             {

+ 3 - 3
wispro.sp.api/appsettings.json

@@ -11,8 +11,8 @@
     "DefaultConnect": "Data Source=(local);Initial Catalog=spDB;User ID=sa;Password=Lqftiu807005"
   },
 
-  "UpdateScheduleSetting": "00 01 09 1-8 * ? *",
-  "InvalidDataScheduleSetting": "00 10 15 1-6 * ? *",
+  "UpdateScheduleSetting": "00 10 13 1-8 * ? *",
+  "InvalidDataScheduleSetting": "00 14 09 1-6 * ? *",
   "AgentMessageScheduleSetting": "00 10 06 7 * ? *",
 
   "ValidAudience": "StaffPerformance",
@@ -30,7 +30,7 @@
     "Account": "caiyangl",
     "Password": "j)wx*lier*@3",
     "ChormeDriverPath": "D:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\97.0.4692.71",
-    "ScheduleSetting": "00 22 15 * * ? *",
+    "ScheduleSetting": "00 36 08 1 * ? *",
     "IPEasyWeb": "http://47.106.221.167/Login.aspx"
   },
 

+ 6 - 0
wispro.sp.api/spDbContext.cs

@@ -391,6 +391,12 @@ namespace wispro.sp.api
                 entity.HasOne(d => d.Staff)
                     .WithMany()
                     .HasForeignKey(d => d.StaffId);
+
+                entity.HasOne(d => d.Item)
+                    .WithMany()
+                    .HasForeignKey(d => d.ItemId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("FK_StaffStatistics_PerformanceItem");
             });
 
             modelBuilder.Entity<Message>(entity =>

+ 5 - 5
wispro.sp.share/NanduStatics.cs

@@ -9,10 +9,10 @@ namespace wispro.sp.share
     public class NanduStatics
     {
         public double NanduXS { get; set; }
-        public int S { get; set; }
-        public int A { get; set; }
-        public int B { get; set; }
-        public int C { get; set; }
-        public int D { get; set; }
+        public double S { get; set; }
+        public double A { get; set; }
+        public double B { get; set; }
+        public double C { get; set; }
+        public double D { get; set; }
     }
 }

+ 3 - 2
wispro.sp.winClient/Form1.cs

@@ -188,9 +188,10 @@ namespace wispro.sp.winClient
        
         private async void button3_Click(object sender, EventArgs e)
         {
-            await UpdateStaff();
+            await RefreshPerformanceItem(0);
+            //await UpdateStaff();
 
-            await InitDepartment();
+            //await InitDepartment();
            //await GetTest();
             //await Compare2DB();
             //await RefreshPerformanceItem(1);

+ 6 - 5
wospro.sp.entity/CalMonth.cs

@@ -34,13 +34,14 @@ namespace wispro.sp.entity
 
         public double? NanduXS { get; set; }
 
-        public int? S { get; set; }
-        public int? A { get; set; }
+        public double? S { get; set; }
+        public double? A { get; set; }
 
-        public int? B { get; set; }
+        public double? B { get; set; }
 
-        public int? C { get; set; }
-        public int? D { get; set; }
+        public double? C { get; set; }
+
+        public double? D { get; set; }
 
         public virtual List<PerformanceItem> PerformanceItems { get; set; }
     }

+ 9 - 5
wospro.sp.entity/StaffStatistics.cs

@@ -55,12 +55,16 @@ namespace wispro.sp.entity
 
         public double? NanduXS { get; set; }
 
-        public int? S { get; set; }
-        public int? A { get; set; }
+        public double? S { get; set; }
+        public double? A { get; set; }
 
-        public int? B { get; set; }
+        public double? B { get; set; }
 
-        public int? C { get; set; }
-        public int? D { get; set; }
+        public double? C { get; set; }
+        public double? D { get; set; }
+
+        public virtual PerformanceItem Item { get; set; }
+
+        public int? ItemId { get; set; }
     }
 }