LableQueryController.cs 2.0 KB

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