@@ -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("保存成功!"); | ||||
} | } | ||||
@@ -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("保存成功!"); | ||||
} | } | ||||
@@ -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 提交数据 | ||||
@@ -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 提交数据 | ||||
@@ -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 提交数据 | ||||