BreakUpBarcodeController.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. namespace Procurement.Controllers
  12. {
  13. [Produces("application/json")]
  14. [Route("api/wms/[controller]")]
  15. public class BreakUpBarcodeController : AbpController
  16. {
  17. private readonly ISqlRepository _repository;
  18. public BreakUpBarcodeController(ISqlRepository sqlRepository)
  19. {
  20. _repository = sqlRepository;
  21. }
  22. /// <summary>
  23. /// ±£´æ
  24. /// </summary>
  25. /// <returns></returns>
  26. [HttpPost]
  27. public async Task<IActionResult> Post([FromBody] JsonElement jsonElement)
  28. {
  29. if (jsonElement.ValueKind == JsonValueKind.Undefined || jsonElement.ValueKind == JsonValueKind.Null)
  30. {
  31. return BadRequest();
  32. }
  33. ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
  34. string subMsg = "";
  35. dynamic items = null;
  36. try
  37. {
  38. string proc = "pr_WMS_SaveBreakUpBarcodes";
  39. SqlParameter[] sqlParams = SqlHelper.CreateSqlParameters(jsonElement);
  40. items = await _repository.GetListByProcAsync(proc, sqlParams);
  41. //´òÓ¡
  42. BarCodeHelper helper = new BarCodeHelper();
  43. helper.getPrintItems(items, sqlParams, _repository);
  44. }
  45. catch (Exception ex)
  46. {
  47. subMsg = ex.Message;
  48. code = ResultCode.Fail;
  49. subCode = ResultCode.Fail;
  50. }
  51. ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
  52. return Ok(result);
  53. }
  54. }
  55. }