From 31bd4ca78156ac2415e48326152dd75bbb726fac Mon Sep 17 00:00:00 2001 From: ndbs Date: Thu, 8 Dec 2022 10:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=8F=E8=B4=B9=E5=BC=80=E5=A7=8B=E5=8D=95?= =?UTF-8?q?=E5=8F=B7=E7=94=9F=E6=88=90=E4=BC=98=E5=8C=96,=E5=8F=8A?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/FundsApplyController.cs | 7 ++-- .../Modules/FundsApplyApi.cs | 7 ++-- .../FundsApply/FundsApplyBLL.cs | 23 ++++++++++++ .../FundsApply/FundsApplyIBLL.cs | 7 ++++ .../FundsApply/FundsApplyService.cs | 36 +++++++++++++++++++ 5 files changed, 75 insertions(+), 5 deletions(-) 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 da691f003..d9d239d80 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 @@ -37,7 +37,7 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers [HttpGet] public ActionResult Form() { - ViewBag.EnCode = "JFKZ_" + CommonHelper.CreateNo(); + ViewBag.EnCode = fundsApplyIBLL.GetCode(); return View(); } @@ -136,10 +136,11 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers { FundsApplyEntity entity = strEntity.ToObject(); List detailList = fundsApplyDetailList.ToObject>(); - fundsApplyIBLL.SaveEntity(keyValue, entity, detailList); - if (string.IsNullOrEmpty(keyValue)) + if (entity.EnCode.Length > 15) { + return Fail("保存失败,经费开支单号今日数量已超上限,请明日提交!"); } + fundsApplyIBLL.SaveEntity(keyValue, entity, detailList); return Success("保存成功!"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs index 986850e52..db8ecfb68 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs @@ -82,7 +82,7 @@ namespace Learun.Application.WebApi { var jsonData = new { - EnCode = "JFKZ_" + CommonHelper.CreateNo() + EnCode = fundsApplyIBLL.GetCode() }; return Success(jsonData); } @@ -129,7 +129,10 @@ namespace Learun.Application.WebApi ReqFormEntity parameter = this.GetReqData(); FundsApplyEntity entity = parameter.strEntity.ToObject(); List detailList = parameter.fundsApplyDetailList.ToObject>(); - + if (entity.EnCode.Length > 15) + { + return Fail("保存失败,经费开支单号今日数量已超上限,请明日提交!"); + } fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList); return Success("保存成功!"); } 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 4262e49b8..0b2a99972 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 @@ -91,6 +91,29 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } + /// + /// 获取FundsApply表实体数据 + /// + /// 主键 + /// + public string GetCode() + { + try + { + return fundsApplyService.GetCode(); + } + 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/FundsApply/FundsApplyIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs index ec0738361..2dc5f4539 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 @@ -34,6 +34,13 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// 流程实例ID /// FundsApplyEntity GetEntityByProcessId(string processId); + /// + /// 经费单号 + /// + /// + /// + string GetCode(); + #endregion #region 提交数据 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 771154266..1a3f85156 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 @@ -124,6 +124,42 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } + /// + /// 获取FundsApply表实体数据 + /// + /// 主键 + /// + public string GetCode() + { + try + { + var strSql = new StringBuilder(); + strSql.Append(@"select * from FundsApply where 1= 1 and ApplyTime >= '" + DateTime.Now.Date + "' "); + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()).OrderByDescending(x => x.EnCode).FirstOrDefault(); + var Code = "JFKZ_" + CommonHelper.StringTime(); + if (data != null && !string.IsNullOrEmpty(data.EnCode)) + { + var NCode = data.EnCode.Substring(data.EnCode.Length - 2, 2); + Code = Code + (Convert.ToInt32(NCode) + 1).ToString().PadLeft(2, '0'); + } + else + { + Code = Code + "01"; + } + return Code; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion #region 提交数据