From 84e068b077bfa73253f3395cf568e921acad63d4 Mon Sep 17 00:00:00 2001 From: ndbs Date: Thu, 29 Dec 2022 15:57:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E6=9D=A1=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WageSchedule/WageScheduleService.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/WageSchedule/WageScheduleService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/WageSchedule/WageScheduleService.cs index c53eb3602..90f6ea6d0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/WageSchedule/WageScheduleService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/WageSchedule/WageScheduleService.cs @@ -70,7 +70,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var strSql = new StringBuilder(); strSql.Append(" SELECT t.*,u.F_Account,u.F_RealName FROM WageSchedule t "); strSql.Append($" left join {baseDataName}.dbo.LR_Base_User u on t.empname=u.F_RealName "); - strSql.Append(" where 1=1 "); + strSql.Append(" where 1=1 and u.F_Description='教师' and u.F_DeleteMark = 0"); var userInfo = LoginUserInfo.Get(); var queryParam = queryJson.ToJObject(); // 虚拟参数 @@ -354,22 +354,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration try { //检测是否有空值 - if (dr[1].ToString() == "" || dr[2].ToString() == "" || dr[3].ToString() == "" || dr[4].ToString() == "" || dr[5].ToString() == "" || dr[6].ToString() == "" || dr[26].ToString() == "" || dr[35].ToString() == "") + if (dr[1].ToString() == "" || dr[3].ToString() == "" || dr[4].ToString() == "" || dr[5].ToString() == "" || dr[6].ToString() == "" || dr[26].ToString() == "" || dr[35].ToString() == "") { throw (new Exception("行内必填项数据有空值,不能为空!")); } - if (dr[36].ToString() == "" || dr[37].ToString() == "") - { - throw (new Exception("发放年月不能为空")); - } if (EmpInfoEntities.Count(m => m.EmpName.ToUpper() == dr[1].ToString().ToUpper()) == 0) { throw (new Exception("【姓名】不存在,请核对!")); } - + if (dr[2].ToString() == "") + { + throw (new Exception("【工资卡号】不能为空")); + } + if (dr[36].ToString() == "" || dr[37].ToString() == "") + { + throw (new Exception("发放【年、月】不能为空")); + } if (wageScheduleEntityList.Count(x => x.IssueYear == dr[37].ToString() && x.IssueMonth == dr[36].ToInt() && x.EmpName == dr[1].ToString()) > 0) { - throw (new Exception("当月信息已重复,信息已忽略")); + throw (new Exception("导入信息已重复,信息已忽略")); } //写入要导入的数据 @@ -418,8 +421,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration }; wageScheduleEntityList.Add(wageScheduleEntity); - //删除表中原有姓名,月份,年的数据 - //db.Delete(x => x.EmpName == wageScheduleEntity.EmpName && x.IssueMonth == wageScheduleEntity.IssueMonth && x.IssueYear == wageScheduleEntity.IssueYear); + //删除表中旧数据 及同年同月同名同姓之人 + db.Delete(x => x.EmpName == wageScheduleEntity.EmpName && x.IssueMonth == wageScheduleEntity.IssueMonth && x.IssueYear == wageScheduleEntity.IssueYear); snum++; } catch (Exception ex)