124 lines
6.0 KiB
C#
124 lines
6.0 KiB
C#
using Aurora.View;
|
|
using AuroraUIComponent.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Collections.Specialized;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using VisionCommon;
|
|
|
|
namespace WeldingCommon.Data
|
|
{
|
|
public enum ExportFormat
|
|
{
|
|
CSV,
|
|
XSXL,
|
|
TEXT,
|
|
JSON,
|
|
}
|
|
public class ActualProcessData : ObservableCollection<ActualProcessUnit>
|
|
{
|
|
private DataTable table = new DataTable("ActualProcessData");
|
|
public ActualProcessData()
|
|
{
|
|
table.Columns.Add("Date", typeof(string));
|
|
table.Columns.Add("Time", typeof(string));
|
|
table.Columns.Add(nameof(ActualProcessUnit.LotID), typeof(string));
|
|
table.Columns.Add(nameof(ActualProcessUnit.CellID), typeof(string));
|
|
table.Columns.Add(nameof(ActualProcessUnit.WeldType), typeof(string));
|
|
table.Columns.Add(nameof(ActualProcessUnit.EncoderCheck), typeof(bool));
|
|
table.Columns.Add(nameof(ActualProcessUnit.StartPointX), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.StartPointY), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.EndPointX), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.EndPointY), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.WeldCondition), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.LaserOnDelay), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.LaserOffDelay), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.JumpDelay), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.MarkDelay), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.PolygonDelay), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.Power), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.JumpSpeed), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.MarkSpeed), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.JumpX), typeof(double));
|
|
table.Columns.Add(nameof(ActualProcessUnit.JumpY), typeof(double));
|
|
}
|
|
|
|
public void CreateFiles(string fullPathNoExt, ExportFormat format = ExportFormat.CSV)
|
|
{
|
|
if (fullPathNoExt == null)
|
|
return;
|
|
|
|
if(format == ExportFormat.CSV)
|
|
CSV_Manager.GetInstance().Save_DataTableToCsv(fullPathNoExt, table);
|
|
|
|
Clear();
|
|
}
|
|
|
|
protected override void InsertItem(int index, ActualProcessUnit item)
|
|
{
|
|
base.InsertItem(index, item);
|
|
table.Rows.Add(item.Date.ToString("yyyy-MM-dd"), item.Date.ToString("HH:mm:ss.fff"), item.LotID, item.CellID, item.WeldType, item.EncoderCheck,
|
|
item.StartPointX, item.StartPointY, item.EndPointX, item.EndPointY,
|
|
item.WeldCondition, item.LaserOnDelay, item.LaserOffDelay, item.JumpDelay, item.MarkDelay,
|
|
item.PolygonDelay, item.Power, item.JumpSpeed, item.MarkSpeed, item.JumpX,
|
|
item.JumpY);
|
|
}
|
|
|
|
protected override void ClearItems()
|
|
{
|
|
base.ClearItems();
|
|
table.Clear();
|
|
}
|
|
|
|
}
|
|
public class ActualProcessUnit : NotifyPropertyChangedBase
|
|
{
|
|
public DateTime Date { get => _Date; set => SetProperty(ref _Date, value); }
|
|
private DateTime _Date;
|
|
public string LotID { get => _LodID; set => SetProperty(ref _LodID, value); }
|
|
private string _LodID;
|
|
|
|
public string CellID { get => _CellID; set => SetProperty(ref _CellID, value); }
|
|
private string _CellID;
|
|
|
|
public string WeldType { get => _WeldType; set => SetProperty(ref _WeldType, value); }
|
|
private string _WeldType;
|
|
public bool EncoderCheck { get => _EncoderCheck; set => SetProperty(ref _EncoderCheck, value); }
|
|
private bool _EncoderCheck;
|
|
public double StartPointX { get => _StartPointX; set => SetProperty(ref _StartPointX, value); }
|
|
private double _StartPointX;
|
|
public double StartPointY { get => _StartPointY; set => SetProperty(ref _StartPointY, value); }
|
|
private double _StartPointY;
|
|
public double EndPointX { get => _EndtPointX; set => SetProperty(ref _EndtPointX, value); }
|
|
private double _EndtPointX;
|
|
public double EndPointY { get => _EndtPointY; set => SetProperty(ref _EndtPointY, value); }
|
|
private double _EndtPointY;
|
|
public double WeldCondition { get => _WeldCondition; set => SetProperty(ref _WeldCondition, value); }
|
|
private double _WeldCondition;
|
|
public double LaserOnDelay { get => _LaserOnDelay; set => SetProperty(ref _LaserOnDelay, value); }
|
|
private double _LaserOnDelay;
|
|
public double LaserOffDelay { get => _LaserOffDelay; set => SetProperty(ref _LaserOffDelay, value); }
|
|
private double _LaserOffDelay;
|
|
public double JumpDelay { get => _JumpDelay; set => SetProperty(ref _JumpDelay, value); }
|
|
private double _JumpDelay;
|
|
public double MarkDelay { get => _MarkDelay; set => SetProperty(ref _MarkDelay, value); }
|
|
private double _MarkDelay;
|
|
public double PolygonDelay { get => _PolygonDelay; set => SetProperty(ref _PolygonDelay, value); }
|
|
private double _PolygonDelay;
|
|
public double Power { get => _Power; set => SetProperty(ref _Power, value); }
|
|
private double _Power;
|
|
public double JumpSpeed { get => _JumpSpeed; set => SetProperty(ref _JumpSpeed, value); }
|
|
private double _JumpSpeed;
|
|
public double MarkSpeed { get => _MarkSpeed; set => SetProperty(ref _MarkSpeed, value); }
|
|
private double _MarkSpeed;
|
|
public double JumpX { get => _JumpX; set => SetProperty(ref _JumpX, value); }
|
|
private double _JumpX;
|
|
public double JumpY { get => _JumpY; set => SetProperty(ref _JumpY, value); }
|
|
private double _JumpY;
|
|
}
|
|
}
|