@@ -40,9 +40,10 @@ namespace Helper.BigScreen | |||||
AlarmMs = param, | AlarmMs = param, | ||||
AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") | AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") | ||||
}); | }); | ||||
HKLog.HKLogImport.WriteInfo(param); | |||||
}); | }); | ||||
ThreadManage.GetInstance().StartLong(() => | ThreadManage.GetInstance().StartLong(() => | ||||
{ | { | ||||
var model = new HKCore().GetDayData(); | var model = new HKCore().GetDayData(); | ||||
@@ -23,6 +23,7 @@ namespace HKCardOUT.ViewModels | |||||
{ | { | ||||
Foods.Add(""); | Foods.Add(""); | ||||
} | } | ||||
} | } | ||||
#region 属性 | #region 属性 | ||||
@@ -34,9 +35,9 @@ namespace HKCardOUT.ViewModels | |||||
private AdInfoModel _mRAdinfo = new AdInfoModel(); | private AdInfoModel _mRAdinfo = new AdInfoModel(); | ||||
public ObservableCollection<string> Foods { get; set; } = new ObservableCollection<string>(); | public ObservableCollection<string> Foods { get; set; } = new ObservableCollection<string>(); | ||||
#endregion | |||||
#endregion | |||||
void FoodsInit(int[] ScreenLoc) | void FoodsInit(int[] ScreenLoc) | ||||
{ | { | ||||
@@ -60,6 +61,16 @@ namespace HKCardOUT.ViewModels | |||||
{ | { | ||||
FoodsInit(BindScreen); | 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(() => | ThreadManage.GetInstance().StartLong(() => | ||||
{ | { | ||||
var model = (new HKCore()).PullDaySaleLog(BindScreen); | var model = (new HKCore()).PullDaySaleLog(BindScreen); | ||||
@@ -105,7 +116,7 @@ namespace HKCardOUT.ViewModels | |||||
data.UserName = DataBus.UserListDto | data.UserName = DataBus.UserListDto | ||||
.Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo)) | .Where(t => t.Cards.Select(x => x.CardNum).Contains(data.CardNo)) | ||||
.Select(x => x.Name).FirstOrDefault(); | .Select(x => x.Name).FirstOrDefault(); | ||||
HKLog.HKLogImport.WriteInfo("取出刷卡信息" + data.ToJsonString()); | |||||
App.Current.Dispatcher.Invoke(() => | App.Current.Dispatcher.Invoke(() => | ||||
{ | { | ||||
if (LAdInfo.Info != null && !string.IsNullOrEmpty(LAdInfo.Info.UserName)) | 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); | Thread.Sleep(10); | ||||
}, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true); | }, $"屏幕刷卡信息{BindScreen[0]}-{BindScreen[1]}", true); | ||||
@@ -136,7 +136,7 @@ namespace HKCardOUT.ViewModels | |||||
Device = t.Name, | Device = t.Name, | ||||
Stalls = x.Name | Stalls = x.Name | ||||
}).ToList(); | }).ToList(); | ||||
/* if (Init != null) | |||||
if (Init != null) | |||||
{ | { | ||||
Ad = new ObservableCollection<AdDTO>(Init); | Ad = new ObservableCollection<AdDTO>(Init); | ||||
var route = SyncStatic.CreateFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AD.txt")); | 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); | var jsons = SyncStatic.Decompress(SyncStatic.ReadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AD.txt")), SecurityType.Base64); | ||||
Ad = new ObservableCollection<AdDTO>(jsons.ToModel<List<AdDTO>>()); | Ad = new ObservableCollection<AdDTO>(jsons.ToModel<List<AdDTO>>()); | ||||
AdOpen(); | AdOpen(); | ||||
}*/ | |||||
} | |||||
})); | })); | ||||
} | } | ||||
@@ -52,8 +52,10 @@ namespace HKCardOUT.Views | |||||
{ | { | ||||
if (DataBus.saleLogDtos.Count > 0) | if (DataBus.saleLogDtos.Count > 0) | ||||
{ | { | ||||
HKLog.HKLogImport.WriteInfo("添加刷卡信息"); | |||||
if (DataBus.saleLogDtos.TryDequeue(out SaleLogDto info)) | if (DataBus.saleLogDtos.TryDequeue(out SaleLogDto info)) | ||||
{ | { | ||||
HKLog.HKLogImport.WriteInfo("取出信息加入队列"); | |||||
if (!DataBus.SaleLogDtoList.ContainsKey(info.Location)) | if (!DataBus.SaleLogDtoList.ContainsKey(info.Location)) | ||||
DataBus.SaleLogDtoList.TryAdd(info.Location, new ConcurrentQueue<SaleLogDto>()); | DataBus.SaleLogDtoList.TryAdd(info.Location, new ConcurrentQueue<SaleLogDto>()); | ||||
DataBus.SaleLogDtoList[info.Location].Enqueue(info); | DataBus.SaleLogDtoList[info.Location].Enqueue(info); | ||||
@@ -18,6 +18,7 @@ namespace HKCardOUT.Views | |||||
public RootView() | public RootView() | ||||
{ | { | ||||
HKLogImport.Init("HKCardOUT"); | HKLogImport.Init("HKCardOUT"); | ||||
HKLogImport.WriteInfo("程序初始化"); | |||||
InitializeComponent(); | InitializeComponent(); | ||||
MessageLog.GetInstance.NotifyShow = new Action<string>((s) => | MessageLog.GetInstance.NotifyShow = new Action<string>((s) => | ||||
{ | { | ||||
@@ -11,6 +11,29 @@ namespace HKControl | |||||
{ | { | ||||
public WindowDataModel LeftWindowData { get; set; } = new WindowDataModel(); | public WindowDataModel LeftWindowData { get; set; } = new WindowDataModel(); | ||||
public WindowDataModel RightWindowData { 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 | public class WindowDataModel | ||||
@@ -37,42 +60,79 @@ namespace HKControl | |||||
[Alarm("警告左侧机构餐盘无盘")] | [Alarm("警告左侧机构餐盘无盘")] | ||||
public bool L1 { get; set; } | public bool L1 { get; set; } | ||||
[Alarm("警告左侧升降气缸下降不到位")] | |||||
[Alarm("左侧机构餐盘掉落无餐盘报警")] | |||||
public bool L2 { get; set; } | public bool L2 { get; set; } | ||||
[Alarm("警告左侧升降气缸中间不到位")] | |||||
[Alarm("左侧升降气缸下降不到位报警")] | |||||
public bool L3 { get; set; } | public bool L3 { get; set; } | ||||
[Alarm("警告左侧升降气缸上升不到位")] | |||||
[Alarm("左侧升降气缸中间位置不到位报警")] | |||||
public bool L4 { get; set; } | public bool L4 { get; set; } | ||||
[Alarm("警告左侧升降气缸上升不到位")] | |||||
[Alarm("左侧升降气缸上升不到位报警")] | |||||
public bool L5 { get; set; } | public bool L5 { get; set; } | ||||
[Alarm("警告左侧机构推空餐盘不到位")] | |||||
[Alarm("左侧机构推空餐盘不到位报警")] | |||||
public bool L6 { get; set; } | public bool L6 { get; set; } | ||||
[Alarm("警告左侧出餐推不到位")] | |||||
[Alarm("左侧机构推空餐盘回退不到位报警")] | |||||
public bool L7 { get; set; } | public bool L7 { get; set; } | ||||
[Alarm("警告左侧出餐回退不到位")] | |||||
[Alarm("左侧出餐推不到位报警")] | |||||
public bool L8 { get; set; } | public bool L8 { get; set; } | ||||
[Alarm("警告左餐盘掉落位置有餐盘")] | |||||
[Alarm("左侧出餐回退不到位报警")] | |||||
public bool L9 { get; set; } | public bool L9 { get; set; } | ||||
[Alarm("左餐盘掉落位置有餐盘报警")] | |||||
public bool L10 { get; set; } | |||||
[Alarm("左侧套餐完成")] | |||||
public bool L11 { get; set; } | |||||
[Alarm("警告右侧机构餐盘无盘")] | [Alarm("警告右侧机构餐盘无盘")] | ||||
public bool R1 { get; set; } | public bool R1 { get; set; } | ||||
[Alarm("警告右侧升降气缸下降不到位")] | |||||
[Alarm("右侧机构餐盘掉落无餐盘报警")] | |||||
public bool R2 { get; set; } | public bool R2 { get; set; } | ||||
[Alarm("警告右侧升降气缸中间不到位")] | |||||
[Alarm("右侧升降气缸下降不到位报警")] | |||||
public bool R3 { get; set; } | public bool R3 { get; set; } | ||||
[Alarm("警告右侧升降气缸上升不到位")] | |||||
[Alarm("右侧升降气缸中间位置不到位报警")] | |||||
public bool R4 { get; set; } | public bool R4 { get; set; } | ||||
[Alarm("警告右侧升降气缸上升不到位")] | |||||
[Alarm("右侧升降气缸上升不到位报警")] | |||||
public bool R5 { get; set; } | public bool R5 { get; set; } | ||||
[Alarm("警告右侧机构推空餐盘不到位")] | |||||
[Alarm("右侧机构推空餐盘不到位报警")] | |||||
public bool R6 { get; set; } | public bool R6 { get; set; } | ||||
[Alarm("警告右侧出餐推不到位")] | |||||
[Alarm("右侧机构推空餐盘回退不到位报警")] | |||||
public bool R7 { get; set; } | public bool R7 { get; set; } | ||||
[Alarm("警告右侧出餐回退不到位")] | |||||
[Alarm("右侧出餐推不到位报警")] | |||||
public bool R8 { get; set; } | public bool R8 { get; set; } | ||||
[Alarm("警告右餐盘掉落位置有餐盘")] | |||||
[Alarm("右侧出餐回退不到位报警")] | |||||
public bool R9 { get; set; } | 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(() => | SiemensDicitonary[item.DeviceNum].ConnectOk = new Action(() => | ||||
{ | { | ||||
AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); | |||||
AlarmHelper<DataModel>.Init(); | AlarmHelper<DataModel>.Init(); | ||||
//AlarmHelper<DataModel>.GetInstance($"{item.DeviceNum}号档口"); | |||||
HKLog.HKLogImport.WriteInfo($"{item.DeviceNum}:连接成功"); | HKLog.HKLogImport.WriteInfo($"{item.DeviceNum}:连接成功"); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
try | 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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -7,10 +7,11 @@ namespace HKLog | |||||
{ | { | ||||
public static void Init(string input) | public static void Init(string input) | ||||
{ | { | ||||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs",$"{input}.log"); | |||||
//日志 | //日志 | ||||
Log.Logger = new LoggerConfiguration() | Log.Logger = new LoggerConfiguration() | ||||
.MinimumLevel.Information() | .MinimumLevel.Information() | ||||
.WriteTo.File($"Logs/{input}.log", rollingInterval: RollingInterval.Day) | |||||
.WriteTo.File(path, rollingInterval: RollingInterval.Day) | |||||
.CreateLogger(); | .CreateLogger(); | ||||
} | } | ||||
public static void WriteInfo(string msg) | public static void WriteInfo(string msg) | ||||