diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextBookOutController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextBookOutController.cs new file mode 100644 index 000000000..5c1dfbf6d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextBookOutController.cs @@ -0,0 +1,168 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using System.Web.Mvc; +using System.Collections.Generic; +using System; + +namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-05 11:17 + /// 描 述:TextBookOut + /// + public class TextBookOutController : MvcControllerBase + { + private TextBookOutIBLL textBookOutIBLL = new TextBookOutBLL(); + private TextBookInOutIBLL textBookInOutIBLL = new TextbookInOutBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + /// + /// 入库表单页 + /// + /// + [HttpGet] + public ActionResult FormOut() + { + ViewBag.BookCode = "RK" + DateTime.Now.ToString("yyyyMMddHHmmss"); + return View(); + } + /// + /// 明细查看 + /// + /// + [HttpGet] + public ActionResult FormView() + { + return View(); + } + /// + /// 明细删除 + /// + /// + [HttpGet] + public ActionResult FormDelete() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = textBookOutIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var TextBookInOutData = textBookInOutIBLL.GetKCEntity(keyValue); + var TextBookOutData = textBookOutIBLL.GetTextBookOutEntity(TextBookInOutData.BookCode); + var jsonData = new + { + TextBookInOut = TextBookInOutData, + TextBookOut = TextBookOutData, + }; + return Success(jsonData); + } + + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormDataEdit(string keyValue) + { + var TextBookInOutData = textBookInOutIBLL.GetKCEntity(keyValue); + var jsonData = new + { + TextBookInOut = TextBookInOutData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + textBookOutIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, string strEntity, string strTextBookOutList) + { + TextbookInOutEntity entity = strEntity.ToObject(); + List textBookOutList = strTextBookOutList.ToObject>(); + textBookOutIBLL.SaveEntity(keyValue, entity, textBookOutList); + if (keyValue != null) + { + } + return Success("保存成功!"); + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Form.cshtml new file mode 100644 index 000000000..8524b3485 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Form.cshtml @@ -0,0 +1,55 @@ +@{ + ViewBag.Title = "教材库存表"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
库存单
+ +
+
+
课程
+
+
+
+
所选书籍
+ +
+
+
出版号
+ +
+
+
作者
+ +
+
+
其他作者
+ +
+
+
出版社
+ +
+
+
版次
+ +
+
+
当前库存
+ +
+
+
备注
+ +
+
+
明细操作
+ + +
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookOut/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Form.js new file mode 100644 index 000000000..ab6707517 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Form.js @@ -0,0 +1,201 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-02 10:37 + * 描 述:教材库存表 + */ +var acceptClick; +var keyValue = request('keyValue'); +// 设置权限 +var setAuthorize; +// 设置表单数据 +var setFormData; +// 验证数据是否填写完整 +var validForm; +// 保存数据 +var save; +var selectedRow; +var refreshGirdData; +var tempdatra = new Array(); + +var bootstrap = function ($, learun) { + "use strict"; + // 设置权限 + setAuthorize = function (data) { + }; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + $("#detailadd").on('click', function () { + selectedRow = null; + learun.layerForm({ + id: 'formTextBookIn', + title: '申请出库', + url: top.$.rootUrl + '/EducationalAdministration/TextBookOut/FormOut', + width: 700, + height: 380, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + $("#detaildel").on('click', function () { + var keyValue = $('#TextBookOut').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res, index) { + if (res) { + $.each(tempdatra, function (key, val) { + if (tempdatra[key].ID === keyValue) { + tempdatra.splice(key, 1); + } + }); + $('#TextBookOu').jfGridSet('refreshdata', tempdatra); + top.layer.close(index); + } + }); + } + }); + page.bind(); + page.initData(); + }, + bind: function () { + $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); + $('#TextBookOut').jfGrid({ + headData: [ + { label: '出库单', name: 'BookCode', width: 180, align: 'left' }, + { + label: "专业部", name: "DeptNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: value, + keyId: 'deptno', + callback: function (_data) { + callback(_data['deptname']); + } + }); + } + }, + { + label: "专业", name: "MajorNo", width: 120, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', + key: value, + keyId: 'majorno', + callback: function (_data) { + callback(_data['majorname']); + } + }); + } + }, + { + label: "课程", name: "LessonNo", width: 150, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', + key: value, + keyId: 'lessonno', + callback: function (_data) { + callback(_data['lessonname']); + } + }); + } + }, + { + label: "班级", name: "ClassNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', + key: value, + keyId: 'classno', + callback: function (_data) { + callback(_data['classname']); + } + }); + } + }, + { label: '学年', name: 'AcademicYearNo', width: 80, align: 'left' }, + { label: '学期', name: 'Semester', width: 80, align: 'left' }, + { label: '领用人', name: 'Recipient', width: 100, align: 'left' }, + { label: '出库数量', name: 'Variate', width: 100, align: 'left' }, + { label: '出库时间', name: 'CreateTime', width: 200, align: 'left' }, + { label: '出库用户', name: 'CrateUserID', width: 100, align: 'left' }, + { label: '备注', name: 'Remark', width: 100, align: 'left' }, + ], + height: 400, + mainId: 'CreateTime desc', + reloadSelected: false, + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormDataEdit?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]); + } + } + }); + } + } + }; + refreshGirdData = function (temprow) { + var ifnewrow = true; + $.each(tempdatra, function (key, val) { + if (tempdatra[key].BookCode === temprow.InOutBook) { + tempdatra[key] = temprow; + ifnewrow = false; + } + }); + if (ifnewrow) { + tempdatra.push(temprow); + } + + $('#TextBookOut').jfGridSet('refreshdata', tempdatra); + }; + // 设置表单数据 + setFormData = function (processId, param, callback) { + if (!!processId) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormDataByProcessId?processId=' + processId, function (data) { + for (var id in data) { + if (!!data[id] && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); + } + else { + if (id == 'TextBookOut' && data[id]) { + keyValue = data[id].ID; + } + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + } + // 验证数据是否填写完整 + validForm = function () { + var datas = $('#TextBookOut').jfGridGet('rowdatas'); + if (datas == null || datas.length == 0) { + learun.alert.warning("申请未包含出库申请!请先添加入库申请!"); + return false; + } + return true; + }; + // 保存数据 + save = function (callBack) { + var postData = {}; + var formData = $('[data-table="TextBookInOut"]').lrGetFormData(); + postData.strEntity = JSON.stringify(formData); + postData.strTextBookOutList = JSON.stringify($('#TextBookOut').jfGridGet('rowdatas')); + $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormDelete.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormDelete.cshtml new file mode 100644 index 000000000..45a55059f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormDelete.cshtml @@ -0,0 +1,54 @@ +@{ + ViewBag.Title = "教材库存表"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
库存单
+ +
+
+
课程
+
+
+
+
所选书籍
+ +
+
+
出版号
+ +
+
+
作者
+ +
+
+
其他作者
+ +
+
+
出版社
+ +
+
+
版次
+ +
+
+
当前库存
+ +
+
+
备注
+ +
+
+
明细操作
+ +
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookOut/FormDelete.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormDelete.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormDelete.js new file mode 100644 index 000000000..3da830d6a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormDelete.js @@ -0,0 +1,161 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-02 10:37 + * 描 述:教材库存表 + */ +var acceptClick; +var keyValue = request('keyValue'); +// 设置权限 +var setAuthorize; +// 设置表单数据 +var setFormData; +// 验证数据是否填写完整 +var selectedRow; +var refreshGirdData; +var tempdatra = new Array(); + +var bootstrap = function ($, learun) { + "use strict"; + // 设置权限 + setAuthorize = function (data) { + }; + var page = { + init: function () { + //$('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); + $('#TextBookOut').jfGrid({ + headData: [ + { label: '出库单', name: 'BookCode', width: 180, align: 'left' }, + { + label: "专业部", name: "DeptNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: value, + keyId: 'deptno', + callback: function (_data) { + callback(_data['deptname']); + } + }); + } + }, + { + label: "专业", name: "MajorNo", width: 120, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', + key: value, + keyId: 'majorno', + callback: function (_data) { + callback(_data['majorname']); + } + }); + } + }, + { + label: "课程", name: "LessonNo", width: 150, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', + key: value, + keyId: 'lessonno', + callback: function (_data) { + callback(_data['lessonname']); + } + }); + } + }, + { + label: "班级", name: "ClassNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', + key: value, + keyId: 'classno', + callback: function (_data) { + callback(_data['classname']); + } + }); + } + }, + { label: '学年', name: 'AcademicYearNo', width: 80, align: 'left' }, + { label: '学期', name: 'Semester', width: 80, align: 'left' }, + { label: '领用人', name: 'Recipient', width: 100, align: 'left' }, + { label: '出库数量', name: 'Variate', width: 100, align: 'left' }, + { label: '出库时间', name: 'CreateTime', width: 200, align: 'left' }, + { label: '出库用户', name: 'CrateUserID', width: 100, align: 'left' }, + { label: '备注', name: 'Remark', width: 100, align: 'left' }, + ], + height: 400, + mainId: 'CreateTime desc', + reloadSelected: false, + }); + $("#detaildel").on('click', function () { + var NewkeyValue = $('#TextBookOut').jfGridValue('ID'); + if (learun.checkrow(NewkeyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res, index) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/DeleteForm', { keyValue: NewkeyValue }, function () { + refreshGirdData(); + learun.layerClose(window.name); + }); + } + }); + } + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/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]); + } + } + }); + } + } + }; + refreshGirdData = function (temprow) { + var ifnewrow = true; + $.each(tempdatra, function (key, val) { + if (tempdatra[key].BookCode === temprow.InOutBook) { + tempdatra[key] = temprow; + ifnewrow = false; + } + }); + if (ifnewrow) { + tempdatra.push(temprow); + } + + $('#TextBookOut').jfGridSet('refreshdata', tempdatra); + }; + // 设置表单数据 + setFormData = function (processId, param, callback) { + if (!!processId) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormDataByProcessId?processId=' + processId, function (data) { + for (var id in data) { + if (!!data[id] && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); + } + else { + if (id == 'TextBookOut' && data[id]) { + keyValue = data[id].ID; + } + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + callback && callback(); + } + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormOut.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormOut.cshtml new file mode 100644 index 000000000..2e0d17aed --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormOut.cshtml @@ -0,0 +1,50 @@ +@{ + ViewBag.Title = "TextBookOut"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + +
+
+
出库单*
+ +
+
+
学年*
+
+
+
+
学期*
+
+
+
+
专业部*
+
+
+
+
专业*
+
+
+
+
班级*
+
+
+
+
课程*
+
+
+
+
数量*
+ +
+
+
领用人*
+ +
+
+
备注
+ +
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookOut/FormOut.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormOut.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormOut.js new file mode 100644 index 000000000..724364414 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormOut.js @@ -0,0 +1,122 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-05 11:17 + * 描 述:TextBookOut + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#AcademicYearNo').lrselect({ + placeholder: "请选择学年", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear', + value: 'value', + text: 'text' + }); + //学期 + $('#Semester').lrselect({ + placeholder: "请选择学期", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', + value: 'value', + text: 'text' + }); + $('#DeptNo').lrselect({ + allowSearch: true, + value: "deptno", + text: "deptname", + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo', + select: function (item) { + if (item) { + $('#MajorNo').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', + param: { strWhere: "DeptNo='" + item.deptno + "' AND CheckMark=1" } + }); + } else { + $('#MajorNo').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', + param: { strWhere: "1=1 AND CheckMark=1" } + }); + } + + } + }); + $('#MajorNo').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', + value: "majorno", + text: "majorname", + param: { strWhere: "1=1 AND CheckMark=1" }, + select: function (item) { + if (item) { + $('#ClassNo').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', + param: { strWhere: "majorno='" + item.majorno + "' AND CheckMark=1" } + }); + } else { + $('#ClassNo').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', + param: { strWhere: "1=1 AND CheckMark=1" } + }); + } + } + }); + $('#ClassNo').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', + param: { strWhere: "1=1 AND CheckMark=1" }, + value: "classno", + text: "classname" + }); + $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/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]); + } + } + }); + } else { + $("#BookCode").val(OutBookCode); + } + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = $('body').lrGetFormData(); + if (!!keyValue) { + if (!!selectedRow) { + postData.ID = selectedRow.ID; + } + } else { + postData.ID = learun.newGuid(); + } + if (!!callBack) { + callBack(postData); + return true; + } + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormView.cshtml new file mode 100644 index 000000000..f80862a71 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormView.cshtml @@ -0,0 +1,50 @@ +@{ + ViewBag.Title = "教材库存表"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
库存单
+ +
+
+
课程
+
+
+
+
所选书籍
+ +
+
+
出版号
+ +
+
+
作者
+ +
+
+
其他作者
+ +
+
+
出版社
+ +
+
+
版次
+ +
+
+
当前库存
+ +
+
+
备注
+ +
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookOut/FormView.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormView.js new file mode 100644 index 000000000..d73fcf0d0 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/FormView.js @@ -0,0 +1,174 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-02 10:37 + * 描 述:教材库存表 + */ +var acceptClick; +var keyValue = request('keyValue'); +// 设置权限 +var setAuthorize; +// 设置表单数据 +var setFormData; +// 验证数据是否填写完整 +var validForm; +// 保存数据 +var save; +var selectedRow; +var refreshGirdData; +var tempdatra = new Array(); + +var bootstrap = function ($, learun) { + "use strict"; + // 设置权限 + setAuthorize = function (data) { + }; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); + $('#TextBookOut').jfGrid({ + headData: [ + { label: '出库单', name: 'BookCode', width: 180, align: 'left' }, + { + label: "专业部", name: "DeptNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: value, + keyId: 'deptno', + callback: function (_data) { + callback(_data['deptname']); + } + }); + } + }, + { + label: "专业", name: "MajorNo", width: 120, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', + key: value, + keyId: 'majorno', + callback: function (_data) { + callback(_data['majorname']); + } + }); + } + }, + { + label: "课程", name: "LessonNo", width: 150, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', + key: value, + keyId: 'lessonno', + callback: function (_data) { + callback(_data['lessonname']); + } + }); + } + }, + { + label: "班级", name: "ClassNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', + key: value, + keyId: 'classno', + callback: function (_data) { + callback(_data['classname']); + } + }); + } + }, + { label: '学年', name: 'AcademicYearNo', width: 80, align: 'left' }, + { label: '学期', name: 'Semester', width: 80, align: 'left' }, + { label: '领用人', name: 'Recipient', width: 100, align: 'left' }, + { label: '出库数量', name: 'Variate', width: 100, align: 'left' }, + { label: '出库时间', name: 'CreateTime', width: 200, align: 'left' }, + { label: '出库用户', name: 'CrateUserID', width: 100, align: 'left' }, + { label: '备注', name: 'Remark', width: 100, align: 'left' }, + ], + height: 400, + mainId: 'CreateTime desc', + reloadSelected: false, + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormData?keyValue=' + keyValue, function (data) { + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); + tempdatra = data[id]; + } + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + } + }; + refreshGirdData = function (temprow) { + var ifnewrow = true; + $.each(tempdatra, function (key, val) { + if (tempdatra[key].ID === temprow.ID) { + tempdatra[key] = temprow; + ifnewrow = false; + } + }); + if (ifnewrow) { + tempdatra.push(temprow); + } + + $('#TextBookOut').jfGridSet('refreshdata', tempdatra); + }; + // 设置表单数据 + setFormData = function (processId, param, callback) { + if (!!processId) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormData?processId=' + processId, function (data) { + for (var id in data) { + if (!!data[id] && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); + } + else { + if (id == 'TextBookOut' && data[id]) { + keyValue = data[id].ID; + } + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + callback && callback(); + } + // 验证数据是否填写完整 + validForm = function () { + var datas = $('#TextBookOut').jfGridGet('rowdatas'); + if (datas == null || datas.length == 0) { + learun.alert.warning("申请未包含出库申请!请先添加入库申请!"); + return false; + } + return true; + }; + // 保存数据 + save = function (callBack) { + var postData = {}; + var formData = $('[data-table="TextBookInOut"]').lrGetFormData(); + postData.strEntity = JSON.stringify(formData); + postData.strTextBookOutList = JSON.stringify($('#TextBookOut').jfGridGet('rowdatas')); + $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/IndexIn.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Index.cshtml similarity index 53% rename from Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/IndexIn.cshtml rename to Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Index.cshtml index 5c13888e5..32f5258ea 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/IndexIn.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Index.cshtml @@ -1,17 +1,24 @@ @{ - ViewBag.Title = "教材库存表"; + ViewBag.Title = "TextBookOut"; Layout = "~/Views/Shared/_Index.cshtml"; } -
-
+
+
- +
-  查询 +
+
+
+
关键字查询
+ +
+
+
@@ -19,9 +26,9 @@
@@ -29,4 +36,4 @@
-@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookInOut/IndexIn.js") +@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookOut/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/IndexIn.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Index.js similarity index 52% rename from Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/IndexIn.js rename to Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Index.js index be51f319e..515e23674 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextbookInOut/IndexIn.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookOut/Index.js @@ -1,70 +1,114 @@ /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 - * 日 期:2022-03-02 10:37 - * 描 述:教材库存表 + * 日 期:2022-03-05 11:17 + * 描 述:TextBookOut */ var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; + var startTime; + var endTime; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { - // 查询 - $('#btn_Search').on('click', function () { - var keyword = $('#txt_Keyword').val(); - page.search({ keyword: keyword }); + // 时间搜索框 + $('#datesearch').lrdate({ + dfdata: [ + { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } + ], + // 月 + mShow: false, + premShow: false, + // 季度 + jShow: false, + prejShow: false, + // 年 + ysShow: false, + yxShow: false, + preyShow: false, + yShow: false, + // 默认 + dfvalue: '1', + selectfn: function (begin, end) { + startTime = begin; + endTime = end; + page.search(); + } }); - $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 100, 400); + $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo',value: 'deptno',text: 'deptname' }); + $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo',value: 'majorno',text: 'majorname' }); + $('#ClassNo').lrDataSourceSelect({ code: 'bjsj',value: 'classno',text: 'classname' }); + $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo',value: 'lessonno',text: 'lessonname' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); - // 新增 - $('#lr_add').on('click', function () { - learun.layerForm({ - id: 'form', - title: '新增', - url: top.$.rootUrl + '/EducationalAdministration/TextBookInOut/Form', - width: 700, - height: 500, - callBack: function (id) { - return top[id].acceptClick(refreshGirdData); - } - }); - }); - // 编辑 + // 出库 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', - title: '编辑', - url: top.$.rootUrl + '/EducationalAdministration/TextBookInOut/Form?keyValue=' + keyValue, - width: 700, - height: 500, + title: '出库', + url: top.$.rootUrl + '/EducationalAdministration/TextBookOut/Form?keyValue=' + keyValue, + width: 1000, + height: 800, callBack: function (id) { - return top[id].acceptClick(refreshGirdData); + var res = false; + // 验证数据 + res = top[id].validForm(); + // 保存数据 + if (res) { + res = top[id].save('', function () { + page.search(); + }); + } + return res; } }); } }); + + // 查看 + $('#lr_view').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'formview', + title: '查看', + url: top.$.rootUrl + '/EducationalAdministration/TextBookOut/FormView?keyValue=' + keyValue, + width: 1000, + height: 700, + btn: null, + }); + } + }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { - learun.layerConfirm('是否确认删除该项!', function (res) { - if (res) { - learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookInOut/DeleteForm', { keyValue: keyValue }, function () { - }); - } + learun.layerForm({ + id: 'formdelete', + title: '删除明细', + url: top.$.rootUrl + '/EducationalAdministration/TextBookOut/FormDelete?keyValue=' + keyValue, + width: 1000, + height: 700, + btn: null, }); } }); }, + // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/EducationalAdministration/TextBookInOut/GetPageList', @@ -88,7 +132,6 @@ var bootstrap = function ($, learun) { { label: '出版号', name: 'PublishNo', width: 200, align: "left" }, { label: '第一作者', name: 'FirstAuthor', width: 200, align: "left" }, { label: '其他作者', name: 'OtherAuthor', width: 200, align: "left" }, - //{ label: '出版日期', name: 'Pubdate', width: 200, align: "left" }, { label: '出版社', name: 'Publisher', width: 200, align: "left" }, { label: '版次', name: 'Edition', width: 200, align: "left" }, { label: '印次', name: 'Impression', width: 200, align: "left" }, @@ -98,7 +141,6 @@ var bootstrap = function ($, learun) { { label: '修改用户', name: 'UpUserID', width: 200, align: "left" }, { label: '当前数量', name: 'FinallyNum', width: 200, align: "left" }, { label: '备注', name: 'Remark', width: 200, align: "left" }, - ], mainId: 'ID', isPage: true, @@ -108,6 +150,7 @@ var bootstrap = function ($, learun) { }, search: function (param) { param = param || {}; + param.SqlParameter = ' and IsSubmit =1 '; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; 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 4cd870a24..6713a49cf 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 @@ -843,6 +843,7 @@ + @@ -1183,6 +1184,9 @@ + + + @@ -6676,6 +6680,10 @@ + + + + @@ -7617,6 +7625,9 @@ + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextBookOutMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextBookOutMap.cs new file mode 100644 index 000000000..d6cab035f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextBookOutMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.EducationalAdministration; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-05 11:17 + /// 描 述:TextBookOut + /// + public class TextBookOutMap : EntityTypeConfiguration + { + public TextBookOutMap() + { + #region 表、主键 + //表 + this.ToTable("TEXTBOOKOUT"); + //主键 + this.HasKey(t => t.ID); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index 3fa4c19f8..d61d39bcf 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -597,6 +597,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInIBLL.cs index 75f63c668..1566bd591 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInIBLL.cs @@ -54,8 +54,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration ///
/// /// - /// - void SaveEntity(string keyValue, TextbookInOutEntity entity, List textBookIndentDatail); + /// + void SaveEntity(string keyValue, TextbookInOutEntity entity, List textBookIn); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInService.cs index 314c0eaf3..5be7cff4e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookIn/TextBookInService.cs @@ -225,7 +225,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration textbookInList[i].Impression = entity.Impression; variate += textbookInList[i].variate; } - entity.Create(); this.BaseRepository("CollegeMIS").Insert(textbookInList); if (variate != 0 && variate > 0) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutBLL.cs new file mode 100644 index 000000000..c94c8eeaa --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutBLL.cs @@ -0,0 +1,150 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-05 11:17 + /// 描 述:TextBookOut + /// + public class TextBookOutBLL : TextBookOutIBLL + { + private TextBookOutService textBookOutService = new TextBookOutService(); + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return textBookOutService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取TextBookOut表实体数据 + /// + /// 主键 + /// + public TextBookOutEntity GetTextBookOutEntity(string keyValue) + { + try + { + return textBookOutService.GetTextBookOutEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + textBookOutService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, TextBookOutEntity entity) + { + try + { + textBookOutService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, TextbookInOutEntity entity, List textBookOutList) + { + try + { + textBookOutService.SaveEntity(keyValue, entity, textBookOutList); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutEntity.cs new file mode 100644 index 000000000..f9010bfe0 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutEntity.cs @@ -0,0 +1,160 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-05 11:17 + /// 描 述:TextBookOut + /// + public class TextBookOutEntity + { + #region 实体成员 + /// + /// ID + /// + [Column("ID")] + public string ID { get; set; } + /// + /// InOutCode + /// + [Column("INOUTCODE")] + public string InOutCode { get; set; } + /// + /// BookCode + /// + [Column("BOOKCODE")] + public string BookCode { get; set; } + /// + /// AcademicYearNo + /// + [Column("ACADEMICYEARNO")] + public string AcademicYearNo { get; set; } + /// + /// Semester + /// + [Column("SEMESTER")] + public string Semester { get; set; } + /// + /// DeptNo + /// + [Column("DEPTNO")] + public string DeptNo { get; set; } + /// + /// MajorNo + /// + [Column("MAJORNO")] + public string MajorNo { get; set; } + /// + /// ClassNo + /// + [Column("CLASSNO")] + public string ClassNo { get; set; } + /// + /// 课程 + /// + [Column("LESSONNO")] + public string LessonNo { get; set; } + /// + /// PublishNo + /// + [Column("PUBLISHNO")] + public string PublishNo { get; set; } + /// + /// 教材号 + /// + [Column("TEXTBOOKNO")] + public string TextBookNo { get; set; } + /// + /// 教材名称 + /// + [Column("TEXTBOOKNAME")] + public string TextBookName { get; set; } + /// + /// 第一作者 + /// + [Column("FIRSTAUTHOR")] + public string FirstAuthor { get; set; } + /// + /// 其他作者 + /// + [Column("OTHERAUTHOR")] + public string OtherAuthor { get; set; } + /// + /// 出版社 + /// + [Column("PUBLISHER")] + public string Publisher { get; set; } + /// + /// 版次 + /// + [Column("EDITION")] + public string Edition { get; set; } + /// + /// 印次 + /// + [Column("IMPRESSION")] + public string Impression { get; set; } + /// + /// 创建人 + /// + [Column("CREATETIME")] + public DateTime? CreateTime { get; set; } + /// + /// 创建版次 + /// + [Column("CRATEUSERID")] + public string CrateUserID { get; set; } + /// + /// UpTime + /// + [Column("UPTIME")] + public DateTime? UpTime { get; set; } + /// + /// UpUserID + /// + [Column("UPUSERID")] + public string UpUserID { get; set; } + /// + /// Variate + /// + [Column("VARIATE")] + public decimal? Variate { get; set; } + /// + /// Recipient + /// + [Column("RECIPIENT")] + public string Recipient { get; set; } + + /// + /// 备注 + /// + [Column("REMARK")] + public string Remark { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.ID = keyValue; + } + #endregion + #region 扩展字段 + #endregion + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutIBLL.cs new file mode 100644 index 000000000..7caddad02 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutIBLL.cs @@ -0,0 +1,56 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-05 11:17 + /// 描 述:TextBookOut + /// + public interface TextBookOutIBLL + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取TextBookOut表实体数据 + /// + /// 主键 + /// + TextBookOutEntity GetTextBookOutEntity(string keyValue); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, TextBookOutEntity entity); + /// + /// 保存实体数据(新增、修改) + /// + /// + /// + /// + void SaveEntity(string keyValue, TextbookInOutEntity entity, List textBookOut); + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutService.cs new file mode 100644 index 000000000..f6a484c1c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookOut/TextBookOutService.cs @@ -0,0 +1,285 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Text; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-05 11:17 + /// 描 述:TextBookOut + /// + public class TextBookOutService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.Id, + t.AcademicYearNo, + t.Semester, + t.DeptNo, + t.MajorNo, + t.ClassNo, + t.LessonNo, + t.Variate, + t.Recipient, + t.CreateTime, + t.CrateUserID + "); + strSql.Append(" FROM TextBookOut t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) + { + dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); + strSql.Append(" AND ( t.CreateTime >= @startTime AND t.CreateTime <= @endTime ) "); + } + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" AND t.Semester = @Semester "); + } + if (!queryParam["DeptNo"].IsEmpty()) + { + dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); + strSql.Append(" AND t.DeptNo = @DeptNo "); + } + if (!queryParam["MajorNo"].IsEmpty()) + { + dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String); + strSql.Append(" AND t.MajorNo = @MajorNo "); + } + if (!queryParam["ClassNo"].IsEmpty()) + { + dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String); + strSql.Append(" AND t.ClassNo = @ClassNo "); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + strSql.Append(" AND t.LessonNo = @LessonNo "); + } + if (!queryParam["Recipient"].IsEmpty()) + { + dp.Add("Recipient", "%" + queryParam["Recipient"].ToString() + "%", DbType.String); + strSql.Append(" AND t.Recipient Like @Recipient "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取TextBookOut表实体数据 + /// + /// 主键 + /// + public TextBookOutEntity GetTextBookOutEntity(string keyValue) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(x => x.InOutCode == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + decimal? Num = 0; + var keyValueArr = keyValue.Split(','); + foreach (var item in keyValueArr) + { + var entity = BaseRepository("CollegeMIS").FindEntity(x => x.ID == item); + if (entity != null) + { + Num += entity.Variate; + var InOutEntity = db.FindEntity(x => x.BookCode == entity.InOutCode); + if (InOutEntity != null) + { + InOutEntity.FinallyNum += Num; + db.Delete(entity); + db.Update(InOutEntity); + } + else + { + db.Rollback(); + } + } + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, TextBookOutEntity entity) + { + try + { + if (keyValue != null) + { + entity.Modify(keyValue); + this.BaseRepository("CollegeMIS").Update(entity); + } + else + { + entity.Create(); + this.BaseRepository("CollegeMIS").Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存 + /// + /// + /// 库存 + /// + public void SaveEntity(string keyValue, TextbookInOutEntity entity, List textbookOutList) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + decimal? variate = 0; + if (textbookOutList.Count > 0) + { + for (int i = 0; i < textbookOutList.Count; i++) + { + textbookOutList[i].InOutCode = entity.BookCode; + textbookOutList[i].LessonNo = entity.LessonNo; + textbookOutList[i].PublishNo = entity.PublishNo; + textbookOutList[i].TextBookNo = entity.TextBookNo; + textbookOutList[i].TextBookName = entity.TextBookName; + textbookOutList[i].FirstAuthor = entity.FirstAuthor; + textbookOutList[i].OtherAuthor = entity.OtherAuthor; + textbookOutList[i].Publisher = entity.Publisher; + textbookOutList[i].Edition = entity.Edition; + textbookOutList[i].Impression = entity.Impression; + textbookOutList[i].Impression = entity.Impression; + variate += textbookOutList[i].Variate; + } + this.BaseRepository("CollegeMIS").Insert(textbookOutList); + + if (variate != 0 && variate > 0) + { + var newtextInOutEntity = db.FindEntity(x => x.BookCode == entity.BookCode); + if (newtextInOutEntity != null) + { + newtextInOutEntity.FinallyNum -= variate; + if (newtextInOutEntity.FinallyNum > 0 || newtextInOutEntity.FinallyNum == 0) + { + db.Update(newtextInOutEntity); + } + else + { + db.Rollback(); + } + } + else + { + db.Rollback(); + } + } + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion + + } +} 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 df66cd941..82c4f37a2 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 @@ -66,6 +66,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration strSql.Append(" FROM TextbookInOut t where 1=1 "); var queryParam = queryJson.ToJObject(); var dp = new DynamicParameters(new { }); + if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) + { + dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); + strSql.Append(" AND ( t.CreateTime >= @startTime AND t.CreateTime <= @endTime ) "); + } if (!queryParam["SqlParameter"].IsEmpty()) { string SqlParameter = queryParam["SqlParameter"].ToString(); @@ -78,7 +84,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } if (!queryParam["TextBookName"].IsEmpty()) { - strSql.Append(" and TextBookName like @TextBookName )"); + strSql.Append(" and TextBookName like @TextBookName "); dp.Add("TextBookName", "%" + queryParam["TextBookName"].ToString() + "%", DbType.String); } return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); 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 ea8266c36..c4b993e41 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 @@ -1818,6 +1818,10 @@ + + + +