Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

163 Zeilen
5.9 KiB

  1. using Nancy;
  2. using Learun.Util;
  3. using System.Collections.Generic;
  4. using Learun.Application.TwoDevelopment.EducationalAdministration;
  5. using Learun.Application.TwoDevelopment.LogisticsManagement;
  6. using System;
  7. using Learun.Application.WorkFlow;
  8. namespace Learun.Application.WebApi
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-06-03 14:29
  15. /// 描 述:系部数据
  16. /// </summary>
  17. public class PurchaseInfoApplyApi : BaseApi
  18. {
  19. private Purchase_Info_ApplyIBLL purchaseinfoIBLL = new Purchase_Info_ApplyBLL();
  20. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  21. /// <summary>
  22. /// 注册接口
  23. /// <summary>
  24. public PurchaseInfoApplyApi()
  25. : base("/learun/adms/purchaseinfoapply")
  26. {
  27. Get["/pagelist"] = GetPageList;
  28. Get["/form"] = GetForm;
  29. Post["/delete"] = DeleteForm;
  30. Post["/save"] = SaveForm;
  31. Post["/submit"] = Submit;
  32. Get["/shList"] = GetshList;
  33. }
  34. #region 获取数据
  35. /// <summary>
  36. /// 获取页面显示列表分页数据
  37. /// <summary>
  38. /// <param name="_"></param>
  39. /// <returns></returns>
  40. public Response GetPageList(dynamic _)
  41. {
  42. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  43. var data = purchaseinfoIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  44. var jsonData = new
  45. {
  46. rows = data,
  47. total = parameter.pagination.total,
  48. page = parameter.pagination.page,
  49. records = parameter.pagination.records
  50. };
  51. return Success(jsonData);
  52. }
  53. /// <summary>
  54. /// 获取表单数据
  55. /// <summary>
  56. /// <param name="_"></param>
  57. /// <returns></returns>
  58. public Response GetForm(dynamic _)
  59. {
  60. string keyValue = this.GetReqData();
  61. var Purchase_InfoData = purchaseinfoIBLL.GetPurchase_Info_ApplyEntity(keyValue);
  62. var Purchase_Info_DetailsData = purchaseinfoIBLL.GetPurchase_Info_ApplydetailsList(Purchase_InfoData.Id);
  63. var jsonData = new
  64. {
  65. Purchase_Info = Purchase_InfoData,
  66. Purchase_Info_Details = Purchase_Info_DetailsData,
  67. };
  68. return Success(jsonData);
  69. }
  70. /// <summary>
  71. /// 获取页面显示列表数据
  72. /// <summary>
  73. /// <param name="_"></param>
  74. /// <returns></returns>
  75. public Response GetshList(dynamic _)
  76. {
  77. Purchase_Info_ApplyEntity parameter = this.GetReqData<Purchase_Info_ApplyEntity>();
  78. var Purchase_InfoData = purchaseinfoIBLL.GetEntityByProcessId(parameter.ProcessId);
  79. var FundsApplyDetailData = purchaseinfoIBLL.GetPurchase_Info_ApplydetailsList(Purchase_InfoData.Id);
  80. var jsonData = new
  81. {
  82. Purchase_Info = Purchase_InfoData,
  83. Purchase_Info_Details = FundsApplyDetailData,
  84. };
  85. return Success(jsonData);
  86. }
  87. #endregion
  88. #region 提交数据
  89. /// <summary>
  90. /// 删除实体数据
  91. /// <param name="_"></param>
  92. /// <summary>
  93. /// <returns></returns>
  94. public Response DeleteForm(dynamic _)
  95. {
  96. string keyValue = this.GetReqData();
  97. purchaseinfoIBLL.DeleteEntity(keyValue);
  98. return Success("删除成功!");
  99. }
  100. /// <summary>
  101. /// 保存实体数据(新增、修改)
  102. /// <param name="_"></param>
  103. /// <summary>
  104. /// <returns></returns>
  105. public Response SaveForm(dynamic _)
  106. {
  107. //Purchase_InfoEntity entity = strEntity.ToObject<Purchase_InfoEntity>();
  108. //List<Purchase_Info_DetailsEntity> purchase_Info_DetailsList = strpurchase_Info_DetailsList.ToObject<List<Purchase_Info_DetailsEntity>>();
  109. //purchase_InfoIBLL.SaveEntity(keyValue, entity, purchase_Info_DetailsList);
  110. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  111. Purchase_Info_ApplyEntity entity = parameter.strEntity.ToObject<Purchase_Info_ApplyEntity>();
  112. List<Purchase_Info_ApplydetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Info_ApplydetailsEntity>>();
  113. //var code = entity.EnCode;
  114. if (detailList != null)
  115. {
  116. if (detailList.Count == 0)
  117. {
  118. return Fail("请添加明细");
  119. }
  120. }
  121. string id=purchaseinfoIBLL.SaveEntity(parameter.keyValue, entity, detailList);
  122. var json = new
  123. {
  124. Id = id
  125. };
  126. return Success(json);
  127. }
  128. /// <summary>
  129. /// 提交
  130. /// <param name="_"></param>
  131. /// <summary>
  132. /// <returns></returns>
  133. public Response Submit(dynamic _)
  134. {
  135. Purchase_Info_ApplyEntity parameter = this.GetReqData<Purchase_Info_ApplyEntity>();
  136. //string keyValue = this.GetReqData();
  137. //var processId = Guid.NewGuid().ToString();
  138. purchaseinfoIBLL.ModifyStatus(parameter.Id, 1, parameter.ProcessId);
  139. //UserInfo userInfo = LoginUserInfo.Get();
  140. //nWFProcessIBLL.CreateFlow("1-4", processId, "", 1, "", userInfo);
  141. return Success("提交成功!");
  142. }
  143. #endregion
  144. #region 私有类
  145. /// <summary>
  146. /// 表单实体类
  147. /// <summary>
  148. private class ReqFormEntity
  149. {
  150. public string keyValue { get; set; }
  151. public string strEntity { get; set; }
  152. public string DetailList { get; set; }
  153. }
  154. #endregion
  155. }
  156. }