Ver a proveniência

学生宿舍导入 导入成功后更新宿舍的入住人数字段

临城职教中职
zhangli há 2 anos
ascendente
cometimento
fb2428dc2d
1 ficheiros alterados com 15 adições e 2 eliminações
  1. +15
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs

+ 15
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs Ver ficheiro

@@ -1919,7 +1919,7 @@ where ID='{ParentID}'
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
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<string, string>();
//寝室Id
var dormitoryIds = new List<string>();

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)
{


Carregando…
Cancelar
Guardar