Ver código fonte

Merge branch '西昌分支' of 123.57.209.16:bjquanjiang/DigitalScholl into 西昌分支

西昌缴费二期
liangkun 2 anos atrás
pai
commit
e28e7fc5d6
31 arquivos alterados com 948 adições e 67 exclusões
  1. +83
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs
  2. +14
    -6
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.cshtml
  3. +9
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.js
  4. +26
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.js
  5. +3
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_Punishment/Index.js
  6. +11
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.cshtml
  7. +37
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js
  8. +0
    -5
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Corridor.cshtml
  9. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Dormitory.cshtml
  10. +1
    -6
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Floor.cshtml
  11. +9
    -13
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js
  12. +5
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js
  13. +5
    -6
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js
  14. +2
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js
  15. +4
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml
  16. +16
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js
  17. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml
  18. +16
    -4
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js
  19. +26
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.cshtml
  20. +180
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js
  21. +0
    -5
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Room.cshtml
  22. +0
    -5
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Unit.cshtml
  23. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.cshtml
  24. BIN
      Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AccommodationImport.xls
  25. +5
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  26. +17
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleEntity.cs
  27. +11
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleService.cs
  28. +105
    -4
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs
  29. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs
  30. +355
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs
  31. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs

+ 83
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs Ver arquivo

@@ -8,6 +8,8 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Linq;
using System.IO;
using Learun.Application.Base.SystemModule;

namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
{
@@ -21,6 +23,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
public class AccommodationController : MvcControllerBase
{
private AccommodationIBLL accommodationIBLL = new AccommodationBLL();
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();

#region 视图功能

@@ -208,6 +211,25 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
return View();
}

/// <summary>
/// 分类管理
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult ClearForm()
{
return View();
}

/// <summary>
/// 导入宿舍
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult IndexImport()
{
return View();
}

#endregion

@@ -521,6 +543,67 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
return Success("同步成功");
}

/// <summary>
/// 按条件清空
/// </summary>
/// <returns></returns>
public ActionResult StudentClear(string Grade)
{
accommodationIBLL.ClearEntity(Grade);
return Success("清空成功");
}

/// <summary>
/// 宿舍信息导入模板
/// </summary>
/// <returns></returns>
public ActionResult DownTemplate()
{
FileStreamResult result = null;
try
{
var path = Server.MapPath("~/Content/excel/");
var pathoffull = path + "AccommodationImport.xls";
FileStream fsread = fsread = new FileStream(pathoffull, FileMode.OpenOrCreate, FileAccess.ReadWrite);
result = File(fsread, "application/ms-excel", "宿舍信息导入.xls");

return result;
}
catch (Exception ex)
{
return null;
}
}


/// <summary>
/// 宿舍信息excel文件导入
/// </summary>
/// <param name="templateId"></param>
/// <param name="Filedata"></param>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ExecuteImportExcel(string fileGuid, int chunks)
{
string path = annexesFileIBLL.SaveAnnexes(fileGuid, fileGuid, chunks, LoginUserInfo.Get());
if (!string.IsNullOrEmpty(path))
{
DataTable dt = ExcelHelper.ExcelImport(path);
var res = accommodationIBLL.ExecuteImportExcel(dt, fileGuid);
var data = new
{
Success = res.snum,
Fail = res.failDt.Rows.Count
};
return Success(data);
}
else
{
return Fail("导入数据失败!");
}
}

#endregion

}


+ 14
- 6
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.cshtml Ver arquivo

@@ -11,17 +11,25 @@
<div class="lr-form-item-title">推送人<font face="宋体">*</font></div>
<div id="PushUser" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryRule">
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryRule">
<div class="lr-form-item-title">推送班主任<font face="宋体">*</font></div>
<div id="ClassDiredctor"></div>
<div id="ClassDiredctor" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryRule">
<div class="lr-form-item-title">推送辅导员<font face="宋体">*</font></div>
<div id="CoachTeach" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryRule">
<div class="lr-form-item-title">推送保卫处<font face="宋体">*</font></div>
<div id="Defend" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Acc_DormitoryRule">
<div class="lr-form-item-title">启用<font face="宋体">*</font></div>
<div id="IsEnable" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryRule">
<div class="lr-form-item-title">推送时间点<font face="宋体">*</font></div>
<input id="PushHour" type="number" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请填写0-23数字" />
</div>
<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryRule">
<div class="lr-form-item-title">启用<font face="宋体">*</font></div>
<div id="IsEnable"></div>
</div>
</div>
@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.js")

+ 9
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.js Ver arquivo

@@ -27,6 +27,15 @@ var bootstrap = function ($, learun) {
type: 'radio',
code: 'YesOrNoInt',
});
$('#CoachTeach').lrRadioCheckbox({
type: 'radio',
code: 'YesOrNoInt',
});
$('#Defend').lrRadioCheckbox({
type: 'radio',
code: 'YesOrNoInt',
});
},
initData: function () {
if (!!keyValue) {


+ 26
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.js Ver arquivo

@@ -71,7 +71,7 @@ var bootstrap = function ($, learun) {
headData: [
{ label: "晚归时间", name: "LateReturnTime", width: 100, align: "left" },
{
label: "推送人", name: "PushUser", width: 200, align: "left",
label: "推送人", name: "PushUser", width: 400, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
if (value.indexOf(',') != -1) {
var content = '';
@@ -83,7 +83,7 @@ var bootstrap = function ($, learun) {
key: timearr[i],
keyId: 'f_userid',
callback: function (_data) {
content += _data['f_realname'];
content += _data['f_realname'] + ",";
}
});
}
@@ -113,6 +113,30 @@ var bootstrap = function ($, learun) {
});
}
},
{
label: "推送辅导员", name: "CoachTeach", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem', {
key: value,
code: 'YesOrNoInt',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{
label: "推送保卫处", name: "Defend", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem', {
key: value,
code: 'YesOrNoInt',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{ label: "推送时间点", name: "PushHour", width: 100, align: "left" },
{
label: "启用", name: "IsEnable", width: 100, align: "left",


+ 3
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_Punishment/Index.js Ver arquivo

@@ -148,9 +148,9 @@ var bootstrap = function ($, learun) {
});
}
},
{ label: "奖励", name: "RewardContent", width: 100, align: "left" },
{ label: "奖励时间", name: "RTime", width: 100, align: "left" },
{ label: "奖励原因", name: "RReason", width: 100, align: "left" },
{ label: "惩罚", name: "RewardContent", width: 100, align: "left" },
{ label: "惩罚时间", name: "RTime", width: 100, align: "left" },
{ label: "惩罚原因", name: "RReason", width: 100, align: "left" },
],
mainId: 'ID',
isPage: true


+ 11
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.cshtml Ver arquivo

@@ -0,0 +1,11 @@
@{
ViewBag.Title = "开课计划";
Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="lr-form-wrap" id="form">
<div class="col-xs-12 lr-form-item" data-table="ClassPlanTeach">
<div class="lr-form-item-title">年级<font face="宋体">*</font></div>
<div id="Grade" isvalid="yes" checkexpession="NotNull"></div>
</div>
</div>
@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js")

+ 37
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js Ver arquivo

@@ -0,0 +1,37 @@
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
* 创建人:超级管理员
* 日 期:2021-11-29 11:43
* 描 述:开课计划
*/
var acceptClick;
var keyValue = request('keyValue');
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
$('.lr-form-wrap').lrscroll();
page.bind();
},
bind: function () {
$('#Grade').lrselect({
url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear',
value: 'value',
text: 'text',
allowSearch: true
});
}
};
// 保存数据
acceptClick = function (callBack) {
if (!$('body').lrValidform()) {
return false;
}
var postData = $('#form').lrGetFormData();
var Grade = postData.Grade;
learun.postForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/StudentClear', { Grade: Grade }, function () {
learun.frameTab.currentIframe().refreshGirdData()
});
};
page.init();
}

+ 0
- 5
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Corridor.cshtml Ver arquivo

@@ -45,11 +45,6 @@
left: 0px;
width: 228px
}
.indSec1T > a {
width: fit-content;
padding-left: 6px;
padding-right: 6px;
}
</style>
</head>
<body>


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Dormitory.cshtml Ver arquivo

@@ -103,7 +103,7 @@
<div class="inSec1ImgCon">
<div class="inSec1ImgCon1"><i v-for="count in parseInt(floor.dormitory.Starred>0?floor.dormitory.Starred:0)" class="fa fa-star"></i></div>
<div v-if="floor.dormitory.HasToilet=='1'" class="inSec1ImgCon2"><img src="/Content/images/floor/dorm1-3.png" alt="" /> 独卫</div>
<div v-if="floor.NoStudentNum==0" class="inSec1ImgCon3">满</div>
<div v-if="floor.NoStudentNum==0 && floor.BedNum!=0" class="inSec1ImgCon3">满</div>
</div>
</div>
</div>


+ 1
- 6
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Floor.cshtml Ver arquivo

@@ -168,12 +168,7 @@
key: value,
keyId: 'f_companyid',
callback: function (_data) {
if (!_data.f_fullname || _data.f_fullname == '' || _data.f_fullname == 'undefined') {
result = '';
}
else {
result = _data.f_fullname;
}
result = _data.f_fullname;
}
});



+ 9
- 13
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js Ver arquivo

@@ -97,19 +97,16 @@ var bootstrap = function ($, learun) {
initData: function () {

if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue,
function(data) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
$('#' + id).jfGridSet('refreshdata', data[id]);
} else {
$('[data-table="' + id + '"]').lrSetFormData(data[id]);
}
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, function (data) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
$('#' + id).jfGridSet('refreshdata', data[id]);
}
});
} else {
$('#BuildType').lrselectSet('4');
$('#BuildType').attr('readonly', 'readonly');
else {
$('[data-table="' + id + '"]').lrSetFormData(data[id]);
}
}
});
}
},
initSelect: function () {
@@ -125,7 +122,6 @@ var bootstrap = function ($, learun) {
param: { parentId: '0' },
}
$('#Campus').lrselect(dfop);
$('#Campus').lrselectSet(learun.clientdata.get(['userinfo']).companyId);

}
};


+ 5
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js Ver arquivo

@@ -19,12 +19,14 @@ var bootstrap = function ($, learun) {

$('#Class').lrselect({
value: "classno",
text: "classname"
text: "classname",
allowSearch: true
});

$('#Major').lrselect({
value: "majorno",
text: "majorname",
allowSearch: true,
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "CdMajorInfo", strWhere: "DeptNo='" + Dept + "'" },
select: function (item) {
@@ -50,7 +52,8 @@ var bootstrap = function ($, learun) {
},
initData: function () {
if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, function (data) {
var kv = keyValue.split(',')[0];
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + kv, function (data) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
$('#' + id).jfGridSet('refreshdata', data[id]);


+ 5
- 6
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js Ver arquivo

@@ -25,7 +25,7 @@ var bootstrap = function ($, learun) {
allowSearch: true,
maxHeight: 225,
select: function (item) {
if (item && item.id != '-1') {
if (item&&item.id!='-1') {
$('#BuildType').lrselectSet(item.title);
$('#BuildType').attr('readonly', 'readonly');
} else {
@@ -43,7 +43,7 @@ var bootstrap = function ($, learun) {
type: 'radio',
code: 'HasToilet',
})
//$('#StudentID').lrDataSourceSelect({ code: 'StuInfoBasic', value: 'stuid', text: 'stuname' });
//$('#StudentID').lrDataSourceSelect({ code: 'StuInfoTwo', value: 'stuid', text: 'stuname' });
$('#StudentID').lrselect({
@@ -51,7 +51,7 @@ var bootstrap = function ($, learun) {
text: "stuname",
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic'
});
$('#Class').lrselect({
value: "classno",
text: "classname"
@@ -115,7 +115,7 @@ var bootstrap = function ($, learun) {

if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue,
function (data) {
function(data) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
$('#' + id).jfGridSet('refreshdata', data[id]);
@@ -126,7 +126,6 @@ var bootstrap = function ($, learun) {
});
} else {
$('#ParentID').lrselectSet(ParentID);
$('#ParentID').attr('readonly', 'readonly');
}
},
initSelect: function () {
@@ -142,7 +141,7 @@ var bootstrap = function ($, learun) {
param: { parentId: '0' },
}
$('#Campus').lrselect(dfop);
$('#Campus').lrselectSet(learun.clientdata.get(['userinfo']).companyId);
}
};
// 保存数据


+ 2
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js Ver arquivo

@@ -24,7 +24,8 @@ var bootstrap = function ($, learun) {
},
initData: function () {
if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, function (data) {
var kv = keyValue.split(',')[0];
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + kv, function (data) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
$('#' + id).jfGridSet('refreshdata', data[id]);


+ 4
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml Ver arquivo

@@ -67,7 +67,7 @@
<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>&nbsp;批量添加宿舍</a>
<a id="lr_bedManage" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;床位管理</a>
@*<a id="lr_allocation" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;自动分配宿舍</a>
@*<a id="lr_allocation" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;自动分配宿舍</a>
<a id="lr_syncdata" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;同步宿舍信息</a>*@
</div>
<div class=" btn-group btn-group-sm" learun-authorize="yes">
@@ -79,6 +79,9 @@
<div class=" btn-group btn-group-sm" learun-authorize="yes">
<a id="lr_Classify" class="btn btn-default"><i class="fa fa-tags"></i>&nbsp;<span class="lrlt">分类管理</span></a>
</div>
<div class=" btn-group btn-group-sm" learun-authorize="yes">
<a id="lr_importBed" class="btn btn-default"><i class="fa fa-sign-in"></i>&nbsp;<span class="lrlt">导入</span></a>
</div>
</div>
</div>
<div class="lr-layout-body" id="gridtable"></div>


+ 16
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js Ver arquivo

@@ -280,6 +280,22 @@ var bootstrap = function ($, learun) {
}
});
});

//导入
$("#lr_importBed").on("click", function () {
learun.layerForm({
id: 'indexImport',
title: "导入宿舍信息",
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexImport',
width: 600,
height: 400,
maxmin: true,
btn: null,
end: function () {
refreshGirdData();
}
});
});
},
//初始化左侧树
initTree: function () {


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml Ver arquivo

@@ -80,6 +80,7 @@
<a id="lr_Dept" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;分配系</a>
<a id="lr_Class" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;分配专业班级</a>
<a id="lr_Bed" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;分配宿舍</a>
<a id="lr_Clear" class="btn btn-default"><i class="fa fa-pencil-square"></i>&nbsp;按年级清空</a>
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i>&nbsp;打印</a>
</div>
</div>


+ 16
- 4
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js Ver arquivo

@@ -271,7 +271,7 @@ var bootstrap = function ($, learun) {
if (arrDept.some(function (value, index) {
return value != arrDept[0];
})) {
return learun.alert.warning("选中记录包含多种专业的数据,不可批量分配班级!");
return learun.alert.warning("选中记录包含多种的数据,不可批量分配班级!");
}
}
learun.layerForm({
@@ -308,14 +308,26 @@ var bootstrap = function ($, learun) {
id: 'formRoom',
title: '分配宿舍--' + Name,
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormRoom?keyValue=' + keyValue + '&Class=' + Class + '&Sex=' + Sex,
width: 600,
height: 400,
width: 800,
height: 600,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});

//清空
$("#lr_Clear").on("click", function () {
learun.layerForm({
id: 'form',
title: '按年级清空',
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/ClearForm',
width: 400,
height: 300,
callBack: function (id) {
return top[id].acceptClick();
}
});
});
},
//初始化左侧树
initTree: function () {


+ 26
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.cshtml Ver arquivo

@@ -0,0 +1,26 @@
@{
ViewBag.Title = "Form";
Layout = "~/Views/Shared/_Form.cshtml";
}
<link href="~/Content/webuploader/webuploader.css" rel="stylesheet" />
<script src="~/Content/webuploader/webuploader.nolog.min.js"></script>
@Html.AppendCssFile("/Areas/LR_SystemModule/Views/ExcelImport/ImportForm.css")

<div class="lr-form-layout lr-form-layout-top-bottom">
<div class="lr-form-layout-header">
<div id="lr_add_file_btn"><i class="fa fa-cloud-upload"></i><span class="lrlt">上传文件</span></div>
<div class="webuploader-pick" id="lr_down_file_btn"><i class="fa fa-download"></i><span class="lrlt">下载模板</span></div>
</div>
<div class="lr-form-layout-body">
<div class="lr-form-file-queue-wrap" id="lr_form_file_queue">
<div class="lr-form-file-queue" id="lr_form_file_queue_list">

</div>
<div class="lr-form-file-queue-bg">
<h1><span class="lrlt">试试将电脑里的文件拖拽到此上传</span></h1>
</div>
</div>
</div>
</div>

@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js")

+ 180
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js Ver arquivo

@@ -0,0 +1,180 @@
/*
* 描 述:附件上传管理
*/
var CLId = request('CLId');

var bootstrap = function ($, learun) {
"use strict";
var fileInfo = {};

// 触发合并文件碎片
var mergeFileChunks = function (file) {
var param = {};
param['__RequestVerificationToken'] = $.lrToken;
//param['CLId'] = CLId;
param['fileGuid'] = fileInfo[file.id].fileGuid;
param['fileName'] = fileInfo[file.id].name;
param['chunks'] = fileInfo[file.id].chunks;
learun.httpAsyncPost(top.$.rootUrl + "/LogisticsManagement/Accommodation/ExecuteImportExcel", param, function (res) {
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.find('.lr-uploader-progress').remove();
if (res.code == learun.httpCode.success) {
if (res.data.Success != '0') {
learun.alert.success('导入成功' + res.data.Success + '条');
}
// 文件保存成功后
$fileItem.append('<div class="lr-msg2"><span>' + res.data.Success + '</span><span>/</span><span style="color:#b94a48;" >' + res.data.Fail + '</span></div>');
// 如果有失败
if (res.data.Fail != '0')
{
learun.download({ url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/DownImportErrorFile', param: { fileId: fileInfo[file.id].fileGuid, fileName: fileInfo[file.id].name, __RequestVerificationToken: $.lrToken }, method: 'POST' });
}

// 文件保存成功后
//$fileItem.append('<div class="lr-msg"><i class="fa fa-check-circle"></i></div>');
//$fileItem.append('<div class="lr-tool-bar"><i class="fa fa-minus-circle" title="删除" data-value="' + file.id + '" ></i></div>');

// $fileItem.find('.lr-tool-bar .fa-minus-circle').on('click', function () {
// var fileId = $(this).attr('data-value');
// DeleteFile(fileId);
// });
// learun.alert.success(res.data.info);
}
else {
learun.alert.error(res.info);
$fileItem.append('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>');
}
});
}
// 触发清楚文件碎片
var reomveFileChunks = function (file) {
var param = {};
param['__RequestVerificationToken'] = $.lrToken;
param['fileGuid'] = fileInfo[file.id].fileGuid;
param['chunks'] = fileInfo[file.id].chunks;
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/MergeAnnexesFile", param, function (res) { });
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.find('.lr-uploader-progress').remove();
$fileItem.append('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>');
}
// 删除文件
var DeleteFile = function (fileId) {
var param = {};
param['__RequestVerificationToken'] = $.lrToken;
param['fileId'] = fileInfo[fileId].fileGuid;
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/DeleteAnnexesFile", param, function (res) { });
var file = page.uploader.getFile(fileId);
if (!!file) {
page.uploader.removeFile(file);
}
delete fileInfo[fileId];
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + fileId);
$fileItem.remove();
if ($('#lr_form_file_queue_list>div').length == 0) {
$('#lr_form_file_queue .lr-form-file-queue-bg').show();
}
}

var page = {
uploader: null,
init: function () {
if (!WebUploader.Uploader.support()) {
alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器');
throw new Error('WebUploader does not support the browser you are using.');
}
/*模板下载*/
$('#lr_down_file_btn').on('click', function () {
location.href = top.$.rootUrl + "/LogisticsManagement/Accommodation/DownTemplate";
});

page.uploader = WebUploader.create({
auto: true,
swf: top.$.rootUrl + '/Content/webuploader/Uploader.swf',
// 文件接收服务端。
server: top.$.rootUrl + "/LR_SystemModule/Annexes/UploadAnnexesFileChunk",
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: '#lr_add_file_btn',
dnd: '#lr_form_file_queue',
paste: 'document.body',
disableGlobalDnd: true,
accept: {
extensions: "xls,xlsx"
},
multiple: false,
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
resize: false,
// 文件分片上传
chunked: true,
chunkRetry: 3,
prepareNextFile: true,
chunkSize: '1048576',
// 上传参数
formData: {
__RequestVerificationToken: $.lrToken
}
});
page.uploader.on('fileQueued', page.fileQueued);
page.uploader.on('uploadStart', page.uploadStart);
page.uploader.on('uploadBeforeSend', page.uploadBeforeSend);
page.uploader.on('uploadProgress', page.uploadProgress);
page.uploader.on('uploadSuccess', page.uploadSuccess);
page.uploader.on('uploadError', page.uploadError);
page.uploader.on('uploadComplete', page.uploadComplete);
page.uploader.on('error', page.error);


$('#lr_form_file_queue').mCustomScrollbar({ // 优化滚动条
theme: "minimal-dark"
});

},
fileQueued: function (file) {// 文件加载到队列
fileInfo[file.id] = { name: file.name };
$('#lr_form_file_queue .lr-form-file-queue-bg').hide();
// 添加一条文件记录
var $item = $('<div class="lr-form-file-queue-item" id="lr_filequeue_' + file.id + '" ></div>');
$item.append('<div class="lr-file-image"><img src="' + top.$.rootUrl + '/Content/images/filetype/' + file.ext + '.png"></div>');
$item.append('<span class="lr-file-name">' + file.name + '(' + learun.countFileSize(file.size) + ')</span>');

$('#lr_form_file_queue_list').append($item);
},
uploadStart: function (file) {
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.append('<div class="lr-uploader-progress"><div class="lr-uploader-progress-bar" style="width:0%;"></div></div>');
},
uploadBeforeSend: function (object, data, headers) {
data.chunk = data.chunk || 0;
data.chunks = data.chunks || 1;
fileInfo[data.id].fileGuid = fileInfo[data.id].fileGuid || WebUploader.Base.guid();
data.fileGuid = fileInfo[data.id].fileGuid;
fileInfo[data.id].chunks = data.chunks;
},
uploadProgress: function (file, percentage) {
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.find('.lr-uploader-progress-bar').css('width', (percentage * 100 + '%'));
},
uploadSuccess: function (file, res) {
if (res.code == 200) {// 上传成功
mergeFileChunks(file);
}
else {// 上传失败
reomveFileChunks(file);
}
},
uploadError: function (file, code) {
reomveFileChunks(file);
},
uploadComplete: function (file) {
},
error: function (type) {
switch (type) {
case 'Q_TYPE_DENIED':
learun.alert.error('当前文件类型不允许上传');
break;
};
}
};
page.init();
}

+ 0
- 5
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Room.cshtml Ver arquivo

@@ -45,11 +45,6 @@
left: -60px;
width: 273px;
}
.indSec1T > a {
width: fit-content;
padding-left: 6px;
padding-right: 6px;
}
</style>
</head>
<body>


+ 0
- 5
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Unit.cshtml Ver arquivo

@@ -45,11 +45,6 @@
left: 0px;
width: 225px
}
.indSec1T > a {
width: fit-content;
padding-left: 6px;
padding-right: 6px;
}
</style>
</head>
<body>


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.cshtml Ver arquivo

@@ -36,7 +36,7 @@
<div class=" btn-group btn-group-sm" learun-authorize="yes">
<a id="lr_out" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;学生出宿</a>
<a id="lr_return" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;学生归宿</a>
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑</a>
@*<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑</a>*@
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i>&nbsp;打印</a>
</div>


BIN
Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AccommodationImport.xls Ver arquivo


+ 5
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj Ver arquivo

@@ -1322,6 +1322,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\ClearForm.js" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClassify.js" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormBed.js" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormRoom.js" />
@@ -1332,6 +1333,7 @@
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexClassify.js" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexBed.js" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexDistribution.js" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexImport.js" />
<Content Include="Areas\LogisticsManagement\Views\Acc_DormitoryRule\Form.js" />
<Content Include="Areas\LogisticsManagement\Views\Acc_DormitoryRule\Index.js" />
<Content Include="Areas\LogisticsManagement\Views\ADR_Record\AttendanceReportByWeek.js" />
@@ -7900,6 +7902,9 @@
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic_PayFee\PayFeeIndex.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic_PayFee\PayFeeForm.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic_PayFee\InvoiceForm.cshtml" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\ClearForm.cshtml" />
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexImport.cshtml" />
<Content Include="Content\excel\AccommodationImport.xls" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />


+ 17
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleEntity.cs Ver arquivo

@@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
/// 日 期:2022-03-14 12:05
/// 描 述:宿舍晚归规则
/// </summary>
public class Acc_DormitoryRuleEntity
public class Acc_DormitoryRuleEntity
{
#region 实体成员
/// <summary>
@@ -64,6 +64,22 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
/// </summary>
[Column("UPDATEUSERID")]
public string UpdateUserId { get; set; }
/// <summary>
///
/// </summary>
[Column("COACHTEACH")]
public int? CoachTeach { get; set; }
/// <summary>
///
/// </summary>
[Column("DEFEND")]
public int? Defend { get; set; }
/// <summary>
///
/// </summary>
[Column("DEFENDID")]
public string DefendId { get; set; }

#endregion

#region 扩展操作


+ 11
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleService.cs Ver arquivo

@@ -1,4 +1,5 @@
using Dapper;
using Learun.Application.Organization;
using Learun.DataBase.Repository;
using Learun.Util;
using System;
@@ -138,14 +139,24 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
{
try
{
var loInfo = LoginUserInfo.Get();
if (!string.IsNullOrEmpty(keyValue))
{
entity.UpdateTime = DateTime.Now;
entity.UpdateUserId = loInfo.account;
entity.Modify(keyValue);
this.BaseRepository("CollegeMIS").Update(entity);
}
else
{
entity.Create();
entity.CreateTime = DateTime.Now;
entity.CreateUserId = loInfo.account;
var NewID = this.BaseRepository().FindEntity<DepartmentEntity>(x => x.F_FullName == "保卫处").F_DepartmentId;
if (NewID != null && entity.Defend == 1)
{
entity.DefendId = NewID;
}
this.BaseRepository("CollegeMIS").Insert(entity);
}
}


+ 105
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs Ver arquivo

@@ -311,11 +311,66 @@ 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);
// }
// }
//}

public List<Acc_DormitoryBuildEntity> GetDept()
{
try
{
return accommodationService.GetSelectData("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList();
return accommodationService.GetDeptOrMajorOrClass("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList();
}
catch (Exception ex)
{
@@ -333,7 +388,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
{
try
{
return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList();
return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList();
}
catch (Exception ex)
{
@@ -351,7 +406,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
{
try
{
return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList();
return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList();
}
catch (Exception ex)
{
@@ -365,7 +420,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
}
}
}

/// <summary>
/// 获取左侧树形数据
/// <summary>
@@ -830,6 +884,53 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement

}
}


/// <summary>
/// 清空实体数据
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
public void ClearEntity(string Grade)
{
try
{
accommodationService.ClearEntity(Grade);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}


public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid)
{
try
{
return accommodationService.ExecuteImportExcel(dt, fileGuid);

}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}

}
}
#endregion

}


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs Ver arquivo

@@ -106,6 +106,10 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
object GetFloorList(string parentID);
object GetRoomList(string parentID);
object GetBedList(string parentID);

void ClearEntity(string Grade);
(DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid);

#endregion

}


+ 355
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs Ver arquivo

@@ -1,5 +1,7 @@
using Dapper;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Cache.Base;
using Learun.Cache.Factory;
using Learun.DataBase.Repository;
using Learun.Util;
using System;
@@ -19,6 +21,10 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
/// </summary>
public class AccommodationService : RepositoryFactory
{
#region 缓存定义
private ICache cache = CacheFactory.CaChe();
private string cacheKey = "Learun_adms_excelError_"; // +公司主键
#endregion
#region 获取数据

/// <summary>
@@ -1709,6 +1715,7 @@ select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (student
{
var parentEntity = db.FindEntity<Acc_DormitoryBuildEntity>(ParentID);
entity.Create();
entity.DNo = entity.Name.Substring(0,entity.Name.Length-1);
entity.ApartmentId = parentEntity.ApartmentId;
entity.UnitId = parentEntity.UnitId;
entity.FloorId = parentEntity.FloorId;
@@ -1866,6 +1873,354 @@ where ID='{ParentID}'
}
}

/// <summary>
/// 按年级清空
/// </summary>
public void ClearEntity(string Grade)
{
try
{
BaseRepository("CollegeMIS").ExecuteBySql($"delete from Acc_DormitoryBuild where StudentID in(select StuNo from StuInfoBasic where Grade ='{Grade}')");
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}


public List<Acc_DormitoryBuildEntity> GetDeptOrMajorOrClass(string strWhere)
{
try
{
string sql1 = " select distinct dept,d.DeptName from Acc_DormitoryBuild t join CdDept d on t.dept=d.deptno";
string sql2 = " select distinct major,m.MajorName from Acc_DormitoryBuild t join CdMajor m on t.major=m.majorno";
string sql3 = " select distinct class,c.ClassName from Acc_DormitoryBuild t join ClassInfo c on t.class=c.classno";
string sql = @" 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 = sql1 + sql;
}
else if (strWhere.Contains("deptno"))
{
sql = sql2 + sql + " and " + strWhere;
}
else if (strWhere.Contains("majorno"))
{
sql = sql3 + 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>
/// <param name="dt"></param>
/// <returns></returns>
public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid)
{
int snum = 0;
int fnum = 0;
var db = this.BaseRepository("CollegeMIS");
var msg = "";
try
{
db.BeginTrans();
var dormitoryBuildList = db.FindList<Acc_DormitoryBuildEntity>().ToList();

//系 专业 班级
var deptList = db.FindList<CdDeptEntity>();
var majorList = db.FindList<CdMajorEntity>(x => x.CheckMark == true);
var classList = db.FindList<ClassInfoEntity>(x => x.CheckMark == true);
//学生
var stuinfobasic = db.FindList<StuInfoBasicEntity>();
// 创建一个datatable容器用于保存导入失败的数据
DataTable failDt = new DataTable();
foreach (DataColumn dc in dt.Columns)
{
failDt.Columns.Add(dc.ColumnName, dc.DataType);
}
failDt.Columns.Add("导入错误", typeof(string));
dt.Columns.Add("导入错误", typeof(string));
//寝室Id
var dormitoryIds = new List<string>();

var user = LoginUserInfo.Get();
foreach (DataRow dr in dt.Rows)
{
try
{
if (!string.IsNullOrEmpty(dr["宿舍楼"].ToString().Trim()))
{

//系 专业 班级
var DeptNo = deptList.Where(x => x.DeptName == dr["系部"].ToString().Trim()).FirstOrDefault()?.DeptNo;
var MajorNo = majorList.Where(x => x.MajorName == dr["专业"].ToString().Trim() && x.DeptNo == DeptNo)
.FirstOrDefault()?.MajorNo;
var ClassNo = classList.Where(x => x.ClassName == dr["班级"].ToString()).FirstOrDefault()?.ClassNo;
if (string.IsNullOrEmpty(DeptNo))
{
fnum++;
dr["导入错误"] = "系部导入错误";
failDt.Rows.Add(dr.ItemArray);
continue;
}
if (string.IsNullOrEmpty(MajorNo))
{
fnum++;
dr["导入错误"] = "专业导入错误";
failDt.Rows.Add(dr.ItemArray);
continue;
}
if (string.IsNullOrEmpty(ClassNo))
{
fnum++;
dr["导入错误"] = "班级导入错误";
failDt.Rows.Add(dr.ItemArray);
continue;
}

var leaderno = "";
if (!string.IsNullOrEmpty(dr["舍长学号"].ToString()))
{
//leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo;
leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString()).FirstOrDefault()?.StuNo;
if (string.IsNullOrEmpty(leaderno))
{
fnum++;
dr["导入错误"] = dr["舍长学号"] + "导入错误";
failDt.Rows.Add(dr.ItemArray);
continue;
}
}

var stuno = "";
if (!string.IsNullOrEmpty(dr["学生学号"].ToString()))
{
stuno = stuinfobasic.Where(x => x.StuNo == dr["学生学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo;
if (string.IsNullOrEmpty(stuno))
{
fnum++;
dr["导入错误"] = dr["学生学号"] + "导入错误";
failDt.Rows.Add(dr.ItemArray);
continue;
}
}

var parent = dormitoryBuildList.Where(x => x.Name == "数字化智慧校园").FirstOrDefault();
if (parent == null)
{
parent = new Acc_DormitoryBuildEntity();
parent.Create();
parent.DNo = "";
parent.Name = "数字化智慧校园";
//parent.BuildType = "1";
parent.CreateBy = user.realName;
parent.CreateTime = DateTime.Now;
parent.Campus = user.companyId;
db.Insert(parent);

dormitoryBuildList.Add(parent);
}

//宿舍楼
var apartmentName = dr["宿舍楼"].ToString().Trim();
var apartmentCode = dr["宿舍楼编号"].ToString();
var apartment = dormitoryBuildList.Where(x => x.Name == apartmentName && x.BuildType == "1")
.FirstOrDefault();
if (apartment == null)
{
//添加宿舍楼
apartment = new Acc_DormitoryBuildEntity();
apartment.Create();
apartment.ParentID = parent.ID;
apartment.DNo = apartmentCode;
apartment.Name = apartmentName;
apartment.BuildType = "1";
apartment.CreateBy = user.realName;
apartment.CreateTime = DateTime.Now;
apartment.Campus = user.companyId;
db.Insert(apartment);

dormitoryBuildList.Add(apartment);
}
//单元
var unitName = dr["单元"].ToString().Trim();
var unitCode = dr["单元编号"].ToString();
var unit = dormitoryBuildList.Where(x => x.Name == unitName && x.BuildType == "2" && x.ParentID == apartment.ID)
.FirstOrDefault();
if (unit == null)
{
//添加单元
unit = new Acc_DormitoryBuildEntity();
unit.Create();
unit.ParentID = apartment.ID;
unit.ApartmentId = apartment.ID;
unit.DNo = unitCode;
unit.Name = unitName;
unit.BuildType = "2";
unit.CreateBy = user.realName;
unit.CreateTime = DateTime.Now;
unit.Campus = user.companyId;
db.Insert(unit);

dormitoryBuildList.Add(unit);
}
//楼层
var floorName = dr["楼层"].ToString().Trim();
var floorCode = dr["楼层编号"].ToString();
var floor = dormitoryBuildList.Where(x => x.Name == floorName && x.DNo == floorCode && x.BuildType == "3" && x.ParentID == unit.ID)
.FirstOrDefault();
if (floor == null)
{
//添加楼层
floor = new Acc_DormitoryBuildEntity();
floor.Create();
floor.ParentID = unit.ID;
floor.ApartmentId = apartment.ID;
floor.UnitId = unit.ID;
floor.DNo = floorCode;
floor.Name = floorName;
floor.BuildType = "3";
floor.CreateBy = user.realName;
floor.CreateTime = DateTime.Now;
floor.Campus = user.companyId;
db.Insert(floor);

dormitoryBuildList.Add(floor);
}
//寝室
var dormitoryName = dr["寝室名称"].ToString().Trim();
var dormitoryCode = dr["寝室编号"].ToString().Trim();
var dormitory = dormitoryBuildList.Where(x => x.Name == dormitoryName && x.DNo == dormitoryCode && x.BuildType == "4" && x.ParentID == floor.ID)
.FirstOrDefault();
if (dormitory == null && !string.IsNullOrEmpty(dormitoryName) && !string.IsNullOrEmpty(dormitoryCode))
{
//添加
dormitory = new Acc_DormitoryBuildEntity();
dormitory.Create();
dormitory.Dept = DeptNo;
dormitory.Major = MajorNo;
dormitory.Class = ClassNo;
dormitory.ParentID = floor.ID;
dormitory.ApartmentId = apartment.ID;
dormitory.UnitId = unit.ID;
dormitory.FloorId = floor.ID;
dormitory.DNo = dormitoryCode;
dormitory.Name = dormitoryName;
dormitory.Sex = dr["性别"].ToString() == "女" ? "0" : "1";
dormitory.BuildType = "4";
dormitory.RoomType = Convert.ToInt32(dr["几人寝"].ToString());
dormitory.Leader = leaderno;
dormitory.Starred = "3";
dormitory.CreateBy = user.realName;
dormitory.CreateTime = DateTime.Now;
dormitory.Campus = user.companyId;
db.Insert(dormitory);

dormitoryBuildList.Add(dormitory);
}
dormitoryIds.Add(dormitory.ID);

//床位
var bedName = dr["床位"].ToString().Trim();
var bedCode = bedName.Replace("床", "").Replace("号", "");
var bed = dormitoryBuildList.Where(x => x.Name == bedName && x.DNo == bedCode && x.BuildType == "5" && x.ParentID == dormitory?.ID)
.FirstOrDefault();
if (bed == null && !string.IsNullOrEmpty(bedName) && !string.IsNullOrEmpty(bedCode))
{
bed = new Acc_DormitoryBuildEntity();
bed.Create();
bed.ParentID = dormitory.ID;
bed.ApartmentId = apartment.ID;
bed.UnitId = unit.ID;
bed.FloorId = floor.ID;
bed.DNo = bedCode;
bed.Name = bedName;
bed.Dept = DeptNo;
bed.Major = MajorNo;
bed.Class = ClassNo;
bed.StudentID = stuno;
bed.Leader = leaderno;
bed.BuildType = "5";
bed.CreateBy = user.realName;
bed.CreateTime = DateTime.Now;
bed.Campus = user.companyId;
db.Insert(bed);

dormitoryBuildList.Add(bed);
snum++;
}

}
else
{
break;
}
}
catch (Exception e)
{
fnum++;
dr["导入错误"] = "出现异常:" + e.Message;
failDt.Rows.Add(dr.ItemArray);
continue;
}
}


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)
{
string errordt = failDt.ToJson();

cache.Write<string>(cacheKey + fileGuid, errordt, CacheId.excel);
}
return (failDt, snum, fnum);
}
catch (Exception ex)
{
db.Rollback();
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion 提交数据
}
}

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs Ver arquivo

@@ -83,7 +83,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
{
string sql = @"select (case t.isreturn when 1 then 1 else 0 end) as isreturn,a.Dept,a.Major,a.class from
(
select parentid,isreturn from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0)
select parentid,isreturn from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) and (IsReturn is not null and len(IsReturn)>0)
) t
join Acc_DormitoryBuild a on a.ID=t.parentid where 1=1
";


Carregando…
Cancelar
Salvar