using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using static SystemX.Net.XAdaptor.PC.O2Sensor.NgCode.DBSchemaMap; using static SystemX.Net.Platform.Common.Util.LogMessage; namespace SystemX.Net.XAdaptor.PC.O2Sensor.NgCode { public class NGCodeMgr { public bool CONNECT { internal set; get; } NGCodeFinder NGCodeFinder { get; set; } NGHistDBFinder HistFinder { get; set; } XAdaptorPC refPCAdaptor; public NGCodeMgr(XAdaptorPC refAdaptor) { refPCAdaptor = refAdaptor; CreateInstances(); } bool CreateInstances() { try { HistFinder = new NGHistDBFinder(refPCAdaptor); NGCodeFinder = new NGCodeFinder(refPCAdaptor); NGCodeFinder.InitialNgCodeTable(); } catch (Exception ex) { MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"Error during initiating NG Code Manager Instance: " + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG); return false; } MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"Recv NgTable.", ConsoleColor.White, LogMessageLevel.DEBUG); return true; } public List GetNGCodeHistory(string strProductID) { return HistFinder.GetNGCodeHistory(strProductID); } public Dictionary GetProcResult(string strProductID, string strPalletID, bool bFirstNgFind) { return HistFinder.FindHistory(strProductID, strPalletID, bFirstNgFind); } public Tuple GetNGProcess(string strProductID, string strPalletID) { return HistFinder.FindNGHistory(strProductID, strPalletID); } public Dictionary GetNGCodeDictionary(eHistProcTableList proc, DataRow dtRow) { Dictionary dicNgCode = null; dicNgCode = NGCodeFinder.GetNGCodeDictionary(dtRow); return dicNgCode; } public string GetNGCode(eHistProcTableList proc, DataRow dtRow) { string strNGCode = string.Empty; strNGCode = NGCodeFinder .GetNGCode(dtRow); return strNGCode; } public eReworkType GetReworkType(string strNGCode) { return NGCodeFinder.GetReworkType(strNGCode); } } }