diff --git a/CapMachine.Wpf/CanDrive/CanDbcModel.cs b/CapMachine.Wpf/CanDrive/CanDbcModel.cs
index 1a3541c..fa7f0ea 100644
--- a/CapMachine.Wpf/CanDrive/CanDbcModel.cs
+++ b/CapMachine.Wpf/CanDrive/CanDbcModel.cs
@@ -80,6 +80,17 @@ namespace CapMachine.Wpf.CanDrive
}
}
+ private int _IsSeletedInfo;
+ ///
+ /// 被选中的信息
+ /// 方便标注着色
+ ///
+ public int IsSeletedInfo
+ {
+ get { return _IsSeletedInfo; }
+ set { _IsSeletedInfo = value;RaisePropertyChanged(); }
+ }
+
///
/// 发布者
diff --git a/CapMachine.Wpf/LinDrive/LinLdfModel.cs b/CapMachine.Wpf/LinDrive/LinLdfModel.cs
index 376a766..9ec3e57 100644
--- a/CapMachine.Wpf/LinDrive/LinLdfModel.cs
+++ b/CapMachine.Wpf/LinDrive/LinLdfModel.cs
@@ -80,6 +80,18 @@ namespace CapMachine.Wpf.LinDrive
}
}
+ private int _IsSeletedInfo;
+ ///
+ /// 被选中的信息
+ /// 方便标注着色
+ ///
+ public int IsSeletedInfo
+ {
+ get { return _IsSeletedInfo; }
+ set { _IsSeletedInfo = value; RaisePropertyChanged(); }
+ }
+
+
///
/// 发布者
///
diff --git a/CapMachine.Wpf/Models/LightChart/ChartManager.cs b/CapMachine.Wpf/Models/LightChart/ChartManager.cs
index df02141..c843911 100644
--- a/CapMachine.Wpf/Models/LightChart/ChartManager.cs
+++ b/CapMachine.Wpf/Models/LightChart/ChartManager.cs
@@ -532,7 +532,7 @@ namespace CapMachine.Wpf.Models.LightChart
//Reduce memory usage and increase performance. Destroys out-scrolled data.
LgChart.ViewXY.DropOldSeriesData = false;
-
+
//多个Y曲线摆放形式
LgChart.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Layered;
//网格带
@@ -600,8 +600,8 @@ namespace CapMachine.Wpf.Models.LightChart
//CursorValueDisplay.LocationScreenCoords.X = 1480;
//光标注释相对的位置 左上侧
- CursorValueDisplay.LocationScreenCoords.Y = 30;
- CursorValueDisplay.LocationScreenCoords.X = 250;
+ CursorValueDisplay.LocationScreenCoords.Y = 35;
+ CursorValueDisplay.LocationScreenCoords.X = 1380;
//CursorValueDisplay.TargetAxisValues.X = 0;
//CursorValueDisplay.TargetAxisValues.Y = 0;
@@ -693,7 +693,7 @@ namespace CapMachine.Wpf.Models.LightChart
///
private void UpdateRecordData(RecordChannelData data)
{
-
+
if (data.Data != null)
{
@@ -1462,6 +1462,7 @@ namespace CapMachine.Wpf.Models.LightChart
return;
}
+
////当前是否是给自己的指令的信息
//if (par.GroupTabIndex == CurSelectedGroupTabIndex)
//{
@@ -1518,9 +1519,20 @@ namespace CapMachine.Wpf.Models.LightChart
break;
case "保存照片":
+
//只保存当前TabIndex的图片截图
if (par.GroupTabIndex == CurSelectedGroupTabIndex)
{
+ //临时屏蔽状态,保存会执行两次
+ if (ConfigService.ChartSavePageTempState)
+ {
+ ConfigService.ChartSavePageTempState = false;
+ }
+ else
+ {
+ return;
+ }
+
var PicPath = GetFilePath();
if (PicPath != null)
{
diff --git a/CapMachine.Wpf/ProPars/ProParsSongZhiHelper.cs b/CapMachine.Wpf/ProPars/ProParsSongZhiHelper.cs
index 96d37a1..5e2e2f4 100644
--- a/CapMachine.Wpf/ProPars/ProParsSongZhiHelper.cs
+++ b/CapMachine.Wpf/ProPars/ProParsSongZhiHelper.cs
@@ -90,20 +90,56 @@ namespace CapMachine.Wpf.ProPars
//装载ListPlcParsData的结构数据
//for (int i = 0; i < Cycle; i++)//Proge 大循环 未启用,默认执行一次
//{
- foreach (ProStep proStep in proSteps)//ProStep 小循环
- {
- //每个ProStep步骤里面包含多个参数的设置
- ListPlcParsData = LoadPlcParsData(proStep, ListPlcParsData);//内部循环
- }
+ foreach (ProStep proStep in proSteps)//ProStep 小循环
+ {
+ //每个ProStep步骤里面包含多个参数的设置
+ ListPlcParsData = LoadPlcParsData(proStep, ListPlcParsData);//内部循环
+ }
//}
- //装载地址 VW1000
- ListPlcParsData = LoadPlcCellAddress(ListPlcParsData);
+ ////防止上一次下载的程序多余当前的步骤,为了清空多余的步骤数据,增加一行的数据
+
+ ////装载地址 VW1000
+ //ListPlcParsData = LoadPlcCellAddress(ListPlcParsData);
//var datga = LoadPlcBlockAddress(ListPlcParsData, 1000);
return ListPlcParsData;
}
+ ///
+ /// 增加一行空的数据,作为终止的执行
+ ///
+ public static List AddNullData(List plcParsDatas)
+ {
+ var NewStep = new ProStep()
+ {
+ MeterCond1Temps = new List() { new MeterCond1Temp() { ValueType=ConfigValueType.Constant,} },
+ MeterCond2Presss=new List() { new MeterCond2Press() { ValueType = ConfigValueType.Constant, } },
+ MeterCond2Temps= new List() { new MeterCond2Temp() { ValueType = ConfigValueType.Constant, } },
+ MeterEnvRHs = new List() { new MeterEnvRH() { ValueType = ConfigValueType.Constant, } },
+ MeterEnvTemps = new List() { new MeterEnvTemp() { ValueType = ConfigValueType.Constant, } },
+ MeterEVAPExpTemps = new List() { new MeterEVAPExpTemp() { ValueType = ConfigValueType.Constant, } },
+ MeterExPresss = new List() { new MeterExPress() { ValueType = ConfigValueType.Constant, } },
+ MeterHVVols = new List() { new MeterHVVol() { ValueType = ConfigValueType.Constant, } },
+ MeterInhPresss = new List() { new MeterInhPress() { ValueType = ConfigValueType.Constant, } },
+ MeterInhTemps = new List() { new MeterInhTemp() { ValueType = ConfigValueType.Constant, } },
+ MeterLubePresss = new List() { new MeterLubePress() { ValueType = ConfigValueType.Constant, } },
+ MeterLVVols = new List() { new MeterLVVol() { ValueType = ConfigValueType.Constant, } },
+ MeterOCRs = new List() { new MeterOCR() { ValueType = ConfigValueType.Constant, } },
+ MeterOS1Temps = new List() { new MeterOS1Temp() { ValueType = ConfigValueType.Constant, } },
+ MeterOS2Temps = new List() { new MeterOS2Temp() { ValueType = ConfigValueType.Constant, } },
+ MeterPTCEntTemps = new List() { new MeterPTCEntTemp() { ValueType = ConfigValueType.Constant, } },
+ MeterPTCFlows = new List() { new MeterPTCFlow() { ValueType = ConfigValueType.Constant, } },
+ MeterPTCPws = new List() { new MeterPTCPw() { ValueType = ConfigValueType.Constant, } },
+ MeterSpeeds = new List() { new MeterSpeed() { ValueType = ConfigValueType.Constant, } },
+ StepNo = 0,
+ SpeedCycle = 0,
+ Remark = "结束",
+ };
+
+ return LoadPlcParsData(NewStep, plcParsDatas);
+
+ }
///
/// 加载数据到PLC
@@ -1640,7 +1676,7 @@ namespace CapMachine.Wpf.ProPars
///
private static int GetCycleCount(int Cycle, int Index, int ListCount)
{
- if (Cycle==1)
+ if (Cycle == 1)
{
//只有一次,也就是没有循环,就是直接的步骤,统一返回没有循环固定值
return 0;
@@ -1675,7 +1711,7 @@ namespace CapMachine.Wpf.ProPars
/// 单元分割
///
///
- private static List LoadPlcCellAddress(List plcParsDatas)
+ public static List LoadPlcCellAddress(List plcParsDatas)
{
//单步长度
int StepLengh = 150;
@@ -1721,6 +1757,8 @@ namespace CapMachine.Wpf.ProPars
return plcParsDatas;
}
+
+
///
/// 加载PLC块地址信息
///
diff --git a/CapMachine.Wpf/Services/ConfigService.cs b/CapMachine.Wpf/Services/ConfigService.cs
index 86baabc..2a41798 100644
--- a/CapMachine.Wpf/Services/ConfigService.cs
+++ b/CapMachine.Wpf/Services/ConfigService.cs
@@ -68,6 +68,12 @@ namespace CapMachine.Wpf.Services
///
public int ChartRtDataCacheTimeSec { get; set; } = 3600_8;
+ ///
+ /// 曲线保存临时状态
+ /// 曲线照片保存会执行两次,这个是屏蔽的状态
+ ///
+ public bool ChartSavePageTempState { get; set; } = false;
+
///
/// CAN和LIN的运行状态模型
///
diff --git a/CapMachine.Wpf/Services/MachineRtDataService.cs b/CapMachine.Wpf/Services/MachineRtDataService.cs
index 6c68c5e..70ac9e8 100644
--- a/CapMachine.Wpf/Services/MachineRtDataService.cs
+++ b/CapMachine.Wpf/Services/MachineRtDataService.cs
@@ -1154,7 +1154,96 @@ namespace CapMachine.Wpf.Services
default:
break;
}
-
+ }
+ else if(itemTag.Value.NameNoUnit == "通讯母线电压")
+ {
+ switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
+ {
+ case CanLinEnum.Can:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯母线电压"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ case CanLinEnum.Lin:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯母线电压"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (itemTag.Value.NameNoUnit == "通讯母线电流")
+ {
+ switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
+ {
+ case CanLinEnum.Can:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯母线电流"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ case CanLinEnum.Lin:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯母线电流"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (itemTag.Value.NameNoUnit == "通讯相电流")
+ {
+ switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
+ {
+ case CanLinEnum.Can:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯相电流"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ case CanLinEnum.Lin:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯相电流"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (itemTag.Value.NameNoUnit == "通讯功率")
+ {
+ switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
+ {
+ case CanLinEnum.Can:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯功率"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ case CanLinEnum.Lin:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯功率"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (itemTag.Value.NameNoUnit == "通讯芯片温度")
+ {
+ switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
+ {
+ case CanLinEnum.Can:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯芯片温度"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ case CanLinEnum.Lin:
+ //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
+ SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯芯片温度"));
+ //itemTag.Value.EngPvValue = 0;
+ break;
+ default:
+ break;
+ }
}
OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
@@ -1285,7 +1374,7 @@ namespace CapMachine.Wpf.Services
}
DiagnosticsTime.Stop();
- ConfigService.PlcCycleTime = (int)DiagnosticsTime.Elapsed.TotalMilliseconds;
+ ConfigService.PlcCycleTime = (int)DiagnosticsTime.Elapsed.TotalMilliseconds-300;
//Console.WriteLine($"扫描时间:{DiagnosticsTime.Elapsed.TotalMilliseconds.ToString()}");
}
});
diff --git a/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs b/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs
index 01da499..5b0d018 100644
--- a/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs
+++ b/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs
@@ -7,6 +7,7 @@ using CapMachine.Wpf.Dtos;
using CapMachine.Wpf.PrismEvent;
using CapMachine.Wpf.Services;
using Ganss.Excel;
+using ImTools;
using Microsoft.VisualBasic;
using Microsoft.Win32;
using NPOI.SS.UserModel.Charts;
@@ -113,9 +114,12 @@ namespace CapMachine.Wpf.ViewModels
if (SelectCanLinConfigPro != null)
{
SelectCanLinConfigPro = canLinConfigPros.Where(a => a.Id == SelectCanLinConfigPro.Id).FirstOrDefault()!;
-
+ //无数据就返回
+ if (SelectCanLinConfigPro == null) return;
+
SelectedCANConfigExdDto = Mapper.Map(SelectCanLinConfigPro!.CANConfigExd);
+ //配置信息
var WirteData = SelectCanLinConfigPro.CanLinConfigContents!.Where(a => a.RWInfo == RW.Write).ToList();
if (WirteData != null && WirteData.Count > 0)
{
@@ -140,19 +144,55 @@ namespace CapMachine.Wpf.ViewModels
// SignalCmdValue = double.TryParse(item.DefautValue, out double result) == true ? result : 0,
//});
}
-
}
var ReadData = SelectCanLinConfigPro.CanLinConfigContents!.Where(a => a.RWInfo == RW.Read).ToList();
if (ReadData != null && ReadData.Count > 0)
{
ListReadCanLinRWConfigDto = new ObservableCollection(Mapper.Map>(ReadData));
+ }
+ //匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListCanDbcModel
+ MatchSeletedAndCanDbcModel();
+ }
+ }
+ ///
+ /// 匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListCanDbcModel
+ /// 为了标注和着色使用
+ ///
+ private void MatchSeletedAndCanDbcModel()
+ {
+ //通过CanLinConfigContents标注ListCanDbcModel的选中状态属性,方便着色
+ if (ListCanDbcModel != null && ListCanDbcModel!.Count() > 0 && SelectCanLinConfigPro.CanLinConfigContents != null && SelectCanLinConfigPro.CanLinConfigContents.Count() > 0)
+ {
+ foreach (var itemCanDbcModel in ListCanDbcModel)
+ {
+ var FindData = SelectCanLinConfigPro.CanLinConfigContents.FindFirst(a => a.SignalName == itemCanDbcModel.SignalName);
+ if (FindData != null)//找到了就标注
+ {
+ switch (FindData.RWInfo)
+ {
+ case RW.Write:
+ itemCanDbcModel.IsSeletedInfo = 1;
+ break;
+ case RW.Read:
+ itemCanDbcModel.IsSeletedInfo = 2;
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ //没有找到了就标注为0
+ itemCanDbcModel.IsSeletedInfo = 0;
+ }
}
}
-
}
+
+
private bool _IsCanConfigProActive = false;
///
/// CAN 配置是否被激活
@@ -335,7 +375,7 @@ namespace CapMachine.Wpf.ViewModels
case "Active":
//激活到取消的状态的判断
- if (IsCanConfigProActive==true)
+ if (IsCanConfigProActive == true)
{
//控件的激活
IsCanConfigProActive = !IsCanConfigProActive;
@@ -467,6 +507,7 @@ namespace CapMachine.Wpf.ViewModels
}
SelectCanLinConfigProConfigName = SelectCanLinConfigPro.ConfigName;
+
return;
}
//先判断是否是正确的集合数据,防止DataGrid的数据源刷新导致的触发事件
@@ -653,8 +694,8 @@ namespace CapMachine.Wpf.ViewModels
return;
}
-
- if ((par as SelectionChangedEventArgs)!.AddedItems[0] == null)
+ //(par as SelectionChangedEventArgs)!.AddedItems[0] == null
+ if ((par as SelectionChangedEventArgs)!.AddedItems.Count==0)
{
return;
}
@@ -777,7 +818,7 @@ namespace CapMachine.Wpf.ViewModels
switch (Par)
{
case "Open":
- if (ComActionService.IsCanToDoWork()==false)
+ if (ComActionService.IsCanToDoWork() == false)
{
System.Windows.MessageBox.Show("请关闭LIN连接后才能开启CAN,同一个时刻只能有一个通信驱动压缩机", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
return;
@@ -793,7 +834,13 @@ namespace CapMachine.Wpf.ViewModels
{
var DbcData = CanDriveService.StartDbc(SelectedCANConfigExdDto.DbcPath);
ListCanDbcModel = DbcData;
+
+ //ListCanDbcModel有数据后就要看看是否有配置信息,有的话就要标注
+ //匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListCanDbcModel
+ MatchSeletedAndCanDbcModel();
+
}
+
}
else
{
diff --git a/CapMachine.Wpf/ViewModels/HistoryDataViewModel.cs b/CapMachine.Wpf/ViewModels/HistoryDataViewModel.cs
index ab57edb..bd17564 100644
--- a/CapMachine.Wpf/ViewModels/HistoryDataViewModel.cs
+++ b/CapMachine.Wpf/ViewModels/HistoryDataViewModel.cs
@@ -40,6 +40,7 @@ namespace CapMachine.Wpf.ViewModels
public IFreeSql FreeSql { get; }
public IEventAggregator EventAggregator { get; }
public IMapper Mapper { get; }
+ public ConfigService ConfigService { get; }
public ILogService Logger { get; }
///
@@ -50,13 +51,13 @@ namespace CapMachine.Wpf.ViewModels
///
///
///
- public HistoryDataViewModel(IDialogService dialogService, IFreeSql freeSql, IEventAggregator eventAggregator, IMapper mapper)
+ public HistoryDataViewModel(IDialogService dialogService, IFreeSql freeSql, IEventAggregator eventAggregator, IMapper mapper,ConfigService configService)
{
DialogService = dialogService;
FreeSql = freeSql;
EventAggregator = eventAggregator;
Mapper = mapper;
-
+ ConfigService = configService;
ListChartTabGroupDto = Mapper.Map>(FreeSql.Select().Where(a => a.IsEnable == true).ToList());
@@ -948,6 +949,8 @@ namespace CapMachine.Wpf.ViewModels
EventAggregator.GetEvent().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "游标放大" });
break;
case "保存照片":
+ //临时的屏蔽状态
+ ConfigService.ChartSavePageTempState = true;
//Chart操作
EventAggregator.GetEvent().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "保存照片" });
break;
diff --git a/CapMachine.Wpf/ViewModels/LinConfigViewModel.cs b/CapMachine.Wpf/ViewModels/LinConfigViewModel.cs
index c54ff3b..f8fb10e 100644
--- a/CapMachine.Wpf/ViewModels/LinConfigViewModel.cs
+++ b/CapMachine.Wpf/ViewModels/LinConfigViewModel.cs
@@ -18,6 +18,7 @@ using System.Threading.Tasks;
using System.Windows.Controls;
using Microsoft.Win32;
using static CapMachine.Wpf.Models.ComEnum;
+using ImTools;
namespace CapMachine.Wpf.ViewModels
{
@@ -37,7 +38,7 @@ namespace CapMachine.Wpf.ViewModels
///
public LinConfigViewModel(IDialogService dialogService, IFreeSql freeSql,
IEventAggregator eventAggregator, IRegionManager regionManager, SysRunService sysRunService,
- ConfigService configService, LinDriveService linDriveService,ComActionService comActionService,
+ ConfigService configService, LinDriveService linDriveService, ComActionService comActionService,
IMapper mapper, MachineRtDataService machineRtDataService)
{
//LogService = logService;
@@ -113,6 +114,8 @@ namespace CapMachine.Wpf.ViewModels
if (SelectCanLinConfigPro != null)
{
SelectCanLinConfigPro = canLinConfigPros.Where(a => a.Id == SelectCanLinConfigPro.Id).FirstOrDefault()!;
+ //无数据就返回
+ if (SelectCanLinConfigPro == null) return;
SelectedLINConfigExdDto = Mapper.Map(SelectCanLinConfigPro!.LINConfigExd);
@@ -146,11 +149,47 @@ namespace CapMachine.Wpf.ViewModels
if (ReadData != null && ReadData.Count > 0)
{
ListReadCanLinRWConfigDto = new ObservableCollection(Mapper.Map>(ReadData));
+ }
+
+ //匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListLinLdfModel
+ MatchSeletedAndLinLdfModel();
+ }
+ }
+ ///
+ /// 匹配选中的SelectCanLinConfigPro.CanLinConfigContents和LinLdfModel
+ /// 为了标注和着色使用
+ ///
+ private void MatchSeletedAndLinLdfModel()
+ {
+ //通过CanLinConfigContents标注ListLinLdfModel的选中状态属性,方便着色
+ if (ListLinLdfModel != null && ListLinLdfModel!.Count() > 0 && SelectCanLinConfigPro.CanLinConfigContents != null && SelectCanLinConfigPro.CanLinConfigContents.Count() > 0)
+ {
+ foreach (var itemLinLdfModel in ListLinLdfModel)
+ {
+ var FindData = SelectCanLinConfigPro.CanLinConfigContents.FindFirst(a => a.SignalName == itemLinLdfModel.SignalName);
+ if (FindData != null)//找到了就标注
+ {
+ switch (FindData.RWInfo)
+ {
+ case RW.Write:
+ itemLinLdfModel.IsSeletedInfo = 1;
+ break;
+ case RW.Read:
+ itemLinLdfModel.IsSeletedInfo = 2;
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ //没有找到了就标注为0
+ itemLinLdfModel.IsSeletedInfo = 0;
+ }
}
}
-
}
private bool _IsLinConfigProActive = false;
@@ -611,7 +650,6 @@ namespace CapMachine.Wpf.ViewModels
}
}
-
///
/// 选中的LinLdfModel
///
@@ -648,8 +686,7 @@ namespace CapMachine.Wpf.ViewModels
return;
}
-
- if ((par as SelectionChangedEventArgs)!.AddedItems[0] == null)
+ if ((par as SelectionChangedEventArgs)!.AddedItems.Count == 0)
{
return;
}
@@ -788,6 +825,10 @@ namespace CapMachine.Wpf.ViewModels
{
var LdfData = LinDriveService.StartLdf(SelectedLINConfigExdDto.LdfPath);
ListLinLdfModel = LdfData;
+
+ //ListLinLdfModel有数据后就要看看是否有配置信息,有的话就要标注
+ //匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListLinLdfModel
+ MatchSeletedAndLinLdfModel();
}
}
else
diff --git a/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs b/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
index 105fdee..bf819fe 100644
--- a/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
+++ b/CapMachine.Wpf/ViewModels/ProConfigViewModel.cs
@@ -12,6 +12,7 @@ using Prism.Commands;
using Prism.Events;
using Prism.Regions;
using Prism.Services.Dialogs;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Text;
@@ -2320,6 +2321,8 @@ namespace CapMachine.Wpf.ViewModels
{
//当前的程序开始标记
ProParsSongZhiHelper.Start();
+ //返回的数据
+ List ReturnPlcParsData = new List();
//var Data=FreeSql.Select(
//以每个程序为单元循环执行
@@ -2351,14 +2354,19 @@ namespace CapMachine.Wpf.ViewModels
if (FindData != null && FindData.ProSteps != null && FindData.ProSteps.Any())
{
//执行程序的步骤集合数据
- var ReturnPlcParsData = ProParsSongZhiHelper.GetPlcParsData(FindData.ProSteps, FindData.ProRepeat);
- ProParsSongZhiHelper.LoadDataToPLC(MachineRtDataService.SiemensDrive, ReturnPlcParsData);
-
- //下载完成的话,则标记状态
- SysRunService.MachineRunState1.IsProLoad = true;
-
+ ReturnPlcParsData = ProParsSongZhiHelper.GetPlcParsData(FindData.ProSteps, FindData.ProRepeat);
+
}
}
+
+ //防止上一次下载的程序多余当前的步骤,为了清空多余的步骤数据,增加一行的数据
+ ReturnPlcParsData = ProParsSongZhiHelper.AddNullData(ReturnPlcParsData);
+ //装载PLC地址
+ ReturnPlcParsData = ProParsSongZhiHelper.LoadPlcCellAddress(ReturnPlcParsData);
+
+ ProParsSongZhiHelper.LoadDataToPLC(MachineRtDataService.SiemensDrive, ReturnPlcParsData);
+ //下载完成的话,则标记状态
+ SysRunService.MachineRunState1.IsProLoad = true;
}
}
diff --git a/CapMachine.Wpf/ViewModels/RealTimeChartViewModel.cs b/CapMachine.Wpf/ViewModels/RealTimeChartViewModel.cs
index 646163c..b3ab4dc 100644
--- a/CapMachine.Wpf/ViewModels/RealTimeChartViewModel.cs
+++ b/CapMachine.Wpf/ViewModels/RealTimeChartViewModel.cs
@@ -3,6 +3,7 @@ using CapMachine.Core;
using CapMachine.Model;
using CapMachine.Wpf.Dtos;
using CapMachine.Wpf.PrismEvent;
+using CapMachine.Wpf.Services;
using Prism.Commands;
using Prism.Events;
using Prism.Services.Dialogs;
@@ -18,13 +19,13 @@ namespace CapMachine.Wpf.ViewModels
///
/// 实例化函数
///
- public RealTimeChartViewModel(IDialogService dialogService, IFreeSql freeSql, IEventAggregator eventAggregator, IMapper mapper)
+ public RealTimeChartViewModel(IDialogService dialogService, IFreeSql freeSql, IEventAggregator eventAggregator, IMapper mapper,ConfigService configService)
{
DialogService = dialogService;
FreeSql = freeSql;
EventAggregator = eventAggregator;
Mapper = mapper;
-
+ ConfigService = configService;
ListChartTabGroupDto = Mapper.Map>(FreeSql.Select().Where(a => a.IsEnable == true).ToList());
//都要加载数据
@@ -47,6 +48,7 @@ namespace CapMachine.Wpf.ViewModels
/// AutoMap映射
///
public IMapper Mapper { get; }
+ public ConfigService ConfigService { get; }
///
/// FreeSQL 实例
@@ -322,6 +324,8 @@ namespace CapMachine.Wpf.ViewModels
EventAggregator.GetEvent().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "游标放大" });
break;
case "保存照片":
+ //临时的屏蔽状态
+ ConfigService.ChartSavePageTempState = true;
//Chart操作
EventAggregator.GetEvent().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "保存照片" });
break;
diff --git a/CapMachine.Wpf/Views/CANConfigView.xaml b/CapMachine.Wpf/Views/CANConfigView.xaml
index ca761b4..8db8f8e 100644
--- a/CapMachine.Wpf/Views/CANConfigView.xaml
+++ b/CapMachine.Wpf/Views/CANConfigView.xaml
@@ -73,7 +73,7 @@
-
+
@@ -931,6 +931,14 @@
+
+
+
+
+
+
+
+
diff --git a/CapMachine.Wpf/Views/HistoryDataView.xaml b/CapMachine.Wpf/Views/HistoryDataView.xaml
index f45f270..468c246 100644
--- a/CapMachine.Wpf/Views/HistoryDataView.xaml
+++ b/CapMachine.Wpf/Views/HistoryDataView.xaml
@@ -73,7 +73,7 @@
-
-
+ -->