fix 人员同步离职处理

This commit is contained in:
2024-09-04 11:16:44 +08:00
parent 49687c0f50
commit 7237a7ad23
2 changed files with 40 additions and 5 deletions

View File

@@ -5,7 +5,8 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"Authority": "https://yikatong.isawesome.cn", "Authority": "https://face.jinkosolar.com",
"Factory": "1234", "Factory": "1201",
"HostName": "yikatong.isawesome.cn" "HostName": "face.jinkosolar.com",
"Download":1
} }

View File

@@ -266,7 +266,7 @@ public class GainfoUpdateService : IGainfoUpdateService
CostId = item.KOSTL, CostId = item.KOSTL,
EntryDate = item.createdate, EntryDate = item.createdate,
ResignationDate = item.ZLZRQ, ResignationDate = item.ZLZRQ,
CardType = Convert.ToInt32(item.ZZ_KLX), CardType = SafeParseCardType(item.ZZ_KLX),
Workplace = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM, Workplace = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM,
Factory = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM, Factory = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM,
}; };
@@ -326,7 +326,7 @@ public class GainfoUpdateService : IGainfoUpdateService
ResignationDate = item.ZLZRQ, ResignationDate = item.ZLZRQ,
Workplace = workplace, Workplace = workplace,
Factory = factory, Factory = factory,
CardType = Convert.ToInt32(item.ZZ_KLX) CardType = SafeParseCardType(item.ZZ_KLX)
}).Where(x => x.Code == item.ename).ExecuteCommandAsync(); }).Where(x => x.Code == item.ename).ExecuteCommandAsync();
await _identityUserSyncService.SyncAccountAsync(gainfo.Code, gainfo.Name, gainfo.IdNo, factory); await _identityUserSyncService.SyncAccountAsync(gainfo.Code, gainfo.Name, gainfo.IdNo, factory);
} }
@@ -375,6 +375,30 @@ public class GainfoUpdateService : IGainfoUpdateService
{ {
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync();
} }
else
{
var workplace = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM;
var factory = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM;
await _dbContext.Updateable<GainfoLeaveEntity>().SetColumns(g => new GainfoLeaveEntity
{
InternalNo = item.PERNR,
Name = item.gname,
PositionNo = item.STELL,
Grade = item.ZZ_ZD,
Title = item.Z_ZJ,
Phone = item.phone,
DepartmentNo = item.appellation,
Remark = item.remark,
Degree = item.email,
Werks = item.WERKS,
CostId = item.KOSTL,
EntryDate = item.createdate,
ResignationDate = item.ZLZRQ,
Workplace = workplace,
Factory = factory,
CardType = SafeParseCardType(item.ZZ_KLX)
}).Where(x => x.Code == item.ename).ExecuteCommandAsync();
}
} }
} }
@@ -500,4 +524,14 @@ public class GainfoUpdateService : IGainfoUpdateService
idNo = idNo.TrimStart(); idNo = idNo.TrimStart();
return idNo[..6]; return idNo[..6];
} }
private static int? SafeParseCardType(string ZZ_KLX)
{
if (int.TryParse(ZZ_KLX, out var cardType))
{
return cardType;
}
return null;
}
} }