PreSendStockDetailController.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 PreSendStockDetailController : BaseController
  17. {
  18. public PreSendStockDetailController(IHttpContextAccessor accessor) : base(accessor)
  19. {
  20. }
  21. #region 创客-首页-仓库管理-小分仓-确认发货
  22. /// <summary>
  23. /// 创客-首页-仓库管理-小分仓-确认发货
  24. /// </summary>
  25. /// <returns></returns>
  26. [HttpPost]
  27. [Authorize]
  28. [Route("/main/presendstockdetail/send")]
  29. public JsonResult Send(string value)
  30. {
  31. value = PublicFunction.DesDecrypt(value);
  32. JsonData data = JsonMapper.ToObject(value);
  33. int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //发货人Id
  34. int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人Id
  35. int FromStoreId = int.Parse(function.CheckInt(data["FromStoreId"].ToString())); //出货仓库Id
  36. int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型Id
  37. string SnIds = data["SnIds"].ToString(); //机具Id
  38. if (ToUserId <= 0)
  39. {
  40. return Json(new AppResultJson() { Status = "-1", Info = "收货创客不存在,请检查收货创客编号是否正确" });
  41. }
  42. var info = PreSendStockDetailUtil.SendDo(UserId, ToUserId, FromStoreId, BrandId, SnIds);
  43. if (info == "success")
  44. {
  45. return Json(new AppResultJson() { Status = "1", Info = "发货成功", Data = "" });
  46. }
  47. else
  48. {
  49. return Json(new AppResultJson() { Status = "-1", Info = "发货失败", Data = info });
  50. }
  51. }
  52. #endregion
  53. #region 创客-首页-仓库管理-小分仓-撤回
  54. /// <summary>
  55. /// 创客-首页-仓库管理-小分仓-撤回
  56. /// </summary>
  57. /// <returns></returns>
  58. [HttpPost]
  59. [Authorize]
  60. [Route("/main/presendstockdetail/cancel")]
  61. public JsonResult Cancel(string value)
  62. {
  63. value = PublicFunction.DesDecrypt(value);
  64. JsonData data = JsonMapper.ToObject(value);
  65. int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //发货人Id
  66. int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //记录Id
  67. string check = RedisDbconn.Instance.Get<string>("SmallStoreCancel:" + UserId);
  68. if (!string.IsNullOrEmpty(check))
  69. {
  70. return Json(new AppResultJson() { Status = "-1", Info = "请勿频繁操作,稍后再试" });
  71. }
  72. var info = PreSendStockDetailUtil.CancelDo(UserId, Id);
  73. if (info == "success")
  74. {
  75. return Json(new AppResultJson() { Status = "1", Info = "撤回成功", Data = "" });
  76. }
  77. else
  78. {
  79. return Json(new AppResultJson() { Status = "-1", Info = "撤回失败", Data = info });
  80. }
  81. }
  82. #endregion
  83. }
  84. }