90 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace Project.Class
 | |
| {
 | |
| 	[Serializable]
 | |
| 	public class JobData
 | |
| 	{
 | |
| 		public enum ErrorCode
 | |
| 		{
 | |
| 			None = 0,
 | |
| 			BarcodeRead,
 | |
| 			Print,
 | |
| 			Camera,
 | |
| 		}
 | |
| 		public ErrorCode error = ErrorCode.None;
 | |
| 		public int No { get; set; }
 | |
| 		public VisionData VisionData;
 | |
| 
 | |
| 		public DateTime JobStart
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				if (this.VisionData == null) return new DateTime(1982, 11, 23);
 | |
| 				else return VisionData.STime;
 | |
| 			}
 | |
| 		}
 | |
| 		public DateTime JobEnd;
 | |
| 		public TimeSpan JobRun
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				if (JobEnd.Year == 1982) return new TimeSpan(0);
 | |
| 				else if (JobStart.Year == 1982) return new TimeSpan(0);
 | |
| 				else return JobEnd - JobStart;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		//작업데이터의 GUID(자료식별)
 | |
| 		public string guid { get; private set; }
 | |
| 
 | |
| 		//언로더포트위치(L/R)
 | |
| 		public string PortPos;
 | |
| 
 | |
| 
 | |
| 		//동작관련 메세지
 | |
| 		public string Message;
 | |
| 
 | |
| 		int idx;
 | |
| 		public JobData(int idx_)
 | |
| 		{
 | |
| 			this.idx = idx_;
 | |
| 			Clear("INIT");
 | |
| 		}
 | |
| 		public void Clear(string source)
 | |
| 		{
 | |
| 			Pub.AddDebugLog($"item data {idx} clear by {source}");
 | |
| 
 | |
| 			No = 0;
 | |
| 			//JobStart = new DateTime(1982, 11, 23);
 | |
| 			JobEnd = new DateTime(1982, 11, 23);
 | |
| 			PortPos = string.Empty;
 | |
| 			guid = Guid.NewGuid().ToString();
 | |
| 			Message = string.Empty;
 | |
| 			if (VisionData == null)
 | |
| 				VisionData = new VisionData(source);
 | |
| 			else
 | |
| 				VisionData.Clear(source, false);
 | |
| 		}
 | |
| 
 | |
| 		public void CopyTo(ref JobData obj)
 | |
| 		{
 | |
| 			if (obj == null) return;
 | |
| 			//obj.JobStart = this.JobStart;
 | |
| 			obj.JobEnd = this.JobEnd;
 | |
| 			obj.guid = this.guid;
 | |
| 			obj.PortPos = this.PortPos;
 | |
| 			obj.Message = this.Message;
 | |
| 
 | |
| 			Pub.AddDebugLog("아이템 복사 전 rid:" + this.VisionData.RID);
 | |
| 			this.VisionData.CopyTo(ref obj.VisionData);
 | |
| 			Pub.AddDebugLog("아이템 복사 후 대상 rid : " + obj.VisionData.RID);
 | |
| 		}
 | |
| 
 | |
| 	}
 | |
| }
 | 
