Browse Source

[宿舍导入] 优化已存在的空床位导入学生

新疆体育高职分支
ndbs 10 months ago
parent
commit
fd1add1e12
1 changed files with 45 additions and 2 deletions
  1. +45
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs

+ 45
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs View File

@@ -1715,7 +1715,7 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student
{
var parentEntity = db.FindEntity<Acc_DormitoryBuildEntity>(ParentID);
entity.Create();
entity.DNo = entity.Name.Substring(0,entity.Name.Length-1);
entity.DNo = entity.Name.Substring(0, entity.Name.Length - 1);
entity.ApartmentId = parentEntity.ApartmentId;
entity.UnitId = parentEntity.UnitId;
entity.FloorId = parentEntity.FloorId;
@@ -2149,6 +2149,7 @@ where ID='{ParentID}'
var bedCode = bedName.Replace("床", "").Replace("号", "");
var bed = dormitoryBuildList.Where(x => x.Name == bedName && x.DNo == bedCode && x.BuildType == "5" && x.ParentID == dormitory?.ID)
.FirstOrDefault();
//床位为空
if (bed == null && !string.IsNullOrEmpty(bedName) && !string.IsNullOrEmpty(bedCode))
{
bed = new Acc_DormitoryBuildEntity();
@@ -2173,7 +2174,49 @@ where ID='{ParentID}'
dormitoryBuildList.Add(bed);
snum++;
}

else
{
//床位不为空 学生为空
if (bed.StudentID.IsEmpty())
{
//相同学号的学生提示已分配
var histroystu = db.FindEntity<Acc_DormitoryBuildEntity>(x => x.StudentID == stuno);
if (histroystu != null)
{
fnum++;
dr["导入错误"] = "此学生已分配!";
failDt.Rows.Add(dr.ItemArray);
continue;
}
else
{
//修改已存在的空床位
bed.ParentID = dormitory.ID;
bed.ApartmentId = apartment.ID;
bed.UnitId = unit.ID;
bed.FloorId = floor.ID;
bed.DNo = bedCode;
bed.Name = bedName;
bed.Dept = DeptNo;
bed.Major = MajorNo;
bed.Class = ClassNo;
bed.StudentID = stuno;
bed.Leader = leaderno;
bed.BuildType = "5";
bed.UpdateBy = user.realName;
bed.UpdateTime = DateTime.Now;
db.Update(bed);
snum++;
}
}
else
{
fnum++;
dr["导入错误"] = "此床位已有学生!";
failDt.Rows.Add(dr.ItemArray);
continue;
}
}
}
else
{


Loading…
Cancel
Save