|
@@ -1,4 +1,5 @@
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
+using NPOI.OpenXmlFormats.Spreadsheet;
|
|
|
using OASystem.API.OAMethodLib.QiYeWeChatAPI;
|
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.Entities.PersonnelModule;
|
|
@@ -46,8 +47,6 @@ namespace OASystem.API.OAMethodLib
|
|
|
userNames = nameData.Data;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
|
|
|
CheckInView checkIn = await _qiYeWeChatApiService.GetCheckin_MonthDataAsync(startDt, endDt);
|
|
|
if (checkIn.errcode != 0)
|
|
@@ -66,8 +65,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
_result.Msg = startDt + " - " + endDt + "请假 类型数据 获取失败!";
|
|
|
return _result;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
foreach (var pm_wsInfo in pm_WageSheetDattaSources)
|
|
|
{
|
|
|
string itemName = userNames.Where(it => it.Id == pm_wsInfo.UserId).FirstOrDefault().CnName;
|
|
@@ -101,16 +99,6 @@ namespace OASystem.API.OAMethodLib
|
|
|
if (checkInData == null) { continue; }
|
|
|
string acctid = checkInData.base_info.acctid;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- List<Sp_Detail> sp_reissuecard_details = new List<Sp_Detail>();
|
|
|
- sp_reissuecard_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 2);
|
|
|
- if (sp_reissuecard_details.Count <= 0)
|
|
|
- {
|
|
|
- _result.Msg += startDt + " - " + endDt + " " + itemName + " 打卡补卡 审批数据获取未获取到!\r\n";
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
Summary_Info? summary_Info = checkInData.summary_info;
|
|
|
if (summary_Info == null) { continue; }
|
|
@@ -239,7 +227,8 @@ namespace OASystem.API.OAMethodLib
|
|
|
{
|
|
|
SubTypeId = leaveType,
|
|
|
SubType = typeName,
|
|
|
- Start_end_time_dt = startEndTiime,
|
|
|
+ StartTimeDt = date_Range.new_begin_dt,
|
|
|
+ EndTimeDt = date_Range.new_end_dt,
|
|
|
Duration = new_duration,
|
|
|
Deduction = thisTypeDeduction,
|
|
|
|
|
@@ -262,26 +251,46 @@ namespace OASystem.API.OAMethodLib
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
- #region 打卡补卡 处理
|
|
|
+ Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" };
|
|
|
+ List<Ex_Item> ex_Item_Infos = new List<Ex_Item>();
|
|
|
+ #region 打卡补卡 补卡次数 处理
|
|
|
|
|
|
- if (reissueCardNum == 3)
|
|
|
+ if (reissueCardNum > 0)
|
|
|
{
|
|
|
- reissuecard_deduction += 10;
|
|
|
- }
|
|
|
- else if (reissueCardNum >= 4)
|
|
|
- {
|
|
|
- reissuecard_deduction += 50;
|
|
|
+ if (reissueCardNum <= 3)
|
|
|
+ {
|
|
|
+ reissuecard_deduction += 10 * reissueCardNum;
|
|
|
+ }
|
|
|
+ else if (reissueCardNum > 3)
|
|
|
+ {
|
|
|
+ int for_reissueCardNum = reissueCardNum - 3;
|
|
|
+
|
|
|
+ for (int i = 0; i < for_reissueCardNum; i++)
|
|
|
+ {
|
|
|
+ reissuecard_deduction += 50;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Ex_Item ex_reissueCard = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 7,
|
|
|
+ SubType = "补卡次数",
|
|
|
+ Deduction = reissuecard_deduction,
|
|
|
+ Reason = "补卡:员工发现自己漏打卡时,需及时提起补卡申请,并说明情况。试用期员工每月有 2 次\r\n补卡机会,超过 2 次不足 5 次的部分,按 10 元/次处罚,5 次及以上的漏卡,按 50 元/次处罚;正式员工每月 3 次以内的补卡,按 10 元/次处罚,3 次及以上的漏卡,按 50 元/次处罚。\r\n补卡路径为:企微-工作台-审批-打卡补卡。",
|
|
|
+ unit = string.Empty
|
|
|
+ };
|
|
|
+
|
|
|
+ ex_Item_Infos.Add(ex_reissueCard);
|
|
|
}
|
|
|
+
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" };
|
|
|
-
|
|
|
- List<dynamic> ex_reissuecard_Items = new List<dynamic>();
|
|
|
- List<Sp_Detail> sp_reissuecard_item_InfosData = sp_reissuecard_details.Where(it => it.applyer.userid == acctid).ToList();
|
|
|
-
|
|
|
- #region 打卡异常处理 统计 1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常;
|
|
|
+ List<Ex_Item> ex_reissuecard_Items = new List<Ex_Item>();
|
|
|
+
|
|
|
+ List<Sp_Detail> sp_reissuecard_details = new List<Sp_Detail>();
|
|
|
|
|
|
+
|
|
|
int beLateNum = 0,
|
|
|
leaveEarlyNum = 0,
|
|
|
dummyDeckNum = 0,
|
|
@@ -303,132 +312,271 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (ex_reissuecard_Items.Count > 0)
|
|
|
+
|
|
|
+
|
|
|
+ CheckInDataView checkInDataView = new CheckInDataView();
|
|
|
+ checkInDataView = await _qiYeWeChatApiService.GetCheckinDataAsync(new List<string>() { acctid },3,startDt,endDt);
|
|
|
+
|
|
|
+ if (checkInDataView.errcode != 0)
|
|
|
{
|
|
|
- ex_Items_dk.Ex_ItemInfo = ex_reissuecard_Items.OrderBy(it => it.SubTypeId).ThenBy(it => it.datehour).ToList();
|
|
|
- ex_Items.Add(ex_Items_dk);
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 打卡记录 "+ checkInDataView.errmsg + " \r\n";
|
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
+
|
|
|
+ List<CheckInDataInfo> checkInDataInfos = checkInDataView.checkindata.Where(it => !string.IsNullOrEmpty(it.exception_type)).ToList();
|
|
|
|
|
|
+
|
|
|
+ List<CheckInDataInfo> leave_checkInDataInfos = new List<CheckInDataInfo>();
|
|
|
+ if (checkInDataInfos.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var leaveItem in ex_ItemInfos)
|
|
|
+ {
|
|
|
+ if (leaveItem.StartTimeDt.ToString("yyyy-MM-dd").Equals(leaveItem.EndTimeDt.ToString("yyyy-MM-dd")))
|
|
|
+ {
|
|
|
+ leave_checkInDataInfos.AddRange(checkInDataInfos.Where(it => it.checkin_time_dt.ToString("yyyy-MM-dd") == leaveItem.StartTimeDt.ToString("yyyy-MM-dd")).ToList());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ leave_checkInDataInfos.AddRange(checkInDataInfos.Where(it => it.checkin_time_dt >= leaveItem.StartTimeDt && it.checkin_time_dt <=leaveItem.EndTimeDt ).ToList());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<CheckInDataInfo> pullcard_checkInDataInfos = new List<CheckInDataInfo>();
|
|
|
+ if (leave_checkInDataInfos.Count > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ pullcard_checkInDataInfos = checkInDataInfos.Except(leave_checkInDataInfos).ToList();
|
|
|
+
|
|
|
+ if (pullcard_checkInDataInfos.Count > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ #region 打卡异常处理 统计 1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ foreach (var pc_ex_item in pullcard_checkInDataInfos)
|
|
|
+ {
|
|
|
+
|
|
|
+ CheckInDayDataView checkInDayDataView = await _qiYeWeChatApiService.GetCheckInDayDataAsync(new List<string>() { acctid },startDt,endDt);
|
|
|
+
|
|
|
+ if (checkInDayDataView.errcode != 0)
|
|
|
+ {
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 异常信息数据获取未获取到!\r\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ Root roots_ex = roots_exs.Where(it => it.base_info.dateDt == pc_ex_item.sch_checkin_time_dt).FirstOrDefault();
|
|
|
+ List<Exception_infos> exception_infos = roots_ex.exception_infos;
|
|
|
+
|
|
|
+ List<Exception_infos> exception_infos1 = checkInDayDataView.datas[29].exception_infos;
|
|
|
+ string exc_type = pc_ex_item.exception_type;
|
|
|
+
|
|
|
+ if (exc_type.Contains("时间异常") || exc_type.Contains("未打卡"))
|
|
|
+ {
|
|
|
+ int day_time_minute = (60 * 7) + 30;
|
|
|
+
|
|
|
+ Exception_infos beLate_ex = exception_infos.Where(it => it.exception == 1).FirstOrDefault();
|
|
|
+ decimal day_miner_unit = dailyWage / 15;
|
|
|
+
|
|
|
+ if (beLate_ex != null)
|
|
|
+ {
|
|
|
+ if (beLateNum > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 4,
|
|
|
+ SubType = "旷工",
|
|
|
+ unit = "分钟",
|
|
|
+ };
|
|
|
+ decimal day_beLate_deduction = 0.00M;
|
|
|
+ if (beLate_ex.duration >= 10 && beLate_ex.duration <= 60)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = beLateNum * 50;
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "迟到";
|
|
|
+ }
|
|
|
+ else if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = day_miner_unit * 6;
|
|
|
+
|
|
|
+ }
|
|
|
+ else day_beLate_deduction = dailyWage;
|
|
|
+
|
|
|
+ beLate_deduction += day_beLate_deduction;
|
|
|
+
|
|
|
+
|
|
|
+ beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
+ beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (leaveEarlyNum > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 4,
|
|
|
+ SubType = "旷工",
|
|
|
+ unit = "分钟",
|
|
|
+ };
|
|
|
+ decimal day_beLate_deduction = 0.00M;
|
|
|
+ if (beLate_ex.duration >= 10 && beLate_ex.duration <= 60)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = beLateNum * 50;
|
|
|
+ beLate_belate_ex.SubTypeId = 3;
|
|
|
+ beLate_belate_ex.SubType = "未打卡/漏卡";
|
|
|
+ }
|
|
|
+ else if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = day_miner_unit * 6;
|
|
|
+
|
|
|
+ }
|
|
|
+ else day_beLate_deduction = dailyWage;
|
|
|
+
|
|
|
+ beLate_deduction += day_beLate_deduction;
|
|
|
+
|
|
|
+ beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
+ beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dummyDeckNum > 0)
|
|
|
+ {
|
|
|
+ Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 4,
|
|
|
+ SubType = "旷工",
|
|
|
+ unit = "分钟",
|
|
|
+ };
|
|
|
+ decimal day_beLate_deduction = 0.00M;
|
|
|
+ if (beLate_ex.duration >= 10 && beLate_ex.duration <= 60)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = beLateNum * 50;
|
|
|
+ beLate_belate_ex.SubTypeId = 2;
|
|
|
+ beLate_belate_ex.SubType = "早退";
|
|
|
+ }
|
|
|
+ else if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = day_miner_unit * 6;
|
|
|
+
|
|
|
+ }
|
|
|
+ else day_beLate_deduction = dailyWage;
|
|
|
+
|
|
|
+ beLate_deduction += day_beLate_deduction;
|
|
|
+
|
|
|
+ beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
+ beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (minerNum > 0)
|
|
|
+ {
|
|
|
+ Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 4,
|
|
|
+ SubType = "旷工",
|
|
|
+ unit = "分钟",
|
|
|
+ };
|
|
|
+ decimal day_beLate_deduction = 0.00M;
|
|
|
+
|
|
|
+ if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = day_miner_unit * 6;
|
|
|
+
|
|
|
+ }
|
|
|
+ else day_beLate_deduction = dailyWage;
|
|
|
+
|
|
|
+ beLate_deduction += day_beLate_deduction;
|
|
|
+
|
|
|
+ beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
+ beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ex_reissuecard_Items.Count > 0拿工资)
|
|
|
+ {
|
|
|
+ ex_Items_dk.Ex_ItemInfo = ex_reissuecard_Items;
|
|
|
+ }
|
|
|
|
|
|
#region 应发合计 实发合计 扣款合计(假勤扣款,其他扣款,社保扣款,公积金代扣,个税扣款)
|
|
|
|