更改了CAN和LIN的标志着色问题
保存图片触发两次 CANLIN的一些数据回读到PLC
This commit is contained in:
@@ -80,6 +80,17 @@ namespace CapMachine.Wpf.CanDrive
|
||||
}
|
||||
}
|
||||
|
||||
private int _IsSeletedInfo;
|
||||
/// <summary>
|
||||
/// 被选中的信息
|
||||
/// 方便标注着色
|
||||
/// </summary>
|
||||
public int IsSeletedInfo
|
||||
{
|
||||
get { return _IsSeletedInfo; }
|
||||
set { _IsSeletedInfo = value;RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发布者
|
||||
|
||||
@@ -80,6 +80,18 @@ namespace CapMachine.Wpf.LinDrive
|
||||
}
|
||||
}
|
||||
|
||||
private int _IsSeletedInfo;
|
||||
/// <summary>
|
||||
/// 被选中的信息
|
||||
/// 方便标注着色
|
||||
/// </summary>
|
||||
public int IsSeletedInfo
|
||||
{
|
||||
get { return _IsSeletedInfo; }
|
||||
set { _IsSeletedInfo = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发布者
|
||||
/// </summary>
|
||||
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -97,13 +97,49 @@ namespace CapMachine.Wpf.ProPars
|
||||
}
|
||||
//}
|
||||
|
||||
//装载地址 VW1000
|
||||
ListPlcParsData = LoadPlcCellAddress(ListPlcParsData);
|
||||
////防止上一次下载的程序多余当前的步骤,为了清空多余的步骤数据,增加一行的数据
|
||||
|
||||
////装载地址 VW1000
|
||||
//ListPlcParsData = LoadPlcCellAddress(ListPlcParsData);
|
||||
//var datga = LoadPlcBlockAddress(ListPlcParsData, 1000);
|
||||
|
||||
return ListPlcParsData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加一行空的数据,作为终止的执行
|
||||
/// </summary>
|
||||
public static List<PlcParsData> AddNullData(List<PlcParsData> plcParsDatas)
|
||||
{
|
||||
var NewStep = new ProStep()
|
||||
{
|
||||
MeterCond1Temps = new List<MeterCond1Temp>() { new MeterCond1Temp() { ValueType=ConfigValueType.Constant,} },
|
||||
MeterCond2Presss=new List<MeterCond2Press>() { new MeterCond2Press() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterCond2Temps= new List<MeterCond2Temp>() { new MeterCond2Temp() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterEnvRHs = new List<MeterEnvRH>() { new MeterEnvRH() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterEnvTemps = new List<MeterEnvTemp>() { new MeterEnvTemp() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterEVAPExpTemps = new List<MeterEVAPExpTemp>() { new MeterEVAPExpTemp() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterExPresss = new List<MeterExPress>() { new MeterExPress() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterHVVols = new List<MeterHVVol>() { new MeterHVVol() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterInhPresss = new List<MeterInhPress>() { new MeterInhPress() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterInhTemps = new List<MeterInhTemp>() { new MeterInhTemp() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterLubePresss = new List<MeterLubePress>() { new MeterLubePress() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterLVVols = new List<MeterLVVol>() { new MeterLVVol() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterOCRs = new List<MeterOCR>() { new MeterOCR() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterOS1Temps = new List<MeterOS1Temp>() { new MeterOS1Temp() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterOS2Temps = new List<MeterOS2Temp>() { new MeterOS2Temp() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterPTCEntTemps = new List<MeterPTCEntTemp>() { new MeterPTCEntTemp() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterPTCFlows = new List<MeterPTCFlow>() { new MeterPTCFlow() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterPTCPws = new List<MeterPTCPw>() { new MeterPTCPw() { ValueType = ConfigValueType.Constant, } },
|
||||
MeterSpeeds = new List<MeterSpeed>() { new MeterSpeed() { ValueType = ConfigValueType.Constant, } },
|
||||
StepNo = 0,
|
||||
SpeedCycle = 0,
|
||||
Remark = "结束",
|
||||
};
|
||||
|
||||
return LoadPlcParsData(NewStep, plcParsDatas);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载数据到PLC
|
||||
@@ -1640,7 +1676,7 @@ namespace CapMachine.Wpf.ProPars
|
||||
/// <returns></returns>
|
||||
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
|
||||
/// 单元分割
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static List<PlcParsData> LoadPlcCellAddress(List<PlcParsData> plcParsDatas)
|
||||
public static List<PlcParsData> LoadPlcCellAddress(List<PlcParsData> plcParsDatas)
|
||||
{
|
||||
//单步长度
|
||||
int StepLengh = 150;
|
||||
@@ -1721,6 +1757,8 @@ namespace CapMachine.Wpf.ProPars
|
||||
return plcParsDatas;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载PLC块地址信息
|
||||
/// </summary>
|
||||
|
||||
@@ -68,6 +68,12 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
public int ChartRtDataCacheTimeSec { get; set; } = 3600_8;
|
||||
|
||||
/// <summary>
|
||||
/// 曲线保存临时状态
|
||||
/// 曲线照片保存会执行两次,这个是屏蔽的状态
|
||||
/// </summary>
|
||||
public bool ChartSavePageTempState { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// CAN和LIN的运行状态模型
|
||||
/// </summary>
|
||||
|
||||
@@ -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()}");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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<CANConfigExdDto>(SelectCanLinConfigPro!.CANConfigExd);
|
||||
|
||||
//配置信息
|
||||
var WirteData = SelectCanLinConfigPro.CanLinConfigContents!.Where(a => a.RWInfo == RW.Write).ToList();
|
||||
if (WirteData != null && WirteData.Count > 0)
|
||||
{
|
||||
@@ -140,18 +144,54 @@ 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<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
|
||||
}
|
||||
|
||||
|
||||
//匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListCanDbcModel
|
||||
MatchSeletedAndCanDbcModel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListCanDbcModel
|
||||
/// 为了标注和着色使用
|
||||
/// </summary>
|
||||
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;
|
||||
/// <summary>
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
@@ -50,13 +51,13 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// <param name="eventAggregator"></param>
|
||||
/// <param name="mapper"></param>
|
||||
/// <param name="logger"></param>
|
||||
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<List<ChartTabGroupDto>>(FreeSql.Select<HistoryChartTabGroup>().Where(a => a.IsEnable == true).ToList());
|
||||
|
||||
|
||||
@@ -948,6 +949,8 @@ namespace CapMachine.Wpf.ViewModels
|
||||
EventAggregator.GetEvent<HistoryChartSetEvent>().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "游标放大" });
|
||||
break;
|
||||
case "保存照片":
|
||||
//临时的屏蔽状态
|
||||
ConfigService.ChartSavePageTempState = true;
|
||||
//Chart操作
|
||||
EventAggregator.GetEvent<HistoryChartSetEvent>().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "保存照片" });
|
||||
break;
|
||||
|
||||
@@ -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
|
||||
/// <param name="machineRtDataService"></param>
|
||||
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<LINConfigExdDto>(SelectCanLinConfigPro!.LINConfigExd);
|
||||
|
||||
@@ -146,11 +149,47 @@ namespace CapMachine.Wpf.ViewModels
|
||||
if (ReadData != null && ReadData.Count > 0)
|
||||
{
|
||||
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
|
||||
}
|
||||
|
||||
|
||||
//匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListLinLdfModel
|
||||
MatchSeletedAndLinLdfModel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 匹配选中的SelectCanLinConfigPro.CanLinConfigContents和LinLdfModel
|
||||
/// 为了标注和着色使用
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中的LinLdfModel
|
||||
/// </summary>
|
||||
@@ -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
|
||||
|
||||
@@ -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<PlcParsData> ReturnPlcParsData = new List<PlcParsData>();
|
||||
|
||||
//var Data=FreeSql.Select<ProSegRun>(
|
||||
//以每个程序为单元循环执行
|
||||
@@ -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);
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
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<List<ChartTabGroupDto>>(FreeSql.Select<ChartTabGroup>().Where(a => a.IsEnable == true).ToList());
|
||||
|
||||
//都要加载数据
|
||||
@@ -47,6 +48,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// AutoMap映射
|
||||
/// </summary>
|
||||
public IMapper Mapper { get; }
|
||||
public ConfigService ConfigService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// FreeSQL 实例
|
||||
@@ -322,6 +324,8 @@ namespace CapMachine.Wpf.ViewModels
|
||||
EventAggregator.GetEvent<ChartSetEvent>().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "游标放大" });
|
||||
break;
|
||||
case "保存照片":
|
||||
//临时的屏蔽状态
|
||||
ConfigService.ChartSavePageTempState = true;
|
||||
//Chart操作
|
||||
EventAggregator.GetEvent<ChartSetEvent>().Publish(new ChartSetMsg() { Machine = CurSelectedMachine, GroupTabIndex = SeletedGroupTabIndex, ChartSetInfo = "保存照片" });
|
||||
break;
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="400" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="500" />
|
||||
<ColumnDefinition Width="550" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Margin="3">
|
||||
@@ -931,6 +931,14 @@
|
||||
</ContextMenu>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsSeletedInfo}" Value="1">
|
||||
<Setter Property="Background" Value="GreenYellow" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsSeletedInfo}" Value="2">
|
||||
<Setter Property="Background" Value="SkyBlue" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button
|
||||
<!--<Button
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Center"
|
||||
Command="{Binding ReportDataCmd}"
|
||||
@@ -89,7 +89,7 @@
|
||||
Text="" />
|
||||
<TextBlock Text="导出Excel数据" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Button>-->
|
||||
<Button
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -209,7 +209,7 @@
|
||||
SelectionMode="Extended"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}">
|
||||
<DataGridTextColumn MinWidth="300" Binding="{Binding Name}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="试验名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
@@ -271,7 +271,7 @@
|
||||
SelectionMode="Extended"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding WorkDay}">
|
||||
<DataGridTextColumn MinWidth="300" Binding="{Binding WorkDay}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="文件名称/日期" />
|
||||
</DataGridTextColumn.Header>
|
||||
|
||||
@@ -930,6 +930,14 @@
|
||||
</ContextMenu>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsSeletedInfo}" Value="1">
|
||||
<Setter Property="Background" Value="GreenYellow" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsSeletedInfo}" Value="2">
|
||||
<Setter Property="Background" Value="SkyBlue" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
|
||||
@@ -1269,11 +1269,11 @@
|
||||
ToolTip="输出锁定" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" HorizontalAlignment="Center">
|
||||
<TextBlock FontSize="12" Text="参数编号(1~16)" />
|
||||
<TextBlock FontSize="12" Text="参数编号(1~10)" />
|
||||
<TextBox Style="{StaticResource txtboxStyle}" Text="{Binding SelectedSlopMeterSpeed.ParNo}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" HorizontalAlignment="Center">
|
||||
<TextBlock FontSize="12" Text="EV(1~4)" />
|
||||
<TextBlock FontSize="12" Text="EV(1~2)" />
|
||||
<TextBox Style="{StaticResource txtboxStyle}" Text="{Binding SelectedSlopMeterSpeed.Ev}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="3" HorizontalAlignment="Center">
|
||||
@@ -1297,7 +1297,7 @@
|
||||
Style="{StaticResource MaterialDesignSwitchToggleButton}"
|
||||
ToolTip="吸排气阀" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
<!--<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Center">
|
||||
@@ -1308,7 +1308,7 @@
|
||||
IsChecked="{Binding SelectedSlopMeterSpeed.PTCEnable}"
|
||||
Style="{StaticResource MaterialDesignSwitchToggleButton}"
|
||||
ToolTip="PTC使能" />
|
||||
</StackPanel>
|
||||
</StackPanel>-->
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user