瀏覽代碼

经费开始单号生成优化,及保存判断

新疆警官学校中职
ndbs 2 年之前
父節點
當前提交
31bd4ca781
共有 5 個檔案被更改,包括 75 行新增5 行删除
  1. +4
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs
  2. +5
    -2
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs
  3. +23
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs
  4. +7
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs
  5. +36
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs

+ 4
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs 查看文件

@@ -37,7 +37,7 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
[HttpGet] [HttpGet]
public ActionResult Form() public ActionResult Form()
{ {
ViewBag.EnCode = "JFKZ_" + CommonHelper.CreateNo();
ViewBag.EnCode = fundsApplyIBLL.GetCode();
return View(); return View();
} }


@@ -136,10 +136,11 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
{ {
FundsApplyEntity entity = strEntity.ToObject<FundsApplyEntity>(); FundsApplyEntity entity = strEntity.ToObject<FundsApplyEntity>();
List<FundsApplyDetailEntity> detailList = fundsApplyDetailList.ToObject<List<FundsApplyDetailEntity>>(); List<FundsApplyDetailEntity> detailList = fundsApplyDetailList.ToObject<List<FundsApplyDetailEntity>>();
fundsApplyIBLL.SaveEntity(keyValue, entity, detailList);
if (string.IsNullOrEmpty(keyValue))
if (entity.EnCode.Length > 15)
{ {
return Fail("保存失败,经费开支单号今日数量已超上限,请明日提交!");
} }
fundsApplyIBLL.SaveEntity(keyValue, entity, detailList);
return Success("保存成功!"); return Success("保存成功!");
} }




+ 5
- 2
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs 查看文件

@@ -82,7 +82,7 @@ namespace Learun.Application.WebApi
{ {
var jsonData = new var jsonData = new
{ {
EnCode = "JFKZ_" + CommonHelper.CreateNo()
EnCode = fundsApplyIBLL.GetCode()
}; };
return Success(jsonData); return Success(jsonData);
} }
@@ -129,7 +129,10 @@ namespace Learun.Application.WebApi
ReqFormEntity parameter = this.GetReqData<ReqFormEntity>(); ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
FundsApplyEntity entity = parameter.strEntity.ToObject<FundsApplyEntity>(); FundsApplyEntity entity = parameter.strEntity.ToObject<FundsApplyEntity>();
List<FundsApplyDetailEntity> detailList = parameter.fundsApplyDetailList.ToObject<List<FundsApplyDetailEntity>>(); List<FundsApplyDetailEntity> detailList = parameter.fundsApplyDetailList.ToObject<List<FundsApplyDetailEntity>>();

if (entity.EnCode.Length > 15)
{
return Fail("保存失败,经费开支单号今日数量已超上限,请明日提交!");
}
fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList); fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList);
return Success("保存成功!"); return Success("保存成功!");
} }


+ 23
- 0
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
} }
} }


/// <summary>
/// 获取FundsApply表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public string GetCode()
{
try
{
return fundsApplyService.GetCode();
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion #endregion


#region 提交数据 #region 提交数据


+ 7
- 0
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
/// <param name="processId">流程实例ID</param> /// <param name="processId">流程实例ID</param>
/// <returns></returns> /// <returns></returns>
FundsApplyEntity GetEntityByProcessId(string processId); FundsApplyEntity GetEntityByProcessId(string processId);
/// <summary>
/// 经费单号
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
string GetCode();

#endregion #endregion


#region 提交数据 #region 提交数据


+ 36
- 0
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
} }
} }


/// <summary>
/// 获取FundsApply表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
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<FundsApplyEntity>(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 #endregion


#region 提交数据 #region 提交数据


Loading…
取消
儲存