PersonnelModuleController.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. using Autofac.Diagnostics;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Microsoft.AspNetCore.Mvc.RazorPages;
  4. using OASystem.API.OAMethodLib.QiYeWeChatAPI;
  5. using OASystem.Domain;
  6. using OASystem.Domain.Dtos.PersonnelModule;
  7. using OASystem.Domain.Dtos.QiYeWeChat;
  8. using OASystem.Domain.Entities.PersonnelModule;
  9. using OASystem.Domain.ViewModels.JuHeExchangeRate;
  10. using OASystem.Domain.ViewModels.PersonnelModule;
  11. using OASystem.Domain.ViewModels.QiYeWeChat;
  12. using OASystem.Infrastructure.Repositories.PersonnelModule;
  13. using SqlSugar;
  14. using StackExchange.Redis;
  15. using System.Collections.Generic;
  16. using System.Globalization;
  17. namespace OASystem.API.Controllers
  18. {
  19. /// <summary>
  20. /// 人事模块
  21. /// </summary>
  22. [Route("api/[controller]/[action]")]
  23. public class PersonnelModuleController : ControllerBase
  24. {
  25. private Result _result;
  26. private readonly IMapper _mapper;
  27. private readonly decimal _chengDuMinimumWage = 2100.00M;
  28. private readonly IQiYeWeChatApiService _qiYeWeChatApiService;
  29. private readonly WageSheetRepository _wageSheetRep;
  30. private readonly UsersRepository _usersRep;
  31. /// <summary>
  32. /// 初始化
  33. /// </summary>
  34. /// <param name="qiYeWeChatApiService"></param>
  35. /// <param name="wageSheetRep"></param>
  36. /// <param name="usersRep"></param>
  37. /// <param name="mapper"></param>
  38. public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService,WageSheetRepository wageSheetRep, UsersRepository usersRep, IMapper mapper)
  39. {
  40. _mapper = mapper;
  41. _usersRep = usersRep;
  42. _qiYeWeChatApiService = qiYeWeChatApiService;
  43. _wageSheetRep = wageSheetRep;
  44. _result = new Result();
  45. }
  46. #region 工资表单
  47. /// <summary>
  48. /// 获取工资表单
  49. /// </summary>
  50. /// <param name="dto"></param>
  51. /// <returns></returns>
  52. [HttpPost]
  53. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  54. public async Task<IActionResult> GetWageSheetList(WageSheetListDto dto)
  55. {
  56. //参数处理
  57. string ymFormat = "yyyy-MM";
  58. DateTime yearMonthDt;
  59. bool yearMonthDttIsValid = DateTime.TryParseExact(dto.YearMonth, ymFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out yearMonthDt);
  60. if (!yearMonthDttIsValid)
  61. {
  62. _result.Msg = "年月格式错误!正确时间格式:yyyy-MM ";
  63. return Ok(JsonView(false, _result.Msg));
  64. }
  65. //获取月工资数据
  66. string yearMonth = yearMonthDt.ToString("yyyy-MM");
  67. string startDt = yearMonthDt.AddDays(-1).ToString("yyyy-MM") + "-28",
  68. endDt = yearMonth + "-27";
  69. //应发合计 = 基本工资 +绩效工资 + 岗位津贴 + 员工的岗位津贴 + 服装洗理补贴 + 通讯补贴 + 交通补贴 + 保密费 + 操作奖金+ 其他补贴 + 部门集体团建费 + 代扣保险 + 代扣公积金 + 餐补 - 个税
  70. //事假 病假 合计
  71. //扣款合计 = 迟到 + 早退 + 矿工 + 未打卡 + 其他扣款
  72. _result = await _wageSheetRep.Get_WageSheet_ListByYearMonthAsync(yearMonth);
  73. if (_result.Code != 0)
  74. {
  75. return Ok(JsonView(false, _result.Msg));
  76. }
  77. if (dto.PortType == 1)
  78. {
  79. }
  80. else if (dto.PortType == 2)
  81. { }
  82. else if (dto.PortType == 3)
  83. { }
  84. else
  85. {
  86. return Ok(JsonView(false, "请选择正确的端口参数"));
  87. }
  88. return Ok(JsonView(true, _result.Msg, _result.Data));
  89. }
  90. /// <summary>
  91. /// 获取工资 详情
  92. /// </summary>
  93. /// <param name="dto"></param>
  94. /// <returns></returns>
  95. [HttpPost]
  96. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  97. public async Task<IActionResult> GetWageSheetById(WageSheetInfoDto dto)
  98. {
  99. if (dto.PortType == 1)
  100. {
  101. _result = await _wageSheetRep.Get_WageSheet_InfoByIdAsync(dto.Id);
  102. if (_result.Code != 0)
  103. {
  104. return Ok(JsonView(false, _result.Msg));
  105. }
  106. }
  107. else if (dto.PortType == 2)
  108. { }
  109. else if (dto.PortType == 3)
  110. { }
  111. else
  112. {
  113. return Ok(JsonView(false, "请选择正确的端口参数"));
  114. }
  115. return Ok(JsonView(true, _result.Msg, _result.Data));
  116. }
  117. /// <summary>
  118. /// 人事模块 工资表单 添加 Or 修改
  119. /// </summary>
  120. /// <param name="dto"></param>
  121. /// <returns></returns>
  122. [HttpPost]
  123. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  124. public async Task<IActionResult> PostWageSheetAddOrEdit(WageAddOrEditDto dto)
  125. {
  126. try
  127. {
  128. _result = await _wageSheetRep.Post_WageSheet_AddOrEditAsync(dto);
  129. if (_result.Code != 0)
  130. {
  131. return Ok(JsonView(false, _result.Msg));
  132. }
  133. }
  134. catch (Exception ex)
  135. {
  136. return Ok(JsonView(false, ex.Message));
  137. }
  138. return Ok(JsonView(true, _result.Msg, _result.Data));
  139. }
  140. /// <summary>
  141. /// 计算工资
  142. /// </summary>
  143. /// <returns></returns>
  144. [HttpPost]
  145. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  146. public async Task<IActionResult> SalaryCalculatorAsync(SalaryCalculatorDto dto)
  147. {
  148. Result result = new Result();
  149. //参数处理
  150. string ymFormat = "yyyy-MM";
  151. DateTime yearMonthDt;
  152. bool yearMonthDttIsValid = DateTime.TryParseExact(dto.yearMonth, ymFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out yearMonthDt);
  153. if (!yearMonthDttIsValid)
  154. {
  155. return Ok(JsonView(false, "年月格式错误!正确时间格式:yyyy-MM "));
  156. }
  157. string thisYearMonth = dto.yearMonth;
  158. string preYearMonth = yearMonthDt.AddMonths(-1).ToString("yyyy-MM");
  159. //本月工资是否有数据 有数据则不计算
  160. result = await _wageSheetRep.Get_WageSheet_ListByYearMonthAsync(thisYearMonth);
  161. if (result.Code == 0 )
  162. {
  163. return Ok(JsonView(false, thisYearMonth + " 工资数据已存在,若无人员工资请手动添加!"));
  164. }
  165. //获取上个月工资信息
  166. DateTime startDt = Convert.ToDateTime(yearMonthDt.AddMonths(-1).ToString("yyyy-MM") + "-28");
  167. DateTime endDt = Convert.ToDateTime(yearMonthDt.ToString("yyyy-MM") + "-27");
  168. string preWageSheetSql = string.Format(@"Select sys_u1.CnName Name,pm_ws.* From Pm_WageSheet pm_ws
  169. Left Join Sys_Users sys_u1 On pm_ws.UserId = sys_u1.Id Where pm_ws.IsDel = 0 And YearMonth ='{0}'", preYearMonth);
  170. List<WageSheetInfos> preWageSheetItems = await _wageSheetRep._sqlSugar.SqlQueryable<WageSheetInfos>(preWageSheetSql).ToListAsync();
  171. if (preWageSheetItems.Count <= 0)
  172. {
  173. return Ok(JsonView(false, preYearMonth + " 工资数据不存在,请手动添加!"));
  174. }
  175. //获取OA系统内所有用户
  176. var nameData = await _usersRep.GetUserNameList(1);
  177. List<UserNameView> userNames = nameData.Data;
  178. //获取所有打卡数据
  179. CheckInView checkIn = await _qiYeWeChatApiService.GetCheckin_MonthDataAsync(startDt, endDt); //时间段内所有 打卡数据
  180. if (checkIn.errcode != 0)
  181. {
  182. return Ok(JsonView(false, checkIn.errmsg));
  183. }
  184. List<Data> checkInDatas = checkIn.datas;
  185. //获取所有打卡补卡,审批 数据
  186. DateTime sp_startDt = startDt.AddDays(-10);
  187. DateTime sp_centerDt = sp_startDt.AddDays(30);
  188. DateTime sp_endDt = endDt.AddDays(10);
  189. List<Sp_Info> sp_Infos = new List<Sp_Info>();
  190. string redisName = "ApprovalData_" + sp_startDt.Year + "_" + sp_startDt.Month;
  191. string sp_InfosString = await RedisRepository.RedisFactory
  192. .CreateRedisRepository()
  193. .StringGetAsync<string>(redisName);//string 取
  194. if (string.IsNullOrEmpty(sp_InfosString))
  195. {
  196. ApprovalDataView approvalData_1 = await _qiYeWeChatApiService.GetApprovalDataAsync(sp_startDt, sp_centerDt); //时间段内所有 审批数据
  197. ApprovalDataView approvalData_2 = await _qiYeWeChatApiService.GetApprovalDataAsync(sp_centerDt, sp_endDt); //时间段内所有 审批数据
  198. if (approvalData_1.errcode != 0)
  199. {
  200. result.Msg = "企业微信 获取时间段内审批 Msg:" + approvalData_1.errmsg;
  201. return Ok(JsonView(false, "企业微信 获取时间段内审批 Msg:" + approvalData_1.errmsg));
  202. }
  203. sp_Infos.AddRange(approvalData_1.data);
  204. if (approvalData_2.errcode != 0)
  205. {
  206. return Ok(JsonView(false, "企业微信 获取时间段内审批 Msg:" + approvalData_2.errmsg));
  207. }
  208. sp_Infos.AddRange(approvalData_2.data);
  209. TimeSpan ts = DateTime.Now.AddMinutes(60) - DateTime.Now; //设置redis 过期时间 60分钟
  210. await RedisRepository
  211. .RedisFactory
  212. .CreateRedisRepository()
  213. .StringSetAsync<string>(redisName, JsonConvert.SerializeObject(sp_Infos), ts);//string 存
  214. }
  215. else
  216. {
  217. sp_Infos = JsonConvert.DeserializeObject<List<Sp_Info>>(sp_InfosString);
  218. }
  219. // 筛选 时间段内(请假时间,补卡时间) /审批类型(打卡补卡,请假)/审核通过的数据
  220. List<Sp_Info> sp_leave_InfosData = sp_Infos.Where(it => it.sp_status == 2 && it.spname == "请假" && it.leave.start_time_dt >= startDt && it.leave.start_time_dt <= endDt).ToList(); //请假
  221. List<Sp_Info> sp_reissuecard_InfosData = sp_Infos.Where(it => it.sp_status == 2 && it.spname == "打卡补卡" && it.comm.FillingDt >= startDt && it.comm.FillingDt <= endDt).ToList(); //补卡
  222. List<Pm_WageSheet> wageSheets = new List<Pm_WageSheet>();
  223. foreach (var item in preWageSheetItems)
  224. {
  225. Pm_WageSheet pm_wsInfo = new Pm_WageSheet();
  226. pm_wsInfo = _mapper.Map<Pm_WageSheet>(item);
  227. //补贴 金额
  228. decimal meal_subsidy = 0.00M; // 午餐(午餐10元/天) 补贴 * 计算方式:单日上午请假时长(小时)大于或者等于三小时 没有餐补
  229. //事假 病假 总金额
  230. decimal personalLeaveTotal = 0.00M, // 事假 日薪 *计算方式:日平均工资 = 月工资/当月应出勤天数。
  231. sickLeaveTotal = 0.00M; // 病假 日薪 *计算方式:日平均工资 = 成都市最低工资标准的80%/当月应出勤天数。 短期病假=当月15天内
  232. //扣款金额
  233. decimal beLate_deduction = 0.00M, // 迟到 扣款金额 *计算方式:
  234. // 一个自然月内,不足 10 分钟的迟到/早退,不超过 2 次的部分,不做处罚;3 次及以上,按50元 / 次处罚;
  235. // 超过 10 分钟(含 10 分钟),不足 60 分钟的迟到/早退,按 50 元/次处罚;
  236. // 超过 60 分钟(含 60 分钟),不足 3 小时的迟到/早退,且无请假者,按旷工半日处理;超过3 小时的迟到 / 早退,且无请假者,按旷工一日处理。
  237. early_deduction = 0.00M, // 早退 扣款金额
  238. absenteeism_deduction = 0.00M, // 旷工 扣款金额 *计算方式:旷工扣发当日工资
  239. unprinted_deduction = 0.00M, // 未打卡 扣款金额 *计算方式:
  240. // 试用期员工每月有 2 次 补卡机会,超过 2 次不足 5 次的部分,按 10 元 / 次处罚,5 次及以上的漏卡,按 50 元 / 次处罚;
  241. // 正式员工每月 3 次以内的补卡,按 10 元 / 次处罚,3 次及以上的漏卡,按 50 元 / 次处罚。
  242. sickLeave_deduction = 0.00M,
  243. other_deduction = 0.00M; // 其他 扣款金额
  244. decimal meal_deduction = 0.00M; // 餐补 扣款金额
  245. decimal reissuecard_deduction = 0.00M; // 补卡 扣款金额
  246. //打卡数据
  247. Data? checkInData = checkInDatas.Where(it => it.base_info.name == item.Name).FirstOrDefault();
  248. if (checkInData == null) { continue; }
  249. string acctid = checkInData.base_info.acctid; //用户Id
  250. //当月总计数据
  251. Summary_Info? summary_Info = checkInData.summary_info;
  252. if (summary_Info == null ) { continue; }
  253. int work_days = summary_Info.work_days; //应出勤天数
  254. int regular_days = summary_Info.regular_days; //正常出勤天数
  255. meal_subsidy = work_days * 10; //应发放餐补
  256. #region 计算日工资 正常日薪 事假日薪 病假日薪
  257. //月 - 应发工资
  258. decimal amountPayable = pm_wsInfo.Basic + pm_wsInfo.Floats + pm_wsInfo.PostAllowance + pm_wsInfo.GarmentWashSubsidies + pm_wsInfo.CommunicationSubsidies +
  259. pm_wsInfo.TrafficSubsidies + pm_wsInfo.InformationSecurityFee + pm_wsInfo.OperationBonus + pm_wsInfo.SpecialAllowance + pm_wsInfo.OtherSubsidies + pm_wsInfo.GroupCost;
  260. // 日薪 = 事假日薪 *计算方式:日平均工资 = 月工资/当月应出勤天数。
  261. decimal dailyWage = amountPayable / work_days;
  262. // 病假日薪 *计算方式:日平均工资 = 成都市最低工资标准的80%/当月应出勤天数。 短期病假=当月15天内
  263. decimal sickLeave_dailywage = _chengDuMinimumWage / work_days;
  264. //病假 一天扣款
  265. sickLeave_deduction = dailyWage - sickLeave_dailywage;
  266. #endregion
  267. int annualLeaveNum = 0, //年假
  268. personalLeaveNum = 0, //事假
  269. sickLeaveNum = 0, //病假
  270. lieuLeaveNum = 0, //调休假
  271. marriageLeaveNum = 0, //婚嫁
  272. maternityLeaveNum = 0, //产假
  273. paternityLeaveNum = 0, //陪产假
  274. funeralLeaveNum = 0, //丧假
  275. reissueCardNum = 0, //补卡 次数
  276. evectionNum = 0, //出差 次数
  277. outIngNum = 0, //外出 次数
  278. outWorkNum = 0, //外勤 次数
  279. otherLeaveNum = 0; //其他
  280. #region 假勤 处理 1-请假;2-补卡;3-出差;4-外出;100-外勤;
  281. List<Sp_Item>? sp_items = checkInData.sp_items.Where(it => it.count != 0).ToList();
  282. if (sp_items != null && sp_items.Count > 0)
  283. {
  284. annualLeaveNum = Fallibilitydispose(sp_items, 1, "年假");
  285. personalLeaveNum = Fallibilitydispose(sp_items, 1, "事假");
  286. sickLeaveNum = Fallibilitydispose(sp_items, 1, "病假");
  287. lieuLeaveNum = Fallibilitydispose(sp_items, 1, "调休假");
  288. marriageLeaveNum = Fallibilitydispose(sp_items, 1, "婚嫁");
  289. maternityLeaveNum = Fallibilitydispose(sp_items, 1, "产假");
  290. paternityLeaveNum = Fallibilitydispose(sp_items, 1, "陪产假");
  291. funeralLeaveNum = Fallibilitydispose(sp_items, 1, "丧假");
  292. otherLeaveNum = Fallibilitydispose(sp_items, 1, "其他");
  293. reissueCardNum = Fallibilitydispose(sp_items, 2, "补卡次数");
  294. evectionNum = Fallibilitydispose(sp_items, 3, "出差");
  295. outIngNum = Fallibilitydispose(sp_items, 4, "外出");
  296. outWorkNum = Fallibilitydispose(sp_items, 3, "外勤");
  297. }
  298. #region 请假类型金额/餐补 处理
  299. List<Sp_Info> sp_leave_item_infosData = sp_leave_InfosData.Where(it => it.spname == "请假" && it.apply_name == item.Name).ToList();
  300. foreach (Sp_Info sp_item in sp_leave_item_infosData)
  301. {
  302. Leave? sp_leave = sp_item.leave;
  303. if (sp_leave != null)
  304. {
  305. //leave_type 1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他
  306. switch (sp_leave.leave_type)
  307. {
  308. case 1: //年假
  309. if (sp_leave.timeunit == 0) //半天
  310. {
  311. meal_deduction += 10;
  312. }
  313. else if (sp_leave.timeunit == 1) //小时
  314. {
  315. if (sp_leave.duration >= 3)
  316. {
  317. meal_deduction += 10;
  318. }
  319. }
  320. break;
  321. case 2: //事假 需调整
  322. if (sp_leave.timeunit == 0) //半天
  323. {
  324. meal_deduction += 10;
  325. personalLeaveTotal += dailyWage / 2;
  326. }
  327. else if (sp_leave.timeunit == 1) //小时
  328. {
  329. if (sp_leave.duration >= 3)
  330. {
  331. meal_deduction += 10;
  332. personalLeaveTotal += dailyWage;
  333. }
  334. }
  335. break;
  336. case 3: //病假 需调整
  337. if (sp_leave.timeunit == 0) //半天
  338. {
  339. meal_deduction += 10;
  340. sickLeaveTotal += sickLeave_deduction / 2;
  341. }
  342. else if (sp_leave.timeunit == 1) //小时
  343. {
  344. if (sp_leave.duration >= 3) //7.5小时 一天
  345. {
  346. meal_deduction += 10;
  347. sickLeaveTotal += sickLeave_deduction;
  348. }
  349. }
  350. break;
  351. case 4: //调休假
  352. if (sp_leave.timeunit == 0) //半天
  353. {
  354. meal_deduction += 10;
  355. }
  356. else if (sp_leave.timeunit == 1) //小时
  357. {
  358. if (sp_leave.duration >= 3) //7.5小时 一天
  359. {
  360. meal_deduction += 10;
  361. }
  362. }
  363. break;
  364. case 5: //婚假
  365. if (sp_leave.timeunit == 0) //半天
  366. {
  367. meal_deduction += 10;
  368. }
  369. else if (sp_leave.timeunit == 1) //小时
  370. {
  371. if (sp_leave.duration >= 3) //7.5小时 一天
  372. {
  373. meal_deduction += 10;
  374. }
  375. }
  376. break;
  377. case 6: //产假
  378. if (sp_leave.timeunit == 0) //半天
  379. {
  380. meal_deduction += 10;
  381. }
  382. else if (sp_leave.timeunit == 1) //小时
  383. {
  384. if (sp_leave.duration >= 3) //7.5小时 一天
  385. {
  386. meal_deduction += 10;
  387. }
  388. }
  389. break;
  390. case 7: //陪产假
  391. if (sp_leave.timeunit == 0) //半天
  392. {
  393. meal_deduction += 10;
  394. }
  395. else if (sp_leave.timeunit == 1) //小时
  396. {
  397. if (sp_leave.duration >= 3) //7.5小时 一天
  398. {
  399. meal_deduction += 10;
  400. }
  401. }
  402. break;
  403. default:
  404. break;
  405. }
  406. }
  407. }
  408. #endregion
  409. #region 补卡 处理
  410. if (reissueCardNum == 3)
  411. {
  412. reissuecard_deduction += 10;
  413. }
  414. else if (reissueCardNum >= 4)
  415. {
  416. reissuecard_deduction += 50;
  417. }
  418. #endregion
  419. #endregion
  420. //打卡异常处理 统计 1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常;
  421. int beLateNum = 0, // 1-迟到;
  422. leaveEarlyNum = 0, // 2-早退;
  423. dummyDeckNum = 0, // 3-缺卡;
  424. minerNum = 0, // 4-旷工;
  425. locationAnomalyNum = 0, // 5-地点异常;
  426. unitExNum = 0; // 6-设备异常;
  427. if (summary_Info.except_days > 0)
  428. {
  429. List<Exception_Info>? ex_infos = checkInData.exception_infos;
  430. if (ex_infos != null && ex_infos.Count >= 0)
  431. {
  432. beLateNum = ExceptionStatistics(ex_infos, 1);
  433. leaveEarlyNum = ExceptionStatistics(ex_infos, 2);
  434. dummyDeckNum = ExceptionStatistics(ex_infos, 3);
  435. minerNum = ExceptionStatistics(ex_infos, 4);
  436. locationAnomalyNum = ExceptionStatistics(ex_infos, 5);
  437. unitExNum = ExceptionStatistics(ex_infos, 6);
  438. }
  439. }
  440. #region 处理当月工资数据
  441. pm_wsInfo.YearMonth = thisYearMonth;
  442. pm_wsInfo.StartDate = startDt.ToString("yyyy-MM-dd");
  443. pm_wsInfo.EndDate = endDt.ToString("yyyy-MM-dd");
  444. pm_wsInfo.SickLeave = sickLeaveTotal; //病假
  445. pm_wsInfo.SomethingFalse = personalLeaveTotal; //事假
  446. pm_wsInfo.LateTo = beLate_deduction; //迟到
  447. pm_wsInfo.LeaveEarly = early_deduction; //早退
  448. pm_wsInfo.Absenteeism = absenteeism_deduction; //旷工
  449. pm_wsInfo.NotPunch = unprinted_deduction; //未打卡
  450. pm_wsInfo.OtherDeductions = other_deduction; //其他
  451. pm_wsInfo.Mealsupplement = meal_subsidy - meal_deduction; //餐补
  452. decimal salaryTotal = amountPayable; //应发合计
  453. //decimal eductionTotal = ;
  454. decimal actualReleaseTotal = 0.00M; //实发合计
  455. pm_wsInfo.LastUpdateUserId = dto.UserId;
  456. pm_wsInfo.LastUpdateDt = DateTime.Now;
  457. pm_wsInfo.CreateUserId = dto.UserId;
  458. pm_wsInfo.CreateTime = DateTime.Now;
  459. #endregion
  460. wageSheets.Add(pm_wsInfo);
  461. }
  462. return Ok(JsonView(true,"操作成功!", wageSheets));
  463. }
  464. /// <summary>
  465. /// 打卡数据
  466. /// 假勤数据 统计
  467. /// </summary>
  468. /// <param name="datas">数据源</param>
  469. /// <param name="type">
  470. /// 1-请假;2-补卡;3-出差;4-外出;100-外勤;
  471. /// </param>
  472. /// <param name="subTypeName">
  473. /// 年假 事假 病假 调休假 婚嫁 产假 陪产假 丧假 补卡次数 出差 外出数 外勤 其他
  474. /// </param>
  475. /// <returns></returns>
  476. private int Fallibilitydispose(List<Sp_Item> datas, int type,string? subTypeName)
  477. {
  478. int num = 0;
  479. Sp_Item _Info = datas.Where(it => it.type == type && it.name == subTypeName).FirstOrDefault();
  480. if (_Info != null) { num = _Info.count; }
  481. return num;
  482. }
  483. /// <summary>
  484. /// 打卡数据
  485. /// 异常数据 统计
  486. /// </summary>
  487. /// <returns></returns>
  488. private int ExceptionStatistics(List<Exception_Info> datas,int type)
  489. {
  490. int num = 0;
  491. Exception_Info _Info = datas.Where(it => it.exception == type).FirstOrDefault();
  492. if (_Info != null) { num = _Info.count; }
  493. return num;
  494. }
  495. #endregion
  496. }
  497. }