From 322430da7067952fa4cbff462006455ff1610989 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 21 Feb 2024 19:27:39 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A4=84=E7=90=86=E5=90=8C=E6=AD=A5gainf?= =?UTF-8?q?o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SyncSapInfo/Job/SyncPersonJob.cs | 86 +++++++++++++------ 1 file changed, 58 insertions(+), 28 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs b/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs index c19272f2..7dfc0596 100644 --- a/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs +++ b/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs @@ -6,6 +6,7 @@ using Dlhis.ScheduledTask.SyncSapInfo.Dto; using Dlhis.ScheduledTask.SyncSapInfo.Comparers; using Dlhis.ScheduledTask.SyncSapInfo.Services; using Kurisu.AspNetCore.Scope; +using Dlhis.Entity.Basic.Enums; namespace Dlhis.ScheduledTask.SyncSapInfo.Job; @@ -113,34 +114,41 @@ public class SyncPersonJob private void InsertPerson(IDbContext db, GainfoSapEntity item) { - //var info = new GainfoEntity - //{ - // No = item.guestno, - // SapNo = item.ano, - // Type = item.@class, - // Name = item.gname, - // Code = item.ename, - // CountryNo = item.country, - // IdClass = item.idcls, - // IdNo = item.idno, - // Native = item.native, - // Gender = item.sex == "F" ? GenderEnumType.Female : GenderEnumType.Male, - // Birthday = (DateTime)item.birthday, - // Address = item.address, - // //Marital 已婚未婚 - // //Occuption = item.occuption, - // DepartmentNo = item.appellation, - // Nation = item.nation, - // Phone = item.phone, - // Degree = item.email, - // Position = item.web, - // //CarNo - // Remark = item.remark, - // Werks = item.WERKS, - // Employed = item.isowner, - //}; - db.Client.Insertable(item).ExecuteCommand(); + + var info = new GainfoEntity + { + No = item.guestno, + SapNo = item.ano, + Type = item.@class, + Name = item.gname, + Code = item.ename, + CountryNo = item.country, + IdClass = item.idcls, + IdNo = item.idno, + Native = item.native, + Gender = item.sex == "F" ? GenderEnumType.Female : GenderEnumType.Male, + Birthday = (DateTime)item.birthday, + Address = item.address, + DepartmentNo = item.appellation, + Nation = item.nation, + Phone = item.phone, + Degree = item.email, + Position = item.web, + Remark = item.remark, + Werks = item.WERKS, + Employed = item.isowner, + }; + + if (item.isowner == "T") + { + db.Client.Insertable(info).ExecuteCommand(); + } + else + { + db.Client.Insertable(info).AS("GainfoLeave").ExecuteCommand(); + } + } private void UpdatePerson(IDbContext db, GainfoSapEntity item) { @@ -149,7 +157,6 @@ public class SyncPersonJob { PERNR = item.PERNR, gname = item.gname, - ename = item.ename, web = item.web, phone = item.phone, appellation = item.appellation, @@ -160,6 +167,29 @@ public class SyncPersonJob }) .Where(x => x.ename == item.ename) .ExecuteCommand(); + + var gainfo = db.Queryable().Where(x => x.Code == item.ename).First(); + if (item.isowner == "T") + { + db.Updateable().SetColumns(g => new GainfoEntity + { + SapNo = item.PERNR, + Name = item.gname, + Position = item.web, + Phone = item.phone, + DepartmentNo = item.appellation, + Remark = item.remark, + Degree = item.email, + Werks = item.WERKS + }) + .Where(x => x.Code == item.ename) + .ExecuteCommand(); + } + else + { + db.Client.Deleteable(gainfo).ExecuteCommand(); + db.Client.Insertable(gainfo).AS("GainfoLeave").ExecuteCommand(); + } } private List GetModifiedPerson(IDbContext db, List sapList)