You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.9 KiB

  1. using DTO;
  2. using HKCardOUT.Logic.Model;
  3. using HKCardOUT.Views;
  4. using HKLib.Dto;
  5. using Logic.RemoteModel;
  6. using System;
  7. using System.Collections.Concurrent;
  8. using System.Collections.Generic;
  9. using System.Globalization;
  10. using System.IO;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Data;
  15. using XExten.Advance.StaticFramework;
  16. namespace HKCardOUT.Helper
  17. {
  18. public class DataBus
  19. {
  20. private static string _ConnectionString;
  21. public static string ConnectionString
  22. {
  23. get => _ConnectionString;
  24. set
  25. {
  26. var Route = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DATA");
  27. _ConnectionString = $"DataSource={SyncStatic.CreateFile(Path.Combine(SyncStatic.CreateDir(Route), value))}";
  28. }
  29. }
  30. public static bool NetWordState { get; set; } = false;
  31. public static string Cron { get; set; }
  32. public static bool StartDevice { get; set; }
  33. public static bool Cancel { get; set; }
  34. public static string StoreId { get; set; }
  35. public static string TenantId { get; set; }
  36. public static string COM { get; set; }
  37. public static string SaasRoute { get; set; }
  38. public static int Span { get; set; }
  39. public static int Count { get; set; }
  40. public static List<string> Admin { get; set; }
  41. public static TimeSpilte Times { get; set; }
  42. public static StoreInfoResponse StoreInfo { get; set; }
  43. public static Dictionary<string, AdWindow> AdStatus { get; set; } = new Dictionary<string, AdWindow>();
  44. public static List<UserListDto> UserListDto { get; set; }
  45. public static ConcurrentQueue<SaleLogDto> saleLogDtos { get; set; }
  46. public static ConcurrentDictionary<string, ConcurrentQueue<SaleLogDto>> SaleLogDtoList { get; set; } = new ConcurrentDictionary<string, ConcurrentQueue<SaleLogDto>>();
  47. public static ConcurrentQueue<SaleLog> Entitys { get; set; }
  48. public static FoodDto Menu { get; set; }
  49. public static List<GateSetUp> RangeCtrl { get; set; }
  50. }
  51. public class ApiRoute
  52. {
  53. public static string GetTime = DataBus.SaasRoute + "api/one-card/eat-time-interval";
  54. /// <summary>
  55. /// 获取所有卡
  56. /// </summary>
  57. public static string CheckCardStatus = DataBus.SaasRoute + "api/one-card/card-list";
  58. /// <summary>
  59. /// 同步消费记录
  60. /// </summary>
  61. public static string SyncSaleLog = DataBus.SaasRoute + "api/member-helper/memberconsumptionorrecharge";
  62. /// <summary>
  63. /// 批量消费记录
  64. /// </summary>
  65. public static string SyncSaleLogList = DataBus.SaasRoute + "api/member-helper/memberconsumptionorrechargelist";
  66. /// <summary>
  67. /// 获取店铺信息
  68. /// </summary>
  69. public static string PullShopInfo = DataBus.SaasRoute + $"api/StoreHelper/GeBasisGateList?StoreId={DataBus.StoreId}";
  70. /// <summary>
  71. /// 区域控制
  72. /// </summary>
  73. public static string RangCtrl = DataBus.SaasRoute + $"api/StoreHelper/GetBasisGateSetUp?StoreId={DataBus.StoreId}";
  74. /// <summary>
  75. /// 菜品数据
  76. /// </summary>
  77. public static string FoodCtrl = DataBus.SaasRoute + $"api/StoreHelper/GetBasisGateFoodList?StoreId={DataBus.StoreId}";
  78. }
  79. public class HKConverter : IValueConverter
  80. {
  81. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  82. {
  83. return (bool)value ? "启用" : "禁用";
  84. }
  85. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  86. {
  87. return value;
  88. }
  89. }
  90. public class MemoryBus
  91. {
  92. public static List<CardStutas> CardStatus { get; set; } = new List<CardStutas>();
  93. public static List<SaleLog> CardRecord { get; set; } = new List<SaleLog>();
  94. }
  95. }