@@ -1,4 +1,5 @@ | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using System; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Util; | |||
using System.Data; | |||
using System.Web.Mvc; | |||
@@ -12,9 +13,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
/// 日 期:2022-03-02 10:37 | |||
/// 描 述:教材库存表 | |||
/// </summary> | |||
public class TextbookInOutController : MvcControllerBase | |||
public class TextBookInOutController : MvcControllerBase | |||
{ | |||
private TextbookInOutIBLL textbookInOutIBLL = new TextbookInOutBLL(); | |||
private TextBookInOutIBLL textbookInOutIBLL = new TextbookInOutBLL(); | |||
#region 视图功能 | |||
@@ -25,7 +26,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
@@ -34,7 +35,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
ViewBag.BookCode = "KC" + DateTime.Now.ToString("yyyyMMddHHmm"); | |||
return View(); | |||
} | |||
#endregion | |||
@@ -47,7 +49,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetList( string queryJson ) | |||
public ActionResult GetList(string queryJson) | |||
{ | |||
var data = textbookInOutIBLL.GetList(queryJson); | |||
return Success(data); | |||
@@ -82,8 +84,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var data = textbookInOutIBLL.GetEntity(keyValue); | |||
return Success(data); | |||
var TextBookInOutData = textbookInOutIBLL.GetEntity(keyValue); | |||
var jsonData = new | |||
{ | |||
TextBookInOut = TextBookInOutData, | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
@@ -110,8 +116,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue,TextbookInOutEntity entity) | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
{ | |||
var loginUserInfo = LoginUserInfo.Get(); | |||
TextbookInOutEntity entity = strEntity.ToObject<TextbookInOutEntity>(); | |||
if (string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.IsDel = 0; | |||
entity.FinallyNum = 0; | |||
entity.CreateTime = DateTime.Now; | |||
entity.CrateUserID = loginUserInfo.userId; | |||
} | |||
else | |||
{ | |||
entity.UpTime =DateTime.Now ; | |||
entity.UpUserID = loginUserInfo.userId; | |||
} | |||
textbookInOutIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
@@ -2,50 +2,53 @@ | |||
ViewBag.Title = "教材库存表"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="body"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<script> | |||
var BookCode = "@ViewBag.BookCode"; | |||
</script> | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">库存编码<font face="宋体">*</font></div> | |||
<input id="BookCode" type="text" class="form-control" isvalid="yes" checkexpession="NotNull " /> | |||
<input id="BookCode" type="text" class="form-control" isvalid="yes" checkexpession="NotNull " readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">课程<font face="宋体">*</font></div> | |||
<div id="LessonNo" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-12 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">教材</div> | |||
<input id="TextBookName" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">教材号</div> | |||
<input id="TextBookNo" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">出版号</div> | |||
<input id="PublishNo" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">第一作者</div> | |||
<input id="FirstAuthor" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">其他作者</div> | |||
<input id="OtherAuthor" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">出版社</div> | |||
<input id="Publisher" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">版次</div> | |||
<input id="Edition" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">印次</div> | |||
<input id="Impression" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="TextbookInOut"> | |||
<div class="col-xs-12 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">备注</div> | |||
<textarea id="Remark" class="form-control" style="height:100px;"></textarea> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextbookInOut/Form.js") | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookInOut/Form.js") |
@@ -74,27 +74,35 @@ var bootstrap = function ($, learun) { | |||
$("#Impression").val(item.impression); | |||
} | |||
}); | |||
$('#IsDel').val(0); | |||
$('#FinallyNum').val(0); | |||
$('#CreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); | |||
$('#CreateUserID')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; | |||
$('#CreateUserID').val(learun.clientdata.get(['userinfo']).realName); | |||
}, | |||
initData: function () { | |||
if (!!selectedRow) { | |||
$('#form').lrSetFormData(selectedRow); | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookInOut/GetFormData?keyValue=' + keyValue, function (data) { | |||
console.log(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]); | |||
} | |||
} | |||
}); | |||
} else { | |||
$("#BookCode").val(BookCode); | |||
} | |||
} | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!$('form').lrValidform()) { | |||
if (!$('body').lrValidform()) { | |||
return false; | |||
} | |||
var postData = { | |||
strEntity: JSON.stringify($('form').lrGetFormData()) | |||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||
}; | |||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextbookInOut/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookInOut/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
@@ -29,4 +29,4 @@ | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextbookInOut/Index.js") | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookInOut/Index.js") |
@@ -4,7 +4,6 @@ | |||
* 日 期:2022-03-02 10:37 | |||
* 描 述:教材库存表 | |||
*/ | |||
var selectedRow; | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
@@ -26,13 +25,12 @@ var bootstrap = function ($, learun) { | |||
}); | |||
// 新增 | |||
$('#lr_add').on('click', function () { | |||
selectedRow = null; | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '新增', | |||
url: top.$.rootUrl + '/EducationalAdministration/TextbookInOut/Form', | |||
url: top.$.rootUrl + '/EducationalAdministration/TextBookInOut/Form', | |||
width: 700, | |||
height: 400, | |||
height: 500, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
@@ -41,14 +39,13 @@ var bootstrap = function ($, learun) { | |||
// 编辑 | |||
$('#lr_edit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
selectedRow = $('#gridtable').jfGridGet('rowdata'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/EducationalAdministration/TextbookInOut/Form?keyValue=' + keyValue, | |||
url: top.$.rootUrl + '/EducationalAdministration/TextBookInOut/Form?keyValue=' + keyValue, | |||
width: 700, | |||
height: 400, | |||
height: 500, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
@@ -61,7 +58,7 @@ var bootstrap = function ($, learun) { | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextbookInOut/DeleteForm', { keyValue: keyValue }, function () { | |||
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookInOut/DeleteForm', { keyValue: keyValue }, function () { | |||
}); | |||
} | |||
}); | |||
@@ -70,7 +67,7 @@ var bootstrap = function ($, learun) { | |||
}, | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/EducationalAdministration/TextbookInOut/GetPageList', | |||
url: top.$.rootUrl + '/EducationalAdministration/TextBookInOut/GetPageList', | |||
headData: [ | |||
{ label: '库存单号', name: 'BookCode', width: 200, align: "left" }, | |||
{ | |||
@@ -104,7 +101,8 @@ var bootstrap = function ($, learun) { | |||
], | |||
mainId: 'ID', | |||
isPage: true | |||
isPage: true, | |||
sidx: 'CreateTime desc' | |||
}); | |||
page.search(); | |||
}, | |||
@@ -839,7 +839,7 @@ | |||
<Compile Include="Areas\EducationalAdministration\Controllers\TextBookInfoController.cs" /> | |||
<Compile Include="Areas\EducationalAdministration\Controllers\TextBookIndentController.cs" /> | |||
<Compile Include="Areas\EducationalAdministration\Controllers\TextBookIndentDetailController.cs" /> | |||
<Compile Include="Areas\EducationalAdministration\Controllers\TextbookInOutController.cs" /> | |||
<Compile Include="Areas\EducationalAdministration\Controllers\TextBookInOutController.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="Areas\AdmissionsPlatform\Views\AP_OnlineUserInfo\DropOutIndex.js" /> | |||
@@ -10,9 +10,9 @@ namespace Learun.Application.Mapping | |||
/// 日 期:2022-03-02 10:37 | |||
/// 描 述:教材库存表 | |||
/// </summary> | |||
public class TextbookInOutMap : EntityTypeConfiguration<TextbookInOutEntity> | |||
public class TextBookInOutMap : EntityTypeConfiguration<TextbookInOutEntity> | |||
{ | |||
public TextbookInOutMap() | |||
public TextBookInOutMap() | |||
{ | |||
#region 表、主键 | |||
//表 | |||
@@ -593,7 +593,7 @@ | |||
<Compile Include="EducationalAdministration\TextBookInfoMap.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookIndentMap.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookIndentDetailMap.cs" /> | |||
<Compile Include="EducationalAdministration\TextbookInOutMap.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookInOutMap.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | |||
@@ -12,7 +12,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// 日 期:2022-03-02 10:37 | |||
/// 描 述:教材库存表 | |||
/// </summary> | |||
public class TextbookInOutBLL : TextbookInOutIBLL | |||
public class TextbookInOutBLL : TextBookInOutIBLL | |||
{ | |||
private TextbookInOutService textbookInOutService = new TextbookInOutService(); | |||
@@ -134,6 +134,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <returns></returns> | |||
[Column("REMARK")] | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// IsDel | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("ISDEL")] | |||
public int? IsDel { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// 日 期:2022-03-02 10:37 | |||
/// 描 述:教材库存表 | |||
/// </summary> | |||
public interface TextbookInOutIBLL | |||
public interface TextBookInOutIBLL | |||
{ | |||
#region 获取数据 | |||
@@ -17,39 +17,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// </summary> | |||
public class TextbookInOutService : RepositoryFactory | |||
{ | |||
#region 构造函数和属性 | |||
private string fieldSql; | |||
/// <summary> | |||
/// 构造方法 | |||
/// </summary> | |||
public TextbookInOutService() | |||
{ | |||
fieldSql=@" | |||
t.ID, | |||
t.InorOut, | |||
t.BookCode, | |||
t.LessonNo, | |||
t.PublishNo, | |||
t.TextBookNo, | |||
t.TextBookName, | |||
t.FirstAuthor, | |||
t.OtherAuthor, | |||
t.Pubdate, | |||
t.Publisher, | |||
t.Edition, | |||
t.Impression, | |||
t.CreateTime, | |||
t.CrateUserID, | |||
t.UpTime, | |||
t.UpUserID, | |||
t.FinallyNum, | |||
t.variate, | |||
t.Remark | |||
"; | |||
} | |||
#endregion | |||
#region 获取数据 | |||
/// <summary> | |||
@@ -57,19 +24,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// </summary> | |||
/// <param name="queryJson">条件参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<TextbookInOutEntity> GetList( string queryJson ) | |||
public IEnumerable<TextbookInOutEntity> GetList(string queryJson) | |||
{ | |||
try | |||
{ | |||
//参考写法 | |||
//var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
//var dp = new DynamicParameters(new { }); | |||
//dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); | |||
var queryParam = queryJson.ToJObject(); | |||
//虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(fieldSql); | |||
strSql.Append(" FROM TextbookInOut t "); | |||
strSql.Append("SELECT *"); | |||
strSql.Append(" FROM TextbookInOut t where 1=1 and ISDEl = 0 "); | |||
return this.BaseRepository("CollegeMIS").FindList<TextbookInOutEntity>(strSql.ToString()); | |||
} | |||
catch (Exception ex) | |||
@@ -96,10 +62,16 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(fieldSql); | |||
strSql.Append(" FROM TextbookInOut t "); | |||
return this.BaseRepository("CollegeMIS").FindList<TextbookInOutEntity>(strSql.ToString(), pagination); | |||
strSql.Append("SELECT *"); | |||
strSql.Append(" FROM TextbookInOut t where 1=1 and IsDel = 0 "); | |||
var queryParam = queryJson.ToJObject(); | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["keyword"].IsEmpty()) | |||
{ | |||
strSql.Append(" and ( t.TextBookNo like @keyword or t.TextBookName like @keyword or t.FirstAuthor like @keyword )"); | |||
dp.Add("keyword", "%" + queryParam["keyword"].ToString() + "%", DbType.String); | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<TextbookInOutEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -148,12 +120,21 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<TextbookInOutEntity>(t=>t.ID == keyValue); | |||
var keyValueArr = keyValue.Split(','); | |||
foreach (var item in keyValueArr) | |||
{ | |||
var entity = BaseRepository("CollegeMIS").FindEntity<TextbookInOutEntity>(x => x.ID == item); | |||
entity.IsDel = 1; | |||
db.Update(entity); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
@@ -1802,10 +1802,10 @@ | |||
<Compile Include="EducationalAdministration\TextBookIndentDetail\TextBookIndentDetailService.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookIndentDetail\TextBookIndentDetailIBLL.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookIndentDetail\TextBookIndentDetailBLL.cs" /> | |||
<Compile Include="EducationalAdministration\TextbookInOut\TextbookInOutEntity.cs" /> | |||
<Compile Include="EducationalAdministration\TextbookInOut\TextbookInOutService.cs" /> | |||
<Compile Include="EducationalAdministration\TextbookInOut\TextbookInOutIBLL.cs" /> | |||
<Compile Include="EducationalAdministration\TextbookInOut\TextbookInOutBLL.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookInOut\TextBookInOutEntity.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookInOut\TextBookInOutService.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookInOut\TextBookInOutIBLL.cs" /> | |||
<Compile Include="EducationalAdministration\TextBookInOut\TextBookInOutBLL.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | |||