|
@@ -1,5 +1,6 @@
|
|
using Google.Protobuf.WellKnownTypes;
|
|
using Google.Protobuf.WellKnownTypes;
|
|
using NPOI.HPSF;
|
|
using NPOI.HPSF;
|
|
|
|
+using NPOI.OpenXmlFormats.Dml.Diagram;
|
|
using NPOI.OpenXmlFormats.Spreadsheet;
|
|
using NPOI.OpenXmlFormats.Spreadsheet;
|
|
using NPOI.SS.Formula.Functions;
|
|
using NPOI.SS.Formula.Functions;
|
|
using NPOI.Util;
|
|
using NPOI.Util;
|
|
@@ -12,6 +13,7 @@ using OASystem.Infrastructure.Repositories.Groups;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.Eventing.Reader;
|
|
using System.Diagnostics.Eventing.Reader;
|
|
|
|
+using System.Drawing;
|
|
using System.Linq.Expressions;
|
|
using System.Linq.Expressions;
|
|
using TencentCloud.Ocr.V20181119.Models;
|
|
using TencentCloud.Ocr.V20181119.Models;
|
|
|
|
|
|
@@ -75,8 +77,26 @@ namespace OASystem.API.OAMethodLib
|
|
_result.Msg = "【企业微信】【打卡】【获取时间段内所有日打卡】【Msg】" + checkInDayDataView.errmsg;
|
|
_result.Msg = "【企业微信】【打卡】【获取时间段内所有日打卡】【Msg】" + checkInDayDataView.errmsg;
|
|
return _result;
|
|
return _result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ CheckInDataView checkInDataView = new CheckInDataView();
|
|
|
|
+ checkInDataView = await _qiYeWeChatApiService.GetCheckinDataAsync(qyWhchatIdList, 3,startDt, endDt);
|
|
|
|
+ if (checkInDataView.errcode != 0)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg = "【企业微信】【打卡】【获取时间段内所有日打卡记录】【Msg】" + checkInDataView.errmsg;
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<Sys_Calendar> sys_Calendars = new List<Sys_Calendar>();
|
|
|
|
+ string sys_sql = string.Format("Select * From Sys_Calendar Where Isdel = 0 And Dt between '{0}' And '{1}'",
|
|
|
|
+ startDt.ToString("yyyy-MM-dd"), endDt.ToString("yyyy-MM-dd"));
|
|
|
|
+ sys_Calendars = await _usersRep._sqlSugar.SqlQueryable<Sys_Calendar>(sys_sql).ToListAsync();
|
|
|
|
+
|
|
|
|
|
|
- List<Root> workday_userRoots = checkInDayDataView.datas.Where(it => it.base_info.day_type == 0 && it.base_info.record_type == 1).ToList();
|
|
+ List<Root> workday_userRoots = checkInDayDataView.datas.Where(it => it.base_info.day_type == 0 && it.base_info.record_type == 1).ToList();
|
|
|
|
+
|
|
|
|
+
|
|
workday_userRoots = workday_userRoots.OrderBy(it => it.base_info.date).ToList();
|
|
workday_userRoots = workday_userRoots.OrderBy(it => it.base_info.date).ToList();
|
|
|
|
|
|
|
|
|
|
@@ -93,7 +113,7 @@ namespace OASystem.API.OAMethodLib
|
|
foreach (var pm_wsInfo in pm_WageSheetDattaSources)
|
|
foreach (var pm_wsInfo in pm_WageSheetDattaSources)
|
|
{
|
|
{
|
|
string itemName = userNames.Where(it => it.Id == pm_wsInfo.UserId).FirstOrDefault().CnName;
|
|
string itemName = userNames.Where(it => it.Id == pm_wsInfo.UserId).FirstOrDefault().CnName;
|
|
-
|
|
+
|
|
|
|
|
|
|
|
|
|
decimal meal_subsidy = 0.00M;
|
|
decimal meal_subsidy = 0.00M;
|
|
@@ -135,6 +155,7 @@ namespace OASystem.API.OAMethodLib
|
|
List<Ex_Items> ex_Items = new List<Ex_Items>();
|
|
List<Ex_Items> ex_Items = new List<Ex_Items>();
|
|
Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" };
|
|
Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" };
|
|
Ex_Items ex_Items_jq = new Ex_Items() { Type = "假勤" };
|
|
Ex_Items ex_Items_jq = new Ex_Items() { Type = "假勤" };
|
|
|
|
+ Ex_Items ex_Items_cc = new Ex_Items() { Type = "出差" };
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
@@ -152,7 +173,6 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
userRoots = userRoots.OrderBy(it => it.base_info.date).ToList();
|
|
userRoots = userRoots.OrderBy(it => it.base_info.date).ToList();
|
|
|
|
|
|
-
|
|
|
|
int dk_work_days = userRoots.Count;
|
|
int dk_work_days = userRoots.Count;
|
|
|
|
|
|
if (dk_work_days > work_days)
|
|
if (dk_work_days > work_days)
|
|
@@ -176,12 +196,23 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
int user_probationary_bk_num = 0;
|
|
int user_probationary_bk_num = 0;
|
|
|
|
|
|
-
|
|
|
|
decimal user_probationary_bk_decimal = pm_wsInfo.Floats;
|
|
decimal user_probationary_bk_decimal = pm_wsInfo.Floats;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ List<CheckInDataInfo> checkInData1 = new List<CheckInDataInfo>();
|
|
|
|
+ checkInData1 = checkInDataView.checkindata;
|
|
|
|
+ List<CheckInDataInfo> checkInDatas = new List<CheckInDataInfo>();
|
|
|
|
+ checkInDatas = checkInData1.Where(it => it.userid == acctid).ToList();
|
|
|
|
+
|
|
|
|
+ List<CheckInDataInfo> checkInData2 = new List<CheckInDataInfo>();
|
|
|
|
+ checkInData2 = checkInDatas.Where(it => it.exception_type.Equals("未打卡")).ToList();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
#region 迟到 早退 旷工
|
|
#region 迟到 早退 旷工
|
|
|
|
|
|
int user_cd_zt_num = 0;
|
|
int user_cd_zt_num = 0;
|
|
|
|
+
|
|
foreach (var root in userRoots)
|
|
foreach (var root in userRoots)
|
|
{
|
|
{
|
|
List<Holiday_infos> holiday_Infos = root.holiday_infos;
|
|
List<Holiday_infos> holiday_Infos = root.holiday_infos;
|
|
@@ -408,15 +439,133 @@ namespace OASystem.API.OAMethodLib
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|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
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region 假勤/补卡次数 审批
|
|
#region 假勤/补卡次数 审批
|
|
|
|
|
|
int leaveNum = 0;
|
|
int leaveNum = 0;
|
|
- int reissuecardNum = 0;
|
|
+ int reissuecardNum = 0;
|
|
|
|
+ int evectionNum = 0;
|
|
|
|
|
|
leaveNum = acc_sp_items.Where(it => it.type == 1).ToList().Count();
|
|
leaveNum = acc_sp_items.Where(it => it.type == 1).ToList().Count();
|
|
reissuecardNum = acc_sp_items.Where(it => it.type == 2).ToList().Count();
|
|
reissuecardNum = acc_sp_items.Where(it => it.type == 2).ToList().Count();
|
|
|
|
+ List<Sp_items> acc_sp_items_evection = new List<Sp_items>();
|
|
|
|
+ acc_sp_items_evection = acc_sp_items.Where(it => it.type == 3).ToList();
|
|
|
|
+ evectionNum = acc_sp_items_evection.Count();
|
|
|
|
|
|
|
|
|
|
if (leaveNum > 0)
|
|
if (leaveNum > 0)
|
|
@@ -629,6 +778,41 @@ namespace OASystem.API.OAMethodLib
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ foreach (var item in checkInData2)
|
|
|
|
+ {
|
|
|
|
+ decimal bukaPrice = 0.00M;
|
|
|
|
+
|
|
|
|
+ if (user_probationary_bk_decimal == 0)
|
|
|
|
+ {
|
|
|
|
+ if (bukaNum <= 2) bukaPrice = 0.00M;
|
|
|
|
+ else if (bukaNum <= 4 && bukaNum > 2) bukaPrice = 10.00M;
|
|
|
|
+ else bukaPrice = 50.00M;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (bukaNum <= 2) bukaPrice = 10.00M;
|
|
|
|
+ else bukaPrice = 50.00M;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Ex_Item ex_reissueCard = new Ex_Item()
|
|
|
|
+ {
|
|
|
|
+ SubTypeId = 7,
|
|
|
|
+ SubType = "打卡补卡",
|
|
|
|
+ StartTimeDt = Convert.ToDateTime(item.checkin_time_dt.ToString("yyyy-MM-dd HH:mm:ss")),
|
|
|
|
+ Deduction = bukaPrice,
|
|
|
|
+ Reason = "[打卡记录]抓取到的未打卡数据!",
|
|
|
|
+ Unit = string.Empty
|
|
|
|
+ };
|
|
|
|
+ unprinted_deduction += bukaPrice;
|
|
|
|
+ ex_reissuecard_Items.Add(ex_reissueCard);
|
|
|
|
+ bukaNum++;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
if (ex_reissuecard_Items.Count > 0)
|
|
if (ex_reissuecard_Items.Count > 0)
|
|
@@ -638,6 +822,143 @@ namespace OASystem.API.OAMethodLib
|
|
ex_Items.Add(ex_Items_dk);
|
|
ex_Items.Add(ex_Items_dk);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ if (evectionNum > 0)
|
|
|
|
+ {
|
|
|
|
+ List<Sp_Detail> sp_leave_details = new List<Sp_Detail>();
|
|
|
|
+ sp_leave_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 3);
|
|
|
|
+ if (sp_leave_details.Count <= 0)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 请假 审批数据获取未获取到!\r\n";
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ List<Ex_Item> cc_ex_ItemInfos = new List<Ex_Item>();
|
|
|
|
+
|
|
|
|
+ foreach (Sp_Detail sp_item in sp_leave_details)
|
|
|
|
+ {
|
|
|
|
+ Apply_data? apply_data = sp_item.apply_data;
|
|
|
|
+ if (apply_data != null)
|
|
|
|
+ {
|
|
|
|
+ List<ContentsItem> contents = apply_data.contents;
|
|
|
|
+ ContentsItem content_Vacation = contents.Where(it => it.control == "Attendance").FirstOrDefault();
|
|
|
|
+ ContentsItem content_Textarea = contents.Where(it => it.control == "Textarea").FirstOrDefault();
|
|
|
|
+
|
|
|
|
+ if (content_Vacation != null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ Attendance attendance = content_Vacation.value.attendance;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ int leaveType = int.Parse("3");
|
|
|
|
+ Date_range date_Range = attendance.date_range;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (startDt >= date_Range.new_begin_dt || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ string leave_starttime = date_Range.new_begin_dt.ToString("HH:mm");
|
|
|
|
+ string leave_endtime = date_Range.new_end_dt.ToString("HH:mm");
|
|
|
|
+
|
|
|
|
+ string typeName = string.Empty;
|
|
|
|
+ string unit = string.Empty;
|
|
|
|
+ int leaveTypeId = leaveType;
|
|
|
|
+ typeName = "出差";
|
|
|
|
+
|
|
|
|
+ string startTime = string.Empty;
|
|
|
|
+ string endTime = string.Empty;
|
|
|
|
+ string startTime1 = string.Empty;
|
|
|
|
+ string endTime1 = string.Empty;
|
|
|
|
+
|
|
|
|
+ decimal new_duration = 0.00M;
|
|
|
|
+ if (date_Range.type == "halfday")
|
|
|
|
+ {
|
|
|
|
+ new_duration = Convert.ToDecimal(date_Range.new_duration) / 86400.00M;
|
|
|
|
+ unit = "天";
|
|
|
|
+ startTime = date_Range.new_begin_dt.ToString("yyyy-MM-dd") + " 09:00";
|
|
|
|
+ endTime = date_Range.new_begin_dt.ToString("yyyy-MM-dd") + " 18:00";
|
|
|
|
+ startTime1 = "09:00:00";
|
|
|
|
+ endTime1 = "18:00:00";
|
|
|
|
+ }
|
|
|
|
+ else if (date_Range.type == "hour")
|
|
|
|
+ {
|
|
|
|
+ new_duration = Convert.ToDecimal(date_Range.new_duration) / 3600.00M;
|
|
|
|
+ unit = "小时";
|
|
|
|
+ startTime = date_Range.new_begin_dt.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ endTime = date_Range.new_end_dt.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ startTime1 = date_Range.new_begin_dt.ToString("HH:mm:ss");
|
|
|
|
+ endTime1 = date_Range.new_end_dt.ToString("HH:mm:ss");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ decimal cckk = 0.00M;
|
|
|
|
+
|
|
|
|
+ int days = (int)(date_Range.new_end_dt - date_Range.new_begin_dt).TotalDays;
|
|
|
|
+ for (int i = 0; i <= days; i++)
|
|
|
|
+ {
|
|
|
|
+ DateTime thisDt = date_Range.new_begin_dt.AddDays(i);
|
|
|
|
+ if (thisDt > date_Range.new_end_dt)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Sys_Calendar sys_Calendar = new Sys_Calendar();
|
|
|
|
+ sys_Calendar = sys_Calendars.Where(it => it.Dt == thisDt.ToString("yyyy-MM-dd")).FirstOrDefault();
|
|
|
|
+ if (sys_Calendar != null) {
|
|
|
|
+ if (sys_Calendar.IsWorkDay)
|
|
|
|
+ {
|
|
|
|
+ cckk += 10.00M;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ meal_deduction += cckk;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Ex_Item ex_Item = new Ex_Item()
|
|
|
|
+ {
|
|
|
|
+ SubTypeId = leaveType,
|
|
|
|
+ SubType = typeName,
|
|
|
|
+ StartTimeDt = Convert.ToDateTime(date_Range.new_begin_dt.ToString("yyyy-MM-dd") + " " + startTime1),
|
|
|
|
+ EndTimeDt = Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd") + " " + endTime1),
|
|
|
|
+ Duration = new_duration,
|
|
|
|
+ Unit = unit,
|
|
|
|
+ Deduction = 0.00M,
|
|
|
|
+
|
|
|
|
+ Apply_time_dt = Convert.ToDateTime(sp_item.apply_time_dt.ToString("yyyy-MM-dd HH:mm:ss"))
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ cc_ex_ItemInfos.Add(ex_Item);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (cc_ex_ItemInfos.Count > 0)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<Ex_Item> ex_jq_Items = new List<Ex_Item>();
|
|
|
|
+ ex_jq_Items = (List<Ex_Item>)ex_Items_jq.Ex_ItemInfo;
|
|
|
|
+ ex_jq_Items.AddRange(cc_ex_ItemInfos);
|
|
|
|
+ ex_Items.Remove(ex_Items_jq);
|
|
|
|
+ ex_Items.Add(
|
|
|
|
+ new Ex_Items()
|
|
|
|
+ {
|
|
|
|
+ Type = "假勤",
|
|
|
|
+ Ex_ItemInfo = ex_jq_Items.OrderBy(it => it.StartTimeDt).ThenBy(it => it.Apply_time_dt).ToList()
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|
|
@@ -693,10 +1014,10 @@ namespace OASystem.API.OAMethodLib
|
|
pm_wsInfo.Ex_ItemsRemark = JsonConvert.SerializeObject(ex_Items);
|
|
pm_wsInfo.Ex_ItemsRemark = JsonConvert.SerializeObject(ex_Items);
|
|
pm_wsInfo.Mealsupplement = mealTotal;
|
|
pm_wsInfo.Mealsupplement = mealTotal;
|
|
|
|
|
|
- pm_wsInfo.Should = salaryTotal;
|
|
+ pm_wsInfo.Should = ConvertToDecimal( salaryTotal);
|
|
- pm_wsInfo.TotalDeductions = eductionTotal;
|
|
+ pm_wsInfo.TotalDeductions = ConvertToDecimal(eductionTotal);
|
|
- pm_wsInfo.TotalRealHair = actualReleaseTotal - pm_wsInfo.WithholdingTax;
|
|
+ pm_wsInfo.TotalRealHair = ConvertToDecimal(actualReleaseTotal - pm_wsInfo.WithholdingTax);
|
|
- pm_wsInfo.AfterTax = actualReleaseTotal - pm_wsInfo.WithholdingTax;
|
|
+ pm_wsInfo.AfterTax = ConvertToDecimal(actualReleaseTotal - pm_wsInfo.WithholdingTax);
|
|
|
|
|
|
pm_wsInfo.LastUpdateUserId = userId;
|
|
pm_wsInfo.LastUpdateUserId = userId;
|
|
pm_wsInfo.LastUpdateDt = DateTime.Now;
|
|
pm_wsInfo.LastUpdateDt = DateTime.Now;
|