|
@@ -208,7 +208,11 @@ namespace OASystem.API.OAMethodLib
|
|
|
//找出外出的打卡记录
|
|
|
List<CheckInDataInfo> checkInData2 = new List<CheckInDataInfo>();
|
|
|
checkInData2 = checkInDatas.Where(it => it.exception_type.Equals("未打卡")).ToList();
|
|
|
-
|
|
|
+
|
|
|
+ //外出打卡
|
|
|
+ List<CheckInDataInfo> checkInData_outPunch = new List<CheckInDataInfo>();
|
|
|
+ checkInData_outPunch = checkInDatas.Where(it => it.checkin_type.Equals("外出打卡")).ToList();
|
|
|
+
|
|
|
#region 迟到 早退 旷工
|
|
|
|
|
|
int user_cd_zt_num = 0; //早退/迟到 次数 10分钟内 2次以内不记处罚 三次及以上50一次
|
|
@@ -491,6 +495,191 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ #region 外出打卡 迟到 早退 旷工
|
|
|
+
|
|
|
+ if (checkInData_outPunch.Count > 0)
|
|
|
+ {
|
|
|
+ List<Sp_Detail> sp_gooutpunch_details = new List<Sp_Detail>();
|
|
|
+ sp_gooutpunch_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 4); //时间段内所有 已同意的 外出打卡 审批数据
|
|
|
+ if (sp_gooutpunch_details.Count <= 0)
|
|
|
+ {
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 外出打卡 审批数据获取未获取到!\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ List<LeaveDetails> goOutPunchDetails = new List<LeaveDetails>();
|
|
|
+ foreach (Sp_Detail sp_item in sp_gooutpunch_details)
|
|
|
+ {
|
|
|
+ Apply_data? apply_data = sp_item.apply_data;
|
|
|
+ if (apply_data != null)
|
|
|
+ {
|
|
|
+ List<ContentsItem> contents = apply_data.contents;
|
|
|
+ ContentsItem content_Attendance = contents.Where(it => it.control == "Attendance").FirstOrDefault(); //请假类型
|
|
|
+ ContentsItem content_Textarea = contents.Where(it => it.control == "Textarea").FirstOrDefault(); //多行文本
|
|
|
+
|
|
|
+ if (content_Attendance != null)
|
|
|
+ {
|
|
|
+ Attendance attendance = content_Attendance.value.attendance; //假勤组件
|
|
|
+
|
|
|
+ string goOutText = string.Empty;
|
|
|
+ if (content_Textarea!=null)
|
|
|
+ {
|
|
|
+ goOutText = content_Textarea.value.text;
|
|
|
+ }
|
|
|
+
|
|
|
+ Date_range date_Range = attendance.date_range;
|
|
|
+
|
|
|
+ //筛选 不在工作日内的假勤申请
|
|
|
+ if (Convert.ToDateTime(date_Range.new_begin_dt) < startDt || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ LeaveDetails leaveDetails1 = new LeaveDetails()
|
|
|
+ {
|
|
|
+ TypeId = 0,
|
|
|
+ TypeName = "外出打卡",
|
|
|
+ StartDt = date_Range.new_begin_dt,
|
|
|
+ EndDt = date_Range.new_end_dt,
|
|
|
+ DtType = date_Range.type,
|
|
|
+ New_Duration = date_Range.new_duration
|
|
|
+ };
|
|
|
+ goOutPunchDetails.Add(leaveDetails1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var goOutPunchItem in goOutPunchDetails)
|
|
|
+ {
|
|
|
+ string thisDay = goOutPunchItem.StartDt.ToString("yyyy-MM-dd");
|
|
|
+ TimeSpan sp_gooutpunchStartTime = goOutPunchItem.StartDt.TimeOfDay;
|
|
|
+ TimeSpan sp_gooutpunchEndTime = goOutPunchItem.EndDt.TimeOfDay;
|
|
|
+ List<CheckInDataInfo> goOut_checkInDataInfos = checkInData_outPunch.Where(it => it.checkin_time_dt.ToString("yyyy-MM-dd").Equals(thisDay)).ToList();
|
|
|
+ //单天
|
|
|
+ if (goOut_checkInDataInfos.Count > 1)
|
|
|
+ {
|
|
|
+ DateTime gooutStartDt = goOut_checkInDataInfos[0].checkin_time_dt;
|
|
|
+ DateTime gooutendDt = goOut_checkInDataInfos[goOut_checkInDataInfos.Count-1].checkin_time_dt;
|
|
|
+
|
|
|
+ Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 4,
|
|
|
+ SubType = "旷工",
|
|
|
+ Duration = 0,
|
|
|
+ StartTimeDt = Convert.ToDateTime(thisDay),
|
|
|
+ Unit = "分钟",
|
|
|
+ Reason ="数据来源【外出打卡】"
|
|
|
+ };
|
|
|
+
|
|
|
+ decimal day_deduction = 0.00M;
|
|
|
+
|
|
|
+ //迟到
|
|
|
+ if (gooutStartDt.TimeOfDay > sp_gooutpunchStartTime)
|
|
|
+ {
|
|
|
+ int timeLong = gooutStartDt.Subtract(goOutPunchItem.StartDt).Minutes;
|
|
|
+ beLate_belate_ex.Duration = timeLong;
|
|
|
+ if (timeLong > 0 && timeLong < 10)
|
|
|
+ {
|
|
|
+ user_cd_zt_num++;
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "迟到";
|
|
|
+
|
|
|
+ if (user_cd_zt_num >= 3)
|
|
|
+ {
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = 0.00M;
|
|
|
+ }
|
|
|
+ beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ }
|
|
|
+ else if (timeLong >= 10 && timeLong < 60)
|
|
|
+ {
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "迟到";
|
|
|
+ }
|
|
|
+ else if (timeLong >= 60 && timeLong <= 180)
|
|
|
+ {
|
|
|
+ day_deduction = ConvertToDecimal(dailyWage / 2); //3小时 按半天计算
|
|
|
+ meal_deduction += 10.00M; //餐补扣款
|
|
|
+ absenteeism_deduction += day_deduction; //矿工半日
|
|
|
+ beLate_belate_ex.Reason = "数据来源【外出打卡】" + thisDay + " 上午(09:00)缺卡/未打卡视为旷工半天";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = ConvertToDecimal(dailyWage);
|
|
|
+ absenteeism_deduction += day_deduction; //矿工一日
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ beLate_belate_ex.Reason = "数据来源【外出打卡】" +thisDay + " 上午(09:00)-下午(18:00) 缺卡/未打视为旷工一天(7.5小时)";
|
|
|
+ }
|
|
|
+ beLate_belate_ex.Deduction = day_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ //早退
|
|
|
+ if (gooutendDt.TimeOfDay < sp_gooutpunchEndTime)
|
|
|
+ {
|
|
|
+ int timeLong = goOutPunchItem.EndDt.Subtract(gooutendDt).Minutes;
|
|
|
+ beLate_belate_ex.Duration = timeLong;
|
|
|
+ if (timeLong > 0 && timeLong < 10)
|
|
|
+ {
|
|
|
+ user_cd_zt_num++;
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "早退";
|
|
|
+
|
|
|
+
|
|
|
+ if (user_cd_zt_num >= 3)
|
|
|
+ {
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = 0.00M;
|
|
|
+ }
|
|
|
+ beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ }
|
|
|
+ else if (timeLong >= 10 && timeLong < 60)
|
|
|
+ {
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "早退";
|
|
|
+ }
|
|
|
+ else if (timeLong >= 60 && timeLong <= 180)
|
|
|
+ {
|
|
|
+ day_deduction = ConvertToDecimal(dailyWage / 2); //3小时 按半天计算
|
|
|
+ meal_deduction += 10.00M; //餐补扣款
|
|
|
+ absenteeism_deduction += day_deduction; //矿工半日
|
|
|
+ beLate_belate_ex.Reason = "数据来源【外出打卡】" + thisDay + " 上午(09:00)缺卡/未打卡视为旷工半天";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = ConvertToDecimal(dailyWage);
|
|
|
+ absenteeism_deduction += day_deduction; //矿工一日
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ beLate_belate_ex.Reason = "数据来源【外出打卡】" + thisDay + " 上午(09:00)-下午(18:00) 缺卡/未打视为旷工一天(7.5小时)";
|
|
|
+ }
|
|
|
+ beLate_belate_ex.Deduction = day_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //多天
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 迟到早团旷工 日期排序
|
|
|
+
|
|
|
+ if (ex_reissuecard_Items.Count > 0)
|
|
|
+ {
|
|
|
+ ex_reissuecard_Items = ex_reissuecard_Items.OrderBy(it => it.StartTimeDt).ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 假勤/补卡次数 审批
|
|
|
|
|
|
int leaveNum = 0; //请假次数
|