@@ -226,6 +226,24 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 床位管理 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult IndexBed() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 床位管理 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult FormBed() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
@@ -397,6 +415,18 @@ 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> | |||
@@ -410,7 +440,21 @@ 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> | |||
/// 寝室分配系 | |||
/// <param name="keyValue">主键</param> | |||
@@ -439,6 +483,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
accommodationIBLL.SaveRoom(RoomId, list); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 学生宿舍的单元、楼层、房间、床位添加 | |||
/// </summary> | |||
@@ -450,11 +495,6 @@ 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()); | |||
@@ -17,23 +17,7 @@ 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) { | |||
@@ -66,8 +66,9 @@ | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
<a id="lr_dormitoryAdd" class="btn btn-default"><i class="fa fa-pencil-square"></i> 批量添加宿舍</a> | |||
<a id="lr_allocation" class="btn btn-default"><i class="fa fa-pencil-square"></i> 自动分配宿舍</a> | |||
@*<a id="lr_syncdata" class="btn btn-default"><i class="fa fa-pencil-square"></i> 同步宿舍信息</a>*@ | |||
<a id="lr_bedManage" class="btn btn-default"><i class="fa fa-pencil-square"></i> 床位管理</a> | |||
@*<a id="lr_allocation" class="btn btn-default"><i class="fa fa-pencil-square"></i> 自动分配宿舍</a> | |||
<a id="lr_syncdata" class="btn btn-default"><i class="fa fa-pencil-square"></i> 同步宿舍信息</a>*@ | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增宿舍</a> | |||
@@ -247,7 +247,7 @@ var bootstrap = function ($, learun) { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
if (keyValue.indexOf(',') != -1) { | |||
learun.alert.warning("只能选择一条记录!"); | |||
learun.alert.warning("只能选择一条记录进行编辑!"); | |||
return false; | |||
} | |||
learun.layerForm({ | |||
@@ -261,24 +261,10 @@ var bootstrap = function ($, learun) { | |||
} | |||
}); | |||
} | |||
}); | |||
//分类管理 | |||
$("#lr_Classify").on("click", function () { | |||
learun.layerForm({ | |||
id: 'indexBed', | |||
title: '分类管理', | |||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexClassify', | |||
width: 1200, | |||
height: 780, | |||
btn: null, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
}, | |||
//初始化左侧树 | |||
initTree: function () { | |||
@@ -1300,6 +1300,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\TeachPlan\Index.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TeachSwitch\Form.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TeachSwitch\Index.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormBed.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormRoom.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClass.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormDept.js" /> | |||
@@ -1310,6 +1311,7 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormDept.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\Allocation.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\DormitoryAdd.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexBed.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexDistribution.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexClassify.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexBed.js" /> | |||
@@ -7584,6 +7586,8 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormDept.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClass.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormRoom.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexBed.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormBed.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -583,6 +583,31 @@ 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> | |||
@@ -607,6 +632,32 @@ 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> | |||
@@ -71,6 +71,7 @@ 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); | |||
@@ -80,6 +81,7 @@ 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); | |||
void SaveRoom(string RoomId, List<Acc_DormitoryBuildEntity> list); | |||
@@ -1021,6 +1021,27 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
} | |||
} | |||
public void DeleteBed(string keyValue, string ParentID) | |||
{ | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<Acc_RewardEntity>(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(); | |||
@@ -1579,6 +1600,74 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||
} | |||
} | |||
/// <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 | |||