| | |
| | | {
|
| | | private const string DbConfigFilename = "DBConfig.xml";
|
| | |
|
| | | private static Logger _logger = LogManager.GetCurrentClassLogger();
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | | private static CcsMain _instance;
|
| | |
|
| | | public static ArrayList ProcessCases = new ArrayList();
|
| | |
| | |
|
| | | private int _connectionCount = 1;
|
| | | private OracleConnection _mainConn = null;
|
| | | private SEventLog _mainLog = null;
|
| | |
|
| | | private SmartThreadPool _mainjobThreadPool = null;
|
| | | private readonly object _syncDbQueue = new object();
|
| | |
| | |
|
| | | public void Startup()
|
| | | {
|
| | | _mainLog = new SEventLog();
|
| | | Logger.Info("CCSMain Startup.");
|
| | |
|
| | | try
|
| | | {
|
| | | ReadXml();
|
| | | Logger.Info("CCSMain ReadXml Complete.");
|
| | |
|
| | | if (_mainConn == null)
|
| | | _mainConn = CreateConnection();
|
| | | //MainConn = CreateMainConnection();
|
| | | Logger.Info("CCSMain has been connected database.");
|
| | |
|
| | | GlobalVariable.CcsCodelist = new CcsCodelist(_mainConn);
|
| | | GlobalVariable.EosCodelist = new EosCodelist(_mainConn);
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | _mainLog.Error(e.Message);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(e.StackTrace);
|
| | |
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | _mainLog.Close();
|
| | | }
|
| | |
|
| | | CcsRecord mRecord = GetWaitRecord(_mainConn);
|
| | |
| | | stpStartInfo.MaxWorkerThreads = GlobalVariable.MaxThreadSize;
|
| | | stpStartInfo.MinWorkerThreads = GlobalVariable.MinThreadSize;
|
| | | _mainjobThreadPool = new SmartThreadPool(stpStartInfo);
|
| | | Logger.Info("Create Thread Pool.");
|
| | | }
|
| | |
|
| | | public void Shutdown()
|
| | |
| | | GC.Collect();
|
| | | GC.WaitForPendingFinalizers();
|
| | | }
|
| | |
|
| | | public void AcceptEvent(CcsRecord record)
|
| | | {
|
| | | /*
|
| | | WorkItemCallback workItemCallback = new WorkItemCallback(this.DoWork);
|
| | | _mainjobThreadPool.QueueWorkItem(workItemCallback, record);
|
| | | */
|
| | |
|
| | | int i = 0;
|
| | | int reConnectCount = 1;
|
| | |
|
| | |
| | |
|
| | | if (mRecord != null)
|
| | | {
|
| | | OracleConnection conn = _dbQueue.Dequeue();
|
| | | OracleConnection conn = null;
|
| | | lock (_syncDbQueue) conn = _dbQueue.Dequeue();
|
| | | ProcessCase(mRecord, conn);
|
| | | }
|
| | | }
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Error(e, e.Message);
|
| | | if (_mainConn.State == ConnectionState.Closed)
|
| | | {
|
| | | i++;
|
| | |
| | | }
|
| | | catch (XmlException xe)
|
| | | {
|
| | | Console.WriteLine(xe.StackTrace);
|
| | | Logger.Error(xe, xe.Message);
|
| | | reader?.Close();
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | _mainLog = new SEventLog();
|
| | |
|
| | | if (conn.State.ToString().Equals("Closed"))
|
| | | if (conn.State == ConnectionState.Closed)
|
| | | conn.Open();
|
| | |
|
| | | transaction = conn.BeginTransaction();
|
| | |
|
| | | if (record.InsertDb(conn, transaction, _mainLog))
|
| | | if (record.InsertDb(conn, transaction))
|
| | | {
|
| | | var eventQuery = new EventQuery
|
| | | {
|
| | |
| | | };
|
| | |
|
| | |
|
| | | if (eventQuery.Insert(_mainLog, conn, transaction))
|
| | | if (eventQuery.Insert(conn, transaction))
|
| | | transaction.Commit();
|
| | | else
|
| | | {
|
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | if (transaction.Connection.State == ConnectionState.Open)
|
| | | transaction.Rollback();
|
| | |
|
| | | throw new Exception("案件未受理成功。");
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | if (transaction.Connection.State == ConnectionState.Open)
|
| | | transaction.Rollback();
|
| | |
|
| | | throw new Exception("案件未受理成功。");
|
| | |
| | | }
|
| | | catch (OracleException e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | _mainLog.Error(e.Message);
|
| | | Logger.Error(e, e.Message);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(e.StackTrace);
|
| | |
|
| | | if (transaction != null && transaction.Connection.State.ToString().Equals("Open"))
|
| | | if (transaction != null && (transaction.Connection.State == ConnectionState.Open))
|
| | | transaction.Rollback();
|
| | |
|
| | | throw;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Console.WriteLine(ex.Message);
|
| | | Console.WriteLine(ex.StackTrace);
|
| | | _mainLog.Error(ex.Message);
|
| | | Logger.Error(ex, ex.Message);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(ex.StackTrace);
|
| | |
|
| | | if (transaction != null && transaction.Connection.State.ToString().Equals("Open"))
|
| | | if (transaction != null && (transaction.Connection.State == ConnectionState.Open))
|
| | | transaction.Rollback();
|
| | |
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | _mainLog.Close();
|
| | | }
|
| | |
|
| | | return true;
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Log(e.Message);
|
| | | _mainLog.Error("無法取得等候處理CCS案件資料。錯誤訊息 = " + e.Message);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | if (ccsid.Length != 0)
|
| | | record = new CcsRecord(ccsid, conn, _mainLog);
|
| | | record = new CcsRecord(ccsid, conn);
|
| | |
|
| | | if (record != null)
|
| | | {
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | if (eventQuery.UpdateCaseStatus(_mainLog, conn, transaction))
|
| | | if (eventQuery.UpdateCaseStatus(conn, transaction))
|
| | | {
|
| | | _mainLog.Info("更新EVENTQUERY的案件狀態為處理中.(CCSID = " + record.CcsId + ")");
|
| | | Logger.Info("更新EVENTQUERY的案件狀態為處理中.(CCSID = " + record.CcsId + ")");
|
| | | transaction.Commit();
|
| | | ProcessCases.Add(record.CcsId);
|
| | | }
|
| | | else
|
| | | {
|
| | | _mainLog.Error("無法更新EVENTQUERY的案件狀態.(CCSID = " + record.CcsId + ")");
|
| | | Logger.Error("無法更新EVENTQUERY的案件狀態.(CCSID = " + record.CcsId + ")");
|
| | |
|
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | |
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | |
|
| | | Log(e.Message);
|
| | | Logger.Error(e, e.Message);
|
| | | record = null;
|
| | | }
|
| | | }
|
| | |
|
| | | return record;
|
| | | }
|
| | |
|
| | | private void Log(string message)
|
| | | {
|
| | | RecordLog pLog = null;
|
| | | try
|
| | | {
|
| | | pLog = new RecordLog(GlobalVariable.CcsListPath + "MAIN.txt");
|
| | | pLog.Error(message);
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (pLog != null)
|
| | | {
|
| | | pLog.Close();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| | |
| | |
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.EventAI
|
| | | {
|
| | | public class JudgeCase
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private TraceSubject _mTraceSubject;
|
| | | private readonly ArrayList _mCase = new ArrayList();
|
| | | private readonly int _damageFdrId;
|
| | |
| | |
|
| | | private readonly OracleConnection _connectionTpc;
|
| | | private readonly OracleTransaction _transaction;
|
| | | private readonly RecordLog _pLog;
|
| | | private readonly string _traceConnectionString;
|
| | |
|
| | | // int Range = 360; //比事故案件還早多久時間內的案件才作合併 單位:分
|
| | |
|
| | | public JudgeCase(int mFdrId, int mFsc, int mUfid, int mCaseId, string mAcceptDate, OracleConnection connection, OracleTransaction trx, string traceConnection, RecordLog log)
|
| | | public JudgeCase(int mFdrId, int mFsc, int mUfid, int mCaseId, string mAcceptDate, OracleConnection connection, OracleTransaction trx, string traceConnection)
|
| | | {
|
| | | _damageFdrId = mFdrId;
|
| | | _damageFsc = mFsc;
|
| | |
| | | _connectionTpc = connection;
|
| | | _transaction = trx;
|
| | | _traceConnectionString = traceConnection;
|
| | | _pLog = log;
|
| | | }
|
| | |
|
| | | public void AiBegin()
|
| | | {
|
| | | _pLog.Info("進行案件追蹤合併.");
|
| | | Logger.Info("進行案件追蹤合併.");
|
| | | // String ToTime = AcceptDate;
|
| | |
|
| | | var sqlStmt = "SELECT R.ACCEPTNUM,R.CASEID as CASEID,R.FDRID as FDRID,R.FSC as FSC,R.UFID as UFID,E.CASESTATUS as CASESTATUS,R.EVENTBRIEF as BRIEF "
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | _pLog.Info("搜尋同一饋線上可供合併之母案件.");
|
| | | Logger.Info("搜尋同一饋線上可供合併之母案件.");
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | |
| | | record.Add(reader["BRIEF"].ToString());
|
| | | record.Add(reader["ACCEPTNUM"].ToString());
|
| | | _mCase.Add(record);
|
| | | _pLog.Info(record[7].ToString() + ", " + record[0]);
|
| | | Logger.Info(record[7].ToString() + ", " + record[0]);
|
| | | }
|
| | | reader.Close();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Logger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | _pLog.Error("尋找母案件時發生錯誤.");
|
| | | Logger.Error("尋找母案件時發生錯誤.");
|
| | | throw e;
|
| | | }
|
| | | finally
|
| | |
| | | {
|
| | | _inferFsc = _damageFsc;
|
| | | _inferUfid = _damageUfid;
|
| | | _pLog.Info("此案件為饋線上第一件案件");
|
| | | _pLog.Info("追蹤合併結束.");
|
| | | Logger.Info("此案件為饋線上第一件案件");
|
| | | Logger.Info("追蹤合併結束.");
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | _parentCaseId = Convert.ToInt32(((ArrayList)_mCase[i])[0].ToString());
|
| | | _inferFsc = Convert.ToInt32(((ArrayList)_mCase[i])[2].ToString());
|
| | | _inferUfid = Convert.ToInt32(((ArrayList)_mCase[i])[3].ToString());
|
| | | _pLog.Info("相同變壓器");
|
| | | _pLog.Info("與案件" + ((ArrayList)_mCase[i])[7] + "合併,故障點Fsc: " + _inferFsc + " Ufid: " + _inferUfid);
|
| | | Logger.Info("相同變壓器");
|
| | | Logger.Info("與案件" + ((ArrayList)_mCase[i])[7] + "合併,故障點Fsc: " + _inferFsc + " Ufid: " + _inferUfid);
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error(ex.Message);
|
| | | Logger.Error(ex.Message);
|
| | | throw ex;
|
| | | }
|
| | | _pLog.Info("不同變壓器,開始追蹤(New Version)...");
|
| | | Logger.Info("不同變壓器,開始追蹤(New Version)...");
|
| | |
|
| | | TraceCase();
|
| | | _pLog.Warn("追蹤合併結束");
|
| | | Logger.Warn("追蹤合併結束");
|
| | | }
|
| | |
|
| | | private void TraceCase()
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | _mTraceSubject = new TraceSubject(_connectionTpc, _transaction, _traceConnectionString, _pLog);
|
| | | _pLog.Info("TraceSubject Startup....");
|
| | | _mTraceSubject = new TraceSubject(_connectionTpc, _transaction, _traceConnectionString);
|
| | | Logger.Info("TraceSubject Startup....");
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error("TraceObject.dll無法初始化,請確認該元件是否存在或jre是否為 1.4 版,並確認是否註冊.");
|
| | | Logger.Error("TraceObject.dll無法初始化,請確認該元件是否存在或jre是否為 1.4 版,並確認是否註冊.");
|
| | | throw ex;
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | _mTraceSubject.StartTrace(_damageFsc, _damageUfid, true);
|
| | | _newCase = _mTraceSubject.GetNewResult(); // 新案件所建出來的linkedlist(往上追到breaker)
|
| | | _pLog.Info("追蹤新案件完成");
|
| | | Logger.Info("追蹤新案件完成");
|
| | |
|
| | | for (int i = 0; i < _mCase.Count; i++)
|
| | | {
|
| | |
| | | _mTraceSubject.StartTrace(Convert.ToInt32(((ArrayList)_mCase[i])[2].ToString()),
|
| | | Convert.ToInt32(((ArrayList)_mCase[i])[3].ToString()), false);
|
| | | _oldCase = _mTraceSubject.GetOldResult(); // 母案件所建出來的TreeMap(往上追到breaker)
|
| | | _pLog.Info("追蹤母案件完成");
|
| | | Logger.Info("追蹤母案件完成");
|
| | |
|
| | | for (int j = 0; j < _newCase.Count; j++)
|
| | | {
|
| | |
| | | _inferFsc = ((Equipment)_newCase[j]).Fsc;
|
| | | _inferUfid = ((Equipment)_newCase[j]).Ufid;
|
| | | _mEquip = (Equipment)((ArrayList)_mCase[i])[5];
|
| | | _pLog.Info("與案件" + ((ArrayList)_mCase[i])[7] + "合併,故障點Fsc: " + _inferFsc + " Ufid: " + _inferUfid);
|
| | | Logger.Info("與案件" + ((ArrayList)_mCase[i])[7] + "合併,故障點Fsc: " + _inferFsc + " Ufid: " + _inferUfid);
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | for (int k = 0; k < facilitySet.Count; k++)
|
| | | foreach (object t1 in facilitySet)
|
| | | {
|
| | | bool merge = false; // 損壞設備是否在所切開的設備下游
|
| | | Equipment damageEquipment = (Equipment)facilitySet[k]; // 切開的設備
|
| | | Equipment damageEquipment = (Equipment)t1; // 切開的設備
|
| | |
|
| | | for (int z = 0; z < _newCase.Count; z++)
|
| | | foreach (object t in _newCase)
|
| | | {
|
| | | if ((((Equipment)_newCase[z]).Fsc== damageEquipment.Fsc) &&
|
| | | (((Equipment)_newCase[z]).Ufid== damageEquipment.Ufid))
|
| | | if ((((Equipment)t).Fsc== damageEquipment.Fsc) &&
|
| | | (((Equipment)t).Ufid== damageEquipment.Ufid))
|
| | | {
|
| | | merge = true;
|
| | | break;
|
| | |
| | | _inferFsc = damageEquipment.Fsc;
|
| | | _inferUfid = damageEquipment.Ufid;
|
| | | _mEquip = (Equipment)((ArrayList)_mCase[i])[5];
|
| | | _pLog.Info("與案件" + ((ArrayList)_mCase[i])[7] + "合併,故障點Fsc: " + _inferFsc + " Ufid: " + _inferUfid);
|
| | | Logger.Info("與案件" + ((ArrayList)_mCase[i])[7] + "合併,故障點Fsc: " + _inferFsc + " Ufid: " + _inferUfid);
|
| | | return;
|
| | | }
|
| | | }
|
| | | } // for loop(k)
|
| | | }
|
| | | } // else
|
| | | } // for loop(i)
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error(ex.Message);
|
| | | _pLog.Error("追蹤時發生錯誤.");
|
| | | Logger.Error(ex, ex.Message);
|
| | | Logger.Error("追蹤時發生錯誤.");
|
| | | throw;
|
| | | }
|
| | | finally
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occur: " + e.Message);
|
| | | Logger.Error("Problems occur: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | |
| | | catch (Exception e)
|
| | | {
|
| | | // CCS.GlobalVariable.ErrorLog.setErrorLog("Error in JudgeCase(RealDamageEquipment) :" + e.getMessage());
|
| | | _pLog.Error("Problems occur: " + e.Message);
|
| | | Logger.Error("Problems occur: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | | using TRACEROBJECTLib;
|
| | |
|
| | | namespace CCSTrace.CCS.EventAI
|
| | | {
|
| | | public class TraceSubject
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private string _mDbConnectionString;
|
| | | private static bool _isNewCase;
|
| | | private static ArrayList _mLinkList; // store the switch of the new case path
|
| | |
| | | private static Hashtable _mTreeMap; // store the switch of the old case path
|
| | | private static int _sFsc;
|
| | | private static int _sUfid;
|
| | | private readonly RecordLog _plogger;
|
| | | private readonly ArrayList _mTmp = new ArrayList();
|
| | | private NetworkContext _mPContext;
|
| | |
|
| | | private readonly OracleConnection _connectionTpc;
|
| | | private readonly OracleTransaction _transaction;
|
| | |
|
| | | public TraceSubject(OracleConnection conn, OracleTransaction trx, string traceConnectionString, RecordLog log)
|
| | | public TraceSubject(OracleConnection conn, OracleTransaction trx, string traceConnectionString)
|
| | | {
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | | _plogger = log;
|
| | | _mDbConnectionString = traceConnectionString;
|
| | |
|
| | | try
|
| | |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _plogger.Error(ex.Message);
|
| | | Logger.Error(ex, ex.Message);
|
| | | throw ex;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | throw e;
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | | command?.Dispose();
|
| | |
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | reader?.Close();
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | |
|
| | | iti.MoveDescent((short)0);
|
| | | }
|
| | |
| | | }
|
| | | i++; //後面直接就FINISH,所以就不用判斷tracecount
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Console.WriteLine("Trace Finish....");
|
| | | _plogger.Info("Trace Finish....");
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Logger.Info("Trace Finish....");
|
| | | break;
|
| | | }
|
| | | // 當追蹤到被切開的開關且該上一層設備只有該開關一個child)
|
| | |
| | | }
|
| | | i++; //後面直接就FINISH,所以就不用判斷tracecount
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Console.WriteLine("Trace Finish....");
|
| | | _plogger.Info("Trace Finish....");
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Logger.Info("Trace Finish....");
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | _mTmp.Add(equip);
|
| | | }
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | i++;
|
| | |
|
| | | /* if (getTraceCount(node.ClassID, node.ObjectID) > 2)
|
| | |
| | | _mTmp.Add(equip);
|
| | | }
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Logger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | i++;
|
| | |
|
| | | /* if (getTraceCount(node.ClassID, node.ObjectID) > 2)
|
| | |
| | | }
|
| | | } // for
|
| | | } // while
|
| | | Console.WriteLine("Tree Node Count = " + i);
|
| | | _plogger.Info("Tree Node Count = " + i);
|
| | | Logger.Info("Tree Node Count = " + i);
|
| | | }
|
| | | else
|
| | | {
|
| | | Console.WriteLine("Tree is null");
|
| | | _plogger.Info("Tree is null");
|
| | | Logger.Info("Tree is null");
|
| | | throw new Exception("無法追蹤到任何設備,可能是該用戶所在變壓器設備連結性有問題。");
|
| | | }
|
| | | }
|
| | |
| | | try
|
| | | {
|
| | | ConfigTrace();
|
| | | _plogger.Info("configTrace OK.");
|
| | | Logger.Info("configTrace OK.");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Logger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return tree;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Logger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _plogger.Error(ex.Message);
|
| | | Logger.Error(ex, ex.Message);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | _mPContext.ResetContext();
|
| | |
|
| | | _plogger.Info("Set ModeTrace OK.");
|
| | | Logger.Info("Set ModeTrace OK.");
|
| | | ResultTreeBuilder trBuilder = _mPContext.CreateTreeBuilder();
|
| | | if (!trBuilder.constructResultTree(tContext, TRAVELTHREADMODE.CONMODE_SYNCHRONOUS)) { return null; }
|
| | | _plogger.Info("ConstructResultTree OK.");
|
| | | Logger.Info("ConstructResultTree OK.");
|
| | | ResultTree result = trBuilder.ResultTree;
|
| | |
|
| | | _plogger.Info("getResultTree OK.");
|
| | | Logger.Info("getResultTree OK.");
|
| | | return result;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | |
|
| | | using System.Data.OracleClient;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class FinishEvent
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private bool _upLevel;
|
| | | private int _originCaseStatus = 0;
|
| | | private Object.EventRecord _mEventRec = null;
|
| | | private RecordLog _pLog;
|
| | | private OracleConnection _connectionTpc;
|
| | | private OracleTransaction _transaction;
|
| | |
|
| | |
| | | {
|
| | | }
|
| | |
|
| | | public bool Finish(int mKind, Object.EventRecord mRecord, OracleConnection conn, OracleTransaction trx, RecordLog log)
|
| | | public bool Finish(int mKind, Object.EventRecord mRecord, OracleConnection conn, OracleTransaction trx)
|
| | | {
|
| | | _mEventRec = mRecord;
|
| | | _pLog = log;
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | |
|
| | | _pLog.Info("進行OMS資料更新程序...");
|
| | | Logger.Info("進行OMS資料更新程序...");
|
| | | if (mRecord.ParentId== 0)
|
| | | { // Original Case
|
| | | if (!(ProcessSingalCase(mRecord)))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("更新eos.events成功!");
|
| | | Logger.Info("更新eos.events成功!");
|
| | | }
|
| | | else
|
| | | { // Child Case
|
| | |
| | | {
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("更新eos.events成功!");
|
| | | Logger.Info("更新eos.events成功!");
|
| | | }
|
| | |
|
| | | // inert into eos.eventrecord && eos.eventrecord_ex
|
| | |
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = mRecord.LocateEquipment.GetSqlStmt();
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord_ex");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord_ex");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | {
|
| | | if (!SetVisualCustomer(mRecord))
|
| | | {
|
| | | _pLog.Error("新增影響用戶資料錯誤.");
|
| | | Logger.Error("新增影響用戶資料錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("新增影響用戶成功!");
|
| | | Logger.Info("新增影響用戶成功!");
|
| | | }
|
| | |
|
| | | _upLevel = false; /* 判斷交辦案件是否升級為母案件 */
|
| | |
|
| | | if (!(UpdateImportCase(mRecord)))
|
| | | {
|
| | | _pLog.Error("處理案件等級變更時發生錯誤.");
|
| | | Logger.Error("處理案件等級變更時發生錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("處理案件等級變更成功!");
|
| | | Logger.Info("處理案件等級變更成功!");
|
| | |
|
| | | if (!(UpdateRecuseOrder(mRecord)))
|
| | | {
|
| | | _pLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | Logger.Error("新增搶修順序資料時發生錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("新增搶修順序成功!");
|
| | | Logger.Info("新增搶修順序成功!");
|
| | |
|
| | | if (mKind == GlobalVariable.CaseTypeChanged)
|
| | | {
|
| | | if (!DeleteOldCase(mRecord))
|
| | | {
|
| | | _pLog.Error("案件轉換發生錯誤");
|
| | | Logger.Error("案件轉換發生錯誤");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("案件轉換成功!");
|
| | | Logger.Info("案件轉換成功!");
|
| | | }
|
| | |
|
| | | if (!SaveCustomerTel(mRecord))
|
| | | {
|
| | | _pLog.Error("無法將用戶電話回存回資料庫.");
|
| | | Logger.Error("無法將用戶電話回存回資料庫.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("將用戶電話回存回資料庫成功!");
|
| | | Logger.Info("將用戶電話回存回資料庫成功!");
|
| | | }
|
| | | else if (mKind == GlobalVariable.NoMeter)
|
| | | {
|
| | | string sqlStmt;
|
| | | sqlStmt = "INSERT INTO EOS.RESCUE_ORDER SELECT " + mRecord.CaseId+ ",999,COUNT(*) + 1,'',"
|
| | | + mRecord.LocateEquipment.GetDsufid() + " FROM EOS.RESCUE_ORDER WHERE DSUFID = "
|
| | | + mRecord.LocateEquipment.GetDsufid();
|
| | | var sqlStmt = "INSERT INTO EOS.RESCUE_ORDER SELECT " + mRecord.CaseId+ ",999,COUNT(*) + 1,'',"
|
| | | + mRecord.LocateEquipment.GetDsufid() + " FROM EOS.RESCUE_ORDER WHERE DSUFID = "
|
| | | + mRecord.LocateEquipment.GetDsufid();
|
| | |
|
| | | command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | Logger.Error("新增搶修順序資料時發生錯誤.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | | command1.Dispose();
|
| | | _pLog.Info("新增搶修順序成功!");
|
| | | Logger.Info("新增搶修順序成功!");
|
| | | }
|
| | |
|
| | | if (mRecord.ParentId== 0)
|
| | | {
|
| | | if (!InsertIntoSri(mRecord))
|
| | | {
|
| | | _pLog.Error("新增資料庫(OCSDB.SRI)錯誤.");
|
| | | Logger.Error("新增資料庫(OCSDB.SRI)錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("新增資料庫(OCSDB.SRI)成功!");
|
| | | Logger.Info("新增資料庫(OCSDB.SRI)成功!");
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Warn(e, e.Message);
|
| | | command.Dispose();
|
| | |
|
| | | if (command1 != null)
|
| | | command1.Dispose();
|
| | | command1?.Dispose();
|
| | |
|
| | | throw e;
|
| | | throw;
|
| | | }
|
| | |
|
| | | /** COMMIT的動作須連外面CCS的資料都正確輸入完才作 */
|
| | |
| | |
|
| | | private bool ProcessSingalCase(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | bool result = false;
|
| | | sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.OriginalCase + ",0)";
|
| | | var result = false;
|
| | | var sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.OriginalCase + ",0)";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | |
| | | if (command.ExecuteNonQuery() > 0)
|
| | | result = true;
|
| | | else
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events. Error = " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "儲存資料時發生錯誤: 無法insert eos.events. Error = " + e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | |
|
| | | private bool ProcessMergeCase(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | // insert eos.events
|
| | | sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.ChildCase + ",0)";
|
| | | var sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.ChildCase + ",0)";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | |
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.mergecase");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法insert eos.mergecase");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更改母案件資料");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法更改母案件資料");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法update eos.eventrecord(FSC,UFID)");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法update eos.eventrecord(FSC,UFID)");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "儲存資料時發生錯誤: " + e.Message);
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _pLog.Error("無法判斷用戶種類.");
|
| | | Logger.Error("無法判斷用戶種類.");
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _pLog.Error("無法確認是否需重新修改原始母案件之影響用戶資料.");
|
| | | Logger.Error("無法確認是否需重新修改原始母案件之影響用戶資料.");
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法刪除原始案件的既有用戶資料.");
|
| | | Logger.Error("無法刪除原始案件的既有用戶資料.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將原始案件的影響用戶數改為變壓器的全部用戶.");
|
| | | Logger.Error("無法將原始案件的影響用戶數改為變壓器的全部用戶.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("無法更新原始案件影響用戶資料: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | command1.Dispose();
|
| | | Logger.Error(e, "無法更新原始案件影響用戶資料: " + e.Message);
|
| | | command1?.Dispose();
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | OracleCommand command2 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command2.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法新增新受理案件的影響用戶資料.");
|
| | | Logger.Error("無法新增新受理案件的影響用戶資料.");
|
| | | command2.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | |
|
| | | private bool UpdateImportCase(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | |
|
| | | /* 該案件不為交辦案件 */
|
| | | if (mRecord.ImportCase!= GlobalVariable.IsImportCase)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | /* 若母案件已為交辦案件,則不需再作任何更動 */
|
| | | sqlStmt = "SELECT IMPORTCASE FROM EOS.EVENTRECORD WHERE CASEID = " + mRecord.ParentId;
|
| | | var sqlStmt = "SELECT IMPORTCASE FROM EOS.EVENTRECORD WHERE CASEID = " + mRecord.ParentId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | |
| | | return true;
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("無法取得母案件之等級.");
|
| | | Logger.Error(e, "無法取得母案件之等級." + e.Message);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | | OracleCommand command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將交辦案件改為母案件.");
|
| | | Logger.Error("無法將交辦案件改為母案件.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將母案件改為子案件.");
|
| | | Logger.Error("無法將母案件改為子案件.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將原先該母案件下的子案件都改掛在交辦案件下.");
|
| | | Logger.Error("無法將原先該母案件下的子案件都改掛在交辦案件下.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將已INSERT入EOS.MERGECASE內的交辦案件資料改為原先母案件的資料(CaseID,AcceptNum).");
|
| | | Logger.Error("無法將已INSERT入EOS.MERGECASE內的交辦案件資料改為原先母案件的資料(CaseID,AcceptNum).");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | |
|
| | | private bool UpdateOtherTable(int oldCaseId, int newCaseId, string newAcceptNum)
|
| | | {
|
| | | string sqlStmt;
|
| | |
|
| | | sqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + oldCaseId;
|
| | | var sqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + oldCaseId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | |
| | | switch (_originCaseStatus)
|
| | | {
|
| | | case 0:
|
| | | _pLog.Error("找不到原始母案件之案件狀態.");
|
| | | Logger.Error("找不到原始母案件之案件狀態.");
|
| | | command.Dispose();
|
| | | return false;
|
| | |
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTDESPATCH.");
|
| | | Logger.Error("無法更新EOS.EVENTDESPATCH.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTS.");
|
| | | Logger.Error("無法更新EOS.EVENTS.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.Events的CaseStatus.");
|
| | | Logger.Error("無法更新EOS.Events的CaseStatus.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新OCSDB.SRI.");
|
| | | Logger.Error("無法更新OCSDB.SRI.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTFACILITY.");
|
| | | Logger.Error("無法更新EOS.EVENTFACILITY.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.CRTAPOLOGY.");
|
| | | Logger.Error("無法更新EOS.CRTAPOLOGY.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTAFFECT.");
|
| | | Logger.Error("無法更新EOS.EVENTAFFECT.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | // SqlStmt = "UPDATE EOS.VOICE SET CASEID = " + NewCaseID + " WHERE CASEID = " + OldCaseID;
|
| | |
|
| | | // if (CCS.GlobalVariable.Conn.UpdateDB(SqlStmt) < 0) {
|
| | | // _PLog.error("無法更新EOS.VOICE.");
|
| | | // Logger.error("無法更新EOS.VOICE.");
|
| | | // return false;
|
| | | // }
|
| | |
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新OCSDB.LOCKFEATURE");
|
| | | Logger.Error("無法更新OCSDB.LOCKFEATURE");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | |
|
| | | private bool UpdateRecuseOrder(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | int rank = 999;
|
| | | int priority = 1;
|
| | | OracleCommand command = null;
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | string sqlStmt;
|
| | | if (_upLevel)
|
| | | {
|
| | | /* 將原先母案件的編號改為新的母案件編號 */
|
| | |
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.RESCUE_ORDER: 無法將原先母案件的編號改為新的母案件編號.");
|
| | | Logger.Error("無法更新EOS.RESCUE_ORDER: 無法將原先母案件的編號改為新的母案件編號.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.RESCUE_ORDER舊的搶修號碼.");
|
| | | Logger.Error("無法更新EOS.RESCUE_ORDER舊的搶修號碼.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法新增EOS.RESCUE_ORDER的資料");
|
| | | Logger.Error("無法新增EOS.RESCUE_ORDER的資料");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occue during updating eos.rescue_order: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "Problems occue during updating eos.rescue_order: " + e.Message);
|
| | |
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
| | | {
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | _pLog.Error("無法找到原先舊的案件.");
|
| | | Logger.Error("無法找到原先舊的案件.");
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTS發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.EVENTS發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTRECORD發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.EVENTRECORD發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTRECORD_EX發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.EVENTRECORD_EX發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.TMPAFFECTCUSTMS發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.TMPAFFECTCUSTMS發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | switch (Convert.ToInt32(reader["COUNT"].ToString()))
|
| | | {
|
| | | case 0:
|
| | | _pLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | Logger.Error("無法找到原先母案件下掛的子案件.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法更新原先子案件(要提升為母案件)的資料.");
|
| | | Logger.Error("無法更新原先子案件(要提升為母案件)的資料.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法刪除原先子案件(要提升為母案件)EOS.TMPAFFECTYCUSTMS的資料.");
|
| | | Logger.Error("無法刪除原先子案件(要提升為母案件)EOS.TMPAFFECTYCUSTMS的資料.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTS的資料.");
|
| | | Logger.Error("無法更新EOS.EVENTS的資料.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | {
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | _pLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | Logger.Error("無法找到原先母案件下掛的子案件.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除EOS.MERGECASE發生錯誤");
|
| | | Logger.Error("刪除EOS.MERGECASE發生錯誤");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | |
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
| | |
|
| | | private bool InsertIntoSri(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | int count = 0;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | sqlStmt = "SELECT COUNT(*) as COUNT FROM OCSDB.SRI WHERE SCENENAME = '" + mRecord.AcceptNum+ "'";
|
| | | var sqlStmt = "SELECT COUNT(*) as COUNT FROM OCSDB.SRI WHERE SCENENAME = '" + mRecord.AcceptNum+ "'";
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occur when checking SCENE Data: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "Problems occur when checking SCENE Data: " + e.Message);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | reader?.Close();
|
| | | }
|
| | |
|
| | | if (count > 0)
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Warn(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | // 電話資料過長
|
| | | if (mRecord.Tel.Trim().Length > 24)
|
| | | {
|
| | | _pLog.Warn("電話過長號碼,無法回存資料庫.");
|
| | | Logger.Warn("電話過長號碼,無法回存資料庫.");
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | _pLog.Warn("無法將用戶電話回存回資料庫.");
|
| | | Logger.Warn("無法將用戶電話回存回資料庫.");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Warn(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | using System;
|
| | | using System.Data.OracleClient;
|
| | | using System.Runtime.CompilerServices;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class InitialEventData
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private string _mAcceptNum = "";
|
| | | private int _mCaseId = 0;
|
| | | private int _mYear = 0;
|
| | | private bool _mChangeYear = false;
|
| | | private string _mNowYear = string.Empty;
|
| | | private readonly string _mAcceptTime = "";
|
| | | private readonly RecordLog _pLog;
|
| | | private readonly OracleConnection _connectionTpc;
|
| | |
|
| | | //New CaseID and New AcceptNum must be seen by others,so it need not controled by transaction
|
| | | [MethodImpl(MethodImplOptions.Synchronized)]
|
| | | public InitialEventData(OracleConnection conn, RecordLog log)
|
| | | public InitialEventData(OracleConnection conn)
|
| | | {
|
| | | _connectionTpc = conn;
|
| | | _pLog = log;
|
| | |
|
| | | string sqlStmt = "SELECT ACCEPTNUM,CASEID,YEAR,TO_CHAR(SYSDATE,'YYYY/MM/DD') as ACCEPTTIME FROM EOS.EVENTNUM";
|
| | | var sqlStmt = "SELECT ACCEPTNUM,CASEID,YEAR,TO_CHAR(SYSDATE,'YYYY/MM/DD') as ACCEPTTIME FROM EOS.EVENTNUM";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | _pLog.Error("起始號碼資料遺失!");
|
| | | Logger.Error("起始號碼資料遺失!");
|
| | | return;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occur when Initializing EventData: " + e.Message);
|
| | | Logger.Error(e, "Problems occur when Initializing EventData: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occur during EventNumCreating: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | throw e;
|
| | | Logger.Error(e, "Problems occur during EventNumCreating: " + e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | |
|
| | | private void RegetNumber()
|
| | | {
|
| | | string sqlStmt = "SELECT ACCEPTNUM,CASEID,YEAR FROM EOS.EVENTNUM";
|
| | | var sqlStmt = "SELECT ACCEPTNUM,CASEID,YEAR FROM EOS.EVENTNUM";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | |
| | |
|
| | | using System.Data.OracleClient;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class Leach
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private readonly MergeCase _mergeCase = new MergeCase();
|
| | | private readonly RecordLog _pLog;
|
| | | private readonly OracleConnection _connectionTpc;
|
| | | private readonly OracleTransaction _transaction;
|
| | | private readonly string _traceConnectionString;
|
| | |
|
| | | public Leach(OracleConnection conn, OracleTransaction trx, string traceConnection, RecordLog log)
|
| | | public Leach(OracleConnection conn, OracleTransaction trx, string traceConnection)
|
| | | {
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | | _traceConnectionString = traceConnection;
|
| | | _pLog = log;
|
| | | }
|
| | |
|
| | | public int LeachCase(Object.EventRecord mNewRec)
|
| | |
| | | int importCase = -1;
|
| | | int tmpCaseId = 0;
|
| | | int caseType = -1;
|
| | | _pLog.Info("利用電號或地址檢查是否有已成立之案件.");
|
| | | Logger.Info("利用電號或地址檢查是否有已成立之案件.");
|
| | | // 檢查資料庫中此電號或地址是否已成立案件
|
| | |
|
| | | if (mNewRec.Meter.Trim().Length != 0)
|
| | |
| | | tmpCaseId = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | caseType = Convert.ToInt32(reader["CASETYPE"].ToString());
|
| | | mNewRec.TmpCaseId = tmpCaseId;
|
| | | _pLog.Info("案件已成立:" + reader["ACCEPTNUM"].ToString() + " " + tmpCaseId + " " + caseType);
|
| | | Logger.Info("案件已成立:" + reader["ACCEPTNUM"].ToString() + " " + tmpCaseId + " " + caseType);
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e.Message);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | |
| | | break;
|
| | |
|
| | | default:
|
| | | _pLog.Error("無法辨別案件種類.");
|
| | | Logger.Error("無法辨別案件種類.");
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | _pLog.Info("檢查該案件有無切開關紀錄.");
|
| | | Logger.Info("檢查該案件有無切開關紀錄.");
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | // 有開關尚未恢復
|
| | | if (reader["CLOSETIME"] == null)
|
| | | {
|
| | | _pLog.Info("有切開關且尚未恢復.");
|
| | | Logger.Info("有切開關且尚未恢復.");
|
| | | if ((mNewRec.ImportCase== importCase) || (importCase == GlobalVariable.IsImportCase))
|
| | | {
|
| | | mResult = AddCount(tmpCaseId);
|
| | |
| | | else
|
| | | {
|
| | | // 開關都已恢復(同用戶須重新受理)
|
| | | _pLog.Info("有切開關且已經恢復.");
|
| | | Logger.Info("有切開關且已經恢復.");
|
| | | int caseId;
|
| | |
|
| | | // 找出案件編號需以母案件編號或該案件編號去找casestatus
|
| | |
| | | else
|
| | | {
|
| | | // 未切過開關
|
| | | _pLog.Info("無切開關紀錄.");
|
| | | Logger.Info("無切開關紀錄.");
|
| | | if ((mNewRec.ImportCase== importCase) || (importCase == GlobalVariable.IsImportCase))
|
| | | {
|
| | | mResult = AddCount(tmpCaseId);
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | |
| | |
|
| | | private int AddCount(int mCaseId)
|
| | | {
|
| | | string sqlStmt = "UPDATE EOS.EVENTS SET COUNT = COUNT + 1 WHERE CASEID = " + mCaseId;
|
| | | var sqlStmt = "UPDATE EOS.EVENTS SET COUNT = COUNT + 1 WHERE CASEID = " + mCaseId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | return GlobalVariable.SameCustomer;
|
| | | else
|
| | | return GlobalVariable.FailureByDb;
|
| | | return command.ExecuteNonQuery() > 0 ? GlobalVariable.SameCustomer : GlobalVariable.FailureByDb;
|
| | | }
|
| | | catch (Exception)
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Warn(e, e.Message);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | |
| | |
|
| | | private int GetCastStatus(int caseId)
|
| | | {
|
| | | string sqlStmt;
|
| | | int status = 0;
|
| | |
|
| | | sqlStmt = "SELECT CASESTATUS FROM CCS.EVENTQUERY WHERE CCSID IN (SELECT CCSID FROM CCS.NUM_CONTRAST " + "WHERE CASEID = " + caseId + ")";
|
| | | var sqlStmt = "SELECT CASESTATUS FROM CCS.EVENTQUERY WHERE CCSID IN (SELECT CCSID FROM CCS.NUM_CONTRAST " + "WHERE CASEID = " + caseId + ")";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = null;
|
| | |
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | {
|
| | | mNewRec.LocateEquipment.SetFsc(GlobalVariable.Breaker);
|
| | | mNewRec.LocateEquipment.SetUfid(mNewRec.Ufid);
|
| | | _pLog.Info("饋線全停:" + mNewRec.Fsc+ ", " + mNewRec.Ufid);
|
| | | _mergeCase.Merge(mNewRec, _connectionTpc, _transaction, _traceConnectionString, _pLog);
|
| | | Logger.Info("饋線全停:" + mNewRec.Fsc+ ", " + mNewRec.Ufid);
|
| | | _mergeCase.Merge(mNewRec, _connectionTpc, _transaction, _traceConnectionString);
|
| | | return GlobalVariable.Success;
|
| | | }
|
| | | }
|
| | | catch (EventAI.TraceLoopException)
|
| | | catch (EventAI.TraceLoopException e)
|
| | | {
|
| | | Logger.Warn(e, e.Message);
|
| | | return GlobalVariable.TraceCounts3;
|
| | | }
|
| | | catch (TraceException)
|
| | | catch (TraceException e)
|
| | | {
|
| | | Logger.Warn(e, e.Message);
|
| | | return GlobalVariable.TraceFailure;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error(ex.Message);
|
| | | Logger.Error(ex, ex.Message);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | |
|
| | | try
|
| | | {
|
| | | _pLog.Info("定位損壞設備!");
|
| | | Logger.Info("定位損壞設備!");
|
| | | int result = GetEquipment(mNewRec);
|
| | | _pLog.Info("FSC:" + mNewRec.Fsc+ ", Ufid:" + mNewRec.Ufid+ ", Tpclid:" + mNewRec.Tpclid+ ", FeederID:" + mNewRec.FdrId);
|
| | | Logger.Info("FSC:" + mNewRec.Fsc+ ", Ufid:" + mNewRec.Ufid+ ", Tpclid:" + mNewRec.Tpclid+ ", FeederID:" + mNewRec.FdrId);
|
| | |
|
| | | switch (result)
|
| | | { // get fsc,ufid,fdrid of sxfmr by meter
|
| | |
| | |
|
| | | if (mNewRec.Brief.Length != 0 && mNewRec.Brief.Substring(0, 1).Equals("A"))
|
| | | { // A類事故原因,做追蹤合併
|
| | | _pLog.Info("<A類案件>");
|
| | | _mergeCase.Merge(mNewRec, _connectionTpc, _transaction, _traceConnectionString, _pLog);
|
| | | Logger.Info("<A類案件>");
|
| | | _mergeCase.Merge(mNewRec, _connectionTpc, _transaction, _traceConnectionString);
|
| | | }
|
| | | else
|
| | | {
|
| | | _pLog.Info("<非A類案件>");
|
| | | Logger.Info("<非A類案件>");
|
| | | }
|
| | |
|
| | | if (changeCaseType)
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | catch (EventAI.TraceLoopException)
|
| | | catch (EventAI.TraceLoopException e)
|
| | | {
|
| | | Logger.Warn(e, e.Message);
|
| | | return GlobalVariable.TraceCounts3;
|
| | | }
|
| | | catch (TraceException)
|
| | | catch (TraceException e)
|
| | | {
|
| | | Logger.Warn(e, e.Message);
|
| | | mResult = GlobalVariable.TraceFailure;
|
| | | }
|
| | | catch (Exception ex1)
|
| | | {
|
| | | _pLog.Error(ex1.Message);
|
| | | Logger.Error(ex1, ex1.Message);
|
| | | mResult = GlobalVariable.FailureByDb;
|
| | | }
|
| | | return mResult;
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Logger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error(ex.Message);
|
| | | Logger.Error(ex, ex.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error(ex.Message);
|
| | | Logger.Error(ex, ex.Message);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | using System.Data.OracleClient;
|
| | | using System.Net;
|
| | | using System.Net.Mail;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class MailService
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private SmtpClient _smtpClient;
|
| | | private string _smtpIp;
|
| | | private int _smtpPort;
|
| | |
| | |
|
| | | using System.Data.OracleClient;
|
| | | using CCSTrace.CCS.Object;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class MergeCase
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private EventRecord _lEventrecord;
|
| | | private EventAI.JudgeCase _mJudgeCase;
|
| | |
|
| | |
| | | {
|
| | | }
|
| | |
|
| | | public void Merge(EventRecord mEventrecord, OracleConnection conn, OracleTransaction trx, string traceConnection, RecordLog log)
|
| | | public void Merge(EventRecord mEventrecord, OracleConnection conn, OracleTransaction trx, string traceConnection)
|
| | | {
|
| | | try
|
| | | {
|
| | | _mJudgeCase = new EventAI.JudgeCase(mEventrecord.FdrId, mEventrecord.Fsc, mEventrecord.Ufid,
|
| | | mEventrecord.CaseId, mEventrecord.AcceptDate, conn, trx, traceConnection, log);
|
| | | mEventrecord.CaseId, mEventrecord.AcceptDate, conn, trx, traceConnection);
|
| | | _lEventrecord = mEventrecord;
|
| | | _mJudgeCase.AiBegin();
|
| | | _lEventrecord.ParentId = _mJudgeCase.GetParentCaseId();
|
| | |
| | | }
|
| | | catch (EventAI.TraceLoopException tle)
|
| | | {
|
| | | log.Error(tle.Message);
|
| | | throw tle;
|
| | | Logger.Error(tle, tle.Message);
|
| | | throw;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | log.Error(e.Message);
|
| | | throw e;
|
| | | Logger.Error(e.Message);
|
| | | throw;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class AddrContrast
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | public static Hashtable MTotalData = null;
|
| | | public static string DefaultDept = "市區巡修課";
|
| | | private OracleConnection _connectionTpc;
|
| | | private RecordLog _pLog;
|
| | |
|
| | | public AddrContrast(OracleConnection conn, OracleTransaction trx, RecordLog log)
|
| | | public AddrContrast(OracleConnection conn, OracleTransaction trx)
|
| | | {
|
| | | _connectionTpc = conn;
|
| | | _pLog = log;
|
| | |
|
| | | string sqlStmt;
|
| | | string city;
|
| | | ArrayList mData = new ArrayList();
|
| | | string tmp = "";
|
| | |
|
| | |
| | | return;
|
| | |
|
| | | MTotalData = new Hashtable();
|
| | | sqlStmt = "SELECT DEPTID,CITY,TOWN,ROAD FROM CCS.ADDR_CONTRAST ORDER BY CITY,TOWN,ROAD";
|
| | | var sqlStmt = "SELECT DEPTID,CITY,TOWN,ROAD FROM CCS.ADDR_CONTRAST ORDER BY CITY,TOWN,ROAD";
|
| | |
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
| | | while (reader.Read())
|
| | | {
|
| | | ArrayList mRecord = new ArrayList();
|
| | | city = reader["CITY"].ToString();
|
| | | var city = reader["CITY"].ToString();
|
| | | mRecord.Add(city);
|
| | | mRecord.Add(reader["TOWN"].ToString());
|
| | | mRecord.Add(reader["ROAD"].ToString());
|
| | |
| | | return deptId;
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法取得所屬巡修部門代號,預設案件所屬巡修部門為市區巡修課!");
|
| | | Logger.Warn(e , e.Message);
|
| | | Logger.Warn("無法取得所屬巡修部門代號,預設案件所屬巡修部門為市區巡修課!");
|
| | | }
|
| | | // 當找不到部門別時,Default 設定為市巡
|
| | | dept = GlobalVariable.EosCodelist.GetKeyId(GlobalVariable.Dept, DefaultDept);
|
| | |
| | | using System.Data.OracleClient;
|
| | | using System.Net;
|
| | | using System.Net.Sockets;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class AlarmData
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | | private Hashtable _mTotalData = new Hashtable();
|
| | | private RecordLog _pLog;
|
| | | private OracleConnection _connectionTpc;
|
| | | private OracleTransaction _transaction;
|
| | |
|
| | | public AlarmData(OracleConnection conn, OracleTransaction trx, RecordLog log)
|
| | | public AlarmData(OracleConnection conn, OracleTransaction trx)
|
| | | {
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | | _pLog = log;
|
| | |
|
| | | string sqlStmt;
|
| | |
|
| | | sqlStmt = "SELECT DEPTID,IP1,IP2,IP_PATROL FROM CCS.ALARM_IP";
|
| | | var sqlStmt = "SELECT DEPTID,IP1,IP2,IP_PATROL FROM CCS.ALARM_IP";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occur when fetch alarm data: (" + e.Message + ")");
|
| | | Logger.Error(e, "Problems occur when fetch alarm data: (" + e.Message + ")");
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | |
| | |
|
| | | public bool Alarm(string acceptNum, int dept)
|
| | | {
|
| | | _pLog.Info("開始Alarm...");
|
| | | Logger.Info("開始Alarm...");
|
| | | Socket mClient;
|
| | | ArrayList ipAddressSet = GetIpAddress(GetSscCode(dept, Convert.ToInt32(DateTime.Now.DayOfWeek)));
|
| | | string ip1;
|
| | |
| | |
|
| | | if (ipAddressSet != null)
|
| | | {
|
| | | _pLog.Info("已取得該部門所需通知的IP Address.");
|
| | | Logger.Info("已取得該部門所需通知的IP Address.");
|
| | | ip1 = ipAddressSet[1].ToString();
|
| | | ip2 = ipAddressSet[2].ToString();
|
| | | ipPatrol = ipAddressSet[3].ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | _pLog.Warn("無法取得該部門所需通知的IP Address!");
|
| | | Logger.Warn("無法取得該部門所需通知的IP Address!");
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | mClient.Shutdown(SocketShutdown.Both);
|
| | | mClient.Close();
|
| | | RecordAlarmIp(acceptNum, ip1);
|
| | | _pLog.Info("已成功通知" + ip1 + " !");
|
| | | Logger.Info("已成功通知" + ip1 + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法通知" + ip1 + ": " + e.Message);
|
| | | Logger.Warn("無法通知" + ip1 + ": " + e.Message);
|
| | | }
|
| | |
|
| | | try
|
| | |
| | | mClient.Shutdown(SocketShutdown.Both);
|
| | | mClient.Close();
|
| | | RecordAlarmIp(acceptNum, ip2);
|
| | | _pLog.Info("已成功通知" + ip2 + " !");
|
| | | Logger.Info("已成功通知" + ip2 + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法通知" + ip2 + ": " + e.Message);
|
| | | Logger.Warn("無法通知" + ip2 + ": " + e.Message);
|
| | | }
|
| | |
|
| | | try
|
| | |
| | | mClient.Shutdown(SocketShutdown.Both);
|
| | | mClient.Close();
|
| | | RecordAlarmIp(acceptNum, ipPatrol);
|
| | | _pLog.Info("已成功通知" + ipPatrol + " !");
|
| | | Logger.Info("已成功通知" + ipPatrol + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法通知" + ipPatrol + ": " + e.Message);
|
| | | _pLog.Warn("三個IP均無法通知到!");
|
| | | Logger.Warn("無法通知" + ipPatrol + ": " + e.Message);
|
| | | Logger.Warn("三個IP均無法通知到!");
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | _pLog.Warn("無法紀錄Alarm IP!");
|
| | | Logger.Warn("無法紀錄Alarm IP!");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("recordAlarmIP Error." + e.Message);
|
| | | Logger.Error("recordAlarmIP Error." + e.Message);
|
| | | return;
|
| | | }
|
| | | finally
|
| | |
| | | using System.Data.OracleClient;
|
| | | using System.Linq;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using CCSTrace.TPower.DMMS.Model.CCS;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class CcsCodelist
|
| | | {
|
| | | private readonly Dictionary<int, Dictionary<int, Codelist>> _mTotalData = new Dictionary<int, Dictionary<int, Codelist>>();
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private readonly Dictionary<int, Dictionary<int, CODELIST>> _mTotalData = new Dictionary<int, Dictionary<int, CODELIST>>();
|
| | |
|
| | | public CcsCodelist(OracleConnection connectionTpc)
|
| | | {
|
| | |
| | | var keyId = Convert.ToInt32(reader["KEYID"].ToString());
|
| | | var item = (reader["ITEM"].ToString());
|
| | | var content = (reader["CONTENT"].ToString());
|
| | | Codelist codelist = new Codelist(indexId, keyId, item, content);
|
| | | CODELIST codelist = new CODELIST(indexId, keyId, item, content);
|
| | | if (!_mTotalData.ContainsKey(indexId))
|
| | | {
|
| | | _mTotalData.Add(indexId, new Dictionary<int, Codelist>());
|
| | | _mTotalData.Add(indexId, new Dictionary<int, CODELIST>());
|
| | | }
|
| | | Dictionary<int, Codelist> keys = _mTotalData[indexId];
|
| | | Dictionary<int, CODELIST> keys = _mTotalData[indexId];
|
| | | if (keys.ContainsKey(keyId))
|
| | | {
|
| | | keys.Add(keyId, codelist);
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine("Error on Startup EOSCodelist: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Warn(e, "Error on Startup CCSCodelist: " + e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public Codelist[] GetAllContent(int mIndexId)
|
| | | public CODELIST[] GetAllContent(int mIndexId)
|
| | | {
|
| | | return _mTotalData[mIndexId].Values.ToArray();
|
| | | }
|
| | |
|
| | | public string GetContent(int mIndexId, int mKeyId)
|
| | | {
|
| | | return _mTotalData[mIndexId][mKeyId].Content;
|
| | | return _mTotalData[mIndexId][mKeyId].CONTENT;
|
| | | }
|
| | |
|
| | | public string GetContent(int mIndexId, string mItem)
|
| | | {
|
| | | string mResult = "";
|
| | |
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | Dictionary<int, CODELIST> mTmp = _mTotalData[mIndexId];
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | foreach (KeyValuePair<int, CODELIST> pair in mTmp)
|
| | | {
|
| | | if (pair.Value.Item.Equals(mItem))
|
| | | if (pair.Value.ITEM.Equals(mItem))
|
| | | {
|
| | | mResult = pair.Value.Content;
|
| | | mResult = pair.Value.CONTENT;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public int GetKeyId(int mIndexId, string mContent)
|
| | | {
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | Dictionary<int, CODELIST> mTmp = _mTotalData[mIndexId];
|
| | | int mResult = 0;
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | foreach (KeyValuePair<int, CODELIST> pair in mTmp)
|
| | | {
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | if (pair.Value.CONTENT.Equals(mContent))
|
| | | {
|
| | | mResult = pair.Key;
|
| | | break;
|
| | |
| | |
|
| | | public string GetItem(int mIndexId, string mContent)
|
| | | {
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | Dictionary<int, CODELIST> mTmp = _mTotalData[mIndexId];
|
| | | string mResult = "";
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | foreach (KeyValuePair<int, CODELIST> pair in mTmp)
|
| | | {
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | if (pair.Value.CONTENT.Equals(mContent))
|
| | | {
|
| | | mResult = pair.Value.Item;
|
| | | mResult = pair.Value.ITEM;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class CcsRecord
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private readonly string _meter;
|
| | | private readonly string _customerName;
|
| | | private readonly string _customerTel;
|
| | |
| | | _acceptTime = accepttime;
|
| | | }
|
| | |
|
| | | public CcsRecord(string ccsid, OracleConnection connectionTpc, SEventLog pLog)
|
| | | public CcsRecord(string ccsid, OracleConnection connectionTpc)
|
| | | {
|
| | | var sqlStmt = "SELECT METER,CUSTOMERNAME,CUSTOMERTEL,ADDR_CITY,ADDR_TOWN,ADDR_ROAD,ADDR_OTHER,RECALLNAME,RECALLTEL,EVENTBRIEF,"
|
| | | + "TO_CHAR(ACCEPTTIME,'YYYY/MM/DD HH24:MI:SS') as ACCEPTTIME,CCSID,IMPORTCASE,DEPT,PARTHICUSTOMER,NOTE FROM CCS.EVENTRECORD "
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | pLog.Error("無法取得CCS報案資訊!" + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | throw e;
|
| | | Logger.Error(e, "無法取得CCS報案資訊!" + e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | |
|
| | | public string Note => _note;
|
| | |
|
| | | public bool InsertDb(OracleConnection connectionTpc, OracleTransaction transaction, SEventLog pLog)
|
| | | public bool InsertDb(OracleConnection connectionTpc, OracleTransaction transaction)
|
| | | {
|
| | | var sqlStmt = "INSERT INTO CCS.EVENTRECORD VALUES ('" + _meter + "','" + _customerName + "','" + _customerTel + "','" + _addrCity + "','"
|
| | | + _addrTown + "','" + _addrRoad + "','" + _addrOther + "','" + _recallName + "','" + _recallTel + "',"
|
| | |
| | | {
|
| | | if (command.ExecuteNonQuery() != 1)
|
| | | {
|
| | | pLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");
|
| | |
|
| | | throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | pLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!" + e.Message);
|
| | | //throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中");
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | |
| | |
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class DeptContrast
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private ArrayList _mTotalData = null;
|
| | | public static string DefaultDept = "市區巡修課";
|
| | |
|
| | |
| | | using System.Data.OracleClient;
|
| | | using System.Linq;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using CCSTrace.TPower.DMMS.Model.CCS;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EosCodelist
|
| | | {
|
| | | private readonly Dictionary<int, Dictionary<int, Codelist>> _mTotalData = new Dictionary<int, Dictionary<int, Codelist>>();
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private readonly Dictionary<int, Dictionary<int, CODELIST>> _mTotalData = new Dictionary<int, Dictionary<int, CODELIST>>();
|
| | |
|
| | | public EosCodelist(OracleConnection connection)
|
| | | {
|
| | |
| | | var keyId = Convert.ToInt32(reader["KEYID"].ToString());
|
| | | var item = (reader["ITEM"].ToString());
|
| | | var content = (reader["CONTENT"].ToString());
|
| | | Codelist codelist = new Codelist(indexId, keyId, item, content);
|
| | | CODELIST codelist = new CODELIST(indexId, keyId, item, content);
|
| | | if (!_mTotalData.ContainsKey(indexId))
|
| | | {
|
| | | _mTotalData.Add(indexId, new Dictionary<int, Codelist>());
|
| | | _mTotalData.Add(indexId, new Dictionary<int, CODELIST>());
|
| | | }
|
| | | Dictionary<int, Codelist> keys = _mTotalData[indexId];
|
| | | Dictionary<int, CODELIST> keys = _mTotalData[indexId];
|
| | | if (keys.ContainsKey(keyId))
|
| | | {
|
| | | keys.Add(keyId, codelist);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public Codelist[] GetAllContent(int mIndexId)
|
| | | public CODELIST[] GetAllContent(int mIndexId)
|
| | | {
|
| | | return _mTotalData[mIndexId].Values.ToArray();
|
| | | }
|
| | |
|
| | | public string GetContent(int mIndexId, int mKeyId)
|
| | | {
|
| | | return _mTotalData[mIndexId][mKeyId].Content;
|
| | | return _mTotalData[mIndexId][mKeyId].CONTENT;
|
| | | }
|
| | |
|
| | | public string GetContent(int mIndexId, string mItem)
|
| | | {
|
| | | string mResult = "";
|
| | |
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | Dictionary<int, CODELIST> mTmp = _mTotalData[mIndexId];
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | foreach (KeyValuePair<int, CODELIST> pair in mTmp)
|
| | | {
|
| | | if (pair.Value.Item.Equals(mItem))
|
| | | if (pair.Value.ITEM.Equals(mItem))
|
| | | {
|
| | | mResult = pair.Value.Content;
|
| | | mResult = pair.Value.CONTENT;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public int GetKeyId(int mIndexId, string mContent)
|
| | | {
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | Dictionary<int, CODELIST> mTmp = _mTotalData[mIndexId];
|
| | | int mResult = 0;
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | foreach (KeyValuePair<int, CODELIST> pair in mTmp)
|
| | | {
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | if (pair.Value.CONTENT.Equals(mContent))
|
| | | {
|
| | | mResult = pair.Key;
|
| | | break;
|
| | |
| | | using System;
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EventQuery
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | | |
| | | //private CCS.Function.TransferDate convert = new CCS.Function.TransferDate();
|
| | |
|
| | | public string CcsId { get; set; }
|
| | |
| | |
|
| | | public string EventLocation { get; set; } = "";
|
| | |
|
| | | public bool Insert(RecordLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | string sqlStmt;
|
| | |
|
| | | if (!Check())
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (Meter == null)
|
| | | {
|
| | | sqlStmt =
|
| | | $"INSERT INTO CCS.EVENTQUERY (CCSID,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" +
|
| | | "'" + CcsId
|
| | | + "'," + CaseStatus + ",to_date('" + ChangeTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('"
|
| | | + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('" + AssumedTimeNth +
|
| | | "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | | }
|
| | | else
|
| | | {
|
| | | sqlStmt =
|
| | | $"INSERT INTO CCS.EVENTQUERY (CCSID,METER,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" +
|
| | | "'"
|
| | | + CcsId + "','" + Meter + "'," + CaseStatus + ",to_date('" + ChangeTime +
|
| | | "','yyyy/mm/dd hh24:mi:ss'),to_date('" + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),to_date('"
|
| | | + AssumedTimeNth + "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | | }
|
| | |
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public bool Insert(SEventLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | public bool Insert(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | string sqlStmt;
|
| | |
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | throw e;
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public bool Update(RecordLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | public bool Update(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | if (!Check())
|
| | | {
|
| | |
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | pLog.Error("更新CCS.EVENTQUERY資料失敗.");
|
| | | Logger.Error("更新CCS.EVENTQUERY資料失敗.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | public bool UpdateCaseStatus(SEventLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | public bool UpdateCaseStatus(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | var sqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS = " + CaseStatus + " WHERE CCSID = '" + CcsId + "'";
|
| | |
|
| | |
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | pLog.Error("更新CCS.EVENTQUERY的CASESTATUS失敗.");
|
| | | Logger.Error("更新CCS.EVENTQUERY的CASESTATUS失敗.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | throw e;
|
| | | Logger.Error(e, e.Message);
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EventRecord
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | | //private CCS.Function.TransferDate Convert = new CCS.Function.TransferDate();
|
| | |
|
| | | public EventRecord(int mCaseId, OracleConnection conn, OracleTransaction trx)
|
| | |
| | | using System;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class LocateEquipment
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private int _caseId = 0;
|
| | | private int _dsUfid = -1;
|
| | | private int _fsc = 0;
|
| | |
| | | using System;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class NumberContrast
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private string _ccsid;
|
| | | private string _acceptNum;
|
| | | private int _caseId;
|
| | |
| | |
|
| | | public class ProcessEvent
|
| | | {
|
| | | private static Logger logger = LogManager.GetCurrentClassLogger();
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private readonly OracleConnection _connectionTpc;
|
| | | private readonly CcsRecord _mCcsRecord;
|
| | |
|
| | | private EventRecord _mEventRecord;
|
| | | private readonly RecordLog _pLog;
|
| | | private readonly string _traceConnectionString = string.Empty;
|
| | | private OracleTransaction _trx;
|
| | |
|
| | |
| | | _mCcsRecord = record;
|
| | | _connectionTpc = conn;
|
| | | _traceConnectionString = traceConnection;
|
| | | _pLog = new RecordLog(GlobalVariable.CcsListPath + record.CcsId + ".txt");
|
| | | }
|
| | |
|
| | | public event ThreadEndEventHandler ThreadFinish;
|
| | |
| | | */
|
| | | if (InitialEventRecord(_mCcsRecord.CcsId))
|
| | | {
|
| | | var mLeach = new Leach(_connectionTpc, _trx, _traceConnectionString, _pLog); // 案件過濾與合併
|
| | | _pLog.Info("過濾案件...");
|
| | | var mLeach = new Leach(_connectionTpc, _trx, _traceConnectionString); // 案件過濾與合併
|
| | | Logger.Info("過濾案件...");
|
| | | var returnStatus = mLeach.LeachCase(_mEventRecord);
|
| | |
|
| | | switch (returnStatus)
|
| | | {
|
| | | case GlobalVariable.Success:
|
| | | _pLog.Info("案件過濾完畢....");
|
| | | Logger.Info("案件過濾完畢....");
|
| | | Process(GlobalVariable.Success);
|
| | | break;
|
| | |
|
| | | case GlobalVariable.NoMeter:
|
| | | _pLog.Info("案件過濾完畢,用戶無電號....");
|
| | | Logger.Info("案件過濾完畢,用戶無電號....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | |
|
| | | case GlobalVariable.SameCustomer:
|
| | | _pLog.Info("相同用戶重複來電....");
|
| | | Logger.Info("相同用戶重複來電....");
|
| | | ProcessSameCustomer(_mCcsRecord, _mEventRecord);
|
| | | break;
|
| | |
|
| | | case GlobalVariable.NoSupplyElc:
|
| | | _pLog.Warn("該饋線未供電,無法作事故案件追蹤合併....");
|
| | | Logger.Warn("該饋線未供電,無法作事故案件追蹤合併....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | |
|
| | | case GlobalVariable.NoSxfmr:
|
| | | _pLog.Warn("該案件無變壓器....");
|
| | | Logger.Warn("該案件無變壓器....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | |
|
| | | case GlobalVariable.CaseTypeChanged:
|
| | | _pLog.Info("變更案件狀態....");
|
| | | Logger.Info("變更案件狀態....");
|
| | | Process(GlobalVariable.CaseTypeChanged);
|
| | | break;
|
| | |
|
| | | case GlobalVariable.TraceFailure:
|
| | | _pLog.Error("故障追蹤錯誤,以一般無電號案件方式受理....");
|
| | | Logger.Error("故障追蹤錯誤,以一般無電號案件方式受理....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | |
| | | _trx.Dispose();
|
| | |
|
| | | if (returnStatus == GlobalVariable.CaseTransfer)
|
| | | _pLog.Error("案件已移轉,此事故案件暫不被受理....");
|
| | | Logger.Error("案件已移轉,此事故案件暫不被受理....");
|
| | | else if (returnStatus == GlobalVariable.FailureByDb)
|
| | | _pLog.Error("資料庫錯誤,此事故案件暫不被受理....");
|
| | | Logger.Error("資料庫錯誤,此事故案件暫不被受理....");
|
| | | else if (returnStatus == GlobalVariable.FdrLocked)
|
| | | _pLog.Error("饋線被鎖定,此事故案件暫不被受理....");
|
| | | Logger.Error("饋線被鎖定,此事故案件暫不被受理....");
|
| | | else
|
| | | _pLog.Error("發生非預期錯誤,此事故案件暫不被受理....");
|
| | | Logger.Error("發生非預期錯誤,此事故案件暫不被受理....");
|
| | |
|
| | | if (traceCount == 0)
|
| | | UpdateTraceCount(_mCcsRecord.CcsId, true);
|
| | |
| | | if (returnStatus == GlobalVariable.TraceCounts3)
|
| | | _mEventRecord.Note = _mEventRecord.Note+ "(本案用戶供電資料追蹤失敗)";
|
| | |
|
| | | _pLog.Error("事故案件處理次數3次,仍無法正常處理,以一般無電號案件方式受理....");
|
| | | Logger.Error("事故案件處理次數3次,仍無法正常處理,以一般無電號案件方式受理....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | sendMail = true;
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine("Error = " + e.Message + ". CCSID = " + _mCcsRecord.CcsId);
|
| | | _pLog.Error("Error = " + e.Message + ". CCSID = " + _mCcsRecord.CcsId);
|
| | | Logger.Error(e, e.Message + ". CCSID = " + _mCcsRecord.CcsId);
|
| | |
|
| | | if (_trx != null)
|
| | | {
|
| | |
| | | }
|
| | | finally
|
| | | {
|
| | | _pLog.Close();
|
| | | CcsMain.ProcessCases.Remove(_mCcsRecord.CcsId);
|
| | | OnThreadFinish(new ThreadEndEvent(_connectionTpc));
|
| | | }
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | if (finishEvent.Finish(kind, _mEventRecord, _connectionTpc, _trx, _pLog))
|
| | | if (finishEvent.Finish(kind, _mEventRecord, _connectionTpc, _trx))
|
| | | {
|
| | | _pLog.Info("OMS資料更新成功!");
|
| | | Logger.Info("OMS資料更新成功!");
|
| | | if (UpdateCcsData(_mEventRecord, _mCcsRecord, (int) CCSCaseState.WaitForDespatch))
|
| | | {
|
| | | _pLog.Info("CCS資料更新成功!");
|
| | | Logger.Info("CCS資料更新成功!");
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | _trx.Rollback();
|
| | |
|
| | | _trx.Dispose();
|
| | | _pLog.Error("CCS資料更新程序發生錯誤!");
|
| | | Logger.Error("CCS資料更新程序發生錯誤!");
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | _trx.Commit();
|
| | | _trx.Dispose();
|
| | | ;
|
| | | var alarmClient = new AlarmData(_connectionTpc, _trx, _pLog);
|
| | | var alarmClient = new AlarmData(_connectionTpc, _trx);
|
| | | alarmClient.Alarm(_mEventRecord.AcceptNum, _mEventRecord.Dept);
|
| | | }
|
| | | else
|
| | |
| | |
|
| | | _trx.Dispose();
|
| | | ;
|
| | | _pLog.Error("OMS資料更新程序發生錯誤!");
|
| | | Logger.Error("OMS資料更新程序發生錯誤!");
|
| | | }
|
| | | _pLog.Info("CCS 案件受理程序結束.");
|
| | | Logger.Info("CCS 案件受理程序結束.");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | |
|
| | | private bool UpdateCcsData(EventRecord mRecord, CcsRecord mCcsRecord, int caseStatus)
|
| | | {
|
| | | _pLog.Info("進行CCS資料更新程序...");
|
| | | Logger.Info("進行CCS資料更新程序...");
|
| | | var eventQuery = new EventQuery();
|
| | | var status = caseStatus;
|
| | | // 設定CCSID
|
| | |
| | | }
|
| | | eventQuery.CaseStatus = status;
|
| | | // 更新CCS.EventQuery
|
| | | if (!eventQuery.Update(_pLog, _connectionTpc, _trx))
|
| | | if (!eventQuery.Update(_connectionTpc, _trx))
|
| | | {
|
| | | _pLog.Error("更新ccs.eventquery失敗!");
|
| | | Logger.Error("更新ccs.eventquery失敗!");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("更新ccs.eventquery成功!");
|
| | | Logger.Info("更新ccs.eventquery成功!");
|
| | | var numberContrast = new NumberContrast();
|
| | | numberContrast.SetAcceptNum(mRecord.AcceptNum);
|
| | | numberContrast.SetCaseId(mRecord.CaseId);
|
| | |
| | | // 更新CCS.Num_Contrast
|
| | | if (!numberContrast.Update(_connectionTpc, _trx))
|
| | | {
|
| | | _pLog.Error("更新ccs.num_contrast失敗!");
|
| | | Logger.Error("更新ccs.num_contrast失敗!");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("更新ccs.num_contrast成功!");
|
| | | Logger.Info("更新ccs.num_contrast成功!");
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool InitialEventRecord(string ccsid)
|
| | | {
|
| | | var initialData = new InitialEventData(_connectionTpc, _pLog);
|
| | | var initialData = new InitialEventData(_connectionTpc);
|
| | | var mContrast = new NumberContrast();
|
| | | DeptContrast deptContrast = null;
|
| | |
|
| | |
| | |
|
| | | if (!mContrast.Insert(_connectionTpc, _trx))
|
| | | {
|
| | | _pLog.Error("初始化寫入CCS.Num_Contrast時發生錯誤!");
|
| | | Logger.Error("初始化寫入CCS.Num_Contrast時發生錯誤!");
|
| | |
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
| | |
|
| | | if (mAddr.Trim().Length == 0)
|
| | | {
|
| | | _pLog.Error("CCS 案件受理程序初始化失敗...地址為空白");
|
| | | Logger.Error("CCS 案件受理程序初始化失敗...地址為空白");
|
| | |
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
| | | _mEventRecord.IsReCall = GlobalVariable.NotReCall;
|
| | | }
|
| | |
|
| | | _pLog.Info("初始化EOS.EVENTRECORD成功!");
|
| | | Logger.Info("初始化EOS.EVENTRECORD成功!");
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Warn("Problems occur during checking process: " + ex.Message);
|
| | | Logger.Warn(ex, "Problems occur during checking process: " + ex.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | |
|
| | | private int FindoutDeptByAddr(CcsRecord ccsRecord, OracleTransaction trx)
|
| | | {
|
| | | var addrContrast = new AddrContrast(_connectionTpc, trx, _pLog);
|
| | | var addrContrast = new AddrContrast(_connectionTpc, trx);
|
| | | return addrContrast.FindDeptId(ccsRecord.AddressCity, ccsRecord.AddressTown, ccsRecord.AddressRoad);
|
| | | }
|
| | |
|
| | |
| | | status = Convert.ToInt32(reader["CaseStatus"].ToString());
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法取得正確之母案件狀態.");
|
| | | Logger.Error(e, e.Message);
|
| | | Logger.Warn("無法取得正確之母案件狀態.");
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | mEventQry.EventLocation = reader["eventlocation"].ToString();
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法取得母案件派工資訊.");
|
| | | Logger.Error(e, e.Message);
|
| | | Logger.Warn("無法取得母案件派工資訊.");
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | |
|
| | | private void ProcessSameCustomer(CcsRecord mCcsRecord, EventRecord mEventRec)
|
| | | {
|
| | | _pLog.Info("處理相同用戶重複來電...");
|
| | | Logger.Info("處理相同用戶重複來電...");
|
| | | StringBuilder note = null;
|
| | |
|
| | | var sqlStmt = "select note from eos.eventrecord where caseid = " + mEventRec.TmpCaseId;
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | var updEosEventRecord = "update eos.eventrecord set note = '" + TrimToLimit(note.ToString(), 127)
|
| | | var updEosEventRecord = "UPDATE EOS.EVENTRECORD SET NOTE = '" + TrimToLimit(note.ToString(), 127)
|
| | | + "' where caseid = " + _mEventRecord.TmpCaseId;
|
| | | var updCcsNumContrast = "update ccs.num_contrast set(acceptnum,caseid) = (select acceptnum," +
|
| | | mEventRec.TmpCaseId + " from eos.eventrecord where caseid = " + mEventRec.TmpCaseId+
|
| | | var updCcsNumContrast = "UPDATE CCS.NUM_CONTRAST SET(acceptnum,caseid) = (SELECT acceptnum," +
|
| | | mEventRec.TmpCaseId + " FROM eos.eventrecord WHERE caseid = " + mEventRec.TmpCaseId+
|
| | | ") where ccsid='" + mCcsRecord.CcsId + "'";
|
| | |
|
| | | var exeCommand = new OracleCommand(updCcsEventQuery, _connectionTpc, _trx);
|
| | |
| | | _trx.Rollback();
|
| | |
|
| | | _trx.Dispose();
|
| | | _pLog.Error("Fail in write back to ccs.eventquery");
|
| | | Logger.Error("Fail in write back to ccs.eventquery");
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | _trx.Rollback();
|
| | |
|
| | | _trx.Dispose();
|
| | | _pLog.Error("Fail in update eos.eventquery");
|
| | | Logger.Error("Fail in update eos.eventquery");
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | _trx.Rollback();
|
| | |
|
| | | _trx.Dispose();
|
| | | _pLog.Error("Fail in insert into ccs.num_contrast");
|
| | | Logger.Error("Fail in insert into ccs.num_contrast");
|
| | | return;
|
| | | }
|
| | |
|
| | | exeCommand.Dispose();
|
| | | _trx.Commit();
|
| | | _trx.Dispose();
|
| | | _pLog.Info("CCS 案件受理程序結束");
|
| | | Logger.Info("CCS 案件受理程序結束");
|
| | | }
|
| | |
|
| | | private string TrimToLimit(string msg, int maxLen)
|
| | |
| | | {
|
| | | return msg;
|
| | | }
|
| | | msg = msg.Substring(msg.IndexOf("|") + 1);
|
| | | msg = msg.Substring(msg.IndexOf("|", StringComparison.Ordinal) + 1);
|
| | | return TrimToLimit(msg, maxLen);
|
| | | }
|
| | | catch (Exception ex)
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(ex.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | return "";
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | using System;
|
| | | using System.IO;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class RecordLog
|
| | | {
|
| | | private readonly StreamWriter _sWriter = null;
|
| | |
|
| | | public RecordLog(string filePath)
|
| | | {
|
| | | _sWriter = new StreamWriter(filePath, true);
|
| | | }
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | public void Debug(object message)
|
| | | {
|
| | | _sWriter.WriteLine("[Debug] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | Logger.Debug(message);
|
| | | }
|
| | |
|
| | | public void Error(object message)
|
| | | {
|
| | | _sWriter.WriteLine("[Error] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | Logger.Error(message);
|
| | | }
|
| | |
|
| | | public void Fatal(object message)
|
| | | {
|
| | | _sWriter.WriteLine("[Fatal] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | Logger.Fatal(message);
|
| | | }
|
| | |
|
| | | public void Info(object message)
|
| | | {
|
| | | _sWriter.WriteLine("[Info] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | Logger.Info(message);
|
| | | }
|
| | |
|
| | | public void Warn(object message)
|
| | | {
|
| | | _sWriter.WriteLine("[Warn] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | }
|
| | |
|
| | | public void Close()
|
| | | {
|
| | | _sWriter.Close();
|
| | | Logger.Warn(message);
|
| | | }
|
| | | }
|
| | | } |
| | |
| | | <ItemGroup>
|
| | | <Compile Include="CCS\CCSMain.cs" />
|
| | | <Compile Include="CCS\Domain\CCSCaseState.cs" />
|
| | | <Compile Include="CCS\Domain\Codelist.cs" />
|
| | | <Compile Include="CCS\EventAI\Equipment.cs" />
|
| | | <Compile Include="CCS\EventAI\JudgeCase.cs" />
|
| | | <Compile Include="CCS\EventAI\TraceSubject.cs" />
|
| | | <Compile Include="CCS\Function\MailService.cs" />
|
| | | <Compile Include="CCS\GlobalVariable.cs" />
|
| | | <Compile Include="CCS\SEventLog.cs" />
|
| | | <Compile Include="CCS\FinishEvent.cs" />
|
| | | <Compile Include="CCS\Function\InitialEventData.cs" />
|
| | | <Compile Include="CCS\Function\Leach.cs" />
|
| | |
| | | <Compile Include="TPower\DMMS\Model\BaseDB\SXFMR.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\ADDRCONTRAST.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\ALARMIP.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\CODELIST.CODELIST.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\CODELIST.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\DEPTCONTRAST.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\EVENTQUERY.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\EVENTRECORD.cs" />
|
| | |
| | | using System.Web.Security; |
| | | using System.Web.SessionState; |
| | | using CCSTrace.CCS; |
| | | using NLog; |
| | | |
| | | namespace CCSTrace |
| | | { |
| | | public class Global : System.Web.HttpApplication |
| | | { |
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
| | | |
| | | protected void Application_Start(object sender, EventArgs e) |
| | | { |
| | | Logger.Info("CCSTrace WebService Application Startup."); |
| | | CcsMain appMain = CcsMain.Instance(); |
| | | string path = HttpContext.Current.Server.MapPath("~/App_Data"); |
| | | appMain.AppDataPath = path; |
| | | appMain.Startup(); |
| | | } |
| | | |
| | |
| | | |
| | | protected void Application_End(object sender, EventArgs e) |
| | | { |
| | | Logger.Info("CCSTrace WebService Application Shutdown."); |
| | | CcsMain appMain = CcsMain.Instance(); |
| | | appMain.Shutdown(); |
| | | } |
| | |
| | | <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" |
| | | layout="${longdate} ${uppercase:${level}} ${message}" /> |
| | | --> |
| | | <target xsi:type="File" name="file" |
| | | fileName="${basedir}/App_Data/Logs/${shortdate}/ccstrace-${logger}.txt" |
| | | layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${newline}" /> |
| | | <target xsi:type="File" name="fileRecord" |
| | | fileName="${basedir}/App_Data/Logs/${shortdate}/ccsrecord-${logger}.txt" |
| | | layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${newline}" /> |
| | | <target xsi:type="File" name="FatalFile" |
| | | fileName="${basedir}/App_Data/Logs/${shortdate}/FatalFile.txt" |
| | | layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${newline}" /> |
| | | <target xsi:type="EventLog" name="eventlog" |
| | | source="CCSTrace" log="Application" |
| | | layout="${date}: ${message} ${stacktrace}" /> |
| | | <target xsi:type="Trace" name="traceLog" |
| | | layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${newline}" /> |
| | | <target xsi:type="Console" name="consoleLog" |
| | | layout="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${newline}" /> |
| | | </targets> |
| | | |
| | | <rules> |
| | | <!-- add your logging rules here --> |
| | | |
| | |
| | | Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" |
| | | <logger name="*" minlevel="Debug" writeTo="f" /> |
| | | --> |
| | | <logger name="*" levels="Trace, Debug, Info, Warn, Error, Fatal" writeTo="file" /> |
| | | <logger name="*" levels="Trace, Debug, Info, Warn, Error, Fatal" writeTo="consoleLog" /> |
| | | <logger name="*" levels="Trace, Debug, Info, Warn, Error, Fatal" writeTo="traceLog"/> |
| | | <logger name="*" level="Warn, Error, Fatal" writeTo="FatalFile" /> |
| | | <logger name="*" level="Warn, Error, Fatal" writeTo="eventlog" /> |
| | | <logger name="CCSTrace.CCS.SEventLog" writeTo="eventlog" /> |
| | | <logger name="CCSTrace.CCS.RecordLog" writeTo="fileRecord" /> |
| | | </rules> |
| | | </nlog> |
| | |
| | | addrOther, recallname, recalltel, eventbrief, accepttime, importcase, dept,
|
| | | partHicustomer, note);
|
| | | //_CCSMain.AcceptEvent(_Record);
|
| | | CCSTrace.CCS.CcsMain.Instance().AcceptEvent(record);
|
| | | CCS.CcsMain.Instance()?.AcceptEvent(record);
|
| | | }
|
| | |
|
| | |
|