界面数据步骤数据的绑定

This commit is contained in:
2025-04-26 16:02:12 +08:00
parent 55c9e1c216
commit cf3d09cb3e
6 changed files with 106 additions and 73 deletions

View File

@@ -85,6 +85,8 @@
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- 手自动切换 -->
<StackPanel
Grid.ColumnSpan="2"
Margin="5,3,3,0"
@@ -112,7 +114,7 @@
Foreground="CadetBlue"
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}" />
</StackPanel>
<!-- MV -->
<StackPanel
Grid.Row="1"
Grid.Column="0"
@@ -154,6 +156,7 @@
Text="MV"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
</StackPanel>
<!-- SV -->
<StackPanel
Grid.Row="1"
Grid.Column="1"

View File

@@ -76,11 +76,22 @@ namespace CapMachine.Wpf.Models.ProModelPars
/// </summary>
public ProStepExe NextProStepExe { get; set; }
private ProStepExe _CurProStepExe;
/// <summary>
/// 当前步骤数据执行
/// 给看步骤是否变化使用
/// </summary>
public ProStepExe CurProStepExe { get; set; }
public ProStepExe CurProStepExe
{
get { return _CurProStepExe; }
set { _CurProStepExe = value;RaisePropertyChanged(); }
}
///// <summary>
///// 当前步骤数据执行
///// 给看步骤是否变化使用
///// </summary>
//public ProStepExe CurProStepExe { get; set; }
/// <summary>
/// 上一步步骤数据执行

View File

@@ -183,6 +183,8 @@ namespace CapMachine.Wpf.Services
/// <param name="IsEnable"></param>
public void UpdateCapEnableCmdData(bool IsEnable)
{
if (!ToomossCanDrive.IsCycleSend) return;
if (EnableCanCmdData != null)
{
EnableCanCmdData.SignalCmdValue = IsEnable ? 1 : 0;

View File

@@ -167,6 +167,8 @@ namespace CapMachine.Wpf.Services
/// <param name="IsEnable"></param>
public void UpdateCapEnableCmdData(bool IsEnable)
{
if (!ToomossLinDrive.IsCycleSend) return;
if (EnableLinCmdData != null)
{
EnableLinCmdData.SignalCmdValue = IsEnable ? 1 : 0;

View File

@@ -2211,24 +2211,34 @@ namespace CapMachine.Wpf.Services
ListHandSwitchData = new List<HandSwitchData>()
{
new HandSwitchData(){Name="自动",ActionAddress="M0.0",StateAddress="M0.0" },
new HandSwitchData(){Name="抽真空",ActionAddress="M0.1",StateAddress="V15.2" },
//new HandSwitchData(){Name="复位",ActionAddress="M0.2",StateAddress="M0.2" },放到上侧的按钮区域了
new HandSwitchData(){Name="抽真空",ActionAddress="M0.3",StateAddress="V9.0" },
//new HandSwitchData(){Name="复位",ActionAddress="M0.7",StateAddress="M0.7" },放到上侧的按钮区域了
//new HandSwitchData(){Name="消音",ActionAddress="M0.3",StateAddress="M0.3" },放到上侧的按钮区域了
new HandSwitchData(){Name="HV电源",ActionAddress="M1.1",StateAddress="Q0.1" },
new HandSwitchData(){Name="HV启动",ActionAddress="M1.2",StateAddress="Q0.6" },
new HandSwitchData(){Name="HV启动",ActionAddress="M1.2",StateAddress="Q2.0" },
new HandSwitchData(){Name="LV电源",ActionAddress="M1.3",StateAddress="Q0.2" },
new HandSwitchData(){Name="水泵",ActionAddress="M1.4",StateAddress="Q0.3" },
new HandSwitchData(){Name="冷凝器电加热",ActionAddress="M1.5",StateAddress="Q0.4" },
new HandSwitchData(){Name="吸气混合器电加热",ActionAddress="M1.6",StateAddress="Q0.5" },
new HandSwitchData(){Name="吸排气球阀",ActionAddress="M1.7",StateAddress="Q0.7" },
new HandSwitchData(){Name="试验箱",ActionAddress="M2.0",StateAddress="V15.0" },
new HandSwitchData(){Name="水SEV1",ActionAddress="M2.1",StateAddress="Q1.0" },
new HandSwitchData(){Name="水SEV2",ActionAddress="M2.2",StateAddress="Q1.1" },
new HandSwitchData(){Name="HCV1",ActionAddress="M2.3",StateAddress="Q1.2" },
new HandSwitchData(){Name="HCV2",ActionAddress="M2.4",StateAddress="Q1.3" },
new HandSwitchData(){Name="ECV1",ActionAddress="M2.5",StateAddress="Q1.4" },
new HandSwitchData(){Name="ECV2",ActionAddress="M2.6",StateAddress="Q1.5" },
new HandSwitchData(){Name="使能",ActionAddress="M2.7",StateAddress="V15.1" },
new HandSwitchData(){Name="LV启动",ActionAddress="M1.4",StateAddress="M1.4" },//VW30=1
new HandSwitchData(){Name="P1水泵",ActionAddress="M1.5",StateAddress="Q0.3" },
new HandSwitchData(){Name="P2水泵",ActionAddress="M1.6",StateAddress="Q0.4" },
new HandSwitchData(){Name="OS1加热器",ActionAddress="M1.7",StateAddress="Q0.5" },
new HandSwitchData(){Name="OS2加热器",ActionAddress="M2.0",StateAddress="Q0.6" },
new HandSwitchData(){Name="COND2加热器",ActionAddress="M2.1",StateAddress="Q0.7" },
new HandSwitchData(){Name="EVAP加热器",ActionAddress="M2.2",StateAddress="Q1.0" },
new HandSwitchData(){Name="HCV1",ActionAddress="M2.3",StateAddress="Q1.1" },
new HandSwitchData(){Name="HCV2",ActionAddress="M2.4",StateAddress="Q1.7" },
new HandSwitchData(){Name="HCV3",ActionAddress="M2.5",StateAddress="Q1.2" },
new HandSwitchData(){Name="HCV4",ActionAddress="M2.6",StateAddress="Q1.3" },
new HandSwitchData(){Name="EV1",ActionAddress="M2.7",StateAddress="Q1.4" },
new HandSwitchData(){Name="EV2",ActionAddress="M3.0",StateAddress="Q1.5" },
new HandSwitchData(){Name="EV3",ActionAddress="M3.1",StateAddress="Q1.6" },
new HandSwitchData(){Name="EV4",ActionAddress="M3.2",StateAddress="Q2.1" },
new HandSwitchData(){Name="试验箱",ActionAddress="M3.3",StateAddress="M3.3" },//VW32=1
new HandSwitchData(){Name="吸排气球阀",ActionAddress="M3.4",StateAddress="Q2.3" },
new HandSwitchData(){Name="使能",ActionAddress="M3.5",StateAddress="V9.1" },
};
ListPlcExdConfigCell = new List<PlcExdConfigCell>()
@@ -2285,23 +2295,25 @@ namespace CapMachine.Wpf.Services
/// <returns></returns>
public bool SysReset()
{
//return true;
SiemensDrive.Write("M0.7", true);
return true;
//取消XXX
var FindData = ListHandSwitchData.Where(a => a.Name == "复位");
if (FindData.Count() > 0)
{
var Result = SiemensDrive.Write(FindData.First().ActionAddress, true);
if (Result.IsSuccess)
{
return true;
}
else
{
return false;
}
}
return false;
////取消XXX
//var FindData = ListHandSwitchData.Where(a => a.Name == "复位");
//if (FindData.Count() > 0)
//{
// var Result = SiemensDrive.Write(FindData.First().ActionAddress, true);
// if (Result.IsSuccess)
// {
// return true;
// }
// else
// {
// return false;
// }
//}
//return false;
}
/// <summary>
@@ -2628,8 +2640,6 @@ namespace CapMachine.Wpf.Services
}
//PV批量读取
OperateResultBlockPVRead = SiemensDrive.Read("VW100", 200);
if (OperateResultBlockPVRead.IsSuccess)
@@ -2703,6 +2713,11 @@ namespace CapMachine.Wpf.Services
}
}
//手自动切换按钮条件
AutoHandSwtichConditionState.AlarmStateResult = SiemensDrive.ReadBool(AutoHandSwtichConditionState.AlarmAddress);
AutoHandSwtichConditionState.HandStateResult = SiemensDrive.ReadBool(AutoHandSwtichConditionState.HandStateAddress);
AutoHandSwtichConditionState.SumResult();
//程序步骤的写入
ProRunStepWrite();
@@ -2713,44 +2728,44 @@ namespace CapMachine.Wpf.Services
//Console.WriteLine("Add Elapsed output runTime:{0}", stopwatch.Elapsed.TotalSeconds.ToString());
//stopwatch.Reset();
////读取报警信息 取消报警XXX
//OperateResultAlarm = SiemensDrive.ReadBool("V0.0", 15);
//if (OperateResultAlarm.IsSuccess)
//{
// foreach (var item in AlarmService.ListAlarmRunCell)
// {
// item.UpdateBoolValue(OperateResultAlarm.Content[item.Index]);
// }
//}
//读取报警信息 取消报警XXX
OperateResultAlarm = SiemensDrive.ReadBool("V0.0", 15);
if (OperateResultAlarm.IsSuccess)
{
foreach (var item in AlarmService.ListAlarmRunCell)
{
item.UpdateBoolValue(OperateResultAlarm.Content[item.Index]);
}
}
////循环读取手自动切换 取消XXX
//foreach (var item in ListHandSwitchData)
//{
// item.StateOperateResult = SiemensDrive.ReadBool(item.StateAddress);
// if (item.StateOperateResult.IsSuccess)
// {
// item.State = item.StateOperateResult.Content;
// //根据PLC得到执行的步骤数据更新到CAN和LIN的数据
// if (item.Name!.Equals("使能"))
// {
// switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
// {
// case CanLinEnum.Can:
// //获取PLC的使能状态更新到CAN的使能状态
// CanDriveService.UpdateCapEnableCmdData(item.State);
// //itemTag.Value.EngPvValue = 0;
// break;
// case CanLinEnum.Lin:
// //获取PLC的使能状态更新到LIN的使能状态
// LinDriveService.UpdateCapEnableCmdData(item.State);
// //itemTag.Value.EngPvValue = 0;
// break;
// default:
// break;
// }
// }
// }
//}
//循环读取手自动切换 取消XXX
foreach (var item in ListHandSwitchData)
{
item.StateOperateResult = SiemensDrive.ReadBool(item.StateAddress);
if (item.StateOperateResult.IsSuccess)
{
item.State = item.StateOperateResult.Content;
//根据PLC得到执行的步骤数据更新到CAN和LIN的数据
if (item.Name!.Equals("使能"))
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//获取PLC的使能状态更新到CAN的使能状态
CanDriveService.UpdateCapEnableCmdData(item.State);
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//获取PLC的使能状态更新到LIN的使能状态
LinDriveService.UpdateCapEnableCmdData(item.State);
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
}
}
////拓展信息的展示 取消XXX

View File

@@ -301,7 +301,7 @@
VerticalAlignment="Center"
FontSize="30"
FontWeight="Bold"
Text="" />
Text="{Binding ProRuntimeService.SpeedProExModel.CurProStepExe.ProStepInfo}" />
</StackPanel>
</materialDesign:Card>