@@ -208,6 +208,25 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 分配专业和班级 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult FormClass() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 分配宿舍 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult FormRoom() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
@@ -246,26 +265,6 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
var data = accommodationIBLL.GetBedListByRoomId(RoomId).OrderBy(x => x.DNo); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取分类数据 | |||
/// <summary> | |||
/// <param name="queryJson"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetClassifyList(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
var data = accommodationIBLL.GetClassifyList(paginationobj, queryJson).OrderBy(x => x.DNo); | |||
//var jsonData = new | |||
//{ | |||
// rows = data, | |||
// total = paginationobj.total, | |||
// page = paginationobj.page, | |||
// records = paginationobj.records | |||
//}; | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取宿舍楼数据 | |||
@@ -379,7 +378,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
var data = accommodationIBLL.GetClassifyTree(); | |||
return Success(data); | |||
} | |||
#endregion | |||
@@ -398,18 +397,6 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
return Success("删除成功!"); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult DeleteBed(string keyValue, string ParentID) | |||
{ | |||
accommodationIBLL.DeleteBed(keyValue, ParentID); | |||
return Success("删除成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
@@ -423,20 +410,6 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
accommodationIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveBedForm(string keyValue, string ParentID, string strEntity) | |||
{ | |||
Acc_DormitoryBuildEntity entity = strEntity.ToObject<Acc_DormitoryBuildEntity>(); | |||
accommodationIBLL.SaveBedEntity(keyValue, ParentID, entity); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 寝室分配系 | |||
@@ -446,7 +419,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveDeptClass(string keyValue, string strEntity, int type) | |||
public ActionResult SaveDeptClass(string keyValue, string strEntity,int type) | |||
{ | |||
Acc_DormitoryBuildEntity entity = strEntity.ToObject<Acc_DormitoryBuildEntity>(); | |||
accommodationIBLL.SaveDeptClass(keyValue, entity, type); | |||
@@ -463,15 +436,9 @@ 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>>(); | |||
string res = accommodationIBLL.SaveRoom(RoomId, list); | |||
if (!string.IsNullOrEmpty(res)) | |||
{ | |||
return Fail(res); | |||
} | |||
accommodationIBLL.SaveRoom(RoomId, list); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 学生宿舍的单元、楼层、房间、床位添加 | |||
/// </summary> | |||
@@ -483,6 +450,11 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
[AjaxOnly] | |||
public ActionResult DormitoryAdd(string keyValue, string strEntity) | |||
{ | |||
//dynamic entity = JsonConvert.DeserializeObject(strEntity); | |||
//var ElementNum = entity.ElementNum; | |||
//var FloorNum = entity.FloorNum; | |||
//var RoomNum = entity.RoomNUm; | |||
//var BedNum = entity.BedNum; | |||
JObject jsonEntity = JObject.Parse(strEntity); | |||
var elementNum = int.Parse(jsonEntity["ElementNum"].ToString()); | |||
@@ -519,7 +491,9 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
{ | |||
accommodationIBLL.SyncData(); | |||
return Success("同步成功"); | |||
} | |||
//public ActionResult DormitoryAdd(string a,string ) | |||
#endregion | |||
@@ -7,7 +7,6 @@ | |||
var acceptClick; | |||
var Class = request('Class'); | |||
var keyValue = request('keyValue'); | |||
var Sex = request('Sex'); | |||
var arr = []; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
@@ -18,19 +17,29 @@ var bootstrap = function ($, learun) { | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
//$('.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); | |||
// }); | |||
// } | |||
// } | |||
//}); | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + keyValue, function (data) { | |||
$('#content').html(''); | |||
var strWhere = " ClassNo='" + Class + "'"; | |||
if (Sex == '0') { | |||
strWhere += " and GenderNo=0"; | |||
} | |||
else if (Sex == '1') { | |||
strWhere += " and GenderNo=1"; | |||
} | |||
for (var i = 0; i < data.length; i++) { | |||
var html = ''; | |||
html += '<div class="col-xs-12 lr-form-item div12">'; | |||
@@ -48,19 +57,17 @@ var bootstrap = function ($, learun) { | |||
$('#content').append(html); | |||
$('#' + data[i].ID).lrselect({ | |||
value: "stuno", | |||
value: "stuid", | |||
text: "stuname", | |||
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', | |||
param: { code: "StuInfoBasic", strWhere: strWhere }, | |||
// 是否允许搜索 | |||
allowSearch: true, | |||
param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" }, | |||
select: function (item) { | |||
// console.log(item); | |||
// console.log(item); | |||
var stuid = ''; | |||
if (item) { | |||
stuid = item.stuno; | |||
stuid = item.stuid; | |||
} | |||
} | |||
var id = $(this).attr('id'); | |||
//console.log('id', id); | |||
//console.log('item',item); | |||
@@ -78,9 +85,9 @@ var bootstrap = function ($, learun) { | |||
//arr.push({ ID: data[i].ID, StudentID: data[i].StudentID }); | |||
} | |||
}); | |||
} | |||
}, | |||
@@ -93,14 +100,8 @@ var bootstrap = function ($, learun) { | |||
//var postData = { | |||
// strEntity: JSON.stringify($('body').lrGetFormData()) | |||
//}; | |||
//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('学生不可重复!'); | |||
} | |||
} | |||
} | |||
//console.log('arr',arr); | |||
var postData = { | |||
list: arr | |||
}; | |||
@@ -290,7 +290,6 @@ var bootstrap = function ($, learun) { | |||
//分配宿舍 | |||
$("#lr_Bed").on("click", function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
var Sex = $('#gridtable').jfGridValue('Sex'); | |||
var BuildType = $('#gridtable').jfGridValue('BuildType'); | |||
var Name = $('#gridtable').jfGridValue('Name'); | |||
var Class = $('#gridtable').jfGridValue('Class'); | |||
@@ -307,7 +306,7 @@ var bootstrap = function ($, learun) { | |||
learun.layerForm({ | |||
id: 'formRoom', | |||
title: '分配宿舍--' + Name, | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormRoom?keyValue=' + keyValue + '&Class=' + Class + '&Sex=' + Sex, | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormRoom?keyValue=' + keyValue + '&Class=' + Class, | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
@@ -339,273 +338,261 @@ var bootstrap = function ($, learun) { | |||
if (item.text.indexOf("室") > -1) { | |||
selectedParent.ChildType = "5"; | |||
} | |||
var param = {}; | |||
if (item.title == '1') | |||
param.ApartmentId = item.value; | |||
else if (item.title == '2') | |||
param.UnitId = item.value; | |||
else if (item.title == '3') | |||
param.FloorId = item.value; | |||
//page.initGird(); | |||
//page.search({ ParentID: item.value }); | |||
page.search(param); | |||
page.initGird(); | |||
page.search({ ParentID: item.value }); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
//宿舍数据 | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', | |||
headData: [ | |||
{ label: "名称", name: "Name", width: 100, align: "left" }, | |||
{ | |||
label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "单元", name: "UnitName", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "楼层", name: "FloorName", width: 100, align: "left" | |||
}, | |||
//{ | |||
// label: "学生", name: "StudentID", width: 100, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', | |||
// key: value, | |||
// keyId: 'stuid', | |||
// callback: function (_data) { | |||
// callback(_data['stuname']); | |||
// } | |||
// }); | |||
// } | |||
//}, | |||
{ label: "位置", name: "Address", width: 100, align: "left" }, | |||
{ | |||
label: "校区", name: "Campus", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', | |||
key: value, | |||
keyId: 'f_companyid', | |||
callback: function (_data) { | |||
callback(_data['f_fullname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "系", name: "Dept", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', | |||
key: value, | |||
keyId: 'deptno', | |||
callback: function (_data) { | |||
callback(_data['deptname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "专业", name: "Major", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', | |||
key: value, | |||
keyId: 'majorno', | |||
callback: function (_data) { | |||
callback(_data['majorname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "班级", name: "Class", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', | |||
key: value, | |||
keyId: 'classno', | |||
callback: function (_data) { | |||
callback(_data['classname']); | |||
$("#gridtable").empty(); | |||
$("#gridtable")[0].dfop = undefined; | |||
if (selectedParent.BuildType == undefined || selectedParent.BuildType === "3") { | |||
//宿舍数据 | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', | |||
headData: [ | |||
{ label: "名称", name: "Name", width: 100, align: "left" }, | |||
{ | |||
label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "单元", name: "UnitName", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "楼层", name: "FloorName", width: 100, align: "left" | |||
}, | |||
//{ | |||
// label: "学生", name: "StudentID", width: 100, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', | |||
// key: value, | |||
// keyId: 'stuid', | |||
// callback: function (_data) { | |||
// callback(_data['stuname']); | |||
// } | |||
// }); | |||
// } | |||
//}, | |||
{ label: "位置", name: "Address", width: 100, align: "left" }, | |||
{ | |||
label: "校区", name: "Campus", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', | |||
key: value, | |||
keyId: 'f_companyid', | |||
callback: function (_data) { | |||
callback(_data['f_fullname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "系", name: "Dept", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', | |||
key: value, | |||
keyId: 'deptno', | |||
callback: function (_data) { | |||
callback(_data['deptname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "专业", name: "Major", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', | |||
key: value, | |||
keyId: 'majorno', | |||
callback: function (_data) { | |||
callback(_data['majorname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "班级", name: "Class", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', | |||
key: value, | |||
keyId: 'classno', | |||
callback: function (_data) { | |||
callback(_data['classname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "寝室类型", name: "RoomType", width: 100, align: "left", | |||
formatter: function (value, row) { | |||
if (value) { | |||
return value + '人寝'; | |||
} else { | |||
return ''; | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "寝室类型", name: "RoomType", width: 100, align: "left", | |||
formatter: function (value, row) { | |||
if (value) { | |||
return value + '人寝'; | |||
} else { | |||
return ''; | |||
} | |||
} | |||
}, | |||
{ label: "入住人数", name: "CheckInStu", width: 100, align: "left" }, | |||
{ | |||
label: "性别", name: "Sex", width: 100, align: "left", | |||
formatter: function (value, row) { | |||
if (value == '0') | |||
return '女'; | |||
else if (value == '1') | |||
return '男'; | |||
else | |||
return ''; | |||
} | |||
}, | |||
{ label: "入住人数", name: "CheckInStu", width: 100, align: "left" }, | |||
{ | |||
label: "性别", name: "Sex", width: 100, align: "left", | |||
formatter: function (callback, value, row, op, $cell) { | |||
if (value == '0') | |||
return '女'; | |||
else if (value == '1') | |||
return '男'; | |||
else | |||
return ''; | |||
} | |||
}, | |||
{ label: "负责人", name: "Functionary", width: 100, align: "left" }, | |||
{ label: "负责人电话", name: "Phone", width: 100, align: "left" }, | |||
{ label: "备注", name: "Remark", width: 100, align: "left" }, | |||
], | |||
mainId: 'ID', | |||
isPage: true, | |||
isMultiselect: true, | |||
sidx: 'CheckInStu asc,ApartmentId asc,UnitId asc ,FloorId asc ', | |||
//sord: 'ASC', | |||
isSubGrid: true, // 是否有子表 | |||
subGridExpanded: function (subContentId, rowItem) { | |||
$('#' + subContentId).jfGrid({ | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + rowItem.ID, | |||
headData: [ | |||
{ label: "名称", name: "Name", width: 100, align: "left" }, | |||
{ | |||
label: "学生", name: "StudentID", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', | |||
key: value, | |||
keyId: 'stuid', | |||
callback: function (_data) { | |||
callback(_data['stuname']); | |||
} | |||
}); | |||
} | |||
}, | |||
], | |||
mainId: 'ID', | |||
isPage: false, | |||
//sidx: 'DNo', | |||
//sord: 'ASC', | |||
}); | |||
//var param; | |||
//param = param || {}; | |||
//param.ParentID = rowItem.Id; | |||
$('#' + subContentId).jfGridSet('reload'); | |||
}, | |||
{ label: "负责人", name: "Functionary", width: 100, align: "left" }, | |||
{ label: "负责人电话", name: "Phone", width: 100, align: "left" }, | |||
{ label: "备注", name: "Remark", width: 100, align: "left" }, | |||
], | |||
mainId: 'ID', | |||
isPage: true, | |||
isMultiselect: true, | |||
sidx: 'CheckInStu asc,ApartmentId asc,UnitId asc ,FloorId asc ', | |||
//sord: 'ASC', | |||
isSubGrid: true, // 是否有子表 | |||
subGridExpanded: function (subContentId, rowItem) { | |||
$('#' + subContentId).jfGrid({ | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + rowItem.ID, | |||
headData: [ | |||
{ label: "名称", name: "Name", width: 100, align: "left" }, | |||
{ | |||
label: "学生", name: "StudentID", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', | |||
key: value, | |||
keyId: 'stuno', | |||
callback: function (_data) { | |||
callback(_data['stuname']); | |||
} | |||
}); | |||
} | |||
}, | |||
], | |||
mainId: 'ID', | |||
isPage: false, | |||
//sidx: 'DNo', | |||
//sord: 'ASC', | |||
}); | |||
//var param; | |||
//param = param || {}; | |||
//param.ParentID = rowItem.Id; | |||
$('#' + subContentId).jfGridSet('reload'); | |||
}, | |||
subGridHeight: 250, | |||
}); | |||
//$("#gridtable").empty(); | |||
//$("#gridtable")[0].dfop = undefined; | |||
//if (selectedParent.BuildType == undefined || selectedParent.BuildType === "3") { | |||
//} else { | |||
// //lrAuthorizeJfGridLei | |||
// $('#gridtable').jfGrid({ | |||
// url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', | |||
// headData: [ | |||
// { label: "名称", name: "Name", width: 100, align: "left" }, | |||
// { | |||
// label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" | |||
// }, | |||
// { | |||
// label: "单元", name: "UnitName", width: 100, align: "left" | |||
// }, | |||
// { | |||
// label: "楼层", name: "FloorName", width: 100, align: "left" | |||
// }, | |||
// //{ | |||
// // label: "学生", name: "StudentID", width: 100, align: "left", | |||
// // formatterAsync: function (callback, value, row, op, $cell) { | |||
// // learun.clientdata.getAsync('custmerData', { | |||
// // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', | |||
// // key: value, | |||
// // keyId: 'stuid', | |||
// // callback: function (_data) { | |||
// // callback(_data['stuname']); | |||
// // } | |||
// // }); | |||
// // } | |||
// //}, | |||
// { label: "位置", name: "Address", width: 100, align: "left" }, | |||
// { | |||
// label: "校区", name: "Campus", width: 100, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', | |||
// key: value, | |||
// keyId: 'f_companyid', | |||
// callback: function (_data) { | |||
// callback(_data['f_fullname']); | |||
// } | |||
// }); | |||
// } | |||
// }, | |||
// //{ | |||
// // label: "系", name: "Dept", width: 100, align: "left", | |||
// // formatterAsync: function (callback, value, row, op, $cell) { | |||
// // learun.clientdata.getAsync('custmerData', { | |||
// // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', | |||
// // key: value, | |||
// // keyId: 'deptno', | |||
// // callback: function (_data) { | |||
// // callback(_data['deptname']); | |||
// // } | |||
// // }); | |||
// // } | |||
// //}, | |||
// //{ | |||
// // label: "专业", name: "Major", width: 100, align: "left", | |||
// // formatterAsync: function (callback, value, row, op, $cell) { | |||
// // learun.clientdata.getAsync('custmerData', { | |||
// // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', | |||
// // key: value, | |||
// // keyId: 'id', | |||
// // callback: function (_data) { | |||
// // callback(_data['majorname']); | |||
// // } | |||
// // }); | |||
// // } | |||
// //}, | |||
// //{ label: "班级", name: "Class", width: 100, align: "left" }, | |||
// //{ | |||
// // label: "性别", name: "Sex", width: 100, align: "left", | |||
// // formatterAsync: function (callback, value, row, op, $cell) { | |||
// // learun.clientdata.getAsync('dataItem', { | |||
// // key: value, | |||
// // code: 'usersex', | |||
// // callback: function (_data) { | |||
// // callback(_data.text); | |||
// // } | |||
// // }); | |||
// // } | |||
// //}, | |||
// { label: "负责人", name: "Functionary", width: 100, align: "left" }, | |||
// { label: "负责人电话", name: "Phone", width: 100, align: "left" }, | |||
// { label: "备注", name: "Remark", width: 100, align: "left" }, | |||
// ], | |||
// mainId: 'ID', | |||
// isPage: true, | |||
// //isMultiselect: true | |||
// //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', | |||
// //sord: 'ASC', | |||
// }); | |||
//} | |||
subGridHeight: 250, | |||
}); | |||
} else { | |||
//lrAuthorizeJfGridLei | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', | |||
headData: [ | |||
{ label: "名称", name: "Name", width: 100, align: "left" }, | |||
{ | |||
label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "单元", name: "UnitName", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "楼层", name: "FloorName", width: 100, align: "left" | |||
}, | |||
//{ | |||
// label: "学生", name: "StudentID", width: 100, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', | |||
// key: value, | |||
// keyId: 'stuid', | |||
// callback: function (_data) { | |||
// callback(_data['stuname']); | |||
// } | |||
// }); | |||
// } | |||
//}, | |||
{ label: "位置", name: "Address", width: 100, align: "left" }, | |||
{ | |||
label: "校区", name: "Campus", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', | |||
key: value, | |||
keyId: 'f_companyid', | |||
callback: function (_data) { | |||
callback(_data['f_fullname']); | |||
} | |||
}); | |||
} | |||
}, | |||
//{ | |||
// label: "系", name: "Dept", width: 100, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', | |||
// key: value, | |||
// keyId: 'deptno', | |||
// callback: function (_data) { | |||
// callback(_data['deptname']); | |||
// } | |||
// }); | |||
// } | |||
//}, | |||
//{ | |||
// label: "专业", name: "Major", width: 100, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', | |||
// key: value, | |||
// keyId: 'id', | |||
// callback: function (_data) { | |||
// callback(_data['majorname']); | |||
// } | |||
// }); | |||
// } | |||
//}, | |||
//{ label: "班级", name: "Class", width: 100, align: "left" }, | |||
//{ | |||
// label: "性别", name: "Sex", width: 100, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('dataItem', { | |||
// key: value, | |||
// code: 'usersex', | |||
// callback: function (_data) { | |||
// callback(_data.text); | |||
// } | |||
// }); | |||
// } | |||
//}, | |||
{ label: "负责人", name: "Functionary", width: 100, align: "left" }, | |||
{ label: "负责人电话", name: "Phone", width: 100, align: "left" }, | |||
{ label: "备注", name: "Remark", width: 100, align: "left" }, | |||
], | |||
mainId: 'ID', | |||
isPage: true, | |||
//isMultiselect: true | |||
//sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', | |||
//sord: 'ASC', | |||
}); | |||
} | |||
//page.search(); | |||
}, | |||
search: function (param) { | |||
//console.log(param); | |||
param = param || {}; | |||
param.SqlParameter = " AND t.BuildType ='4' "; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
@@ -85,7 +85,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
{ | |||
try | |||
{ | |||
return accommodationService.GetClassifyList(paginationobj, queryJson); | |||
return accommodationService.GetClassifyList(paginationobj,queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -311,61 +311,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
public List<Acc_DormitoryBuildEntity> GetDept() | |||
{ | |||
try | |||
{ | |||
return accommodationService.GetSelectData("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public List<Acc_DormitoryBuildEntity> GetMajor(string strWhere) | |||
{ | |||
try | |||
{ | |||
return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public List<Acc_DormitoryBuildEntity> GetClass(string strWhere) | |||
{ | |||
try | |||
{ | |||
return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
@@ -386,7 +331,8 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
showcheck = false, | |||
checkstate = 0, | |||
isexpand = true, | |||
parentId = item.ParentID == null ? "" : item.ParentID | |||
parentId = item.ParentID == null ? "" : item.ParentID, | |||
title = item.BuildType | |||
}; | |||
@@ -454,6 +400,8 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
} | |||
public List<TreeModel> GetClassifyTree() | |||
{ | |||
try | |||
@@ -471,7 +419,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
checkstate = 0, | |||
isexpand = false, | |||
parentId = item.ParentID == null ? "" : item.ParentID, | |||
title = string.IsNullOrEmpty(item.BuildType) ? "" : (Convert.ToInt32(item.BuildType) + 1).ToString(), | |||
title =string.IsNullOrEmpty(item.BuildType)?"":(Convert.ToInt32(item.BuildType)+1).ToString() , | |||
}; | |||
@@ -541,7 +489,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
/// <summary> | |||
/// <summary> | |||
/// 根据父id 获取树形数据 | |||
/// </summary> | |||
/// <param name="parentID"></param> | |||
@@ -586,11 +534,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
public bool MatchDormitoryInfo(string stuNo, string dormitory, string unit, string floor, string room, string bed, List<Acc_DormitoryBuildEntity> data) | |||
public bool MatchDormitoryInfo(string stuNo,string dormitory,string unit,string floor,string room,string bed ,List<Acc_DormitoryBuildEntity> data) | |||
{ | |||
try | |||
{ | |||
return accommodationService.MatchDormitoryInfo(stuNo, dormitory, unit, floor, room, bed, data); | |||
return accommodationService.MatchDormitoryInfo(stuNo,dormitory,unit,floor,room,bed,data); | |||
} | |||
catch (Exception ex) | |||
@@ -636,31 +584,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public void DeleteBed(string keyValue, string ParentID) | |||
{ | |||
try | |||
{ | |||
accommodationService.DeleteBed(keyValue, ParentID); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="keyValue">主键</param> | |||
@@ -685,38 +608,12 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public void SaveBedEntity(string keyValue, string ParentID, Acc_DormitoryBuildEntity entity) | |||
{ | |||
try | |||
{ | |||
accommodationService.SaveBedEntity(keyValue, ParentID, entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 分配系 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="entity"></param> | |||
public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type) | |||
public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type) | |||
{ | |||
try | |||
{ | |||
@@ -735,11 +632,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
public string SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list) | |||
public void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list) | |||
{ | |||
try | |||
{ | |||
return accommodationService.SaveRoom(RoomId, list); | |||
accommodationService.SaveRoom(RoomId, list); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -809,26 +706,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
public void SyncData() | |||
{ | |||
try | |||
{ | |||
accommodationService.SyncData(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -44,9 +44,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// <summary> | |||
/// <returns></returns> | |||
List<Acc_DormitoryBuildEntity> GetList(); | |||
List<Acc_DormitoryBuildEntity> GetDept(); | |||
List<Acc_DormitoryBuildEntity> GetMajor(string strWhere); | |||
List<Acc_DormitoryBuildEntity> GetClass(string strWhere); | |||
/// <summary> | |||
/// 获取左侧树形数据 | |||
/// <summary> | |||
@@ -74,7 +71,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// <summary> | |||
/// <returns></returns> | |||
void DeleteEntity(string keyValue); | |||
void DeleteBed(string keyValue, string ParentID); | |||
string GetBuildType(string parentID); | |||
string GetParentBuildType(string keyValue); | |||
@@ -84,9 +80,8 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// <summary> | |||
/// <returns></returns> | |||
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); | |||
string SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list); | |||
void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list); | |||
/// <summary> | |||
/// 批量添加单元、楼层、房间、床位 | |||
@@ -100,7 +95,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
void Automatic_allocation_accommodation(bool noNation, bool noPlace); | |||
void SyncData(); | |||
object GetDormitoryList(); | |||
object GetUnitList(string ParentID); | |||
object GetFloorList(string parentID); | |||
@@ -68,10 +68,10 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
dp.Add("ParentID", queryParam["ParentID"].ToString(), DbType.String); | |||
strSql.Append(" AND t.ParentID =@ParentID "); | |||
} | |||
//else | |||
//{ | |||
// strSql.Append(" AND t.BuildType ='4' "); | |||
//} | |||
else | |||
{ | |||
strSql.Append(" AND t.BuildType ='4' "); | |||
} | |||
if (!queryParam["ApartmentId"].IsEmpty()) | |||
{ | |||
@@ -101,17 +101,17 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
} | |||
if (!queryParam["Dept"].IsEmpty()) | |||
{ | |||
dp.Add("Dept", queryParam["Dept"].ToString(), DbType.String); | |||
dp.Add("Dept", "%" + queryParam["Dept"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Dept=@Dept "); | |||
} | |||
if (!queryParam["Class"].IsEmpty()) | |||
{ | |||
dp.Add("Class", queryParam["Class"].ToString(), DbType.String); | |||
dp.Add("Class", "%" + queryParam["Class"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Class=@Class "); | |||
} | |||
if (!queryParam["Major"].IsEmpty()) | |||
{ | |||
dp.Add("Major", queryParam["Major"].ToString(), DbType.String); | |||
dp.Add("Major", "%" + queryParam["Major"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Major=@Major "); | |||
} | |||
if (!queryParam["Sex"].IsEmpty()) | |||
@@ -170,12 +170,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
strSql.Append(" AND t.CheckInStu>0 "); | |||
} | |||
} | |||
if (!queryParam["SqlParameter"].IsEmpty()) | |||
{ | |||
strSql.Append(queryParam["SqlParameter"].ToString()); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(strSql.ToString(), dp, pagination).OrderBy(a => a.Name).ThenBy(a => a.Name).ToList(); | |||
} | |||
catch (Exception ex) | |||
@@ -298,8 +292,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Name Like @Name "); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(strSql.ToString(), dp).ToList(); | |||
//return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(strSql.ToString(), dp, pagination).ToList(); | |||
return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(strSql.ToString(), dp, pagination).ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -318,7 +311,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
{ | |||
try | |||
{ | |||
var entity = this.BaseRepository("CollegeMIS").FindEntity<Acc_DormitoryBuildEntity>(a => a.ParentID == parentID); | |||
var entity = this.BaseRepository("CollegeMIS").FindEntity<Acc_DormitoryBuildEntity>(a => a.ID == parentID); | |||
if (null != entity) | |||
{ | |||
return entity.BuildType; | |||
@@ -624,7 +617,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
floorInfo.dormitory = bed; | |||
if (!string.IsNullOrEmpty(bed.StudentID)) | |||
{ | |||
floorInfo.stuInfo = this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicEntity>(a => a.StuNo == bed.StudentID); | |||
floorInfo.stuInfo = this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicEntity>(a => a.StuId == bed.StudentID); | |||
} | |||
list.Add(floorInfo); | |||
} | |||
@@ -720,7 +713,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(x => (x.BuildType == "2" || x.BuildType == "1")).ToList(); | |||
return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(x => ( x.BuildType == "2" || x.BuildType == "1")).ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -823,78 +816,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
} | |||
} | |||
/// <summary> | |||
/// 获取非空床的系部专业 班级 | |||
/// </summary> | |||
/// <returns></returns> | |||
public List<Acc_DormitoryBuildEntity> GetSelectData(string strWhere) | |||
{ | |||
try | |||
{ | |||
string sql = | |||
@"select distinct dept,d.DeptName,major,m.MajorName,class,c.ClassName from [dbo].[Acc_DormitoryBuild] t | |||
join CdDept d on t.dept=d.deptno | |||
join CdMajor m on t.major=m.majorno | |||
join ClassInfo c on t.class=c.classno | |||
where t.ID in ( | |||
select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) | |||
)"; | |||
if (!string.IsNullOrEmpty(strWhere)) | |||
{ | |||
sql += " and " + strWhere; | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(sql).ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取树形数据(学生归宿) | |||
/// </summary> | |||
/// <returns></returns> | |||
public List<Acc_DormitoryBuildEntity> GetSqlTreeForReturn() | |||
{ | |||
try | |||
{ | |||
List<Acc_DormitoryBuildEntity> list = new List<Acc_DormitoryBuildEntity>(); | |||
var roomSql = @"select * from [dbo].[Acc_DormitoryBuild] where ID in ( | |||
select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) | |||
)"; | |||
List<Acc_DormitoryBuildEntity> roomList = this.BaseRepository("CollegeMIS") | |||
.FindList<Acc_DormitoryBuildEntity>(roomSql).ToList(); | |||
list = roomList.Union(list).ToList(); | |||
var apartIds = roomList.Select(x => x.ApartmentId).Distinct().ToList(); | |||
var unitIds = roomList.Select(x => x.UnitId).Distinct().ToList(); | |||
var floorIds = roomList.Select(x => x.FloorId).Distinct().ToList(); | |||
var otherList = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(x => | |||
apartIds.Contains(x.ID) || unitIds.Contains(x.ID) || floorIds.Contains(x.ID)).ToList(); | |||
list = list.Union(otherList).ToList(); | |||
return list.OrderBy(x => x.DNo).OrderBy(x => x.Name).ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 根据父id获取数据 | |||
/// </summary> | |||
@@ -1100,27 +1021,6 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
} | |||
} | |||
public void DeleteBed(string keyValue, string ParentID) | |||
{ | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<Acc_DormitoryBuildEntity>(t => t.ID == keyValue); | |||
UpdateCheckInNum(ParentID); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
public void DeleteAll(string parentid) | |||
{ | |||
var list = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.ParentID == parentid).ToList(); | |||
@@ -1183,7 +1083,6 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
UpdateTime = DateTime.Now | |||
}; | |||
elementEntity.Create(); | |||
elementEntity.UnitId = elementEntity.ID; | |||
list.Add(elementEntity); | |||
//添加楼层 | |||
@@ -1214,7 +1113,6 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
UpdateTime = DateTime.Now | |||
}; | |||
floorEntity.Create(); | |||
floorEntity.FloorId = floorEntity.ID; | |||
list.Add(floorEntity); | |||
//添加房间 | |||
@@ -1259,9 +1157,6 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
var bedEntity = new Acc_DormitoryBuildEntity | |||
{ | |||
ParentID = roomEntity.ID, | |||
ApartmentId = keyValue, | |||
UnitId = elementEntity.ID, | |||
FloorId = floorEntity.ID, | |||
Name = m.ToString() + "床", | |||
DNo = m.ToString(), | |||
BuildType = "5", | |||
@@ -1613,11 +1508,9 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
if (entity.BuildType == "1") | |||
{ | |||
entity.ApartmentId = entity.ID; | |||
if (string.IsNullOrEmpty(entity.ParentID) || entity.ParentID == "-1") | |||
if (string.IsNullOrEmpty(entity.ParentID)) | |||
{ | |||
var rootNode = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>().FirstOrDefault(a => a.ParentID == null); | |||
if (rootNode == null) | |||
@@ -1643,17 +1536,14 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
} | |||
else | |||
{ | |||
//上一级 | |||
var parentity = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>().FirstOrDefault(a => a.ID == entity.ParentID); | |||
switch (parentity.BuildType) | |||
{ | |||
case "1": | |||
entity.ApartmentId = parentity.ID; | |||
entity.UnitId = entity.ID; | |||
break; | |||
case "2": | |||
{ | |||
entity.FloorId = entity.ID; | |||
entity.UnitId = parentity.ID; | |||
entity.ApartmentId = parentity.ApartmentId; | |||
} | |||
@@ -1668,6 +1558,7 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
} | |||
} | |||
entity.Create(); | |||
entity.CreateBy = currentUser.realName; | |||
entity.CreateTime = DateTime.Now; | |||
entity.UpdateBy = currentUser.realName; | |||
@@ -1688,74 +1579,6 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public void SaveBedEntity(string keyValue, string ParentID, Acc_DormitoryBuildEntity entity) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS"); | |||
try | |||
{ | |||
db.BeginTrans(); | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue); | |||
db.Update(entity); | |||
} | |||
else | |||
{ | |||
var parentEntity = db.FindEntity<Acc_DormitoryBuildEntity>(ParentID); | |||
entity.Create(); | |||
entity.ApartmentId = parentEntity.ApartmentId; | |||
entity.UnitId = parentEntity.UnitId; | |||
entity.FloorId = parentEntity.FloorId; | |||
entity.ParentID = ParentID; | |||
entity.BuildType = "5"; | |||
db.Insert(entity); | |||
} | |||
db.Commit(); | |||
UpdateCheckInNum(ParentID); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
private void UpdateCheckInNum(string ParentID) | |||
{ | |||
try | |||
{ | |||
string sql = $@"update [dbo].[Acc_DormitoryBuild] set RoomType=( | |||
select count(1) from [dbo].[Acc_DormitoryBuild] where ParentId='{ParentID}' and BuildType='5' | |||
) | |||
where ID='{ParentID}' | |||
"; | |||
this.BaseRepository("CollegeMIS").ExecuteBySql(sql); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type) | |||
{ | |||
try | |||
@@ -1796,25 +1619,13 @@ where ID='{ParentID}' | |||
/// </summary> | |||
/// <param name="RoomId"></param> | |||
/// <param name="list"></param> | |||
public string SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list) | |||
public void 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); | |||
} | |||
@@ -1824,7 +1635,6 @@ where ID='{ParentID}' | |||
db.ExecuteBySql(checkInSql); | |||
db.Commit(); | |||
return ""; | |||
} | |||
catch (Exception ex) | |||
{ | |||