Initial commit

This commit is contained in:
ChiKyun Kim
2025-07-17 16:11:46 +09:00
parent 4865711adc
commit 4a1b1924ba
743 changed files with 230954 additions and 0 deletions

View File

@@ -0,0 +1,187 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project
{
public static class AmkorReelID
{
/// <summary>
/// 앰코 ID형태인지 확인합니다.
/// </summary>
/// <param name="rid"></param>
/// <param name="yy"></param>
/// <param name="m"></param>
/// <returns></returns>
public static Boolean IsValidID(string rid, out string yy, out string m)
{
yy = string.Empty;
m = string.Empty;
if (rid.Length != 15) return false;
try
{
var custCost = rid.Substring(2, 4);
var site = "K" + rid.Substring(6, 1);
var mc = rid.Substring(7, 1);
yy = rid.Substring(8, 2);
m = rid.Substring(10, 1);
var sn = rid.Substring(11, 4);
return true;
}
catch
{
return false;
}
}
public static string MakeReelID(string customercode, string ym)
{
if (customercode.Length != 4)
{
return String.Empty;//
//throw new Exception("Customer 코드는 4자리 입니다");
}
if (ym.Length != 3)
{
return string.Empty;//
//throw new Exception("Ym 코드는 3자리 입니다");
}
var rid = "RC{CUST}{DEVLOC}{DEVID}{YM}";
rid = rid.Replace("{DEVLOC}", Pub.setting.ReelIdDeviceLoc);
rid = rid.Replace("{DEVID}", Pub.setting.ReelIdDeviceID);
rid = rid.Replace("{CUST}", customercode);
rid = rid.Replace("{YM}", ym);
rid += GetNextSNbyYM(ym);
return rid;
}
/// <summary>
/// 입력된 월 기준으로 시리얼 번호를 생성합니다
/// </summary>
/// <param name="ym">21년 1월의 경우 211, 10월의 경우 21A 식으로 표현</param>
/// <param name="removeR">1,2번 위치에 R기호를 제거 할 것인가?</param>
/// <returns></returns>
public static string GetNextSNbyYM(string ym)
{
//서버에서 자료를 조회해서 처리한다.
var db = new EEEntities();
var dr = db.Component_Reel_Result.Where(t => t.PDATE == ym && t.PDATE.Contains("R") == false).OrderByDescending(t => t.RSN).FirstOrDefault();
if (dr == null) return "0001"; //처음쓰는 자료인다.
var curSN = dr.RSN;
return GetNextSNbySN(curSN);
}
/// <summary>
/// 해당월의 리턴릴의 번호를 생성한다
/// </summary>
/// <param name="ym"></param>
/// <returns></returns>
public static string GetNextSNbyYM_Return(string ym)
{
//서버에서 자료를 조회해서 처리한다.
var db = new EEEntities();
var dr = db.Component_Reel_Result.Where(t => t.PDATE == ym && t.PDATE.StartsWith("R")).OrderByDescending(t => t.RSN).FirstOrDefault();
if (dr == null) return "R001"; //처음쓰는 자료인다.
var curSN = dr.RSN;
return GetNextSNbySN_Return(curSN);
}
/// <summary>
/// 중복릴의 다은번호를 생성한다
/// </summary>
/// <param name="ym"></param>
/// <returns></returns>
public static string GetNextSNbyYM_Dup(string ym)
{
//서버에서 자료를 조회해서 처리한다.
var db = new EEEntities();
var dr = db.Component_Reel_Result.Where(t => t.PDATE == ym && t.PDATE.StartsWith("0R")).OrderByDescending(t => t.RSN).FirstOrDefault();
if (dr == null) return "0R01"; //처음쓰는 자료인다.
var curSN = dr.RSN;
return GetNextSNbySN_Dup(curSN);
}
/// <summary>
/// 입력한 시리얼 번호 이후의 번호를 생성합니다(0000~ZZZZ) 까지의 데이터를 가지며 2번쨰짜리까지는 R을 사용하지 못한다
/// </summary>
/// <param name="sn">기준 시리얼번호 4자리</param>
/// <param name="removeR"></param>
/// <returns></returns>
public static string GetNextSNbySN(string sn)
{
//서버에서 자료를 조회해서 처리한다.
string curSN = sn;
if (sn.Length != 4) throw new Exception("s/n length 4");
var buffer = curSN.ToCharArray();
for (int i = buffer.Length; i > 0; i--)
{
if (i <= 2)
if (buffer[i - 1] == 'Q') buffer[i - 1] = 'R';
if (buffer[i - 1] == '9') { buffer[i - 1] = 'A'; break; }
else if (buffer[i - 1] == 'Z') buffer[i - 1] = '0';
else { buffer[i - 1] = (char)((byte)buffer[i - 1] + 1); break; }
}
return string.Join("", buffer);
}
/// <summary>
/// 리턴릴의 다음 번호 생성 R로시작하며 000~ZZZ 영역을 가진다(제외문자 없음)
/// </summary>
/// <param name="sn"></param>
/// <returns></returns>
public static string GetNextSNbySN_Return(string sn)
{
//서버에서 자료를 조회해서 처리한다.
string curSN = sn;
if (sn.Length != 4) throw new Exception("s/n length 4");
var buffer = curSN.ToCharArray();
for (int i = buffer.Length; i > 1; i--)
{
//if (i <= 2) //1,2번 영역에는 R값이 들어가면 안된다.
//{
// if (buffer[i - 1] == 'Q') buffer[i - 1] = 'R';
//}
if (buffer[i - 1] == '9') { buffer[i - 1] = 'A'; break; }
else if (buffer[i - 1] == 'Z') buffer[i - 1] = '0';
else { buffer[i - 1] = (char)((byte)buffer[i - 1] + 1); break; }
}
buffer[0] = 'R';
return string.Join("", buffer);
}
/// <summary>
/// 중복릴의 다음 번호 생성(0R로 시작하며 00~ZZ의 영역을 가진다)
/// </summary>
/// <param name="sn"></param>
/// <returns></returns>
public static string GetNextSNbySN_Dup(string sn)
{
//서버에서 자료를 조회해서 처리한다.
string curSN = sn;
if (sn.Length != 4) throw new Exception("s/n length 4");
var buffer = curSN.ToCharArray();
for (int i = buffer.Length; i > 2; i--)
{
//if (i <= 2) //1,2번 영역에는 R값이 들어가면 안된다.
//{
// if (buffer[i - 1] == 'Q') buffer[i - 1] = 'R';
//}
if (buffer[i - 1] == '9') { buffer[i - 1] = 'A'; break; }
else if (buffer[i - 1] == 'Z') buffer[i - 1] = '0';
else { buffer[i - 1] = (char)((byte)buffer[i - 1] + 1); break; }
}
buffer[0] = '0';
buffer[1] = 'R';
return string.Join("", buffer);
}
}
}

View File

@@ -0,0 +1,168 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
namespace Project.Class
{
public class CHistoryJOB : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
List<JobData> _items;
public CHistoryJOB()
{
_items = new List<JobData>();
}
public void Clear()
{
lock (_items)
{
_items.Clear();
}
OnPropertyChanged("Clear");
}
public int Count
{
get
{
lock (_items)
{
return _items.Count;
}
}
}
public void SetItems(List<JobData> value)
{
lock (_items)
{
this._items = value;
}
OnPropertyChanged("REFRESH");
}
public List<JobData> Items { get { return _items; } }
public void Add(JobData data)
{
lock (_items)
{
data.No = this._items.Count + 1;
_items.Add(data);
}
OnPropertyChanged("Add:" + data.guid);
}
public void Remove(JobData data)
{
lock (_items)
{
_items.Remove(data);
}
OnPropertyChanged("Remove:" + data.guid);
}
public void Remove(string guid)
{
lock (_items)
{
var data = Get(guid);
_items.Remove(data);
}
OnPropertyChanged("Remove:" + guid);
}
public JobData Get(string guid)
{
lock (_items)
{
return _items.Where(t => t.guid == guid).FirstOrDefault();
}
}
public void Set(JobData data)
{
var item = Get(data.guid);
if (item == null) throw new Exception("No data guid:" + data.guid.ToString());
else
{
//item.No = data.No;
//item.JobStart = data.JobStart;
//item.JobEnd = data.JobEnd;
//item.VisionData = data.VisionData;
//item.error = data.error;
//item.Message = data.Message;
OnPropertyChanged("Set:" + data.guid);
}
}
public void RaiseSetEvent(string guid)
{
OnPropertyChanged("Set:" + guid);
}
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(name));
}
}
//[Serializable]
//public class JobData
//{
// //고유식별자
// public string guid { get; private set; }
// //비젼처리값
// public Class.VisionData VisionData { get; set; }
// //언로더포트(L/R)
// public string PortPos { get; set; }
// //프린트위치(U/LO)
// public string PrintPos { get; set; }
// //작업시작시간
// public DateTime JobStart { get; set; }
// //작업종료시간
// public DateTime JobEnd { get; set; }
// /// <summary>
// /// 이전 출고되는 시점과의 시간차 값
// /// </summary>
// public double TackTime { get { return (JobEnd - JobStart).TotalSeconds; } }
// //작업순서
// public int No { get; set; }
// //오류상태
// public eJobResult error { get; set; }
// //메세지
// public string message { get; set; }
// public TimeSpan JobRun
// {
// get
// {
// if (JobEnd.Year == 1982) return new TimeSpan(0);
// else return this.JobEnd - this.JobStart;
// }
// }
// public JobData()
// {
// this.No = 0;
// PortPos = string.Empty;
// PrintPos = string.Empty;
// guid = Guid.NewGuid().ToString();
// VisionData = new VisionData();
// this.JobStart = new DateTime(1982, 11, 23); // DateTime.Parse("1982-11-23");
// this.JobEnd = new DateTime(1982, 11, 23); // DateTime.Parse("1982-11-23");
// error = eJobResult.None;
// message = string.Empty;
// }
//}
}

View File

@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
namespace Project.Class
{
public class CHistorySIDRef : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public Boolean JobSIDRecvError
{
get
{
//아이템이있어야 정상이다
if (_items == null || _items.Count < 1) return true;
else if (JobSIDRecvTime.Year == 1982) return true;
else return false;
}
}
public DateTime JobSIDRecvTime { get; set; }
public string JobSIDRecvMessage { get; set; }
List<SIDDataRef> _items;
public CHistorySIDRef()
{
Clear();
}
public void SetItems(List<SIDDataRef> value)
{
this._items = value;
OnPropertyChanged("REFRESH");
}
public List<SIDDataRef> Items { get { return _items; } }
public int Count
{
get
{
return _items.Count;
}
}
public SIDDataRef Get(string sid_)
{
return _items.Where(t => t.sid == sid_).FirstOrDefault();
}
public void Set(SIDDataRef data)
{
var item = Get(data.sid);
if (item == null) throw new Exception("No data sid:" + data.sid.ToString());
else
{
item.kpc = data.kpc;
item.unit = data.unit;
OnPropertyChanged("Set:" + data.sid);
}
}
public void Set(string sid, int kpc, string unit)
{
var item = Get(sid);
if (item == null)
{
Add(sid, kpc, unit); //없다면 추가해준다
}
else
{
item.kpc = kpc;
item.unit = unit;
OnPropertyChanged("Set:" + sid);
}
}
public void Add(SIDDataRef data)
{
_items.Add(data);
OnPropertyChanged("Add:" + data.sid);
}
public void Add(string sid, int kpc_, string unit)
{
if (string.IsNullOrEmpty(sid))
{
Pub.log.AddAT("SID 추가 실패 SID 값이 입력되지 않았습니다");
return;
}
//if (JobSidList.ContainsKey(sid) == false)
_items.Add(new SIDDataRef(sid, kpc_, unit));
OnPropertyChanged("Add:" + sid);
//else
//{
//이미 데이터가 있다. 중복이므로 누적한다
//JobSidList.TryGetValue()
//}
}
public void Clear()
{
//JobSIDRecvError = false;
JobSIDRecvMessage = string.Empty;
JobSIDRecvTime = DateTime.Parse("1982-11-23");
if (this._items == null) this._items = new List<SIDDataRef>();
else this._items.Clear();
OnPropertyChanged("Clear");
}
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(name));
}
}
[Serializable]
public class SIDDataRef
{
public string guid { get; set; }
public string sid { get; set; }
public string unit { get; set; }
public int kpc { get; set; }
public SIDDataRef(string sid_, int kpc_, string unit_)
{
guid = Guid.NewGuid().ToString();
sid = sid_;
unit = unit_;
kpc = kpc_;
}
public SIDDataRef() : this(string.Empty, 0, string.Empty) { }
}
}

View File

@@ -0,0 +1,572 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project
{
public class CCustRule
{
public void Clear()
{
Code = string.Empty;
}
public string Code { get; set; }
public string Name { get; set; }
public int Len { get; set; }
public string Pre { get; set; }
public string Post { get; set; }
public string Expression { get; set; }
public Boolean isValid
{
get
{
return string.IsNullOrEmpty(Code) == false && Code.Equals("000") == false;
}
}
}
public class CResult
{
public enum eInspectResult
{
NG = 0,
OK,
ERROR,
NOTSET = 9,
}
public DateTime ResetButtonDownTime = DateTime.Now;
//public Class.VisionData[] VisionData = new Class.VisionData[3];
public Boolean ClearAllSID = false;
//public Class.CHistoryJOB JObHistory;
public Class.CHistorySIDRef SIDReference; //SIDLIST받은 내역
public List<UIControl.CItem> OUTHistory; //출고포트 처리내역
public DataSet1.SIDHistoryDataTable SIDHistory; //sID별 rid 전체 목록 차수별로만 저장된다
public DSList dsList;
public ModelInfoM mModel; //모션 모델
public ModelInfoV vModel; //작업 모델
/// <summary>
/// 아이템의 정보가 담겨있다 (0:왼쪽,1:비젼,2:오른쪽)
/// </summary>
public Class.JobData[] ItemData = new Class.JobData[3];
public string JobType2 = string.Empty;
public Boolean JobFirst = false;
public List<CCustRule> CustomerRule = new List<CCustRule>();
public Boolean DryRun
{
get
{
if (string.IsNullOrEmpty(JobType2)) return false;
else return JobType2.ToUpper() == "DRY";
}
}
public int OverLoadCountF { get; set; }
public int OverLoadCountR { get; set; }
public UIControl.CItem UnloaderItem = null;
public DateTime LastExtInputTime = DateTime.Parse("1982-11-23");
public DateTime LastOutTime = DateTime.Parse("1982-11-23");
public Single[] PortAlignWaitSec = new float[] { 0, 0, 0, 0 };
public long[] PortAlignTime = new long[] { 0, 0, 0, 0 };
public byte UnloaderSeq = 0;
public DateTime UnloaderSeqTime;
public DateTime UnloaderSendtime = DateTime.Parse("1982-11-23");
//작업옵션처리 210121
public Boolean Option_Confirm1 = false;
public Boolean Option_QtyUpdate1 = false;
public Boolean Option_QtyUpdateM = false;
public Boolean Option_partUpdate = false;
public Boolean Option_AutoConf = false;
//public string Option_PrintPos1 = "";
public Boolean Option_vname = false;
public Boolean Option_NewReelID = false;
//public bool Option_Dryrun = false;
//public Boolean Option_Confirm3 = false;
//public Boolean Option_QtyUpdate3 = false;
//public Boolean Option_FixPrint3 = false;
//public Boolean Option_printforce3 = false;
//public string Option_PrintPos3 = "";
/// <summary>
/// 로딩에 사용하는 포트번호 (자동 판단됨)
/// </summary>
public int LoadPortIndex = -1;
/// <summary>
/// 로딩시에 사용한 포트의 번호(이 값으로 수량기록 위치를 결정)
/// </summary>
public int LoadPickIndex = -1;
/// <summary>
/// 최종 할당된 언로딩 포트번호(1~8)
/// </summary>
public int UnloadPortNo = -1;
public byte LiveViewseq = 0;
public string AcceptBcd = string.Empty;
public DateTime AcceptBcdTime = DateTime.Now;
public string AcceptSid = string.Empty;
//작업정보
public eInspectResult Result; //작업결과가 저장됨
public eResult ResultCode;
public string ResultMessage;
public string LastSIDFrom = string.Empty;//101 = string.Empty;
public string LastSIDTo = string.Empty; // 103 = string.Empty;
//public string LastSID103_2 = string.Empty;
public string LastVName = string.Empty;
public int LastSIDCnt = 0;
//작업정보(시간)
public DateTime JobStartTime;
public DateTime JobEndTime;
public TimeSpan JobRunTime()
{
if (JobStartTime.Year == 1982) return new TimeSpan(0);
if (JobEndTime.Year == 1982) return DateTime.Now - JobStartTime;
else return JobEndTime - JobStartTime;
}
/// <summary>
/// RUN -> Pause(Wait Start)모드 전환시 저장할 모터의 위치값
/// 조그모드등으로 좌표를 옴길때의 기준 좌표
/// 이 좌표값에서 현재 모션값에 변화가 있으면 프로그램에서는 오류로 처리하게 됨
/// </summary>
public double[] PreventMotionPosition = new double[8];
#region "SetResultMessage"
public void SetResultMessage(eResult code, eECode err, eNextStep systempause, params object[] args)
{
var msg = getResultCodeMessage(code) + " ERROR\n" + getErrorMessage(code, err, args);
SetResultMessage(code, msg, systempause);
}
private void SetResultMessage(eResult code, string msg, eNextStep systemPause)
{
this.ResultCode = code;
this.ResultMessage = msg;
if (systemPause == eNextStep.pauseNoMessage) this.ResultMessage = string.Empty; //210129
Pub.log.AddE(msg);
if (systemPause == eNextStep.pause) Pub.sm.setNewStep(StateMachine.eSMStep.PAUSE);
else if (systemPause == eNextStep.pauseNoMessage) Pub.sm.setNewStep(StateMachine.eSMStep.PAUSE);
else if (systemPause == eNextStep.error) Pub.sm.setNewStep(StateMachine.eSMStep.ERROR);
}
//public void SetResultTimeOutMessage(StateMachine.eSMStep step, eNextStep systemPause)
//{
// SetResultMessage(eResult.TIMEOUT, eECode.timeout_step, systemPause, step);
//}
public void SetResultTimeOutMessage(eDOName pinName, Boolean checkState, eNextStep systemPause)
{
if (checkState) SetResultMessage(eResult.SENSOR, eECode.doon, systemPause, pinName);
else SetResultMessage(eResult.SENSOR, eECode.dooff, systemPause, pinName);
}
public void SetResultTimeOutMessage(eDIName pinName, Boolean checkState, eNextStep systemPause)
{
if (checkState) SetResultMessage(eResult.SENSOR, eECode.dion, systemPause, pinName);
else SetResultMessage(eResult.SENSOR, eECode.dioff, systemPause, pinName);
}
public void SetResultTimeOutMessage(eAxis motAxis, eECode ecode, eNextStep systemPause, string source)
{
SetResultMessage(eResult.TIMEOUT, ecode, systemPause, motAxis, source);
}
public void SetResultTimeOutMessage(eECode ecode, eNextStep systemPause, params object[] args)
{
SetResultMessage(eResult.TIMEOUT, ecode, systemPause, args);
}
#endregion
public DateTime[,] diCheckTime = new DateTime[2, 64];
public DateTime[,] doCheckTime = new DateTime[2, 64];
public Boolean isError { get; set; }
// public Boolean isMarkingMode { get; set; }
public int retry = 0;
public DateTime retryTime;
public DateTime[] WaitForVar = new DateTime[255];
public int JoystickAxisGroup = 0;
public int ABCount = 0;
public CResult()
{
mModel = new ModelInfoM();
vModel = new ModelInfoV();
SIDReference = new Class.CHistorySIDRef();
SIDHistory = new DataSet1.SIDHistoryDataTable();
//JObHistory = new Class.CHistoryJOB();
OUTHistory = new List<UIControl.CItem>();
this.Clear();
dsList = new DSList();
LoadListDB();
}
public void SaveListDB()
{
var finame = System.IO.Path.Combine(Util.CurrentPath, "Data", "SavaedList.xml");
var fi = new System.IO.FileInfo(finame);
if (fi.Directory.Exists == false) fi.Directory.Create();
this.dsList.WriteXml(fi.FullName);
Pub.log.Add("사전목록DB를 저장 했습니다" + fi.FullName);
}
public void LoadListDB()
{
var finame = System.IO.Path.Combine(Util.CurrentPath, "Data", "SavaedList.xml");
var fi = new System.IO.FileInfo(finame);
if (fi.Directory.Exists == false) fi.Directory.Create();
if (fi.Exists)
{
this.dsList.ReadXml(fi.FullName);
Pub.log.Add("사전목록DB를 불러왔습니다" + fi.FullName);
}
}
/// <summary>
/// 입력한 sid 가 원본에 존재하지 않으면 -1을 존재하면 입력된 수량을 반환합니다
/// </summary>
/// <param name="sid"></param>
/// <returns></returns>
public int ExistSIDReferenceCheck(string sid)
{
var dr = Pub.Result.SIDReference.Items.Where(t => t.sid.EndsWith(sid)).FirstOrDefault();
if (dr == null) return -1;
else return dr.kpc;
}
public void ClearHistory()
{
//this.JObHistory.Clear();
this.SIDReference.Clear();
Pub.log.AddI("Clear History");
}
public void ClearOutPort()
{
OUTHistory.Clear();
}
public void Clear()
{
//this.JObHistory.Clear();
this.ItemData = new Class.JobData[3];
for (int i = 0; i < ItemData.Length; i++)
{
ItemData[i] = new Class.JobData(i);
}
JobFirst = true;
OverLoadCountF = 0;
OverLoadCountR = 0;
ClearOutPort();
LoadPortIndex = -1;
Pub.ClearRunStepSeqTime();
isError = false;
ABCount = 0;
///기다림용 변수모듬
for (int i = 0; i < WaitForVar.Length; i++)
WaitForVar[i] = DateTime.Parse("1982-11-23");
//조그모드시 모션이동 감지용 저장 변수
for (int i = 0; i < 6; i++)
PreventMotionPosition[i] = 0.0;
JobStartTime = DateTime.Parse("1982-11-23");
JobEndTime = DateTime.Parse("1982-11-23");
LastOutTime = DateTime.Parse("1982-11-23");
Result = eInspectResult.NOTSET;
ResultCode = eResult.NOERROR;
ResultMessage = string.Empty;
//시간정보값을 초기화함
for (int i = 0; i < 2; i++)
ClearTime(i);
Pub.log.Add("Result 데이터 초기화");
}
public void ClearTime(int shutIdx)
{
JobStartTime = DateTime.Parse("1982-11-23");
JobEndTime = DateTime.Parse("1982-11-23");
Result = eInspectResult.NOTSET;
ResultCode = eResult.NOERROR;
ResultMessage = string.Empty;
Pub.log.Add("Result(Clear Time)");
}
public Boolean isSetmModel
{
get
{
if (Pub.Result.mModel == null || Pub.Result.mModel.idx == -1 || Pub.Result.mModel.Title.isEmpty())
return false;
else return true;
}
}
public Boolean isSetvModel
{
get
{
if (Pub.Result.vModel == null || Pub.Result.vModel.idx == -1 || Pub.Result.vModel.Title.isEmpty())
return false;
else return true;
}
}
public string getErrorMessage(eResult rlt, eECode err, params object[] args)
{
switch (err)
{
case eECode.DOORF:
return string.Format("전면 도어가 열렸습니다");
case eECode.DOORR:
return string.Format("후면 도어가 열렸습니다");
case eECode.SIDERR101:
return string.Format("현재 작업 형태와 SID값이 일치하지 않습니다\nSID:{0}\n작업형태:{1}\n101 SID작업 입니다.", args);
case eECode.SIDERR106:
return string.Format("현재 작업 형태와 SID값이 일치하지 않습니다\nSID:{0}\n작업형태:{1}\n106 SID작업 입니다.", args);
case eECode.SIDERR103:
return string.Format("현재 작업 형태와 SID값이 일치하지 않습니다\nSID:{0}\n작업형태:{1}\n103 SID작업 입니다.", args);
case eECode.RIDDUPL:
return string.Format(
"좌측 언로더에 사용되었던 REEL ID 입니다\n" +
"바코드 오류 가능성이 있습니다\n" +
"좌측 릴의 바코드를 확인하시기 바랍니다\n" +
"작업을 계속할 수 없습니다. 취소 후 다시 시도하세요\n{0}", args);
case eECode.RIDDUPR:
return string.Format(
"우측 언로더에 사용되었던 REEL ID 입니다\n" +
"바코드 오류 가능성이 있습니다\n" +
"우측 릴의 바코드를 확인하시기 바랍니다\n" +
"작업을 계속할 수 없습니다. 취소 후 다시 시도하세요\n{0}", args);
case eECode.BARCODEVALIDERR:
return string.Format("바코드 데이터 검증 실패\n" +
"인쇄전 데이터와 인쇄후 데이터가 일치하지 않습니다\n" +
"ID(O) : {1}\n" +
"ID(N) : {2}\n" +
"SID : {5}->{6}\n" +
"QTY : {3}->{4}\n" +
"DATE : {7}->{8}\n" +
"Index : {0}", args);
case eECode.MOTX_SAFETY:
return string.Format("PICKER-X 축이 안전위치에 없습니다\n1. 조그를 이용하여 중앙으로 이동 합니다\n2.홈 작업을 다시 실행합니다", args);
case eECode.noerror:
return string.Format("오류가 없습니다", args);
case eECode.portoverload:
return string.Format("PORT OVERLOAD\n위치 : {0}\n" +
"너무 많은 양이 적재 되었습니다\n" + "상단 LIMIT 센서에 걸리지 않게 적재하세요", args);
case eECode.emergency:
return string.Format("비상정지 버튼을 확인하세요\n" +
"버튼 : F{0}\n" +
"메인전원이 OFF 된 경우에도 이 메세지가 표시 됩니다\n" +
"메인전원은 모니터 하단 AIR버튼 좌측에 있습니다"
, Util_DO.GetIOInput(eDIName.BUT_EMGF));
case eECode.nomodelm:
return "모션모델이 선택되지 않았습니다\n" +
"상단 메뉴 [모션모델]에서 사용할 모델을 선택하세요";
case eECode.nomodelv:
return "작업모델이 선택되지 않았습니다\n" +
"상단 메뉴 [작업모델]에서 사용할 모델을 선택하세요";
case eECode.CARTERROR:
return string.Format("언로더 카트가 없거나 크기 정보가 일치하지 않습니다\n좌측:{0}, 로더:{1}, 우측:{2}", args);
case eECode.CARTL:
return string.Format("왼쪽(UNLOAD) 포트에 카트가 감지되지 않습니다\n카트를 장착하세요\n카트크기 : {0}, 릴크기:{1}", args);
case eECode.CARTC:
return string.Format("중앙(LOAD) 포트에 카트가 감지되지 않습니다\n카트를 장착하세요\n카트크기 : {0}, 릴크기:{1}", args);
case eECode.CARTR:
return string.Format("오른쪽(UNLOAD) 포트에 카트가 감지되지 않습니다\n카트를 장착하세요\n카트크기 : {0}, 릴크기:{1}", args);
case eECode.CARTLMATCH:
return string.Format("왼쪽(UNLOAD) 카트와 피커의 릴 크기가 일치하지 않습니다\n카트크기를 확인 하세요\n카트크기 : {0}, 릴크기:{1}", args);
case eECode.CARTCMATCH:
return string.Format("중앙(LOAD) 카트와 피커의 릴 크기가 일치하지 않습니다\n카트크기를 확인 하세요\n카트크기 : {0}, 릴크기:{1}", args);
case eECode.CARTRMATCH:
return string.Format("오른쪽(UNLOAD) 카트와 피커의 릴 크기가 일치하지 않습니다\n카트크기를 확인 하세요\n카트크기 : {0}, 릴크기:{1}", args);
case eECode.NOREELSIZEL:
return string.Format("왼쪽포트에 놓을 릴의 크기정보가 없습니다\n프로그램 오류입니다\n개발자에게 해당 메세지를 전달하세요\n" +
"장치 초기화를 진행 한 후 다시 시도하세요");
case eECode.NOREELSIZER:
return string.Format("오른쪽포트에 놓을 릴의 크기정보가 없습니다\n프로그램 오류입니다\n개발자에게 해당 메세지를 전달하세요\n" +
"장치 초기화를 진행 한 후 다시 시도하세요");
case eECode.CAM_CONN:
return string.Format("카메라({0}) 연결 안됨", args);
case eECode.EVISION_CONN:
return string.Format("E-Vision USB Dongle Error", args);
case eECode.CAM_NOBARCODEL:
return string.Format("로더 바코드 필수값을 읽지 못했습니다", args);
case eECode.CAM_NOBARCODEU:
return string.Format("언로더({0}) 바코드를 읽지 못했습니다", args);
case eECode.HOME_TIMEOUT:
return string.Format("홈 진행이 완료되지 않고 있습니다\n" +
"오류가 발생했다면 '홈' 작업을 다시 진행하세요\n" +
"대기시간 : {0}초", args);
case eECode.PICKOVL:
return string.Format("피커({0})에서 오버로드가 감지되었습니다\n" +
"센서및 포트의 적재 상태를 확인한 후 다시 시도하세요", args);
case eECode.saftyport:
return string.Format("포트 안전센서가 감지 되었습니다\n" +
"안전센서를 확인한 후 다시 시도하세요\n", args);
case eECode.airnoout:
return "AIR 공급이 차단 되어 있습니다.\n" +
"전면의 AIR 버튼을 누르세요\n" +
"공급이 되지 않으면 메인 전원 을 확인하세요\n" +
"메인 전원은 AIR 버튼 좌측에 있습니다" +
"메인 전원 공급 실패시 장비 후면의 차단기를 확인하세요";
case eECode.dooff:
var pinoOf = (eDOName)args[0];
return string.Format("출력이 OFF 되지 않았습니다.\n" +
"포트설명 : {0}\n" +
"포트번호 : {1} ({2})", Util_DO.getPinDescription(pinoOf), (int)pinoOf, Enum.GetName(typeof(eDOPin), pinoOf));
case eECode.doon:
var pinoOn = (eDOName)args[0];
return string.Format("출력이 ON 되지 않았습니다.\n" +
"포트설명 : {0}\n" +
"포트번호 : {1} ({2})", Util_DO.getPinDescription(pinoOn), (int)pinoOn, Enum.GetName(typeof(eDOPin), pinoOn));
case eECode.dioff:
var piniOf = (eDIName)args[0];
return string.Format("입력이 OFF 되지 않았습니다.\n" +
"포트설명 : {0}\n" +
"포트번호 : {1} ({2})", Util_DO.getPinDescription(piniOf), (int)piniOf, Enum.GetName(typeof(eDIPin), piniOf));
case eECode.dion:
var piniOn = (eDIName)args[0];
return string.Format("입력이 ON 되지 않았습니다.\n" +
"포트설명 : {0}\n" +
"포트번호 : {1} ({2})", Util_DO.getPinDescription(piniOn), (int)piniOn, Enum.GetName(typeof(eDIPin), piniOn));
case eECode.azininit:
return string.Format("DIO 혹은 모션카드가 초기화 되지 않았습니다.\n" +
"DIO : {0}\n" +
"MOTION : {1}\n" +
"해당 카드는 본체 내부 PCI 슬롯에 장착 된 장비 입니다\n" +
"EzConfig AXT 프로그램으로 카드 상태를 확인하세요",
Pub.dio.IsInit, Pub.mot.IsInit);
case eECode.MOT_INIT:
return string.Format("모션카드가 초기화 되지 않았습니다\n" +
"아진엑스텍 프로그램을 통해서 보드를 확인하세요\n" +
"PC를 재부팅한 후 재시도 하세요", args);
case eECode.MOT_HSET:
var msg = "모션의 HOME 검색이 완료되지 않았습니다";
for (int i = 0; i < 6; i++)
{
if (Pub.mot.isUse[i] == false) continue;
var axis = (eAxis)i;
var stat = Pub.mot.isHomeSet[i];
if (stat == false) msg += string.Format("\n[{0}] {1} : {2}", i, axis, stat);
}
msg += "\n장치 초기화를 실행하세요";
return msg;
case eECode.MOT_SVOFF:
var msgsv = "모션 중 SERVO-OFF 된 축이 있습니다";
for (int i = 0; i < 6; i++)
{
if (Pub.mot.isUse[i] == false) continue;
var axis = (eAxis)i;
var stat = Pub.mot.isSERVOON[i];
if (stat == false) msgsv += string.Format("\n[{0}] {1} : {2}", i, axis, stat);
}
msgsv += "\nRESET을 누른 후 '모션설정' 화면에서 확인합니다";
return msgsv;
case eECode.MOT_HSEARCH:
return string.Format("모션의 홈 검색이 실패되었습니다\n" +
"축 : {0}\n" +
"메세지 : {1}", args);
case eECode.MOT_CMD:
var axisNo = (int)((eAxis)args[0]);
var axisSrc = args[1].ToString();
return string.Format("모션축 명령이 실패 되었습니다\n축 : {0}\n" +
"현재위치 : {2}\n" +
"명령위치 : {3}\n" +
"소스 : {1}", axisNo, axisSrc, Pub.mot.dACTPOS[axisNo], Pub.mot.dCMDPOS[axisNo]);
case eECode.MNBR:
return string.Format("MNBR 값이 없습니다\n" +
"환경설정에서 MNBR 값을 입력하세요", args);
//case eECode.timeout_step:
// return string.Format("스텝당 최대 실행 시간이 초과 되었습니다.\n" +
// "스텝 : {0}\n" +
// "최대동작시간 : " + Pub.setting.Timeout_StepMaxTime.ToString(), args);
case eECode.USER_STOP:
return "'일시정지' 버튼 눌림\n" +
"사용자에 의해 작동이 중지 되었습니다\n" +
"'RESET' -> 'START'로 작업을 계속할 수 있습니다";
case eECode.CAM_RIGHT:
return "우측카메라가 사용가능한 상태가 아닙니다.\n" +
"신규 실행시에는 초기화 완료까지 기다려 주세요";
case eECode.CAM_LEFT:
return "좌측카메라가 사용가능한 상태가 아닙니다.\n" +
"신규 실행시에는 초기화 완료까지 기다려 주세요";
default:
return err.ToString();
}
}
public string getResultCodeMessage(eResult rltCode)
{
//별도 메세지처리없이 그대로 노출한다
return rltCode.ToString().ToUpper();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
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);
}
}
}

View File

@@ -0,0 +1,275 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using HidSharp;
using HidSharp.Reports;
using HidSharp.Reports.Encodings;
namespace arDev.Joystick
{
public class JoystickRaw : IDisposable
{
HidDevice _dev;
HidStream _hidStream;
public Boolean IsOpen { get; private set; }
public event EventHandler Disconnected;
public event EventHandler Connected;
public event EventHandler Changed;
public delegate void MessageHandler(string msg);
public event MessageHandler Message;
public int InputLength { get; private set; }
public int OutputLength { get; private set; }
public int FeatureLength { get; private set; }
public int vid { get; set; }
public int pid { get; set; }
public Boolean[] Buttons = new bool[64]; //버튼정보를 기록한다
Boolean bListUpdate = false;
public JoystickRaw()
{
vid = -1;
pid = -1;
this.InputLength = 0;
this.OutputLength = 0;
this.FeatureLength = 0;
this.IsOpen = false;
this._dev = null;
this._hidStream = null;
DeviceList.Local.Changed += Local_Changed;
Job = new Task(JobMain, ct);
Job.Start();
for (int i = 0; i < Buttons.Length; i++)
Buttons[i] = false;
}
CancellationToken ct ;
public IEnumerable<HidDevice> GetHidDevices()
{
return DeviceList.Local.GetHidDevices();
}
public void Connect(int vid, int pid)
{
this.vid = vid;
this.pid = pid;
}
public void Connect(HidDevice device)
{
this.vid = device.VendorID;
this.pid = device.ProductID;
}
Task Job = null;
private bool disposed = false;
DateTime LastConnTime = DateTime.Now;
void JobMain()
{
//개체가 소멸하기전까지 진행한다
while (this.disposed == false)
{
if (IsOpen == false)
{
if (this.vid == -1 || this.pid == -1)
{
//아직설정되지 않았으니 대기를한다
System.Threading.Thread.Sleep(3000);
}
else
{
//연결작업을 시작해야한다
if (bListUpdate || (DateTime.Now - LastConnTime).TotalMilliseconds >= 3000)
{
LastConnTime = DateTime.Now;
//연결작업
var list = this.GetHidDevices();
this._dev = list.Where(t => t.VendorID == this.vid && t.ProductID == this.pid).FirstOrDefault();
if (_dev != null)
{
try
{
IsOpen = _dev.TryOpen(out _hidStream);
if (IsOpen)
{
this.InputLength = _dev.GetMaxInputReportLength();
this.OutputLength = _dev.GetMaxOutputReportLength();
this.FeatureLength = _dev.GetMaxFeatureReportLength();
this._hidStream.ReadTimeout = Timeout.Infinite;
Connected?.Invoke(this, null);
var rawReportDescriptor = _dev.GetRawReportDescriptor();
var msg = ("Report Descriptor:");
msg += string.Format(" {0} ({1} bytes)", string.Join(" ", rawReportDescriptor.Select(d => d.ToString("X2"))), rawReportDescriptor.Length);
Message?.Invoke(msg);
}
else
{
if (this._hidStream != null) this._hidStream.Dispose();
}
}
catch { System.Threading.Thread.Sleep(1500); }
}
else System.Threading.Thread.Sleep(1500);
}
else System.Threading.Thread.Sleep(1500);
}
}
else
{
//데이터를 가지고 온다
using (_hidStream)
{
try
{
reportDescriptor = _dev.GetReportDescriptor();
deviceItem = reportDescriptor.DeviceItems[0];
var inputReportBuffer = new byte[_dev.GetMaxInputReportLength()];
var inputReceiver = reportDescriptor.CreateHidDeviceInputReceiver();
var inputParser = deviceItem.CreateDeviceItemInputParser();
inputReceiver.Start(_hidStream);
while (true)
{
if (!inputReceiver.IsRunning) { break; } // Disconnected?
Report report; //
while (inputReceiver.TryRead(inputReportBuffer, 0, out report))
{
if (inputParser.TryParseReport(inputReportBuffer, 0, report))
{
WriteDeviceItemInputParserResult(inputParser);
}
}
System.Threading.Thread.Sleep(20);
}
inputReceiver = null;
IsOpen = false;
}
catch (Exception ex)
{
Message?.Invoke(ex.Message);
}
finally
{
Disconnected?.Invoke(this, null);
IsOpen = false;
}
}
}
}
}
void WriteDeviceItemInputParserResult(HidSharp.Reports.Input.DeviceItemInputParser parser)
{
while (parser.HasChanged)
{
int changedIndex = parser.GetNextChangedIndex();
var previousDataValue = parser.GetPreviousValue(changedIndex);
var dataValue = parser.GetValue(changedIndex);
var oVal = previousDataValue.GetPhysicalValue();
var nVal = dataValue.GetPhysicalValue();
if (double.IsNaN(oVal)) oVal = 0.0;
if (double.IsNaN(nVal)) nVal = 0.0;
var InputMethod = (Usage)dataValue.Usages.FirstOrDefault();
if (InputMethod.ToString().StartsWith("Button"))
{
var butNo = int.Parse(InputMethod.ToString().Substring(6));
this.Buttons[butNo - 1] = nVal > 0; //버튼값은 기록 210107
}
//이벤트발생
InputChanged?.Invoke(this, new InputChangedEventHandler(
InputMethod, oVal, nVal));
//메세지도 발생함
//var msg = (string.Format(" {0}: {1} -> {2}",
// (Usage)dataValue.Usages.FirstOrDefault(),
// previousDataValue.GetPhysicalValue(),
// dataValue.GetPhysicalValue()));
//Message?.Invoke(msg);
}
}
public event EventHandler<InputChangedEventHandler> InputChanged;
public class InputChangedEventHandler : EventArgs
{
public Usage input { get; set; }
public double oldValue { get; set; }
public double newValue { get; set; }
public InputChangedEventHandler(Usage input_, double oValue_, double nValue_)
{
this.input = input_;
this.oldValue = oValue_;
this.newValue = nValue_;
}
}
ReportDescriptor reportDescriptor;
DeviceItem deviceItem;
~JoystickRaw()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if (!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if (disposing)
{
// Dispose managed resources.
this._dev = null;
}
Job.Wait();
Job.Dispose();
// Call the appropriate methods to clean up
// unmanaged resources here.
// If disposing is false,
// only the following code is executed.
//CloseHandle(handle);
//handle = IntPtr.Zero;
// Note disposing has been done.
DeviceList.Local.Changed -= Local_Changed;
disposed = true;
}
}
private void Local_Changed(object sender, DeviceListChangedEventArgs e)
{
Changed?.Invoke(sender, e);
bListUpdate = true;
}
}
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Project.Class
{
public class KeyenceBarcodeData
{
public double Angle { get; set; }
public StdLabelPrint.CAmkorSTDBarcode AmkorData { get; set; }
public Point[] vertex { get; set; }
public string Data { get; set; }
public Point CenterPX { get; set; }
public string sym { get; set; }
public Boolean UserActive { get; set; }
public Boolean isSTDBarcode
{
get
{
if (AmkorData != null && sym == "1" && AmkorData.isValid) return true;
return false;
}
}
public Boolean isNewLen15
{
get
{
if (AmkorData != null && sym == "1" && AmkorData.isValid && AmkorData.NewLen15Barcode) return true;
return false;
}
}
/// <summary>
/// 라벨의 위치를 표시한다. 8방향이며 키패드 유사하게 설정한다 789/4-6/123
/// </summary>
public byte LabelPosition { get; set; }
public KeyenceBarcodeData()
{
LabelPosition = 0;
Angle = 0.0;
Data = string.Empty;
CenterPX = Point.Empty;
AmkorData = null;
vertex = null;
sym = string.Empty;
UserActive = false;
}
public override string ToString()
{
return string.Format("{0},Deg={1},Center={2}x{3}", Data, Angle, CenterPX.X, CenterPX.Y);
}
/// <summary>
/// 해당 중심점이 겹치는지 확인합니다.
/// </summary>
/// <param name="Center"></param>
/// <returns></returns>
public Boolean CheckIntersect(Point Center, string data)
{
if (data.Equals(this.Data) == false) return false; //자료가 다르면 다른 자료로 처리한다
return getInside(Center, vertex);
}
bool getInside(Point pt, Point[] ptArr)
{
int crosses = 0;
for (int i = 0; i < ptArr.Length; i++)
{
int j = (i + 1) % ptArr.Length;
if ((ptArr[i].Y > pt.Y) != (ptArr[j].Y > pt.Y))
{
//atX는 점 B를 지나는 수평선과 선분 (p[i], p[j])의 교점
double atX = (ptArr[j].X - ptArr[i].X) * (pt.Y - ptArr[i].Y) / (ptArr[j].Y - ptArr[i].Y) + ptArr[i].X;
//atX가 오른쪽 반직선과의 교점이 맞으면 교점의 개수를 증가시킨다.
if (pt.X < atX)
crosses++;
}
}
return crosses % 2 > 0;
}
}
}

View File

@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.ComponentModel;
namespace Project
{
public class ModelInfoM
{
//스피드 값과, 위치값을 저장하면 된다.
public int idx { get; set; }
public string Title { get; set; }
public Dictionary<int, PositionData[]> Position { get; set; }
public ModelInfoM()
{
idx = -1;
Title = string.Empty;
ClearDataPosition();
}
void ClearDataPosition()
{
Position = new Dictionary<int, PositionData[]>();
var motCount = Enum.GetNames(typeof(eAxis)).Length;
for (int i = 0; i < motCount; i++)
{
var datas = new PositionData[64];
for (int j = 0; j < datas.Length; j++)
datas[j] = new PositionData(-1, string.Empty, 0.0);
Position.Add(i, datas);
}
}
public Boolean isSet
{
get
{
if (idx == -1) return false;
else return !Title.isEmpty();
}
}
public void ReadValue(DataSet1.MCModelRow dr)
{
idx = dr.idx;
Title = dr.Title;
ReadValuePosition(idx);
}
public void ReadValue(int index)
{
var dr = Pub.mdm.dataSet.MCModel.Where(t => t.idx == index).FirstOrDefault();
if (dr == null)
{
idx = -1;
Title = string.Empty;
ClearDataPosition();
}
else
{
idx = dr.idx;
Title = dr.Title;
ReadValuePosition(idx);
}
}
public void ReadValue(string title)
{
ReadValue(title, Pub.mdm.dataSet.MCModel);
}
public void ReadValue(string title, DataSet1.MCModelDataTable dt)
{
var dr = dt.Where(t => t.Title == title).FirstOrDefault();
if (dr == null)
{
idx = -1;
this.Title= string.Empty;
ClearDataPosition();
}
else
{
idx = dr.idx;
this.Title = dr.Title;
ReadValuePosition(idx);
}
}
public void ReadValuePosition(int modelidx)
{
ReadValuePosition(modelidx, Pub.mdm.dataSet.MCModel);
}
public void ReadValuePosition(int modelidx, DataSet1.MCModelDataTable dt)
{
ClearDataPosition();
//각 모터별로 데이터를 가져온다
int cnt = 0;
foreach (var data in Position)
{
//해당 모터의 속도값을 가져온다
var drows = dt.Where(t => t.pidx == modelidx && t.PosIndex >= 0 && t.MotIndex == data.Key);
foreach (DataSet1.MCModelRow dr in drows)
{
var item = data.Value[dr.PosIndex];
item.index = dr.PosIndex;
item.title = dr.PosTitle;
item.value = dr.Position;
item.speed = dr.Speed;
item.acc = dr.SpeedAcc;
item.dcc = dr.SpeedDcc;
data.Value[dr.PosIndex] = item;
cnt += 1;
}
}
Pub.log.Add(String.Format("model {0} 의 위치 데이터 {1}건을 불러왔습니다", modelidx, cnt));
}
}
}

View File

@@ -0,0 +1,257 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.ComponentModel;
namespace Project
{
public class ModelInfoV
{
[Browsable(false)]
public string SPN { get; set; }
//[Browsable(false)]
//public Boolean SplitSPN { get; set; }
[Browsable(false)]
public string Title { get; set; }
[Browsable(false)]
public int idx { get; set; }
[Browsable(false)]
public Rectangle Roi_UnitArea { get; set; }
[Browsable(false)]
public Rectangle Roi_Orient { get; set; }
[Browsable(false)]
public Rectangle Roi_TrayDetect { get; set; }
[Browsable(false)]
public Rectangle Roi_DMDetect { get; set; }
[Browsable(false)]
public Rectangle Roi_DataMatrix { get; set; }
[Browsable(false)]
public Point UnitCount { get; set; }
[Browsable(false)]
public Point RoiCount { get; set; }
[Browsable(false)]
public int ColCount { get { return UnitCount.X; } }
[Browsable(false)]
public int RowCount { get { return UnitCount.Y; } }
[Browsable(false)]
public int TotalUnitCount { get { return UnitCount.X * UnitCount.Y; } }
[Browsable(false)]
public Point VisionCount { get; set; }
[Browsable(false)]
public int VisionColCount { get { return VisionCount.X; } }
[Browsable(false)]
public int VisionRowCount { get { return VisionCount.Y; } }
[Browsable(false)]
public int TotalVisionCount { get { return VisionCount.X * VisionCount.Y; } }
[Browsable(false)]
public UInt16 airBlowRuntime { get; set; }
[Browsable(false)]
public UInt16 LimitCount { get; set; }
[Browsable(false)]
public float DotFontSize { get; set; }
//여기는 사용하지 않는 코드(일단 몰라서 나둠)
[Browsable(false), Description("범위 : 0.0~1.0")]
public double OrientScore { get; set; }
[Browsable(false)]
public Size OrientROSSize { get; set; }
[Category("ROI Offset(Front)"), DisplayName("모션이동(Column)"), Description("비젼축(X)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '열'의 위치가 변경되면 이 옵셋이 적용 됩니다")]
public RoiOffset ROIOffsetColF { get; set; }
[Category("ROI Offset(Front)"), DisplayName("모션이동(Row)"), Description("셔틀축(Y)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '줄'의 위치가 변경되면 이 옵셋이 적용 됩니다.")]
public RoiOffset ROIOffsetRowF { get; set; }
[Category("ROI Offset(Front)"), DisplayName("기본옵셋"), Description("입력된 ROI기준으로 추가로 적용할 옵셋값 입니다")]
public RoiOffset ROIOffsetFront { get; set; }
[Category("ROI Offset(Front)"), DisplayName("개별간격"), Description("자동으로 생성되는 ROI(=Dummy ROI)에 적용하는 옵셋 값입니다. Theta 의 오류가 있는 경우 이 값을 통해서 ROI를 회전하는 효과를 얻을 수 있습니다")]
public RoiOffset ROIOffsetUnitTermFront { get; set; }
[Category("ROI Offset(Rear)"), DisplayName("모션이동(Column)"), Description("비젼축(X)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '열'의 위치가 변경되면 이 옵셋이 적용 됩니다")]
public RoiOffset ROIOffsetColR { get; set; }
[Category("ROI Offset(Rear)"), DisplayName("모션이동(Row)"), Description("셔틀축(Y)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '줄'의 위치가 변경되면 이 옵셋이 적용 됩니다.")]
public RoiOffset ROIOffsetRowR { get; set; }
[Category("ROI Offset(Rear)"), DisplayName("기본옵셋"), Description("입력된 ROI기준으로 추가로 적용할 옵셋값 입니다")]
public RoiOffset ROIOffsetRear { get; set; }
[Category("ROI Offset(Rear)"), DisplayName("개별간격"), Description("자동으로 생성되는 ROI(=Dummy ROI)에 적용하는 옵셋 값입니다. Theta 의 오류가 있는 경우 이 값을 통해서 ROI를 회전하는 효과를 얻을 수 있습니다")]
public RoiOffset ROIOffsetUnitTermRear { get; set; }
[Category("Common"), DisplayName("검사영역 간격"),Description("자동으로 생성되는 ROI(=Dummy ROI)의 간격입니다. 각 유닛의 Pitch 값이며, 화면을 보고 해당 간격을 맞추시기 바랍니다.")]
public Point UnitTerm { get; set; }
[Category("Common"), DisplayName("조명 밝기"), Description("조명의 밝기 입니다. 라이브영상으로 전환 후 화면 하단의 Light 영역내에서 그 값을 변경하며 확인할 수 있습니다. (입력범위 : 0~255)")]
public UInt16 LightValue { get; set; }
[Browsable(false), Category("Common"), Description("비젼 판독을 위한 설정 값")]
public CVisionProcess VisionParameter { get; set; }
public ModelInfoV()
{
VisionParameter = new CVisionProcess();
}
public void ReadValue(DataSet1.ModelRow dr)
{
this.Title = dr.Title;
this.idx = dr.idx;
}
public bool WriteValue()
{
var model = Pub.mdm.GetDataV(this.Title);
return WriteValue(ref model);
}
public bool WriteValue(ref DataSet1.ModelRow dr)
{
try
{
dr.Title = this.Title;
dr.EndEdit();
Pub.mdm.SaveModelV();
return true;
}
catch (Exception ex)
{
Pub.log.AddE("write model error" + ex.Message);
return false;
}
}
}
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class RoiOffset
{
[DisplayName("Horizon"), Description("수직(Y축) 변화 값(+는 아래쪽,-는 위쪽)")]
public double Y { get; set; }
[DisplayName("Vertical"), Description("수평(X축) 변화 값(+는 오른쪽,-는 왼쪽)")]
public double X { get; set; }
[Browsable(false)]
public bool IsEmpty { get { if (Y == 0 && X == 0) return true; else return false; } }
public RoiOffset(double start = 0.0, double end = 0.0)
{
this.Y = start;
this.X = end;
}
public override string ToString()
{
return string.Format("{0},{1}", Y, X);
}
public string toPointStr()
{
return string.Format("{0};{1}", Y, X);
}
}
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class Range
{
[DisplayName("시작값")]
public uint Start { get; set; }
[DisplayName("종료값")]
public uint End { get; set; }
[Browsable(false)]
public bool IsEmpty { get { if (Start == 0 && End == 0) return true; else return false; } }
public Range(UInt16 start, UInt16 end) : this((uint)start, (uint)end) { }
public Range(uint start = 0, uint end = 0)
{
this.Start = start;
this.End = end;
}
public static implicit operator RangeF(Range p)
{
return new RangeF((float)p.Start, (float)p.End);
}
public override string ToString()
{
return string.Format("{0}~{1}", Start, End);
}
}
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class RangeF
{
[DisplayName("시작값")]
public float Start { get; set; }
[DisplayName("종료값")]
public float End { get; set; }
[Browsable(false)]
public bool IsEmpty { get { if (Start == 0f && End == 0f) return true; else return false; } }
public RangeF(float start = 0f, float end = 0f)
{
this.Start = start;
this.End = end;
}
public static implicit operator Range(RangeF p)
{
return new Range((uint)p.Start, (uint)p.End);
}
public override string ToString()
{
return string.Format("{0}~{1}", Start, End);
}
}
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class CVisionProcess
{
[Category("특수설정(개발자용)"), Description("미사용(DOT 인식시에 사용했음)")]
public UInt16 halfKernel { get; set; }
[Category("특수설정(개발자용)"), Description("미사용(DOT 인식시에 사용했음)")]
public UInt16 Constant { get; set; }
[Category("특수설정(개발자용)"), DisplayName("MP_Dilate"),Description("미사용(DOT 인식시에 사용했음)")]
public UInt16 dilate { get; set; }
[Category("특수설정(개발자용)"), DisplayName("MP_Erode"), Description("미사용(DOT 인식시에 사용했음)")]
public UInt16 erode { get; set; }
[Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
public UInt16 open { get; set; }
[Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
public UInt32 segment_threshold { get; set; }
[Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
public Boolean isBlack { get; set; }
[Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
public UInt32 judg_runcount { get; set; }
[Category("유닛 감지"),DisplayName("밝기 기준값"), Description("입력된 값 이상의 데이터를 취합니다. 이 값이 낮을 수록 검출값이 높아지게 됩니다. 이 기준값으로 검출된 값으로 판정을 합니다. 유닛은 밝은 데이터를 보고 판정 하므로 이 기준값 이상의 데이터가 검출이 됩니다")]
public byte detect_threhosld { get; set; }
[Category("유닛 감지"),DisplayName("판정 기준값"), Description("판정을 하는 기준 값입니다. 밝기기준값으로 인해 검출된 값이 5000이라면. 이 판정 기준에 입력된 값이 5000보다 크면 유닛이 존재하는 것으로 판정하며, 그 보다 낮을 때에는 유닛이 없는 'Empty' 유닛으로 감지 됩니다")]
public UInt16 detect_count { get; set; }
[Category("유닛 감지"), DisplayName("*예외영역 판정기준"), Description("빈 유닛(=Empty) 일때 셔틀 프레임의 빛 반사가 심할 경우 해당 반사값에 의해 유닛이 감지됩니다. 그러한 데이터를 제거하기위해 이 값이 사용되며, 유닛검출에 사용하는 흰색영역의 값외에 추가로 검은색 덩어리를 검사합니다. 설정한 값사이의 검은색 덩어리가 검출되면 'Empty' 유닛으로 감지 됩니다")]
public Point detect_blobrange { get; set; }
[Category("2D 감지"), DisplayName("밝기 기준값"), Description("입력된 값 이하의 데이터를 취합니다. 이 값이 낮을 수록 검출값도 낮아지게 됩니다. 이 기준값으로 검출된 값으로 판정을 합니다. 2D는 어두운 데이터를 보고 판정 하므로 이 기준값 이하의 데이터가 검출이 됩니다")]
public byte detectDM_threhosld { get; set; }
[Category("2D 감지"), DisplayName("판정 기준값"), Description("판정을 하는 기준 값입니다. 밝기기준값으로 인해 검출된 값이 5000이라면. 이 판정 기준에 입력된 값이 5000보다 크면 ID가 존재하는 것으로 판정하며, 그 보다 낮을 때에는 ID가 없는 'New' 유닛으로 감지 됩니다")]
public UInt16 detectDM_count { get; set; }
public CVisionProcess()
{
}
public override string ToString()
{
return "비젼 설정 값";
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project
{
public class PositionData
{
public int index { get; set; }
public string title { get; set; }
public double value { get; set; }
public double speed { get; set; }
public double acc { get; set; }
public double dcc { get; set; }
public PositionData()
{
index = -1;
title = string.Empty;
value = 0.0;
this.speed = 0.0;
this.acc = 100.0;
this.dcc = 0.0;
}
public PositionData(int idx_, string title_, double value_)
{
this.index = idx_;
this.title = title_;
this.value = value_;
}
}
}

View File

@@ -0,0 +1,536 @@
using Emgu.CV.Structure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Project.Class
{
public class VisionData
{
public int RetryLoader { get; set; }
public List<string> bcdMessage { get; set; }
public Boolean LightOn { get; set; }
public DateTime STime; //비젼시작시간
public DateTime ETime; //비젼종료시간
public TimeSpan RunTime { get { return ETime - STime; } } //비젼동작시간
public DateTime GTime; //이미지수집시간
public string FileNameL; //로딩존 촬영
public string FileNameU; //언로딩존 촬영
public Boolean Complete;
//public Boolean AngleQR { get; set; }
//public Boolean AngleSTD { get; set; }
//public double Angle { get; set; }
//public Boolean IsAngleSet
//{
// get
// {
// if (AngleQR == false && AngleSTD == false && Angle == 0.0) return true;
// else return false;
// }
//}
public double ApplyAngle { get; set; } //적용된 회전 각도
public Boolean NeedCylinderForward { get; set; } //부착시 실린더를 올려야하는가
public Boolean ApplyOffset { get; set; }
public Boolean BaseAngle(out string msg, out KeyenceBarcodeData bcd)
{
msg = string.Empty;
bcd = null;
//데이터없다면 회전하지 못한다.
if (this.barcodelist == null || this.barcodelist.Count < 1)
{
msg = "No barcode data";
return false;
}
//사용자가 확정한 코드를 우선으로 한다
bcd = barcodelist.Where(t => t.UserActive).FirstOrDefault();
if (bcd != null)
{
//angle = bcd.Angle;
msg = "User Active";
return true;
}
//표준바코드를 최우선 으로 사용
//15자리 기존 바코드는 angle 로 사용하지 않는다.
bcd = barcodelist.Where(t => t.isSTDBarcode && t.isNewLen15 == false).FirstOrDefault();
if (bcd != null)
{
//angle = bcd.Angle;
msg = "STD Barcode";
return true;
}
//QR코드를 우선으로 사용 - return 릴은 적용하지 안게한다.
//RQ코드가 적용되지 않게한다 210824
bcd = barcodelist.Where(t => t.sym == "1" && t.isNewLen15 == false && t.Data.EndsWith(";;;") == false && t.Data.StartsWith("RQ")==false).FirstOrDefault();
if (bcd != null)
{
//angle = bcd.Angle;
msg = "QR Code";
return true;
}
//첫번쨰 아이템을 우선으로 사용
if (barcodelist.Count == 1)
{
bcd = barcodelist[0];
msg = "First Barcode = " + bcd.Data;
return true;
}
else
{
//여러개가 있음
bcd = barcodelist.Where(t => t.sym == "0").FirstOrDefault();
if (bcd != null)
{
msg = "1D Data";
return true;
}
else
{
bcd = barcodelist[0];
msg = "first";
return true;
}
}
// angle = bcd.Angle;
//return true;
} //모션회전각도
public Boolean Ready { get; set; }
public Boolean ServerUpdate { get; set; }
public Boolean Confirm { get { return ConfirmAuto || ConfirmUser; } }
public Boolean ConfirmUser { get; set; }
public Boolean ConfirmAuto { get; set; }
public Boolean ValidSkipbyUser { get; set; }
public string QTY0 { get; set; } //원본수량
public string QTY { get; set; } //바코드수량(=서버수량)
/// <summary>
/// QTY값이 RQ에서 입력된 데이터인가?
/// </summary>
public Boolean QTYRQ { get; set; }
public string SID0 { get; set; } //원본SID
public string SID { get; set; } //바코드
private string _rid = string.Empty;
public string RID
{
get { return _rid; }
} //바코드
public void SetRID(string value, string reason)
{
//값이 변경될때 로그에 변경
if (_rid.Equals(value) == false)
{
Pub.AddDebugLog(string.Format("RID 변경 {0} -> {1} by {2}", _rid, value, reason));
}
_rid = value;
}
public string RID0 { get; set; }
public string VLOT { get; set; }
public string VNAME { get; set; }
//public string SCODE { get; set; } //서플라이코드 210219
public string MFGDATE { get; set; }
public string PARTNO { get; set; }
public Boolean HASHEADER { get; set; }
public string temp_custcode { get; set; }
public string temp_custname { get; set; }
/// <summary>
/// 데이터가 모두존재하는지 확인
/// </summary>
public Boolean DataValid
{
get
{
if (Confirm == false) return false;
return QTY.isEmpty() == false &&
SID.isEmpty() == false &&
RID.isEmpty() == false &&
VLOT.isEmpty() == false &&
VNAME.isEmpty() == false &&
MFGDATE.isEmpty() == false &&
PARTNO.isEmpty();
}
}
public Boolean PrintPositionCheck { get; set; }
public string PrintPositionData { get; set; }
//상단위치에 프린트를 할것인가?
//프린트위치에 따른다
public ePrintPutPos GetPrintPutPosition()
{
//하단에 찍는경우이다
if (PrintPositionData == "1" ||
PrintPositionData == "2" ||
PrintPositionData == "3")
{
return ePrintPutPos.Bottom;
}
else if (PrintPositionData == "7" ||
PrintPositionData == "8" ||
PrintPositionData == "9")
{
return ePrintPutPos.Top;
}
else if (PrintPositionData == "4") //왼쪽
{
return ePrintPutPos.Middle;
}
else if (PrintPositionData == "6") //오른쪽
{
return ePrintPutPos.Middle;
}
else return ePrintPutPos.None;
}
//public string LabelPos { get; set; }
//public Boolean PrintForce { get; set; }
public eCartSize ReelSize { get; set; }
public string QTY2 { get; set; } //바코드수량
public string SID2 { get; set; } //바코드
public string RID2 { get; set; } //바코드
public string VLOT2 { get; set; }
public string MANU2 { get; set; }
public string MFGDATE2 { get; set; }
public string PARTNO2 { get; set; }
public Emgu.CV.Image<Gray, Byte> image { get; private set; } //최종수집된 이미지
public void SetImage(Emgu.CV.Image<Gray, Byte> img_)
{
if (this.image != null)
{
this.image.Dispose();
this.image = null;
}
//이미지를 신규로 해성하고 데이터를 복사한다 210121
this.image = new Emgu.CV.Image<Gray, byte>(img_.Size);
img_.CopyTo(this.image);
}
public System.Drawing.Color GetColorByBarcodeCount(int idx)
{
if (QRPositionData[idx] > 0) return Color.Gold; //QR데이터가있다면 금색으로 한다
var Cnt = LabelPositionData[idx];
if (Cnt == MaxBarcodePosData) return Color.Purple;
else if (Cnt == 0) return Color.FromArgb(32, 32, 32);
{
//나머진 숫자별로 데이터를 표시한다 (
var GValue = Cnt * 10;
if (GValue > 255) GValue = 255;
return Color.FromArgb(32, 32, GValue);
}
}
public Boolean isMaxBarcodePosition(int idx)
{
return LabelPositionData[idx] == MaxBarcodePosData;
}
public byte[] QRPositionData { get; private set; }
public byte[] LabelPositionData { get; private set; }
private List<Class.KeyenceBarcodeData> _barcodelist;
//리더기로부터 읽은 자료 모두가 들어잇다
public List<Class.KeyenceBarcodeData> barcodelist
{
get { return _barcodelist; }
set
{
this._barcodelist = value;
UpdateBarcodePositionData();
}
}
public byte MaxBarcodePosData { get; private set; }
/// <summary>
/// 바코드목록을 이용해서 라벨위치 분포값을 변경합낟.
/// 해당 위치값은 labelposdata로 접근가능함
/// </summary>
public void UpdateBarcodePositionData()
{
LabelPositionData[0] = (byte)_barcodelist.Where(t => t.LabelPosition == 1).Count();
LabelPositionData[1] = (byte)_barcodelist.Where(t => t.LabelPosition == 2).Count();
LabelPositionData[2] = (byte)_barcodelist.Where(t => t.LabelPosition == 3).Count();
LabelPositionData[3] = (byte)_barcodelist.Where(t => t.LabelPosition == 4).Count();
LabelPositionData[4] = (byte)_barcodelist.Where(t => t.LabelPosition == 6).Count();
LabelPositionData[5] = (byte)_barcodelist.Where(t => t.LabelPosition == 7).Count();
LabelPositionData[6] = (byte)_barcodelist.Where(t => t.LabelPosition == 8).Count();
LabelPositionData[7] = (byte)_barcodelist.Where(t => t.LabelPosition == 9).Count();
QRPositionData[0] = (byte)_barcodelist.Where(t => t.LabelPosition == 1 && t.AmkorData.isValid).Count();
QRPositionData[1] = (byte)_barcodelist.Where(t => t.LabelPosition == 2 && t.AmkorData.isValid).Count();
QRPositionData[2] = (byte)_barcodelist.Where(t => t.LabelPosition == 3 && t.AmkorData.isValid).Count();
QRPositionData[3] = (byte)_barcodelist.Where(t => t.LabelPosition == 4 && t.AmkorData.isValid).Count();
QRPositionData[4] = (byte)_barcodelist.Where(t => t.LabelPosition == 6 && t.AmkorData.isValid).Count();
QRPositionData[5] = (byte)_barcodelist.Where(t => t.LabelPosition == 7 && t.AmkorData.isValid).Count();
QRPositionData[6] = (byte)_barcodelist.Where(t => t.LabelPosition == 8 && t.AmkorData.isValid).Count();
QRPositionData[7] = (byte)_barcodelist.Where(t => t.LabelPosition == 9 && t.AmkorData.isValid).Count();
MaxBarcodePosData = LabelPositionData.Max(t => t);
}
/// <summary>
/// Data1(인쇄전 인식데이터) 과 Data2(QR)가 동일한지 비교합니다.
/// </summary>
public Boolean MatchValidation
{
get
{
if (PARTNO == null) this.PARTNO = string.Empty;
if (PARTNO2 == null) this.PARTNO2 = string.Empty;
if (QTY == null) QTY = string.Empty;
if (QTY2 == null) QTY2 = string.Empty;
if (SID == null) SID = string.Empty;
if (SID2 == null) SID2 = string.Empty;
if (VLOT == null) VLOT = string.Empty;
if (VLOT2 == null) VLOT2 = string.Empty;
if (PARTNO == null) PARTNO = string.Empty;
if (PARTNO2 == null) PARTNO2 = string.Empty;
if (QTY.Equals(QTY2) == false)
{
Pub.log.AddE(string.Format("QR검증실패 수량:{0} != {1}", QTY, QTY2));
return false;
}
if (RID.Equals(RID2) == false)
{
Pub.log.AddE(string.Format("QR검증실패 RID:{0} != {1}", RID, RID2));
return false;
}
if (VLOT.Equals(VLOT2) == false)
{
Pub.log.AddE(string.Format("QR검증실패 VLOT:{0} != {1}", VLOT, VLOT2));
return false;
}
if (PARTNO.Equals(PARTNO2) == false)
{
Pub.log.AddE(string.Format("QR검증실패 PARTNO:{0} != {1}", PARTNO, PARTNO2));
return false;
}
if (SID.Equals(SID2) == false)
{
Pub.log.AddE(string.Format("QR검증실패 SID:{0} != {1}", SID, SID2));
return false;
}
return true;
}
}
public string QRInputRaw { get; set; } //입력에 사용한 RAW
public string QROutRaw { get; set; } //부착된 QR코드의 값
public string ZPL { get; set; } //출력시 사용한 ZPL
public string QRData { get; set; } //출력시 사용한 ZPL에 포함된 QR데이터
public VisionData(string reason)
{
Clear(reason, false);
}
public Boolean isEmpty()
{
return RID.isEmpty();
}
public void Clear(string reason, Boolean timeBackup)
{
RetryLoader = 0;
ApplyOffset = false;
var baktime = new DateTime(1982, 11, 23);
if (timeBackup) baktime = this.STime;
bcdMessage = new List<string>();
HASHEADER = false;
temp_custcode = string.Empty;
temp_custname = string.Empty;
RID0 = string.Empty;
LightOn = false;
//SCODE = string.Empty;
ValidSkipbyUser = false;
NeedCylinderForward = false;
ApplyAngle = 0;
MaxBarcodePosData = 0;
PrintPositionCheck = false;
LabelPositionData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };
QRPositionData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };
ReelSize = eCartSize.None;
// PrintForce = false;
ConfirmAuto = false;
ConfirmUser = false;
if (image != null)
{
image.Dispose();
image = null;
}
ServerUpdate = false;
PrintPositionData = "";
//LabelPos = "";
_barcodelist = new List<KeyenceBarcodeData>();
QRInputRaw = string.Empty;
QROutRaw = string.Empty;
ZPL = string.Empty;
QRData = string.Empty;
STime = baktime;// DateTime.Parse("1982-11-23");
ETime = DateTime.Parse("1982-11-23");
GTime = DateTime.Parse("1982-11-23");
Complete = false;
//Angle = 0.0;
//AngleQR = false;
//AngleSTD = false;
Ready = false;
QTY0 = string.Empty;
QTY = string.Empty;// string.Empty;
QTYRQ = false;
Pub.log.AddI($"비젼개체 CLEAR 로 RQ 상태 초기화(false)");
SID0 = string.Empty;
SID = string.Empty;
//RID = string.Empty;
SetRID(string.Empty, reason);
VLOT = string.Empty;
MFGDATE = string.Empty;
VNAME = string.Empty;
PARTNO = string.Empty;
QTY2 = "0";// string.Empty;
SID2 = string.Empty;
RID2 = string.Empty;
VLOT2 = string.Empty;
MFGDATE2 = string.Empty;
MANU2 = string.Empty;
PARTNO2 = string.Empty;
FileNameL = string.Empty;
FileNameU = string.Empty;
Pub.log.Add($"Vision Data Clear : {reason}");
}
public void CopyTo(ref VisionData obj)
{
//바코드메세지 복사
obj.bcdMessage = new List<string>();
foreach (var item in this.bcdMessage)
obj.bcdMessage.Add(item);
obj.ApplyOffset = this.ApplyOffset;
obj.ConfirmAuto = this.ConfirmAuto;
obj.ConfirmUser = this.ConfirmUser;
obj.temp_custcode = this.temp_custcode;
obj.temp_custname = this.temp_custname;
obj.LightOn = this.LightOn;
//obj.SCODE = this.SCODE;
obj.ValidSkipbyUser = this.ValidSkipbyUser;
obj.NeedCylinderForward = this.NeedCylinderForward; //210207
obj.ApplyAngle = this.ApplyAngle; //210207
obj.STime = this.STime;
obj.ETime = this.ETime;
obj.GTime = this.GTime;
obj.FileNameL = this.FileNameL;
obj.FileNameU = this.FileNameU;
obj.Complete = this.Complete;
//obj.Angle = this.Angle;
//obj.AngleQR = this.AngleQR;
//obj.AngleSTD = this.AngleSTD;
obj.Ready = this.Ready;
obj.QTY = this.QTY;
obj.QTYRQ = this.QTYRQ;
obj.SID = this.SID;
obj.SID0 = this.SID0; //210331
obj.SetRID(this.RID, "copy");// obj.RID = this.RID;
obj.RID0 = this.RID0;
obj.VLOT = this.VLOT;
obj.VNAME = this.VNAME;
obj.MFGDATE = this.MFGDATE;
obj.PARTNO = this.PARTNO;
obj.QTY2 = this.QTY2;
obj.SID2 = this.SID2;
obj.RID2 = this.RID2;
obj.VLOT2 = this.VLOT2;
obj.MANU2 = this.MANU2;
obj.MFGDATE2 = this.MFGDATE;
obj.PARTNO2 = this.PARTNO2;
obj.QRInputRaw = this.QRInputRaw;
obj.QROutRaw = this.QROutRaw;
obj.ZPL = this.ZPL;
obj.QRData = this.QRData;
obj.PrintPositionData = this.PrintPositionData;
//obj.PrintForce = this.PrintForce;
obj.ReelSize = this.ReelSize;
obj.PrintPositionCheck = this.PrintPositionCheck;
//라벨위치값 복사
for (int i = 0; i < obj.LabelPositionData.Length; i++)
obj.LabelPositionData[i] = this.LabelPositionData[i];
for (int i = 0; i < obj.QRPositionData.Length; i++)
obj.QRPositionData[i] = this.QRPositionData[i];
if (obj.image != null)
{
obj.image.Dispose();
obj.image = null;
}
//이미지를 복사해준다. 210121
if (this.image != null)
{
obj.image = new Emgu.CV.Image<Gray, byte>(this.image.Size);
this.image.CopyTo(obj.image);
}
//바코드 데이터를 복사해준다.
obj.barcodelist = new List<KeyenceBarcodeData>();
if (this.barcodelist.Count > 0)
{
foreach (var bcd in this.barcodelist)
{
var newitema = new KeyenceBarcodeData
{
Angle = bcd.Angle,
CenterPX = new Point(bcd.CenterPX.X, bcd.CenterPX.Y),
Data = bcd.Data,
LabelPosition = bcd.LabelPosition,
UserActive = bcd.UserActive,
sym = bcd.sym,
};
newitema.vertex = new Point[bcd.vertex.Length];
bcd.vertex.CopyTo(newitema.vertex, 0);
bcd.AmkorData.CopyTo(newitema.AmkorData);
obj.barcodelist.Add(newitema);
}
}
}
}
}