diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs index 76c79dc0a..da27d80a3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs @@ -17,6 +17,7 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers public class FundsApplyController : MvcControllerBase { private FundsApplyIBLL fundsApplyIBLL = new FundsApplyBLL(); + private FundsApplyDetailIBLL fundsApplyDetailIBLL = new FundsApplyDetailBLL(); #region 视图功能 @@ -27,7 +28,7 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers [HttpGet] public ActionResult Index() { - return View(); + return View(); } /// /// 表单页 @@ -39,6 +40,12 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers ViewBag.EnCode = "JFKZ_" + CommonHelper.CreateNo(); return View(); } + + [HttpGet] + public ActionResult FormView() + { + return View(); + } #endregion #region 获取数据 @@ -73,9 +80,12 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var FundsApplyData = fundsApplyIBLL.GetFundsApplyEntity( keyValue ); - var jsonData = new { + var FundsApplyData = fundsApplyIBLL.GetFundsApplyEntity(keyValue); + var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(keyValue); + var jsonData = new + { FundsApply = FundsApplyData, + FundsApplyDetail = FundsApplyDetailData, }; return Success(jsonData); } @@ -88,8 +98,9 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers [AjaxOnly] public ActionResult GetFormDataByProcessId(string processId) { - var FundsApplyData = fundsApplyIBLL.GetEntityByProcessId( processId ); - var jsonData = new { + var FundsApplyData = fundsApplyIBLL.GetEntityByProcessId(processId); + var jsonData = new + { FundsApply = FundsApplyData, }; return Success(jsonData); @@ -119,15 +130,30 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] - public ActionResult SaveForm(string keyValue, string strEntity) + public ActionResult SaveForm(string keyValue, string strEntity, string fundsApplyDetailList) { FundsApplyEntity entity = strEntity.ToObject(); - fundsApplyIBLL.SaveEntity(keyValue,entity); + List detailList = fundsApplyDetailList.ToObject>(); + fundsApplyIBLL.SaveEntity(keyValue, entity, detailList); if (string.IsNullOrEmpty(keyValue)) { } return Success("保存成功!"); } + + /// + /// 提交 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult ChangeStatusById(string keyValue, string processId) + { + fundsApplyIBLL.ChangeStatusById(keyValue, 1, processId); + return Success("操作成功!"); + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.cshtml index a4bd971e6..907fcd77e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.cshtml @@ -7,7 +7,7 @@
-
+
申报单号
@@ -19,12 +19,16 @@
填报时间
+
+
是否固定资产
+
+
填报人
- @*
备注
*@ +
备注
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js index 61729de56..7e40036df 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js @@ -78,11 +78,12 @@ var bootstrap = function ($, learun) { learun.layerConfirm('是否确认删除该项!', function (res, index) { if (res) { $.each(tempdatra, function (key, val) { - if (tempdatra[key].Id === keyValue) { + if (tempdatra[key] && tempdatra[key].Id === keyValue) { pricecount -= tempdatra[key].Amount; tempdatra.splice(key, 1); } }); + pricecount = pricecount.toFixed(2); $("#SumAmount").val(pricecount); $("#UpperAmount").val(smalltoBIG(pricecount)); $('#FundsApplyDetail').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); @@ -96,6 +97,7 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { + $('#IsFixedAssets').lrDataItemSelect({ code: 'YesOrNoInt' }); $('#ApplyDept').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }); $('#ApplyDept').lrselectSet(learun.clientdata.get(['userinfo']).departmentId); $('#ApplyTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); @@ -127,9 +129,13 @@ var bootstrap = function ($, learun) { 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]); + if (data[id].SumAmount) { + pricecount = data[id].SumAmount; + } } } }); @@ -154,7 +160,7 @@ var bootstrap = function ($, learun) { for (var i = 0; i < tempdatra.length; i++) { pricecount += parseFloat(tempdatra[i].Amount); } - $("#SumAmount").val(pricecount); + $("#SumAmount").val(pricecount.toFixed(2)); $("#UpperAmount").val(smalltoBIG(pricecount)); $('#FundsApplyDetail').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); }; @@ -195,7 +201,7 @@ var bootstrap = function ($, learun) { formData.ProcessId = processId; } postData.strEntity = JSON.stringify(formData); - postData.FundsApplyDetailList = JSON.stringify($('#FundsApplyDetail').jfGridGet('rowdatas')); + postData.fundsApplyDetailList = JSON.stringify($('#FundsApplyDetail').jfGridGet('rowdatas')); $.lrSaveForm(top.$.rootUrl + '/AssetManagementSystem/FundsApply/SaveForm?keyValue=' + keyValue, postData, function (res) { // 保存成功后才回调 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/FormView.cshtml new file mode 100644 index 000000000..77e8a894a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/FormView.cshtml @@ -0,0 +1,52 @@ +@{ + ViewBag.Title = "经费开支申报"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + +
+ +
+
申报单号
+ +
+
+
申报部门
+
+
+
+
填报时间
+ +
+
+
是否固定资产
+
+
+
+
填报人
+ +
+
+
备注
+ +
+
+
总金额
+ +
+
+
人民币(大写)
+ +
+ @*
+
明细操作
+ + + +
*@ +
+
+
+
+@Html.AppendJsFile("/Areas/AssetManagementSystem/Views/FundsApply/FormView.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/FormView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/FormView.js new file mode 100644 index 000000000..7e40036df --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/FormView.js @@ -0,0 +1,242 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-11-07 14:25 + * 描 述:经费开支申报 + */ +var keyValue = request('keyValue'); +// 设置权限 +var setAuthorize; +// 设置表单数据 +var setFormData; +// 验证数据是否填写完整 +var validForm; +// 保存数据 +var save; +var refreshGirdData; +var acceptClick; +var selectedRow; +var tempdatra = new Array(); +//总价计算 +var pricecount = 0; +var bootstrap = function ($, learun) { + "use strict"; + // 设置权限 + setAuthorize = function (data) { + if (!!data) { + for (var field in data) { + if (data[field].isLook != 1) {// 如果没有查看权限就直接移除 + $('#' + data[field].fieldId).parent().remove(); + } + else { + if (data[field].isEdit != 1) { + $('#' + data[field].fieldId).attr('disabled', 'disabled'); + if ($('#' + data[field].fieldId).hasClass('lrUploader-wrap')) { + $('#' + data[field].fieldId).css({ 'padding-right': '58px' }); + $('#' + data[field].fieldId).find('.btn-success').remove(); + } + } + } + } + } + }; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + $("#detailadd").on('click', function () { + selectedRow = null; + learun.layerForm({ + id: 'formdetail', + title: '新增明细', + url: top.$.rootUrl + '/AssetManagementSystem/FundsApplyDetail/Form', + width: 500, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + $("#detailedit").on('click', function () { + var keyValue = $('#FundsApplyDetail').jfGridValue('Id'); + selectedRow = $('#FundsApplyDetail').jfGridGet('rowdata'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'formdetail', + title: '编辑明细', + url: top.$.rootUrl + '/AssetManagementSystem/FundsApplyDetail/Form?keyValue=' + keyValue, + width: 500, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + $("#detaildel").on('click', function () { + var keyValue = $('#FundsApplyDetail').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res, index) { + if (res) { + $.each(tempdatra, function (key, val) { + if (tempdatra[key] && tempdatra[key].Id === keyValue) { + pricecount -= tempdatra[key].Amount; + tempdatra.splice(key, 1); + } + }); + pricecount = pricecount.toFixed(2); + $("#SumAmount").val(pricecount); + $("#UpperAmount").val(smalltoBIG(pricecount)); + $('#FundsApplyDetail').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); + top.layer.close(index); + } + }); + } + }); + + page.bind(); + page.initData(); + }, + bind: function () { + $('#IsFixedAssets').lrDataItemSelect({ code: 'YesOrNoInt' }); + $('#ApplyDept').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }); + $('#ApplyDept').lrselectSet(learun.clientdata.get(['userinfo']).departmentId); + $('#ApplyTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); + $('#ApplyUser')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; + $('#ApplyUser').val(learun.clientdata.get(['userinfo']).realName); + $('#FundsApplyDetail').jfGrid({ + headData: [ + { + label: '项目内容', name: 'ProjectContent', width: 150, align: 'left' + }, + { + label: '数量', name: 'Number', width: 150, align: 'left' + }, + { + label: '单价(元)', name: 'Price', width: 150, align: 'left' + }, + { + label: '金额(元)', name: 'Amount', width: 150, align: 'left' + }, + ], + height: 400, + mainId: 'AAIId', + reloadSelected: false, + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/FundsApply/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]); + if (data[id].SumAmount) { + pricecount = data[id].SumAmount; + } + } + } + }); + } else { + $("#EnCode").val(NewEnCode); + } + } + }; + 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); + } + //总价计算 + pricecount = 0; + for (var i = 0; i < tempdatra.length; i++) { + pricecount += parseFloat(tempdatra[i].Amount); + } + $("#SumAmount").val(pricecount.toFixed(2)); + $("#UpperAmount").val(smalltoBIG(pricecount)); + $('#FundsApplyDetail').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); + }; + function sortNumber(a, b) { + return a.AAIOrder - b.AAIOrder; + } + // 设置表单数据 + setFormData = function (processId, param, callback) { + if (!!processId) { + $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/FundsApply/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 == 'FundsApply' && data[id]) { + keyValue = data[id].Id; + } + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + callback && callback(); + } + // 验证数据是否填写完整 + validForm = function () { + if (!$('body').lrValidform()) { + return false; + } + return true; + }; + // 保存数据 + save = function (processId, callBack, i) { + var postData = {}; + var formData = $('[data-table="FundsApply"]').lrGetFormData(); + if (!!processId) { + formData.ProcessId = processId; + } + postData.strEntity = JSON.stringify(formData); + postData.fundsApplyDetailList = JSON.stringify($('#FundsApplyDetail').jfGridGet('rowdatas')); + + $.lrSaveForm(top.$.rootUrl + '/AssetManagementSystem/FundsApply/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(res, i); + } + }); + }; + page.init(); + function smalltoBIG(n) { + var fraction = ['角', '分']; + var digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']; + var unit = [ + ['元', '万', '亿'], + ['', '拾', '佰', '仟'] + ]; + var head = n < 0 ? '欠' : ''; + n = Math.abs(n); + + var s = ''; + + for (var i = 0; i < fraction.length; i++) { + s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, ''); + } + s = s || '整'; + n = Math.floor(n); + + for (var i = 0; i < unit[0].length && n > 0; i++) { + var p = ''; + for (var j = 0; j < unit[1].length && n > 0; j++) { + p = digit[n % 10] + unit[1][j] + p; + n = Math.floor(n / 10); + } + s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s; + } + return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整'); + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.cshtml index dd563c3ab..e97220d9e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.cshtml @@ -16,6 +16,7 @@  申请  编辑  删除 +  提交  打印
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.js index 5766bbf48..a356e7b1c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Index.js @@ -32,8 +32,11 @@ var bootstrap = function ($, learun) { res = top[id].validForm(); // 保存数据 if (res) { - processId = learun.newGuid(); - res = top[id].save(processId, refreshGirdData); + res = top[id].save('', function () { + page.search(); + }); + //processId = learun.newGuid(); + //res = top[id].save(processId, refreshGirdData); } return res; } @@ -81,13 +84,33 @@ var bootstrap = function ($, learun) { $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); + // 提交 + $('#lr_submit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var Status = $('#gridtable').jfGridValue('Status'); + if (Status !== 0) { + learun.alert.warning("当前项目已提交,请耐心等待审批!"); + return; + } + learun.layerConfirm('是否确认提交该项!', function (res) { + if (res) { + processId = learun.newGuid(); + learun.postForm(top.$.rootUrl + '/AssetManagementSystem/FundsApply/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) { + refreshGirdData(res, {}); + }); + } + }); + } + }); + }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/AssetManagementSystem/FundsApply/GetPageList', headData: [ - { label: "申报单号", name: "EnCode", width: 100, align: "left" }, + { label: "申报单号", name: "EnCode", width: 200, align: "left" }, { label: "申报部门", name: "ApplyDept", width: 100, align: "left", formatterAsync: function (callback, value, row, op,$cell) { learun.clientdata.getAsync('department', { @@ -109,7 +132,20 @@ var bootstrap = function ($, learun) { }}, { label: "备注", name: "Remark", width: 100, align: "left"}, { label: "总金额", name: "SumAmount", width: 100, align: "left"}, - { label: "人民币(大写)", name: "UpperAmount", width: 100, align: "left"}, + { label: "人民币(大写)", name: "UpperAmount", width: 100, align: "left" }, + { + label: "审批状态", name: "Status", width: 100, align: "left", + formatter: function (cellvalue, row) { + if (cellvalue === 1) { + return '审批中'; + } else if (cellvalue === 2) { + return '审批通过'; + } else { + return '草稿'; + } + } + } + ], mainId:'Id', isPage: true @@ -128,7 +164,7 @@ var bootstrap = function ($, learun) { { // 发起流程 var postData = { - schemeCode:'',// 填写流程对应模板编号 + schemeCode:'LC_FundsApply',// 填写流程对应模板编号 processId:processId, level:'1', }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApplyDetail/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApplyDetail/Form.js index 86e3c8d85..ef5c48880 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApplyDetail/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApplyDetail/Form.js @@ -21,7 +21,7 @@ var bootstrap = function ($, learun) { var num = $('#Number').val(); var Price = $('#Price').val(); if (!!num && !!Price) { - $('#Amount').val(parseInt(num) * parseFloat(Price)); + $('#Amount').val((parseInt(num) * parseFloat(Price)).toFixed(2)); } }); }, 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 b6dc1e70d..0eb6ac75b 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 @@ -1003,6 +1003,7 @@ + @@ -1288,6 +1289,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config index c14b8b64d..9c34b10f1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config @@ -35,6 +35,7 @@ + @@ -80,6 +81,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs index 981de1559..4262e49b8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs @@ -123,11 +123,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem ///
/// 主键 /// 实体 - public void SaveEntity(string keyValue, FundsApplyEntity entity) + public void SaveEntity(string keyValue, FundsApplyEntity entity, List detailList) { try { - fundsApplyService.SaveEntity(keyValue, entity); + fundsApplyService.SaveEntity(keyValue, entity, detailList); } catch (Exception ex) { @@ -142,6 +142,43 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } + public void ChangeStatusById(string keyValue,int status, string processId) + { + try + { + fundsApplyService.ChangeStatusById(keyValue, status, processId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public void ChangeStatusByProcessId(string processId, int status) + { + try + { + fundsApplyService.ChangeStatusByProcessId(processId, status); + } + 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/AssetManagementSystem/FundsApply/FundsApplyEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyEntity.cs index d530ec7fc..52107d240 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyEntity.cs @@ -35,6 +35,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem [Column("APPLYDEPT")] public string ApplyDept { get; set; } /// + /// 是否固定资产 + /// + [Column("ISFIXEDASSETS")] + public int? IsFixedAssets { get; set; } + /// /// ApplyUser /// [Column("APPLYUSER")] @@ -73,6 +78,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem public void Create() { this.Id = Guid.NewGuid().ToString(); + this.Status = 0; } /// /// 编辑调用 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs index 0aa366d15..ec0738361 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs @@ -48,7 +48,14 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// /// 主键 /// 实体 - void SaveEntity(string keyValue, FundsApplyEntity entity); + void SaveEntity(string keyValue, FundsApplyEntity entity, List detailList); + /// + /// 提交 + /// + /// + /// + void ChangeStatusById(string keyValue,int status, string processId); + void ChangeStatusByProcessId(string processId, int status); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs index 14b5b3a7e..367911a38 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs @@ -135,20 +135,76 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// 主键 /// 实体 /// - public void SaveEntity(string keyValue, FundsApplyEntity entity) + public void SaveEntity(string keyValue, FundsApplyEntity entity, List detailList) { + var db = this.BaseRepository("CollegeMIS"); try { + db.BeginTrans(); if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); - this.BaseRepository("CollegeMIS").Update(entity); + db.Update(entity); } else { entity.Create(); - this.BaseRepository("CollegeMIS").Insert(entity); + db.Insert(entity); } + //子表 + db.ExecuteBySql($"delete FundsApplyDetail where ApplyId='{entity.Id}'"); + foreach (var detail in detailList) + { + detail.Create(); + detail.ApplyId = entity.Id; + db.Insert(detail); + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// + /// + /// + /// + /// + public void ChangeStatusById(string keyValue, int status, string processId) + { + try + { + this.BaseRepository("CollegeMIS").ExecuteBySql($"update FundsApply set ProcessId='{processId}',status='{status}' where Id='{keyValue}'"); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public void ChangeStatusByProcessId(string processId, int status) + { + try + { + this.BaseRepository("CollegeMIS").ExecuteBySql($"update FundsApply set status='{status}' where ProcessId='{processId}'"); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailBLL.cs index ed08fc2b6..57835808a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailBLL.cs @@ -67,6 +67,24 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } + public List GetListByApplyId(string applyId) + { + try + { + return fundsApplyDetailService.GetListByApplyId(applyId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailIBLL.cs index 1154b4ec0..bfd0f536d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailIBLL.cs @@ -27,6 +27,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// 主键 /// FundsApplyDetailEntity GetFundsApplyDetailEntity(string keyValue); + List GetListByApplyId(string applyId); #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailService.cs index 27a70d4ef..5fdd277a2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApplyDetail/FundsApplyDetailService.cs @@ -4,6 +4,7 @@ using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.TwoDevelopment.AssetManagementSystem @@ -43,7 +44,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -82,6 +83,25 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } + + public List GetListByApplyId(string applyId) + { + try + { + return this.BaseRepository("CollegeMIS").FindList(x => x.ApplyId == applyId).ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion #region 提交数据 @@ -94,7 +114,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.Id == keyValue); + this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj index 735f99cb1..0ee1148a0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj @@ -97,6 +97,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/FundsApplyMethod.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/FundsApplyMethod.cs new file mode 100644 index 000000000..db949d68d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/FundsApplyMethod.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Learun.Application.TwoDevelopment.AssetManagementSystem; + +namespace Learun.Application.WorkFlow +{ + public class FundsApplyMethod : IWorkFlowMethod + { + FundsApplyIBLL fundsApply = new FundsApplyBLL(); + + + public void Execute(WfMethodParameter parameter) + { + if (parameter.code == "agree") + { + fundsApply.ChangeStatusByProcessId(parameter.processId, 2); + } + else + { + fundsApply.ChangeStatusByProcessId(parameter.processId, 0); + } + } + } +}