Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

152 рядки
5.6 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. purchaseprintIBLL.SaveEntity(parameter.keyValue, entity, detailList);
  115. return Success("保存成功!");
  116. }
  117. /// <summary>
  118. /// 提交
  119. /// <param name="_"></param>
  120. /// <summary>
  121. /// <returns></returns>
  122. public Response Submit(dynamic _)
  123. {
  124. string keyValue = this.GetReqData();
  125. var processId = Guid.NewGuid().ToString();
  126. purchaseprintIBLL.ModifyStatus(keyValue, 1, processId);
  127. UserInfo userInfo = LoginUserInfo.Get();
  128. nWFProcessIBLL.CreateFlow("1-6", processId, "", 1, "", userInfo);
  129. return Success("提交成功!");
  130. }
  131. #endregion
  132. #region 私有类
  133. /// <summary>
  134. /// 表单实体类
  135. /// <summary>
  136. private class ReqFormEntity
  137. {
  138. public string keyValue { get; set; }
  139. public string strEntity { get; set; }
  140. public string DetailList { get; set; }
  141. }
  142. #endregion
  143. }
  144. }