Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

134 linhas
4.2 KiB

  1. using Learun.Application.TwoDevelopment.AssetManagementSystem;
  2. using Learun.Util;
  3. using Nancy;
  4. namespace Learun.Application.WebApi
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  8. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  9. /// 创 建:超级管理员
  10. /// 日 期:2019-10-17 17:22
  11. /// 描 述:资产盘点明细表
  12. /// </summary>
  13. public class InventoryItemApi : BaseApi
  14. {
  15. private readonly Ass_InventoryItemApplyIBLL inventoryItemIBLL = new Ass_InventoryItemApplyBLL();
  16. /// <summary>
  17. /// 注册接口
  18. /// <summary>
  19. public InventoryItemApi()
  20. : base("/Learun/AssetManagementSystem/InventoryItem")
  21. {
  22. Get["/pagelist"] = GetPageList;
  23. Get["/form"] = GetForm;
  24. Get["/formbycode"] = GetFormByCode;
  25. Post["/delete"] = DeleteForm;
  26. Post["/save"] = SaveForm;
  27. }
  28. #region  私有类
  29. /// <summary>
  30. /// 表单实体类
  31. /// <summary>
  32. private class ReqFormEntity
  33. {
  34. public string keyValue { get; set; }
  35. public string strEntity { get; set; }
  36. }
  37. #endregion
  38. #region  获取数据
  39. /// <summary>
  40. /// 获取页面显示列表分页数据
  41. /// <summary>
  42. /// <param name="_"></param>
  43. /// <returns></returns>
  44. public Response GetPageList(dynamic _)
  45. {
  46. var parameter = GetReqData<ReqPageParam>();
  47. var data = inventoryItemIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  48. var jsonData = new
  49. {
  50. rows = data,
  51. parameter.pagination.total,
  52. parameter.pagination.page,
  53. parameter.pagination.records
  54. };
  55. return Success(jsonData);
  56. }
  57. /// <summary>
  58. /// 获取表单数据
  59. /// <summary>
  60. /// <param name="_"></param>
  61. /// <returns></returns>
  62. public Response GetForm(dynamic _)
  63. {
  64. var keyValue = GetReqData();
  65. var Ass_InventoryItemApplyData = inventoryItemIBLL.GetAss_InventoryItemApplyEntity(keyValue);
  66. var jsonData = new
  67. {
  68. Ass_InventoryItemApply = Ass_InventoryItemApplyData
  69. };
  70. return Success(jsonData);
  71. }
  72. /// <summary>
  73. /// 获取表单数据
  74. /// <summary>
  75. /// <param name="_"></param>
  76. /// <returns></returns>
  77. public Response GetFormByCode(dynamic _)
  78. {
  79. var keyValue = GetReqData<ACodeAAId>();
  80. var Ass_InventoryItemApplyData = inventoryItemIBLL.GetAss_InventoryItemApplyEntityByCode(keyValue.AAId,keyValue.acode);
  81. var jsonData = new
  82. {
  83. Ass_InventoryItemApply = Ass_InventoryItemApplyData
  84. };
  85. return Success(jsonData);
  86. }
  87. public class ACodeAAId
  88. {
  89. public string AAId { get; set; }
  90. public string acode { get; set; }
  91. }
  92. #endregion
  93. #region  提交数据
  94. /// <summary>
  95. /// 删除实体数据
  96. /// <param name="_"></param>
  97. /// <summary>
  98. /// <returns></returns>
  99. public Response DeleteForm(dynamic _)
  100. {
  101. var keyValue = GetReqData();
  102. inventoryItemIBLL.DeleteEntity(keyValue);
  103. return Success("删除成功!");
  104. }
  105. /// <summary>
  106. /// 保存实体数据(新增、修改)
  107. /// <param name="_"></param>
  108. /// <summary>
  109. /// <returns></returns>
  110. public Response SaveForm(dynamic _)
  111. {
  112. var parameter = GetReqData<ReqFormEntity>();
  113. var entity = parameter.strEntity.ToObject<Ass_InventoryItemApplyEntity>();
  114. entity.AIsCheck = true;
  115. inventoryItemIBLL.SaveEntity(userInfo, parameter.keyValue, entity);
  116. return Success("保存成功!");
  117. }
  118. #endregion
  119. }
  120. }