浏览代码

计算工资 5.14

leiy 1 年之前
父节点
当前提交
1b83f95fed

+ 3 - 0
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -242,6 +242,9 @@ namespace OASystem.API.Controllers
             string thisYearMonth = dto.yearMonth;
             string preYearMonth = yearMonthDt.AddMonths(-1).ToString("yyyy-MM");
 
+
+            Result hoildays = await PayrollComputation.GetHoilDays(startDt, endDt);
+
             //计算本月工资起止时间 比如是2月的1号-28号,那就是2月1号的零点到3月1号的零点 
             DateTime thisStartDt = startDt;
             DateTime thisEndDt = endDt.AddDays(1); //

+ 63 - 6
OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs

@@ -72,6 +72,7 @@ namespace OASystem.API.OAMethodLib
 
             try
             {
+                
 
 
                 foreach (var pm_wsInfo in pm_WageSheetDattaSources)
@@ -406,7 +407,7 @@ namespace OASystem.API.OAMethodLib
                             List<Root> roots_words = checkInDayDataView.datas.Where(it => it.base_info.day_type == 0).ToList(); //获取工作日日报信息
                             List<Root> roots_exs = checkInDayDataView.datas.Where(it => it.exception_infos.Count > 0).ToList();
 
-
+                            int user_cd_zt_num = 0;
                             foreach (var roots_ex in roots_exs)
                             {
                                 foreach (var exception_info in roots_ex.exception_infos)
@@ -446,7 +447,7 @@ namespace OASystem.API.OAMethodLib
                                     {
                                         if (timelength < 10)
                                         {
-                                            reissueCardNum++;
+                                            user_cd_zt_num++;
                                             beLate_belate_ex.SubTypeId = 1;
                                             beLate_belate_ex.SubType = "迟到";
 
@@ -456,7 +457,7 @@ namespace OASystem.API.OAMethodLib
                                             }
                                             else
                                             {
-                                                day_deduction = 10.00M;
+                                                day_deduction = 0.00M;
                                             }
                                             beLate_deduction += day_deduction; //迟到扣款 总额
                                         }
@@ -487,16 +488,18 @@ namespace OASystem.API.OAMethodLib
                                     {
                                         if (timelength < 10)
                                         {
-                                            reissueCardNum++;
+                                            user_cd_zt_num++;
                                             beLate_belate_ex.SubTypeId = 2;
                                             beLate_belate_ex.SubType = "早退";
 
                                             if (reissueCardNum >= 3)
                                             {
                                                 day_deduction = 50.00M;
-                                                early_deduction += day_deduction;  //早退扣款 总计
                                             }
-
+                                            else {
+                                                day_deduction = 0.00M;
+                                            }
+                                            early_deduction += day_deduction;  //早退扣款 总计
                                         }
                                         else if (timelength >= 10 && timelength <= 60)
                                         {
@@ -1027,5 +1030,59 @@ namespace OASystem.API.OAMethodLib
             return num;
         }
 
+        /// <summary>
+        /// 获取时间段内节假日
+        /// </summary>
+        /// <param name="startDt"></param>
+        /// <param name="endDt"></param>
+        /// <returns></returns>
+        public static async  Task<Result> GetHoilDays(DateTime startDt,DateTime endDt) 
+        {
+            Result result = new Result();
+            
+
+            HttpClient _httpClient = new HttpClient();
+            var res = await _httpClient.GetAsync("https://timor.tech/api/holiday/year/"+ startDt.ToString("yyyy"));
+
+            if (res.IsSuccessStatusCode)
+            {
+                var stringResponse = await res.Content.ReadAsStringAsync();
+
+                HoiDaysRes obj = JsonConvert.DeserializeObject<HoiDaysRes>(stringResponse);
+
+
+                
+                if (obj.code == 0)
+                {
+                    int hoilDays = 0;
+                    while (true)
+                    {
+                        string dt = startDt.ToString("MM-dd");
+
+                        if (startDt == endDt)
+                        {
+                            continue;
+                        }
+                        startDt.AddDays(1);
+                    }
+
+                    result.Code = 0;
+                    result.Data = hoilDays;
+                }
+                int code = obj.code;
+                
+            }
+
+            return result;
+
+
+        }
+
+        public class HoiDaysRes
+        {
+            public int code { get; set; }
+
+            public object holiday { get; set; }
+        }
     }
 }

+ 0 - 1
OASystem/OASystem.Api/appsettings.json

@@ -121,5 +121,4 @@
   "GrpFileBaseUrl": "http://132.232.92.186:24/",
   "GrpFileBasePath": "C:/Server/File/OA2023/Office/GrpFile/"
 
-
 }