Files
2024-06-26 10:30:00 +09:00

83 lines
2.2 KiB
C#

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<string> GetNGCodeHistory(string strProductID)
{
return HistFinder.GetNGCodeHistory(strProductID);
}
public Dictionary<eHistProcTableList, DataRow> GetProcResult(string strProductID, string strPalletID, bool bFirstNgFind)
{
return HistFinder.FindHistory(strProductID, strPalletID, bFirstNgFind);
}
public Tuple<eHistProcTableList, DataRow, bool> GetNGProcess(string strProductID, string strPalletID)
{
return HistFinder.FindNGHistory(strProductID, strPalletID);
}
public Dictionary<string, string> GetNGCodeDictionary(eHistProcTableList proc, DataRow dtRow)
{
Dictionary<string, string> 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);
}
}
}