2026-03-30 17:09:29 +09:00

104 lines
4.1 KiB
C#

using Aurora;
using Aurora.Api;
using Aurora.View;
using AuroraLaserScanner;
using CoreUnit.Control.UserControl.Canvas;
using Hermes;
using Matrox.MatroxImagingLibrary;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using WeldingCommon.Devices;
using WeldingCommon.Settings;
using static Aurora.Api.SequenceBuilder;
using static AuroraPLC.PLCBase;
namespace WeldingCommon.Data
{
public class WeldingData : NotifyPropertyChangedBase
{
protected readonly Logger Log = new Logger("WeldingData");
private object _LockObj = new object();
// For View
// Main AutoRun Sequence 에서 한번에 Update 하여 view 에 보여 주기 위함.
// 아래 EDC 와 중복인 것도 있지만, 한번에 Update 되어야 혼란이 없을 것 같음.
public DateTime AutoRunStartTime { get => _AutoRunStartTime; set => SetProperty(ref _AutoRunStartTime, value); }
private DateTime _AutoRunStartTime;
public DateTime LoadStartTime { get => _LoadStartTime; set => SetProperty(ref _LoadStartTime, value); }
private DateTime _LoadStartTime;
// 마지막 제품 Weld 시작 시각
public DateTime WeldingStartTime { get => _WeldingStartTime; set => SetProperty(ref _WeldingStartTime, value); }
private DateTime _WeldingStartTime;
public TimeSpan TactTime_Welding { get => _TactTime_Welding; set => SetProperty(ref _TactTime_Welding, value); }
private TimeSpan _TactTime_Welding;
// 마지막 제품 생산 시각, LastProductTime
public DateTime WeldingEndTime {
get => _WeldingEndTime;
set {
TactTime_Welding = value.Subtract(WeldingStartTime);
SetProperty(ref _WeldingEndTime, value);
}
}
private DateTime _WeldingEndTime;
public DateTime UnloadStartTime { get => _UnloadStartTime; set => SetProperty(ref _UnloadStartTime, value); }
private DateTime _UnloadStartTime;
public string WeldingSpanTimeMilliseconds { get => _WeldingSpanTimeMilliseconds; set => SetProperty(ref _WeldingSpanTimeMilliseconds, value); }
private string _WeldingSpanTimeMilliseconds;
public uint TodayProduct { get => _TodayProduct; set => SetProperty(ref _TodayProduct, value); }
private uint _TodayProduct;
public uint TotalProduct { get => _TotalProduct; set => SetProperty(ref _TotalProduct, value); }
private uint _TotalProduct;
public string CellId { get => _CellId; set => SetProperty(ref _CellId, value); }
private string _CellId;
public string LotId { get => _LotId; set => SetProperty(ref _LotId, value); }
private string _LotId;
// <EDC, SeqAutoRunSMW, SeqAutoRunLHS_Normal, SeqReceiveCellInfo>
public string LBAD_Judge { get => _LBAD_Judge; set => SetProperty(ref _LBAD_Judge, value); }
private string _LBAD_Judge;
public string LDD_Judge { get => _LDD_Judge; set => SetProperty(ref _LDD_Judge, value); }
private string _LDD_Judge;
public bool IsVisionNG { get => _IsVisionNG; set => SetProperty(ref _IsVisionNG, value); }
private bool _IsVisionNG;
// AutoRun <-> (FlyingVisionScout, SeqScout)
[JsonIgnore]
public MIL_ID ScannerFiledImage { get => _ScannerFiledImage; set => SetProperty(ref _ScannerFiledImage, value); }
private MIL_ID _ScannerFiledImage;
[JsonIgnore]
public List<PLCReportData> UploadProcessDatas { get => _UploadProcessDatas; set => SetProperty(ref _UploadProcessDatas, value); }
private List<PLCReportData> _UploadProcessDatas = new List<PLCReportData>();
public WeldingData()
{
var aurora = Application.Current.AuroraEnv();
}
public virtual void Clear()
{
CellId = string.Empty;
LotId = string.Empty;
foreach (var data in UploadProcessDatas)
data.Value = 0.0;
}
}
}