|
|
@@ -7,6 +7,7 @@ using Prism.Events;
|
|
|
using Prism.Ioc;
|
|
|
using Prism.Mvvm;
|
|
|
using Prism.Regions;
|
|
|
+using SqlSugar;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
@@ -99,6 +100,30 @@ namespace TeamAAS_VP.Core
|
|
|
set { SetProperty(ref _StatusBackground, value); }
|
|
|
}
|
|
|
|
|
|
+ private System.Windows.Media.Brush _RunModelBackground;
|
|
|
+
|
|
|
+ public System.Windows.Media.Brush RunModelBackground
|
|
|
+ {
|
|
|
+ get { return _RunModelBackground; }
|
|
|
+ set { SetProperty(ref _RunModelBackground, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private System.Windows.Media.Brush _ManualModeBackground;
|
|
|
+
|
|
|
+ public System.Windows.Media.Brush ManualModeBackground
|
|
|
+ {
|
|
|
+ get { return _ManualModeBackground; }
|
|
|
+ set { SetProperty(ref _ManualModeBackground, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private System.Windows.Media.Brush _ClearModeBackground;
|
|
|
+
|
|
|
+ public System.Windows.Media.Brush ClearModeBackground
|
|
|
+ {
|
|
|
+ get { return _ClearModeBackground; }
|
|
|
+ set { SetProperty(ref _ClearModeBackground, value); }
|
|
|
+ }
|
|
|
+
|
|
|
private ObservableCollection<ShowRender> _Renders;
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -252,6 +277,7 @@ namespace TeamAAS_VP.Core
|
|
|
_systemDatabaseService = systemDatabaseService;
|
|
|
_lightManagerService = lightManagerService;
|
|
|
_mesService = mesService;
|
|
|
+ _eventAggregator.GetEvent<CurrentStatusNotification>().Subscribe(CurrentRunStatus);
|
|
|
InitPressure();
|
|
|
}
|
|
|
|
|
|
@@ -1235,10 +1261,6 @@ namespace TeamAAS_VP.Core
|
|
|
/// </summary>
|
|
|
string PartSN = "";
|
|
|
/// <summary>
|
|
|
- /// 压力曲线编号
|
|
|
- /// </summary>
|
|
|
- int pngindex = 100;
|
|
|
- /// <summary>
|
|
|
/// 产品SN
|
|
|
/// </summary>
|
|
|
string[] ProductMainSN = new string[10];//产品主sn
|
|
|
@@ -1269,10 +1291,11 @@ namespace TeamAAS_VP.Core
|
|
|
bool _LastFixedCameraPickExe = false;
|
|
|
bool _LastFixedCameraPutExe = false;
|
|
|
bool _LastFixedCameracheckExe = false;
|
|
|
- bool _LastThrowExe = false;
|
|
|
- bool _LastRunModel = false;
|
|
|
+ public bool _LastAutoRunning = false;
|
|
|
bool _LastManualMode = false;
|
|
|
bool _LastClearMode = false;
|
|
|
+ bool _LastThrowExe = false;
|
|
|
+ bool _LastRunModel = false;
|
|
|
bool _LastFault = false;
|
|
|
Int16[] _LastWorkStart = new Int16[7];
|
|
|
Int16 _LastQrCodePhotoRequest = 0;
|
|
|
@@ -2588,13 +2611,13 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
//切换成自动运行模式
|
|
|
- else if (addressConfig.RunMode.Address.Contains(tuple.nodeId))
|
|
|
+ else if (addressConfig.AutoRunning.Address.Contains(tuple.nodeId))
|
|
|
{
|
|
|
if (tuple.value is bool state)
|
|
|
{
|
|
|
- if (_LastRunModel != state)
|
|
|
+ if (_LastAutoRunning != state)
|
|
|
{
|
|
|
- _LastRunModel = state;
|
|
|
+ _LastAutoRunning = state;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -2603,8 +2626,12 @@ namespace TeamAAS_VP.Core
|
|
|
if (state)
|
|
|
{
|
|
|
SendTaskMessage("收到切换成自动模式", MessageLevel.Info);
|
|
|
- StatusBackground = System.Windows.Media.Brushes.Green;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SendTaskMessage("收到关闭自动模式", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ CurrentRunStatus();
|
|
|
}
|
|
|
}
|
|
|
//切换成维修模式
|
|
|
@@ -2622,13 +2649,10 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
if (state)
|
|
|
{
|
|
|
+ ClearModeBackground = System.Windows.Media.Brushes.White;
|
|
|
+ RunModelBackground = System.Windows.Media.Brushes.White;
|
|
|
+ ManualModeBackground = System.Windows.Media.Brushes.Orange;
|
|
|
SendTaskMessage("收到切换成维修模式", MessageLevel.Info);
|
|
|
- StatusBackground = System.Windows.Media.Brushes.Yellow;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendTaskMessage("收到切换成自动模式", MessageLevel.Info);
|
|
|
- StatusBackground = System.Windows.Media.Brushes.Green;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2647,33 +2671,10 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
if (state)
|
|
|
{
|
|
|
+ ClearModeBackground = System.Windows.Media.Brushes.Yellow;
|
|
|
+ RunModelBackground = System.Windows.Media.Brushes.White;
|
|
|
+ ManualModeBackground = System.Windows.Media.Brushes.White;
|
|
|
SendTaskMessage("收到切换成流线模式", MessageLevel.Info);
|
|
|
- StatusBackground = System.Windows.Media.Brushes.Green;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //plc报警
|
|
|
- else if (addressConfig.Fault.Address.Contains(tuple.nodeId))
|
|
|
- {
|
|
|
- if (tuple.value is bool state)
|
|
|
- {
|
|
|
- if (_LastFault != state)
|
|
|
- {
|
|
|
- _LastFault = state;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (state)
|
|
|
- {
|
|
|
- SendTaskMessage("收到PLC报警", MessageLevel.Error);
|
|
|
- StatusBackground = System.Windows.Media.Brushes.Red;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendTaskMessage("收到PLC消除报警", MessageLevel.Debug);
|
|
|
- StatusBackground = System.Windows.Media.Brushes.Green;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2774,7 +2775,12 @@ namespace TeamAAS_VP.Core
|
|
|
revision[i] = revisionItem.Replace("stage=", "").Trim();
|
|
|
SendTaskMessage($"stage:{revision[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
-
|
|
|
+ //if (QRcode != camerasn)
|
|
|
+ //{
|
|
|
+ // SendTaskMessage($"Camera_SN与相机获取sn不一致", MessageLevel.Error);
|
|
|
+ // await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
//切换产品
|
|
|
if (i == 0)//i=0时才会切换产品
|
|
|
{
|
|
|
@@ -2879,7 +2885,12 @@ namespace TeamAAS_VP.Core
|
|
|
revision[i] = revisionItem.Replace("stage=", "").Trim();
|
|
|
SendTaskMessage($"stage:{revision[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
-
|
|
|
+ //if (QRcode != camerasn)
|
|
|
+ //{
|
|
|
+ // SendTaskMessage($"Camera_SN与相机获取sn不一致", MessageLevel.Alarm);
|
|
|
+ // await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
|
|
|
@@ -3290,7 +3301,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
string target_Torque = target_Directory + item.Replace(source_Torque_Image, "");
|
|
|
File.Copy(item, target_Torque, true);
|
|
|
- SendTaskMessage($"曲线图{i}保存成功", MessageLevel.Error);
|
|
|
+ SendTaskMessage($"曲线图{i}保存成功", MessageLevel.Debug);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
@@ -3455,6 +3466,73 @@ namespace TeamAAS_VP.Core
|
|
|
_eventAggregator.GetEvent<TaskMessageNotification>().Publish(new Models.MessageStruct() { Message = msg, level = level });
|
|
|
});
|
|
|
}
|
|
|
+ public bool concurrenty = true;
|
|
|
+ public void CurrentRunStatus()
|
|
|
+ {
|
|
|
+ if (!concurrenty)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ concurrenty = true;
|
|
|
+ bool connectStaus = true;
|
|
|
+ bool mesStatus = true;
|
|
|
+ //bool paraStatus = true;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var allDevices = _configService.GetAllDeviceInfos();
|
|
|
+
|
|
|
+ for (int i = 0; i < allDevices.Count; i++)
|
|
|
+ {
|
|
|
+ var stationConfig = allDevices.FirstOrDefault(d => d.DeviceNo == i);
|
|
|
+ //var stationConfig = _configService.GetDeviceInfo(i);
|
|
|
+ if (!string.IsNullOrEmpty(stationConfig.Station) && stationConfig.Station != ""&&!string.IsNullOrEmpty(stationConfig.DeviceName) && stationConfig.DeviceName != "")
|
|
|
+ {
|
|
|
+ if (!stationConfig.EnableMES || !stationConfig.EnableDoubleMes || !stationConfig.SaveCsv)
|
|
|
+ {
|
|
|
+ SendTaskMessage("当前MES功能/双验证功能/保存CSV功能未启用,请检查...", MessageLevel.Info);
|
|
|
+ mesStatus = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //var systemConfig = _configService.GetSystemConfiguration();
|
|
|
+ //if (!systemConfig.PressureSensorConfig[0].IsSavePressureCurve || !systemConfig.PressureSensorConfig[1].IsSavePressureCurve)
|
|
|
+ //{
|
|
|
+ // paraStatus = false;
|
|
|
+ //}
|
|
|
+ foreach (var item in Status)
|
|
|
+ {
|
|
|
+ if (item.Background == System.Windows.Media.Brushes.Red)
|
|
|
+ {
|
|
|
+ SendTaskMessage("当前有设备未连接,请检查...", MessageLevel.Info);
|
|
|
+ connectStaus = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connectStaus = false;
|
|
|
+ mesStatus = false;
|
|
|
+ //paraStatus = false;
|
|
|
+
|
|
|
+ }
|
|
|
+ if (connectStaus && mesStatus && _LastAutoRunning)
|
|
|
+ {
|
|
|
+ RunModelBackground = System.Windows.Media.Brushes.Green;
|
|
|
+ ClearModeBackground = System.Windows.Media.Brushes.White;
|
|
|
+ ManualModeBackground = System.Windows.Media.Brushes.White;
|
|
|
+ SendTaskMessage("当前为生产模式", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RunModelBackground = System.Windows.Media.Brushes.White;
|
|
|
+ ClearModeBackground = System.Windows.Media.Brushes.White;
|
|
|
+ ManualModeBackground = System.Windows.Media.Brushes.Orange;
|
|
|
+ SendTaskMessage("当前为调机模式", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ concurrenty = true;
|
|
|
+ }
|
|
|
|
|
|
#region Pressure collection helpers
|
|
|
public void InitPressure()
|
|
|
@@ -3598,7 +3676,6 @@ namespace TeamAAS_VP.Core
|
|
|
csvPath = string.Empty;
|
|
|
pngPath = string.Empty;
|
|
|
}
|
|
|
- pngindex = Index;
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
{
|
|
|
_eventAggregator.GetEvent<PressureFinishNotification>().Publish((true, Index, snapshot.ToArray(), pngPath));
|