Pārlūkot izejas kodu

导入模块添加对外处理人处理
前台显示添加对外处理人栏位
修正添加绩效记录时,计算绩效的逻辑

luocaiyang 10 mēneši atpakaļ
vecāks
revīzija
fd9529c276

+ 168 - 153
wispro.sp.api/Controllers/PerformanceItemController.cs

@@ -153,16 +153,6 @@ namespace wispro.sp.api.Controllers
                         {
                             Context.CalMonths.Add(item.CalMonth);
 
-                            if (item.BasePoint > 0)
-                            {
-                                _calItemJX(item, Context);
-                            }
-                            else
-                            {
-                                var oldJxList = Context.StaffStatistics.Where(p => p.ItemId == item.Id);
-                                Context.StaffStatistics.RemoveRange(oldJxList);
-                            }
-
                             Context.SaveChanges();
                         }
                         else
@@ -170,6 +160,8 @@ namespace wispro.sp.api.Controllers
                             item.CalMonth = calMonth;
                         }
 
+                        
+
                         item.CalMonthId = item.CalMonth.Id;
                         item.CalMonth = null;
                     }
@@ -235,6 +227,27 @@ namespace wispro.sp.api.Controllers
                     Context.ItemStaffs.AddRange(ItemStaffs);
                     Context.SaveChanges();
 
+                    #region 计算绩效
+                    if (item.BasePoint > 0)
+                    {
+                        _calItemJX(item, Context);
+                    }
+                    else
+                    {
+                        var oldJxList = Context.StaffStatistics.Where(p => p.ItemId == item.Id);
+                        Context.StaffStatistics.RemoveRange(oldJxList);
+                    }
+                    #endregion
+
+                    Context.SaveChanges();
+
+                    #region 添加其他新申请的绩效分配(默认是对外处理人与处理人50:50)
+                    if(item.Type == "其他新申请")
+                    {
+                        //Context.AllocationRatios.Add();
+                    }
+                    #endregion
+
                     Context.Database.CommitTransaction();
                 }
                 catch (Exception ex)
@@ -370,25 +383,14 @@ namespace wispro.sp.api.Controllers
                 .Include(pi => pi.Reviewer)
                 .Include(pi => pi.Customer)
                 .Include(pi => pi.CalMonth)
+                .Include(pi => pi.ExternalHandler)
                 .OrderByDescending(o => o.Id)
                 .Skip<PerformanceItem>((pageIndex - 1) * pageSize).Take(pageSize).ToList<PerformanceItem>();
 
             #region 将某些属性设为null,避免循环取值造成返回json过大
             foreach (PerformanceItem item in retList)
             {
-                foreach (ItemStaff itemStaff in item.ItemStaffs)
-                {
-                    itemStaff.DoPerson.ItemStaffs = null;
-                    itemStaff.DoPerson.ReviewerItems = null;
-                    itemStaff.Item = null;
-                }
-
-                item.Reviewer.ReviewerItems = null;
-                item.Reviewer.Customers = null;
-                item.Reviewer.ItemStaffs = null;
-
-                item.Customer.PerformanceItems = null;
-                item.CalMonth.PerformanceItems = null;
+                SetReturnItem(item);
             }
             #endregion
 
@@ -408,26 +410,12 @@ namespace wispro.sp.api.Controllers
                 .Include(pi => pi.Reviewer)
                 .Include(pi => pi.Customer)
                 .Include(pi => pi.CalMonth)
+                .Include (pi => pi.ExternalHandler)
                 .OrderByDescending(o => o.Id)
                 .FirstOrDefault();
 
             #region 将某些属性设为null,避免循环取值造成返回json过大
-            foreach (ItemStaff itemStaff in item.ItemStaffs)
-            {
-                itemStaff.DoPerson.ItemStaffs = null;
-                itemStaff.DoPerson.ReviewerItems = null;
-                itemStaff.Item = null;
-            }
-
-            if (item.Reviewer != null)
-            {
-                item.Reviewer.ReviewerItems = null;
-                item.Reviewer.Customers = null;
-                item.Reviewer.ItemStaffs = null;
-            }
-
-            item.Customer.PerformanceItems = null;
-            item.CalMonth.PerformanceItems = null;
+            SetReturnItem(item);
             #endregion
 
             return item;
@@ -456,6 +444,7 @@ namespace wispro.sp.api.Controllers
                 .Include(pi => pi.Reviewer)
                 .Include(pi => pi.Customer)
                 .Include(pi => pi.CalMonth)
+                .Include(pi => pi.ExternalHandler)
                 .OrderByDescending(o => o.Id)
                 .Skip<PerformanceItem>((pageIndex - 1) * pageSize).Take(pageSize)
                 .ToList<PerformanceItem>();
@@ -463,19 +452,7 @@ namespace wispro.sp.api.Controllers
             #region 将某些属性设为null,避免循环取值造成返回json过大
             foreach (PerformanceItem item in retList)
             {
-                foreach (ItemStaff itemStaff in item.ItemStaffs)
-                {
-                    itemStaff.DoPerson.ItemStaffs = null;
-                    itemStaff.DoPerson.ReviewerItems = null;
-                    itemStaff.Item = null;
-                }
-
-                item.Reviewer.ReviewerItems = null;
-                item.Reviewer.Customers = null;
-                item.Reviewer.ItemStaffs = null;
-
-                item.Customer.PerformanceItems = null;
-                item.CalMonth.PerformanceItems = null;
+                SetReturnItem(item);
             }
             #endregion
 
@@ -2739,6 +2716,7 @@ namespace wispro.sp.api.Controllers
             dt.Columns.Add("处理人", typeof(string));
             dt.Columns.Add("处理人部门", typeof(string));
             dt.Columns.Add("核稿人", typeof(string));
+            dt.Columns.Add("对外处理人", typeof(string));
             dt.Columns.Add("客户名称", typeof(string));
             dt.Columns.Add("申请人", typeof(string));
             dt.Columns.Add("处理事项完成日", typeof(string));
@@ -2825,6 +2803,8 @@ namespace wispro.sp.api.Controllers
                         }
                     }
 
+                    row["对外处理人"] = item.ExternalHandler?.Name;
+
                     row["客户名称"] = item.Customer?.Name;
                     row["申请人"] = item.ApplicationName;
                     row["处理事项完成日"] = item.FinishedDate?.ToString("yyyy-MM-dd");
@@ -2874,6 +2854,7 @@ namespace wispro.sp.api.Controllers
                     .Include(pi => pi.Reviewer)
                     .Include(pi => pi.Customer)
                     .Include(pi => pi.CalMonth)
+                    .Include(pi => pi.ExternalHandler)
                     .OrderConditions<PerformanceItem>(queryFilter.Sorts);
                     //.Pager<PerformanceItem>(1, queryFilter.PageSize, out totals);
             }
@@ -2884,6 +2865,7 @@ namespace wispro.sp.api.Controllers
                     .Include(pi => pi.Reviewer)
                     .Include(pi => pi.Customer)
                     .Include(pi => pi.CalMonth)
+                    .Include(pi => pi.ExternalHandler)
                     .OrderConditions<PerformanceItem>(queryFilter.Sorts);
                     //.Pager<PerformanceItem>(queryFilter.PageIndex, queryFilter.PageSize, out totals);
             }
@@ -2897,47 +2879,76 @@ namespace wispro.sp.api.Controllers
             #region 将某些属性设为null,避免循环取值造成返回json过大
             foreach (PerformanceItem item in retList)
             {
+                SetReturnItem(item);
+            }
+            #endregion
 
-                foreach (ItemStaff itemStaff in item.ItemStaffs)
-                {
-                    itemStaff.DoPerson.ItemStaffs = null;
-                    itemStaff.DoPerson.ReviewerItems = null;
-                    itemStaff.DoPerson.Customers = null;
-                    itemStaff.Item = null;
-                }
+            ret.Results = retList.ToList();
 
-                if (item.Reviewer != null)
-                {
-                    item.Reviewer.ReviewerItems = null;
-                    item.Reviewer.Customers = null;
-                    item.Reviewer.ItemStaffs = null;
-                }
+            //string str= System.Text.Json.JsonSerializer.Serialize(ret);
 
-                if (item.WorkflowUser != null)
-                {
-                    item.WorkflowUser.ReviewerItems = null;
-                    item.WorkflowUser.Customers = null;
-                    item.WorkflowUser.ItemStaffs = null;
-                }
+            return ret;
+        }
 
-                if (item.Customer != null)
-                {
-                    item.Customer.PerformanceItems = null;
-                    item.Customer.ResponseMan = null;
-                }
+        private static void SetReturnItem(PerformanceItem item)
+        {
+            foreach (ItemStaff itemStaff in item.ItemStaffs)
+            {
+                itemStaff.DoPerson.ItemStaffs = null;
+                itemStaff.DoPerson.ReviewerItems = null;
+                itemStaff.DoPerson.Customers = null;
+                itemStaff.DoPerson.AllocationRatios = null;
+                itemStaff.DoPerson.ExternalHandlerItems = null;
+                itemStaff.Item = null;
+            }
+
+            if (item.Reviewer != null)
+            {
+                item.Reviewer.ReviewerItems = null;
+                item.Reviewer.Customers = null;
+                item.Reviewer.ItemStaffs = null;
+                item.Reviewer.AllocationRatios = null;
+                item.Reviewer.ExternalHandlerItems = null;
 
-                if (item.CalMonth != null)
-                {
-                    item.CalMonth.PerformanceItems = null;
-                }
             }
-            #endregion
 
-            ret.Results = retList.ToList();
+            if (item.ExternalHandler != null)
+            {
+                item.ExternalHandler.ReviewerItems = null;
+                item.ExternalHandler.Customers = null;
+                item.ExternalHandler.ItemStaffs = null;
+                item.ExternalHandler.AllocationRatios = null;
+                item.ExternalHandler.ExternalHandlerItems = null;
+            }
 
-            //string str= System.Text.Json.JsonSerializer.Serialize(ret);
+            if (item.PreOastaff != null)
+            {
+                item.PreOastaff.ReviewerItems = null;
+                item.PreOastaff.Customers = null;
+                item.PreOastaff.ItemStaffs = null;
+                item.PreOastaff.AllocationRatios = null;
+                item.PreOastaff.ExternalHandlerItems = null;
+            }
 
-            return ret;
+            if (item.WorkflowUser != null)
+            {
+                item.WorkflowUser.ReviewerItems = null;
+                item.WorkflowUser.Customers = null;
+                item.WorkflowUser.ItemStaffs = null;
+                item.WorkflowUser.AllocationRatios = null;
+                item.WorkflowUser.ExternalHandlerItems = null;
+            }
+
+            if (item.Customer != null)
+            {
+                item.Customer.PerformanceItems = null;
+                item.Customer.ResponseMan = null;
+            }
+
+            if (item.CalMonth != null)
+            {
+                item.CalMonth.PerformanceItems = null;
+            }
         }
 
         private IQueryable<PerformanceItem> NewMethod(QueryFilter queryFilter)
@@ -3531,13 +3542,20 @@ namespace wispro.sp.api.Controllers
             var newList = spDb.PerformanceItems.Include(p => p.ItemStaffs).ThenInclude(p=>p.DoPerson)
                 .Include(p=>p.CalMonth)
                 .Where(p=>p.CalMonthId == calMonthId && p.BasePoint >0
-                    && (p.Type =="新申请" || p.Type =="专案" || (p.Type == "其它" && p.WordCount >0 && (p.DoItem =="新申请" || p.DoItem == "翻译")))
+                    && (p.Type =="新申请" || p.Type == "其他新申请" || p.Type =="专案" || (p.Type == "其它" && p.WordCount >0 && (p.DoItem =="新申请" || p.DoItem == "翻译")))
                 ).ToList();
 
             foreach(var p in newList)
             {
                 #region 严重延期降系数  
                 string strCaseCeoffcient = p.CaseCoefficient;
+
+                if(p.Type == "其他新申请")
+                {
+                    //宁德时代的案件按照B统计
+                    strCaseCeoffcient = "B";
+                }
+
                 if (string.IsNullOrEmpty(strCaseCeoffcient))
                 {
                     strCaseCeoffcient = "B";
@@ -3589,79 +3607,76 @@ namespace wispro.sp.api.Controllers
 
                 if(doPersons >0)
                 {
-                    //System.Diagnostics.Debug.WriteLine("");                
-                
-
-                foreach(var h in doList)
-                {
-                    var temObj = retlist.FirstOrDefault(s=>s.StaffId == h.StaffId && s.Type == "新申请" && s.isReview == false);
-                    if(temObj == null)
+                    foreach(var h in doList)
                     {
-                        temObj = new StaffStatisticsforLevel();
-                        temObj.StaffId = h.StaffId;
+                        var temObj = retlist.FirstOrDefault(s=>s.StaffId == h.StaffId && s.Type == "新申请" && s.isReview == false);
+                        if(temObj == null)
+                        {
+                            temObj = new StaffStatisticsforLevel();
+                            temObj.StaffId = h.StaffId;
                         
-                        temObj.GradeId = h.Staff.StaffGradeId.Value ;
+                            temObj.GradeId = h.Staff.StaffGradeId.Value ;
 
-                        temObj.CalMonthId = p.CalMonthId;
-                        temObj.Type = "新申请";
-                        retlist.Add(temObj);
-                    }
+                            temObj.CalMonthId = p.CalMonthId;
+                            temObj.Type = "新申请";
+                            retlist.Add(temObj);
+                        }
 
-                    switch (strCaseCeoffcient)
-                    {
-                        case "S":
-                            if(p.Type == "专案")
-                            {
-                                temObj.S += h.totalBasePoint.Value;
-                            }
-                            else
-                            {
-                                temObj.S+=(double)(1.0M/ (decimal)doPersons);
-                            }
-                            break;
-                        case "A":
-                            if (p.Type == "专案")
-                            {
-                                temObj.A += h.totalBasePoint.Value;
-                            }
-                            else
-                            {
-                                temObj.A += (double)(1.0M / (decimal)doPersons);
-                            }
-                            break;
-                        case "B":
-                            if (p.Type == "专案")
-                            {
-                                temObj.B += h.totalBasePoint.Value;
-                            }
-                            else
-                            {
-                                temObj.B += (double)(1.0M / (decimal)doPersons);
-                            }
-                            break;
-                        case "C":
-                            if (p.Type == "专案")
-                            {
-                                temObj.C += h.totalBasePoint.Value;
-                            }
-                            else
-                            {
-                                temObj.C += (double)(1.0M / (decimal)doPersons);
-                            }
-                            break;
-                        case "D":
-                            if (p.Type == "专案")
-                            {
-                                temObj.D += h.totalBasePoint.Value;
-                            }
-                            else
-                            {
-                                temObj.D += (double)(1.0M / (decimal)doPersons);
-                            }
-                            break;
-                    }
+                        switch (strCaseCeoffcient)
+                        {
+                            case "S":
+                                if(p.Type == "专案")
+                                {
+                                    temObj.S += h.totalBasePoint.Value;
+                                }
+                                else
+                                {
+                                    temObj.S+=(double)(1.0M/ (decimal)doPersons);
+                                }
+                                break;
+                            case "A":
+                                if (p.Type == "专案")
+                                {
+                                    temObj.A += h.totalBasePoint.Value;
+                                }
+                                else
+                                {
+                                    temObj.A += (double)(1.0M / (decimal)doPersons);
+                                }
+                                break;
+                            case "B":
+                                if (p.Type == "专案")
+                                {
+                                    temObj.B += h.totalBasePoint.Value;
+                                }
+                                else
+                                {
+                                    temObj.B += (double)(1.0M / (decimal)doPersons);
+                                }
+                                break;
+                            case "C":
+                                if (p.Type == "专案")
+                                {
+                                    temObj.C += h.totalBasePoint.Value;
+                                }
+                                else
+                                {
+                                    temObj.C += (double)(1.0M / (decimal)doPersons);
+                                }
+                                break;
+                            case "D":
+                                if (p.Type == "专案")
+                                {
+                                    temObj.D += h.totalBasePoint.Value;
+                                }
+                                else
+                                {
+                                    temObj.D += (double)(1.0M / (decimal)doPersons);
+                                }
+                                break;
+                        }
                     
-                }
+                    }
                 }
                 #endregion
 

+ 1 - 1
wispro.sp.api/Job/ImportReportJob.cs

@@ -714,7 +714,7 @@ namespace wispro.sp.api.Job
                 //item.ReviewerId = GetStaff(row["案件核稿人"].ToString().Trim());
 
                 var strWordCount = row["翻译字数"].ToString().Trim();
-                if (string.IsNullOrEmpty(strWordCount))
+                if (!string.IsNullOrEmpty(strWordCount))
                 {
                     try
                     {

+ 8 - 0
wispro.sp.api/Utility/Utility.cs

@@ -25,12 +25,19 @@ namespace wispro.sp.api.Utility
                 return o;
             });
 
+            if (item.Customer.Name.Contains("宁德") && item.DoItem == "新申请")
+            {
+                Console.WriteLine("");
+            }
+
             foreach (BasePointRule rule in rules)
             {
                 var options = InterpreterOptions.Default | InterpreterOptions.LambdaExpressions;
                 var interpreter = new Interpreter(options)
                     .Reference(typeof(System.Linq.Enumerable));
 
+                
+
                 try
                 {
                     
@@ -40,6 +47,7 @@ namespace wispro.sp.api.Utility
 
                     if (result)
                     {
+                        
                         var temString = rule.PointExpress;
 
                         if (!rule.PointExpress.Contains("."))

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

@@ -30,7 +30,7 @@
     "isHeadless": "false",
     "Account": "caiyangl",
     "Password": "j)wx*lier*@3",
-    "ChormeDriverPath": "d:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\130.0.6723.69",
+    "ChormeDriverPath": "D:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\130.0.6723.69",
     "ScheduleSetting": "00 55 15 16 * ? *",
     "IPEasyWeb": "http://47.106.94.35/Login.aspx"
   },

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

@@ -433,6 +433,7 @@ namespace wispro.sp.api
                 entity.ToTable("AllocationRatio");
 
                 entity.Property(e => e.Ratio);//.HasColumnType("numeric(18, 2)");
+                entity.Property(e => e.ActualAmount);
 
                 entity.HasOne(d => d.Person)
                     .WithMany(p => p.AllocationRatios)

+ 1 - 0
wispro.sp.web/Pages/AppCase/CaseManager.razor

@@ -186,6 +186,7 @@ RenderFragment gdIcon =
                                     }
                                 }
                             </AntDesign.Column>
+                            <AntDesign.Column Title="对外处理人" TData="string" Width="100">@(context.ExternalHandler == null ? "" : context.ExternalHandler.Name)</AntDesign.Column>
                             <AntDesign.Column Title="核稿人" TData="string" Width="100">@(context.Reviewer == null ? "" : context.Reviewer.Name)</AntDesign.Column>
                             <ActionColumn>
                                 <Button Icon="refresh" @onclick="()=>OnRefresh(context)">刷新</Button>

+ 2 - 0
wispro.sp.web/Pages/AppCase/MyCaselist.razor

@@ -158,6 +158,8 @@
                                     }
                                 }
                             </AntDesign.Column>
+                            <AntDesign.Column Title="对外处理人" TData="string" Width="100">@(context.Reviewer == null ? "" : context.ExternalHandler.Name)</AntDesign.Column>
+
                             <AntDesign.Column Title="核稿人" TData="string" Width="100">@(context.Reviewer == null ? "" : context.Reviewer.Name)</AntDesign.Column>
 
                             @if (ShowMenu())

+ 1 - 1
wispro.sp.winClient/Form1.cs

@@ -915,7 +915,7 @@ namespace wispro.sp.winClient
             return retStr;
         }
 
-        string strAPIBaseUri = "http://1.116.113.26:81";//"http://localhost:39476"; //    "http://47.106.221.167:8081"; //  
+        string strAPIBaseUri = "http://localhost:39476"; // "http://1.116.113.26:81";//   "http://47.106.221.167:8081"; //  
 
         userToken Token;
 

+ 3 - 0
wispro.sp.winClient/frmCaseFileCompare.cs

@@ -372,6 +372,9 @@ namespace wispro.sp.winClient
 
         private void button2_Click(object sender, EventArgs e)
         {
+            
+            new Form1().ShowDialog();
+            return;
             var caseInfo = IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件",true);
             return;
             var retData = IPEasyUtility.GetFinished3FilesCases(1);

+ 5 - 0
wospro.sp.entity/AllocationRatio.cs

@@ -23,6 +23,11 @@ namespace wispro.sp.entity
         public double? Ratio { get; set; }
 
         /// <summary>
+        /// 实际金额
+        /// </summary>
+        public double? ActualAmount { get; set; }
+
+        /// <summary>
         /// 绩效分配参与人
         /// </summary>
         [Description("绩效分配参与人")]