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 3bdefa34c..960cdd883 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 @@ -1715,6 +1715,7 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student { var parentEntity = db.FindEntity(ParentID); entity.Create(); + entity.DNo = entity.Name.Substring(0,entity.Name.Length-1); entity.ApartmentId = parentEntity.ApartmentId; entity.UnitId = parentEntity.UnitId; entity.FloorId = parentEntity.FloorId; @@ -2004,7 +2005,8 @@ where ID='{ParentID}' var leaderno = ""; if (!string.IsNullOrEmpty(dr["舍长学号"].ToString())) { - leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo; + //leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo; + leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString()).FirstOrDefault()?.StuNo; if (string.IsNullOrEmpty(leaderno)) { fnum++; @@ -2114,7 +2116,7 @@ where ID='{ParentID}' var dormitoryCode = dr["寝室编号"].ToString().Trim(); var dormitory = dormitoryBuildList.Where(x => x.Name == dormitoryName && x.DNo == dormitoryCode && x.BuildType == "4" && x.ParentID == floor.ID) .FirstOrDefault(); - if (dormitory == null) + if (dormitory == null && !string.IsNullOrEmpty(dormitoryName) && !string.IsNullOrEmpty(dormitoryCode)) { //添加 dormitory = new Acc_DormitoryBuildEntity(); @@ -2145,9 +2147,9 @@ where ID='{ParentID}' //床位 var bedName = dr["床位"].ToString().Trim(); var bedCode = bedName.Replace("床", "").Replace("号", ""); - var bed = dormitoryBuildList.Where(x => x.Name == bedName && x.DNo == bedCode && x.BuildType == "5" && x.ParentID == dormitory.ID) + var bed = dormitoryBuildList.Where(x => x.Name == bedName && x.DNo == bedCode && x.BuildType == "5" && x.ParentID == dormitory?.ID) .FirstOrDefault(); - if (bed == null) + if (bed == null && !string.IsNullOrEmpty(bedName) && !string.IsNullOrEmpty(bedCode)) { bed = new Acc_DormitoryBuildEntity(); bed.Create();