diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/QualityReportController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/QualityReportController.cs index d408ef9e9..ffe5b7396 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/QualityReportController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/QualityReportController.cs @@ -39,10 +39,51 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers { return View(); } + /// + /// 上报数据管理 + /// + /// + [HttpGet] + public ActionResult IndexReport() + { + return View(); + } + + /// + /// 上报数据管理 + /// + /// + [HttpGet] + public ActionResult FormView() + { + return View(); + } + #endregion #region 获取数据 /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = fualityReportMainIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// /// 判断是否可以上报 /// /// 项目Id @@ -92,6 +133,31 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers return Success("保存成功!"); } + /// + /// 提交 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult UpdateState(string keyValue, int Status) + { + fualityReportChildIBLL.UpdateState(keyValue, Status); + + return Success("操作成功!"); + } + /// + /// 删除 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + fualityReportChildIBLL.DeleteEntity(keyValue); + + return Success("删除成功!"); + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/FormulaMain/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/FormulaMain/Index.js index 755d1076f..a5a0c9c03 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/FormulaMain/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/FormulaMain/Index.js @@ -89,11 +89,11 @@ var bootstrap = function ($, learun) { url: top.$.rootUrl + '/LR_Desktop/FormulaMain/GetPageList', headData: [ { label: "名称", name: "Name", width: 150, align: "left" }, - { label: "公式", name: "Result", width: 250, align: "left" }, + { label: "公式", name: "Result", width: 350, align: "left" }, { label: "排序", name: "Sort", width: 100, align: "left" }, { label: "描述", name: "Desc", width: 200, align: "left" }, { - label: "状态", name: "IsEnable", width: 100, align: "left", + label: "启用", name: "IsEnable", width: 100, align: "left", formatter: function (cellvalue) { return cellvalue == 1 ? "" : ""; } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Form.js index bfc50023c..bb185a4fe 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Form.js @@ -35,11 +35,11 @@ var bootstrap = function ($, learun) { initData: function () { if (!!keyValue) { $.lrSetForm(top.$.rootUrl + '/LR_Desktop/QualityReport/GetFormData?keyValue=' + keyValue, function (data) { - console.log(data); + $('#content').html(''); for (var i = 0; i < data.length; i++) { var id = data[i].Id; - arr.push({ Id: id, Value: data[i].Value, Sort: data[i].Sort }); + arr.push({ Id: id, Value: data[i].Value, Sort: data[i].Sort, ProjectId: data[i].ProjectId }); var html = ''; html += '
'; html += '
计算项*
'; @@ -87,8 +87,10 @@ var bootstrap = function ($, learun) { if (!$('body').lrValidform()) { return false; } - console.log('save', arr); - //return; + if (arr.count <= 0) { + return learun.alert.warning('请设置上报数据!'); + } + var postData = { list: arr //JSON.stringify($('body').lrGetFormData()) }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/FormView.cshtml new file mode 100644 index 000000000..33f7bebba --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/FormView.cshtml @@ -0,0 +1,12 @@ +@{ + ViewBag.Title = "数据上报"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
+
公式:
+
+
+
+@Html.AppendJsFile("/Areas/LR_Desktop/Views/QualityReport/FormView.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/FormView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/FormView.js new file mode 100644 index 000000000..b086d09d5 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/FormView.js @@ -0,0 +1,105 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2021-06-22 11:07 + * 描 述:数据上报 + */ +var acceptClick; +var keyValue = request('keyValue'); +var ProjectName = request('ProjectName'); +var arr = []; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + //文本框失去焦点,计算结果 + $('#form').on('blur', + '.value', + function () { + var id = $(this)[0].id; + arr.forEach(m => { + if (m.Id == id) { + return m.Value = $('#' + id).val(); + } + }); + + page.refreshRes(); + + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LR_Desktop/QualityReport/GetFormData?keyValue=' + keyValue, function (data) { + + $('#content').html(''); + for (var i = 0; i < data.length; i++) { + var id = data[i].Id; + arr.push({ Id: id, Value: data[i].Value, Sort: data[i].Sort, ProjectId: data[i].ProjectId }); + var html = ''; + html += '
'; + html += '
计算项*
'; + html += '
'; + html += '
'; + html += '
'; + html += '
*
'; + html += + ''; + //if (data[i].CalName.indexOf('文字描述') != -1) { + // html += + // ''; + //} else if (data[i].CalType != '变量') { + // html += + // ''; + //} else { + // html += + // ''; + //} + html += '
'; + + $('#content').append(html); + $('#' + id).val(data[i].Value); + //CalType CalName + $('#pro' + id).lrDataSourceSelect({ + code: 'CalculateProject', + value: 'id', + text: 'name' + }); + $('#pro' + id).lrselectSet(data[i].ProjectId); + } + page.refreshRes(); + }); + } + }, + refreshRes: function () { + //页面显示计算结果 + var text = ''; + arr.forEach(m => { + text += m.Value; + }); + $('#result').html(text); + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + console.log('save', arr); + //return; + var postData = { + list: arr //JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/LR_Desktop/QualityReport/SaveList?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.cshtml index 47ec3468e..b78b81f03 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.cshtml @@ -1,5 +1,5 @@ @{ - ViewBag.Title = "公式管理"; + ViewBag.Title = "数据上报"; Layout = "~/Views/Shared/_Index.cshtml"; }
@@ -11,8 +11,12 @@
-
名称
- +
核心工作模块
+ +
+
+
项目名称
+
@@ -24,8 +28,8 @@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.js index db6b895bf..c8fd4ae38 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/Index.js @@ -2,7 +2,7 @@ * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 * 日 期:2021-06-22 11:07 - * 描 述:公式管理 + * 描 述:数据上报 */ var refreshGirdData; var bootstrap = function ($, learun) { @@ -119,20 +119,20 @@ var bootstrap = function ($, learun) { }); } }, - { - label: "状态", name: "State", width: 150, align: "center", - formatter: function (cellvalue) { - if (cellvalue === 0) { - return '草稿'; - } else if (cellvalue === 1) { - return '待设置填报人'; - } else if (cellvalue === 2) { - return '待设置公式'; - } else { - return '已完成'; - } - } - }, + //{ + // label: "状态", name: "State", width: 150, align: "center", + // formatter: function (cellvalue) { + // if (cellvalue === 0) { + // return '草稿'; + // } else if (cellvalue === 1) { + // return '待设置填报人'; + // } else if (cellvalue === 2) { + // return '待设置公式'; + // } else { + // return '已完成'; + // } + // } + //}, { label: "备注", name: "Demo", width: 300, align: "center" }, ], mainId: 'Id', @@ -142,7 +142,7 @@ var bootstrap = function ($, learun) { }, search: function (param) { param = param || {}; - //param.State = 3; + param.State = 3; //param.FillingPeople = learun.clientdata.get(['userinfo']).userId; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/IndexReport.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/IndexReport.cshtml new file mode 100644 index 000000000..5025d0c9b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/IndexReport.cshtml @@ -0,0 +1,38 @@ +@{ + ViewBag.Title = "上报数据管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
名称
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/LR_Desktop/Views/QualityReport/IndexReport.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/IndexReport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/IndexReport.js new file mode 100644 index 000000000..685ac95c1 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/QualityReport/IndexReport.js @@ -0,0 +1,152 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2021-06-25 11:07 + * 描 述:上报数据管理 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('fid'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/LR_Desktop/QualityReport/Form?keyValue=' + keyValue, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 查看 + $('#lr_view').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('fid'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '查看', + url: top.$.rootUrl + '/LR_Desktop/QualityReport/FormView?keyValue=' + keyValue, + width: 600, + height: 400, + btn: null + }); + } + }); + + //提交 + $('#lr_submit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var Status = $('#gridtable').jfGridValue('Status'); + if (Status == 1) { + return learun.alert.warning('该项已提交!'); + } + learun.layerConfirm('是否确认提交该项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/LR_Desktop/QualityReport/UpdateState', { keyValue: keyValue, Status: 1 }, function () { + refreshGirdData(); + }); + } + }); + } + }); + + //删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var Status = $('#gridtable').jfGridValue('Status'); + if (Status == 1) { + return learun.alert.warning('该项已提交,不可删除!'); + } + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_Desktop/QualityReport/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LR_Desktop/QualityReport/GetPageList', + headData: [ + { label: "核心工作模块", name: "WorderModule", width: 300, align: "center" }, + { label: "项目名称", name: "ProjectName", width: 300, align: "center" }, + { + label: "填报部门", name: "FillingDept", width: 100, align: "center", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', + key: value, + keyId: 'id', + callback: function (_data) { + callback(_data['name']); + } + }); + } + }, + { + label: "填报人", name: "CreateUserName", width: 150, align: "center" + }, + { + label: "公式计算结果", name: "Result", width: 150, align: "center" + }, + { + label: "填报时间", name: "ReportTime", width: 150, align: "center" + }, + { + label: "状态", name: "Status", width: 150, align: "center", + formatter: function (cellvalue) { + if (cellvalue === 0) { + return '草稿'; + } else if (cellvalue === 1) { + return '完成'; + } + } + }, + ], + mainId: 'Id', + isPage: true + }); + page.search(); + }, + search: function (param) { + param = param || {}; + param.State = 3; + //param.FillingPeople = learun.clientdata.get(['userinfo']).userId; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Form.js index 08f6e9dac..3c36fd670 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Form.js @@ -6,7 +6,8 @@ */ var acceptClick; var keyValue = request('keyValue'); -var PPId = request("PPId"); +var PPId = request("PPId");//项目阶段id +var PId = request("PId");//项目Id var bootstrap = function ($, learun) { "use strict"; var page = { @@ -26,6 +27,9 @@ var bootstrap = function ($, learun) { value: "Id", text: "Name", }); + if (!!PId) { + $('#PId').lrselectSet(PId); + } $('#PPId').lrselect({ type: 'tree', // 展开最大高度 @@ -43,7 +47,6 @@ var bootstrap = function ($, learun) { if (!!PPId) { $('#PPId').lrselectSet(PPId); } - $('#Files').lrUploader(); $('#DepartmentId').lrDepartmentSelect(); $('#ManagerId').lrUserSelect(0); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Index.js index e6c339937..9ff098575 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectDataManage/Index.js @@ -6,6 +6,7 @@ */ var refreshGirdData; var PPId; +var PId = request("PId");//项目Id var bootstrap = function ($, learun) { "use strict"; var page = { @@ -33,7 +34,7 @@ var bootstrap = function ($, learun) { learun.layerForm({ id: 'ProjectDataManageform', title: '新增', - url: top.$.rootUrl + '/LogisticsManagement/ProjectDataManage/Form?PPId=' + PPId, + url: top.$.rootUrl + '/LogisticsManagement/ProjectDataManage/Form?PPId=' + PPId + '&PId=' + PId, width: 800, height: 600, callBack: function (id) { @@ -125,6 +126,7 @@ var bootstrap = function ($, learun) { search: function (param) { param = param || {}; param.PPId = PPId; + param.PId = PId; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Form.js index 181f3e26f..97f812dd9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Form.js @@ -6,7 +6,7 @@ */ var acceptClick; var keyValue = request('keyValue'); -var PTId = request("PTId"); +var PTId = request("PTId");//项目类型id var bootstrap = function ($, learun) { "use strict"; var page = { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Index.js index d2592c468..dea7f9a8a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ProjectManage/Index.js @@ -72,6 +72,17 @@ var bootstrap = function ($, learun) { }); //  上传项目资料 $('#lr_data').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'ProjectDataManageIndex', + title: '项目资料管理', + url: top.$.rootUrl + '/LogisticsManagement/ProjectDataManage/Index?PId=' + keyValue, + width: 1000, + height: 800, + btn: null + }); + } }); }, inittree: function () { 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 96c2ad2bd..d2329adab 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 @@ -1295,7 +1295,9 @@ + + @@ -7353,6 +7355,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildBLL.cs index de9154443..7b941026d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildBLL.cs @@ -189,6 +189,27 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } + + public void UpdateState(string keyValue, int Status) + { + try + { + qualityReportChildService.UpdateState(keyValue, 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/LR_Desktop/QualityReportChild/QualityReportChildIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildIBLL.cs index 445b43b42..7da67af16 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildIBLL.cs @@ -60,6 +60,12 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop /// /// void SaveList(string keyValue, List list); + /// + /// 提交 + /// + /// + /// + void UpdateState(string keyValue, int Status); #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildService.cs index 35307e44e..1407828e7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportChild/QualityReportChildService.cs @@ -164,6 +164,11 @@ where a.Id='{keyValue}' order by b.Sort"; int mouth = DateTime.Now.Month - 1; var entity = this.BaseRepository("CollegeMIS").FindEntity(x => x.Id == keyValue); + if (string.IsNullOrEmpty(entity.Formula)) + { + return "请先设置公式!"; + } + if (entity.FillingCycle == "1") { //填报周期--月(每月) @@ -220,12 +225,18 @@ where a.Id='{keyValue}' order by b.Sort";         /// 主键 public void DeleteEntity(string keyValue) { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { - this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); + db.Delete(t => t.Id == keyValue); + var sql = $"delete from QualityReportChild where MainId='{keyValue}'"; + db.ExecuteBySql(sql); + + db.Commit(); } catch (Exception ex) { + db.Rollback(); if (ex is ExceptionEx) { throw; @@ -282,9 +293,11 @@ where a.Id='{keyValue}' order by b.Sort"; { if (!string.IsNullOrEmpty(keyValue)) { + var mainId = ""; list = list.OrderBy(x => x.Sort).ToList(); var projectIds = list.Select(x => x.ProjectId).ToList(); var gs = ""; + var result = ""; var calculateProjectList = db.FindList(x => projectIds.Contains(x.Id)); foreach (var entity in list) { @@ -292,15 +305,14 @@ where a.Id='{keyValue}' order by b.Sort"; model = db.FindEntity(x => x.Id == entity.Id); model.Value = entity.Value; db.Update(model); + mainId = model.MainId; + //保存运算结果 //计算项目 var calculateProject = calculateProjectList.Where(x => x.Id == entity.ProjectId).FirstOrDefault(); - if (calculateProject.Name.Contains("文字描述")) - { - gs += entity.Value; - }else if (calculateProject.Type == "变量") + if (calculateProject.Type == "变量") { - var value=ToDecimal(entity.Value); + var value = ToDecimal(entity.Value); if (value == 0) { gs += entity.Value; @@ -309,12 +321,42 @@ where a.Id='{keyValue}' order by b.Sort"; { gs += value; } - //select convert(varchar,convert(decimal(18,0),(1/5)*100))+'%' as LT5 + } + else + { + gs += entity.Value; } + + } + + if (!string.IsNullOrEmpty(mainId)) + { + + //公式运算结果 + if (list.Count == 1) + { + result = list.FirstOrDefault().Value; + } + else + { + gs = gs.Replace("(", "(").Replace(")", ")"); + if (gs.Contains("%")) + { + gs = gs.Replace("%", ""); + var dt = db.FindTable($"select convert(varchar,convert(decimal(18,0),{gs}))+'%' as num "); + result = dt.Rows[0][0].ToString(); + } + else + { + var dt = db.FindTable($"select convert(varchar,convert(decimal(18,0),{gs})) as num "); + result = dt.Rows[0][0].ToString(); + } + } + QualityReportMainEntity main = db.FindEntity(x => x.Id == mainId); + main.Result = result; + db.Update(main); } - //公式运算结果 - } db.Commit(); } @@ -332,6 +374,29 @@ where a.Id='{keyValue}' order by b.Sort"; } } + + public void UpdateState(string keyValue, int Status) + { + try + { + string sql = $"update QualityReportMain set [Status]='{Status}' where Id='{keyValue}'"; + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion /// /// @@ -341,7 +406,7 @@ where a.Id='{keyValue}' order by b.Sort"; { try { - return decimal.Round(Convert.ToDecimal(value),2); + return Convert.ToDecimal(Convert.ToDecimal(value).ToString("f2")); } catch { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainEntity.cs index bfebc3fc7..cd9a51519 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainEntity.cs @@ -79,6 +79,26 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } #endregion #region 扩展字段 + /// + /// 核心模块 + /// + [NotMapped] + public string WorderModule { get; set; } + /// + /// 项目名称 + /// + [NotMapped] + public string ProjectName { get; set; } + /// + /// 部门 + /// + [NotMapped] + public string FillingDept { get; set; } + /// + /// 项目表Id + /// + [NotMapped] + public string fid { get; set; } #endregion } } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainService.cs index 97f30a4a4..63b0d0d15 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/QualityReportMain/QualityReportMainService.cs @@ -30,12 +30,9 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop try { var strSql = new StringBuilder(); - strSql.Append("SELECT "); - strSql.Append(@" -                t.Id, -                t.FillinFromId -                "); - strSql.Append("  FROM QualityReportMain t "); + strSql.Append(@"select b.WorderModule,b.ProjectName,b.FillingDept,b.Id as fid,a.Id,a.ReportTime,a.Status,a.Result,a.CreateUserName from QualityReportMain a join FillinFrom b on a.FillinFromId=b.Id + "); + strSql.Append("  WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数