@@ -40,9 +40,10 @@ namespace Helper.BigScreen | |||
AlarmMs = param, | |||
AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") | |||
}); | |||
HKLog.HKLogImport.WriteInfo(param); | |||
}); | |||
ThreadManage.GetInstance().StartLong(() => | |||
{ | |||
var model = new HKCore().GetDayData(); | |||
@@ -23,6 +23,7 @@ namespace HKCardOUT.ViewModels | |||
{ | |||
Foods.Add(""); | |||
} | |||
} | |||
#region 属性 | |||
@@ -34,9 +35,9 @@ namespace HKCardOUT.ViewModels | |||
private AdInfoModel _mRAdinfo = new AdInfoModel(); | |||
public ObservableCollection<string> Foods { get; set; } = new ObservableCollection<string>(); | |||
#endregion | |||
#endregion | |||
void FoodsInit(int[] ScreenLoc) | |||
{ | |||
@@ -60,6 +61,16 @@ namespace HKCardOUT.ViewModels | |||
{ | |||
FoodsInit(BindScreen); | |||
ThreadManage.GetInstance().StartLong(() => | |||
{ | |||
if (DateTime.Now.Hour == 16) | |||
{ | |||
LAdInfo.AInfo = new ObservableCollection<ScreenInfoDto>(); | |||
RAdinfo.AInfo = new ObservableCollection<ScreenInfoDto>(); | |||
} | |||
Thread.Sleep(5000); | |||
}, "清理屏幕数据", true); | |||
ThreadManage.GetInstance().StartLong(() => | |||
{ | |||
var model = (new HKCore()).PullDaySaleLog(BindScreen); | |||
@@ -105,7 +116,7 @@ namespace HKCardOUT.ViewModels | |||
data.UserName = DataBus.UserListDto | |||
.Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo)) | |||
.Select(x => x.Name).FirstOrDefault(); | |||
HKLog.HKLogImport.WriteInfo("取出刷卡信息" + data.ToJsonString()); | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
if (LAdInfo.Info != null && !string.IsNullOrEmpty(LAdInfo.Info.UserName)) | |||
@@ -118,6 +129,10 @@ namespace HKCardOUT.ViewModels | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
HKLog.HKLogImport.WriteInfo("未包含屏幕" + BindScreen[i]); | |||
} | |||
} | |||
Thread.Sleep(10); | |||
}, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true); | |||
@@ -136,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")); | |||
@@ -148,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(); | |||
}*/ | |||
} | |||
})); | |||
} | |||
@@ -52,8 +52,10 @@ namespace HKCardOUT.Views | |||
{ | |||
if (DataBus.saleLogDtos.Count > 0) | |||
{ | |||
HKLog.HKLogImport.WriteInfo("添加刷卡信息"); | |||
if (DataBus.saleLogDtos.TryDequeue(out SaleLogDto info)) | |||
{ | |||
HKLog.HKLogImport.WriteInfo("取出信息加入队列"); | |||
if (!DataBus.SaleLogDtoList.ContainsKey(info.Location)) | |||
DataBus.SaleLogDtoList.TryAdd(info.Location, new ConcurrentQueue<SaleLogDto>()); | |||
DataBus.SaleLogDtoList[info.Location].Enqueue(info); | |||
@@ -18,6 +18,7 @@ namespace HKCardOUT.Views | |||
public RootView() | |||
{ | |||
HKLogImport.Init("HKCardOUT"); | |||
HKLogImport.WriteInfo("程序初始化"); | |||
InitializeComponent(); | |||
MessageLog.GetInstance.NotifyShow = new Action<string>((s) => | |||
{ | |||
@@ -11,6 +11,29 @@ namespace HKControl | |||
{ | |||
public WindowDataModel LeftWindowData { get; set; } = new WindowDataModel(); | |||
public WindowDataModel RightWindowData { get; set; } = new WindowDataModel(); | |||
[Alarm("1号通道缺碗")] | |||
public bool LackBowl1 { get; set; } | |||
[Alarm("2号通道缺碗")] | |||
public bool LackBowl2 { get; set; } | |||
[Alarm("3号通道缺碗")] | |||
public bool LackBowl3 { get; set; } | |||
[Alarm("4号通道缺碗")] | |||
public bool LackBowl4 { get; set; } | |||
[Alarm("水温过低")] | |||
public bool WaterTemperatureLow { get; set; } | |||
[Alarm("变频器故障")] | |||
public bool FrequencyConverterFault { get; set; } | |||
[Alarm("机器人通讯异常")] | |||
public bool RobotCommFault { get; set; } | |||
public RobotStatus RBStatus { get; set; } | |||
} | |||
public class WindowDataModel | |||
@@ -37,42 +60,79 @@ namespace HKControl | |||
[Alarm("警告左侧机构餐盘无盘")] | |||
public bool L1 { get; set; } | |||
[Alarm("警告左侧升降气缸下降不到位")] | |||
[Alarm("左侧机构餐盘掉落无餐盘报警")] | |||
public bool L2 { get; set; } | |||
[Alarm("警告左侧升降气缸中间不到位")] | |||
[Alarm("左侧升降气缸下降不到位报警")] | |||
public bool L3 { get; set; } | |||
[Alarm("警告左侧升降气缸上升不到位")] | |||
[Alarm("左侧升降气缸中间位置不到位报警")] | |||
public bool L4 { get; set; } | |||
[Alarm("警告左侧升降气缸上升不到位")] | |||
[Alarm("左侧升降气缸上升不到位报警")] | |||
public bool L5 { get; set; } | |||
[Alarm("警告左侧机构推空餐盘不到位")] | |||
[Alarm("左侧机构推空餐盘不到位报警")] | |||
public bool L6 { get; set; } | |||
[Alarm("警告左侧出餐推不到位")] | |||
[Alarm("左侧机构推空餐盘回退不到位报警")] | |||
public bool L7 { get; set; } | |||
[Alarm("警告左侧出餐回退不到位")] | |||
[Alarm("左侧出餐推不到位报警")] | |||
public bool L8 { get; set; } | |||
[Alarm("警告左餐盘掉落位置有餐盘")] | |||
[Alarm("左侧出餐回退不到位报警")] | |||
public bool L9 { get; set; } | |||
[Alarm("左餐盘掉落位置有餐盘报警")] | |||
public bool L10 { get; set; } | |||
[Alarm("左侧套餐完成")] | |||
public bool L11 { get; set; } | |||
[Alarm("警告右侧机构餐盘无盘")] | |||
public bool R1 { get; set; } | |||
[Alarm("警告右侧升降气缸下降不到位")] | |||
[Alarm("右侧机构餐盘掉落无餐盘报警")] | |||
public bool R2 { get; set; } | |||
[Alarm("警告右侧升降气缸中间不到位")] | |||
[Alarm("右侧升降气缸下降不到位报警")] | |||
public bool R3 { get; set; } | |||
[Alarm("警告右侧升降气缸上升不到位")] | |||
[Alarm("右侧升降气缸中间位置不到位报警")] | |||
public bool R4 { get; set; } | |||
[Alarm("警告右侧升降气缸上升不到位")] | |||
[Alarm("右侧升降气缸上升不到位报警")] | |||
public bool R5 { get; set; } | |||
[Alarm("警告右侧机构推空餐盘不到位")] | |||
[Alarm("右侧机构推空餐盘不到位报警")] | |||
public bool R6 { get; set; } | |||
[Alarm("警告右侧出餐推不到位")] | |||
[Alarm("右侧机构推空餐盘回退不到位报警")] | |||
public bool R7 { get; set; } | |||
[Alarm("警告右侧出餐回退不到位")] | |||
[Alarm("右侧出餐推不到位报警")] | |||
public bool R8 { get; set; } | |||
[Alarm("警告右餐盘掉落位置有餐盘")] | |||
[Alarm("右侧出餐回退不到位报警")] | |||
public bool R9 { get; set; } | |||
[Alarm("右餐盘掉落位置有餐盘报警")] | |||
public bool R10 { get; set; } | |||
[Alarm("右侧套餐完成")] | |||
public bool R11 { get; set; } | |||
} | |||
public enum RobotStatus | |||
{ | |||
运行, | |||
停止, | |||
暂停, | |||
准备, | |||
故障, | |||
} | |||
} |
@@ -132,45 +132,66 @@ namespace HKControl | |||
{ | |||
SiemensDicitonary[item.DeviceNum].ConnectOk = new Action(() => | |||
{ | |||
AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); | |||
AlarmHelper<DataModel>.Init(); | |||
//AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); | |||
HKLog.HKLogImport.WriteInfo($"{item.DeviceNum}:连接成功"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
try | |||
{ | |||
var md = AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); | |||
var res = SiemensDicitonary[item.DeviceNum].Read<byte>("MB7"); | |||
var res1 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB10"); | |||
var res2 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB11"); | |||
md.LeftWindowData.L1 = Get8bitValue(res1, 2); | |||
md.LeftWindowData.L2 = Get8bitValue(res1, 3); | |||
md.LeftWindowData.L3 = Get8bitValue(res1, 4); | |||
md.LeftWindowData.L4 = Get8bitValue(res1, 5); | |||
md.LeftWindowData.L5 = Get8bitValue(res1, 6); | |||
md.LeftWindowData.L6 = Get8bitValue(res1, 7); | |||
md.LeftWindowData.L7 = Get8bitValue(res1, 8); | |||
md.LeftWindowData.L8 = Get8bitValue(res2, 1); | |||
md.LeftWindowData.L9 = Get8bitValue(res2, 2); | |||
var md = AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}"); | |||
var MB7 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB7"); | |||
DataModels[item.DeviceNum].LeftWindowData.IsSwipe = Get8bitValue(MB7, 1); | |||
DataModels[item.DeviceNum].LeftWindowData.Complete = Get8bitValue(MB7, 2); | |||
DataModels[item.DeviceNum].RightWindowData.IsSwipe = Get8bitValue(MB7, 3); | |||
DataModels[item.DeviceNum].RightWindowData.Complete = Get8bitValue(MB7, 4); | |||
var res3 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB12"); | |||
var res4 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB13"); | |||
md.RightWindowData.R1 = Get8bitValue(res3, 2); | |||
md.RightWindowData.R2 = Get8bitValue(res3, 3); | |||
md.RightWindowData.R3 = Get8bitValue(res3, 4); | |||
md.RightWindowData.R4 = Get8bitValue(res3, 5); | |||
md.RightWindowData.R5 = Get8bitValue(res3, 6); | |||
md.RightWindowData.R6 = Get8bitValue(res3, 7); | |||
md.RightWindowData.R7 = Get8bitValue(res3, 8); | |||
md.RightWindowData.R8 = Get8bitValue(res4, 1); | |||
md.RightWindowData.R9 = Get8bitValue(res4, 2); | |||
var MB10 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB10"); | |||
var MB11 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB11"); | |||
md.LeftWindowData.L2 = Get8bitValue(MB10, 2); | |||
md.LeftWindowData.L3 = Get8bitValue(MB10, 3); | |||
md.LeftWindowData.L4 = Get8bitValue(MB10, 4); | |||
md.LeftWindowData.L5 = Get8bitValue(MB10, 5); | |||
md.LeftWindowData.L6 = Get8bitValue(MB10, 6); | |||
md.LeftWindowData.L7 = Get8bitValue(MB10, 7); | |||
md.LeftWindowData.L8 = Get8bitValue(MB10, 8); | |||
md.LeftWindowData.L9 = Get8bitValue(MB11, 1); | |||
DataModels[item.DeviceNum].LeftWindowData.IsSwipe = Get8bitValue(res, 1); | |||
DataModels[item.DeviceNum].LeftWindowData.Complete = Get8bitValue(res, 2); | |||
var MB12 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB12"); | |||
var MB13 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB13"); | |||
md.RightWindowData.R2 = Get8bitValue(MB12, 2); | |||
md.RightWindowData.R3 = Get8bitValue(MB12, 3); | |||
md.RightWindowData.R4 = Get8bitValue(MB12, 4); | |||
md.RightWindowData.R5 = Get8bitValue(MB12, 5); | |||
md.RightWindowData.R6 = Get8bitValue(MB12, 6); | |||
md.RightWindowData.R7 = Get8bitValue(MB12, 7); | |||
md.RightWindowData.R8 = Get8bitValue(MB12, 8); | |||
md.RightWindowData.R9 = Get8bitValue(MB13, 1); | |||
var MB14 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB14"); | |||
md.WaterTemperatureLow = Get8bitValue(MB14, 5); | |||
md.FrequencyConverterFault = Get8bitValue(MB14, 6); | |||
var MB15 = SiemensDicitonary[item.DeviceNum].Read<byte>("MB15"); | |||
md.RobotCommFault = Get8bitValue(MB15, 6); | |||
bool TempFault = Get8bitValue(MB15, 5); | |||
if (TempFault) | |||
{ | |||
md.RBStatus = RobotStatus.故障; | |||
} | |||
else | |||
{ | |||
if (Get8bitValue(MB15, 1)) | |||
md.RBStatus = RobotStatus.运行; | |||
else if (Get8bitValue(MB15, 2)) | |||
md.RBStatus = RobotStatus.停止; | |||
else if (Get8bitValue(MB15, 3)) | |||
md.RBStatus = RobotStatus.暂停; | |||
else if (Get8bitValue(MB15, 4)) | |||
md.RBStatus = RobotStatus.准备; | |||
} | |||
DataModels[item.DeviceNum].RightWindowData.IsSwipe = Get8bitValue(res, 3); | |||
DataModels[item.DeviceNum].RightWindowData.Complete = Get8bitValue(res, 4); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -7,10 +7,11 @@ namespace HKLog | |||
{ | |||
public static void Init(string input) | |||
{ | |||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs",$"{input}.log"); | |||
//日志 | |||
Log.Logger = new LoggerConfiguration() | |||
.MinimumLevel.Information() | |||
.WriteTo.File($"Logs/{input}.log", rollingInterval: RollingInterval.Day) | |||
.WriteTo.File(path, rollingInterval: RollingInterval.Day) | |||
.CreateLogger(); | |||
} | |||
public static void WriteInfo(string msg) | |||