diff --git a/AuroraDevices/AuroraCellTracker/CellTracker.cs b/AuroraDevices/AuroraCellTracker/CellTracker.cs index 29d151e..fe385fc 100644 --- a/AuroraDevices/AuroraCellTracker/CellTracker.cs +++ b/AuroraDevices/AuroraCellTracker/CellTracker.cs @@ -26,7 +26,7 @@ namespace AuroraCellTracker public class CellTracker : Device { Logger _Logger = new Logger("CellTracker"); - ICellTracker _CellTracker; + public ICellTracker _CellTracker; public CellTrackerConfig _CellTrackerConfig { get; set; } private ICellTracker[] _MultiCellTrackerObj = new ICellTracker[4]; diff --git a/AuroraDevices/AuroraCellTracker/DaekhonCoporation/CellTrackerDaekhon.cs b/AuroraDevices/AuroraCellTracker/DaekhonCoporation/CellTrackerDaekhon.cs index 9717272..7d7189a 100644 --- a/AuroraDevices/AuroraCellTracker/DaekhonCoporation/CellTrackerDaekhon.cs +++ b/AuroraDevices/AuroraCellTracker/DaekhonCoporation/CellTrackerDaekhon.cs @@ -149,6 +149,8 @@ namespace AuroraCellTracker.DaekhonCoporation { string lotId = "", cellId = ""; + bool gotNew = false; + if (selectedMode == eMode.Queue) { if (null != dllSocketCtrl) { string str = dllSocketCtrl.DllSocket_GetReceiveMessageInQueue(true, true); @@ -158,6 +160,7 @@ namespace AuroraCellTracker.DaekhonCoporation CalcCellInfo(str, out lotId, out cellId); SetCellInfo(lotId, cellId); + gotNew = true; } else CellInfoStrings.ReceiveStrInQueue = "Receive Length is 0"; } else @@ -166,27 +169,33 @@ namespace AuroraCellTracker.DaekhonCoporation _Logger.D(string.Format($"{CellInfoStrings.ReceiveStrInQueue}")); } else if (selectedMode == eMode.Callback) { // Callback 방식의 경우, 자체 ConcurrentQueue에서 Deque해서 가져와야 함 - CellInfoStr info; - + CellInfoStr info; if (CellInfoQueue.TryDequeue(out info)) { SetCellInfo(info.LotID, info.CellID); + gotNew = true; } } - // Queue 방식인데 Cell Tracker에서 메세지가 안 왔거나, Callback 방식인데 Cell Tracker API 함수가 Callback 안 된 경우(ex : ECS 오프라인 모드), + // Queue 방식인데 Cell Tracker에서 메세지가 안 왔거나, + // Callback 방식인데 실제 수신이 없거나(또는 같은 값이 연속으로 들어오는 경우), // Lot ID/Cell ID를 ES 지정사양에 맞추어 생성 - if (OldLotId == CellInfoStrings.LotID && OldCellId == CellInfoStrings.CellID) { + if (!gotNew || (OldLotId == CellInfoStrings.LotID && OldCellId == CellInfoStrings.CellID)) { CalcCellInfo("", out lotId, out cellId); AddCellInfo(lotId, cellId); CellInfoStr info; - if (CellInfoQueue.TryDequeue(out info)) - { + if (CellInfoQueue.TryDequeue(out info)) { SetCellInfo(info.LotID, info.CellID); + } else { + // 새로운 값이 안들어와도 일단 보여줌 + SetCellInfo(lotId, cellId); } } + OldLotId = CellInfoStrings.LotID; OldCellId = CellInfoStrings.CellID; + + _Logger.I($"Received CellInfo >> count({CellInfoQueue.Count})"); } public void SendData(string str, bool isSendToUpperSystem = false) diff --git a/Machines/ILSOS_CCW_H52A/Device/Scanner/ScannerList.cs b/Machines/ILSOS_CCW_H52A/Device/Scanner/ScannerList.cs index a06d2a2..2ac8466 100644 --- a/Machines/ILSOS_CCW_H52A/Device/Scanner/ScannerList.cs +++ b/Machines/ILSOS_CCW_H52A/Device/Scanner/ScannerList.cs @@ -66,6 +66,7 @@ namespace ILSOS_CCW_H52A.Device public bool CheckSendCellinfo { get; set; } public bool CheckSendPLCLaserPower { get; set; } public bool ReportComplete { get; set; } + public void SetReportComplete(bool comp) => ReportComplete = comp; public override string ToString() => string.Format("{0},WriteTime({1}),WeldingCount({2}),StartAngle({3}),JigNo({4}),CanExist({5}),LotId({6}),CellId({7})", ListNo, WriteTime.ToString("HHmmss.fff"), WeldingCount, StartAngle, JigNo, CanExist, LotId, CellId); diff --git a/Machines/ILSOS_CCW_H52A/ILSOS_CCW_H52A.csproj b/Machines/ILSOS_CCW_H52A/ILSOS_CCW_H52A.csproj index 67fa239..1b10f5d 100644 --- a/Machines/ILSOS_CCW_H52A/ILSOS_CCW_H52A.csproj +++ b/Machines/ILSOS_CCW_H52A/ILSOS_CCW_H52A.csproj @@ -106,7 +106,8 @@ - + + diff --git a/Machines/ILSOS_CCW_H52A/Sequences/ProcessManager.cs b/Machines/ILSOS_CCW_H52A/Sequences/ProcessObjects/ProcessManager.cs similarity index 96% rename from Machines/ILSOS_CCW_H52A/Sequences/ProcessManager.cs rename to Machines/ILSOS_CCW_H52A/Sequences/ProcessObjects/ProcessManager.cs index 9b71740..7af96f0 100644 --- a/Machines/ILSOS_CCW_H52A/Sequences/ProcessManager.cs +++ b/Machines/ILSOS_CCW_H52A/Sequences/ProcessObjects/ProcessManager.cs @@ -5,6 +5,7 @@ using AuroraLaserScanner; using AuroraPLC; using ILSOS_CCW_H52A.Device; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; @@ -12,9 +13,10 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using WeldingCommon; +using WeldingCommon.Data; using static ILSOS_CCW_H52A.Device.PLCControllerCCWH52A; -namespace ILSOS_CCW_H52A.Sequences +namespace ILSOS_CCW_H52A.Sequences.ProcessObjects { public class ProcessManager { @@ -40,6 +42,7 @@ namespace ILSOS_CCW_H52A.Sequences public double DegreePerJig { get => RotaryMaxAngle / RotaryJigCount; } public double HalfDegreePerJig { get => DegreePerJig / 2; } + //public ConcurrentQueue public void Init(IAuroraEnvironment env) { _env = env; diff --git a/Machines/ILSOS_CCW_H52A/Sequences/ProcessObjects/ReceivedCellInfo.cs b/Machines/ILSOS_CCW_H52A/Sequences/ProcessObjects/ReceivedCellInfo.cs new file mode 100644 index 0000000..31254a7 --- /dev/null +++ b/Machines/ILSOS_CCW_H52A/Sequences/ProcessObjects/ReceivedCellInfo.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ILSOS_CCW_H52A.Sequences.ProcessObjects +{ + public class ReceivedCellInfo + { + + public ReceivedCellInfo() { + + } + } +} diff --git a/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs b/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs index 8aa9fa4..2ce0451 100644 --- a/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs +++ b/Machines/ILSOS_CCW_H52A/Sequences/SeqAutoRunCCWH52A.cs @@ -1,8 +1,10 @@ using Aurora; using Aurora.Api; using Aurora.Api.Manager; +using Aurora.Util.HislogPlus; using Aurora.View; using AuroraCellTracker; +using AuroraCellTracker.DaekhonCoporation; using AuroraIO; using AuroraLaser; using AuroraLaserScanner; @@ -458,8 +460,8 @@ namespace ILSOS_CCW_H52A.Sequences WaitingScannerList.Reset(); CompleteScannerList.Reset(); - isTheFirstListWrite = false; // 작업 시작 시 처음 2개의 List는 입력하고 시작한다 - isTheSecondListWrite = false; + isTheFirstListWrite = true; // 작업 시작 시 처음 2개의 List는 입력하고 시작한다 + isTheSecondListWrite = true; isTheFirstListExecute = true; // 제일 첫 List는 ExecuteList 필요. 이후는 AutoChange _PLC.WriteBit(eBitOutput.PC_AUTO_STATUS, true); @@ -1031,6 +1033,10 @@ namespace ILSOS_CCW_H52A.Sequences return null; } + // 중복 보고 방지 플래그 세팅 + CompleteScannerList.SetReportComplete(true); + isWeled = false; + return SequenceAction.Ok(); } @@ -1054,12 +1060,23 @@ namespace ILSOS_CCW_H52A.Sequences } // END ALL #endregion - private static string CheckCanWelded(SequenceContext context, string id, ICollection branches, SequenceActionResult param) + private string CheckCanWelded(SequenceContext context, string id, ICollection branches, SequenceActionResult param) { - if (isWeled) + // 중복 보고 방지: + // - CanExist=false (skip 대상) 는 보고하지 않음(미사용) + // - WeldComplete=false (레이저 ON 감지/완료 처리 전) 는 보고하지 않음(미사용) + // - ReportComplete=true (이미 보고 완료) 는 다시 보고하지 않음 + // .시퀀스가 너무 빨리 내려가서 보고하는 케이스로 예상 + + // 보고 누락: + // - 첫번째, 두번째는 UploadWeldingList를 해야하기 때문에 일단 넘긴다. + if (isWeled + //CompleteScannerList.CanExist && + //CompleteScannerList.WeldComplete && + && !CompleteScannerList.ReportComplete) return SEQ_SET_PARAMS_REPORT_CELL_RESULT_SEQ; - else - return SEQ_CHECK_CYCLE_STOP; + + return SEQ_CHECK_CYCLE_STOP; } private void SaveCellAPD() @@ -1194,6 +1211,13 @@ namespace ILSOS_CCW_H52A.Sequences { Status.EquipmentMode = eEquipmentMode.MANUAL; + if((_CellTracker._CellTracker as CellTrackerDaekhon) != null && _CellTracker._CellTracker is CellTrackerDaekhon tracker){ + Log.I($"Stoped Seq >> CellTracker Recv Queue count ({tracker.CellInfoQueue.Count})"); + foreach (var info in tracker.CellInfoQueue.Select((value, index) => (value, index))) { + Log.I($"[{info.index}]Queue >> CellId[{info.value.CellID}] / LotId[{info.value.LotID}]"); + } + } + //PLC All BIT OFF for (int i = 0; i < _RotaryJigCount; i++) _PLC.WriteBit(eBitOutput.PC_WELD_COMPLETE_1 + i, false);