MobileTaskController.cs 1.9 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 MobileTaskController : AbpController
  15. {
  16. private readonly ISqlRepository _repository;
  17. public MobileTaskController(ISqlRepository sqlRepository)
  18. {
  19. _repository = sqlRepository;
  20. }
  21. [HttpGet]
  22. public async Task<IActionResult> Get(string typeid = "Wms", string userno = "", int page = 0)
  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 = "@TypeID", Value = typeid,SqlDbType=SqlDbTypes.VarChar},
  31. new SqlParameterViewModel { ParameterName = "@UserNo", Value = userno,SqlDbType=SqlDbTypes.VarChar},
  32. new SqlParameterViewModel { ParameterName = "@Page", Value = page,SqlDbType=SqlDbTypes.Int16},
  33. };
  34. items = await _repository.GetListByProcAsync("pr_WMS_BPM_GetMobileTaskList", parameters);
  35. }
  36. catch (Exception ex)
  37. {
  38. subMsg = ex.Message;
  39. code = ResultCode.Fail;
  40. subCode = ResultCode.Fail;
  41. }
  42. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  43. return Ok(result);
  44. }
  45. }
  46. }