ASNBOLShipperMasterController.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 ASNBOLShipperMasterController : AbpController
  16. {
  17. private readonly ISqlRepository _repository;
  18. public ASNBOLShipperMasterController(ISqlRepository sqlRepository)
  19. {
  20. _repository = sqlRepository;
  21. }
  22. /// <summary>
  23. /// µ¥ºÅÑ¡ÔñÁбí
  24. /// </summary>
  25. /// <param name="domain"></param>
  26. /// <returns></returns>
  27. [Route("nbrselectlist")]
  28. [HttpGet]
  29. public async Task<IActionResult> Get(string domain, string type, string userno)
  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 = "@UserNo", Value = userno,SqlDbType=SqlDbType.VarChar},
  40. };
  41. items = await _repository.GetSingleListByProcAsync("pr_WMS_GetASNBOLShipperList", 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("nbrdetails")]
  53. [HttpGet]
  54. public async Task<IActionResult> GetNbrDetails(string domain, string nbr, 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 = "@Nbr", Value = nbr,SqlDbType=SqlDbType.VarChar},
  64. new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar}
  65. };
  66. items = await _repository.GetListByProcAsync("pr_WMS_GetASNBOLShipperDetails", 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. }
  78. }