Ver código fonte

西门子通讯修改

reconfiguration
pry 3 meses atrás
pai
commit
c3f30cf1b9
2 arquivos alterados com 102 adições e 102 exclusões
  1. +68
    -68
      BPASmartClient.Academy/App.xaml.cs
  2. +34
    -34
      BPASmartClient.Academy/Model/Simens_PLC.cs

+ 68
- 68
BPASmartClient.Academy/App.xaml.cs Ver arquivo

@@ -98,74 +98,31 @@ namespace BPASmartClient.Academy
private void MenuInit()
{
#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.Academy",
ToggleWindowPath = "View.RecipeSettingsView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.Academy",
ToggleWindowPath = "View.RecipeControlView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
MainMenuName = "配方管理",
Alias = "Recipe Management",
subMenumodels = RecipeManage,
});
#endregion

#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "调试日志",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.DebugLogView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "消息日志",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
Alias = "Message Log",
subMenumodels = InfoLog,
});
//ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
//RecipeManage.Add(new SubMenumodel()
//{
// SubMenuName = "配方管理",
// SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
// AssemblyName = "BPASmartClient.Academy",
// ToggleWindowPath = "View.RecipeSettingsView"
//});

//RecipeManage.Add(new SubMenumodel()
//{
// SubMenuName = "配方下发",
// SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
// AssemblyName = "BPASmartClient.Academy",
// ToggleWindowPath = "View.RecipeControlView"
//});

//MenuManage.GetInstance.menuModels.Add(new MenuModel()
//{
// MainMenuIcon = "&#xe683;",
// MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
// MainMenuName = "配方管理",
// Alias = "Recipe Management",
// subMenumodels = RecipeManage,
//});
#endregion

#region 硬件设备监控
@@ -234,6 +191,49 @@ namespace BPASmartClient.Academy
subMenumodels = UserManager,
});
#endregion

#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "调试日志",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.DebugLogView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "消息日志",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
Alias = "Message Log",
subMenumodels = InfoLog,
});
#endregion
}

private void DataInit()


+ 34
- 34
BPASmartClient.Academy/Model/Simens_PLC.cs Ver arquivo

@@ -27,10 +27,10 @@ namespace BPASmartClient.Academy.Model
public DataFeedback dataFeedback { get; set; } = new DataFeedback();
public string id { get; set; } = "";
//public SiemensHelper siemens { get; set; } = new SiemensHelper();
public ICommSiemens siemens;
public ICommSiemens siemens = CommHelper.Siemens;
public DeviceCtrl deviceCtrl { get; set; } = new DeviceCtrl();
public Action<bool> connect { get; set; }
public ConcurrentDictionary<string,string> AlarmInfo { get; set; }= new ConcurrentDictionary<string, string>();
public Action<bool> connect { get; set; }
public ConcurrentDictionary<string, string> AlarmInfo { get; set; } = new ConcurrentDictionary<string, string>();
public bool IsConnected { get; set; } = false;
bool heart = false;
public void Connect()
@@ -70,41 +70,41 @@ namespace BPASmartClient.Academy.Model
{
ChartDataRead();
}, "曲线数据");
ThreadManage.GetInstance.StartLong(() =>
{
AlarmRead();
ThreadManage.GetInstance.StartLong(() =>
{
AlarmRead();
}, "报警监控");
}
public void AlarmInfoGet()
public void AlarmInfoGet()
{
var x = (NameValueCollection)ConfigurationManager.GetSection("FlexBatchSystem/Alarm");
if (x!=null)
if (x != null)
{
x.AllKeys.ToList().ForEach(o =>
x.AllKeys.ToList().ForEach(o =>
{
if (!AlarmInfo.ContainsKey(o))
{
AlarmInfo.TryAdd(o, x.Get(o));
}
});
}
}
public void AlarmRead()
public void AlarmRead()
{
if (IsConnected)
if (IsConnected)
{
AlarmInfo.Keys.ToList().ForEach(o =>
{
siemens.Read<bool>(o).OnSuccess(p =>
siemens.Read<bool>(o).OnSuccess(p =>
{
if (o== "DB1.DBX2004.4"&&p.Content)
if (o == "DB1.DBX2004.4" && p.Content)
{
IsConnected = false;
}
if (p.Content)
{
App.Current.Dispatcher.Invoke(() =>
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", Simens_PLC.GetInstance.AlarmInfo[o], 2, 1);
});
@@ -112,7 +112,7 @@ namespace BPASmartClient.Academy.Model
}
});
});
}
Thread.Sleep(2000);
}
@@ -120,15 +120,15 @@ namespace BPASmartClient.Academy.Model
{
if (IsConnected)
{
siemens.Read<bool>("DB1.DBX1003.7").OnSuccess(o =>
siemens.Read<bool>("DB1.DBX1003.7").OnSuccess(o =>
{
heart = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.0").OnSuccess(o =>
siemens.Read<bool>("DB1.DBX2000.0").OnSuccess(o =>
{
deviceCtrl.M101 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.1").OnSuccess(o =>
siemens.Read<bool>("DB1.DBX2000.1").OnSuccess(o =>
{
deviceCtrl.M102 = o.Content;
});
@@ -152,10 +152,10 @@ namespace BPASmartClient.Academy.Model
{
deviceCtrl.VX103 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.7").OnSuccess(o =>
{
deviceCtrl.VX104 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.7").OnSuccess(o =>
{
deviceCtrl.VX104 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.0").OnSuccess(o =>
{
deviceCtrl.VX105 = o.Content;
@@ -168,10 +168,10 @@ namespace BPASmartClient.Academy.Model
{
deviceCtrl.VX107 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.3").OnSuccess(o =>
{
deviceCtrl.VX108 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.3").OnSuccess(o =>
{
deviceCtrl.VX108 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.4").OnSuccess(o =>
{
deviceCtrl.VX109 = o.Content;
@@ -200,7 +200,7 @@ namespace BPASmartClient.Academy.Model
{
deviceCtrl.VX115 = o.Content;
});
siemens.Read<int>("DB1.DBD2022").OnSuccess(o =>
siemens.Read<int>("DB1.DBD2022").OnSuccess(o =>
{
deviceCtrl.TempWok = o.Content;
});
@@ -220,10 +220,10 @@ namespace BPASmartClient.Academy.Model
Thread.Sleep(100);
}
}
public void PipeDetect()
public void PipeDetect()
{
//阀门3-4连接
if (deviceCtrl.VX102||deviceCtrl.VX103)
if (deviceCtrl.VX102 || deviceCtrl.VX103)
{
DeviceMotionViewModel.PipeLine.PipeH_1.Fill = true;
DeviceMotionViewModel.PipeLine.PipeH_1.Direction = 2;
@@ -258,7 +258,7 @@ namespace BPASmartClient.Academy.Model
DeviceMotionViewModel.PipeLine.PipeH_3.Fill = false;
DeviceMotionViewModel.PipeLine.PipeH_3.Direction = 0;
}
else
else
{
if (deviceCtrl.VX108)
{
@@ -278,7 +278,7 @@ namespace BPASmartClient.Academy.Model
DeviceMotionViewModel.PipeLine.PipeH_4.Fill = true;
DeviceMotionViewModel.PipeLine.PipeH_4.Direction = 1;
}
else
else
{
DeviceMotionViewModel.PipeLine.PipeH_4.Fill = false;
DeviceMotionViewModel.PipeLine.PipeH_4.Direction = 0;
@@ -315,7 +315,7 @@ namespace BPASmartClient.Academy.Model
//DataView(dataFeedback.WeightWok, new DataValue() { DateTime = date, Value = saveData.WeightWok });
if (siemens != null && id != "")
{
SaveData saveData = new SaveData()
{
Id = Simens_PLC.GetInstance.id,
@@ -364,7 +364,7 @@ namespace BPASmartClient.Academy.Model
IsConnected = true;
});
}
Thread.Sleep(3000);
}



Carregando…
Cancelar
Salvar