StoreStockChangeController.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using System.Web;
  3. using System.Collections.Generic;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.AspNetCore.Http;
  6. using MySystem.Models.Main;
  7. using Library;
  8. using System.Linq;
  9. using LitJson;
  10. using Microsoft.AspNetCore.Authorization;
  11. using MySystem.Service.Main;
  12. namespace MySystem.Areas.Api.Controllers.v1
  13. {
  14. [Area("Api")]
  15. [Route("Api/v1/[controller]/[action]")]
  16. public class StoreStockChangeController : BaseController
  17. {
  18. public StoreStockChangeController(IHttpContextAccessor accessor) : base(accessor)
  19. {
  20. }
  21. #region 首页-仓库管理-整箱划拨
  22. /// <summary>
  23. /// 首页-仓库管理-整箱划拨
  24. /// </summary>
  25. /// <returns></returns>
  26. [HttpPost]
  27. [Authorize]
  28. [Route("/main/storestockchange/transferwholeorone")]
  29. public JsonResult TransferWholeOrOne(string value)
  30. {
  31. value = PublicFunction.DesDecrypt(value);
  32. JsonData data = JsonMapper.ToObject(value);
  33. int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString())); //订单Id
  34. int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
  35. int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人
  36. string SnIds = data["SnIds"].ToString(); //机具SN的Id集合
  37. var info = StoreStockChangeUtil.TransferWholeOrOneDo(OrderId, StoreId, ToUserId, SnIds);
  38. if (info == "success")
  39. {
  40. return Json(new AppResultJson() { Status = "1", Info = "划拨成功", Data = "" });
  41. }
  42. else
  43. {
  44. return Json(new AppResultJson() { Status = "-1", Info = "划拨失败", Data = info });
  45. }
  46. }
  47. #endregion
  48. // #region 首页-仓库管理-逐台划拨
  49. // /// <summary>
  50. // /// 首页-仓库管理-逐台划拨
  51. // /// </summary>
  52. // /// <returns></returns>
  53. // [HttpPost]
  54. // [Authorize]
  55. // [Route("/main/storestockchange/transferone")]
  56. // public JsonResult TransferOne(string value)
  57. // {
  58. // value = PublicFunction.DesDecrypt(value);
  59. // JsonData data = JsonMapper.ToObject(value);
  60. // int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString())); //订单Id
  61. // int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
  62. // int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人
  63. // string SnIds = data["SnIds"].ToString(); //机具SN的Id集合
  64. // return Json(new AppResultJson() { Status = "1", Info = "", Data = "" });
  65. // }
  66. // #endregion
  67. #region 首页-仓库管理-售后单划拨
  68. /// <summary>
  69. /// 首页-仓库管理-售后单划拨
  70. /// </summary>
  71. /// <returns></returns>
  72. [HttpPost]
  73. [Authorize]
  74. [Route("/main/storestockchange/transferforchange")]
  75. public JsonResult TransferForChange(string value)
  76. {
  77. value = PublicFunction.DesDecrypt(value);
  78. JsonData data = JsonMapper.ToObject(value);
  79. int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString())); //订单Id
  80. int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
  81. string SnIds = data["SnIds"].ToString(); //机具SN的Id集合
  82. var info = StoreStockChangeUtil.TransferForChangeDo(OrderId, StoreId, SnIds);
  83. if (info == "success")
  84. {
  85. return Json(new AppResultJson() { Status = "1", Info = "划拨成功", Data = "" });
  86. }
  87. else
  88. {
  89. return Json(new AppResultJson() { Status = "-1", Info = "划拨失败", Data = info });
  90. }
  91. }
  92. #endregion
  93. }
  94. }