@@ -21,6 +21,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HKLib", "HKLib\HKLib.csproj | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HKCardManager", "HKCardManager\HKCardManager.csproj", "{96C17249-7F4A-4D25-B658-507A8E876582}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfTest", "WpfTest\WpfTest.csproj", "{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
@@ -101,6 +103,14 @@ Global | |||
{96C17249-7F4A-4D25-B658-507A8E876582}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{96C17249-7F4A-4D25-B658-507A8E876582}.Release|x86.ActiveCfg = Release|Any CPU | |||
{96C17249-7F4A-4D25-B658-507A8E876582}.Release|x86.Build.0 = Release|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Debug|x86.Build.0 = Debug|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Release|x86.ActiveCfg = Release|Any CPU | |||
{8312F839-6DA5-4BF0-8BB3-D1505E194AB5}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -78,6 +78,7 @@ namespace HKCardOUT | |||
DataBus.StartDevice = configer["StartDevice"].AsBool(); | |||
DataBus.Cancel = configer["Cancel"].AsBool(); | |||
DataBus.Count = configer["Count"].AsInt(); | |||
DataBus.MQTT = configer["MQTT"].ToString(); | |||
DataBus.Admin = configer.GetSection("Admin").GetChildren().Select(t => t.Value).ToList(); | |||
HKLib.Configer.SaasRoute = DataBus.SaasRoute; | |||
RemoteService.PullShopInfo(); | |||
@@ -95,6 +96,7 @@ namespace HKCardOUT | |||
DataBus.saleLogDtos = new System.Collections.Concurrent.ConcurrentQueue<DTO.SaleLogDto>(); | |||
RemoteService.GetFoodMenus(); | |||
RemoteService.GetRangeCtrl(); | |||
MQTTCon.Connection(); | |||
base.Configure(); | |||
} | |||
@@ -14,9 +14,9 @@ | |||
<AssemblyVersion>1.0.0.0</AssemblyVersion> | |||
<Platforms>AnyCPU;x86</Platforms> | |||
</PropertyGroup> | |||
<PropertyGroup> | |||
<!--<PropertyGroup> | |||
<ApplicationManifest>App.manifest</ApplicationManifest> | |||
</PropertyGroup> | |||
</PropertyGroup>--> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |||
<DefineConstants>TRACE;Core</DefineConstants> | |||
</PropertyGroup> | |||
@@ -33,7 +33,9 @@ | |||
<None Remove="HKResouces\背景.jpg" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.25" /> | |||
<PackageReference Include="BPA.Communication" Version="1.0.42" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.78" /> | |||
<PackageReference Include="CalcBinding" Version="2.5.2" /> | |||
<PackageReference Include="HandyControls" Version="3.4.1" /> | |||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | |||
@@ -0,0 +1,210 @@ | |||
using BPA.Communication; | |||
using BPA.Helper; | |||
using BPA.Message; | |||
using DTO; | |||
using HKCardOUT.Helper; | |||
using HKCardOUT.Logic.Service; | |||
using HKControl; | |||
using HKLib.Dto; | |||
using ImTools; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
namespace Helper.BigScreen | |||
{ | |||
public class DataCenter | |||
{ | |||
public static List<string> S1 { get; set; } = new List<string>(2); | |||
public static List<string> S2 { get; set; } = new List<string>(2); | |||
public static List<string> S3 { get; set; } = new List<string>(2); | |||
public static List<string> S4 { get; set; } = new List<string>(2); | |||
public static List<string> S5 { get; set; } = new List<string>(2); | |||
public static List<string> S6 { get; set; } = new List<string>(2); | |||
public static void CreateData() | |||
{ | |||
ThreadManage.GetInstance().StartLong(() => | |||
{ | |||
var model = new HKCore().GetDayData(); | |||
var sender = new ScreenModelSplitMeals(); | |||
sender.IsRun = IsRun.运行; | |||
if (!Main.GetInstance.GetIsConnect(6) || !Main.GetInstance.GetIsConnect(5)) | |||
sender.RobotStatu1 = WorkStatus.停止; | |||
if (!Main.GetInstance.GetIsConnect(4) || !Main.GetInstance.GetIsConnect(3)) | |||
sender.RobotStatu2 = WorkStatus.停止; | |||
if (!Main.GetInstance.GetIsConnect(2) || !Main.GetInstance.GetIsConnect(1)) | |||
sender.RobotStatu3 = WorkStatus.停止; | |||
sender.WorkStatus_1 = Main.GetInstance.GetIsSwipe(6) ? WorkStatus.工作 : WorkStatus.待机; | |||
sender.WorkStatus_2 = Main.GetInstance.GetIsSwipe(5) ? WorkStatus.工作 : WorkStatus.待机; | |||
sender.WorkStatus_3 = Main.GetInstance.GetIsSwipe(4) ? WorkStatus.工作 : WorkStatus.待机; | |||
sender.WorkStatus_4 = Main.GetInstance.GetIsSwipe(3) ? WorkStatus.工作 : WorkStatus.待机; | |||
sender.WorkStatus_5 = Main.GetInstance.GetIsSwipe(2) ? WorkStatus.工作 : WorkStatus.待机; | |||
sender.WorkStatus_6 = Main.GetInstance.GetIsSwipe(1) ? WorkStatus.工作 : WorkStatus.待机; | |||
sender.SplitMeals_CreditCardCount_1 = model["6"]; | |||
if (DataBus.SaleLogDtoList.ContainsKey("6")) | |||
{ | |||
if (DataBus.SaleLogDtoList["6"].Count > 0) | |||
{ | |||
if (DataBus.SaleLogDtoList["6"].TryDequeue(out SaleLogDto info)) | |||
{ | |||
var Name = DataBus.UserListDto.Where(t => t.Cards.Select(x => x.CardNum).Contains(info.CardNo)).Select(x => x.Name).FirstOrDefault(); | |||
if (S1.Count >= 2) | |||
{ | |||
S1.RemoveAt(0); | |||
S1.Add(Name); | |||
} | |||
else | |||
S1.Add(Name); | |||
sender.SplitMeals_CreditCardNameBefore_1 = S1[0]; | |||
sender.SplitMeals_CreditCardName_1 = S1.Count >= 2 ? S1[1] : S1[0]; | |||
} | |||
} | |||
} | |||
var GateId = DataBus.StoreInfo.Devices.Where(t => t.Address == $"05" || t.Address == $"06").Select(t => t.GateId).FirstOrDefault(); | |||
var res = DataBus.Menu.GateFood.Where(t => t.GateId == GateId)?.Select(t => t.Foods)?.FirstOrDefault(); | |||
sender.SplitMeals_CookType_1 = res; | |||
sender.SplitMeals_CreditCardCount_2 = model["5"]; | |||
if (DataBus.SaleLogDtoList.ContainsKey("5")) | |||
{ | |||
if (DataBus.SaleLogDtoList["5"].Count > 0) | |||
{ | |||
if (DataBus.SaleLogDtoList["5"].TryDequeue(out SaleLogDto info)) | |||
{ | |||
var Name = DataBus.UserListDto.Where(t => t.Cards.Select(x => x.CardNum).Contains(info.CardNo)).Select(x => x.Name).FirstOrDefault(); | |||
if (S2.Count >= 2) | |||
{ | |||
S2.RemoveAt(0); | |||
S2.Add(Name); | |||
} | |||
else | |||
S2.Add(Name); | |||
sender.SplitMeals_CreditCardNameBefore_2 = S2[0]; | |||
sender.SplitMeals_CreditCardName_2 = S2.Count >= 2 ? S2[1] : S2[0]; | |||
} | |||
} | |||
} | |||
sender.SplitMeals_CookType_2 = res; | |||
sender.SplitMeals_CreditCardCount_3 = model["4"]; | |||
if (DataBus.SaleLogDtoList.ContainsKey("4")) | |||
{ | |||
if (DataBus.SaleLogDtoList["4"].Count > 0) | |||
{ | |||
if (DataBus.SaleLogDtoList["4"].TryDequeue(out SaleLogDto info)) | |||
{ | |||
var Name = DataBus.UserListDto.Where(t => t.Cards.Select(x => x.CardNum).Contains(info.CardNo)).Select(x => x.Name).FirstOrDefault(); | |||
if (S3.Count >= 2) | |||
{ | |||
S3.RemoveAt(0); | |||
S3.Add(Name); | |||
} | |||
else | |||
S3.Add(Name); | |||
sender.SplitMeals_CreditCardNameBefore_3 = S3[0]; | |||
sender.SplitMeals_CreditCardName_3 = S3.Count >= 2 ? S3[1] : S3[0]; | |||
} | |||
} | |||
} | |||
sender.SplitMeals_CookType_3 = res; | |||
sender.SplitMeals_CreditCardCount_4 = model["3"]; | |||
if (DataBus.SaleLogDtoList.ContainsKey("3")) | |||
{ | |||
if (DataBus.SaleLogDtoList["3"].Count > 0) | |||
{ | |||
if (DataBus.SaleLogDtoList["3"].TryDequeue(out SaleLogDto info)) | |||
{ | |||
var Name = DataBus.UserListDto.Where(t => t.Cards.Select(x => x.CardNum).Contains(info.CardNo)).Select(x => x.Name).FirstOrDefault(); | |||
if (S4.Count >= 2) | |||
{ | |||
S4.RemoveAt(0); | |||
S4.Add(Name); | |||
} | |||
else | |||
S4.Add(Name); | |||
sender.SplitMeals_CreditCardNameBefore_4 = S4[0]; | |||
sender.SplitMeals_CreditCardName_4 = S4.Count >= 2 ? S4[1] : S4[0]; | |||
} | |||
} | |||
} | |||
sender.SplitMeals_CookType_4 = res; | |||
sender.SplitMeals_CreditCardCount_5 = model["2"]; | |||
if (DataBus.SaleLogDtoList.ContainsKey("2")) | |||
{ | |||
if (DataBus.SaleLogDtoList["2"].Count > 0) | |||
{ | |||
if (DataBus.SaleLogDtoList["2"].TryDequeue(out SaleLogDto info)) | |||
{ | |||
var Name = DataBus.UserListDto.Where(t => t.Cards.Select(x => x.CardNum).Contains(info.CardNo)).Select(x => x.Name).FirstOrDefault(); | |||
if (S5.Count >= 2) | |||
{ | |||
S5.RemoveAt(0); | |||
S5.Add(Name); | |||
} | |||
else | |||
S5.Add(Name); | |||
sender.SplitMeals_CreditCardNameBefore_5 = S5[0]; | |||
sender.SplitMeals_CreditCardName_5 = S5.Count >= 2 ? S5[1] : S5[0]; | |||
} | |||
} | |||
} | |||
sender.SplitMeals_CookType_5 = res; | |||
sender.SplitMeals_CreditCardCount_6 = model["1"]; | |||
if (DataBus.SaleLogDtoList.ContainsKey("1")) | |||
{ | |||
if (DataBus.SaleLogDtoList["1"].Count > 0) | |||
{ | |||
if (DataBus.SaleLogDtoList["1"].TryDequeue(out SaleLogDto info)) | |||
{ | |||
var Name = DataBus.UserListDto.Where(t => t.Cards.Select(x => x.CardNum).Contains(info.CardNo)).Select(x => x.Name).FirstOrDefault(); | |||
if (S6.Count >= 2) | |||
{ | |||
S6.RemoveAt(0); | |||
S6.Add(Name); | |||
} | |||
else | |||
S6.Add(Name); | |||
sender.SplitMeals_CreditCardNameBefore_6 = S6[0]; | |||
sender.SplitMeals_CreditCardName_6 = S6.Count >= 2 ? S6[1] : S6[0]; | |||
} | |||
} | |||
} | |||
sender.SplitMeals_CookType_6 = res; | |||
sender.StatsCount = new List<StatsModel> { | |||
new StatsModel { } | |||
}; | |||
MQTTCon.Send(sender); | |||
Thread.Sleep(10); | |||
}, $"屏幕刷卡信息", true); | |||
} | |||
public static void InitQueeue() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (DataBus.saleLogDtos.Count > 0) | |||
{ | |||
if (DataBus.saleLogDtos.TryDequeue(out SaleLogDto info)) | |||
{ | |||
if (!DataBus.SaleLogDtoList.ContainsKey(info.Location)) | |||
DataBus.SaleLogDtoList.TryAdd(info.Location, new ConcurrentQueue<SaleLogDto>()); | |||
DataBus.SaleLogDtoList[info.Location].Enqueue(info); | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "刷卡队列分配"); | |||
} | |||
} | |||
} |
@@ -1,8 +1,13 @@ | |||
using DTO; | |||
using BPA.Communication; | |||
using BPA.Helper; | |||
using BPA.Message.Enum; | |||
using BPA.Message; | |||
using DTO; | |||
using HKCardOUT.Logic.Model; | |||
using HKCardOUT.Views; | |||
using HKLib.Dto; | |||
using Logic.RemoteModel; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
@@ -12,7 +17,9 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
using System.Xml.Linq; | |||
using XExten.Advance.StaticFramework; | |||
using static System.Net.Mime.MediaTypeNames; | |||
namespace HKCardOUT.Helper | |||
{ | |||
@@ -38,6 +45,7 @@ namespace HKCardOUT.Helper | |||
public static string SaasRoute { get; set; } | |||
public static int Span { get; set; } | |||
public static int Count { get; set; } | |||
public static string MQTT { get; set; } | |||
public static List<string> Admin { get; set; } | |||
public static TimeSpilte Times { get; set; } | |||
public static StoreInfoResponse StoreInfo { get; set; } | |||
@@ -92,8 +100,108 @@ namespace HKCardOUT.Helper | |||
} | |||
} | |||
public class MemoryBus | |||
{ | |||
{ | |||
public static List<CardStutas> CardStatus { get; set; } = new List<CardStutas>(); | |||
public static List<SaleLog> CardRecord { get; set; } = new List<SaleLog>(); | |||
} | |||
public static class MQTTCon | |||
{ | |||
static MqttHelper mqttHelper; | |||
static MQTTCon() | |||
{ | |||
mqttHelper = new MqttHelper(); | |||
} | |||
/// <summary> | |||
/// Mqtt是否运行 | |||
/// </summary> | |||
static bool IsRunningMqtt = false; | |||
public static void Connection() | |||
{ | |||
try | |||
{ | |||
//2.Mqtt连接 | |||
if (!string.IsNullOrEmpty(DataBus.MQTT) && DataBus.MQTT.Contains(',')) | |||
{ | |||
string[] mqttcom = DataBus.MQTT.Split(','); | |||
if (mqttcom != null && mqttcom.Count() == 4) | |||
{ | |||
mqttHelper.Connect(mqttcom[2], mqttcom[3], mqttcom[0], int.Parse(mqttcom[1]), $"分餐机{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); | |||
} | |||
} | |||
mqttHelper.Disconnect = new Action(() => | |||
{ | |||
IsRunningMqtt = false; | |||
MessageLog.GetInstance.ShowEx($"分餐机MQTT异常断开...."); | |||
}); | |||
mqttHelper.ConnectOk = new Action(() => | |||
{ | |||
IsRunningMqtt = true;//连接成功 | |||
}); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"分餐机初始化连接 MQTT,原因:{ex.Message}"); | |||
} | |||
} | |||
public static void Send(ScreenModelSplitMeals screenModel) | |||
{ | |||
SendScreenDataModel sendScreenData = new SendScreenDataModel(); | |||
sendScreenData.Name = ScreenDeviceType.分餐机; | |||
sendScreenData.Value = screenModel; | |||
//new ScreenModelSplitMeals | |||
//{ | |||
// IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止, | |||
// WorkStatus = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
// RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
// Alarm = new List<AlarmModel> { | |||
// new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
// new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
// new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
// }, | |||
// FailuresCount = 0, | |||
// StatsCount = new List<StatsModel> { | |||
// new StatsModel { Name = name_s[0], Count = new Random().Next(0, 100) }, | |||
// new StatsModel { Name = name_s[1], Count = new Random().Next(0, 100) }, | |||
// new StatsModel { Name = name_s[2], Count = new Random().Next(0, 100) }, | |||
// new StatsModel { Name = name_s[3], Count = new Random().Next(0, 100) }, | |||
// new StatsModel { Name = name_s[4], Count = new Random().Next(0, 100) }, | |||
// }, | |||
// SplitMeals_CreditCardCount_1 = new Random().Next(0, 100), | |||
// SplitMeals_CreditCardNameBefore_1 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CreditCardName_1 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CookType_1 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
// SplitMeals_CreditCardCount_2 = new Random().Next(0, 100), | |||
// SplitMeals_CreditCardNameBefore_2 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CreditCardName_2 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CookType_2 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
// SplitMeals_CreditCardCount_3 = new Random().Next(0, 100), | |||
// SplitMeals_CreditCardNameBefore_3 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CreditCardName_3 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CookType_3 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
// SplitMeals_CreditCardCount_4 = new Random().Next(0, 100), | |||
// SplitMeals_CreditCardNameBefore_4 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CreditCardName_4 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CookType_4 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
// SplitMeals_CreditCardCount_5 = new Random().Next(0, 100), | |||
// SplitMeals_CreditCardNameBefore_5 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CreditCardName_5 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CookType_5 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
// SplitMeals_CreditCardCount_6 = new Random().Next(0, 100), | |||
// SplitMeals_CreditCardNameBefore_6 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CreditCardName_6 = name_XM[new Random().Next(0, 5)], | |||
// SplitMeals_CookType_6 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
//}; | |||
string message = JsonConvert.SerializeObject(sendScreenData); | |||
mqttHelper.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.分餐机), message); | |||
} | |||
} | |||
} |
@@ -292,6 +292,16 @@ namespace HKCardOUT.Logic.Service | |||
.WhereIF(screen.Length == 2, t => t.Location == a || t.Location == b).Select(t => t.Location).ToList(); | |||
return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); | |||
} | |||
/// <summary> | |||
/// 获取当天的刷卡 | |||
/// </summary> | |||
/// <returns></returns> | |||
public Dictionary<string, int> GetDayData() | |||
{ | |||
var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); | |||
var count = DbContext.Context.Queryable<SaleLog>().Select(t => t.Location).ToList(); | |||
return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count()); | |||
} | |||
public void WriteData() | |||
{ | |||
@@ -1,5 +1,6 @@ | |||
using BPA.Helper; | |||
using DTO; | |||
using Helper.BigScreen; | |||
using HKCardOUT.Helper; | |||
using HKCardOUT.Logic.Model; | |||
using HKCardOUT.Logic.Service; | |||
@@ -39,6 +40,8 @@ namespace HKCardOUT.ViewModels | |||
serv.GetAllCardStatus(); | |||
ProcessCard(); | |||
InsertData(); | |||
DataCenter.InitQueeue(); | |||
DataCenter.CreateData(); | |||
} | |||
/// <summary> | |||
@@ -133,7 +136,7 @@ namespace HKCardOUT.ViewModels | |||
Device = t.Name, | |||
Stalls = x.Name | |||
}).ToList(); | |||
if (Init != null) | |||
/* if (Init != null) | |||
{ | |||
Ad = new ObservableCollection<AdDTO>(Init); | |||
var route = SyncStatic.CreateFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AD.txt")); | |||
@@ -145,7 +148,7 @@ namespace HKCardOUT.ViewModels | |||
var jsons = SyncStatic.Decompress(SyncStatic.ReadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AD.txt")), SecurityType.Base64); | |||
Ad = new ObservableCollection<AdDTO>(jsons.ToModel<List<AdDTO>>()); | |||
AdOpen(); | |||
} | |||
}*/ | |||
})); | |||
} | |||
@@ -24,8 +24,10 @@ | |||
//"MQ": "host=10.2.1.21:5672;username=guest;password=guest" | |||
//MQ正式地址 | |||
"MQ": "host=47.108.65.220;username=root;password=pwd", | |||
//MQTT | |||
"MQTT": "10.2.1.254,1883,admin,public", | |||
//超级卡 | |||
"Admin": [6666666666666666666,8888888888888888888,9999999999999999999,1590198360768385024,1590198442460844032], | |||
"Admin": [ 6666666666666666666, 8888888888888888888, 9999999999999999999, 1590198360768385024, 1590198442460844032 ], | |||
//刷卡间隔 | |||
"Span": 5 | |||
} |
@@ -0,0 +1,9 @@ | |||
<Application x:Class="WpfTest.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:WpfTest" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources> | |||
</Application.Resources> | |||
</Application> |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace WpfTest | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
using System.Windows; | |||
[assembly: ThemeInfo( | |||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | |||
//(used if a resource is not found in the page, | |||
// or application resource dictionaries) | |||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | |||
//(used if a resource is not found in the page, | |||
// app, or any theme specific resource dictionaries) | |||
)] |
@@ -0,0 +1,13 @@ | |||
<Window x:Class="WpfTest.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:WpfTest" | |||
mc:Ignorable="d" | |||
Title="MainWindow" Height="450" Width="800"> | |||
<Grid> | |||
<TextBox x:Name="textwb" Background="Black" Foreground="#FFC000FB" TextWrapping="Wrap" AcceptsReturn="True" ></TextBox> | |||
<Button Width="100" Height="100" Click="Button_Click" Visibility="Collapsed"></Button> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,382 @@ | |||
using BPA.Communication; | |||
using BPA.Helper; | |||
using BPA.Message; | |||
using BPA.Message.Enum; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace WpfTest | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
/// <summary> | |||
/// MQTT连接信息 | |||
/// </summary> | |||
public string MQTTConnection { get; set; } = "10.2.1.254,1883,admin,public"; | |||
/// <summary> | |||
/// Mqtt是否运行 | |||
/// </summary> | |||
public bool IsRunningMqtt = false; | |||
/// <summary> | |||
/// Mqtt | |||
/// </summary> | |||
public MqttHelper mqttHelper = new MqttHelper(); | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
Connection(); | |||
ThreadServer(); | |||
//Button_Click(null, null); | |||
} | |||
public void ThreadServer() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
try | |||
{ | |||
if (IsRunningMqtt) | |||
{ | |||
Send(ScreenDeviceType.大炒); | |||
Thread.Sleep(1000); | |||
Send(ScreenDeviceType.小炒); Thread.Sleep(1000); | |||
Send(ScreenDeviceType.煮面机); Thread.Sleep(1000); | |||
Send(ScreenDeviceType.分餐机); Thread.Sleep(1000); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"{Name}:线程服务异常,原因:{ex.Message}"); | |||
} | |||
Thread.Sleep(100); | |||
}), $"{Name},线程服务"); | |||
} | |||
/// <summary> | |||
/// 初始化连接Redis MQTT | |||
/// </summary> | |||
public void Connection() | |||
{ | |||
try | |||
{ | |||
//2.Mqtt连接 | |||
if (!string.IsNullOrEmpty(this.MQTTConnection) && this.MQTTConnection.Contains(',')) | |||
{ | |||
string[] mqttcom = this.MQTTConnection.Split(','); | |||
if (mqttcom != null && mqttcom.Count() == 4) | |||
{ | |||
mqttHelper.Connect(mqttcom[2], mqttcom[3], mqttcom[0], int.Parse(mqttcom[1]), $"{Name}:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); | |||
} | |||
} | |||
mqttHelper.Disconnect = new Action(() => | |||
{ | |||
IsRunningMqtt = false; | |||
MessageLog.GetInstance.ShowEx($"{Name}:MQTT异常断开...."); | |||
}); | |||
mqttHelper.ConnectOk = new Action(() => | |||
{ | |||
IsRunningMqtt = true;//连接成功 | |||
}); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"{Name}:初始化连接 MQTT,原因:{ex.Message}"); | |||
} | |||
} | |||
public void Send(ScreenDeviceType screen) | |||
{ | |||
int k2 =new Random().Next(0, 2); | |||
SendScreenDataModel sendScreenData = new SendScreenDataModel(); | |||
List<ORDER_STATUS> oRDER_STATUS = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING, ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE, ORDER_STATUS.ERR_NOT_REPLY_WHEN_COOKING }; | |||
List<string> name_s = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花", "尖椒鸡杂", "回锅肉" }; | |||
List<string> name_s_zm = new List<string>() { "清汤面", "鸡蛋面", "火鸡面", "回锅肉面", "鸡杂面" }; | |||
List<string> name_XM = new List<string>() { "王权贵", "张哲", "李青古", "龙西", "李富贵" }; | |||
int k = new Random().Next(0, 5); | |||
int M = new Random().Next(0, 5); | |||
if (screen == ScreenDeviceType.大炒) | |||
{ | |||
sendScreenData.Name = screen; | |||
sendScreenData.Value = new ScreenModelMaxWok | |||
{ | |||
IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止, | |||
WorkStatus_1 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
WorkStatus_2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
// Alarm = new List<AlarmModel> { | |||
// new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
// new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
// new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
//}, | |||
FailuresCount = 0, | |||
StatsCount = new List<StatsModel> { | |||
new StatsModel{Name= name_s[0],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[1],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[2],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[3],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[4],Count=new Random().Next(0, 100)}, | |||
}, | |||
MaxWok_Dishes_1 = "回锅肉", | |||
MaxWok_Task_1 = "炒菜中", | |||
MaxWok_Process_1 = new List<ProcessModel> { | |||
new ProcessModel{ Id=0,Name= "清洗", Status=(M==0) ? ProcessStatus.正在执行:((M>0)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=1,Name= "到菜", Status=(M==1) ? ProcessStatus.正在执行:((M>1)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=2,Name= "翻炒", Status=(M==2) ? ProcessStatus.正在执行:((M>2)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=3,Name= "调料", Status=(M==3) ? ProcessStatus.正在执行:((M>3)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=4,Name= "完成", Status=(M==4) ? ProcessStatus.正在执行:((M>4)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
}, | |||
MaxWok_HeatGear_1 = "1", | |||
MaxWok_StirGear_1 = "2", | |||
MaxWok_FlipSpeed_1 = "30", | |||
MaxWok_Temp_1 = "102", | |||
MaxWok_OrderCount_1 = new Random().Next(0, 100), | |||
MaxWok_ErrorOrderCount_1 = new Random().Next(0, 100), | |||
MaxWok_Dishes_2 = "烂肉豇豆", | |||
MaxWok_Task_2 = "炒菜中", | |||
MaxWok_Process_2 = new List<ProcessModel> { | |||
new ProcessModel{ Id=0,Name= "清洗", Status=(k==0) ? ProcessStatus.正在执行:((k>0)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=1,Name= "到菜", Status=(k==1) ? ProcessStatus.正在执行:((k>1)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=2,Name= "翻炒", Status=(k==2) ? ProcessStatus.正在执行:((k>2)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=3,Name= "调料", Status=(k==3) ? ProcessStatus.正在执行:((k>3)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=4,Name= "完成", Status=(k==4) ? ProcessStatus.正在执行:((k>4)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
}, | |||
MaxWok_HeatGear_2 = "2", | |||
MaxWok_StirGear_2 = "3", | |||
MaxWok_FlipSpeed_2 = "32", | |||
MaxWok_Temp_2 = "132", | |||
MaxWok_OrderCount_2 = new Random().Next(0, 100), | |||
MaxWok_ErrorOrderCount_2 = new Random().Next(0, 100), | |||
}; | |||
} | |||
else if (screen == ScreenDeviceType.小炒) | |||
{ | |||
sendScreenData.Name = screen; | |||
sendScreenData.Value = new ScreenModelMinWok | |||
{ | |||
IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止, | |||
WorkStatus_1 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
WorkStatus_2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
// Alarm = new List<AlarmModel> { | |||
// new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
// new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
// new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
//}, | |||
FailuresCount = 0, | |||
StatsCount = new List<StatsModel> { | |||
new StatsModel{Name= name_s[0],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[1],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[2],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[3],Count=new Random().Next(0, 100)}, | |||
new StatsModel{Name= name_s[4],Count=new Random().Next(0, 100)}, | |||
}, | |||
MinWok_Dishes_1 = "回锅肉", | |||
MinWok_Task_1 = "炒菜中", | |||
MinWok_Process_1 = new List<ProcessModel> { | |||
new ProcessModel{ Id=0,Name= "清洗", Status=(M==0) ? ProcessStatus.正在执行:((M>0)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=1,Name= "到菜", Status=(M==1) ? ProcessStatus.正在执行:((M>1)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=2,Name= "翻炒", Status=(M==2) ? ProcessStatus.正在执行:((M>2)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=3,Name= "调料", Status=(M==3) ? ProcessStatus.正在执行:((M>3)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=4,Name= "完成", Status=(M==4) ? ProcessStatus.正在执行:((M>4)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
}, | |||
MinWok_HeatGear_1 = "1", | |||
MinWok_StirGear_1 = "2", | |||
MinWok_FlipSpeed_1 = "30", | |||
MinWok_Temp_1 = "102", | |||
MinWok_OrderCount_1 = new Random().Next(0, 100), | |||
MinWok_ErrorOrderCount_1 = new Random().Next(0, 100), | |||
MinWok_Dishes_2 = "烂肉豇豆", | |||
MinWok_Task_2 = "炒菜中", | |||
MinWok_Process_2 = new List<ProcessModel> { | |||
new ProcessModel{ Id=0,Name= "清洗", Status=(k==0) ? ProcessStatus.正在执行:((k>0)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=1,Name= "到菜", Status=(k==1) ? ProcessStatus.正在执行:((k>1)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=2,Name= "翻炒", Status=(k==2) ? ProcessStatus.正在执行:((k>2)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=3,Name= "调料", Status=(k==3) ? ProcessStatus.正在执行:((k>3)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
new ProcessModel{ Id=4,Name= "完成", Status=(k==4) ? ProcessStatus.正在执行:((k>4)?ProcessStatus.执行完成:ProcessStatus.未执行)}, | |||
}, | |||
MinWok_HeatGear_2 = "2", | |||
MinWok_StirGear_2 = "3", | |||
MinWok_FlipSpeed_2 = "32", | |||
MinWok_Temp_2 = "132", | |||
MinWok_OrderCount_2 = new Random().Next(0, 100), | |||
MinWok_ErrorOrderCount_2 = new Random().Next(0, 100), | |||
}; | |||
} | |||
else if (screen == ScreenDeviceType.煮面机) | |||
{ | |||
sendScreenData.Name = screen; | |||
sendScreenData.Value = new ScreenModelMorkS | |||
{ | |||
IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止, | |||
WorkStatus = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
Alarm = new List<AlarmModel> { | |||
new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "煮面机警告,水温过低!!!!" }, | |||
//new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
//new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
}, | |||
FailuresCount = 0, | |||
StatsCount = new List<StatsModel> { | |||
new StatsModel { Name = name_s_zm[0], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s_zm[1], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s_zm[2], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s_zm[3], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s_zm[4], Count = new Random().Next(0, 100) }, | |||
}, | |||
MorkS_OrderCount = new Random().Next(0, 100), | |||
MorkS_ErrorOrderCount = new Random().Next(0, 100), | |||
MorkS_NoodleUpOrDown_1 = k2 == 0 ? "true" : "false", | |||
MorkS_NoodleUpOrDown_2 = k2 == 0 ? "true" : "false", | |||
MorkS_NoodleUpOrDown_3 = k2 == 0 ? "true" : "false", | |||
MorkS_NoodleUpOrDown_4 = k2 == 0 ? "true" : "false", | |||
MorkS_NoodleUpOrDown_5 = k2 == 0 ? "true" : "false", | |||
MorkS_NoodleUpOrDown_6 = k2 == 0 ? "true" : "false", | |||
MorkS_Temp = "false",// k2 == 0 ? "true" : "false", | |||
MorkS_BinLocation = new Random().Next(0, 6).ToString(), | |||
MorkS_SiloMeas = k2 == 0 ? "true" : "false", | |||
MorkS_NoBowMeas = k2 == 0 ? "true" : "false", | |||
MakeOrder = new List<OrderMakeModel> { | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="007".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="008".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="009".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="010".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="011".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_COOK, SortNum="006".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="005".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="004".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="003".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="002".ToString()}, | |||
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="001".ToString()}, | |||
}, | |||
}; | |||
} | |||
else if (screen == ScreenDeviceType.分餐机) | |||
{ | |||
sendScreenData.Name = screen; | |||
sendScreenData.Value = new ScreenModelSplitMeals | |||
{ | |||
IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止, | |||
WorkStatus = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机, | |||
//Alarm = new List<AlarmModel> { | |||
// new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
//new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
//new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" }, | |||
//}, | |||
FailuresCount = 0, | |||
StatsCount = new List<StatsModel> { | |||
new StatsModel { Name = name_s[0], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s[1], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s[2], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s[3], Count = new Random().Next(0, 100) }, | |||
new StatsModel { Name = name_s[4], Count = new Random().Next(0, 100) }, | |||
}, | |||
SplitMeals_CreditCardCount_1 = new Random().Next(0, 100), | |||
SplitMeals_CreditCardNameBefore_1 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CreditCardName_1 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CookType_1 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
SplitMeals_CreditCardCount_2 = new Random().Next(0, 100), | |||
SplitMeals_CreditCardNameBefore_2 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CreditCardName_2 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CookType_2 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
SplitMeals_CreditCardCount_3 = new Random().Next(0, 100), | |||
SplitMeals_CreditCardNameBefore_3 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CreditCardName_3 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CookType_3 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
SplitMeals_CreditCardCount_4 = new Random().Next(0, 100), | |||
SplitMeals_CreditCardNameBefore_4 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CreditCardName_4 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CookType_4 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
SplitMeals_CreditCardCount_5 = new Random().Next(0, 100), | |||
SplitMeals_CreditCardNameBefore_5 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CreditCardName_5 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CookType_5 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
SplitMeals_CreditCardCount_6 = new Random().Next(0, 100), | |||
SplitMeals_CreditCardNameBefore_6 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CreditCardName_6 = name_XM[new Random().Next(0, 5)], | |||
SplitMeals_CookType_6 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" }, | |||
}; | |||
} | |||
string message = JsonConvert.SerializeObject(sendScreenData); | |||
mqttHelper.Publish(ScreenTOPIC.GetInstance.GetTopic(screen), message); | |||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||
{ | |||
if (textwb.Text.Length > 100000) | |||
{ | |||
textwb.Text = ""; | |||
} | |||
string text = $"{ScreenTOPIC.GetInstance.GetTopic(screen)} {message}\n"; | |||
textwb.Text += text; | |||
})); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
int i = 0; | |||
Window1 window1 = new Window1(); | |||
foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens) | |||
{ | |||
//if (!scr.Primary) | |||
{ | |||
if (i == 1) | |||
{ | |||
window1.WindowStartupLocation = WindowStartupLocation.Manual; | |||
window1.Left = scr.WorkingArea.Left; | |||
window1.Top = scr.WorkingArea.Top; | |||
window1.Width = scr.Bounds.Width; | |||
window1.Height = scr.Bounds.Height; | |||
window1.WindowState = WindowState.Maximized; | |||
window1.ResizeMode = ResizeMode.NoResize; | |||
window1.WindowStyle = WindowStyle.None; | |||
window1.WindowState = WindowState.Normal; | |||
window1.ShowInTaskbar = false; | |||
window1.Show(); | |||
} | |||
else if (i == 2) | |||
{ | |||
} | |||
i++; | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
<Window x:Class="WpfTest.Window1" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:WpfTest" | |||
mc:Ignorable="d" | |||
Title="Window1" Height="450" Width="800"> | |||
<Grid> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace WpfTest | |||
{ | |||
/// <summary> | |||
/// Window1.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class Window1 : Window | |||
{ | |||
public Window1() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.CustomResource" Version="1.0.14" /> | |||
</ItemGroup> | |||
</Project> |