Browse Source

宿舍管理限制一个人不能分配到多个床位

临城职教中职
zhangli 2 years ago
parent
commit
53fdb5effe
5 changed files with 38 additions and 14 deletions
  1. +6
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs
  2. +15
    -9
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js
  3. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs
  4. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs
  5. +14
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs

+ 6
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs View File

@@ -463,7 +463,12 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
public ActionResult SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
{
//List<Acc_DormitoryBuildEntity> list = strEntity.ToObject<List<Acc_DormitoryBuildEntity>>();
accommodationIBLL.SaveRoom(RoomId, list);
string res = accommodationIBLL.SaveRoom(RoomId, list);
if (!string.IsNullOrEmpty(res))
{
return Fail(res);
}

return Success("保存成功!");
}



+ 15
- 9
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js View File

@@ -18,7 +18,7 @@ var bootstrap = function ($, learun) {
page.initData();
},
bind: function () {
},
initData: function () {
if (!!keyValue) {
@@ -51,16 +51,16 @@ var bootstrap = function ($, learun) {
value: "stuno",
text: "stuname",
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "StuInfoBasic", strWhere: strWhere },
param: { code: "StuInfoBasic", strWhere: strWhere },
// 是否允许搜索
allowSearch: true,
select: function (item) {
// console.log(item);
// console.log(item);
var stuid = '';
if (item) {
stuid = item.stuno;

}
}
var id = $(this).attr('id');
//console.log('id', id);
//console.log('item',item);
@@ -78,9 +78,9 @@ var bootstrap = function ($, learun) {

//arr.push({ ID: data[i].ID, StudentID: data[i].StudentID });
}
});
}
},
@@ -93,8 +93,14 @@ var bootstrap = function ($, learun) {
//var postData = {
// strEntity: JSON.stringify($('body').lrGetFormData())
//};
//console.log('arr',arr);
//console.log('arr', arr);
for (var i = 0; i < arr.length - 1; i++) {
for (var j = i + 1; j < arr.length; j++) {
if (!!arr[i].StudentID && arr[i].StudentID === arr[j].StudentID) {
return learun.alert.warning('学生不可重复!');
}
}
}
var postData = {
list: arr
};


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

@@ -681,11 +681,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
}
}

public void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
public string SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
{
try
{
accommodationService.SaveRoom(RoomId, list);
return accommodationService.SaveRoom(RoomId, list);
}
catch (Exception ex)
{


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs View File

@@ -83,7 +83,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
void SaveEntity(string keyValue, Acc_DormitoryBuildEntity entity);
void SaveBedEntity(string keyValue,string ParentID, Acc_DormitoryBuildEntity entity);
void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type);
void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list);
string SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list);

/// <summary>
/// 批量添加单元、楼层、房间、床位


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

@@ -1721,13 +1721,25 @@ where ID='{ParentID}'
/// </summary>
/// <param name="RoomId"></param>
/// <param name="list"></param>
public void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
public string SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
{
var db = this.BaseRepository("CollegeMIS").BeginTrans();
try
{
foreach (var entity in list)
{
//判断该学生是否已分配
if (!string.IsNullOrEmpty(entity.StudentID))
{
var count = db.FindList<Acc_DormitoryBuildEntity>().Count(x => x.StudentID == entity.StudentID && x.ID != entity.ID);
if (count > 0)
{
var stuname = db.FindEntity<StuInfoBasicEntity>(x => x.StuNo == entity.StudentID)?.StuName;
return "学生" + stuname + "已分配床位,不可重复分配!";
}
}

//分配床位
string sql = $"update Acc_DormitoryBuild set StudentID='{entity.StudentID}' where ID='{entity.ID}'";
db.ExecuteBySql(sql);
}
@@ -1737,6 +1749,7 @@ where ID='{ParentID}'
db.ExecuteBySql(checkInSql);

db.Commit();
return "";
}
catch (Exception ex)
{


Loading…
Cancel
Save