PurOrdMasterController.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using Procurement.Enums;
  2. using Microsoft.AspNetCore.Mvc;
  3. using System;
  4. using System.Threading.Tasks;
  5. using Volo.Abp.AspNetCore.Mvc;
  6. using Procurement.EntityFrameworkCore.SqlRepositories;
  7. using Procurement.ViewModel;
  8. using Procurement.Helpers;
  9. using System.Data.SqlClient;
  10. using System.Data;
  11. namespace Procurement.Controllers
  12. {
  13. [Produces("application/json")]
  14. [Route("api/[controller]")]
  15. public class PurOrdMasterController : AbpController
  16. {
  17. private readonly ISqlRepository _repository;
  18. public PurOrdMasterController(ISqlRepository sqlRepository)
  19. {
  20. _repository = sqlRepository;
  21. }
  22. /// <summary>
  23. /// ²É¹ºµ¥Ñ¡ÔñÁбí
  24. /// </summary>
  25. /// <param name="domain"></param>
  26. /// <returns></returns>
  27. [Route("purordselectlist")]
  28. [HttpGet]
  29. public async Task<IActionResult> GetPurOrd(string domain, string type = "", string supplier = "")
  30. {
  31. ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
  32. string subMsg = "";
  33. dynamic items = null;
  34. try
  35. {
  36. SqlParameter[] parameters = {
  37. new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
  38. new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar},
  39. new SqlParameter { ParameterName = "@Supplier", Value = supplier,SqlDbType=SqlDbType.VarChar},
  40. };
  41. items = await _repository.GetSingleListByProcAsync("pr_WMS_GetPurOrdList", parameters);
  42. }
  43. catch (Exception ex)
  44. {
  45. subMsg = ex.Message;
  46. code = ResultCode.Fail;
  47. subCode = ResultCode.Fail;
  48. }
  49. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  50. return Ok(result);
  51. }
  52. [Route("purorddetails")]
  53. [HttpGet]
  54. public async Task<IActionResult> GetPurOrdDetails(string domain, string purord, string type)
  55. {
  56. ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
  57. string subMsg = "";
  58. dynamic items = null;
  59. try
  60. {
  61. SqlParameter[] parameters = {
  62. new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
  63. new SqlParameter { ParameterName = "@PurOrd", Value = purord,SqlDbType=SqlDbType.VarChar},
  64. new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar}
  65. };
  66. items = await _repository.GetListByProcAsync("pr_WMS_GetPurOrdDetails", parameters);
  67. }
  68. catch (Exception ex)
  69. {
  70. subMsg = ex.Message;
  71. code = ResultCode.Fail;
  72. subCode = ResultCode.Fail;
  73. }
  74. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  75. return Ok(result);
  76. }
  77. [Route("purordnbrdetails")]
  78. [HttpGet]
  79. public async Task<IActionResult> GetPurOrdNbrDetails(string domain, string purord, string nbr)
  80. {
  81. ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
  82. string subMsg = "";
  83. dynamic items = null;
  84. try
  85. {
  86. SqlParameter[] parameters = {
  87. new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
  88. new SqlParameter { ParameterName = "@PurOrd", Value = purord,SqlDbType=SqlDbType.VarChar},
  89. new SqlParameter { ParameterName = "@Nbr", Value = nbr,SqlDbType=SqlDbType.VarChar}
  90. };
  91. items = await _repository.GetListByProcAsync("pr_WMS_GetVMIPurOrdNbrDetails", parameters);
  92. }
  93. catch (Exception ex)
  94. {
  95. subMsg = ex.Message;
  96. code = ResultCode.Fail;
  97. subCode = ResultCode.Fail;
  98. }
  99. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  100. return Ok(result);
  101. }
  102. }
  103. }