@@ -134,71 +134,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}
public List<JobPerformanceEntity> GetPeopleType()
{
try
{
string sql = " select distinct PeopleType from JobPerformance where 1=1 and PeopleType is not null order by PeopleType asc ";
return this.BaseRepository("CollegeMIS").FindList<JobPerformanceEntity>(sql).ToList();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
public List<JobPerformanceEntity> GetPostType()
{
try
{
string sql = " select distinct PostType from JobPerformance where 1=1 and PostType is not null order by PostType asc ";
return this.BaseRepository("CollegeMIS").FindList<JobPerformanceEntity>(sql).ToList();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 薪级
/// </summary>
/// <param name="PayGrade"></param>
/// <returns></returns>
public List<JobPerformanceEntity> GetPayGrade()
{
try
{
string sql = " select distinct PayGrade from JobPerformance where 1=1 and PayGrade is not null order by PayGrade asc";
return this.BaseRepository("CollegeMIS").FindList<JobPerformanceEntity>(sql).ToList();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion
#region 提交数据
@@ -316,14 +252,14 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
private ICache cache = CacheFactory.CaChe();
private string cacheKey = "Learun_adms_excelError_"; // +公司主键
#endregion
/// <summary>
/// 工作绩效导入
/// </summary>
/// <param name="dt"></param>
/// <param name="fileId"></param>
/// <returns></returns>
public string SalarySheel Import(DataTable dt, string fileId)
public string JobPerformance Import(DataTable dt, string fileId)
{
try
{
@@ -347,75 +283,106 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
try
{
//检测是否有空值
if (dr[1].ToString() == "" || dr[3].ToString() == "" || dr[6].ToString() == "" || dr[26].ToString() == "" || dr[35].ToString() == "")
if (string.IsNullOrEmpty(dr["发放年份"].ToString()))
{
throw (new Exception("发放年份不能为空!"));
}
if (string.IsNullOrEmpty(dr["发放月份"].ToString()))
{
throw (new Exception("发放月份不能为空!"));
}
if (string.IsNullOrEmpty(dr["姓名"].ToString()))
{
throw (new Exception("姓名不能为空!"));
}
if (string.IsNullOrEmpty(dr["身份证号"].ToString()))
{
throw (new Exception("身份证号不能为空!"));
}
//检测发放年份
decimal year = 0;
bool yearParseResult = decimal.TryParse(dr["发放年份"].ToString(), out year);
if (!yearParseResult || dr["发放年份"].ToString().Length != 4)
{
throw (new Exception("行内必填项数据有空值,不能为空!"));
throw (new Exception("发放年份数据无效 !"));
}
if (EmpInfoEntities.Count(m => m.EmpName.ToUpper() == dr[1].ToString().ToUpper()) == 0)
//检测发放月份
int month = 0;
bool monthParseResult = int.TryParse(dr["发放月份"].ToString(), out month);
if (!monthParseResult)
{
throw (new Exception("【姓名】不存在,请核对!"));
throw (new Exception("发放月份必须为数字 !"));
}
if (dr[2].ToString() == "")
if (month <= 0 || month > 12 )
{
throw (new Exception("【工资卡号】不能为空"));
throw (new Exception("发放月份必须为1-12中间的数字! "));
}
if (dr[36].ToString() == "" || dr[37].ToString() == "")
//检测姓名
var empinfoEntity = EmpInfoEntities.FirstOrDefault(x => x.IdentityCardNo == dr["身份证号"].ToString());
if (empinfoEntity == null)
{
throw (new Exception("发放【年、月】不能为空"));
throw (new Exception("【身份证号】不存在,请核对! "));
}
if (jobPerformanceEntityList.Count(x => x.IssueYear == dr[37].ToString() && x.IssueMonth == dr[36].ToInt() && x.EmpName == dr[1].ToString()) > 0)
//检测重复
if (jobPerformanceEntityList.Count(x => x.IssueYear == dr["发放年份"].ToString() && x.IssueMonth == dr["发放月份"].ToInt() && x.EmpName == empinfoEntity.EmpName && x.EmpNo == empinfoEntity.EmpNo) > 0)
{
throw (new Exception("导入信息已重复,信息已忽略"));
throw (new Exception("导入信息已重复,信息已忽略! "));
}
//写入要导入的数据
JobPerformanceEntity jobPerformanceEntity = new JobPerformanceEntity
{
Id = Guid.NewGuid().ToString(),
//No = dr[0].ToString(),
//EmpName = dr[1].ToString(),
//WageCardNo = dr[2].ToString(),
//PeopleType = dr[3].ToString(),
//PostType = dr[4].ToString(),
//PayGrade = dr[5].ToString(),
//TotalGrossPay = dr[6].ToDecimalOrNull(),
//PostWage = dr[7].ToDecimalOrNull(),
//PayGradeWage = dr[8].ToDecimalOrNull(),
//TenPercent = dr[9].ToDecimalOrNull(),
//BasicsPerformance = dr[10].ToDecimalOrNull(),
//AwardPerformance = dr[11].ToDecimalOrNull(),
//SeparateBasicsPerformance = dr[12].ToDecimalOrNull(),
//SeparateAwardPerformance = dr[13].ToDecimalOrNull(),
//RoughEdgeAllowance = dr[14].ToDecimalOrNull(),
//NationAllowance = dr[15].ToDecimalOrNull(),
//TeachAllowance = dr[16].ToDecimalOrNull(),
//SuperfineTeacherResearch = dr[17].ToDecimalOrNull(),
//Transportation = dr[18].ToDecimalOrNull(),
//RealeState = dr[19].ToDecimalOrNull(),
//WorkKeep = dr[20].ToDecimalOrNull(),
//GirlStaffSanitation = dr[21].ToDecimalOrNull(),
//TeacherAndTown = dr[22].ToDecimalOrNull(),
//HousingAllowance = dr[23].ToDecimalOrNull(),
//HousingFundAllowance = dr[24].ToDecimalOrNull(),
//OtherOne = dr[25].ToDecimalOrNull(),
//DeductionsSubtotal = dr[26].ToDecimalOrNull(),
//AccumulationFund = dr[27].ToDecimalOrNull(),
//EndowmentInsurance = dr[28].ToDecimalOrNull(),
//OccupationalAnnuities = dr[29].ToDecimalOrNull(),
//MedicalInsurance = dr[30].ToDecimalOrNull(),
//UnemploymentInsurance = dr[31].ToDecimalOrNull(),
//LaborUnionWage = dr[32].ToDecimalOrNull(),
//PersonalIncomeTax = dr[33].ToDecimalOrNull(),
//Other = dr[34].ToDecimalOrNull(),
//NetCombined = dr[35].ToDecimalOrNull(),
IssueMonth = dr[36].ToInt(),
IssueYear = dr[37].ToString(),
IssueYear = year.ToString(),
IssueMonth = month,
EmpNo = empinfoEntity.EmpNo,
EmpName = empinfoEntity.EmpName,
Department = dr[2].ToString(),
Post = dr[5].ToString(),
AdminPosition = dr[6].ToDecimalOrNull(),
LeagueSecretary = dr[7].ToDecimalOrNull(),
CenterPeople = dr[8].ToDecimalOrNull(),
TeachingPosition = dr[9].ToDecimalOrNull(),
Director = dr[10].ToDecimalOrNull(),
TeacherWorkRoom = dr[11].ToDecimalOrNull(),
MajorPeople = dr[12].ToDecimalOrNull(),
WorkLeader = dr[13].ToDecimalOrNull(),
TrainAdmin = dr[14].ToDecimalOrNull(),
CommitteeMember = dr[15].ToDecimalOrNull(),
LessonNum = dr[16].ToIntOrNull(),
LessonHour = dr[17].ToDecimalOrNull(),
MorningStudyNum = dr[18].ToIntOrNull(),
MorningStudyHour = dr[19].ToDecimalOrNull(),
NightStudyNum = dr[20].ToIntOrNull(),
NightStudyHour = dr[21].ToDecimalOrNull(),
TwoExerciseNum = dr[22].ToIntOrNull(),
TwoExerciseHour = dr[23].ToDecimalOrNull(),
TempWorkDay = dr[24].ToDecimalOrNull(),
TempWorkScore = dr[25].ToDecimalOrNull(),
OffWorkDay = dr[26].ToIntOrNull(),
OffWorkMinusScore = dr[27].ToDecimalOrNull(),
OnDutyDay = dr[28].ToDecimalOrNull(),
OnDutyScore = dr[29].ToDecimalOrNull(),
ShouldWorkDay = dr[30].ToDecimalOrNull(),
WorkBasicScore = dr[31].ToDecimalOrNull(),
WorkOffCount = dr[32].ToIntOrNull(),
WorkMinusScore = dr[33].ToDecimalOrNull(),
BigActivityMinusScore = dr[34].ToDecimalOrNull(),
AbsenteeismDay = dr[35].ToDecimalOrNull(),
AbsenteeismMinusScore = dr[36].ToDecimalOrNull(),
WorkRemark = dr[37].ToString(),
RoutineBasicScore = dr[38].ToDecimalOrNull(),
RoutineMinusScore = dr[39].ToDecimalOrNull(),
RoutineRemark = dr[40].ToString(),
PerformanceTotalScore = dr[41].ToDecimalOrNull(),
HolidayJobPerformance = dr[42].ToString(),
CreateUser = LoginUserInfo.Get().userId,
CreateTime = DateTime.Now,
F_EnabledMark = "0"
};
jobPerformanceEntityList.Add(jobPerformanceEntity);
//删除表中旧数据 及同年同月同名同姓之人
db.Delete<JobPerformanceEntity>(x => x.EmpName == jobPerformanceEntity.EmpName && x.IssueMonth == jobPerformanceEntity.IssueMonth && x.IssueYear == jobPerformanceEntity.IssueYear);
db.Delete<JobPerformanceEntity>(x => x.EmpName == jobPerformanceEntity.EmpName && x.EmpNo == jobPerformanceEntity.EmpNo && x. IssueMonth == jobPerformanceEntity.IssueMonth && x.IssueYear == jobPerformanceEntity.IssueYear);
snum++;
}
catch (Exception ex)