Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

157 righe
5.8 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 PurchasePrintApplyApi : BaseApi
  18. {
  19. private Purchase_Print_ApplyIBLL purchaseprintIBLL = new Purchase_Print_ApplyBLL();
  20. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  21. /// <summary>
  22. /// 注册接口
  23. /// <summary>
  24. public PurchasePrintApplyApi()
  25. : base("/learun/adms/purchaseprintapply")
  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 = purchaseprintIBLL.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_PrintData = purchaseprintIBLL.GetPurchase_Print_ApplyEntity(keyValue);
  62. var Purchase_Print_DetailsData = purchaseprintIBLL.GetPurchase_Print_ApplydetailsList(Purchase_PrintData.Id);
  63. var jsonData = new
  64. {
  65. Purchase_Print = Purchase_PrintData,
  66. Purchase_Print_Details = Purchase_Print_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_Print_ApplyEntity parameter = this.GetReqData<Purchase_Print_ApplyEntity>();
  78. var Purchase_PrintData = purchaseprintIBLL.GetEntityByProcessId(parameter.ProcessId);
  79. var Purchase_Print_DetailsData = purchaseprintIBLL.GetPurchase_Print_ApplydetailsList(Purchase_PrintData.Id);
  80. var jsonData = new
  81. {
  82. Purchase_Print = Purchase_PrintData,
  83. Purchase_Print_Details = Purchase_Print_DetailsData,
  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. purchaseprintIBLL.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_PrintEntity entity = strEntity.ToObject<Purchase_PrintEntity>();
  108. //List<Purchase_Print_DetailsEntity> purchase_Print_DetailsList = strpurchase_Print_DetailsList.ToObject<List<Purchase_Print_DetailsEntity>>();
  109. //purchase_PrintIBLL.SaveEntity(keyValue, entity, purchase_Print_DetailsList);
  110. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  111. Purchase_Print_ApplyEntity entity = parameter.strEntity.ToObject<Purchase_Print_ApplyEntity>();
  112. List<Purchase_Print_ApplydetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Print_ApplydetailsEntity>>();
  113. //var code = entity.EnCode;
  114. string id= purchaseprintIBLL.SaveEntity(parameter.keyValue, entity, detailList);
  115. var json = new
  116. {
  117. Id = id
  118. };
  119. return Success(json);
  120. }
  121. /// <summary>
  122. /// 提交
  123. /// <param name="_"></param>
  124. /// <summary>
  125. /// <returns></returns>
  126. public Response Submit(dynamic _)
  127. {
  128. Purchase_Print_ApplyEntity parameter = this.GetReqData<Purchase_Print_ApplyEntity>();
  129. //string keyValue = this.GetReqData();
  130. //var processId = Guid.NewGuid().ToString();
  131. purchaseprintIBLL.ModifyStatus(parameter.Id, 1, parameter.ProcessId);
  132. //UserInfo userInfo = LoginUserInfo.Get();
  133. //nWFProcessIBLL.CreateFlow("1-6", processId, "", 1, "", userInfo);
  134. return Success("提交成功!");
  135. }
  136. #endregion
  137. #region 私有类
  138. /// <summary>
  139. /// 表单实体类
  140. /// <summary>
  141. private class ReqFormEntity
  142. {
  143. public string keyValue { get; set; }
  144. public string strEntity { get; set; }
  145. public string DetailList { get; set; }
  146. }
  147. #endregion
  148. }
  149. }