FJDeviceMonitorController.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using Microsoft.AspNetCore.Mvc;
  2. using WMS.BZWeb;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Linq;
  7. using System.Reflection;
  8. using System.Web;
  9. using WMS.Info.Models.WCSDeviceMonitor;
  10. using Microsoft.Extensions.DependencyInjection;
  11. using FreeRedis;
  12. using WCS.Entity.Protocol.DataStructure;
  13. using MessagePack;
  14. namespace WMS.BZWeb
  15. {
  16. [Area("DeviceMonitorManager")]
  17. public class FJDeviceMonitorController : MvcControllerBase
  18. {
  19. private readonly RedisClient _FJRedis;
  20. //交互点
  21. public readonly List<int> InteractionPointFirstFloor = new List<int> { 1001 };
  22. public readonly List<int> InteractionPointSecondFloor = new List<int> { 1001 };
  23. public FJDeviceMonitorController(IServiceProvider serviceProvider)
  24. {
  25. var redisDict = serviceProvider.GetRequiredService<Dictionary<string, RedisClient>>();
  26. if (redisDict.Any())
  27. {
  28. _FJRedis = redisDict["FJRedis"];
  29. _FJRedis.Serialize = obj => MessagePackSerializer.Serialize(obj);// JsonConvert.SerializeObject(obj);
  30. _FJRedis.DeserializeRaw = (bytes, type) => MessagePackSerializer.Deserialize(type, bytes);// JsonConvert.DeserializeObject(json, type);
  31. }
  32. }
  33. #region 视图功能
  34. // GET: DeviceMonitorManager/FJDeviceMonitor
  35. public ActionResult Index()
  36. {
  37. return View();
  38. }
  39. /// <summary>
  40. /// 表单页
  41. /// <summary>
  42. /// <returns></returns>
  43. [HttpGet]
  44. public ActionResult DDJDetail()
  45. {
  46. return View();
  47. }
  48. #endregion
  49. /// <summary>
  50. /// 获取设备信息
  51. /// </summary>
  52. /// <param name="code"></param>
  53. /// <returns></returns>
  54. [HttpGet]
  55. //////[AjaxOnly]
  56. public ActionResult GetDeviceData(string code)
  57. {
  58. //DeviceDataPack dp = new DeviceDataPack();
  59. return null;
  60. }
  61. }
  62. }