PurOrdMasterController.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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, string shipnbr = "")
  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. new SqlParameter { ParameterName = "@ShipNbr", Value = shipnbr,SqlDbType=SqlDbType.VarChar},
  66. };
  67. items = await _repository.GetListByProcAsync("pr_WMS_GetPurOrdDetails", parameters);
  68. }
  69. catch (Exception ex)
  70. {
  71. subMsg = ex.Message;
  72. code = ResultCode.Fail;
  73. subCode = ResultCode.Fail;
  74. }
  75. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  76. return Ok(result);
  77. }
  78. [Route("purordnbrdetails")]
  79. [HttpGet]
  80. public async Task<IActionResult> GetPurOrdNbrDetails(string domain, string purord, string nbr)
  81. {
  82. ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
  83. string subMsg = "";
  84. dynamic items = null;
  85. try
  86. {
  87. SqlParameter[] parameters = {
  88. new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
  89. new SqlParameter { ParameterName = "@PurOrd", Value = purord,SqlDbType=SqlDbType.VarChar},
  90. new SqlParameter { ParameterName = "@Nbr", Value = nbr,SqlDbType=SqlDbType.VarChar}
  91. };
  92. items = await _repository.GetListByProcAsync("pr_WMS_GetVMIPurOrdNbrDetails", parameters);
  93. }
  94. catch (Exception ex)
  95. {
  96. subMsg = ex.Message;
  97. code = ResultCode.Fail;
  98. subCode = ResultCode.Fail;
  99. }
  100. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  101. return Ok(result);
  102. }
  103. }
  104. }