ソースを参照

分配宿舍

西昌缴费二期
zhangli 2年前
コミット
64d3850e7c
6個のファイルの変更123行の追加43行の削除
  1. +13
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs
  2. +54
    -41
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js
  3. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js
  4. +19
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs
  5. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs
  6. +35
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs

+ 13
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs ファイルの表示

@@ -359,6 +359,19 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
return Success("保存成功!");
}

/// <summary>
/// 寝室分配床位
/// <summary>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
{
//List<Acc_DormitoryBuildEntity> list = strEntity.ToObject<List<Acc_DormitoryBuildEntity>>();
accommodationIBLL.SaveRoom(RoomId, list);
return Success("保存成功!");
}
/// <summary>
/// 学生宿舍的单元、楼层、房间、床位添加
/// </summary>


+ 54
- 41
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js ファイルの表示

@@ -38,8 +38,10 @@ var bootstrap = function ($, learun) {
initData: function () {
if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + keyValue, function (data) {
var html = '';
$('#content').html('');
for (var i = 0; i < data.length; i++) {
var html = '';
html += '<div class="col-xs-12 lr-form-item div12">';
html += '<div class="col-xs-6 lr-form-item">';
html += '<div class="lr-form-item-title">床位</div>';
@@ -52,46 +54,39 @@ var bootstrap = function ($, learun) {
html += '<div class="Student" id="' + data[i].ID + '"></div>';
html += '</div>';
html += '</div>';
$('#content').append(html);

//$('#' + data[i].ID).lrselectRefresh({
// value: "stuid",
// text: "stuname",
// url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
// param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" },
// select: function (item) {
// if (item) {
// console.log(item);
// $.each(arr,
// function (index, value) {
// console.log('arr_index', value);
// console.log('arr_index', value);
// });
// }
$('#' + data[i].ID).lrselect({
value: "stuid",
text: "stuname",
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" },
select: function (item) {
// console.log(item);
var stuid = '';
if (item) {
stuid = item.stuid;

// }
//});
$('#' + data[i].ID).lrselectSet(data[i].StudentID);
}
var id = $(this).attr('id');
//console.log('id', id);
//console.log('item',item);
arr.forEach(item => {
if (item.ID == id) {
//如果存在删除
removeByValue(arr, 'ID', id);

arr.push({ ID: data[i].ID, StudentID: data[i].StudentID });
}
$('#content').html(html);
$('.Student').lrselect({
value: "stuid",
text: "stuname",
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" },
select: function (item) {
if (item) {
console.log(item);
$.each(arr,
function (index, value) {
console.log('arr_index', value);
console.log('arr_index', value);
});
}
});
arr.push({ ID: id, StudentID: stuid });
}
});
$('#' + data[i].ID).lrselectSet(data[i].StudentID);

}
});
//arr.push({ ID: data[i].ID, StudentID: data[i].StudentID });
}
});
}
@@ -99,13 +94,19 @@ var bootstrap = function ($, learun) {
};
// 保存数据
acceptClick = function (callBack) {
if (!$('body').lrValidform()) {
return false;
}
//if (!$('body').lrValidform()) {
// return false;
//}
//var postData = {
// strEntity: JSON.stringify($('body').lrGetFormData())
//};
//console.log('arr',arr);
var postData = {
strEntity: JSON.stringify($('body').lrGetFormData())
list: arr
};
$.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveDeptClass?type=2&keyValue=' + keyValue, postData, function (res) {

$.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveRoom?RoomId=' + keyValue, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
@@ -113,4 +114,16 @@ var bootstrap = function ($, learun) {
});
};
page.init();
//删除数组元素
function removeByValue(arr, attr, value) {
var index = 0;
for (var i in arr) {
if (arr[i][attr] == value) {
index = i;
break;
}
}
arr.splice(index, 1);
}

}

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js ファイルの表示

@@ -458,7 +458,7 @@ var bootstrap = function ($, learun) {
mainId: 'ID',
isPage: true,
isMultiselect: true,
sidx: 'CheckInStu desc,ApartmentId asc,UnitId asc ,FloorId asc ',
sidx: 'CheckInStu asc,ApartmentId asc,UnitId asc ,FloorId asc ',
//sord: 'ASC',
isSubGrid: true, // 是否有子表
subGridExpanded: function (subContentId, rowItem) {


+ 19
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs ファイルの表示

@@ -571,6 +571,25 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
}
}

public void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
{
try
{
accommodationService.SaveRoom(RoomId, list);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

/// <summary>
/// 批量添加单元、楼层、宿舍、床位
/// </summary>


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs ファイルの表示

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

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


+ 35
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs ファイルの表示

@@ -1507,6 +1507,41 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName
}
}

/// <summary>
/// 分配宿舍
/// </summary>
/// <param name="RoomId"></param>
/// <param name="list"></param>
public void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list)
{
var db = this.BaseRepository("CollegeMIS").BeginTrans();
try
{
foreach (var entity in list)
{
string sql = $"update Acc_DormitoryBuild set StudentID='{entity.StudentID}' where ID='{entity.ID}'";
db.ExecuteBySql(sql);
}

int checkInStu = list.Where(x => x.StudentID != null).Count();
string checkInSql = $"update Acc_DormitoryBuild set CheckInStu='{checkInStu}' where ID='{RoomId}'";
db.ExecuteBySql(checkInSql);

db.Commit();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

/// <summary>
/// 同步宿舍信息
/// </summary>


読み込み中…
キャンセル
保存