using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace SKMC.Api.Product.Material.Tray
{
///
/// 基础物料盘的配置模型
///
public class TrayConfig : BindableBase
{
private long _id;
public long Id
{
get { return _id; }
set { _id = value; }
}
private int _length;
///
/// Tray长度mm
///
public int Length
{
get { return _length; }
set { _length = value; RaisePropertyChanged(); }
}
private int _width;
///
/// Tray宽度mm
///
public int Width
{
get { return _width; }
set { _width = value; RaisePropertyChanged(); }
}
private long _profileId;
///
/// 档案Id
///
public long ProfileId
{
get { return _profileId; }
set { _profileId = value; RaisePropertyChanged(); }
}
private int _row;
///
/// Tray物料行数
///
public int Row
{
get { return _row; }
set { _row = value; RaisePropertyChanged(); }
}
private int _col;
///
/// Tray物料列数
///
public int Col
{
get { return _col; }
set { _col = value; RaisePropertyChanged(); }
}
///
/// Tray的最大物料数(行*列)
///
public int Number { get => _row * _col; }
private double _xStart;
///
/// Tray的首个物料位起始位置的X位置mm
///
public double XStart
{
get { return _xStart; }
set { _xStart = value; RaisePropertyChanged(); }
}
private double _xPitch;
///
/// Tray的X方向(列与列)物料间隔mm
///
public double XPitch
{
get { return _xPitch; }
set { _xPitch = value; RaisePropertyChanged(); }
}
private double _yStart;
///
/// Tray的首个物料位起始位置的Y位置mm
///
public double YStart
{
get { return _yStart; }
set { _yStart = value; RaisePropertyChanged(); }
}
private double _yPitch;
///
/// Tray的Y方向(行与行)物料间隔mm
///
public double YPitch
{
get { return _yPitch; }
set { _yPitch = value; RaisePropertyChanged(); }
}
private double _height;
///
/// Tray的高度
///
public double Height
{
get { return _height; }
set { _height = value; RaisePropertyChanged(); }
}
public double XWidth => XStart + Col * XPitch;
public double YWidth => YStart + Row * YPitch;
private string _linePath;
///
/// Tray的走线路径(物料格序号集字符串, 空格分隔)
///
public string LinePath
{
get { return _linePath; }
set { _linePath = value; RaisePropertyChanged(); }
}
///
/// Tray的走线路径(物料格序号集)
///
public List LinePathList
{
get
{
string linePath = Regex.Replace(_linePath.Trim(), @"\s+", " ", RegexOptions.Multiline);
return linePath.Split(' ').Select(Int32.Parse).ToList();
}
}
///
/// 物料格开关(用于跳过走线与作业)
///
public List SiteSwitchs { get; set; } = new List();
}
}