添加 MX-PD-盘古 项目文件

将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
Shi.Ji
2026-05-18 11:43:09 +08:00
parent 03632a379d
commit e31d3560bb
739 changed files with 99783 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using System.Collections.Generic;
namespace MainShell.DeviceMaintance.Model
{
public enum CylinderControlType
{
SingleOutput = 0,
DualOutput = 1,
MultiOutput = 2
}
public enum CylinderConditionType
{
PointOn = 0,
PointOff = 1
}
public class CylinderActionConditionDefinition
{
public CylinderConditionType ConditionType { get; set; }
public string PointReference { get; set; }
public string Message { get; set; }
public bool ExpectedState => ConditionType == CylinderConditionType.PointOn;
}
public class CylinderDefinition
{
public string Name { get; set; }
public string Description { get; set; }
public string Module { get; set; }
public CylinderControlType ControlType { get; set; }
public List<string> ExtendOutputPoints { get; set; } = new List<string>();
public List<string> RetractOutputPoints { get; set; } = new List<string>();
public List<string> ExtendedFeedbackPoints { get; set; } = new List<string>();
public List<string> RetractedFeedbackPoints { get; set; } = new List<string>();
public List<CylinderActionConditionDefinition> ExtendConditions { get; set; } = new List<CylinderActionConditionDefinition>();
public List<CylinderActionConditionDefinition> RetractConditions { get; set; } = new List<CylinderActionConditionDefinition>();
public bool HasRetractOutputs => RetractOutputPoints != null && RetractOutputPoints.Count > 0;
}
public class CylinderExecutionResult
{
public bool Success { get; set; }
public string FailureReason { get; set; }
public IReadOnlyList<string> FailurePointReferences { get; set; } = new List<string>();
}
}

View File

@@ -0,0 +1,209 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace MainShell.DeviceMaintance.Model
{
public static class CylinderDefinitionLoader
{
private const string CylinderConfigFileName = "CylinderDefinitions.csv";
public static IReadOnlyList<CylinderDefinition> LoadDefinitions()
{
var definitions = new List<CylinderDefinition>();
var path = ResolveConfigPath();
if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
{
return definitions;
}
var lines = File.ReadAllLines(path, Encoding.UTF8);
foreach (var raw in lines)
{
if (string.IsNullOrWhiteSpace(raw))
{
continue;
}
var line = raw.Trim();
if (line.StartsWith("#") || line.StartsWith("Name", StringComparison.OrdinalIgnoreCase))
{
continue;
}
var cols = line.Split(',');
if (cols.Length < 7)
{
continue;
}
var extendOutputPoints = ParsePointReferences(cols[3]);
if (extendOutputPoints.Count == 0)
{
continue;
}
var retractOutputPoints = ParsePointReferences(cols[4]);
var hasConditionColumns = cols.Length >= 10;
var extendConditionIndex = hasConditionColumns ? 7 : -1;
var retractConditionIndex = hasConditionColumns ? 8 : -1;
var descriptionIndex = hasConditionColumns ? 9 : 7;
definitions.Add(new CylinderDefinition
{
Name = cols[0].Trim(),
Module = cols[1].Trim(),
ControlType = ParseControlType(cols[2]),
ExtendOutputPoints = extendOutputPoints,
RetractOutputPoints = retractOutputPoints,
ExtendedFeedbackPoints = ParsePointReferences(cols[5]),
RetractedFeedbackPoints = ParsePointReferences(cols[6]),
ExtendConditions = extendConditionIndex >= 0 ? ParseConditions(cols[extendConditionIndex]) : new List<CylinderActionConditionDefinition>(),
RetractConditions = retractConditionIndex >= 0 ? ParseConditions(cols[retractConditionIndex]) : new List<CylinderActionConditionDefinition>(),
Description = cols.Length > descriptionIndex ? string.Join(",", cols.Skip(descriptionIndex)).Trim() : string.Empty
});
}
return definitions;
}
private static CylinderControlType ParseControlType(string raw)
{
if (string.Equals(raw, "DualOutput", StringComparison.OrdinalIgnoreCase) ||
string.Equals(raw, "Dual", StringComparison.OrdinalIgnoreCase))
{
return CylinderControlType.DualOutput;
}
if (string.Equals(raw, "MultiOutput", StringComparison.OrdinalIgnoreCase) ||
string.Equals(raw, "Multi", StringComparison.OrdinalIgnoreCase))
{
return CylinderControlType.MultiOutput;
}
return CylinderControlType.SingleOutput;
}
private static List<string> ParsePointReferences(string raw)
{
return (raw ?? string.Empty)
.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Select(x => x.Trim())
.Where(x => !string.IsNullOrWhiteSpace(x))
.ToList();
}
private static List<CylinderActionConditionDefinition> ParseConditions(string raw)
{
return (raw ?? string.Empty)
.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.Select(ParseCondition)
.Where(x => x != null)
.ToList();
}
private static CylinderActionConditionDefinition ParseCondition(string raw)
{
if (string.IsNullOrWhiteSpace(raw))
{
return null;
}
var parts = raw.Split(new[] { ':' }, 3);
if (parts.Length < 2)
{
return null;
}
var pointReference = parts[1].Trim();
if (string.IsNullOrWhiteSpace(pointReference))
{
return null;
}
CylinderConditionType conditionType;
switch ((parts[0] ?? string.Empty).Trim().ToUpperInvariant())
{
case "POINTON":
case "ON":
conditionType = CylinderConditionType.PointOn;
break;
case "POINTOFF":
case "OFF":
conditionType = CylinderConditionType.PointOff;
break;
default:
return null;
}
return new CylinderActionConditionDefinition
{
ConditionType = conditionType,
PointReference = pointReference,
Message = parts.Length > 2 ? parts[2].Trim() : string.Empty
};
}
private static string ResolveConfigPath()
{
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
var localPath = Path.Combine(baseDir, "Configuration", CylinderConfigFileName);
var sourcePath = ResolveRootConfigPath(baseDir);
if (TrySyncConfigToLocal(sourcePath, localPath))
{
return localPath;
}
return File.Exists(localPath) ? localPath : sourcePath;
}
private static string ResolveRootConfigPath(string baseDir)
{
var current = new DirectoryInfo(baseDir);
while (current != null)
{
var rootConfigDir = Path.Combine(current.FullName, "Configuration");
if (Directory.Exists(rootConfigDir) && Directory.Exists(Path.Combine(current.FullName, "MainShell")))
{
var path = Path.Combine(rootConfigDir, CylinderConfigFileName);
if (File.Exists(path))
{
return path;
}
}
current = current.Parent;
}
return null;
}
private static bool TrySyncConfigToLocal(string sourcePath, string localPath)
{
if (string.IsNullOrWhiteSpace(sourcePath) || !File.Exists(sourcePath))
{
return false;
}
if (!string.Equals(Path.GetFullPath(sourcePath), Path.GetFullPath(localPath), StringComparison.OrdinalIgnoreCase))
{
var localDir = Path.GetDirectoryName(localPath);
if (!string.IsNullOrWhiteSpace(localDir))
{
Directory.CreateDirectory(localDir);
}
if (!File.Exists(localPath) || File.GetLastWriteTimeUtc(localPath) < File.GetLastWriteTimeUtc(sourcePath))
{
File.Copy(sourcePath, localPath, true);
}
}
return true;
}
}
}

View File

@@ -0,0 +1,19 @@
using Stylet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MainShell.DeviceMaintance.Model
{
public class DeviceMaintanceBaseViewModel : Screen
{
public event Action<bool> UiStateChangedEvent = null;
protected void OnUiStateChanged(bool uiStateChanged)
{
UiStateChangedEvent?.Invoke(uiStateChanged);
}
}
}

View File

@@ -0,0 +1,97 @@
using MainShell.Filewritable;
using Newtonsoft.Json;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace MainShell.DeviceMaintance.Model
{
public class LaserCompensationSetting : MXJM.FileWritable.JsonFileWritableBase, INotifyPropertyChanged
{
private string _axisName = "Axis_Stage_Y3";
public string AxisName
{
get { return _axisName; }
set { SetAndNotify(ref _axisName, value); }
}
private double _startPos;
public double StartPos
{
get { return _startPos; }
set { SetAndNotify(ref _startPos, value); }
}
private double _steps = 1.0d;
public double Steps
{
get { return _steps; }
set { SetAndNotify(ref _steps, value); }
}
private int _stepsCount = 5;
public int StepsCount
{
get { return _stepsCount; }
set { SetAndNotify(ref _stepsCount, value); }
}
private double _jumpPos = 1.0d;
public double JumpPos
{
get { return _jumpPos; }
set { SetAndNotify(ref _jumpPos, value); }
}
private int _workCount = 1;
public int WorkCount
{
get { return _workCount; }
set { SetAndNotify(ref _workCount, value); }
}
private double _speed = 5.0d;
public double Speed
{
get { return _speed; }
set { SetAndNotify(ref _speed, value); }
}
private double _dwellTime = 0.5d;
public double DwellTime
{
get { return _dwellTime; }
set { SetAndNotify(ref _dwellTime, value); }
}
[JsonIgnore]
public override string Dir => Paths.CalibSettingPath;
[JsonIgnore]
public override string FileName => "LaserCompensationSetting.json";
public event PropertyChangedEventHandler PropertyChanged;
public void LoadFromFile()
{
Read();
}
public void SaveToFile()
{
Write();
}
protected bool SetAndNotify<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(field, value))
{
return false;
}
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
return true;
}
}
}

View File

@@ -0,0 +1,64 @@
using MainShell.Common;
using MainShell.Filewritable;
using MaxwellControl.Controls;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MainShell.DeviceMaintance.Model
{
public enum MaintanceType
{
= 1,
= 2,
= 3,
}
public class MaintanceRecord
{
/// <summary>
/// 设备编号
/// </summary>
public string DeviceId { get; set; }
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get; set; }
/// <summary>
/// 维护时间
/// </summary>
public DateTime MaintanceTime { get; set; }
/// <summary>
/// 维护内容
/// </summary>
public MaintanceType MaintanceType { get; set; }
public void WriteToFile(string info)
{
try
{
if (!Directory.Exists(Paths.MaintanceRecordDir))
{
Directory.CreateDirectory(Paths.MaintanceRecordDir);
}
string filePath = Path.Combine(Paths.MaintanceRecordDir, $"{MaintanceType}_MaintanceRecord.txt");
using (var writer = new System.IO.StreamWriter(filePath, true))
{
if (!File.Exists(filePath))
{
writer.WriteLine("设备ID,日期,信息");
}
writer.WriteLine($"{DeviceId},{DateTime.Now}: {info}");
writer.Flush();
}
}
catch (Exception ex)
{
MessageBox.Show($"写入文件失败: {ex.Message}");
}
}
}
}

View File

@@ -0,0 +1,757 @@
using MwFramework.Controls.UIControl;
using MwFramework.ManagerService;
using Stylet;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MainShell.DeviceMaintance.Model
{
[Export(typeof(IParameter))]
public class NeedleCalibrationSetting : ParameterBase
{
public NeedleZCalibrationItem NeedleZCalibrationItem { get; set; } = new NeedleZCalibrationItem();
public NeedleXYCalibrationItem NeedleXYCalibrationItem { get; set; } = new NeedleXYCalibrationItem();
public NeedleXYCalibrationItemNew NeedleXYCalibrationItemNew { get; set; } = new NeedleXYCalibrationItemNew();
public override void Copy(IParameter source)
{
NeedleCalibrationSetting setting = source as NeedleCalibrationSetting;
if (setting != null)
{
ReflectionExtension.Copy<NeedleZCalibrationItem>(NeedleZCalibrationItem, setting.NeedleZCalibrationItem);
ReflectionExtension.Copy<NeedleXYCalibrationItem>(NeedleXYCalibrationItem, setting.NeedleXYCalibrationItem);
ReflectionExtension.Copy<NeedleXYCalibrationItemNew>(NeedleXYCalibrationItemNew, setting.NeedleXYCalibrationItemNew);
}
}
}
public class NeedleZCalibrationItem : PropertyChangedBase, IParameterItem
{
private double _supportPinPositionX;
[WatchValue("针尖对准对刀仪X1位置")]
public double SupportPinPositionX
{
get { return _supportPinPositionX; }
set { if (_supportPinPositionX != value) { _supportPinPositionX = value; OnPropertyChanged(nameof(SupportPinPositionX)); } }
}
private double _supportPinPositionY;
[WatchValue("针尖对准对刀仪Y1位置")]
public double SupportPinPositionY
{
get { return _supportPinPositionY; }
set { if (_supportPinPositionY != value) { _supportPinPositionY = value; OnPropertyChanged(nameof(SupportPinPositionY)); } }
}
private double _knifeOffset;
[WatchValue("对刀仪偏差")]
/// <summary>
/// 对刀仪偏差
/// </summary>
public double KnifeOffset
{
get { return _knifeOffset; }
set { if (_knifeOffset != value) { _knifeOffset = value; OnPropertyChanged(nameof(KnifeOffset)); } }
}
private double _cZHeight = -0.725;
[WatchValue("SZ高度")]
public double CZHeight
{
get { return _cZHeight; }
set { if (_cZHeight != value) { _cZHeight = value; OnPropertyChanged(nameof(CZHeight)); } }
}
private double _stageHeight;
[WatchValue("载台高度")]
public double StageHeight
{
get { return _stageHeight; }
set { if (_stageHeight != value) { _stageHeight = value; OnPropertyChanged(nameof(StageHeight)); } }
}
private double _gantry2AvoidPositionX = 10;
[WatchValue("对刀时龙门X2的避让位置")]
public double Gantry2AvoidPositionX
{
get { return _gantry2AvoidPositionX; }
set { if (_gantry2AvoidPositionX != value) { _gantry2AvoidPositionX = value; OnPropertyChanged(nameof(Gantry2AvoidPositionX)); } }
}
private double _gantry2AvoidPositionY = 200;
[WatchValue("对刀时龙门Y2的避让位置")]
public double Gantry2AvoidPositionY
{
get { return _gantry2AvoidPositionY; }
set { if (_gantry2AvoidPositionY != value) { _gantry2AvoidPositionY = value; OnPropertyChanged(nameof(Gantry2AvoidPositionY)); } }
}
private double _z1StartPosition;
[WatchValue("Z1开始位置")]
public double Z1StartPosition
{
get { return _z1StartPosition; }
set { if (_z1StartPosition != value) { _z1StartPosition = value; OnPropertyChanged(nameof(Z1StartPosition)); } }
}
private double _z1Speed;
[WatchValue("Z1速度")]
public double Z1Speed
{
get { return _z1Speed; }
set { if (_z1Speed != value) { _z1Speed = value; OnPropertyChanged(nameof(Z1Speed)); } }
}
private double _z1DropMaxPosition;
[WatchValue("Z1下降距离")]
public double Z1DropMaxPosition
{
get { return _z1DropMaxPosition; }
set { if (_z1DropMaxPosition != value) { _z1DropMaxPosition = value; OnPropertyChanged(nameof(Z1DropMaxPosition)); } }
}
private int _needleTouchCount = 1;
[WatchValue("对刀次数")]
public int NeedleTouchCount
{
get { return _needleTouchCount; }
set { if (_needleTouchCount != value) { _needleTouchCount = value; OnPropertyChanged(nameof(NeedleTouchCount)); } }
}
private double _needleTouchHeight = 14;
/// <summary>
/// Z1接触对刀仪高度
/// </summary>
[WatchValue("Z1接触对刀仪高度")]
public double NeedleTouchHeight
{
get { return _needleTouchHeight; }
set { if (_needleTouchHeight != value) { _needleTouchHeight = value; OnPropertyChanged(nameof(NeedleTouchHeight)); } }
}
private double _needleTouchHeightBase;
/// <summary>
/// 基准值
/// </summary>
[WatchValue("基准值")]
public double NeedleTouchHeightBase
{
get { return _needleTouchHeightBase; }
set { if (_needleTouchHeightBase != value) { _needleTouchHeightBase = value; OnPropertyChanged(nameof(NeedleTouchHeightBase)); } }
}
private double _currentNeedleTouchHeight;
[WatchValue("当前使用对刀高度")]
/// <summary>
/// 当前使用对刀高度
/// </summary>
public double CurrentNeedleTouchHeight
{
get { return _currentNeedleTouchHeight; }
set { if (_currentNeedleTouchHeight != value) { _currentNeedleTouchHeight = value; OnPropertyChanged(nameof(CurrentNeedleTouchHeight)); } }
}
private double _needleTouchOffset;
[WatchValue("对刀与基准偏差")]
/// <summary>
/// 对刀与基准偏差
/// </summary>
public double NeedleTouchOffset
{
get { return _needleTouchOffset; }
set { if (_needleTouchOffset != value) { _needleTouchOffset = value; OnPropertyChanged(nameof(NeedleTouchOffset)); } }
}
private double _needleTouchHeightAve;
[WatchValue("Z1对刀平均高度")]
/// <summary>
/// Z1对刀平均高度
/// </summary>
public double NeedleTouchHeightAve
{
get { return _needleTouchHeightAve; }
set { if (_needleTouchHeightAve != value) { _needleTouchHeightAve = value; OnPropertyChanged(nameof(NeedleTouchHeightAve)); } }
}
private ObservableCollection<NeedleTouchRecord> _needleTouchRecords = new ObservableCollection<NeedleTouchRecord>();
public ObservableCollection<NeedleTouchRecord> NeedleTouchRecords
{
get { return _needleTouchRecords; }
set
{
_needleTouchRecords = value;
OnPropertyChanged(nameof(NeedleTouchRecords));
}
}
private double _laserToNeedleOffset = 0;
public double LaserToNeedleOffset
{
get { return _laserToNeedleOffset; }
set { if (_laserToNeedleOffset != value) { _laserToNeedleOffset = value; OnPropertyChanged(nameof(LaserToNeedleOffset)); } }
}
private double _needleCameraHeightOffset;
public double NeedleCameraHeightOffset
{
get { return _needleCameraHeightOffset; }
set { if (_needleCameraHeightOffset != value) { _needleCameraHeightOffset = value; OnPropertyChanged(nameof(NeedleCameraHeightOffset)); } }
}
public IParameterItem Clone()
{
NeedleZCalibrationItem clone = new NeedleZCalibrationItem();
clone.CurrentNeedleTouchHeight = _needleCameraHeightOffset;
clone.CZHeight = CZHeight;
clone.Gantry2AvoidPositionX = Gantry2AvoidPositionX;
clone.Gantry2AvoidPositionY = Gantry2AvoidPositionY;
clone.LaserToNeedleOffset = LaserToNeedleOffset;
clone.NeedleCameraHeightOffset = NeedleCameraHeightOffset;
clone.NeedleTouchCount = NeedleTouchCount;
clone.NeedleTouchHeight = NeedleTouchHeight;
clone.NeedleTouchHeightAve = NeedleTouchHeightAve;
clone.NeedleTouchHeightBase = NeedleTouchHeightBase;
clone.NeedleTouchOffset = NeedleTouchOffset;
clone.StageHeight = StageHeight;
clone.SupportPinPositionX = SupportPinPositionX;
clone.SupportPinPositionY = SupportPinPositionY;
clone.Z1DropMaxPosition = Z1DropMaxPosition;
clone.Z1Speed = Z1Speed;
clone.Z1StartPosition = Z1StartPosition;
if (this.NeedleTouchRecords != null)
{
foreach (var item in this.NeedleTouchRecords)
{
clone.NeedleTouchRecords.Add(item.Clone() as NeedleTouchRecord);
}
}
return clone;
}
}
public class NeedleXYCalibrationItem : PropertyChangedBase, IParameterItem
{
private double _needleX;
[WatchValue("设置—刺晶头X")]
public double NeedleX
{
get { return _needleX; }
set { if (_needleX != value) { _needleX = value; OnPropertyChanged(nameof(NeedleX)); } }
}
private double _needleY;
[WatchValue("设置—刺晶头Y")]
public double NeedleY
{
get { return _needleY; }
set { if (_needleY != value) { _needleY = value; OnPropertyChanged(nameof(NeedleY)); } }
}
private double _cameraX;
[WatchValue("设置—相机X")]
public double CameraX
{
get { return _cameraX; }
set { if (_cameraX != value) { _cameraX = value; OnPropertyChanged(nameof(CameraX)); } }
}
private double _cameraY;
[WatchValue("设置—相机Y")]
public double CameraY
{
get { return _cameraY; }
set { if (_cameraY != value) { _cameraY = value; OnPropertyChanged(nameof(CameraY)); } }
}
private double _needleZ1 = 0.0;
[WatchValue("设置—刺晶头Z1")]
public double NeedleZ1
{
get { return _needleZ1; }
set { if (_needleZ1 != value) { _needleZ1 = value; OnPropertyChanged(nameof(NeedleZ1)); } }
}
private double _offsetX;
[WatchValue("X方向偏差")]
public double OffsetX
{
get { return _offsetX; }
set { if (_offsetX != value) { _offsetX = value; OnPropertyChanged(nameof(OffsetX)); } }
}
private double _offsetY;
[WatchValue("Y方向偏差")]
public double OffsetY
{
get { return _offsetY; }
set { if (_offsetY != value) { _offsetY = value; OnPropertyChanged(nameof(OffsetY)); } }
}
private double _initialOffsetX;
/// <summary>
/// 针和相机之间的X初始偏差不加补偿
/// </summary>
[WatchValue("X方向初始偏差")]
public double InitialOffsetX
{
get { return _initialOffsetX; }
set { if (_initialOffsetX != value) { _initialOffsetX = value; OnPropertyChanged(nameof(InitialOffsetX)); } }
}
private double _initialOffsetY;
/// <summary>
/// 针和相机之间的Y初始偏差不加补偿
/// </summary>
[WatchValue("Y方向初始偏差")]
public double InitialOffsetY
{
get { return _initialOffsetY; }
set { if (_initialOffsetY != value) { _initialOffsetY = value; OnPropertyChanged(nameof(InitialOffsetY)); } }
}
private double _compensateX;
/// <summary>
/// 针和相机之间的X方向偏差补偿
/// </summary>
[WatchValue("X方向补偿")]
public double CompensateX
{
get { return _compensateX; }
set { if (_compensateX != value) { _compensateX = value; OnPropertyChanged(nameof(CompensateX)); } }
}
private double _compensateY;
/// <summary>
/// 针和相机之间的Y方向偏差补偿
/// </summary>
[WatchValue("Y方向补偿")]
public double CompensateY
{
get { return _compensateY; }
set { if (_compensateY != value) { _compensateY = value; OnPropertyChanged(nameof(CompensateY)); } }
}
private double _offsetXMax;
[WatchValue("偏差限制—X偏差最大值")]
public double OffsetXMax
{
get { return _offsetXMax; }
set { if (_offsetXMax != value) { _offsetXMax = value; OnPropertyChanged(nameof(OffsetXMax)); } }
}
private double _offsetXMin;
[WatchValue("偏差限制—X偏差最小值")]
public double OffsetXMin
{
get { return _offsetXMin; }
set { if (_offsetXMin != value) { _offsetXMin = value; OnPropertyChanged(nameof(OffsetXMin)); } }
}
private double _offsetYMax;
[WatchValue("偏差限制—Y偏差最大值")]
public double OffsetYMax
{
get { return _offsetYMax; }
set { if (_offsetYMax != value) { _offsetYMax = value; OnPropertyChanged(nameof(OffsetYMax)); } }
}
private double _offsetYMin;
[WatchValue("偏差限制—Y偏差最小值")]
public double OffsetYMin
{
get { return _offsetYMin; }
set { if (_offsetYMin != value) { _offsetYMin = value; OnPropertyChanged(nameof(OffsetYMin)); } }
}
/// <summary>
/// 扎铜箔时龙门X2避让位置
/// </summary>
private double _x2AvoidPosition;
[WatchValue("扎铜箔时龙门X2避让位置")]
public double X2AvoidPosition
{
get { return _x2AvoidPosition; }
set { if (_x2AvoidPosition != value) { _x2AvoidPosition = value; OnPropertyChanged(nameof(X2AvoidPosition)); } }
}
/// <summary>
/// 扎铜箔时龙门Y2避让位置
/// </summary>
private double _y2AvoidPosition;
[WatchValue("扎铜箔时龙门Y2避让位置")]
public double Y2AvoidPosition
{
get { return _y2AvoidPosition; }
set { if (_y2AvoidPosition != value) { _y2AvoidPosition = value; OnPropertyChanged(nameof(Y2AvoidPosition)); } }
}
/// <summary>
/// 扎铜箔时Stage的位置
/// </summary>
private double _stagePosition;
[WatchValue("扎铜箔时Stage的位置")]
public double StagePosition
{
get { return _stagePosition; }
set { if (_stagePosition != value) { _stagePosition = value; OnPropertyChanged(nameof(StagePosition)); } }
}
public IParameterItem Clone()
{
NeedleXYCalibrationItem clone = new NeedleXYCalibrationItem();
clone.NeedleX = this.NeedleX;
clone.NeedleY = this.NeedleY;
clone.CameraX = this.CameraY;
clone.CameraY = this.CameraY;
clone.OffsetX = this.OffsetX;
clone.OffsetY = this.OffsetY;
clone.OffsetXMax = this.OffsetXMax;
clone.OffsetXMin = this.OffsetXMin;
clone.OffsetYMax = this.OffsetYMax;
clone.OffsetYMin = this.OffsetYMin;
return this.MemberwiseClone() as IParameterItem;
}
}
public class NeedleXYCalibrationItemNew : PropertyChangedBase, IParameterItem
{
//private VisionParData _needleVisionParData;
//public VisionParData NeedleVisionParData
//{
// get { return _needleVisionParData ?? new VisionParData() { Exposure = 2000 }; }
// set { SetAndNotify(ref _needleVisionParData, value); }
//}
private double _x1Calib;
/// <summary>
/// 相机标定位X1
/// </summary>
[WatchValue("相机标定位X1")]
public double X1Calib
{
get { return _x1Calib; }
set { if (_x1Calib != value) { _x1Calib = value; OnPropertyChanged(nameof(X1Calib)); } }
}
private double _x1MechanicalOffset = 0.0;
/// <summary>
/// 机械X1Offset
/// </summary>
[WatchValue("机械X1Offset")]
public double X1MechanicalOffset
{
get { return _x1MechanicalOffset; }
set { if (_x1MechanicalOffset != value) { _x1MechanicalOffset = value; OnPropertyChanged(nameof(X1MechanicalOffset)); } }
}
private double _wSCalibX2;
/// <summary>
/// 方片标定位X2
/// </summary>
[WatchValue("方片标定位X2")]
public double WSCalibX2
{
get { return _wSCalibX2; }
set { if (_wSCalibX2 != value) { _wSCalibX2 = value; OnPropertyChanged(nameof(WSCalibX2)); } }
}
private double _wSCalibY2;
/// <summary>
/// 方片标定位Y2
/// </summary>
[WatchValue("方片标定位Y2")]
public double WSCalibY2
{
get { return _wSCalibY2; }
set { if (_wSCalibY2 != value) { _wSCalibY2 = value; OnPropertyChanged(nameof(WSCalibY2)); } }
}
private double _needleX1;
[WatchValue("刺晶头X1")]
public double NeedleX1
{
get { return _needleX1; }
set { if (_needleX1 != value) { _needleX1 = value; OnPropertyChanged(nameof(NeedleX1)); } }
}
private double _needleZ1 = 0.0;
[WatchValue("刺晶头Z1")]
public double NeedleZ1
{
get { return _needleZ1; }
set { if (_needleZ1 != value) { _needleZ1 = value; OnPropertyChanged(nameof(NeedleZ1)); } }
}
private int _z1WorkTime = 0;
/// <summary>
/// Z1保持下扎时长
/// </summary>
[WatchValue("Z1保持下扎时长")]
public int Z1WorkTime
{
get { return _z1WorkTime; }
set { if (_z1WorkTime != value) { _z1WorkTime = value; OnPropertyChanged(nameof(Z1WorkTime)); } }
}
private double _offsetX;
/// <summary>
/// 针和相机之间的X初始偏差不加补偿
/// </summary>
[WatchValue("X方向偏差")]
public double OffsetX
{
get { return _offsetX; }
set { if (_offsetX != value) { _offsetX = value; OnPropertyChanged(nameof(OffsetX)); } }
}
private double _offsetY;
/// <summary>
/// 针和相机之间的Y初始偏差不加补偿
/// </summary>
[WatchValue("Y方向偏差")]
public double OffsetY
{
get { return _offsetY; }
set { if (_offsetY != value) { _offsetY = value; OnPropertyChanged(nameof(OffsetY)); } }
}
private double _compensateX;
/// <summary>
/// 针和相机之间的X方向偏差补偿
/// </summary>
[WatchValue("X方向补偿")]
public double CompensateX
{
get { return _compensateX; }
set { if (_compensateX != value) { _compensateX = value; OnPropertyChanged(nameof(CompensateX)); } }
}
private double _compensateY;
/// <summary>
/// 针和相机之间的Y方向偏差补偿
/// </summary>
[WatchValue("Y方向补偿")]
public double CompensateY
{
get { return _compensateY; }
set { if (_compensateY != value) { _compensateY = value; OnPropertyChanged(nameof(CompensateY)); } }
}
private double _offsetXMax;
[WatchValue("偏差限制—X偏差最大值")]
public double OffsetXMax
{
get { return _offsetXMax; }
set { if (_offsetXMax != value) { _offsetXMax = value; OnPropertyChanged(nameof(OffsetXMax)); } }
}
private double _offsetXMin;
[WatchValue("偏差限制—X偏差最小值")]
public double OffsetXMin
{
get { return _offsetXMin; }
set { if (_offsetXMin != value) { _offsetXMin = value; OnPropertyChanged(nameof(OffsetXMin)); } }
}
private double _offsetYMax;
[WatchValue("偏差限制—Y偏差最大值")]
public double OffsetYMax
{
get { return _offsetYMax; }
set { if (_offsetYMax != value) { _offsetYMax = value; OnPropertyChanged(nameof(OffsetYMax)); } }
}
private double _offsetYMin;
[WatchValue("偏差限制—Y偏差最小值")]
public double OffsetYMin
{
get { return _offsetYMin; }
set { if (_offsetYMin != value) { _offsetYMin = value; OnPropertyChanged(nameof(OffsetYMin)); } }
}
private double _wSApproachX2;
/// <summary>
/// 方片逼近位X2
/// </summary>
[WatchValue("方片逼近位X2")]
public double WSApproachX2
{
get { return _wSApproachX2; }
set { if (_wSApproachX2 != value) { _wSApproachX2 = value; OnPropertyChanged(nameof(WSApproachX2)); } }
}
private double _wSApproachY2;
/// <summary>
/// 方片逼近位Y2
/// </summary>
[WatchValue("方片逼近位Y2")]
public double WSApproachY2
{
get { return _wSApproachY2; }
set { if (_wSApproachY2 != value) { _wSApproachY2 = value; OnPropertyChanged(nameof(WSApproachY2)); } }
}
private double _stampThreRadius;
/// <summary>
/// 针印理论半径
/// </summary>
[WatchValue("针印理论半径")]
public double StampThreRadius
{
get { return _stampThreRadius; }
set { if (_stampThreRadius != value) { _stampThreRadius = value; OnPropertyChanged(nameof(StampThreRadius)); } }
}
private double _stampThreErrorRange;
/// <summary>
/// 针印误差范围
/// </summary>
[WatchValue("针印误差范围")]
public double StampThreErrorRange
{
get { return _stampThreErrorRange; }
set { if (_stampThreErrorRange != value) { _stampThreErrorRange = value; OnPropertyChanged(nameof(StampThreErrorRange)); } }
}
private double _stampMinCircularity;
/// <summary>
/// 针印最小圆度
/// </summary>
[WatchValue("针印最小圆度")]
public double StampMinCircularity
{
get { return _stampMinCircularity; }
set { if (_stampMinCircularity != value) { _stampMinCircularity = value; OnPropertyChanged(nameof(StampMinCircularity)); } }
}
private double _stampPolarity;
/// <summary>
/// 针印颜色,0黑1白
/// </summary>
[WatchValue("针印理论半径")]
public double StampPolarity
{
get { return _stampPolarity; }
set { if (_stampPolarity != value) { _stampPolarity = value; OnPropertyChanged(nameof(StampPolarity)); } }
}
private bool _isBlack = false;
public bool IsBlack
{
get
{
return _isBlack;
}
set
{
_isBlack = value;
StampPolarityUpdate();
OnPropertyChanged(nameof(IsBlack));
}
}
public void StampPolarityUpdate()
{
if (IsBlack)
{
StampPolarity = 0;
}
else
{
StampPolarity = 1;
}
}
public IParameterItem Clone()
{
NeedleXYCalibrationItemNew clone = new NeedleXYCalibrationItemNew();
clone.NeedleX1 = this.NeedleX1;
clone.NeedleZ1 = this.NeedleZ1;
clone.WSApproachX2 = this.WSApproachX2;
clone.WSApproachY2 = this.WSApproachY2;
clone.Z1WorkTime = Z1WorkTime;
clone.X1MechanicalOffset = X1MechanicalOffset;
clone.X1Calib = X1Calib;
clone.WSCalibX2 = WSCalibX2;
clone.WSCalibY2 = WSCalibY2;
clone.CompensateX = CompensateX;
clone.CompensateY = CompensateY;
clone.OffsetX = this.OffsetX;
clone.OffsetY = this.OffsetY;
clone.OffsetXMax = this.OffsetXMax;
clone.OffsetXMin = this.OffsetXMin;
clone.OffsetYMax = this.OffsetYMax;
clone.OffsetYMin = this.OffsetYMin;
clone.IsBlack = this.IsBlack;
clone.StampMinCircularity = this.StampMinCircularity;
clone.StampPolarity = this.StampPolarity;
clone.StampThreErrorRange = this.StampThreErrorRange;
clone.StampThreRadius = this.StampThreRadius;
//clone.NeedleVisionParData.Exposure = this.NeedleVisionParData.Exposure;
//clone.NeedleVisionParData.Gain = this.NeedleVisionParData.Gain;
//clone.NeedleVisionParData.LightSourceBack = this.NeedleVisionParData.LightSourceBack;
//clone.NeedleVisionParData.LightSourcePointBlue = this.NeedleVisionParData.LightSourcePointBlue;
//clone.NeedleVisionParData.LightSourcePointRed = this.NeedleVisionParData.LightSourcePointRed;
//clone.NeedleVisionParData.LightSourceRingBlue = this.NeedleVisionParData.LightSourceRingBlue;
//clone.NeedleVisionParData.LightSourceRingRed = this.NeedleVisionParData.LightSourceRingRed;
//clone.NeedleVisionParData.Z2 = this.NeedleVisionParData.Z2;
return this.MemberwiseClone() as IParameterItem;
}
}
public class NeedleTouchRecord : PropertyChangedBase, IParameterItem
{
private int _CurrentCount;
/// <summary>
/// 当前次数
/// </summary>
public int CurrentCount
{
get { return _CurrentCount; }
set
{ SetAndNotify(ref _CurrentCount, value); }
}
private double _Height;
/// <summary>
/// 高度
/// </summary>
public double Height
{
get { return _Height; }
set
{ SetAndNotify(ref _Height, value); }
}
public NeedleTouchRecord()
{
}
public NeedleTouchRecord(int count, double height)
{
CurrentCount = count;
Height = height;
}
public IParameterItem Clone()
{
return this.MemberwiseClone() as IParameterItem;
}
}
}

View File

@@ -0,0 +1,104 @@
using MainShell.Models;
using MwFramework.ManagerService;
using Stylet;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MainShell.DeviceMaintance.Model
{
[Export(typeof(IParameter))]
public class NeedlePrintCalibrateSetting : ParameterBase
{
public NeedlePrintCalibrateParameter NeedlePrintCalibrateParameter { get; set; } = new NeedlePrintCalibrateParameter();
public NeedlePrintCalibrateSetting() { }
public override void Copy(IParameter source)
{
if (source is NeedlePrintCalibrateSetting setting)
{
ReflectionExtension.Copy(NeedlePrintCalibrateParameter, setting.NeedlePrintCalibrateParameter);
}
}
}
public class NeedlePrintCalibrateParameter : PropertyChangedBase, IParameterItem
{
private MPoint _startPoint = new MPoint();
public MPoint StartPoint
{
get { return _startPoint; }
set { SetAndNotify(ref _startPoint, value); }
}
private MPoint _endPoint = new MPoint();
public MPoint EndPoint
{
get { return _endPoint; }
set { SetAndNotify(ref _endPoint, value); }
}
private MPoint _avoidancePoint = new MPoint();
public MPoint AvoidancePoint
{
get { return _avoidancePoint; }
set { SetAndNotify(ref _avoidancePoint, value); }
}
private double _z1WorkHeight;
public double Z1WorkHeight
{
get { return _z1WorkHeight; }
set { SetAndNotify(ref _z1WorkHeight, value); }
}
private double _z2WorkHeight;
public double Z2WorkHeight
{
get { return _z2WorkHeight; }
set { SetAndNotify(ref _z2WorkHeight, value); }
}
private double _xPitch;
public double Xpitch
{
get { return _xPitch; }
set { SetAndNotify(ref _xPitch, value); }
}
private double _yPitch;
public double Ypitch
{
get { return _yPitch; }
set { SetAndNotify(ref _yPitch, value); }
}
private int _usedNum;
public int UsedNum
{
get { return _usedNum; }
set { SetAndNotify(ref _usedNum, value); }
}
private int _sleepTime = 1000;
public int SleepTime
{
get { return _sleepTime; }
set { SetAndNotify(ref _sleepTime, value); }
}
public IParameterItem Clone()
{
return MemberwiseClone() as NeedlePrintCalibrateParameter;
}
}
}