添加 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,108 @@
using MainShell.Common.Extension;
using MainShell.DeviceMaintance.Model;
using MainShell.Hardware;
using MainShell.Parameter;
using MainShell.Recipe.Models;
using MaxwellFramework.Core.Interfaces;
using MwFramework.Device;
using MwFramework.ManagerService;
using MXJM.Parameter.Maintance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MainShell.HeightMeasure.Model
{
public class DiastimeterHeightMeasure : IHeightMeasure
{
public HeightBaseItem HeightBaseItem { get; set; }
public DiaHeightItem DiaHeightItem { get; set; }
public CapHeightItem CapHeightItem { get; set; }
private HardwareManager _hardwareManager;
private readonly IDiastimeter _diastimeter;
private readonly IParamList _paramlist;
public DiastimeterHeightMeasure(GlobalParameterContext globalParam, HardwareManager hardwareManager, IParameterManager paramList)
{
_hardwareManager = hardwareManager;
_diastimeter = _hardwareManager.Diastimeter;
_paramlist = paramList as IParamList;
DiaHeightItem = globalParam.HeightBaseSetting.DiaHeightItem;
HeightBaseItem = globalParam.HeightBaseSetting.HeightBaseItem;
}
public double GetDistance()
{
_hardwareManager.Diastimeter.GetLastSamples(out double Distance);
if (double.IsNaN(Distance))
{
throw new Exception("测距仪反馈数据为NAN请检查测距仪状态");
}
return Distance;
}
public void CalculateHeight()
{
double glassHeightAverage = HeightBaseItem.GlassHeightMeasureList.Average(m => m.Height);
double glassZAverage = HeightBaseItem.GlassHeightMeasureList.Average(m => m.Z);
double waferHeightAverage = HeightBaseItem.WaferHeightMeasureList.Average(m => m.Height);
double waferZAverage = HeightBaseItem.WaferHeightMeasureList.Average(m => m.Z);
HeightBaseItem.GlassZHeight = glassZAverage + glassHeightAverage;
HeightBaseItem.WaferZHeight = waferZAverage + waferHeightAverage;
if (_paramlist == null)
{
throw new InvalidOperationException("IParamList 未初始化,无法计算测高标定参数。");
}
var needleZCalibrationItem = _paramlist.GetParameter<NeedleCalibrationSetting>().NeedleZCalibrationItem;
DiaHeightItem.NeedleTouchHeight = needleZCalibrationItem.NeedleTouchHeight;
DiaHeightItem.KnifeOffset = needleZCalibrationItem.KnifeOffset;
//Gap2
HeightBaseItem.FromDieToPadDistance = GetGap2(HeightBaseItem.DieThickness, HeightBaseItem.WaferFilmThickness);
//激光与刺晶头偏差
DiaHeightItem.LaserToZ1Offset = DiaHeightItem.NeedleTouchHeight -
(DiaHeightItem.CaliZHeightLaserReading + DiaHeightItem.CaliZHeightPositionZ) + DiaHeightItem.KnifeOffset;
//刺晶头接触到方片高度
HeightBaseItem.NeedleTouchWaferZHeight = HeightBaseItem.WaferZHeight + DiaHeightItem.LaserToZ1Offset;
}
public double GetGap2(double dieThickness, double waferFilmThickness)
{
double height = 0.0;
height = HeightBaseItem.WaferZHeight - HeightBaseItem.GlassZHeight
- dieThickness - waferFilmThickness;
return Math.Abs(height);
}
//public double GetZStageTheoryWorkHeight(double glassThickness, double carrierThickness, WaferRecipeContentItem currentWaferRecipe = null)
//{
// double calibWaferToStageDis = HeightBaseItem.WaferFilmThickness + HeightBaseItem.DieThickness +
// HeightBaseItem.FromDieToPadDistance + HeightBaseItem.GlassThickness + HeightBaseItem.CarrierThickness;
// double actualWaferToStageDis = currentWaferRecipe.WaferFilmThickness + currentWaferRecipe.DieThickness +
// currentWaferRecipe.FromDieToPadDistance + glassThickness + carrierThickness;
// double height = HeightBaseItem.StageDatumHeight + calibWaferToStageDis - actualWaferToStageDis;
// return height;
//}
//public double GetZ1WorkHeight(BondingCraftRecipeContentItem currentWaferRecipe = null)
//{
// double height = 0.0;
// //2.针尖的工作高度
// height = HeightBaseItem.NeedleTouchWaferZHeight + currentWaferRecipe.Gap1;
// return height;
//}
}
}

View File

@@ -0,0 +1,441 @@
using MwFramework.Controls.UIControl;
using MwFramework.ManagerService;
using Stylet;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MaxwellFramework.Core.Attributes;
using System.ComponentModel.Composition;
namespace MXJM.Parameter.Maintance
{
[Export(typeof(IParameter))]
public class HeightBaseSetting : ParameterBase
{
public HeightBaseItem HeightBaseItem { get; set; } = new HeightBaseItem();
public DiaHeightItem DiaHeightItem { get; set; } = new DiaHeightItem();
public CapHeightItem CapHeightItem { get; set; } = new CapHeightItem();
public override void Copy(IParameter source)
{
HeightBaseSetting setting = source as HeightBaseSetting;
if (setting != null)
{
ReflectionExtension.Copy<HeightBaseItem>(HeightBaseItem, setting.HeightBaseItem);
ReflectionExtension.Copy<DiaHeightItem>(DiaHeightItem, setting.DiaHeightItem);
ReflectionExtension.Copy<CapHeightItem>(CapHeightItem, setting.CapHeightItem);
}
}
}
public class HeightBaseItem : PropertyChangedBase, IParameterItem
{
private double _measureWaferHeightX11;
/// <summary>
/// 测量方片时X11坐标
/// </summary>
[WatchValue("测量方片时X11坐标")]
public double MeasureWaferHeightX11
{
get { return _measureWaferHeightX11; }
set { if (_measureWaferHeightX11 != value) { _measureWaferHeightX11 = value; OnPropertyChanged(nameof(MeasureWaferHeightX11)); } }
}
private double _measureWaferHeightY11;
/// <summary>
/// 测量方片时Y11坐标
/// </summary>
[WatchValue("测量方片时Y11坐标")]
public double MeasureWaferHeightY11
{
get { return _measureWaferHeightY11; }
set { if (_measureWaferHeightY11 != value) { _measureWaferHeightY11 = value; OnPropertyChanged(nameof(MeasureWaferHeightY11)); } }
}
//龙门2避让位
private double _avoidancePositionX21;
[WatchValue("龙门X21的避让位")]
public double AvoidancePositionX21
{
get { return _avoidancePositionX21; }
set { if (_avoidancePositionX21 != value) { _avoidancePositionX21 = value; OnPropertyChanged(nameof(AvoidancePositionX21)); } }
}
private double _avoidancePositionY21;
[WatchValue("龙门Y21的避让位")]
public double AvoidancePositionY21
{
get { return _avoidancePositionY21; }
set { if (_avoidancePositionY21 != value) { _avoidancePositionY21 = value; OnPropertyChanged(nameof(AvoidancePositionY21)); } }
}
private double _stageDatumHeight;
[WatchValue("载台基准高度")]
/// <summary>
/// 载台基准高度
/// </summary>
public double StageDatumHeight
{
get { return _stageDatumHeight; }
set { if (_stageDatumHeight != value) { _stageDatumHeight = value; OnPropertyChanged(nameof(StageDatumHeight)); } }
}
private double _needleTouchWaferZHeight;
[WatchValue("刺晶头接触到Wafer高度")]
/// <summary>
/// 刺晶头接触到Wafer高度
/// </summary>
public double NeedleTouchWaferZHeight
{
get { return _needleTouchWaferZHeight; }
set { if (_needleTouchWaferZHeight != value) { _needleTouchWaferZHeight = value; OnPropertyChanged(nameof(NeedleTouchWaferZHeight)); } }
}
private double _cZCalibrationHeight;
/// <summary>
/// CZ标定高度
/// </summary>
[WatchValue("CZ标定高度")]
public double CZCalibrationHeight
{
get { return _cZCalibrationHeight; }
set { if (_cZCalibrationHeight != value) { _cZCalibrationHeight = value; OnPropertyChanged(nameof(CZCalibrationHeight)); } }
}
private double _waferFilmThickness;
/// <summary>
/// 方片膜厚度
/// </summary>
[WatchValue("方片膜厚度")]
public double WaferFilmThickness
{
get { return _waferFilmThickness; }
set { if (_waferFilmThickness != value) { _waferFilmThickness = value; OnPropertyChanged(nameof(WaferFilmThickness)); } }
}
private double _dieThickness;
/// <summary>
/// 晶粒厚度
/// </summary>
[WatchValue("晶粒厚度")]
public double DieThickness
{
get { return _dieThickness; }
set { if (_dieThickness != value) { _dieThickness = value; OnPropertyChanged(nameof(DieThickness)); } }
}
private double _glassThickness = 0.5;
[WatchValue("Glass厚度")]
/// <summary>
/// //Glass厚度
/// </summary>
public double GlassThickness
{
get { return _glassThickness; }
set { if (_glassThickness != value) { _glassThickness = value; OnPropertyChanged(nameof(GlassThickness)); } }
}
private double _carrierThickness = 0.5;
[WatchValue("Carrier厚度")]
/// <summary>
/// Carrier厚度
/// </summary>
public double CarrierThickness
{
get { return _carrierThickness; }
set { if (_carrierThickness != value) { _carrierThickness = value; OnPropertyChanged(nameof(CarrierThickness)); } }
}
private double _fromDieToPadDistance;
/// <summary>
/// Gap2:Die到Pad的距离
/// </summary>
[WatchValue("Gap2:Die到Pad的距离")]
public double FromDieToPadDistance
{
get { return _fromDieToPadDistance; }
set { if (_fromDieToPadDistance != value) { _fromDieToPadDistance = value; OnPropertyChanged(nameof(FromDieToPadDistance)); } }
}
private double _gap1;
/// <summary>
/// Gap1
/// </summary>
[WatchValue("Gap1")]
public double Gap1
{
get { return _gap1; }
set { if (_gap1 != value) { _gap1 = value; OnPropertyChanged(nameof(Gap1)); } }
}
private double _glassZHeight;
/// <summary>
/// 测Glass时Z高度
/// </summary>
[WatchValue("测Glass时Z高度")]
public double GlassZHeight
{
get { return _glassZHeight; }
set { if (_glassZHeight != value) { _glassZHeight = value; OnPropertyChanged(nameof(GlassZHeight)); } }
}
private double _waferZHeight;
/// <summary>
/// 测Wafer时Z高度
/// </summary>
[WatchValue("测Wafer时Z高度")]
public double WaferZHeight
{
get { return _waferZHeight; }
set { if (_waferZHeight != value) { _waferZHeight = value; OnPropertyChanged(nameof(WaferZHeight)); } }
}
private ObservableCollection<TeachPoint> _glassHeightMeasureList = new ObservableCollection<TeachPoint>();
public ObservableCollection<TeachPoint> GlassHeightMeasureList
{
get { return _glassHeightMeasureList; }
set { if (_glassHeightMeasureList != value) { _glassHeightMeasureList = value; OnPropertyChanged(nameof(GlassHeightMeasureList)); } }
}
private ObservableCollection<TeachPoint> _waferHeightMeasureList = new ObservableCollection<TeachPoint>();
public ObservableCollection<TeachPoint> WaferHeightMeasureList
{
get { return _waferHeightMeasureList; }
set { if (_waferHeightMeasureList != value) { _waferHeightMeasureList = value; OnPropertyChanged(nameof(WaferHeightMeasureList)); } }
}
public IParameterItem Clone()
{
HeightBaseItem clone = new HeightBaseItem();
if (this.GlassHeightMeasureList != null && this.GlassHeightMeasureList.Count != 0)
{
foreach (var item in this.GlassHeightMeasureList)
{
clone.GlassHeightMeasureList.Add(item.Clone() as TeachPoint);
}
}
if (this.WaferHeightMeasureList != null && this.WaferHeightMeasureList.Count != 0)
{
foreach (var item in this.WaferHeightMeasureList)
{
clone.WaferHeightMeasureList.Add(item.Clone() as TeachPoint);
}
}
clone.NeedleTouchWaferZHeight = this.NeedleTouchWaferZHeight;
return clone;
}
}
public class DiaHeightItem : PropertyChangedBase, IParameterItem
{
public IParameterItem Clone()
{
return this.MemberwiseClone() as IParameterItem;
//DiaHeightItem clone = new DiaHeightItem();
//clone.CaliZHeightPositionX = this.CaliZHeightPositionX;
//clone.CaliZHeightPositionY = this.CaliZHeightPositionY;
//clone.CaliZHeightPositionZ = this.CaliZHeightPositionZ;
//clone.GlassZHeight = this.GlassZHeight;
//clone.WaferZHeight = this.WaferZHeight;
//return clone;
}
private double _needleTouchHeight;
/// <summary>
/// 标定时对刀高度
/// </summary>
[WatchValue("标定时对刀高度")]
public double NeedleTouchHeight
{
get { return _needleTouchHeight; }
set { if (_needleTouchHeight != value) { _needleTouchHeight = value; OnPropertyChanged(nameof(NeedleTouchHeight)); } }
}
private double _knifeOffset;
[WatchValue("对刀偏差值")]
/// <summary>
/// 对刀偏差值
/// </summary>
public double KnifeOffset
{
get { return _knifeOffset; }
set { if (_knifeOffset != value) { _knifeOffset = value; OnPropertyChanged(nameof(KnifeOffset)); } }
}
private double _laserToZ1Offset;
[WatchValue("激光与刺晶头偏差")]
/// <summary>
/// 激光与刺晶头偏差
/// </summary>
public double LaserToZ1Offset
{
get { return _laserToZ1Offset; }
set { if (_laserToZ1Offset != value) { _laserToZ1Offset = value; OnPropertyChanged(nameof(LaserToZ1Offset)); } }
}
private double _caliZHeightPositionX;
[WatchValue("激光打到对刀仪上X坐标")]
/// <summary>
/// 激光打到对刀仪上X坐标
/// </summary>
public double CaliZHeightPositionX
{
get { return _caliZHeightPositionX; }
set { if (_caliZHeightPositionX != value) { _caliZHeightPositionX = value; OnPropertyChanged(nameof(CaliZHeightPositionX)); } }
}
private double _caliZHeightPositionY;
[WatchValue("激光打到对刀仪上Y坐标")]
/// <summary>
/// 激光打到对刀仪上Y坐标
/// </summary>
public double CaliZHeightPositionY
{
get { return _caliZHeightPositionY; }
set { if (_caliZHeightPositionY != value) { _caliZHeightPositionY = value; OnPropertyChanged(nameof(CaliZHeightPositionY)); } }
}
public double CaliZHeight;
private double _caliZHeightPositionZ;
[WatchValue("激光打到对刀仪上Z坐标")]
/// <summary>
/// 激光打到对刀仪上Z坐标
/// </summary>
public double CaliZHeightPositionZ
{
get { return _caliZHeightPositionZ; }
set { if (_caliZHeightPositionZ != value) { _caliZHeightPositionZ = value; OnPropertyChanged(nameof(CaliZHeightPositionZ)); } }
}
private double _caliZHeightLaserReading;
[WatchValue("激光打到对刀仪上时激光读数")]
/// <summary>
/// 激光打到对刀仪上时激光读数
/// </summary>
public double CaliZHeightLaserReading
{
get { return _caliZHeightLaserReading; }
set { if (_caliZHeightLaserReading != value) { _caliZHeightLaserReading = value; OnPropertyChanged(nameof(CaliZHeightLaserReading)); } }
}
}
public class CapHeightItem : PropertyChangedBase, IParameterItem
{
public IParameterItem Clone()
{
return this.MemberwiseClone() as IParameterItem;
}
private double _capInitialValue;
/// <summary>
/// 电容初始值
/// </summary>
[WatchValue("电容初始值")]
public double CapInitialValue
{
get { return _capInitialValue; }
set { if (_capInitialValue != value) { _capInitialValue = value; OnPropertyChanged(nameof(CapInitialValue)); } }
}
}
public class TeachPoint : PropertyChangedBase, IParameterItem
{
private int _id = 1;
public int Id
{
get { return _id; }
set { if (_id != value) { _id = value; OnPropertyChanged(nameof(Id)); } }
}
private double _x = 0.0;
public double X
{
get { return _x; }
set { if (_x != value) { _x = value; OnPropertyChanged(nameof(X)); } }
}
private double _y = 0.0;
public double Y
{
get { return _y; }
set { if (_y != value) { _y = value; OnPropertyChanged(nameof(Y)); } }
}
private double _z = 5.0;
public double Z
{
get { return _z; }
set { if (_z != value) { _z = value; OnPropertyChanged(nameof(Z)); } }
}
private double _laserZ = 0.0;
public double LaserZ
{
get { return _laserZ; }
set { if (_laserZ != value) { _laserZ = value; OnPropertyChanged(nameof(LaserZ)); } }
}
private double _height = 0.0;
public double Height
{
get { return _height; }
set { if (_height != value) { _height = value; OnPropertyChanged(nameof(Height)); } }
}
private double _laserAndZHeightSum = 0.0;
public double LaserAndZHeightSum
{
get { return _laserAndZHeightSum; }
set { if (_laserAndZHeightSum != value) { _laserAndZHeightSum = value; OnPropertyChanged(nameof(LaserAndZHeightSum)); } }
}
private int _row = 1;
public int Row
{
get { return _row; }
set { SetAndNotify(ref _row, value); }
}
private int _column = 1;
public int Column
{
get { return _column; }
set { SetAndNotify(ref _column, value); }
}
private int _regionIndex;
public int RegionIndex
{
get { return _regionIndex; }
set { SetAndNotify(ref _regionIndex, value); }
}
public TeachPoint(double x, double y)
{
_x = x;
_y = y;
}
public TeachPoint()
{
}
IParameterItem IParameterItem.Clone()
{
return this.MemberwiseClone() as IParameterItem;
}
}
}

View File

@@ -0,0 +1,29 @@
using MwFramework.ManagerService;
using MXJM.Parameter.Maintance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MainShell.HeightMeasure.Model
{
public interface IHeightMeasure
{
HeightBaseItem HeightBaseItem { get; set; }
CapHeightItem CapHeightItem { get; set; }
DiaHeightItem DiaHeightItem { get; set; }
double GetDistance();
void CalculateHeight();
double GetGap2(double dieThickness, double waferFilmThickness);
//double GetZStageTheoryWorkHeight(double glassThickness, double carrierThickness, WaferRecipeContentItem currentWaferRecipe = null);
//double GetZ1WorkHeight(BondingCraftRecipeContentItem currentWaferRecipe = null);
}
}

View File

@@ -0,0 +1,83 @@
using MainShell.Hardware;
using MainShell.Motion;
using MainShell.HeightMeasure.Model;
using MaxwellFramework.Core.Attributes;
using MXJM.Parameter.Maintance;
using System;
namespace MainShell.HeightMeasure.Service
{
[Singleton]
public class HeightMeasureMotionService
{
private readonly HardwareManager _hardware;
private readonly SafeAxisMotion _safeAxisMotion;
private readonly StagePlatformMotionService _stagePlatformMotionService;
public HeightMeasureMotionService(HardwareManager hardware, SafeAxisMotion safeAxisMotion, StagePlatformMotionService stagePlatformMotionService)
{
_hardware = hardware ?? throw new ArgumentNullException(nameof(hardware));
_safeAxisMotion = safeAxisMotion ?? throw new ArgumentNullException(nameof(safeAxisMotion));
_stagePlatformMotionService = stagePlatformMotionService ?? throw new ArgumentNullException(nameof(stagePlatformMotionService));
}
public void MoveCalibrationAndStagePlatformHeights(double czCalibrationHeight, double stageDatumHeight)
{
_safeAxisMotion.MoveAbs(AxisName.Axis_SZ, czCalibrationHeight);
_stagePlatformMotionService.MoveFlat(stageDatumHeight);
}
public void MoveWsAvoidance(double xPosition, double yPosition)
{
_safeAxisMotion.SafeMove(
MotionMoveRequest.ForAxis(GetRequiredAxis(_hardware.Axis_X2, nameof(_hardware.Axis_X2)), xPosition),
MotionMoveRequest.ForAxis(GetRequiredAxis(_hardware.Axis_Y2, nameof(_hardware.Axis_Y2)), yPosition));
}
public void MovePhsAndNeedle(double xPosition, double yPosition, double zPosition)
{
_safeAxisMotion.SafeMove(
MotionMoveRequest.ForAxis(GetRequiredAxis(_hardware.Axis_X1, nameof(_hardware.Axis_X1)), xPosition),
MotionMoveRequest.ForAxis(GetRequiredAxis(_hardware.Axis_Y1, nameof(_hardware.Axis_Y1)), yPosition));
_safeAxisMotion.MoveAbs(GetRequiredAxis(_hardware.Axis_Z1, nameof(_hardware.Axis_Z1)), zPosition);
}
public void MoveGlassMeasurePoint(TeachPoint point)
{
if (point == null)
{
throw new ArgumentNullException(nameof(point));
}
MovePhsAndNeedle(point.X, point.Y, point.Z);
}
public void MoveWaferMeasurePoint(TeachPoint point)
{
if (point == null)
{
throw new ArgumentNullException(nameof(point));
}
MoveWsAvoidance(point.X, point.Y);
_safeAxisMotion.MoveAbs(GetRequiredAxis(_hardware.Axis_Z1, nameof(_hardware.Axis_Z1)), point.Z);
}
public void MoveWaferMeasurePose(double xPosition, double yPosition)
{
_safeAxisMotion.SafeMove(
MotionMoveRequest.ForAxis(GetRequiredAxis(_hardware.Axis_X1, nameof(_hardware.Axis_X1)), xPosition),
MotionMoveRequest.ForAxis(GetRequiredAxis(_hardware.Axis_Y1, nameof(_hardware.Axis_Y1)), yPosition));
}
private static MwFramework.Device.IAxis GetRequiredAxis(MwFramework.Device.IAxis axis, string axisPropertyName)
{
if (axis == null)
{
throw new InvalidOperationException(string.Format("Axis '{0}' is not available.", axisPropertyName));
}
return axis;
}
}
}

View File

@@ -0,0 +1,353 @@
<UserControl x:Class="MainShell.HeightMeasure.View.HeightView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MainShell.HeightMeasure.View"
xmlns:mw="http://www.maxwell-gp.com/"
xmlns:mwControls="http://www.maxwell-gp.com/"
xmlns:customControl="clr-namespace:MainShell.Resources.CustomControl"
mwControls:ParameterAttach.DelayAcceptValue ="{Binding ParameterHelper}"
mc:Ignorable="d"
d:DesignHeight="850" d:DesignWidth="1200">
<UserControl.Resources>
<Style TargetType="GroupBox" BasedOn="{StaticResource GroupStepControl}"/>
<Style TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
<Setter Property="HorizontalContentAlignment" Value="Right"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Height" Value="35"/>
<Setter Property="Width" Value="80"/>
</Style>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}" >
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="82"/>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="2*"/>
<RowDefinition Height="90"/>
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<GroupBox Header="【第一步】填写测高标定数据" Grid.Row="0">
<GroupBox.Content>
<StackPanel Orientation="Vertical" >
<StackPanel Orientation="Horizontal">
<Label Content="{DynamicResource DieThickness}"/>
<mw:NumberBox Value="{Binding HeightBaseItem.DieThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" Grid.Column="1" HorizontalAlignment="Left" Width="110" Height="35" />
<Label Content="{DynamicResource WaferThickness}" />
<mw:NumberBox Value="{Binding HeightBaseItem.WaferFilmThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" Grid.Column="1" HorizontalAlignment="Left" Width="110" Height="35" />
<Label Content="{DynamicResource SubstrateThickness}"/>
<mw:NumberBox Value="{Binding HeightBaseItem.GlassThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" Grid.Column="1" HorizontalAlignment="Right" Width="110" Height="35" />
<Label Content="{DynamicResource CarrierThickness}"/>
<mw:NumberBox Value="{Binding HeightBaseItem.CarrierThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" Grid.Column="1" HorizontalAlignment="Right" Width="110" Height="35" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<customControl:AxisMoveControl LableContent1="{DynamicResource CZCalibrationHeight}"
Value1="{Binding HeightBaseItem.CZCalibrationHeight}"
LableContent2="{DynamicResource StageDatumHeight}"
NumberBoxWidth="110"
Value2="{Binding HeightBaseItem.StageDatumHeight}"
MoveCommand="{mw:Action btnMoveCZAndStagePlatform}"/>
</StackPanel>
</StackPanel>
</GroupBox.Content>
</GroupBox>
<GroupBox Header="【第二步】基础位置示教" Grid.Row="1">
<GroupBox.Content>
<StackPanel Orientation="Vertical" >
<StackPanel Orientation="Horizontal">
<Label Content="{DynamicResource WSAvoidancePosition}" Width="120"/>
<mw:NumberBox DecimalPlaces="4" Value="{Binding HeightBaseItem.AvoidancePositionX21}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
<mw:NumberBox DecimalPlaces="4" Value="{Binding HeightBaseItem.AvoidancePositionY21}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
<Button Content="{DynamicResource ReadPosition}" Tag="龙门2避让位—读取当前位置" Click="{mw:Action btnReadAvoidancePosition}" VerticalAlignment="Center" HorizontalAlignment="Left" Width="110"/>
<Button Content="{DynamicResource MovePosition}" Tag="龙门2避让位—移动到位" Click="{mw:Action btnMoveAvoidancePosition}" VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="{DynamicResource LaserToCaliStage}" Grid.Column="0" Width="120"/>
<mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightPositionX}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
<mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightPositionY}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
<mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightPositionZ}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
<Button Content="{DynamicResource ReadPosition}" Tag="激光打到对刀仪测量点—读取当前位置" Click="{mw:Action btnReadLaserToKnifePosition}" VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
<Button Content="{DynamicResource MovePosition}" Tag="激光打到对刀仪测量点—移动到位" Click="{mw:Action btnMoveLaserToKnifePosition}" VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
<Button Content="{DynamicResource HeightMeasure}" Tag="激光打到对刀仪测量点—高度测量" Click="{mw:Action btnHeightMeasure}" VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
<mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightLaserReading}" IsReadOnly="True" Background="LightGray" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Right" Margin="5" Width="110" Height="35" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="激光实时值" Width="120"/>
<mw:NumberBox Value="{Binding CurrentDiastimeterDistance}" DecimalPlaces="4" IsReadOnly="True" Background="LightGray" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
<Button Content="开始采集" Click="{mw:Action StartDiastimeterPolling}" Width="110"/>
<Button Content="停止采集" Click="{mw:Action StopDiastimeterPolling}" Width="110"/>
<TextBlock Text="{Binding DiastimeterStatus}" VerticalAlignment="Center" Margin="8,0,0,0" Foreground="{StaticResource PrimaryTextBrush}"/>
</StackPanel>
</StackPanel>
</GroupBox.Content>
</GroupBox>
<GroupBox Header="【第三步】测量点位示教" Grid.Row="2">
<UniformGrid Grid.Row="2" Columns="2">
<GroupBox Header="{DynamicResource SubstrateHeightMeasure}" Margin="3,3,3,3" Style="{StaticResource GroupBoxSecondary}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<DataGrid Name="dataGridGlassPoint" Grid.Row="0" ItemsSource="{Binding HeightBaseItem.GlassHeightMeasureList}" SelectedItem="{Binding SelectedGlassPoint}" Margin="3" AutoGenerateColumns="false" SelectionMode="Single"
CanUserSortColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="{DynamicResource Id}" Binding="{Binding Id}" Width="2*" IsReadOnly="true"/>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource X}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Minimum="-100000" Maximum="100000"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource Y}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Minimum="-100000" Maximum="100000"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource Z}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Minimum="-100000" Maximum="100000"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource Height}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockHeight" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockHeight" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<UniformGrid Grid.Row="1" Columns="6">
<Button Content="{DynamicResource Add}" Tag="产品高度测量—添加" Click="{mw:Action BtnGlassAdd}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource Delete}" Tag="产品高度测量—删除" Click="{mw:Action BtnGlassDelete}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource ReadPosition}" Tag="产品高度测量—读取当前位置" Click="{mw:Action btnSetPositionGlass}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource MovePosition}" Tag="产品高度测量—移动到位" Click="{mw:Action btnMovePositionGlass}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource HeightMeasure}" Tag="产品高度测量—高度测量" Click="{mw:Action btnTestGlassHeightGlass}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
</UniformGrid>
</Grid>
</GroupBox>
<GroupBox Header="{DynamicResource WaferHeightMeasure}" Margin="0,3,3,3" Style="{StaticResource GroupBoxSecondary}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<customControl:AxisMoveControl LableContent1="X1:" LableWidth="35"
Value1="{Binding HeightBaseItem.MeasureWaferHeightX11}"
LableContent2="Y1:"
Value2="{Binding HeightBaseItem.MeasureWaferHeightY11}"
MoveCommand="{mw:Action btnMoveGantry1}"/>
</StackPanel>
<DataGrid Name="dataGridWaferPoint" Grid.Row="1" ItemsSource="{Binding HeightBaseItem.WaferHeightMeasureList}" SelectedItem="{Binding SelectedWaferPoint}" Margin="3" AutoGenerateColumns="false" SelectionMode="Single"
CanUserSortColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="{DynamicResource Id}" Binding="{Binding Id}" Width="2*" IsReadOnly="true"/>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource X}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Minimum="-100000" Maximum="100000"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource Y}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Minimum="-100000" Maximum="100000"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource Z}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Minimum="-100000" Maximum="100000"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="3*">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource Height}"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
<Setter TargetName="txtBlockHeight" Property="TextBlock.Foreground" Value="White"/>
</DataTrigger>
</DataTemplate.Triggers>
<TextBlock Name="txtBlockHeight" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228" mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="True"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<UniformGrid Grid.Row="2" Columns="6">
<Button Content="{DynamicResource Add }" Tag="方片高度测量—添加" Click="{mw:Action BtnWaferAdd}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource Delete}" Tag="方片高度测量—删除" Click="{mw:Action BtnWaferDelete}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource ReadPosition}" Tag="方片高度测量—读取当前位置" Click="{mw:Action btnSetPositionWafer}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource MovePosition}" Tag="方片高度测量—移动到位" Click="{mw:Action btnMovePositionWafer}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Button Content="{DynamicResource HeightMeasure}" Tag="方片高度测量—高度测量" Click="{mw:Action btnTestWaferHeight}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
</UniformGrid>
</Grid>
</GroupBox>
</UniformGrid>
</GroupBox>
<GroupBox Header="【第四步】测高结果计算" Grid.Row="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0" IsEnabled="False" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<Label Content="{DynamicResource StageBaseHeight}" Width="100"/>
<mw:NumberBox DecimalPlaces="4" Value="{Binding HeightBaseItem.StageDatumHeight}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Margin="5" Maximum="1000" HorizontalAlignment="Left" Width="100" Height="35" />
<Label Content="{DynamicResource Gap2}" Margin="5" Width="100" />
<mw:NumberBox DecimalPlaces="4" Value="{Binding HeightBaseItem.FromDieToPadDistance}" mw:NumericKeypadAttach.IsEnabled="True" Margin="5" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Width="100" Height="35" />
<Label Content="{DynamicResource NeedleTouchWaferZHeight}" Width="150"/>
<mw:NumberBox Value="{Binding HeightBaseItem.NeedleTouchWaferZHeight}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="100" Height="35" />
<Label Content="{DynamicResource LaserToZ1Offset}" Width="110"/>
<mw:NumberBox Value="{Binding DiaHeightItem.LaserToZ1Offset}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="100" Height="35" />
</StackPanel>
</StackPanel>
<Button Content="{DynamicResource Calculate}" Tag="计算" Grid.Column="1" Click="{mw:Action BtnCalculateHeight}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</GroupBox>
<Border
Grid.Row="4"
Background="{StaticResource SecondaryLightBrush}"
BorderBrush="{StaticResource BorderBrush}"
BorderThickness="2,0,2,2">
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="{DynamicResource Save}" Tag="保存" Click="{mw:Action btnSave}" Height="35" Grid.Row="1" Grid.Column="4" Margin="5" IsEnabled="{Binding Motion.IsFinish}"/>
</StackPanel>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainShell.HeightMeasure.View
{
/// <summary>
/// HeightView.xaml 的交互逻辑
/// </summary>
public partial class HeightView : UserControl
{
public HeightView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,581 @@
using MainShell.Common;
using MainShell.EventArgsFolder;
using MainShell.Hardware;
using MainShell.HeightMeasure.Model;
using MainShell.HeightMeasure.Service;
using MainShell.Log;
using MainShell.Parameter;
using MaxwellControl.Tools;
using MaxwellFramework.Core.Interfaces;
using MwFramework.Controls.Components;
using MwFramework.Controls.UIControl;
using MwFramework.Device;
using MwFramework.ManagerService;
using MXJM.Parameter.Maintance;
using Stylet;
using StyletIoC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using MessageBox = MaxwellControl.Controls.MessageBox;
namespace MainShell.HeightMeasure.ViewModel
{
public class HeightViewModel : Screen, IPage, IHandle<NeedleCalibrationHeightTestEventArgs>, IHandle<DiastimeterSampleChangedEventArgs>
{
public string Name { get; set; } = "HeightMaint";
private ParameterHelper _parameterHelper = new ParameterHelper();
public ParameterHelper ParameterHelper
{
get
{
return _parameterHelper;
}
set
{
_parameterHelper = value;
OnPropertyChanged(nameof(ParameterHelper));
}
}
//private bool _isHaveDia;
///// <summary>
///// 是否有激光测距仪
///// </summary>
//public bool IsHaveDia
//{
// get
// {
// return _isHaveDia;
// }
// set
// {
// _isHaveDia = value;
// OnPropertyChanged(nameof(IsHaveDia));
// }
//}
private IHeightMeasure _heightMeasureManager;
public IHeightMeasure HeightMeasureManager
{
get
{
return _heightMeasureManager;
}
set
{
_heightMeasureManager = value;
OnPropertyChanged(nameof(Parameter));
}
}
private HeightBaseSetting _heightTestSetting = new HeightBaseSetting();
public HeightBaseSetting HeightTestSetting
{
get
{
return _heightTestSetting;
}
set
{
_heightTestSetting = value;
OnPropertyChanged(nameof(Parameter));
}
}
private HeightBaseItem _heightBaseItem = new HeightBaseItem();
public HeightBaseItem HeightBaseItem
{
get
{
return _heightBaseItem;
}
set
{
_heightBaseItem = value;
OnPropertyChanged(nameof(HeightBaseItem));
}
}
//private CapHeightItem _capHeightItem = new CapHeightItem();
//public CapHeightItem CapHeightItem
//{
// get
// {
// return _capHeightItem;
// }
// set
// {
// _capHeightItem = value;
// OnPropertyChanged(nameof(CapHeightItem));
// }
//}
private DiaHeightItem _diaHeightItem = new DiaHeightItem();
public DiaHeightItem DiaHeightItem
{
get
{
return _diaHeightItem;
}
set
{
_diaHeightItem = value;
OnPropertyChanged(nameof(DiaHeightItem));
}
}
private TeachPoint _selectedGlassPoint = null;
public TeachPoint SelectedGlassPoint
{
get
{
return _selectedGlassPoint;
}
set
{
_selectedGlassPoint = value;
OnPropertyChanged(nameof(SelectedGlassPoint));
}
}
private TeachPoint _selectedWaferPoint = null;
public TeachPoint SelectedWaferPoint
{
get
{
return _selectedWaferPoint;
}
set
{
_selectedWaferPoint = value;
OnPropertyChanged(nameof(SelectedWaferPoint));
}
}
//private GlassCraftParItem _glassCraftParItem;
//public GlassCraftParItem GlassCraftParItem
//{
// get { return _glassCraftParItem; }
// set { _glassCraftParItem = value; OnPropertyChanged(nameof(GlassCraftParItem)); }
//}
//private GlassRecipeContentItem _glassRecipeContentItem;
//public GlassRecipeContentItem GlassRecipeContentItem
//{
// get { return _glassRecipeContentItem; }
// set { if (_glassRecipeContentItem != value) { _glassRecipeContentItem = value; OnPropertyChanged(nameof(GlassRecipeContentItem)); } }
//}
private HardwareManager _hardware;
private readonly GlobalParameterContext _gp;
private readonly HeightMeasureMotionService _heightMeasureMotionService;
private readonly IEventAggregator _eventAggregator;
private readonly DiastimeterPollingService _diastimeterPollingService;
private double _currentDiastimeterDistance;
private string _diastimeterStatus;
private bool _isDiastimeterPolling;
public HeightViewModel(GlobalParameterContext gp, HardwareManager hardware, IParameterManager parameterManager, IHeightMeasure heightMeasure, HeightMeasureMotionService heightMeasureMotionService, IEventAggregator eventAggregator, DiastimeterPollingService diastimeterPollingService)
{
_gp = gp;
_hardware = hardware;
_heightMeasureMotionService = heightMeasureMotionService ?? throw new ArgumentNullException(nameof(heightMeasureMotionService));
_eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));
_diastimeterPollingService = diastimeterPollingService ?? throw new ArgumentNullException(nameof(diastimeterPollingService));
var _paramlist = parameterManager as IParamList;
HeightTestSetting = _paramlist.GetParameter<HeightBaseSetting>();
HeightBaseItem = HeightTestSetting.HeightBaseItem;
DiaHeightItem = HeightTestSetting.DiaHeightItem;
HeightMeasureManager = heightMeasure;
DiastimeterStatus = "未启动";
}
public double CurrentDiastimeterDistance
{
get
{
return _currentDiastimeterDistance;
}
set
{
_currentDiastimeterDistance = value;
OnPropertyChanged(nameof(CurrentDiastimeterDistance));
}
}
public string DiastimeterStatus
{
get
{
return _diastimeterStatus;
}
set
{
_diastimeterStatus = value;
OnPropertyChanged(nameof(DiastimeterStatus));
}
}
public bool IsDiastimeterPolling
{
get
{
return _isDiastimeterPolling;
}
set
{
_isDiastimeterPolling = value;
OnPropertyChanged(nameof(IsDiastimeterPolling));
}
}
protected override void OnInitialActivate()
{
base.OnInitialActivate();
_eventAggregator.Subscribe(this);
}
protected override void OnDeactivate()
{
_eventAggregator.Unsubscribe(this);
_diastimeterPollingService.Stop();
IsDiastimeterPolling = false;
base.OnDeactivate();
}
public void StartDiastimeterPolling()
{
try
{
_diastimeterPollingService.Start();
IsDiastimeterPolling = true;
DiastimeterStatus = "采集中";
}
catch (Exception ex)
{
DiastimeterStatus = $"启动失败:{ex.Message}";
LogManager.LogSysError(ex, true);
}
}
public void StopDiastimeterPolling()
{
_diastimeterPollingService.Stop();
IsDiastimeterPolling = false;
DiastimeterStatus = "已停止";
}
#region
public void btnMoveCZAndStagePlatform()
{
if (MessageBox.Show("是否移动到当前位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
_heightMeasureMotionService.MoveCalibrationAndStagePlatformHeights(HeightBaseItem.CZCalibrationHeight, HeightBaseItem.StageDatumHeight);
});
}
}
#endregion
#region
public void btnReadAvoidancePosition()
{
if (MessageBox.Show("是否读取当前位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
HeightBaseItem.AvoidancePositionX21 = _hardware.Axis_X2.State.ActualPos;
HeightBaseItem.AvoidancePositionY21 = _hardware.Axis_Y2.State.ActualPos;
});
}
}
public void btnMoveAvoidancePosition()
{
if (MessageBox.Show("是否移动到当前位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
_heightMeasureMotionService.MoveWsAvoidance(HeightBaseItem.AvoidancePositionX21, HeightBaseItem.AvoidancePositionY21);
});
}
}
public void btnReadLaserToKnifePosition()
{
if (MessageBox.Show("是否读取当前位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
DiaHeightItem.CaliZHeightPositionX = _hardware.Axis_X1.State.ActualPos;
DiaHeightItem.CaliZHeightPositionY = _hardware.Axis_Y1.State.ActualPos;
DiaHeightItem.CaliZHeightPositionZ = _hardware.Axis_Z1.State.ActualPos;
});
}
}
public void btnMoveLaserToKnifePosition()
{
if (MessageBox.Show("是否移动到当前位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
_heightMeasureMotionService.MovePhsAndNeedle(DiaHeightItem.CaliZHeightPositionX, DiaHeightItem.CaliZHeightPositionY, DiaHeightItem.CaliZHeightPositionZ);
});
}
}
public void btnHeightMeasure()
{
CommonUti.RunOnUi(() =>
{
DiaHeightItem.CaliZHeightLaserReading = HeightMeasureManager.GetDistance();
Thread.Sleep(500);
//1107-暂时注释目前没有_equipmentParaSysSetting对象
//SafeAxisMotion.MoveAbs(_hardware.Axis_Z1, _equipmentParaSysSetting.SafeParaSysItem.Z1GeneralSafeHeight, false, true);
});
}
#endregion
#region
public void BtnGlassAdd()
{
TeachPoint teachPoint = new TeachPoint();
teachPoint.Id = HeightBaseItem.GlassHeightMeasureList.Count + 1;
teachPoint.X = 0;
teachPoint.Y = 0;
HeightBaseItem.GlassHeightMeasureList.Add(teachPoint);
}
public void BtnGlassDelete()
{
if (SelectedGlassPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否删除", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
HeightBaseItem.GlassHeightMeasureList.Remove(SelectedGlassPoint);
}
}
public void btnSetPositionGlass()
{
if (SelectedGlassPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否使用当前位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
SelectedGlassPoint.X = _hardware.Axis_X1.State.ActualPos;
SelectedGlassPoint.Y = _hardware.Axis_Y1.State.ActualPos;
SelectedGlassPoint.Z = _hardware.Axis_Z1.State.ActualPos;
SelectedGlassPoint.LaserZ = 0.0;
SelectedGlassPoint.Height = 0;
});
}
}
public void btnMovePositionGlass()
{
if (SelectedGlassPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否移动到选中点", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
_heightMeasureMotionService.MoveGlassMeasurePoint(SelectedGlassPoint);
});
}
}
public void btnTestGlassHeightGlass()
{
if (SelectedGlassPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否测量", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
var Distance = HeightMeasureManager.GetDistance();
SelectedGlassPoint.LaserZ = Distance + SelectedGlassPoint.Z;
SelectedGlassPoint.Height = Distance;
});
}
}
/////////Wafer/////////////
public void BtnWaferAdd()
{
TeachPoint teachPoint = new TeachPoint();
teachPoint.Id = HeightBaseItem.WaferHeightMeasureList.Count + 1;
teachPoint.X = 0;
teachPoint.Y = 0;
HeightBaseItem.WaferHeightMeasureList.Add(teachPoint);
}
public void BtnWaferDelete()
{
if (SelectedWaferPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否删除", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
HeightBaseItem.WaferHeightMeasureList.Remove(SelectedWaferPoint);
}
}
public void btnSetPositionWafer()
{
if (SelectedWaferPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否使用当前位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
SelectedWaferPoint.X = _hardware.Axis_X2.State.ActualPos;
SelectedWaferPoint.Y = _hardware.Axis_Y2.State.ActualPos;
SelectedWaferPoint.Z = _hardware.Axis_Z1.State.ActualPos;
SelectedWaferPoint.LaserZ = 0.0;
SelectedWaferPoint.Height = 0.0;
});
}
}
public void btnMovePositionWafer()
{
if (SelectedWaferPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否移动到选中点", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
_heightMeasureMotionService.MoveWaferMeasurePoint(SelectedWaferPoint);
});
}
}
public void btnTestWaferHeight()
{
if (SelectedWaferPoint == null)
{
MessageBox.Show("请先选中要设置的点");
return;
}
if (MessageBox.Show("是否测量", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
var Distance = HeightMeasureManager.GetDistance();
SelectedWaferPoint.LaserZ = Distance + SelectedWaferPoint.Z;
SelectedWaferPoint.Height = Distance;
});
}
}
public void btnMoveGantry1()
{
if (MessageBox.Show("是否移动到该位置", null, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
_heightMeasureMotionService.MoveWaferMeasurePose(HeightBaseItem.MeasureWaferHeightX11, HeightBaseItem.MeasureWaferHeightY11);
});
}
}
#endregion
#region
public void BtnCalculateHeight()
{
CommonUti.RunOnUi(() =>
{
HeightMeasureManager.CalculateHeight();
});
}
public void btnSave()
{
var a=_gp.HeightBaseSetting.HeightBaseItem;
if (MessageBox.Show("是否保存", null, "确认保存", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
{
CommonUti.RunOnUi(() =>
{
HeightMeasureManager.HeightBaseItem = HeightBaseItem;
//HeightMeasureManager.CapHeightItem = CapHeightItem;
HeightMeasureManager.DiaHeightItem = DiaHeightItem;
HeightTestSetting.Write();
SaveParaLog();
ParameterHelper.RaiseValueAccept();
});
}
}
public void SaveParaLog()
{
LogWatchValueManager.Save(HeightBaseItem, "HeightTestPara_测高参数");
LogWatchValueManager.Save(DiaHeightItem, "HeightTestPara_测高参数");
}
#endregion
public void Handle(NeedleCalibrationHeightTestEventArgs message)
{
throw new NotImplementedException();
}
public void Handle(DiastimeterSampleChangedEventArgs message)
{
if (message == null)
{
return;
}
if (message.IsValid)
{
CurrentDiastimeterDistance = message.Distance;
DiastimeterStatus = $"采样时间:{message.SampleTime:HH:mm:ss.fff}";
return;
}
DiastimeterStatus = string.IsNullOrWhiteSpace(message.Message) ? "采样失败" : message.Message;
}
}
}