| | |
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private string _mDbConnectionString;
|
| | | private string _dbConnectionString;
|
| | | private static bool _isNewCase;
|
| | | private static ArrayList _mLinkList; // store the switch of the new case path
|
| | | private static TraceEngine _mTEngine;
|
| | | private static Hashtable _mTreeMap; // store the switch of the old case path
|
| | | private static ArrayList _linkList; // store the switch of the new case path
|
| | | private static TraceEngine _traceEngine;
|
| | | private static Hashtable _treeMap; // store the switch of the old case path
|
| | | private static int _sFsc;
|
| | | private static int _sUfid;
|
| | | private readonly ArrayList _mTmp = new ArrayList();
|
| | | private NetworkContext _mPContext;
|
| | | private readonly ArrayList _tmp = new ArrayList();
|
| | | private NetworkContext _context;
|
| | |
|
| | | private readonly OracleConnection _connectionTpc;
|
| | | private readonly OracleTransaction _transaction;
|
| | |
| | | {
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | | _mDbConnectionString = traceConnectionString;
|
| | | _dbConnectionString = traceConnectionString;
|
| | |
|
| | | try
|
| | | {
|
| | | if (_mTEngine == null)
|
| | | if (_traceEngine == null)
|
| | | {
|
| | | _mTEngine = new TraceEngine();
|
| | | _traceEngine = new TraceEngine();
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Logger.Error(ex, ex.Message);
|
| | | throw ex;
|
| | | throw;
|
| | | }
|
| | | }
|
| | |
|
| | | public void DiscardEngine()
|
| | | {
|
| | | _mTEngine = null;
|
| | | _traceEngine = null;
|
| | | }
|
| | |
|
| | | public ArrayList GetNewResult()
|
| | | {
|
| | | return _mLinkList;
|
| | | return _linkList;
|
| | | }
|
| | |
|
| | | public Hashtable GetOldResult()
|
| | | {
|
| | | return _mTreeMap;
|
| | | return _treeMap;
|
| | | }
|
| | |
|
| | | // for EOS(only get the reverse tree)
|
| | |
| | | _sFsc = startFsc;
|
| | | _sUfid = startUfid;
|
| | | _isNewCase = mIsNew;
|
| | | _mTreeMap = new Hashtable();
|
| | | _mLinkList = new ArrayList();
|
| | | _treeMap = new Hashtable();
|
| | | _linkList = new ArrayList();
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | Equipment equip = new Equipment(node.ClassID, node.ObjectID);
|
| | |
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | _linkList.Add(equip);
|
| | | else
|
| | | {
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | _treeMap.Add(node.ObjectID, equip);
|
| | | _tmp.Add(equip);
|
| | | }
|
| | | i++;
|
| | |
|
| | |
| | | */
|
| | | }
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | |
|
| | | iti.MoveDescent((short)0);
|
| | |
| | | Equipment equip = new Equipment(node.ClassID, node.ObjectID);
|
| | |
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | _linkList.Add(equip);
|
| | | else
|
| | | {
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | _treeMap.Add(node.ObjectID, equip);
|
| | | _tmp.Add(equip);
|
| | | }
|
| | | i++; //後面直接就FINISH,所以就不用判斷tracecount
|
| | |
|
| | |
| | | if (IsEndEquip(equip))
|
| | | {
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | _linkList.Add(equip);
|
| | | else
|
| | | {
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | _treeMap.Add(node.ObjectID, equip);
|
| | | _tmp.Add(equip);
|
| | | }
|
| | | i++; //後面直接就FINISH,所以就不用判斷tracecount
|
| | |
|
| | |
| | | {
|
| | | case 108:
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | _linkList.Add(equip);
|
| | | else
|
| | | {
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | _treeMap.Add(node.ObjectID, equip);
|
| | | _tmp.Add(equip);
|
| | | }
|
| | |
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | |
| | | if (!ostatus)
|
| | | {
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | _linkList.Add(equip);
|
| | | else
|
| | | {
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | _treeMap.Add(node.ObjectID, equip);
|
| | | _tmp.Add(equip);
|
| | | }
|
| | |
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return tree;
|
| | | Logger.Error(e, e.Message);
|
| | | return null;
|
| | | }
|
| | |
|
| | | try
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | |
|
| | | return tree;
|
| | |
| | |
|
| | | private void ConfigTrace()
|
| | | {
|
| | | if (_mDbConnectionString == null)
|
| | | if (_dbConnectionString == null)
|
| | | {
|
| | | _mDbConnectionString = "basedb/basedb000@nntpc";
|
| | | _dbConnectionString = "basedb/basedb000@nntpc";
|
| | | }
|
| | | try
|
| | | {
|
| | | if (_mPContext == null) _mPContext = _mTEngine.teoCreateContext();
|
| | | if (_context == null) _context = _traceEngine.teoCreateContext();
|
| | |
|
| | | if (_mPContext.IsConnected == 0)
|
| | | if (_context.IsConnected == 0)
|
| | | {
|
| | | _mPContext.Connect("", _mDbConnectionString);
|
| | | _context.Connect("", _dbConnectionString);
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | |
| | | tContext.addCriterion(sCriterion);
|
| | | tContext.addCriterion(eCriterion);
|
| | |
|
| | | _mPContext.ResetContext();
|
| | | _context.ResetContext();
|
| | |
|
| | | Logger.Info("Set ModeTrace OK.");
|
| | | ResultTreeBuilder trBuilder = _mPContext.CreateTreeBuilder();
|
| | | ResultTreeBuilder trBuilder = _context.CreateTreeBuilder();
|
| | | if (!trBuilder.constructResultTree(tContext, TRAVELTHREADMODE.CONMODE_SYNCHRONOUS)) { return null; }
|
| | | Logger.Info("ConstructResultTree OK.");
|
| | | ResultTree result = trBuilder.ResultTree;
|
| | |
| | | //判斷是否為最終設備(逆向追到已經無child的設備時,檢查該設備是否為最終設備(查驗該設備的同層設備,是否仍有可繼續逆向追蹤的設備,若無,則該設備為最終設備
|
| | | private bool IsEndEquip(Equipment selfEquip)
|
| | | {
|
| | | string sqlStmt;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | | long nValue = 0;
|
| | |
|
| | | sqlStmt = "SELECT DIR,OSTATUS,N1,N2 FROM BASEDB.CONNECTIVITY WHERE FSC = " + selfEquip.Fsc+ " AND UFID = " + selfEquip.Ufid;
|
| | | var sqlStmt = "SELECT DIR,OSTATUS,N1,N2 FROM BASEDB.CONNECTIVITY WHERE FSC = " + selfEquip.Fsc+ " AND UFID = " + selfEquip.Ufid;
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | }
|
| | | finally
|
| | | {
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | command?.Dispose();
|
| | | reader?.Close();
|
| | | }
|
| | |
|
| | | return true;
|