diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs index a022735b9..38b09417d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs @@ -1919,7 +1919,7 @@ where ID='{ParentID}' /// /// /// - public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt,string fileGuid) + public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid) { int snum = 0; int fnum = 0; @@ -1944,7 +1944,9 @@ where ID='{ParentID}' } failDt.Columns.Add("导入错误", typeof(string)); dt.Columns.Add("导入错误", typeof(string)); - var dic = new Dictionary(); + //寝室Id + var dormitoryIds = new List(); + var user = LoginUserInfo.Get(); foreach (DataRow dr in dt.Rows) { @@ -2093,6 +2095,8 @@ where ID='{ParentID}' dormitoryBuildList.Add(dormitory); } + dormitoryIds.Add(dormitory.ID); + //床位 var bedName = dr["床位"].ToString().Trim(); var bedCode = bedName.Replace("床", "").Replace("号", ""); @@ -2138,7 +2142,16 @@ where ID='{ParentID}' } } + db.Commit(); + + //更新寝室入住人数字段 + var ids = string.Join("','", dormitoryIds); + var sql = $@" update a set a.CheckInStu=b.num +from Acc_DormitoryBuild a join (select parentid,count(1) as num from Acc_DormitoryBuild where buildtype='5' and studentid is not null and len(studentid)>0 and parentid in ('{ids}') group by parentid) b + on a.id=b.parentid + where a.id in ('{ids}') and a.buildtype='4'"; + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); // 写入缓存如果有未导入的数据 if (failDt.Rows.Count > 0) {