@@ -16,6 +16,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
public class QualityReportController : MvcControllerBase | |||
{ | |||
private QualityReportMainIBLL fualityReportMainIBLL = new QualityReportMainBLL(); | |||
private QualityReportChildIBLL fualityReportChildIBLL = new QualityReportChildBLL(); | |||
#region 视图功能 | |||
@@ -26,11 +27,72 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
[HttpGet] | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
/// <summary> | |||
/// 判断是否可以上报 | |||
/// </summary> | |||
/// <param name="keyValue">项目Id</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult IsCanReport(string keyValue) | |||
{ | |||
var str = fualityReportChildIBLL.IsCanReport(keyValue); | |||
if (!string.IsNullOrEmpty(str)) | |||
{ | |||
return Fail(str); | |||
} | |||
return Success(""); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// </summary> | |||
/// <param name="keyValue">项目Id</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var ReportData = fualityReportChildIBLL.GetListByFillId(keyValue); | |||
return Success(ReportData); | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="strEntity">实体</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveList(string keyValue, List<QualityReportChildEntity> list) | |||
{ | |||
fualityReportChildIBLL.SaveList(keyValue, list); | |||
return Success("保存成功!"); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -68,7 +68,6 @@ var bootstrap = function ($, learun) { | |||
html += '<div class="col-xs-6 lr-form-item" data-table="FormulaChild">'; | |||
html += '<div class="lr-form-item-title"><a id="' + id + '" class="btn child_delete"><i class="fa fa-trash-o"></i> </a>计算项目<font face="宋体">*</font></div>'; | |||
html += '<div id="pro' + id + '" class="project" isvalid="yes" checkexpession="NotNull"></div>'; | |||
html += '</div>'; | |||
html += '<div class="col-xs-6 lr-form-item" data-table="FormulaChild">'; | |||
html += '<div class="lr-form-item-title">顺序<font face="宋体">*</font></div>'; | |||
@@ -3,21 +3,10 @@ | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="FormulaMain"> | |||
<div class="lr-form-item-title">名称<font face="宋体">*</font></div> | |||
<input id="Name" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="FormulaMain"> | |||
<div class="lr-form-item-title">排序<font face="宋体">*</font></div> | |||
<input id="Sort" type="number" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="FormulaMain"> | |||
<div class="lr-form-item-title">选项<font face="宋体">*</font></div> | |||
<div id="IsEnable"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="FormulaMain"> | |||
<div class="lr-form-item-title">描述</div> | |||
<textarea id="Desc" class="form-control" style="height:100px;"></textarea> | |||
<div id="content"></div> | |||
<div class="col-xs-12 lr-form-item" style="color: red; margin-top: 20px;"> | |||
<div class="lr-form-item-title">公式:</div> | |||
<div id="result" style="margin-top: 5px;"></div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/LR_Desktop/Views/QualityReport/Form.js") |
@@ -6,6 +6,8 @@ | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var ProjectName = request('ProjectName'); | |||
var arr = []; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
@@ -15,24 +17,69 @@ var bootstrap = function ($, learun) { | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#IsEnable').lrRadioCheckbox({ | |||
type: 'radio', | |||
code: 'EnableStatus', | |||
}); | |||
//文本框失去焦点,计算结果 | |||
$('#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/FormulaMain/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]); | |||
$.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 }); | |||
var html = ''; | |||
html += '<div class="col-xs-6 lr-form-item">'; | |||
html += '<div class="lr-form-item-title">计算项<font face="宋体">*</font></div>'; | |||
html += '<div id="pro' + id + '" readonly="readonly"></div>'; | |||
html += '</div>'; | |||
html += '<div class="col-xs-6 lr-form-item">'; | |||
html += '<div class="lr-form-item-title">值<font face="宋体">*</font></div>'; | |||
if (data[i].CalName.indexOf('文字描述') != -1) { | |||
html += | |||
'<input id="' + id + '" type="text" class="form-control value" isvalid="yes" checkexpession="NotNull"/>'; | |||
} else if (data[i].CalType != '变量') { | |||
html += | |||
'<input id="' + id + '" type="text" class="form-control value" isvalid="yes" checkexpession="NotNull" readonly="readonly"/>'; | |||
} else { | |||
html += | |||
'<input id="' + id + '" type="number" class="form-control value" isvalid="yes" checkexpession="NotNull" />'; | |||
} | |||
html += '</div>'; | |||
$('#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); | |||
} | |||
}; | |||
// 保存数据 | |||
@@ -40,10 +87,12 @@ var bootstrap = function ($, learun) { | |||
if (!$('body').lrValidform()) { | |||
return false; | |||
} | |||
console.log('save', arr); | |||
//return; | |||
var postData = { | |||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||
list: arr //JSON.stringify($('body').lrGetFormData()) | |||
}; | |||
$.lrSaveForm(top.$.rootUrl + '/LR_Desktop/FormulaMain/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
$.lrSaveForm(top.$.rootUrl + '/LR_Desktop/QualityReport/SaveList?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
@@ -22,16 +22,26 @@ var bootstrap = function ($, learun) { | |||
}); | |||
// 填报 | |||
$('#lr_add').on('click', function () { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '填报数据', | |||
url: top.$.rootUrl + '/LR_Desktop/FormulaMain/Form', | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
var ProjectName = $('#gridtable').jfGridValue('ProjectName'); | |||
learun.httpAsyncGet(top.$.rootUrl + '/LR_Desktop/QualityReport/IsCanReport?keyValue=' + keyValue, function (res) { | |||
if (res.code == 200) { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: ProjectName + '填报', | |||
url: top.$.rootUrl + '/LR_Desktop/QualityReport/Form?keyValue=' + keyValue + '&ProjectName=' + ProjectName, | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
else { | |||
learun.alert.error(res.info); | |||
} | |||
}); | |||
}); | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
@@ -43,11 +43,37 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
} | |||
/// <summary> | |||
/// 获取QualityReportChild表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="keyValue">项目Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<QualityReportChildEntity> GetListByFillId(string keyValue) | |||
{ | |||
try | |||
{ | |||
return qualityReportChildService.GetListByFillId(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取QualityReportChild表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public QualityReportChildEntity GetQualityReportChildEntity(string keyValue) | |||
{ | |||
try | |||
@@ -67,6 +93,31 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
} | |||
/// <summary> | |||
/// 判断是否可以上报 | |||
/// </summary> | |||
/// <param name="keyValue">项目Id</param> | |||
/// <returns></returns> | |||
public string IsCanReport(string keyValue) | |||
{ | |||
try | |||
{ | |||
return qualityReportChildService.IsCanReport(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -95,11 +146,11 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
public void SaveEntity(string keyValue, QualityReportChildEntity entity) | |||
{ | |||
try | |||
@@ -119,6 +170,25 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
} | |||
public void SaveList(string keyValue, List<QualityReportChildEntity> list) | |||
{ | |||
try | |||
{ | |||
qualityReportChildService.SaveList(keyValue, list); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} |
@@ -35,20 +35,10 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
[Column("VALUE")] | |||
public string Value { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// 排序 | |||
/// </summary> | |||
[Column("CREATETIME")] | |||
public DateTime? CreateTime { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
[Column("CREATEUSERID")] | |||
public string CreateUserId { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
[Column("CREATEUSERNAME")] | |||
public string CreateUserName { get; set; } | |||
[Column("SORT")] | |||
public int? Sort { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -69,6 +59,18 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
/// <summary> | |||
/// 计算项类型(变量、常量、符号) | |||
/// </summary> | |||
[NotMapped] | |||
public string CalType { get; set; } | |||
/// <summary> | |||
/// 计算项名称 | |||
/// </summary> | |||
[NotMapped] | |||
public string CalName { get; set; } | |||
#endregion | |||
} | |||
} |
@@ -21,12 +21,24 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<QualityReportChildEntity> GetPageList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <returns></returns> | |||
IEnumerable<QualityReportChildEntity> GetListByFillId(string keyValue); | |||
/// <summary> | |||
/// 获取QualityReportChild表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
QualityReportChildEntity GetQualityReportChildEntity(string keyValue); | |||
/// <summary> | |||
/// 判断是否可以上报 | |||
/// </summary> | |||
/// <param name="keyValue">项目Id</param> | |||
/// <returns></returns> | |||
string IsCanReport(string keyValue); | |||
#endregion | |||
#region 提交数据 | |||
@@ -42,6 +54,13 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, QualityReportChildEntity entity); | |||
/// <summary> | |||
/// 保存 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="list"></param> | |||
void SaveList(string keyValue, List<QualityReportChildEntity> list); | |||
#endregion | |||
} |
@@ -4,7 +4,9 @@ using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Text; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
{ | |||
@@ -20,11 +22,11 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">查询参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">查询参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<QualityReportChildEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
@@ -55,6 +57,71 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
} | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="keyValue">项目Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<QualityReportChildEntity> GetListByFillId(string keyValue) | |||
{ | |||
try | |||
{ | |||
var month = DateTime.Now.Month - 1; | |||
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(" order by t.Sort "); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
var list = this.BaseRepository("CollegeMIS").FindList<QualityReportChildEntity>(strSql.ToString()); | |||
if (list == null || list.Count() <= 0) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
var sql = | |||
$@"select c.Id,c.Name,c.[Type],(case c.[Type] when '变量' then '' when '常量' then c.Value when '符号' then c.Name end) as value,b.Sort | |||
from FillinFrom a join FormulaChild b on a.Formula=b.MainId | |||
join CalculateProject c on b.ProjectId=c.id | |||
where a.Id='{keyValue}' order by b.Sort"; | |||
var dt = db.FindTable(sql); | |||
QualityReportMainEntity main = new QualityReportMainEntity(); | |||
main.Create(); | |||
main.FillinFromId = keyValue; | |||
main.ReportTime = DateTime.Now.AddMonths(-1); | |||
main.Status = 0; | |||
db.Insert(main); | |||
for (int i = 0; i < dt.Rows.Count; i++) | |||
{ | |||
QualityReportChildEntity entity = new QualityReportChildEntity(); | |||
entity.Create(); | |||
entity.MainId = main.Id; | |||
entity.ProjectId = dt.Rows[i]["Id"].ToString(); | |||
entity.Value = dt.Rows[i]["value"].ToString(); | |||
entity.Sort = Convert.ToInt32(dt.Rows[i]["Sort"]); | |||
db.Insert(entity); | |||
} | |||
db.Commit(); | |||
return this.BaseRepository("CollegeMIS").FindList<QualityReportChildEntity>(strSql.ToString()); | |||
} | |||
else | |||
{ | |||
return list; | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取QualityReportChild表实体数据 | |||
/// </summary> | |||
@@ -79,6 +146,70 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
} | |||
/// <summary> | |||
/// 判断是否允许上报 | |||
/// </summary> | |||
/// <param name="keyValue">项目Id</param> | |||
/// <returns></returns> | |||
public string IsCanReport(string keyValue) | |||
{ | |||
try | |||
{ | |||
if (DateTime.Now.Day >= 15) | |||
{ | |||
//return "每月1-15日才可填报!"; | |||
} | |||
int mouth = DateTime.Now.Month - 1; | |||
var entity = this.BaseRepository("CollegeMIS").FindEntity<FillinFromEntity>(x => x.Id == keyValue); | |||
if (entity.FillingCycle == "1") | |||
{ | |||
//填报周期--月(每月) | |||
} | |||
else if (entity.FillingCycle == "2") | |||
{ | |||
//填报周期--学期((3月、9月)) | |||
var fillingTime = entity.FillingTime.Split(',').ToList(); | |||
if (!fillingTime.Any(x => Convert.ToInt32(x) + 1 == DateTime.Now.Month)) | |||
{ | |||
return "当前日期不可进行填报!"; | |||
} | |||
} | |||
else if (entity.FillingCycle == "2") | |||
{ | |||
//填报周期--年(每年7月) | |||
if (Convert.ToInt32(entity.FillingTime) != DateTime.Now.Month - 1) | |||
{ | |||
return "当前日期不可进行填报!"; | |||
} | |||
} | |||
var qualityReportMainEntity = this.BaseRepository("CollegeMIS").FindEntity<QualityReportMainEntity>(x => x.FillinFromId == keyValue && x.ReportTime.Value.Month == mouth); | |||
if (qualityReportMainEntity == null) | |||
{ | |||
return ""; | |||
} | |||
else if (qualityReportMainEntity.Status == 1) | |||
{ | |||
return "上报数据已提交,不可重复上报!"; | |||
} | |||
return ""; | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -107,10 +238,10 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, QualityReportChildEntity entity) | |||
{ | |||
try | |||
@@ -139,7 +270,84 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="list"></param> | |||
public void SaveList(string keyValue, List<QualityReportChildEntity> list) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
list = list.OrderBy(x => x.Sort).ToList(); | |||
var projectIds = list.Select(x => x.ProjectId).ToList(); | |||
var gs = ""; | |||
var calculateProjectList = db.FindList<CalculateProjectEntity>(x => projectIds.Contains(x.Id)); | |||
foreach (var entity in list) | |||
{ | |||
QualityReportChildEntity | |||
model = db.FindEntity<QualityReportChildEntity>(x => x.Id == entity.Id); | |||
model.Value = entity.Value; | |||
db.Update(model); | |||
//计算项目 | |||
var calculateProject = calculateProjectList.Where(x => x.Id == entity.ProjectId).FirstOrDefault(); | |||
if (calculateProject.Name.Contains("文字描述")) | |||
{ | |||
gs += entity.Value; | |||
}else if (calculateProject.Type == "变量") | |||
{ | |||
var value=ToDecimal(entity.Value); | |||
if (value == 0) | |||
{ | |||
gs += entity.Value; | |||
} | |||
else | |||
{ | |||
gs += value; | |||
} | |||
//select convert(varchar,convert(decimal(18,0),(1/5)*100))+'%' as LT5 | |||
} | |||
} | |||
//公式运算结果 | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <returns></returns> | |||
private decimal ToDecimal(string value) | |||
{ | |||
try | |||
{ | |||
return decimal.Round(Convert.ToDecimal(value),2); | |||
} | |||
catch | |||
{ | |||
return 0; | |||
} | |||
} | |||
} | |||
} |
@@ -34,6 +34,12 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
/// </summary> | |||
[Column("STATUS")] | |||
public int? Status { get; set; } | |||
/// <summary> | |||
/// 公式运算结果 | |||
/// </summary> | |||
[Column("RESULT")] | |||
public string Result { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
@@ -58,6 +64,10 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
public void Create() | |||
{ | |||
this.Id = Guid.NewGuid().ToString(); | |||
this.CreateTime=DateTime.Now; | |||
var userinfo = LoginUserInfo.Get(); | |||
this.CreateUserId = userinfo.userId; | |||
this.CreateUserName = userinfo.realName; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||