private void InputSignalCheck() { if (false == IsInitialize) { return; } short[] _BitNum = new short[IOCnt]; for (int iLoopCount = 0; iLoopCount < IOCnt; ++iLoopCount) { _BitNum[iLoopCount] = (short)iLoopCount; } if (DigitalIO.InputMultiBitData(_BitNum, IOCnt, InputMultiSignal) != (int)CDioConst.DIO_ERR_SUCCESS) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "Input Check Error"); return; } for (int iLoopCount = 0; iLoopCount < IOCnt; iLoopCount++) { if (InputMultiSignal[iLoopCount] == (short)DIOEnum.ON) { ControlInvoke(btnInputSignal[iLoopCount], Color.DarkGreen); } else if (InputMultiSignal[iLoopCount] == (short)DIOEnum.OFF) { ControlInvoke(btnInputSignal[iLoopCount], Color.Maroon); } } }
private bool Inspection(CogImage8Grey _SrcImage, CogRectangle _InspArea, bool _IsRotate = false) { bool _Result = true; try { if (true == _IsRotate) { CogRectangleAffine _Area = new CogRectangleAffine(); _Area.SetCenterLengthsRotationSkew(_InspArea.CenterX, _InspArea.CenterY, _InspArea.Width, _InspArea.Height, -3.14, 0); IDResults = IDProc.Execute(_SrcImage, _Area); } else { IDResults = IDProc.Execute(_SrcImage, _InspArea); } } catch (Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "InspectionID - Inspection Exception : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW); _Result = false; } return(_Result); }
private void ThreadImageAutoDeleteFunc() { DateTime TimeNow; bool IsDeleted = false; try { while (false == IsThreadImageAutoDeleteExit) { TimeNow = DateTime.Now; if (true == IsThreadImageAutoDeleteTrigger) { if (TimeNow.Hour == 0 && IsDeleted == false) { IsThreadImageAutoDeleteTrigger = false; TimeNow = TimeNow.AddDays(-GetDeleteDate()); SetDeleteFolderName(TimeNow); IsDeleted = true; } else if (TimeNow.Hour != 0) { IsDeleted = false; } } Thread.Sleep(100); } } catch (System.Exception ex) { //MessageBox.Show(new Form { TopMost = true }, ex.Message + " ->" + ex.StackTrace); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format(ex.Message + " ->" + ex.StackTrace), CLogManager.LOG_LEVEL.LOW); } }
private void ThreadSignalToggleFunc() { try { SleepTime = 10; while (false == IsThreadSignalToggleExit) { for (int iLoopCount = SignalToggleList.Count - 1; iLoopCount >= 0; --iLoopCount) { SignalToggleList[iLoopCount].ToggleTime -= SleepTime; if (SignalToggleList[iLoopCount].ToggleTime <= 0) { byte _Data = Convert.ToByte(!SignalToggleList[iLoopCount].CurrentSignal); DigitalIO.OutputBitData(SignalToggleList[iLoopCount].Signal, _Data); SignalToggleList.RemoveAt(iLoopCount); } } Thread.Sleep(SleepTime); } } catch (System.Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "ThreadSignalToggleFunc Err : " + ex.Message, CLogManager.LOG_LEVEL.LOW); } }
private void rbExit_Click(object sender, EventArgs e) { try { for (int iLoopCount = 0; iLoopCount < ISMModuleCount; ++iLoopCount) { InspSysManager[iLoopCount].ImageContinuesGrabStop(); } DialogResult dlgResult = MessageBox.Show(new Form { TopMost = true }, "Do you want exit program ? ", "Exit Program", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2); if (DialogResult.Yes != dlgResult) { return; } CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "MainProcess : CIPOS lead inspection program exit!!"); DeInitialize(); Environment.Exit(0); } catch (Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "MainForm Exit : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW); Environment.Exit(0); } }
public void UpdateReceiveString(string _RecvMessage) { //ㄱ,1,0.05,0.02,0.03,0.01,ㄴ string _RecvString = _RecvMessage.Trim(); _RecvString = _RecvString.Replace(" ", ""); string[] _RecvCmd = _RecvString.Split(','); for (int iLoopCount = 0; iLoopCount < _RecvCmd.Length; ++iLoopCount) { CommandQueue.Enqueue(_RecvCmd[iLoopCount]); } if (true == ProtocolCommandProcess()) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "Receive Data : " + _RecvString); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "ProtocolCommandProcess : Good"); } else { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "Receive Data : " + _RecvString); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "ProtocolCommandProcess : Bad"); } ControlInvoke(textBoxRecvString, _RecvString); }
public void Connection() { try { SockArgs.Dispose(); SockArgs = new SocketAsyncEventArgs(); SockArgs.RemoteEndPoint = IPEndPoint; SockClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); SockClient.ConnectAsync(SockArgs); if (ThreadClientReceive != null && ThreadClientReceive.IsAlive == false) { Thread.Sleep(100); ClientStart(); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "ThreadClientReceive Start"); } IsInitialize = true; } catch { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "Connect Exception", CLogManager.LOG_LEVEL.LOW); } }
private void WaitingRoofFunction(byte[] _SendData) { while (RetryCount < RETRY_COUNT - 1) { lock (Lock_Recv) { string _Command = Encoding.Unicode.GetString(_SendData); if (_Command.IndexOf("ACK") != -1) { break; } if (false == WaitReceiveMessage(300, 10)) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.WARN, @"ASK/NAK Return Message TimeOut(" + _Command + ") : " + RetryCount.ToString()); } else { } } RetryCount++; } }
private void ThreadInspectionFunction() { try { while (false == IsThreadInspectionExit) { if (true == IsThreadInspectionTrigger) { IsThreadInspectionTrigger = false; InspWnd.IsInspectionComplete = false; CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("Vision : ISM{0} IsInspectionComplete false", ID + 1), CLogManager.LOG_LEVEL.LOW); if (!IsSimulationMode) { ImageGrabSnap(); } else { InspWnd.IsThreadInspectionProcessTrigger = true; } Thread.Sleep(50); } Thread.Sleep(10); } } catch (System.Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "ThreadInspectionFunction Exception : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW); } }
private void btnRecipeAdd_Click(object sender, EventArgs e) { IsRecipeNew = true; RecipeNewNameWindow _RcpNewNameWnd = new RecipeNewNameWindow(ProjectType); _RcpNewNameWnd.RecipeCopyEvent += new RecipeNewNameWindow.RecipeCopyHandler(RecipeCopyEventFunction); string[] _RecipeList = new string[listBoxRecipe.Items.Count]; for (int iLoopCount = 0; iLoopCount < _RecipeList.Count(); ++iLoopCount) { _RecipeList[iLoopCount] = listBoxRecipe.Items[iLoopCount].ToString(); } _RcpNewNameWnd.SetCurrentRecipe("[Default]", _RecipeList); if (_RcpNewNameWnd.ShowDialog() == DialogResult.OK) { LoadRecipeList(); this.Hide(); CParameterManager.SystemMode = eSysMode.RCP_MANUAL_CANGE; RecipeChange(_RcpNewNameWnd.NewRecipeName, "[Default]"); this.Show(); } CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "RecipeWindow - RecipeAdd Complete", CLogManager.LOG_LEVEL.LOW); _RcpNewNameWnd.RecipeCopyEvent -= new RecipeNewNameWindow.RecipeCopyHandler(RecipeCopyEventFunction); IsRecipeNew = false; }
private bool LOTChange(string _LOTInfo) { bool _Result = false; string[] _LOTInfoTemp = _LOTInfo.Split(','); string _LOTName = _LOTInfoTemp[1]; try { if (_LOTName == "LotEnd") { ResultBaseWnd.LOTEnd(); ResultBaseWnd.ClearResultData(); } else { ResultBaseWnd.ClearResultData(_LOTName, ParamManager.SystemParam.InDataFolderPath, ParamManager.SystemParam.OutDataFolderPath); ResultBaseWnd.LOTStart(_LOTInfoTemp); string IndataTotalCount = ResultBaseWnd.GetTotalCount(); if (IndataTotalCount != null) { MainProcess.SendSerialData(eMainProcCmd.LOT_RETURN, IndataTotalCount); } } _Result = true; } catch (Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("Main : LOTChange Exception!!!"), CLogManager.LOG_LEVEL.LOW); } return(_Result); }
private void SetResultData(object _Result) { SendResultParameter _SendResParam = _Result as SendResultParameter; ResultBaseWnd.SetResultData(_SendResParam); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("Main : SetResultData")); }
/// <summary> /// single Insert,update,delete /// </summary> /// <param name="_sql">완성된 Insert,update,delete 문</param> /// <returns></returns> public static int SqlExecute(string _SqlQuery, bool _CreateTable, string _CreateComm = "") { try { string StrFilePath = String.Format(@"{0}\History.db", connStrFolderPath); StrFilePath = String.Format(@"{0}{1}; PRAGMA Journa_Mode=WAL", connStr, StrFilePath); using (SQLiteConnection SQLiteConnection = new SQLiteConnection(StrFilePath)) { SQLiteConnection.Open(); SQLiteCommand SQLiteComm; int iRet = 0; if (_CreateTable == true) { // string CreateComm = ""; // CreateComm = string.Format("{0} (Date Datetime, RecipeName char, Result char, ResultX char, ResultTheta char, InspResult char, SendResult char, InspImagePath char);", SqlDefine.CREATE_TABLE); SQLiteComm = new SQLiteCommand(_CreateComm, SQLiteConnection); iRet = SQLiteComm.ExecuteNonQuery(); } SQLiteComm = new SQLiteCommand(_SqlQuery, SQLiteConnection); iRet = SQLiteComm.ExecuteNonQuery(); SQLiteConnection.Close(); return(iRet); } } catch (System.Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "SqliteManager SqlExecute Exception!!", CLogManager.LOG_LEVEL.LOW); return(0); } }
private void OutputSignalCheck() { if (false == IsInitialize) { return; } short[] _BitNum = new short[IOCnt]; byte[] _Data = new byte[IOCnt]; for (int iLoopCount = 0; iLoopCount < IOCnt; ++iLoopCount) { _BitNum[iLoopCount] = (short)iLoopCount; } if (DigitalIO.OutputEchoBackMultiBitData(_BitNum, IOCnt, _Data) != (int)CDioConst.DIO_ERR_SUCCESS) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "Output Check Error"); return; } for (int iLoopCount = 0; iLoopCount < IOCnt; iLoopCount++) { if (_Data[iLoopCount] == (short)DIOEnum.ON) { ControlInvoke(btnOutputSignal[iLoopCount], Color.DarkGreen); OutputSignalFlag[iLoopCount] = true; } else if (_Data[iLoopCount] == (short)DIOEnum.OFF) { ControlInvoke(btnOutputSignal[iLoopCount], Color.Maroon); OutputSignalFlag[iLoopCount] = false; } } }
public void TriggerOn() { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("ISM {0} Trigger ON!", ID + 1)); InspWnd.InspMode = eInspMode.TRI_INSP; InspWnd.IsInspectionComplete = false; IsThreadInspectionTrigger = true; }
private void btnClose_Click(object sender, EventArgs e) { BarcodeReaderEvent(textBoxBarcode.Text); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "CodeSettingWindow - BarcodeReaderEvent Complete", CLogManager.LOG_LEVEL.MID); this.Hide(); }
public override bool TriggerOn(int _ID) { bool _Result = false; CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("Main : Trigger{0} On Event", _ID + 1)); OnMainProcessCommand(eMainProcCmd.TRG, _ID); return(_Result); }
private void SaveResultCount() { RegTotalCount.SetValue("Value", TotalCount, RegistryValueKind.String); RegGoodCount.SetValue("Value", GoodCount, RegistryValueKind.String); RegNgCount.SetValue("Value", NgCount, RegistryValueKind.String); RegYield.SetValue("Value", Yield, RegistryValueKind.String); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "Save Result Count"); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("TotalCount : {0}, GoodCount : {1}, NgCount : {2}, Yield : {3:F3}", TotalCount, GoodCount, NgCount, Yield)); }
private void LoadResultCount() { TotalCount = Convert.ToUInt32(RegTotalCount.GetValue("Value")); GoodCount = Convert.ToUInt32(RegGoodCount.GetValue("Value")); NgCount = Convert.ToUInt32(RegNgCount.GetValue("Value")); Yield = Convert.ToDouble(RegYield.GetValue("Value")); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "Load Result Count"); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("TotalCount : {0}, GoodCount : {1}, NgCount : {2}, Yield : {3:F3}", TotalCount, GoodCount, NgCount, Yield)); }
public void SendResultData(string _ResultDataString) { if (false == IsConnected) { return; } ClientSock.Send(_ResultDataString); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "Send Data : " + _ResultDataString); }
private void MainProcessTriggerOn(object _Value) { if (CParameterManager.SystemMode != eSysMode.AUTO_MODE) { return; } int _ID = Convert.ToInt32(_Value); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("Main : Trigger{0} On Event", _ID + 1)); InspSysManager[_ID].TriggerOn(); }
private void ImageGrabSnap() { //Camera 모듈 Check CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("ISM {0} ImageGrabSnap Complete", ID + 1), CLogManager.LOG_LEVEL.LOW); CParameterManager.SystemMode = eSysMode.AUTO_MODE; InspWnd.GrabAndInspection(); //InspWnd.IsThreadInspectionProcessTrigger = true; CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("ISM{0} IsThreadInspectionProcessTrigger = true", ID + 1), CLogManager.LOG_LEVEL.LOW); }
private void SaveResultCount() { RegTotalCount.SetValue("Value", TotalCount, RegistryValueKind.String); RegGoodCount.SetValue("Value", GoodCount, RegistryValueKind.String); RegNgCount.SetValue("Value", NgCount, RegistryValueKind.String); RegInputDummyCount.SetValue("Value", InputDummyCount, RegistryValueKind.String); RegOriginDummyCount.SetValue("Value", OriginDummyCount, RegistryValueKind.String); RegYield.SetValue("Value", Yield, RegistryValueKind.String); RegNowLotSeparateNum.SetValue("Value", NowLotSeparateNum, RegistryValueKind.String); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "Save Result Count"); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("TotalCount : {0}, GoodCount : {1}, NgCount : {2}, InputDummyCount : {3}, OriginDummyCount : {4}, Yield : {5:F3}, SepNum : {6}", TotalCount, GoodCount, NgCount, InputDummyCount, OriginDummyCount, Yield, NowLotSeparateNum)); }
private void LoadResultCount() { //TotalCount = (Convert.ToUInt32(RegTotalCount.GetValue("Value")) != null) ? Convert.ToUInt32(RegTotalCount.GetValue("Value") : 0; TotalCount = Convert.ToUInt32(RegTotalCount.GetValue("Value")); GoodCount = Convert.ToUInt32(RegGoodCount.GetValue("Value")); NgCount = Convert.ToUInt32(RegNgCount.GetValue("Value")); InputDummyCount = Convert.ToUInt32(RegInputDummyCount.GetValue("Value")); OriginDummyCount = Convert.ToUInt32(RegOriginDummyCount.GetValue("Value")); Yield = Convert.ToDouble(RegYield.GetValue("Value")); NowLotSeparateNum = Convert.ToString(RegNowLotSeparateNum.GetValue("Value")); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "Load Result Count"); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("TotalCount : {0}, GoodCount : {1}, NgCount : {2}, InputDummyCount : {3}, OriginDummyCount : {4}, Yield : {5:F3}", TotalCount, GoodCount, NgCount, InputDummyCount, OriginDummyCount, Yield)); }
public void SendSequenceData(string _SendData) { byte[] SendData; try { SendData = Encoding.ASCII.GetBytes(_SendData); SerialComm.Write(SendData, 0, SendData.Count()); } catch { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "SerialWindow SendWequenceData Exception!!", CLogManager.LOG_LEVEL.LOW); } }
private void rbStop_Click(object sender, EventArgs e) { for (int iLoopCount = 0; iLoopCount < ParamManager.SystemParam.InspSystemManagerCount; ++iLoopCount) { InspSysManager[iLoopCount].SetSystemMode(eSysMode.MANUAL_MODE); } rbStart.Enabled = true; rbLight.Enabled = true; CParameterManager.SystemMode = eSysMode.MANUAL_MODE; MainProcess.AutoMode(false); ResultBaseWnd.SetAutoMode(false); CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, "MainProcess AutoMode STOP", CLogManager.LOG_LEVEL.MID); }
public bool ReadLightParameters() { bool _Result = true; LightParam = new LightParameter(); try { DirectoryInfo _DirInfo = new DirectoryInfo(LightParameterFolderPath); if (false == _DirInfo.Exists) { _DirInfo.Create(); System.Threading.Thread.Sleep(100); } if (false == File.Exists(LightParameterFullPath)) { File.Create(LightParameterFullPath).Close(); WriteLightParameter(); System.Threading.Thread.Sleep(100); } XmlNodeList _XmlNodeList = GetNodeList(LightParameterFullPath); if (null == _XmlNodeList) { return(false); } foreach (XmlNode _Node in _XmlNodeList) { if (null == _Node) { return(false); } if ("LightCount" == _Node.Name.ToString()) { LightParam.LightCount = Convert.ToInt32(_Node.InnerText); } GetLightValuesParameter(_Node, ref LightParam); } } catch { _Result = false; CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "ReadLightParameters Exception!!", CLogManager.LOG_LEVEL.LOW); } return(_Result); }
//LDH, 2019.04.03, Client Connect Check private void ThreadConnectCheckFunction() { try { while (false == IsThreadConnectCheckExit) { ConnectCheckTimer_Tick(); Thread.Sleep(500); } } catch (System.Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "ThreadConnectCheckFunction Exception : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW); } }
//LDH, 2019.04.03, Check private void ThreadReceiceDataCheckFunction() { try { while (false == IsThreadConnectCheckExit) { ProtocolCommandProcess(); Thread.Sleep(10); } } catch (System.Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "ThreadReceiceDataCheckFunction Exception : " + ex.ToString(), CLogManager.LOG_LEVEL.LOW); } }
private void ThreadInputAliveCheckFunc() { try { while (false == IsThreadInputAliveCheckExit) { InputAliveCheck(); Thread.Sleep(10); } } catch (System.Exception ex) { CLogManager.AddSystemLog(CLogManager.LOG_TYPE.ERR, "ThreadInputAliveCheckFunc Err : " + ex.Message, CLogManager.LOG_LEVEL.LOW); } }