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 a31215f40..e86a1ba0c 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 @@ -158,9 +158,9 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetFormData(string keyValue) + public ActionResult GetFormData(string keyValue,string mainId) { - var ReportData = fualityReportChildIBLL.GetListByFillId(keyValue); + var ReportData = fualityReportChildIBLL.GetListByFillId(keyValue, mainId); return Success(ReportData); } 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 8fde253f4..244559307 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 @@ -6,6 +6,7 @@ */ var acceptClick; var keyValue = request('keyValue'); +var mainId = request('mainId'); var ProjectName = request('ProjectName'); var arr = []; var bootstrap = function ($, learun) { @@ -32,7 +33,7 @@ var bootstrap = function ($, learun) { }, initData: function () { if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/LR_Desktop/QualityReport/GetFormData?keyValue=' + keyValue, function (data) { + $.lrSetForm(top.$.rootUrl + '/LR_Desktop/QualityReport/GetFormData?keyValue=' + keyValue + '&mainId=' + mainId, function (data) { $('#content').html(''); for (var i = 0; i < data.length; i++) { 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 index b086d09d5..3e0bb12eb 100644 --- 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 @@ -6,6 +6,7 @@ */ var acceptClick; var keyValue = request('keyValue'); +var mainId = request('mainId'); var ProjectName = request('ProjectName'); var arr = []; var bootstrap = function ($, learun) { @@ -34,7 +35,7 @@ var bootstrap = function ($, learun) { }, initData: function () { if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/LR_Desktop/QualityReport/GetFormData?keyValue=' + keyValue, function (data) { + $.lrSetForm(top.$.rootUrl + '/LR_Desktop/QualityReport/GetFormData?keyValue=' + keyValue + '&mainId=' + mainId, function (data) { $('#content').html(''); for (var i = 0; i < data.length; i++) { 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 57ed09dd6..a61959e68 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 @@ -165,7 +165,9 @@ var bootstrap = function ($, learun) { label: "公式计算结果", name: "Result", width: 150, align: "left" }, { - label: "填报时间", name: "ReportTime", width: 150, align: "left" + label: "填报时间", name: "ReportTime", width: 150, align: "left", formatter: function (cellvalue) { + return learun.formatDate(cellvalue, 'yyyy-MM'); + } }, { label: "状态", name: "Status", width: 150, align: "left", 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 index 0d09b3b7d..a828edf9f 100644 --- 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 @@ -22,15 +22,20 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - + // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('fid'); + var mainId = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { + var Status = $('#gridtable').jfGridValue('Status'); + if (Status == 1) { + return learun.alert.warning('该项已提交,不可编辑!'); + } learun.layerForm({ id: 'form', title: '编辑', - url: top.$.rootUrl + '/LR_Desktop/QualityReport/Form?keyValue=' + keyValue, + url: top.$.rootUrl + '/LR_Desktop/QualityReport/Form?keyValue=' + keyValue + '&mainId=' + mainId, width: 600, height: 400, callBack: function (id) { @@ -42,11 +47,12 @@ var bootstrap = function ($, learun) { // 查看 $('#lr_view').on('click', function () { var keyValue = $('#gridtable').jfGridValue('fid'); + var mainId = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '查看', - url: top.$.rootUrl + '/LR_Desktop/QualityReport/FormView?keyValue=' + keyValue, + url: top.$.rootUrl + '/LR_Desktop/QualityReport/FormView?keyValue=' + keyValue + '&mainId=' + mainId, width: 600, height: 400, btn: null @@ -71,7 +77,7 @@ var bootstrap = function ($, learun) { }); } }); - + //撤回 $('#lr_nosubmit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); @@ -106,7 +112,7 @@ var bootstrap = function ($, learun) { }); } }); - + // 打印 $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); @@ -151,7 +157,10 @@ var bootstrap = function ($, learun) { label: "公式计算结果", name: "Result", width: 150, align: "left" }, { - label: "填报时间", name: "ReportTime", width: 150, align: "left" + label: "填报时间", name: "ReportTime", width: 150, align: "left", + formatter: function (cellvalue) { + return learun.formatDate(cellvalue, 'yyyy-MM'); + } }, { label: "状态", name: "Status", width: 150, align: "left", @@ -167,7 +176,9 @@ var bootstrap = function ($, learun) { }, ], mainId: 'Id', - isPage: true + isPage: true, + sidx: 'ReportTime', + sord: 'DESC', }); page.search(); }, 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 7b941026d..882394e83 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 @@ -49,11 +49,11 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop /// /// 项目Id /// - public IEnumerable GetListByFillId(string keyValue) + public IEnumerable GetListByFillId(string keyValue, string mainId) { try { - return qualityReportChildService.GetListByFillId(keyValue); + return qualityReportChildService.GetListByFillId(keyValue, mainId); } catch (Exception ex) { 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 7da67af16..a570e6dbe 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 @@ -26,7 +26,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop /// /// /// - IEnumerable GetListByFillId(string keyValue); + IEnumerable GetListByFillId(string keyValue, string mainId); /// /// 获取QualityReportChild表实体数据 /// 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 c185e9b2b..b4a29c245 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 @@ -62,7 +62,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop /// /// 项目Id /// - public IEnumerable GetListByFillId(string keyValue) + public IEnumerable GetListByFillId(string keyValue, string mainId) { try { @@ -70,7 +70,17 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop var strSql = new StringBuilder(); strSql.Append(@" select t.*,c.[type] as CalType,c.Name as CalName from QualityReportChild t join QualityReportMain m on t.Mainid=m.id join QualityReportMain a on t.MainId = a.Id join CalculateProject c on t.ProjectId=c.id "); - strSql.Append($"  WHERE 1=1 and a.FillinFromId='{keyValue}' and year(m.ReportTime)=year(getdate()) and month(m.ReportTime)='{month}'"); + strSql.Append($"  WHERE 1=1 and a.FillinFromId='{keyValue}' "); + + if (!string.IsNullOrEmpty(mainId)) + { + strSql.Append($" and t.MainId='{mainId}'"); + } + else + { + strSql.Append($" and year(m.ReportTime)=year(getdate()) and month(m.ReportTime)='{month}'"); + } + strSql.Append(" order by t.Sort "); // 虚拟参数 var dp = new DynamicParameters(new { }); @@ -341,7 +351,7 @@ where a.Id='{keyValue}' order by b.Sort"; else { gs = gs.Replace("(", "(").Replace(")", ")"); - if (gs.Contains("%")) + if (gs.Contains("*100%")) { gs = gs.Replace("%", ""); var dt = db.FindTable($"select convert(varchar,convert(decimal(18,0),{gs}))+'%' as num "); @@ -349,7 +359,7 @@ where a.Id='{keyValue}' order by b.Sort"; } else { - var dt = db.FindTable($"select convert(varchar,convert(decimal(18,0),{gs})) as num "); + var dt = db.FindTable($"select convert(decimal(18,2),{gs}) as num "); result = dt.Rows[0][0].ToString(); } } 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 d971ccfbd..520b5ae25 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 @@ -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.LR_Desktop @@ -33,7 +34,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop 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 "); + strSql.Append("  WHERE 1=1 and b.[State]=2 and b.IsFlag=0"); var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); @@ -84,7 +85,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop strSql.Append($" AND a.FillInFromId='{queryParam["FillInFromId"].ToString()}' "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp).OrderByDescending(x => x.ReportTime); } catch (Exception ex) {