|
|
@@ -6,7 +6,7 @@ using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using TeamAAS_VP.Models.PLC;
|
|
|
|
|
|
-namespace TeamAAS_VP.Models
|
|
|
+namespace TeamAAS_VP.Models.PLC
|
|
|
{
|
|
|
public class PlcAddressConfig : BindableBase
|
|
|
{
|
|
|
@@ -489,6 +489,13 @@ namespace TeamAAS_VP.Models
|
|
|
return a;
|
|
|
}
|
|
|
|
|
|
+ // 辅助局部函数:确保 PlcPointAddress 实例存在
|
|
|
+ PlcPointAddress EnsurePoint(PlcPointAddress p)
|
|
|
+ {
|
|
|
+ if (p == null) return new PlcPointAddress();
|
|
|
+ return p;
|
|
|
+ }
|
|
|
+
|
|
|
// 2. 按 JSON 提供的数据设置默认值(以当前属性名为准)
|
|
|
Out_WorkMode = Ensure(Out_WorkMode);
|
|
|
Out_WorkMode.Address = "ns=4;s=DB_Communication|FromPC.WorkMode";
|
|
|
@@ -535,6 +542,8 @@ namespace TeamAAS_VP.Models
|
|
|
Out_FixedCameracheckNum.DataType = "int16";
|
|
|
Out_FixedCameracheckNum.Description = "固定相机检测锁附/组装次数=0 无";
|
|
|
|
|
|
+ Out_PickCamera = EnsurePoint(Out_PickCamera);
|
|
|
+
|
|
|
// 3. 为其余 Out_* 设置合理默认(基于注释)
|
|
|
Out_WorkNum = Ensure(Out_WorkNum);
|
|
|
Out_WorkNum.Address = "ns=4;s=DB_Communication|FromPC.WorkNum";
|
|
|
@@ -586,6 +595,120 @@ namespace TeamAAS_VP.Models
|
|
|
Out_MesStatus.DataType = "int16";
|
|
|
Out_MesStatus.Description = "过站信息 =1 允许工作 =2 本站放行 =3 数据上传完成";
|
|
|
|
|
|
+ // Out_PickCamera 初始化并赋地址
|
|
|
+ Out_PickCamera = EnsurePoint(Out_PickCamera);
|
|
|
+ Out_PickCamera.Description = "取料拍照点位参数";
|
|
|
+ Out_PickCamera.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.X_Position";
|
|
|
+ Out_PickCamera.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.X_Velocity";
|
|
|
+ Out_PickCamera.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Y_Position";
|
|
|
+ Out_PickCamera.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Y_Velocity";
|
|
|
+ Out_PickCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Z_Position_Start";
|
|
|
+ Out_PickCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Z_Velocity_Start";
|
|
|
+ Out_PickCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Z_Position_Stop";
|
|
|
+ Out_PickCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Z_Velocity_Stop";
|
|
|
+ Out_PickCamera.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.U_Position";
|
|
|
+ Out_PickCamera.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.U_Velocity";
|
|
|
+ Out_PickCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.R_Position";
|
|
|
+ Out_PickCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.R_Velocity";
|
|
|
+ Out_PickCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Torque";
|
|
|
+ Out_PickCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.Feeder";
|
|
|
+ Out_PickCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera{0}.ScrewProNum";
|
|
|
+
|
|
|
+ // Out_Pick(取料点位)初始化并赋地址
|
|
|
+ Out_Pick = EnsurePoint(Out_Pick);
|
|
|
+ Out_Pick.Description = "取料点位参数";
|
|
|
+ Out_Pick.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.X_Position";
|
|
|
+ Out_Pick.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.X_Velocity";
|
|
|
+ Out_Pick.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Y_Position";
|
|
|
+ Out_Pick.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Y_Velocity";
|
|
|
+ Out_Pick.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Z_Position_Start";
|
|
|
+ Out_Pick.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Z_Velocity_Start";
|
|
|
+ Out_Pick.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Z_Position_Stop";
|
|
|
+ Out_Pick.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Z_Velocity_Stop";
|
|
|
+ Out_Pick.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.U_Position";
|
|
|
+ Out_Pick.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.U_Velocity";
|
|
|
+ Out_Pick.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.R_Position";
|
|
|
+ Out_Pick.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.R_Velocity";
|
|
|
+ Out_Pick.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Torque";
|
|
|
+ Out_Pick.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.Feeder";
|
|
|
+ Out_Pick.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick{0}.ScrewProNum";
|
|
|
+
|
|
|
+ // Out_SecPosCamera(下相机二次定位)初始化并赋地址
|
|
|
+ Out_SecPosCamera = EnsurePoint(Out_SecPosCamera);
|
|
|
+ Out_SecPosCamera.Description = "下相机二次定位点位参数";
|
|
|
+ Out_SecPosCamera.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.X_Position";
|
|
|
+ Out_SecPosCamera.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.X_Velocity";
|
|
|
+ Out_SecPosCamera.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Y_Position";
|
|
|
+ Out_SecPosCamera.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Y_Velocity";
|
|
|
+ Out_SecPosCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Z_Position_Start";
|
|
|
+ Out_SecPosCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Z_Velocity_Start";
|
|
|
+ Out_SecPosCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Z_Position_Stop";
|
|
|
+ Out_SecPosCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Z_Velocity_Stop";
|
|
|
+ Out_SecPosCamera.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.U_Position";
|
|
|
+ Out_SecPosCamera.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.U_Velocity";
|
|
|
+ Out_SecPosCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.R_Position";
|
|
|
+ Out_SecPosCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.R_Velocity";
|
|
|
+ Out_SecPosCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Torque";
|
|
|
+ Out_SecPosCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.Feeder";
|
|
|
+ Out_SecPosCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera{0}.ScrewProNum";
|
|
|
+
|
|
|
+ // Out_ScrewCamera(锁附拍照点位)初始化并赋地址
|
|
|
+ Out_ScrewCamera = EnsurePoint(Out_ScrewCamera);
|
|
|
+ Out_ScrewCamera.Description = "锁附拍照点位参数";
|
|
|
+ Out_ScrewCamera.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.X_Position";
|
|
|
+ Out_ScrewCamera.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.X_Velocity";
|
|
|
+ Out_ScrewCamera.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Y_Position";
|
|
|
+ Out_ScrewCamera.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Y_Velocity";
|
|
|
+ Out_ScrewCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Z_Position_Start";
|
|
|
+ Out_ScrewCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Z_Velocity_Start";
|
|
|
+ Out_ScrewCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Z_Position_Stop";
|
|
|
+ Out_ScrewCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Z_Velocity_Stop";
|
|
|
+ Out_ScrewCamera.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.U_Position";
|
|
|
+ Out_ScrewCamera.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.U_Velocity";
|
|
|
+ Out_ScrewCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.R_Position";
|
|
|
+ Out_ScrewCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.R_Velocity";
|
|
|
+ Out_ScrewCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Torque";
|
|
|
+ Out_ScrewCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.Feeder";
|
|
|
+ Out_ScrewCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera{0}.ScrewProNum";
|
|
|
+
|
|
|
+ // Out_Screw(锁附点位)初始化并赋地址
|
|
|
+ Out_Screw = EnsurePoint(Out_Screw);
|
|
|
+ Out_Screw.Description = "锁附点位参数";
|
|
|
+ Out_Screw.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.X_Position";
|
|
|
+ Out_Screw.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.X_Velocity";
|
|
|
+ Out_Screw.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Y_Position";
|
|
|
+ Out_Screw.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Y_Velocity";
|
|
|
+ Out_Screw.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Z_Position_Start";
|
|
|
+ Out_Screw.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Z_Velocity_Start";
|
|
|
+ Out_Screw.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Z_Position_Stop";
|
|
|
+ Out_Screw.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Z_Velocity_Stop";
|
|
|
+ Out_Screw.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.U_Position";
|
|
|
+ Out_Screw.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.U_Velocity";
|
|
|
+ Out_Screw.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.R_Position";
|
|
|
+ Out_Screw.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.R_Velocity";
|
|
|
+ Out_Screw.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Torque";
|
|
|
+ Out_Screw.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.Feeder";
|
|
|
+ Out_Screw.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw{0}.ScrewProNum";
|
|
|
+
|
|
|
+ // Out_CheckCamera(复检点位)初始化并赋地址
|
|
|
+ Out_CheckCamera = EnsurePoint(Out_CheckCamera);
|
|
|
+ Out_CheckCamera.Description = "复检点位参数";
|
|
|
+ Out_CheckCamera.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.X_Position";
|
|
|
+ Out_CheckCamera.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.X_Velocity";
|
|
|
+ Out_CheckCamera.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Y_Position";
|
|
|
+ Out_CheckCamera.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Y_Velocity";
|
|
|
+ Out_CheckCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Z_Position_Start";
|
|
|
+ Out_CheckCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Z_Velocity_Start";
|
|
|
+ Out_CheckCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Z_Position_Stop";
|
|
|
+ Out_CheckCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Z_Velocity_Stop";
|
|
|
+ Out_CheckCamera.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.U_Position";
|
|
|
+ Out_CheckCamera.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.U_Velocity";
|
|
|
+ Out_CheckCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.R_Position";
|
|
|
+ Out_CheckCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.R_Velocity";
|
|
|
+ Out_CheckCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Torque";
|
|
|
+ Out_CheckCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.Feeder";
|
|
|
+ Out_CheckCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera{0}.ScrewProNum";
|
|
|
+
|
|
|
// 4. In_* 默认(假定从 PLC 读到 PC,使用 ToPC 前缀)
|
|
|
In_Code = Ensure(In_Code);
|
|
|
In_Code.Address = "ns=4;s=DB_Communication|ToPC.Code";
|