LableQueryController.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.Text.Json;
  10. using System.Data.SqlClient;
  11. using System.Data;
  12. namespace Procurement.Controllers
  13. {
  14. [Produces("application/json")]
  15. [Route("api/wms/[controller]")]
  16. public class LableQueryController : AbpController
  17. {
  18. private readonly ISqlRepository _repository;
  19. public LableQueryController(ISqlRepository sqlRepository)
  20. {
  21. _repository = sqlRepository;
  22. }
  23. [HttpGet]
  24. public async Task<IActionResult> Get(string domain, string location = "", string shelf = "", int page = 1)
  25. {
  26. ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
  27. string subMsg = "";
  28. dynamic items = null;
  29. try
  30. {
  31. SqlParameter[] parameters = {
  32. new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
  33. new SqlParameter { ParameterName = "@Location", Value = location,SqlDbType=SqlDbType.VarChar},
  34. new SqlParameter { ParameterName = "@Shelf", Value = shelf,SqlDbType=SqlDbType.VarChar},
  35. new SqlParameter { ParameterName = "@Page", Value = page,SqlDbType=SqlDbType.Int},
  36. };
  37. items = await _repository.GetListByProcAsync("pr_WMS_GetLableQueryWIPList", parameters);
  38. }
  39. catch (Exception ex)
  40. {
  41. subMsg = ex.Message;
  42. code = ResultCode.Fail;
  43. subCode = ResultCode.Fail;
  44. }
  45. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  46. return Ok(result);
  47. }
  48. }
  49. }