diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs index 5968fcd23..818b679c0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs @@ -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 /// 描 述:教材库存表 /// - 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(); } /// /// 表单页 @@ -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 /// [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(); + 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("保存成功!"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Form.cshtml index df551850a..32adcf9b9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Form.cshtml @@ -2,50 +2,53 @@ ViewBag.Title = "教材库存表"; Layout = "~/Views/Shared/_Form.cshtml"; } -
-
+ +
+
库存编码*
- +
-
+
课程*
-
+
教材
-
+
教材号
-
+
出版号
-
+
第一作者
-
+
其他作者
-
+
出版社
-
+
版次
-
+
印次
-
+
备注
-@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextbookInOut/Form.js") +@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookInOut/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Form.js index 2f98dbb10..25576af1a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/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(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Index.cshtml index 4967877a2..a0b9f7e45 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Index.cshtml @@ -29,4 +29,4 @@
-@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextbookInOut/Index.js") +@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookInOut/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Index.js index b2cfc80c7..be51f319e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/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(); }, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 0d0983c53..01818d1ac 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -6664,10 +6664,10 @@ - - - - + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextbookInOutMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextbookInOutMap.cs index 0b47760e9..6d4e35cc6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextbookInOutMap.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextbookInOutMap.cs @@ -10,9 +10,9 @@ namespace Learun.Application.Mapping /// 日 期:2022-03-02 10:37 /// 描 述:教材库存表 ///
- public class TextbookInOutMap : EntityTypeConfiguration + public class TextBookInOutMap : EntityTypeConfiguration { - public TextbookInOutMap() + public TextBookInOutMap() { #region 表、主键 //表 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs index 27e84851e..3a803549c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs @@ -12,7 +12,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 日 期:2022-03-02 10:37 /// 描 述:教材库存表 /// - public class TextbookInOutBLL : TextbookInOutIBLL + public class TextbookInOutBLL : TextBookInOutIBLL { private TextbookInOutService textbookInOutService = new TextbookInOutService(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutEntity.cs index 9804e5028..ceb914435 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutEntity.cs @@ -134,6 +134,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("REMARK")] public string Remark { get; set; } + /// + /// IsDel + /// + /// + [Column("ISDEL")] + public int? IsDel { get; set; } + #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs index 706c97878..39a69539c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs @@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 日 期:2022-03-02 10:37 /// 描 述:教材库存表 /// - public interface TextbookInOutIBLL + public interface TextBookInOutIBLL { #region 获取数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs index 7753ab5f1..60712203b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs @@ -17,39 +17,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// public class TextbookInOutService : RepositoryFactory { - #region 构造函数和属性 - - private string fieldSql; - /// - /// 构造方法 - /// - 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 获取数据 /// @@ -57,19 +24,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// 条件参数 /// - public IEnumerable GetList( string queryJson ) + public IEnumerable 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(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(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(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -148,12 +120,21 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 主键 public void DeleteEntity(string keyValue) { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { - this.BaseRepository("CollegeMIS").Delete(t=>t.ID == keyValue); + var keyValueArr = keyValue.Split(','); + foreach (var item in keyValueArr) + { + var entity = BaseRepository("CollegeMIS").FindEntity(x => x.ID == item); + entity.IsDel = 1; + db.Update(entity); + } + db.Commit(); } catch (Exception ex) { + db.Rollback(); if (ex is ExceptionEx) { throw; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index 2f14e2a28..5abd4943f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -1814,6 +1814,10 @@ + + + +