using System; using Nancy; using Learun.Util; using System.Collections.Generic; using Learun.Application.TwoDevelopment.LogisticsManagement; using Learun.Application.TwoDevelopment.AssetManagementSystem; using Learun.Application.WorkFlow; namespace Learun.Application.WebApi { /// /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 /// 日 期:2022-11-21 10:09 /// 描 述:考勤记录 /// public class FundsApplyApi : BaseApi { private FundsApplyIBLL fundsApplyIBLL = new FundsApplyBLL(); private FundsApplyDetailIBLL fundsApplyDetailIBLL = new FundsApplyDetailBLL(); private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL(); /// /// 注册接口 /// public FundsApplyApi() : base("/learun/adms/FundsApply") { Get["/pagelist"] = GetPageList; Get["/form"] = GetForm; Get["/getEnCode"] = GetEnCode; Post["/delete"] = DeleteForm; Post["/save"] = SaveForm; Post["/submit"] = Submit; } #region 获取数据 /// /// 获取页面显示列表分页数据 /// /// /// public Response GetPageList(dynamic _) { ReqPageParam parameter = this.GetReqData(); var data = fundsApplyIBLL.GetPageList(parameter.pagination, parameter.queryJson); var jsonData = new { rows = data, total = parameter.pagination.total, page = parameter.pagination.page, records = parameter.pagination.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// /// public Response GetForm(dynamic _) { string keyValue = this.GetReqData(); var FundsApplyData = fundsApplyIBLL.GetFundsApplyEntity(keyValue); var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(keyValue); var jsonData = new { FundsApply = FundsApplyData, FundsApplyDetail = FundsApplyDetailData, }; return Success(jsonData); } /// /// 获取申请单号 /// /// /// public Response GetEnCode(dynamic _) { var jsonData = new { EnCode = "JFKZ_" + CommonHelper.CreateNo() }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// /// /// public Response DeleteForm(dynamic _) { string keyValue = this.GetReqData(); fundsApplyIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } /// /// 保存实体数据(新增、修改) /// /// /// public Response SaveForm(dynamic _) { ReqFormEntity parameter = this.GetReqData(); FundsApplyEntity entity = parameter.strEntity.ToObject(); List detailList = parameter.fundsApplyDetailList.ToObject>(); fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList); return Success("保存成功!"); } /// /// 提交 /// /// /// public Response Submit(dynamic _) { string keyValue = this.GetReqData(); var processId = Guid.NewGuid().ToString(); fundsApplyIBLL.ChangeStatusById(keyValue, 1, processId); UserInfo userInfo = LoginUserInfo.Get(); nWFProcessIBLL.CreateFlow("LC_FundsApply", processId, "", 1, "", userInfo); return Success("提交成功!"); } #endregion #region 私有类 /// /// 表单实体类 /// private class ReqFormEntity { public string keyValue { get; set; } public string strEntity { get; set; } public string fundsApplyDetailList { get; set; } } #endregion } }