1 files deleted
28 files modified
| | |
| | |
|
| | | Microsoft Visual Studio Solution File, Format Version 11.00
|
| | | # Visual Studio 2010
|
| | | Microsoft Visual Studio Solution File, Format Version 12.00
|
| | | # Visual Studio 14
|
| | | VisualStudioVersion = 14.0.25123.0
|
| | | MinimumVisualStudioVersion = 10.0.40219.1
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCSTrace", "CCSTrace\CCSTrace.csproj", "{E56EE563-6708-4448-85C4-9AE3C01E1B86}"
|
| | | EndProject
|
| | | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "CCSTracex64", "CCSTracex64\CCSTracex64.vdproj", "{5DF7599C-A1CE-4C2A-846C-76505DA5B656}"
|
| | | EndProject
|
| | | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "CCSTracex86", "CCSTracex86\CCSTracex86.vdproj", "{BB9B551B-D3F7-4A48-8FB9-7E08A989307A}"
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCSTrace.Tests", "CCSTrace.Tests\CCSTrace.Tests.csproj", "{6CD5DE3F-1581-4F40-9971-264802B47DE6}"
|
| | | EndProject
|
| | | Global
|
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
| | | Debug|Any CPU = Debug|Any CPU
|
| | | Debug|x86 = Debug|x86
|
| | | Release|Any CPU = Release|Any CPU
|
| | | Release|x86 = Release|x86
|
| | | EndGlobalSection
|
| | | GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Debug|x86.ActiveCfg = Debug|Any CPU
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Debug|x86.Build.0 = Debug|Any CPU
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Release|Any CPU.Build.0 = Release|Any CPU
|
| | | {5DF7599C-A1CE-4C2A-846C-76505DA5B656}.Debug|Any CPU.ActiveCfg = Debug
|
| | | {5DF7599C-A1CE-4C2A-846C-76505DA5B656}.Debug|Any CPU.Build.0 = Debug
|
| | | {5DF7599C-A1CE-4C2A-846C-76505DA5B656}.Release|Any CPU.ActiveCfg = Release
|
| | | {5DF7599C-A1CE-4C2A-846C-76505DA5B656}.Release|Any CPU.Build.0 = Release
|
| | | {BB9B551B-D3F7-4A48-8FB9-7E08A989307A}.Debug|Any CPU.ActiveCfg = Debug
|
| | | {BB9B551B-D3F7-4A48-8FB9-7E08A989307A}.Debug|Any CPU.Build.0 = Debug
|
| | | {BB9B551B-D3F7-4A48-8FB9-7E08A989307A}.Release|Any CPU.ActiveCfg = Release
|
| | | {BB9B551B-D3F7-4A48-8FB9-7E08A989307A}.Release|Any CPU.Build.0 = Release
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Release|x86.ActiveCfg = Release|Any CPU
|
| | | {E56EE563-6708-4448-85C4-9AE3C01E1B86}.Release|x86.Build.0 = Release|Any CPU
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Debug|x86.ActiveCfg = Debug|x86
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Debug|x86.Build.0 = Debug|x86
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Release|x86.ActiveCfg = Release|x86
|
| | | {6CD5DE3F-1581-4F40-9971-264802B47DE6}.Release|x86.Build.0 = Release|x86
|
| | | EndGlobalSection
|
| | | GlobalSection(SolutionProperties) = preSolution
|
| | | HideSolutionNode = FALSE
|
| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | | using System.Xml;
|
| | | using System.Data.OracleClient;
|
| | | using System.IO;
|
| | | using System.Runtime.CompilerServices;
|
| | | using System.Threading;
|
| | |
|
| | | using System.Web;
|
| | | using System.Xml;
|
| | | using Amib.Threading;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using CCSTrace.CCS.Object;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class CCSMain
|
| | | public class CcsMain
|
| | | {
|
| | | private static CCSMain _instance;
|
| | | public static CCS.Object.CCSCodelist CCSCodelist;
|
| | | public static CCS.Object.EOSCodelist EOSCodelist;
|
| | | public static System.Collections.ArrayList DBConnList = new System.Collections.ArrayList();
|
| | | public static System.Collections.ArrayList ProcessCases = new System.Collections.ArrayList();
|
| | | private const string DbConfigFilename = "DBConfig.xml";
|
| | |
|
| | | private string LoadFilename = "DBConfig.xml";
|
| | | private string ConnectionString = String.Empty;
|
| | | private string traceConnectionString = String.Empty;
|
| | | private int ConnectionCount = 1;
|
| | | public static System.Data.OracleClient.OracleConnection MainConn = null;
|
| | | static SEventLog _MainLog = null;
|
| | | private static Logger _logger = LogManager.GetCurrentClassLogger();
|
| | | private static CcsMain _instance;
|
| | |
|
| | | public static System.Collections.Hashtable ProcessFDR = new System.Collections.Hashtable();//Record the processing FDR
|
| | | public static System.Collections.ArrayList WaitingCases = new System.Collections.ArrayList();//Record the case when the case's FDR processed by another
|
| | | public static ArrayList ProcessCases = new ArrayList();
|
| | | public static Queue<int> ProcessCaseQueue = new Queue<int>();
|
| | | public static Hashtable ProcessFdr = new Hashtable();//Record the processing FDR
|
| | | public static ArrayList WaitingCases = new ArrayList();//Record the case when the case's FDR processed by another
|
| | |
|
| | | public CCSMain()
|
| | | private int _connectionCount = 1;
|
| | | private OracleConnection _mainConn = null;
|
| | | private SEventLog _mainLog = null;
|
| | |
|
| | | private SmartThreadPool _mainjobThreadPool = null;
|
| | | private readonly object _syncDbQueue = new object();
|
| | | private readonly Queue<OracleConnection> _dbQueue = new Queue<OracleConnection>();
|
| | |
|
| | | public CcsMain()
|
| | | {
|
| | | Initial();
|
| | | _mainjobThreadPool = new SmartThreadPool();
|
| | | // Startup();
|
| | | }
|
| | |
|
| | | public static CCSMain Instance()
|
| | | {
|
| | | public string AppDataPath { get; set; }
|
| | |
|
| | | public static CcsMain Instance()
|
| | | {
|
| | | // Uses lazy initialization.
|
| | |
|
| | | // Note: this is not thread safe.
|
| | |
|
| | | if (_instance == null)
|
| | | {
|
| | | _instance = new CCSMain();
|
| | |
|
| | | _instance = new CcsMain();
|
| | | }
|
| | | return _instance;
|
| | |
|
| | | }
|
| | |
|
| | | private void Initial()
|
| | | public void Startup()
|
| | | {
|
| | | _MainLog = new SEventLog();
|
| | | _mainLog = new SEventLog();
|
| | |
|
| | | try
|
| | | {
|
| | | ReadXML();
|
| | | ReadXml();
|
| | |
|
| | | if (MainConn == null)
|
| | | MainConn = CreateConnection();
|
| | | if (_mainConn == null)
|
| | | _mainConn = CreateConnection();
|
| | | //MainConn = CreateMainConnection();
|
| | |
|
| | | CCSCodelist = new CCSTrace.CCS.Object.CCSCodelist(MainConn);
|
| | | EOSCodelist = new CCSTrace.CCS.Object.EOSCodelist(MainConn);
|
| | | GlobalVariable.CcsCodelist = new CcsCodelist(_mainConn);
|
| | | GlobalVariable.EosCodelist = new EosCodelist(_mainConn);
|
| | |
|
| | | for (int i = 0; i < ConnectionCount; i++)
|
| | | DBConnList.Add(CreateConnection());
|
| | | for (int i = 0; i < _connectionCount; i++)
|
| | | {
|
| | | lock (_syncDbQueue) _dbQueue.Enqueue(CreateConnection());
|
| | | }
|
| | | }
|
| | | catch(Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | _MainLog.Error(e.Message);
|
| | | _mainLog.Error(e.Message);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _MainLog.Error(e.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(e.StackTrace);
|
| | |
|
| | | throw e;
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | _MainLog.Close();
|
| | | _mainLog.Close();
|
| | | }
|
| | |
|
| | | Object.CCSRecord m_Record = getWaitRecord();
|
| | | CcsRecord mRecord = GetWaitRecord(_mainConn);
|
| | |
|
| | | if (m_Record != null)
|
| | | if (mRecord != null)
|
| | | {
|
| | | System.Data.OracleClient.OracleConnection _Conn = (System.Data.OracleClient.OracleConnection)DBConnList[0];
|
| | | DBConnList.Remove(_Conn);
|
| | |
|
| | | ProcessCase(m_Record, _Conn);
|
| | | OracleConnection conn = null;
|
| | | lock (_syncDbQueue) conn = _dbQueue.Dequeue();
|
| | | ProcessCase(mRecord, conn);
|
| | | }
|
| | |
|
| | | STPStartInfo stpStartInfo = new STPStartInfo();
|
| | | stpStartInfo.IdleTimeout = GlobalVariable.IdleTimeout * 1000;
|
| | | stpStartInfo.MaxWorkerThreads = GlobalVariable.MaxThreadSize;
|
| | | stpStartInfo.MinWorkerThreads = GlobalVariable.MinThreadSize;
|
| | | _mainjobThreadPool = new SmartThreadPool(stpStartInfo);
|
| | | }
|
| | |
|
| | | public void AcceptEvent(Object.CCSRecord _Record)
|
| | | public void Shutdown()
|
| | | {
|
| | | _mainjobThreadPool.Shutdown(true, 1000);
|
| | | _mainjobThreadPool.Dispose();
|
| | | _mainjobThreadPool = null;
|
| | | GC.Collect();
|
| | | GC.WaitForPendingFinalizers();
|
| | | }
|
| | | public void AcceptEvent(CcsRecord record)
|
| | | {
|
| | | int i = 0;
|
| | | int ReConnectCount = 1;
|
| | | int reConnectCount = 1;
|
| | |
|
| | |
|
| | | while ( i <= ReConnectCount )
|
| | | while (i <= reConnectCount)
|
| | | {
|
| | | try
|
| | | {
|
| | | if (InsertEventRecord(_Record))
|
| | | if (InsertEventRecord(record, _mainConn))
|
| | | {
|
| | | if (DBConnList.Count > 0)
|
| | | if (_dbQueue.Count > 0)
|
| | | {
|
| | |
|
| | | //將EVETNQUERY的案件狀態改為開始處理
|
| | | Object.CCSRecord m_Record = getWaitRecord();
|
| | | CcsRecord mRecord = GetWaitRecord(_mainConn);
|
| | |
|
| | | if (m_Record != null)
|
| | | if (mRecord != null)
|
| | | {
|
| | | System.Data.OracleClient.OracleConnection _Conn = (System.Data.OracleClient.OracleConnection)DBConnList[0];
|
| | | DBConnList.Remove(_Conn);
|
| | |
|
| | | ProcessCase(m_Record, _Conn);
|
| | | OracleConnection conn = _dbQueue.Dequeue();
|
| | | ProcessCase(mRecord, conn);
|
| | | }
|
| | | }
|
| | |
|
| | | break;
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | catch (Exception)
|
| | | {
|
| | | if (MainConn.State.ToString().Equals("Closed"))
|
| | | if (_mainConn.State == ConnectionState.Closed)
|
| | | {
|
| | | i++;
|
| | | if (i > ReConnectCount)
|
| | | throw ex;
|
| | | if (i > reConnectCount)
|
| | | throw;
|
| | | }
|
| | | else
|
| | | throw ex;
|
| | | throw;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | private void ReadXML()
|
| | | private void ReadXml()
|
| | | {
|
| | | XmlReader reader = null;
|
| | |
|
| | | try
|
| | | {
|
| | | string file = Path.Combine(AppDataPath, DbConfigFilename);
|
| | | // 建立 XML 讀取器
|
| | | XmlReaderSettings settings = new XmlReaderSettings();
|
| | | settings.IgnoreComments = true; // 不處理註解
|
| | | settings.IgnoreWhitespace = true; // 跳過空白
|
| | | settings.ValidationType = ValidationType.None; // 不驗證任何資料
|
| | | reader = XmlTextReader.Create(System.AppDomain.CurrentDomain.BaseDirectory + "\\" + LoadFilename, settings);
|
| | | reader = XmlReader.Create(file, settings);
|
| | |
|
| | | // 進入讀取主要部分
|
| | | while (reader.Read())
|
| | |
| | | switch (reader.NodeType)
|
| | | {
|
| | | case XmlNodeType.Element:
|
| | | string LocalName = reader.LocalName; // 取得標籤名稱
|
| | | string localName = reader.LocalName; // 取得標籤名稱
|
| | |
|
| | | // Step 3: 讀取 FileInfo 標籤的屬性
|
| | | if (LocalName.Equals("DBSetting"))
|
| | | if (localName.Equals("DBSetting"))
|
| | | {
|
| | | ConnectionString = String.Format("Data source={0};User Id={1};Password={2};", reader["DataSource"], reader["UserId"], reader["Password"]) ;
|
| | | traceConnectionString = String.Format("{0}/{1}@{2}", reader["UserId"], reader["Password"], reader["DataSource"]);
|
| | | ConnectionCount = Int32.Parse(reader["ConnectionCount"]);
|
| | | LocalVariable.ShowError = bool.Parse(reader["ShowError"]);
|
| | | GlobalVariable.ConnectionString =
|
| | | $"Data source={reader["DataSource"]};User Id={reader["UserId"]};Password={reader["Password"]};";
|
| | | GlobalVariable.TraceConnectionString =
|
| | | $"{reader["UserId"]}/{reader["Password"]}@{reader["DataSource"]}";
|
| | | string token = reader["ConnectionCount"];
|
| | | if (token != null)
|
| | | {
|
| | | GlobalVariable.MaxConnectionCount = int.Parse(token);
|
| | | }
|
| | | token = reader["ShowError"];
|
| | | if (token != null)
|
| | | {
|
| | | GlobalVariable.ShowError = bool.Parse(token);
|
| | | }
|
| | | } else if (localName.Equals("ThreadSetting"))
|
| | | {
|
| | | string token = reader["maxThreadSize"];
|
| | | if (token != null)
|
| | | {
|
| | | GlobalVariable.MaxThreadSize = int.Parse(token);
|
| | | }
|
| | | token = reader["minThreadSize"];
|
| | | if (token != null)
|
| | | {
|
| | | GlobalVariable.MinThreadSize = int.Parse(token);
|
| | | }
|
| | | }
|
| | |
|
| | | break;
|
| | | }
|
| | | }
|
| | | reader.Close();
|
| | |
|
| | | }
|
| | | catch (System.Xml.XmlException xe)
|
| | | catch (XmlException xe)
|
| | | {
|
| | | Console.WriteLine(xe.StackTrace);
|
| | | reader.Close();
|
| | | reader?.Close();
|
| | | }
|
| | | }
|
| | |
|
| | | private System.Data.OracleClient.OracleConnection CreateConnection()
|
| | | private OracleConnection CreateConnection()
|
| | | {
|
| | | System.Data.OracleClient.OracleConnection DBConn = new System.Data.OracleClient.OracleConnection(ConnectionString);
|
| | | OracleConnection dbConn = new OracleConnection(GlobalVariable.ConnectionString);
|
| | |
|
| | | DBConn.Open();
|
| | | dbConn.Open();
|
| | |
|
| | | return DBConn;
|
| | | return dbConn;
|
| | | }
|
| | |
|
| | | [MethodImpl(MethodImplOptions.Synchronized)]
|
| | | private bool InsertEventRecord(Object.CCSRecord _Record)
|
| | | private bool InsertEventRecord(CcsRecord record, OracleConnection conn)
|
| | | {
|
| | | Object.EventQuery _EventQuery = null;
|
| | | System.Data.OracleClient.OracleTransaction _Transaction = null;
|
| | | OracleTransaction transaction = null;
|
| | |
|
| | | try
|
| | | {
|
| | | _MainLog = new SEventLog();
|
| | | _mainLog = new SEventLog();
|
| | |
|
| | | if (MainConn.State.ToString().Equals("Closed"))
|
| | | MainConn.Open();
|
| | | if (conn.State.ToString().Equals("Closed"))
|
| | | conn.Open();
|
| | |
|
| | | _Transaction = MainConn.BeginTransaction();
|
| | | transaction = conn.BeginTransaction();
|
| | |
|
| | | if (_Record.InsertDB(MainConn, _Transaction, _MainLog))
|
| | | if (record.InsertDb(conn, transaction, _mainLog))
|
| | | {
|
| | | _EventQuery = new CCSTrace.CCS.Object.EventQuery();
|
| | | var eventQuery = new EventQuery
|
| | | {
|
| | | CcsId = record.CcsId,
|
| | | Meter = record.Meter,
|
| | | CaseStatus = (int) CCSCaseState.EventInitial,
|
| | | ChangeTime = record.AcceptTime
|
| | | };
|
| | |
|
| | | _EventQuery.setCCSID(_Record.getCCSID());
|
| | | _EventQuery.setMeter(_Record.getMeter());
|
| | | _EventQuery.setCaseStatus(LocalVariable.EventInitial);
|
| | | _EventQuery.setChangeTime(_Record.getAcceptTime());
|
| | |
|
| | | if (_EventQuery.Insert(_MainLog, MainConn, _Transaction))
|
| | | _Transaction.Commit();
|
| | | if (eventQuery.Insert(_mainLog, conn, transaction))
|
| | | transaction.Commit();
|
| | | else
|
| | | {
|
| | | if (_Transaction.Connection.State.ToString().Equals("Open"))
|
| | | _Transaction.Rollback();
|
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | |
|
| | | throw new Exception("案件未受理成功。");
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (_Transaction.Connection.State.ToString().Equals("Open"))
|
| | | _Transaction.Rollback();
|
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | |
|
| | | throw new Exception("案件未受理成功。");
|
| | | }
|
| | |
|
| | | }
|
| | | catch (System.Data.OracleClient.OracleException e)
|
| | | catch (OracleException e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | _MainLog.Error(e.Message);
|
| | | _mainLog.Error(e.Message);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _MainLog.Error(e.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(e.StackTrace);
|
| | |
|
| | | if (_Transaction != null && _Transaction.Connection.State.ToString().Equals("Open") )
|
| | | _Transaction.Rollback();
|
| | | if (transaction != null && transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | |
|
| | | throw e;
|
| | | throw;
|
| | | }
|
| | | catch(Exception ex)
|
| | | {
|
| | | Console.WriteLine(ex.Message);
|
| | | Console.WriteLine(ex.StackTrace);
|
| | | _MainLog.Error(ex.Message);
|
| | | _mainLog.Error(ex.Message);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _MainLog.Error(ex.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(ex.StackTrace);
|
| | |
|
| | | if (_Transaction != null && _Transaction.Connection.State.ToString().Equals("Open") )
|
| | | _Transaction.Rollback();
|
| | | if (transaction != null && transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | |
|
| | | throw ex;
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | _MainLog.Close();
|
| | | _mainLog.Close();
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | delegate void WorkerThreadHandler();
|
| | | private delegate void WorkerThreadHandler();
|
| | |
|
| | | private void ProcessCase(Object.CCSRecord _Record, System.Data.OracleClient.OracleConnection _Conn)
|
| | | private void ProcessCase(CcsRecord record, OracleConnection conn)
|
| | | {
|
| | | try
|
| | | {
|
| | | if (_Conn.State.ToString().Equals("Closed"))
|
| | | _Conn.Open();
|
| | | if (conn.State.ToString().Equals("Closed"))
|
| | | conn.Open();
|
| | |
|
| | | ProcessEvent _ProcessEvent = new ProcessEvent(_Record, _Conn, traceConnectionString);
|
| | | _ProcessEvent.ThreadFinish += new ThreadEndEventHandler(ThreadEndEventProcess);
|
| | | ProcessEvent processEvent = new ProcessEvent(record, conn, GlobalVariable.TraceConnectionString);
|
| | | processEvent.ThreadFinish += ThreadEndEventProcess;
|
| | |
|
| | | System.Threading.ThreadStart _ThreadStart = new System.Threading.ThreadStart(_ProcessEvent.Run);
|
| | | System.Threading.Thread _Thread = new System.Threading.Thread(_ThreadStart);
|
| | | _Thread.Start();
|
| | | ThreadStart threadStart = processEvent.Run;
|
| | | Thread thread = new Thread(threadStart);
|
| | | thread.Start();
|
| | | }
|
| | | catch
|
| | | {
|
| | | DBConnList.Add(_Conn);
|
| | | lock (_syncDbQueue) _dbQueue.Enqueue(conn);
|
| | | }
|
| | | }
|
| | |
|
| | | private void ThreadEndEventProcess(object sender, ThreadEndEvent e)
|
| | | {
|
| | | //將EVETNQUERY的案件狀態改為開始處理
|
| | | Object.CCSRecord m_Record = getWaitRecord();
|
| | | CcsRecord mRecord = GetWaitRecord(e.GetConnection());
|
| | |
|
| | | try
|
| | | {
|
| | | if (m_Record != null)
|
| | | ProcessCase(m_Record, e.getConnection());
|
| | | else
|
| | | DBConnList.Add(e.getConnection());
|
| | | if (mRecord != null)
|
| | | ProcessCase(mRecord, e.GetConnection());
|
| | | }
|
| | | catch
|
| | | finally |
| | | {
|
| | | DBConnList.Add(e.getConnection());
|
| | | lock (_syncDbQueue) _dbQueue.Enqueue(e.GetConnection());
|
| | | }
|
| | | }
|
| | |
|
| | | [MethodImpl(MethodImplOptions.Synchronized)]
|
| | | private Object.CCSRecord getWaitRecord() |
| | | private CcsRecord GetWaitRecord(OracleConnection conn)
|
| | | {
|
| | | String ProcessCCSID = "";
|
| | | String CCSID = "";
|
| | | Object.CCSRecord _Record = null;
|
| | | string processCcsid = "";
|
| | | string ccsid = "";
|
| | | CcsRecord record = null;
|
| | |
|
| | | foreach (String[] Obj in WaitingCases)
|
| | | foreach (string[] obj in WaitingCases)
|
| | | {
|
| | | String _CCSID = Obj[0];
|
| | | String _FDRID = Obj[1];
|
| | | string ccsId = obj[0];
|
| | | string fdrid = obj[1];
|
| | |
|
| | | if (ProcessFDR.ContainsKey(_FDRID)) //該條饋線仍有案件在處理中
|
| | | ProcessCCSID = ProcessCCSID + "'" + _CCSID + "',";
|
| | | if (ProcessFdr.ContainsKey(fdrid)) //該條饋線仍有案件在處理中
|
| | | processCcsid = processCcsid + "'" + ccsid + "',";
|
| | | else
|
| | | {
|
| | | CCSID = _CCSID;
|
| | | WaitingCases.Remove(Obj);
|
| | | ccsid = ccsId;
|
| | | WaitingCases.Remove(obj);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (CCSID.Length == 0) //沒有因同饋線而在等候中的案件
|
| | | if (ccsid.Length == 0) //沒有因同饋線而在等候中的案件
|
| | | {
|
| | | String SqlStmt = "SELECT Q.CCSID AS CCSID FROM CCS.EVENTQUERY Q,CCS.EVENTRECORD R WHERE Q.CASESTATUS IN (" + LocalVariable.EventInitial + "," + LocalVariable.EventProcess + ")";
|
| | | System.Collections.IEnumerator Enum = ProcessCases.GetEnumerator();
|
| | | string sqlStmt = "SELECT Q.CCSID AS CCSID FROM CCS.EVENTQUERY Q,CCS.EVENTRECORD R WHERE Q.CASESTATUS IN (" + (int) CCSCaseState.EventInitial + "," + (int) CCSCaseState.EventProcess + ")";
|
| | | IEnumerator Enum = ProcessCases.GetEnumerator();
|
| | |
|
| | | while (Enum.MoveNext())
|
| | | ProcessCCSID = ProcessCCSID + "'" + Enum.Current.ToString() + "',";
|
| | | if (Enum.Current != null) processCcsid = processCcsid + "'" + Enum.Current + "',";
|
| | |
|
| | | if (ProcessCCSID.Length != 0)
|
| | | SqlStmt = SqlStmt + " AND Q.CCSID NOT IN (" + ProcessCCSID.Substring(0, ProcessCCSID.Length - 1) + ")";
|
| | | if (processCcsid.Length != 0)
|
| | | sqlStmt = sqlStmt + " AND Q.CCSID NOT IN (" + processCcsid.Substring(0, processCcsid.Length - 1) + ")";
|
| | |
|
| | | SqlStmt = SqlStmt + " AND Q.CCSID = R.CCSID AND ROWNUM < 2 ORDER BY Q.ChangeTime";
|
| | | System.Data.OracleClient.OracleCommand Command = new System.Data.OracleClient.OracleCommand(SqlStmt, MainConn);
|
| | | System.Data.OracleClient.OracleDataReader reader = Command.ExecuteReader();
|
| | | sqlStmt = sqlStmt + " AND Q.CCSID = R.CCSID AND ROWNUM < 2 ORDER BY Q.ChangeTime";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, conn);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | CCSID = reader["CCSID"].ToString();
|
| | | ccsid = reader["CCSID"].ToString();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Log(e.Message);
|
| | | _MainLog.Error("無法取得等候處理CCS案件資料。錯誤訊息 = " + e.Message);
|
| | | _mainLog.Error("無法取得等候處理CCS案件資料。錯誤訊息 = " + e.Message);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _MainLog.Error(e.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | _mainLog.Error(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | if (CCSID.Length != 0)
|
| | | _Record = new Object.CCSRecord(CCSID, MainConn, _MainLog);
|
| | | if (ccsid.Length != 0)
|
| | | record = new CcsRecord(ccsid, conn, _mainLog);
|
| | |
|
| | | if (_Record != null)
|
| | | if (record != null)
|
| | | {
|
| | | CCS.Object.EventQuery EventQuery = new CCSTrace.CCS.Object.EventQuery();
|
| | | EventQuery eventQuery = new EventQuery();
|
| | | //先將EVETNQUERY的案件狀態改為開始處理
|
| | | EventQuery.setCCSID(_Record.getCCSID());
|
| | | EventQuery.setCaseStatus(LocalVariable.EventProcess);
|
| | | eventQuery.CcsId = record.CcsId;
|
| | | eventQuery.CaseStatus = (int) CCSCaseState.EventProcess;
|
| | |
|
| | | System.Data.OracleClient.OracleTransaction _Transaction = MainConn.BeginTransaction();
|
| | | OracleTransaction transaction = conn.BeginTransaction();
|
| | |
|
| | | try
|
| | | {
|
| | |
|
| | | if (EventQuery.UpdateCaseStatus(_MainLog, MainConn, _Transaction))
|
| | | if (eventQuery.UpdateCaseStatus(_mainLog, conn, transaction))
|
| | | {
|
| | | _MainLog.Info("更新EVENTQUERY的案件狀態為處理中.(CCSID = " + _Record.getCCSID() + ")");
|
| | | _Transaction.Commit();
|
| | | ProcessCases.Add(_Record.getCCSID());
|
| | | _mainLog.Info("更新EVENTQUERY的案件狀態為處理中.(CCSID = " + record.CcsId + ")");
|
| | | transaction.Commit();
|
| | | ProcessCases.Add(record.CcsId);
|
| | | }
|
| | | else
|
| | | {
|
| | | _MainLog.Error("無法更新EVENTQUERY的案件狀態.(CCSID = " + _Record.getCCSID() + ")");
|
| | | _mainLog.Error("無法更新EVENTQUERY的案件狀態.(CCSID = " + record.CcsId + ")");
|
| | |
|
| | | if (_Transaction.Connection.State.ToString().Equals("Open"))
|
| | | _Transaction.Rollback();
|
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | if (_Transaction.Connection.State.ToString().Equals("Open"))
|
| | | _Transaction.Rollback();
|
| | | if (transaction.Connection.State.ToString().Equals("Open"))
|
| | | transaction.Rollback();
|
| | |
|
| | | Log(e.Message);
|
| | | _Record = null;
|
| | | record = null;
|
| | | }
|
| | | }
|
| | |
|
| | | return _Record;
|
| | | return record;
|
| | | }
|
| | |
|
| | | private void Log(String message)
|
| | | private void Log(string message)
|
| | | {
|
| | | RecordLog _PLog = null;
|
| | | RecordLog pLog = null;
|
| | | try
|
| | | {
|
| | | _PLog = new RecordLog(CCS.LocalVariable.CCS_ListPath + "MAIN.txt");
|
| | | _PLog.Error(message);
|
| | | pLog = new RecordLog(GlobalVariable.CcsListPath + "MAIN.txt");
|
| | | pLog.Error(message);
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (_PLog != null)
|
| | | if (pLog != null)
|
| | | {
|
| | | _PLog.Close();
|
| | | pLog.Close();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | namespace CCSTrace.CCS.EventAI
|
| | | namespace CCSTrace.CCS.EventAI
|
| | | {
|
| | | public class Equipment
|
| | | {
|
| | | int FSC;
|
| | | int UFID;
|
| | |
|
| | | public Equipment(int m_Fsc, int m_Ufid)
|
| | | public Equipment(int mFsc, int mUfid)
|
| | | {
|
| | | this.FSC = m_Fsc;
|
| | | this.UFID = m_Ufid;
|
| | | Fsc = mFsc;
|
| | | Ufid = mUfid;
|
| | | }
|
| | |
|
| | | public int getFSC()
|
| | | {
|
| | | return FSC;
|
| | | }
|
| | | public int Fsc { get; }
|
| | |
|
| | | public int getUFID()
|
| | | {
|
| | | return UFID;
|
| | | }
|
| | | public int Ufid { get; }
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | |
| | | {
|
| | | public class JudgeCase
|
| | | {
|
| | | TraceSubject m_TraceSubject;
|
| | | System.Collections.ArrayList m_Case = new System.Collections.ArrayList();
|
| | | int Damage_FdrID;
|
| | | int Damage_Fsc; // 新案件的損壞設備種類
|
| | | int Damage_Ufid; // 新案件的損壞設備編號
|
| | | int New_CaseID;
|
| | | String AcceptDate;
|
| | | System.Collections.ArrayList New_Case;
|
| | | System.Collections.Hashtable Old_Case;
|
| | | int Infer_Fsc; // 推測出可能受損的設備種類
|
| | | int Infer_Ufid; // 推測出可能受損的設備編號
|
| | | int Parent_CaseID = 0;
|
| | | CCS.EventAI.Equipment m_Equip;
|
| | | private TraceSubject _mTraceSubject;
|
| | | private readonly ArrayList _mCase = new ArrayList();
|
| | | private readonly int _damageFdrId;
|
| | | private readonly int _damageFsc; // 新案件的損壞設備種類
|
| | | private readonly int _damageUfid; // 新案件的損壞設備編號
|
| | | private int _newCaseId;
|
| | | private string _acceptDate;
|
| | | private ArrayList _newCase;
|
| | | private Hashtable _oldCase;
|
| | | private int _inferFsc; // 推測出可能受損的設備種類
|
| | | private int _inferUfid; // 推測出可能受損的設備編號
|
| | | private int _parentCaseId = 0;
|
| | | private Equipment _mEquip;
|
| | |
|
| | | private OracleConnection _ConnectionTPC;
|
| | | private OracleTransaction _Transaction;
|
| | | private RecordLog _PLog;
|
| | | private String _traceConnectionString = String.Empty;
|
| | | private readonly OracleConnection _connectionTpc;
|
| | | private readonly OracleTransaction _transaction;
|
| | | private readonly RecordLog _pLog;
|
| | | private readonly string _traceConnectionString;
|
| | |
|
| | | // int Range = 360; //比事故案件還早多久時間內的案件才作合併 單位:分
|
| | |
|
| | | public JudgeCase(int m_FdrID, int m_fsc, int m_ufid, int m_CaseID, String m_AcceptDate, 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, RecordLog log)
|
| | | {
|
| | | this.Damage_FdrID = m_FdrID;
|
| | | this.Damage_Fsc = m_fsc;
|
| | | this.Damage_Ufid = m_ufid;
|
| | | this.New_CaseID = m_CaseID;
|
| | | this.AcceptDate = m_AcceptDate;
|
| | | _damageFdrId = mFdrId;
|
| | | _damageFsc = mFsc;
|
| | | _damageUfid = mUfid;
|
| | | _newCaseId = mCaseId;
|
| | | _acceptDate = mAcceptDate;
|
| | |
|
| | | _ConnectionTPC = _Connection;
|
| | | _Transaction = _Trx;
|
| | | _traceConnectionString = _traceConnection;
|
| | | _PLog = _Log;
|
| | | _connectionTpc = connection;
|
| | | _transaction = trx;
|
| | | _traceConnectionString = traceConnection;
|
| | | _pLog = log;
|
| | | }
|
| | |
|
| | | public void AIBegin() {
|
| | | _PLog.Info("進行案件追蹤合併.");
|
| | | String SqlStmt;
|
| | | public void AiBegin()
|
| | | {
|
| | | _pLog.Info("進行案件追蹤合併.");
|
| | | // String ToTime = AcceptDate;
|
| | |
|
| | | 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 "
|
| | | + "FROM EOS.EVENTRECORD R,EOS.EVENTS E WHERE E.CASEID = R.CASEID AND R.TRACE_FINISH = " + CCS.LocalVariable.Trace_Still
|
| | | + " AND E.CASETYPE <> " + CCS.LocalVariable.ChildCase + " AND R.FDRID = " + this.Damage_FdrID;
|
| | | 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 "
|
| | | + "FROM EOS.EVENTRECORD R,EOS.EVENTS E WHERE E.CASEID = R.CASEID AND R.TRACE_FINISH = " + GlobalVariable.TraceStill
|
| | | + " AND E.CASETYPE <> " + GlobalVariable.ChildCase + " AND R.FDRID = " + _damageFdrId;
|
| | |
|
| | | OracleCommand Command = null;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | try
|
| | | {
|
| | | _PLog.Info("搜尋同一饋線上可供合併之母案件.");
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | _pLog.Info("搜尋同一饋線上可供合併之母案件.");
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | // 找出同一饋線上處理中的母案件(可作合併的)
|
| | | // 該饋線上有可能有二件或兩件以上的母案件
|
| | | while (reader.Read())
|
| | | {
|
| | | System.Collections.ArrayList Record = new System.Collections.ArrayList();
|
| | | Record.Add(Convert.ToInt32(reader["CASEID"].ToString()));
|
| | | Record.Add(Convert.ToInt32(reader["FDRID"].ToString()));
|
| | | Record.Add(Convert.ToInt32(reader["FSC"].ToString()));
|
| | | Record.Add(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | Record.Add(Convert.ToInt32(reader["CASESTATUS"].ToString()));
|
| | | CCS.EventAI.Equipment Tmp = new CCS.EventAI.Equipment(Convert.ToInt32(reader["FSC"].ToString()), Convert.ToInt32(reader["UFID"].ToString()));
|
| | | Record.Add(Tmp);
|
| | | Record.Add(reader["BRIEF"].ToString());
|
| | | Record.Add(reader["ACCEPTNUM"].ToString());
|
| | | m_Case.Add(Record);
|
| | | _PLog.Info(Record[7].ToString() + ", " + Record[0]);
|
| | | ArrayList record = new ArrayList();
|
| | | record.Add(Convert.ToInt32(reader["CASEID"].ToString()));
|
| | | record.Add(Convert.ToInt32(reader["FDRID"].ToString()));
|
| | | record.Add(Convert.ToInt32(reader["FSC"].ToString()));
|
| | | record.Add(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | record.Add(Convert.ToInt32(reader["CASESTATUS"].ToString()));
|
| | | Equipment tmp = new Equipment(Convert.ToInt32(reader["FSC"].ToString()), Convert.ToInt32(reader["UFID"].ToString()));
|
| | | record.Add(tmp);
|
| | | record.Add(reader["BRIEF"].ToString());
|
| | | record.Add(reader["ACCEPTNUM"].ToString());
|
| | | _mCase.Add(record);
|
| | | _pLog.Info(record[7].ToString() + ", " + record[0]);
|
| | | }
|
| | | reader.Close();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | _PLog.Error("尋找母案件時發生錯誤.");
|
| | | _pLog.Error("尋找母案件時發生錯誤.");
|
| | | throw e;
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (Command != null)
|
| | | Command.Dispose();
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | }
|
| | |
|
| | | // 若事故案件為該饋線上的第一件事故案件時,無須再作追蹤比較
|
| | | if (m_Case.Count == 0) {
|
| | | Infer_Fsc = this.Damage_Fsc;
|
| | | Infer_Ufid = this.Damage_Ufid;
|
| | | _PLog.Info("此案件為饋線上第一件案件");
|
| | | _PLog.Info("追蹤合併結束.");
|
| | | if (_mCase.Count == 0)
|
| | | {
|
| | | _inferFsc = _damageFsc;
|
| | | _inferUfid = _damageUfid;
|
| | | _pLog.Info("此案件為饋線上第一件案件");
|
| | | _pLog.Info("追蹤合併結束.");
|
| | | return;
|
| | | }
|
| | |
|
| | | // 判斷是否為同一變壓器,如果是就不必作追蹤
|
| | | try {
|
| | | for (int i = 0; i < m_Case.Count; i++) {
|
| | | if ( (Convert.ToInt32(((ArrayList) m_Case[i])[2].ToString()) == Damage_Fsc) && |
| | | (Convert.ToInt32(((ArrayList) m_Case[i])[3].ToString()) == Damage_Ufid)) |
| | | try
|
| | | {
|
| | | if (((ArrayList) m_Case[i])[6].ToString().StartsWith("A")) // 若母案件事故原因為A類才做合併
|
| | | for (int i = 0; i < _mCase.Count; i++)
|
| | | {
|
| | | Parent_CaseID = Convert.ToInt32(((ArrayList) m_Case[i])[0].ToString());
|
| | | Infer_Fsc = Convert.ToInt32(((ArrayList) m_Case[i])[2].ToString());
|
| | | Infer_Ufid = Convert.ToInt32(((ArrayList) m_Case[i])[3].ToString());
|
| | | _PLog.Info("相同變壓器");
|
| | | _PLog.Info("與案件"+((ArrayList) m_Case[i])[7]+"合併,故障點Fsc: "+Infer_Fsc+" Ufid: "+Infer_Ufid);
|
| | | if ((Convert.ToInt32(((ArrayList)_mCase[i])[2].ToString()) == _damageFsc) &&
|
| | | (Convert.ToInt32(((ArrayList)_mCase[i])[3].ToString()) == _damageUfid))
|
| | | {
|
| | | if (((ArrayList)_mCase[i])[6].ToString().StartsWith("A")) // 若母案件事故原因為A類才做合併
|
| | | {
|
| | | _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);
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | _PLog.Error(ex.Message);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error(ex.Message);
|
| | | throw ex;
|
| | | }
|
| | | _PLog.Info("不同變壓器,開始追蹤(New Version)...");
|
| | | _pLog.Info("不同變壓器,開始追蹤(New Version)...");
|
| | |
|
| | | this.TraceCase();
|
| | | _PLog.Warn("追蹤合併結束");
|
| | | TraceCase();
|
| | | _pLog.Warn("追蹤合併結束");
|
| | | }
|
| | |
|
| | | private void TraceCase() {
|
| | | int m_Key;
|
| | | private void TraceCase()
|
| | | {
|
| | | int mKey;
|
| | |
|
| | | try {
|
| | | this.m_TraceSubject = new CCS.EventAI.TraceSubject(_ConnectionTPC, _Transaction, _traceConnectionString, _PLog);
|
| | | _PLog.Info("TraceSubject Initial....");
|
| | | try
|
| | | {
|
| | | _mTraceSubject = new TraceSubject(_connectionTpc, _transaction, _traceConnectionString, _pLog);
|
| | | _pLog.Info("TraceSubject Startup....");
|
| | | }
|
| | | catch (Exception ex) {
|
| | | _PLog.Error("TraceObject.dll無法初始化,請確認該元件是否存在或jre是否為 1.4 版,並確認是否註冊.");
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error("TraceObject.dll無法初始化,請確認該元件是否存在或jre是否為 1.4 版,並確認是否註冊.");
|
| | | throw ex;
|
| | | }
|
| | |
|
| | | try {
|
| | | this.m_TraceSubject.startTrace(Damage_Fsc, Damage_Ufid, true);
|
| | | New_Case = this.m_TraceSubject.getNewResult(); // 新案件所建出來的linkedlist(往上追到breaker)
|
| | | _PLog.Info("追蹤新案件完成");
|
| | | try
|
| | | {
|
| | | _mTraceSubject.StartTrace(_damageFsc, _damageUfid, true);
|
| | | _newCase = _mTraceSubject.GetNewResult(); // 新案件所建出來的linkedlist(往上追到breaker)
|
| | | _pLog.Info("追蹤新案件完成");
|
| | |
|
| | | for (int i = 0; i < m_Case.Count; i++) {
|
| | | if (this.AlreadyFinishCase(Convert.ToInt32(((ArrayList) m_Case[i])[0].ToString()))) {
|
| | | for (int i = 0; i < _mCase.Count; i++)
|
| | | {
|
| | | if (AlreadyFinishCase(Convert.ToInt32(((ArrayList)_mCase[i])[0].ToString())))
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | ArrayList FacilitySet = this.RealDamageEquipment(Convert.ToInt32(((ArrayList)m_Case[i])[0].ToString())); // 切開的設備
|
| | | ArrayList facilitySet = RealDamageEquipment(Convert.ToInt32(((ArrayList)_mCase[i])[0].ToString())); // 切開的設備
|
| | |
|
| | | if (FacilitySet.Count == 0) {
|
| | | this.m_TraceSubject.startTrace(Convert.ToInt32(((ArrayList)m_Case[i])[2].ToString()),
|
| | | Convert.ToInt32(((ArrayList)m_Case[i])[3].ToString()), false);
|
| | | Old_Case = this.m_TraceSubject.getOldResult(); // 母案件所建出來的TreeMap(往上追到breaker)
|
| | | _PLog.Info("追蹤母案件完成");
|
| | |
|
| | | for (int j = 0; j < New_Case.Count; j++) {
|
| | | m_Key = ((Equipment) New_Case[j]).getUFID();
|
| | |
|
| | | if (Old_Case.ContainsKey(m_Key)) |
| | | if (facilitySet.Count == 0)
|
| | | {
|
| | | if (((ArrayList)m_Case[i])[6].ToString().StartsWith("A")) // 若母案件事故原因為A類才做合併
|
| | | _mTraceSubject.StartTrace(Convert.ToInt32(((ArrayList)_mCase[i])[2].ToString()),
|
| | | Convert.ToInt32(((ArrayList)_mCase[i])[3].ToString()), false);
|
| | | _oldCase = _mTraceSubject.GetOldResult(); // 母案件所建出來的TreeMap(往上追到breaker)
|
| | | _pLog.Info("追蹤母案件完成");
|
| | |
|
| | | for (int j = 0; j < _newCase.Count; j++)
|
| | | {
|
| | | this.Parent_CaseID = Convert.ToInt32(((ArrayList)m_Case[i])[0].ToString());
|
| | | Infer_Fsc = ((Equipment) New_Case[j]).getFSC();
|
| | | Infer_Ufid = ((Equipment) New_Case[j]).getUFID();
|
| | | this.m_Equip = (CCS.EventAI.Equipment) ((ArrayList) m_Case[i])[5];
|
| | | _PLog.Info("與案件"+((ArrayList) m_Case[i])[7]+"合併,故障點Fsc: "+Infer_Fsc+" Ufid: "+Infer_Ufid);
|
| | | mKey = ((Equipment)_newCase[j]).Ufid;
|
| | |
|
| | | if (_oldCase.ContainsKey(mKey))
|
| | | {
|
| | | if (((ArrayList)_mCase[i])[6].ToString().StartsWith("A")) // 若母案件事故原因為A類才做合併
|
| | | {
|
| | | _parentCaseId = Convert.ToInt32(((ArrayList)_mCase[i])[0].ToString());
|
| | | _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);
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | } else {
|
| | | for (int k = 0; k < FacilitySet.Count; k++) |
| | | }
|
| | | else
|
| | | {
|
| | | bool Merge = false; // 損壞設備是否在所切開的設備下游
|
| | | Equipment DamageEquipment = (Equipment) FacilitySet[k]; // 切開的設備
|
| | | for (int k = 0; k < facilitySet.Count; k++)
|
| | | {
|
| | | bool merge = false; // 損壞設備是否在所切開的設備下游
|
| | | Equipment damageEquipment = (Equipment)facilitySet[k]; // 切開的設備
|
| | |
|
| | | for (int z = 0; z < New_Case.Count; z++) |
| | | for (int z = 0; z < _newCase.Count; z++)
|
| | | {
|
| | | if ( (((Equipment) New_Case[z]).getFSC() == DamageEquipment.getFSC()) && |
| | | (((Equipment) New_Case[z]).getUFID() == DamageEquipment.getUFID())) |
| | | if ((((Equipment)_newCase[z]).Fsc== damageEquipment.Fsc) &&
|
| | | (((Equipment)_newCase[z]).Ufid== damageEquipment.Ufid))
|
| | | {
|
| | | Merge = true;
|
| | | merge = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | // 當發現在所切開開關的下游,就將損壞設備指向切開的設備並return
|
| | | if (Merge) |
| | | if (merge)
|
| | | {
|
| | | if (((ArrayList)m_Case[i])[6].ToString().StartsWith("A")) // 若母案件事故原因為A類才做合併
|
| | | if (((ArrayList)_mCase[i])[6].ToString().StartsWith("A")) // 若母案件事故原因為A類才做合併
|
| | | {
|
| | | this.Parent_CaseID = Convert.ToInt32(((ArrayList)m_Case[i])[0].ToString());
|
| | | Infer_Fsc = DamageEquipment.getFSC();
|
| | | Infer_Ufid = DamageEquipment.getUFID();
|
| | | this.m_Equip = (CCS.EventAI.Equipment) ((ArrayList) m_Case[i])[5];
|
| | | _PLog.Info("與案件"+((ArrayList) m_Case[i])[7]+"合併,故障點Fsc: "+Infer_Fsc+" Ufid: "+Infer_Ufid);
|
| | | _parentCaseId = Convert.ToInt32(((ArrayList)_mCase[i])[0].ToString());
|
| | | _inferFsc = damageEquipment.Fsc;
|
| | | _inferUfid = damageEquipment.Ufid;
|
| | | _mEquip = (Equipment)((ArrayList)_mCase[i])[5];
|
| | | _pLog.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("追蹤時發生錯誤.");
|
| | | throw ex;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _pLog.Error(ex.Message);
|
| | | _pLog.Error("追蹤時發生錯誤.");
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | this.m_TraceSubject.discardEngine();
|
| | | _mTraceSubject.DiscardEngine();
|
| | | }
|
| | |
|
| | | Infer_Fsc = this.Damage_Fsc;
|
| | | Infer_Ufid = this.Damage_Ufid;
|
| | | this.m_TraceSubject.discardEngine();
|
| | | return;
|
| | | _inferFsc = _damageFsc;
|
| | | _inferUfid = _damageUfid;
|
| | | _mTraceSubject.DiscardEngine();
|
| | | }
|
| | |
|
| | | public Equipment getInferEquipment() {
|
| | | Equipment Equip = new Equipment(this.Infer_Fsc, this.Infer_Ufid);
|
| | | return Equip;
|
| | | public Equipment GetInferEquipment()
|
| | | {
|
| | | Equipment equip = new Equipment(_inferFsc, _inferUfid);
|
| | | return equip;
|
| | | }
|
| | |
|
| | | public Equipment getOldrEquipment() {
|
| | | return m_Equip;
|
| | | public Equipment GetOldrEquipment()
|
| | | {
|
| | | return _mEquip;
|
| | | }
|
| | |
|
| | | public int getParentCaseID() {
|
| | | return Parent_CaseID;
|
| | | public int GetParentCaseId()
|
| | | {
|
| | | return _parentCaseId;
|
| | | }
|
| | |
|
| | | private bool AlreadyFinishCase(int CaseID) {
|
| | | String SqlStmt;
|
| | | bool Result = false;
|
| | | private bool AlreadyFinishCase(int caseId)
|
| | | {
|
| | | bool result = false;
|
| | |
|
| | | SqlStmt = "SELECT TO_CHAR(CLOSETIME,'YYYY/MM/DD HH24:MI:SS') as CLOSETIME,COUNT(*) as COUNT FROM EOS.EVENTFACILITY " + "WHERE CASEID = "
|
| | | + CaseID + " GROUP BY CLOSETIME ORDER BY CLOSETIME DESC";
|
| | | var sqlStmt = "SELECT TO_CHAR(CLOSETIME,'YYYY/MM/DD HH24:MI:SS') as CLOSETIME,COUNT(*) as COUNT FROM EOS.EVENTFACILITY " + "WHERE CASEID = "
|
| | | + caseId + " GROUP BY CLOSETIME ORDER BY CLOSETIME DESC";
|
| | |
|
| | | OracleCommand Command = null;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | if (Convert.ToString(reader["CLOSETIME"]).Equals("null") || Convert.ToString(reader["CLOSETIME"]).Length == 0 )
|
| | | Result = false; // 有切開開關未恢復(Case in Process)
|
| | | result = false; // 有切開開關未恢復(Case in Process)
|
| | | else
|
| | | Result = true; // 有切開關但全都恢復(Case Finish)
|
| | |
|
| | | result = true; // 有切開關但全都恢復(Case Finish)
|
| | | }
|
| | | else
|
| | | Result = false; // 未切過開關
|
| | | result = false; // 未切過開關
|
| | |
|
| | | reader.Close();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("Problems occur: " + e.Message);
|
| | | _pLog.Error("Problems occur: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (Command != null)
|
| | | Command.Dispose();
|
| | | command?.Dispose();
|
| | |
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | reader?.Close();
|
| | | }
|
| | | return Result;
|
| | | return result;
|
| | | }
|
| | |
|
| | | private System.Collections.ArrayList RealDamageEquipment(int CaseID) {
|
| | | System.Collections.ArrayList Result = new System.Collections.ArrayList();
|
| | | String SqlStmt;
|
| | | private ArrayList RealDamageEquipment(int caseId)
|
| | | {
|
| | | ArrayList result = new ArrayList();
|
| | |
|
| | | SqlStmt = "SELECT FSC,UFID FROM EOS.EVENTFACILITY WHERE CASEID = " + CaseID + " AND CLOSETIME IS NULL";
|
| | | var sqlStmt = "SELECT FSC,UFID FROM EOS.EVENTFACILITY WHERE CASEID = " + caseId + " AND CLOSETIME IS NULL";
|
| | |
|
| | | OracleCommand Command = null;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | while (reader.Read())
|
| | | {
|
| | | Equipment Tmp = new Equipment(Convert.ToInt32(reader["FSC"]), Convert.ToInt32(reader["UFID"]));
|
| | | Result.Add(Tmp);
|
| | | Equipment tmp = new Equipment(Convert.ToInt32(reader["FSC"]), Convert.ToInt32(reader["UFID"]));
|
| | | result.Add(tmp);
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | // CCS.LocalVariable.ErrorLog.setErrorLog("Error in JudgeCase(RealDamageEquipment) :" + e.getMessage());
|
| | | _PLog.Error("Problems occur: " + e.Message);
|
| | | // CCS.GlobalVariable.ErrorLog.setErrorLog("Error in JudgeCase(RealDamageEquipment) :" + e.getMessage());
|
| | | _pLog.Error("Problems occur: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (reader != null )
|
| | | reader.Close();
|
| | | reader?.Close();
|
| | |
|
| | | if (Command != null )
|
| | | Command.Dispose();
|
| | | command?.Dispose();
|
| | | }
|
| | | return Result;
|
| | | return result;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | | using System.Collections;
|
| | | using TRACEROBJECTLib;
|
| | | using System.Data.OracleClient;
|
| | | using TRACEROBJECTLib;
|
| | |
|
| | | namespace CCSTrace.CCS.EventAI
|
| | | {
|
| | | public class TraceSubject
|
| | | {
|
| | | private String m_dbConnectionString;
|
| | | static bool IsNewCase;
|
| | | static ArrayList m_LinkList; // store the switch of the new case path
|
| | | static TraceEngine m_tEngine;
|
| | | static Hashtable m_TreeMap; // store the switch of the old case path
|
| | | static int s_Fsc;
|
| | | static int s_Ufid;
|
| | | private RecordLog _Plogger;
|
| | | private ArrayList m_Tmp = new ArrayList();
|
| | | private NetworkContext m_pContext;
|
| | | private string _mDbConnectionString;
|
| | | private static bool _isNewCase;
|
| | | private static ArrayList _mLinkList; // store the switch of the new case path
|
| | | private static TraceEngine _mTEngine;
|
| | | private static Hashtable _mTreeMap; // store the switch of the old case path
|
| | | private static int _sFsc;
|
| | | private static int _sUfid;
|
| | | private readonly RecordLog _plogger;
|
| | | private readonly ArrayList _mTmp = new ArrayList();
|
| | | private NetworkContext _mPContext;
|
| | |
|
| | | private OracleConnection _ConnectionTPC = null;
|
| | | private OracleTransaction _Transaction;
|
| | | 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, RecordLog log)
|
| | | {
|
| | | _ConnectionTPC = _Conn;
|
| | | _Transaction = _Trx;
|
| | | _Plogger = _Log;
|
| | | m_dbConnectionString = traceConnectionString;
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | | _plogger = log;
|
| | | _mDbConnectionString = traceConnectionString;
|
| | |
|
| | | try
|
| | | {
|
| | | if (m_tEngine == null) {
|
| | | m_tEngine = new TraceEngine();
|
| | | if (_mTEngine == null)
|
| | | {
|
| | | _mTEngine = new TraceEngine();
|
| | | }
|
| | | }
|
| | | catch (Exception ex) {
|
| | | _Plogger.Error(ex.Message);
|
| | | catch (Exception ex)
|
| | | {
|
| | | _plogger.Error(ex.Message);
|
| | | throw ex;
|
| | | }
|
| | | }
|
| | |
|
| | | public void discardEngine() {
|
| | | if (m_tEngine != null) {
|
| | | m_tEngine = null;
|
| | | }
|
| | | public void DiscardEngine()
|
| | | {
|
| | | _mTEngine = null;
|
| | | }
|
| | |
|
| | | public ArrayList getNewResult() {
|
| | | return m_LinkList;
|
| | | public ArrayList GetNewResult()
|
| | | {
|
| | | return _mLinkList;
|
| | | }
|
| | |
|
| | | public Hashtable getOldResult() {
|
| | | return m_TreeMap;
|
| | | public Hashtable GetOldResult()
|
| | | {
|
| | | return _mTreeMap;
|
| | | }
|
| | |
|
| | | // for EOS(only get the reverse tree)
|
| | | public void startTrace(int Start_Fsc, int Start_Ufid, bool m_IsNew) {
|
| | | s_Fsc = Start_Fsc;
|
| | | s_Ufid = Start_Ufid;
|
| | | IsNewCase = m_IsNew;
|
| | | m_TreeMap = new Hashtable();
|
| | | m_LinkList = new ArrayList();
|
| | | public void StartTrace(int startFsc, int startUfid, bool mIsNew)
|
| | | {
|
| | | _sFsc = startFsc;
|
| | | _sUfid = startUfid;
|
| | | _isNewCase = mIsNew;
|
| | | _mTreeMap = new Hashtable();
|
| | | _mLinkList = new ArrayList();
|
| | |
|
| | | try
|
| | | {
|
| | | this.setReverseTree(Trace(true));
|
| | | SetReverseTree(Trace(true));
|
| | | }
|
| | | catch (Exception e) {
|
| | | _Plogger.Error(e.Message);
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | throw e;
|
| | | }
|
| | | }
|
| | |
|
| | | private bool getSwitchOn(int UFID) {
|
| | | String SqlStmt;
|
| | | private bool GetSwitchOn(int ufid)
|
| | | {
|
| | | var sqlStmt = "SELECT M.OSTATUS as OSTATUS FROM (SELECT UFID,OSTATUS FROM BASEDB.CONNECTIVITY WHERE FSC = 114) M,"
|
| | | + "BASEDB.SWITCH S WHERE M.UFID = S.UFID AND S.NSTATUS <> 0 AND M.UFID = " + ufid;
|
| | |
|
| | | SqlStmt = "SELECT M.OSTATUS as OSTATUS FROM (SELECT UFID,OSTATUS FROM BASEDB.CONNECTIVITY WHERE FSC = 114) M,"
|
| | | + "BASEDB.SWITCH S WHERE M.UFID = S.UFID AND S.NSTATUS <> 0 AND M.UFID = " + UFID;
|
| | |
|
| | | OracleCommand Command = null;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _Plogger.Error(e.Message);
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (Command != null)
|
| | | Command.Dispose();
|
| | | command?.Dispose();
|
| | |
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | reader?.Close();
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | private bool getJumperOn(int UFID) {
|
| | | String SqlStmt;
|
| | | private bool GetJumperOn(int ufid)
|
| | | {
|
| | | var sqlStmt = "SELECT OSTATUS FROM BASEDB.CONNECTIVITY WHERE FSC = 109 AND UFID = " + ufid;
|
| | |
|
| | | SqlStmt = "SELECT OSTATUS FROM BASEDB.CONNECTIVITY WHERE FSC = 109 AND UFID = " + UFID;
|
| | |
|
| | | OracleCommand Command = null;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _Plogger.Error(e.Message);
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (Command != null)
|
| | | Command.Dispose();
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | private Hashtable TraceCounts = new Hashtable();
|
| | | private readonly Hashtable _traceCounts = new Hashtable();
|
| | |
|
| | | private void setReverseTree(ResultTree tree) {
|
| | | private void SetReverseTree(ResultTree tree)
|
| | | {
|
| | | int i = 0;
|
| | | TreeIterator iti = null;
|
| | | bool ostatus = true;
|
| | |
|
| | | if (tree != null) {
|
| | | if (tree != null)
|
| | | {
|
| | | i = 0;
|
| | | iti = tree.CreateTreeIterator();
|
| | | bool isNotEnd = true;
|
| | |
|
| | | while (isNotEnd) {
|
| | |
|
| | | if (getTraceCount(iti.Value.ClassID, iti.Value.ObjectID) > 5)
|
| | | while (isNotEnd)
|
| | | {
|
| | | if (GetTraceCount(iti.Value.ClassID, iti.Value.ObjectID) > 5)
|
| | | throw new TraceLoopException("追蹤產生迴圈狀況。(Fsc,Ufid) = (" + iti.Value.ClassID + "," + iti.Value.ObjectID + ")");
|
| | | else
|
| | | AddTraceCount(iti.Value.ClassID, iti.Value.ObjectID);
|
| | |
|
| | | while (iti.IsLeaf == 0)
|
| | | {
|
| | | TRACEROBJECTLib.TreeNode node = iti.Value;
|
| | | TreeNode node = iti.Value;
|
| | |
|
| | | if ((node.ClassID == 114) || (node.ClassID == 108) || (node.ClassID == 109))
|
| | | {
|
| | | Equipment Equip = new Equipment(node.ClassID, node.ObjectID);
|
| | | Equipment equip = new Equipment(node.ClassID, node.ObjectID);
|
| | |
|
| | | if (IsNewCase)
|
| | | m_LinkList.Add(Equip);
|
| | | else {
|
| | | m_TreeMap.Add(node.ObjectID, Equip);
|
| | | m_Tmp.Add(Equip);
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | else
|
| | | {
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | }
|
| | | i++;
|
| | |
|
| | |
| | | throw new Exception("追蹤產生迴圈狀況。(Fsc,Ufid) = (" + node.ClassID + "," + node.ObjectID + ")");
|
| | | else
|
| | | AddTraceCount(node.ClassID, node.ObjectID);
|
| | | */ }
|
| | | */
|
| | | }
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _Plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | |
|
| | | iti.MoveDescent((short) 0);
|
| | | }
|
| | |
|
| | | // 當從breaker出來的導線不只一條時,breaker可能會不被add(因為breaker是leaf但其parent的DescentCount > 1,所以被忽略)
|
| | | /*
|
| | | * if ( ((com.origo.TraceModel.ITreeNode)iti.get_Value()).get_ClassID() == EOS.LocalVariable.Breaker ) {
|
| | | * if ( ((com.origo.TraceModel.ITreeNode)iti.get_Value()).get_ClassID() == EOS.GlobalVariable.Breaker ) {
|
| | | * com.origo.TraceModel.ITreeNode node = iti.get_Value(); Equipment Equip = new Equipment(node.get_ClassID(),node.get_ObjectID()); if (
|
| | | * IsNewCase ) m_LinkList.add(i,Equip); else { m_TreeMap.put(new Integer(node.get_ObjectID()),Equip); m_Tmp.add(Equip); }
|
| | | * System.out.println(node.get_ClassID() + "----->" + node.get_ObjectID()); System.out.println("Trace Finish...."); i++; break; }
|
| | | */
|
| | |
|
| | | if ((iti.Value).ClassID == CCS.LocalVariable.Breaker) {
|
| | | TRACEROBJECTLib.TreeNode node = iti.Value;
|
| | | Equipment Equip = new Equipment(node.ClassID, node.ObjectID);
|
| | | if ((iti.Value).ClassID == GlobalVariable.Breaker)
|
| | | {
|
| | | TreeNode node = iti.Value;
|
| | | Equipment equip = new Equipment(node.ClassID, node.ObjectID);
|
| | |
|
| | | if (IsNewCase)
|
| | | m_LinkList.Add(Equip);
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | else
|
| | | {
|
| | | m_TreeMap.Add(node.ObjectID, Equip);
|
| | | m_Tmp.Add(Equip);
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | }
|
| | | i++; //後面直接就FINISH,所以就不用判斷tracecount
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _Plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Console.WriteLine("Trace Finish....");
|
| | | _Plogger.Info("Trace Finish....");
|
| | | _plogger.Info("Trace Finish....");
|
| | | break;
|
| | | }
|
| | | // 當追蹤到被切開的開關且該上一層設備只有該開關一個child)
|
| | | else if (iti.Value.ClassID == CCS.LocalVariable.Switch || iti.Value.ClassID == CCS.LocalVariable.Jumper ) {
|
| | | TRACEROBJECTLib.TreeNode node = iti.Value;
|
| | | else if (iti.Value.ClassID == GlobalVariable.Switch || iti.Value.ClassID == GlobalVariable.Jumper)
|
| | | {
|
| | | TreeNode node = iti.Value;
|
| | | iti.MoveAscent();
|
| | |
|
| | | Equipment Equip = new Equipment(node.ClassID, node.ObjectID);
|
| | | Equipment equip = new Equipment(node.ClassID, node.ObjectID);
|
| | |
|
| | | if (isEndEquip(Equip))
|
| | | if (IsEndEquip(equip))
|
| | | {
|
| | | if (IsNewCase)
|
| | | m_LinkList.Add(Equip);
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | else
|
| | | {
|
| | | m_TreeMap.Add(node.ObjectID, Equip);
|
| | | m_Tmp.Add(Equip);
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | }
|
| | | i++; //後面直接就FINISH,所以就不用判斷tracecount
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _Plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | Console.WriteLine("Trace Finish....");
|
| | | _Plogger.Info("Trace Finish....");
|
| | | _plogger.Info("Trace Finish....");
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | TRACEROBJECTLib.TreeNode node = iti.Value;
|
| | | TreeNode node = iti.Value;
|
| | | iti.MoveAscent();
|
| | |
|
| | | if (iti.DescentCount == 1)
|
| | | throw new Exception("追蹤到非開關類斷開之設備(Fsc = " + node.ClassID + ",Ufid = " + node.ObjectID);
|
| | | }
|
| | |
|
| | | for (int j = 1; j < iti.DescentCount; j++) {
|
| | | for (int j = 1; j < iti.DescentCount; j++)
|
| | | {
|
| | | iti.MoveDescent((short) j);
|
| | |
|
| | | if (iti.IsLeaf == 1) {
|
| | | TRACEROBJECTLib.TreeNode node = iti.Value;
|
| | | Equipment Equip = new Equipment(node.ClassID, node.ObjectID);
|
| | | if (iti.IsLeaf == 1)
|
| | | {
|
| | | TreeNode node = iti.Value;
|
| | | Equipment equip = new Equipment(node.ClassID, node.ObjectID);
|
| | |
|
| | | switch (node.ClassID) {
|
| | | switch (node.ClassID)
|
| | | {
|
| | | case 108:
|
| | | if (IsNewCase)
|
| | | m_LinkList.Add(Equip);
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | else
|
| | | {
|
| | | m_TreeMap.Add(node.ObjectID, Equip);
|
| | | m_Tmp.Add(Equip);
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | }
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _Plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | i++;
|
| | |
|
| | | /* if (getTraceCount(node.ClassID, node.ObjectID) > 2)
|
| | |
| | | AddTraceCount(node.ClassID, node.ObjectID);
|
| | | */
|
| | | break;
|
| | |
|
| | | case 109:
|
| | | case 114:
|
| | | switch (node.ClassID)
|
| | | {
|
| | | case 114:
|
| | | ostatus = getSwitchOn(node.ObjectID);
|
| | | ostatus = GetSwitchOn(node.ObjectID);
|
| | | break;
|
| | |
|
| | | case 109:
|
| | | ostatus = getJumperOn(node.ObjectID);
|
| | | ostatus = GetJumperOn(node.ObjectID);
|
| | | break;
|
| | | }
|
| | |
|
| | | // Only for switch because the breaker only has one node to descent
|
| | | if (!ostatus) {
|
| | | if (IsNewCase)
|
| | | m_LinkList.Add(Equip);
|
| | | else {
|
| | | m_TreeMap.Add(node.ObjectID, Equip);
|
| | | m_Tmp.Add(Equip);
|
| | | if (!ostatus)
|
| | | {
|
| | | if (_isNewCase)
|
| | | _mLinkList.Add(equip);
|
| | | else
|
| | | {
|
| | | _mTreeMap.Add(node.ObjectID, equip);
|
| | | _mTmp.Add(equip);
|
| | | }
|
| | |
|
| | | Console.WriteLine(node.ClassID + "----->" + node.ObjectID);
|
| | | _Plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | _plogger.Info(node.ClassID + "----->" + node.ObjectID);
|
| | | i++;
|
| | |
|
| | | /* if (getTraceCount(node.ClassID, node.ObjectID) > 2)
|
| | |
| | | */
|
| | | }
|
| | | break;
|
| | |
|
| | | default:
|
| | | break;
|
| | | } // switch
|
| | |
|
| | | iti.MoveAscent();
|
| | | isNotEnd = false;
|
| | | } else {
|
| | | }
|
| | | else
|
| | | {
|
| | | isNotEnd = true;
|
| | | break;
|
| | | }
|
| | | } // for
|
| | | } // while
|
| | | Console.WriteLine("Tree Node Count = " + i);
|
| | | _Plogger.Info("Tree Node Count = " + i);
|
| | | } else
|
| | | _plogger.Info("Tree Node Count = " + i);
|
| | | }
|
| | | else
|
| | | {
|
| | | Console.WriteLine("Tree is null");
|
| | | _Plogger.Info("Tree is null");
|
| | | _plogger.Info("Tree is null");
|
| | | throw new Exception("無法追蹤到任何設備,可能是該用戶所在變壓器設備連結性有問題。");
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private ResultTree Trace(bool Reverse) {
|
| | | private ResultTree Trace(bool reverse)
|
| | | {
|
| | | ResultTree tree = null;
|
| | |
|
| | | try {
|
| | | configTrace();
|
| | | _Plogger.Info("configTrace OK.");
|
| | | try
|
| | | {
|
| | | ConfigTrace();
|
| | | _plogger.Info("configTrace OK.");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _Plogger.Error(e.Message);
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return tree;
|
| | | }
|
| | |
|
| | | try {
|
| | | tree = ModeTrace(Reverse);
|
| | | try
|
| | | {
|
| | | tree = ModeTrace(reverse);
|
| | | }
|
| | | catch (Exception e) {
|
| | | _Plogger.Error(e.Message);
|
| | | catch (Exception e)
|
| | | {
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | |
|
| | | return tree;
|
| | | }
|
| | |
|
| | | void configTrace() {
|
| | | if (m_dbConnectionString == null) {
|
| | | m_dbConnectionString = "basedb/basedb000@nntpc";
|
| | | private void ConfigTrace()
|
| | | {
|
| | | if (_mDbConnectionString == null)
|
| | | {
|
| | | _mDbConnectionString = "basedb/basedb000@nntpc";
|
| | | }
|
| | | try {
|
| | | if (m_pContext == null) m_pContext = m_tEngine.teoCreateContext();
|
| | | try
|
| | | {
|
| | | if (_mPContext == null) _mPContext = _mTEngine.teoCreateContext();
|
| | |
|
| | | if (m_pContext.IsConnected == 0) {
|
| | | m_pContext.Connect("", m_dbConnectionString);
|
| | | if (_mPContext.IsConnected == 0)
|
| | | {
|
| | | _mPContext.Connect("", _mDbConnectionString);
|
| | | }
|
| | | }
|
| | | catch (Exception ex) {
|
| | | _Plogger.Error(ex.Message);
|
| | | catch (Exception ex)
|
| | | {
|
| | | _plogger.Error(ex.Message);
|
| | | }
|
| | | }
|
| | |
|
| | | private ResultTree ModeTrace(bool Reverse) {
|
| | | private ResultTree ModeTrace(bool reverse)
|
| | | {
|
| | | TravelContext tContext = new TravelContext();
|
| | | TravelStartCriterion sCriterion = new TravelStartCriterion();
|
| | | TravelTerminateCriterion eCriterion = new TravelTerminateCriterion();
|
| | |
|
| | | sCriterion.ClsID = (short) s_Fsc;
|
| | | sCriterion.ObjID = s_Ufid;
|
| | | sCriterion.ClsID = (short)_sFsc;
|
| | | sCriterion.ObjID = _sUfid;
|
| | |
|
| | | if (Reverse) // 反向上追
|
| | | if (reverse) // 反向上追
|
| | | {
|
| | | sCriterion.StartMode = (TRAVELSTARTCRITERIONTYPE)(Convert.ToInt32(TRAVELSTARTCRITERIONTYPE.TRAVELBYNEGDIR) + Convert.ToInt32(TRAVELSTARTCRITERIONTYPE.TRAVELWITHFOLLOW));
|
| | |
|
| | | eCriterion.ClsID = (short)CCS.LocalVariable.Breaker;
|
| | | eCriterion.ClsID = (short)GlobalVariable.Breaker;
|
| | | eCriterion.EndMode = TRAVELTERMCRITERIONTYPE.TRAVELTOTHISCLASS;
|
| | | } else // 順向追蹤
|
| | | }
|
| | | else // 順向追蹤
|
| | | {
|
| | | sCriterion.StartMode = TRAVELSTARTCRITERIONTYPE.TRAVELBYCURDIR;
|
| | |
|
| | |
| | | tContext.addCriterion(sCriterion);
|
| | | tContext.addCriterion(eCriterion);
|
| | |
|
| | | m_pContext.ResetContext();
|
| | | _mPContext.ResetContext();
|
| | |
|
| | | _Plogger.Info("Set ModeTrace OK.");
|
| | | ResultTreeBuilder trBuilder = m_pContext.CreateTreeBuilder();
|
| | | _plogger.Info("Set ModeTrace OK.");
|
| | | ResultTreeBuilder trBuilder = _mPContext.CreateTreeBuilder();
|
| | | if (!trBuilder.constructResultTree(tContext, TRAVELTHREADMODE.CONMODE_SYNCHRONOUS)) { return null; }
|
| | | _Plogger.Info("ConstructResultTree OK.");
|
| | | _plogger.Info("ConstructResultTree OK.");
|
| | | ResultTree result = trBuilder.ResultTree;
|
| | |
|
| | | _Plogger.Info("getResultTree OK.");
|
| | | _plogger.Info("getResultTree OK.");
|
| | | return result;
|
| | | }
|
| | |
|
| | | //判斷是否為最終設備(逆向追到已經無child的設備時,檢查該設備是否為最終設備(查驗該設備的同層設備,是否仍有可繼續逆向追蹤的設備,若無,則該設備為最終設備
|
| | | private bool isEndEquip(Equipment SelfEquip)
|
| | | private bool IsEndEquip(Equipment selfEquip)
|
| | | {
|
| | | String SqlStmt;
|
| | | OracleCommand Command = null;
|
| | | string sqlStmt;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | | long N_Value = 0;
|
| | | long nValue = 0;
|
| | |
|
| | | SqlStmt = "SELECT DIR,OSTATUS,N1,N2 FROM BASEDB.CONNECTIVITY WHERE FSC = " + SelfEquip.getFSC() + " AND UFID = " + SelfEquip.getUFID();
|
| | | sqlStmt = "SELECT DIR,OSTATUS,N1,N2 FROM BASEDB.CONNECTIVITY WHERE FSC = " + selfEquip.Fsc+ " AND UFID = " + selfEquip.Ufid;
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | if (Convert.ToInt32(reader["DIR"]) == 3) //順向無電 N1-->N2,所以逆向的上游N值抓N2
|
| | | N_Value = Convert.ToInt32(reader["N2"]);
|
| | | nValue = Convert.ToInt32(reader["N2"]);
|
| | | else
|
| | | N_Value = Convert.ToInt32(reader["N1"]);
|
| | | nValue = Convert.ToInt32(reader["N1"]);
|
| | | }
|
| | | }
|
| | | reader.Close();
|
| | |
|
| | | SqlStmt = "SELECT FSC,UFID,DIR,OSTATUS,N1,N2 FROM BASEDB.CONNECTIVITY WHERE N1 <> N2 AND ( N1 = " + N_Value + " OR N2 = " + N_Value + ")";
|
| | | Command.CommandText = SqlStmt;
|
| | | sqlStmt = "SELECT FSC,UFID,DIR,OSTATUS,N1,N2 FROM BASEDB.CONNECTIVITY WHERE N1 <> N2 AND ( N1 = " + nValue + " OR N2 = " + nValue + ")";
|
| | | command.CommandText = sqlStmt;
|
| | |
|
| | | reader = Command.ExecuteReader();
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | while (reader.Read())
|
| | | {
|
| | | if (Convert.ToInt32(reader["FSC"]) == SelfEquip.getFSC() && Convert.ToInt32(reader["UFID"]) == SelfEquip.getUFID())
|
| | | if (Convert.ToInt32(reader["FSC"]) == selfEquip.Fsc&& Convert.ToInt32(reader["UFID"]) == selfEquip.Ufid)
|
| | | continue;
|
| | |
|
| | | if (Convert.ToInt32(reader["OSTATUS"]) == 0) //切開的設備不可能為逆向的上游
|
| | | continue;
|
| | |
|
| | | if (Convert.ToInt32(reader["N1"]) == N_Value)
|
| | | if (Convert.ToInt32(reader["N1"]) == nValue)
|
| | | {
|
| | | switch (Convert.ToInt32(reader["DIR"]))
|
| | | {
|
| | | case 1:
|
| | | case 3:
|
| | | break;
|
| | |
|
| | | case 2:
|
| | | case 4:
|
| | | return false; //如果逆向的上游連接點為N1,一定要N2-->N1才可能還有需要逆向追蹤設備
|
| | |
| | | break; //未供電設備不可能是逆向上游
|
| | | }
|
| | | }
|
| | | else if (Convert.ToInt32(reader["N2"]) == N_Value)
|
| | | else if (Convert.ToInt32(reader["N2"]) == nValue)
|
| | | {
|
| | | switch (Convert.ToInt32(reader["DIR"]))
|
| | | {
|
| | |
| | | case 2:
|
| | | case 4:
|
| | | break;
|
| | |
|
| | | case 99:
|
| | | return false; //未供電設備不可能是逆向上游
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _Plogger.Error(e.Message);
|
| | | _plogger.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (Command != null)
|
| | | Command.Dispose();
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | }
|
| | |
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | private int getTraceCount(int Fsc, int Ufid)
|
| | | private int GetTraceCount(int fsc, int ufid)
|
| | | {
|
| | | if (TraceCounts.ContainsKey(Fsc + "|" + Ufid))
|
| | | return Int32.Parse(TraceCounts[Fsc + "|" + Ufid].ToString());
|
| | | if (_traceCounts.ContainsKey(fsc + "|" + ufid))
|
| | | return int.Parse(_traceCounts[fsc + "|" + ufid].ToString());
|
| | | else
|
| | | return 0;
|
| | | }
|
| | |
|
| | | private void AddTraceCount(int Fsc, int Ufid)
|
| | | private void AddTraceCount(int fsc, int ufid)
|
| | | {
|
| | | int Count = 1;
|
| | | int count = 1;
|
| | |
|
| | | if (TraceCounts.ContainsKey(Fsc + "|" + Ufid))
|
| | | if (_traceCounts.ContainsKey(fsc + "|" + ufid))
|
| | | {
|
| | | Count = Int32.Parse(TraceCounts[Fsc + "|" + Ufid].ToString());
|
| | | Count++;
|
| | | TraceCounts.Remove(Fsc + "|" + Ufid);
|
| | | count = int.Parse(_traceCounts[fsc + "|" + ufid].ToString());
|
| | | count++;
|
| | | _traceCounts.Remove(fsc + "|" + ufid);
|
| | | }
|
| | |
|
| | | TraceCounts.Add(Fsc + "|" + Ufid, Count.ToString());
|
| | | _traceCounts.Add(fsc + "|" + ufid, count.ToString());
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public class TraceLoopException : Exception
|
| | | {
|
| | | public String Message = "";
|
| | |
|
| | | public TraceLoopException(String _Message)
|
| | | public TraceLoopException(string message) : base(message)
|
| | | {
|
| | | Message = _Message;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using CCSTrace.CCS.Domain;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class FinishEvent
|
| | | {
|
| | | private bool upLevel;
|
| | | private int OriginCaseStatus = 0;
|
| | | private CCS.Object.EventRecord m_EventRec = null;
|
| | | private RecordLog _PLog;
|
| | | private OracleConnection _ConnectionTPC;
|
| | | private OracleTransaction _Transaction;
|
| | | private bool _upLevel;
|
| | | private int _originCaseStatus = 0;
|
| | | private Object.EventRecord _mEventRec = null;
|
| | | private RecordLog _pLog;
|
| | | private OracleConnection _connectionTpc;
|
| | | private OracleTransaction _transaction;
|
| | |
|
| | | public FinishEvent()
|
| | | {
|
| | | }
|
| | |
|
| | | public bool Finish(int m_Kind, CCS.Object.EventRecord m_Record, OracleConnection _Conn, OracleTransaction _Trx, RecordLog _Log)
|
| | | public bool Finish(int mKind, Object.EventRecord mRecord, OracleConnection conn, OracleTransaction trx, RecordLog log)
|
| | | {
|
| | | this.m_EventRec = m_Record;
|
| | | _PLog = _Log;
|
| | | _ConnectionTPC = _Conn;
|
| | | _Transaction = _Trx;
|
| | | _mEventRec = mRecord;
|
| | | _pLog = log;
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | |
|
| | | _PLog.Info("進行OMS資料更新程序...");
|
| | | if (m_Record.getParentID() == 0)
|
| | | _pLog.Info("進行OMS資料更新程序...");
|
| | | if (mRecord.ParentId== 0)
|
| | | { // Original Case
|
| | | if (!(this.ProcessSingalCase(m_Record)))
|
| | | if (!(ProcessSingalCase(mRecord)))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("更新eos.events成功!");
|
| | | _pLog.Info("更新eos.events成功!");
|
| | | }
|
| | | else
|
| | | { // Child Case
|
| | | if (!(this.ProcessMergeCase(m_Record)))
|
| | | if (!(ProcessMergeCase(mRecord)))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("更新eos.events成功!");
|
| | | _pLog.Info("更新eos.events成功!");
|
| | | }
|
| | |
|
| | | // inert into eos.eventrecord && eos.eventrecord_ex
|
| | | OracleCommand Command = new OracleCommand(m_Record.getSqlStmt(), _ConnectionTPC,_Transaction);
|
| | | OracleCommand Command1 = null;
|
| | | OracleCommand command = new OracleCommand(mRecord.GetSqlStmt(), _connectionTpc, _transaction);
|
| | | OracleCommand command1 = null;
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord");
|
| | | Command.Dispose();
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | Command.CommandText = m_Record.getLocateEquipment().getSqlStmt();
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = mRecord.LocateEquipment.GetSqlStmt();
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord_ex");
|
| | | Command.Dispose();
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord_ex");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | |
|
| | | if ((m_Kind == CCS.LocalVariable.Success) || (m_Kind == CCS.LocalVariable.CaseTypeChanged))
|
| | | if ((mKind == GlobalVariable.Success) || (mKind == GlobalVariable.CaseTypeChanged))
|
| | | {
|
| | | /* 當饋線全停時不需注意影響虛擬用戶,影響用戶資料會由實際切開關產生 */
|
| | | if (m_Record.getFsc() != CCS.LocalVariable.Breaker)
|
| | | if (mRecord.Fsc!= GlobalVariable.Breaker)
|
| | | {
|
| | | if (!SetVisualCustomer(m_Record))
|
| | | if (!SetVisualCustomer(mRecord))
|
| | | {
|
| | | _PLog.Error("新增影響用戶資料錯誤.");
|
| | | _pLog.Error("新增影響用戶資料錯誤.");
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("新增影響用戶成功!");
|
| | | _pLog.Info("新增影響用戶成功!");
|
| | | }
|
| | |
|
| | | upLevel = false; /* 判斷交辦案件是否升級為母案件 */
|
| | | _upLevel = false; /* 判斷交辦案件是否升級為母案件 */
|
| | |
|
| | | if (!(UpdateImportCase(m_Record)))
|
| | | if (!(UpdateImportCase(mRecord)))
|
| | | {
|
| | | _PLog.Error("處理案件等級變更時發生錯誤.");
|
| | | _pLog.Error("處理案件等級變更時發生錯誤.");
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("處理案件等級變更成功!");
|
| | | _pLog.Info("處理案件等級變更成功!");
|
| | |
|
| | | if (!(UpdateRecuseOrder(m_Record)))
|
| | | if (!(UpdateRecuseOrder(mRecord)))
|
| | | {
|
| | | _PLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | _pLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("新增搶修順序成功!");
|
| | | _pLog.Info("新增搶修順序成功!");
|
| | |
|
| | | if (m_Kind == CCS.LocalVariable.CaseTypeChanged)
|
| | | if (mKind == GlobalVariable.CaseTypeChanged)
|
| | | {
|
| | | if (!DeleteOldCase(m_Record))
|
| | | if (!DeleteOldCase(mRecord))
|
| | | {
|
| | | _PLog.Error("案件轉換發生錯誤");
|
| | | _pLog.Error("案件轉換發生錯誤");
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("案件轉換成功!");
|
| | | _pLog.Info("案件轉換成功!");
|
| | | }
|
| | |
|
| | | if (!this.SaveCustomerTel(m_Record))
|
| | | if (!SaveCustomerTel(mRecord))
|
| | | {
|
| | | _PLog.Error("無法將用戶電話回存回資料庫.");
|
| | | _pLog.Error("無法將用戶電話回存回資料庫.");
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("將用戶電話回存回資料庫成功!");
|
| | |
|
| | | _pLog.Info("將用戶電話回存回資料庫成功!");
|
| | | }
|
| | | else if (m_Kind == CCS.LocalVariable.NoMeter)
|
| | | else if (mKind == GlobalVariable.NoMeter)
|
| | | {
|
| | | String SqlStmt;
|
| | | SqlStmt = "INSERT INTO EOS.RESCUE_ORDER SELECT " + m_Record.getCaseID() + ",999,COUNT(*) + 1,'',"
|
| | | + m_Record.getLocateEquipment().getDSUFID() + " FROM EOS.RESCUE_ORDER WHERE DSUFID = "
|
| | | + m_Record.getLocateEquipment().getDSUFID();
|
| | | 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();
|
| | |
|
| | | Command1 = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | if (Command1.ExecuteNonQuery() <= 0)
|
| | | command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | Command1.Dispose();
|
| | | _pLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | | Command1.Dispose();
|
| | | _PLog.Info("新增搶修順序成功!");
|
| | | command1.Dispose();
|
| | | _pLog.Info("新增搶修順序成功!");
|
| | | }
|
| | |
|
| | | if (m_Record.getParentID() == 0)
|
| | | if (mRecord.ParentId== 0)
|
| | | {
|
| | | if (!InsertIntoSri(m_Record))
|
| | | if (!InsertIntoSri(mRecord))
|
| | | {
|
| | | _PLog.Error("新增資料庫(OCSDB.SRI)錯誤.");
|
| | | _pLog.Error("新增資料庫(OCSDB.SRI)錯誤.");
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("新增資料庫(OCSDB.SRI)成功!");
|
| | | _pLog.Info("新增資料庫(OCSDB.SRI)成功!");
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | |
|
| | | if (Command1 != null)
|
| | | Command1.Dispose();
|
| | | if (command1 != null)
|
| | | command1.Dispose();
|
| | |
|
| | | throw e;
|
| | | }
|
| | |
|
| | | /** COMMIT的動作須連外面CCS的資料都正確輸入完才作 */
|
| | | return true;
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | private bool ProcessSingalCase(CCS.Object.EventRecord m_Record)
|
| | | private bool ProcessSingalCase(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt;
|
| | | bool Result = false;
|
| | | SqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + m_Record.getCaseID() + "," + CCS.LocalVariable.WaitForDespatch + ",1,"
|
| | | + CCS.LocalVariable.OriginalCase + ",0)";
|
| | | string sqlStmt;
|
| | | bool result = false;
|
| | | sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.OriginalCase + ",0)";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() > 0)
|
| | | Result = true;
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | result = true;
|
| | | else
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法insert eos.events. Error = " + e.Message);
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events. Error = " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | return Result;
|
| | | return result;
|
| | | }
|
| | |
|
| | | private bool ProcessMergeCase(CCS.Object.EventRecord m_Record)
|
| | | private bool ProcessMergeCase(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | | // insert eos.events
|
| | | SqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + m_Record.getCaseID() + "," + CCS.LocalVariable.WaitForDespatch + ",1,"
|
| | | + CCS.LocalVariable.ChildCase + ",0)";
|
| | | sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.ChildCase + ",0)";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | Command.Dispose();
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | // insert into eos.mergecase
|
| | | SqlStmt = "INSERT INTO EOS.MERGECASE VALUES(" + m_Record.getCaseID() + ",'" + m_Record.getAcceptNum() + "'," + m_Record.getParentID() + ")";
|
| | | sqlStmt = "INSERT INTO EOS.MERGECASE VALUES(" + mRecord.CaseId+ ",'" + mRecord.AcceptNum+ "'," + mRecord.ParentId+ ")";
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法insert eos.mergecase");
|
| | | Command.Dispose();
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.mergecase");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | // update parent case data(EOS.EVENTS)
|
| | | SqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + CCS.LocalVariable.ParentCase + ",MERGECASECOUNT = MERGECASECOUNT + 1 " + "WHERE CASEID = "
|
| | | + m_Record.getParentID();
|
| | | sqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + GlobalVariable.ParentCase + ",MERGECASECOUNT = MERGECASECOUNT + 1 " + "WHERE CASEID = "
|
| | | + mRecord.ParentId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法更改母案件資料");
|
| | | Command.Dispose();
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更改母案件資料");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | // update parent case data(EOS.EVENTRECORD)
|
| | | SqlStmt = "UPDATE EOS.EVENTRECORD SET FSC = " + m_Record.getFsc() + ",UFID = " + m_Record.getUfid()
|
| | | + " WHERE CASEID in (SELECT CASEID FROM EOS.MERGECASE WHERE PARENTID = " + m_Record.getParentID() + ") OR CASEID = "
|
| | | + m_Record.getParentID();
|
| | | sqlStmt = "UPDATE EOS.EVENTRECORD SET FSC = " + mRecord.Fsc+ ",UFID = " + mRecord.Ufid + " WHERE CASEID in (SELECT CASEID FROM EOS.MERGECASE WHERE PARENTID = " + mRecord.ParentId+ ") OR CASEID = "
|
| | | + mRecord.ParentId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: 無法update eos.eventrecord(FSC,UFID)");
|
| | | Command.Dispose();
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法update eos.eventrecord(FSC,UFID)");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("儲存資料時發生錯誤: " + e.Message);
|
| | | _pLog.Error("儲存資料時發生錯誤: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool SetVisualCustomer(CCS.Object.EventRecord m_Record)
|
| | | private bool SetVisualCustomer(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt = "";
|
| | | String CustomerKind = "C"; // 高壓用戶or一般用戶
|
| | | string sqlStmt = "";
|
| | | string customerKind = "C"; // 高壓用戶or一般用戶
|
| | |
|
| | | SqlStmt = "SELECT COUNT(*) as COUNT FROM BASEDB.HICUSTOMER WHERE METR_NUMB = '" + m_Record.getMeter() + "'";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | sqlStmt = "SELECT COUNT(*) as COUNT FROM BASEDB.HICUSTOMER WHERE METR_NUMB = '" + mRecord.Meter+ "'";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | if (Convert.ToInt32(reader["COUNT"].ToString()) > 0)
|
| | | {
|
| | | CustomerKind = "H";
|
| | | customerKind = "H";
|
| | | }
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _PLog.Error("無法判斷用戶種類.");
|
| | | _pLog.Error("無法判斷用戶種類.");
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | if (m_Record.getParentID() == 0)
|
| | | if (mRecord.ParentId== 0)
|
| | | {
|
| | | SqlStmt = "INSERT INTO EOS.TMPAFFECTCUSTMS SELECT " + m_Record.getCaseID() + ",A.M_NAME,"
|
| | | + "M.TELE_NUMB,M.METR_NUMB,A.M_ADDR,M.TRAN_CORD,M.CUST_TYPE,'" + CustomerKind + "' "
|
| | | + "FROM BASEDB.METER M,BASEDB.MSTADDR A WHERE M.METR_NUMB = A.M_CUST_NO(+) AND M.METR_NUMB = '" + m_Record.getMeter() + "'";
|
| | | sqlStmt = "INSERT INTO EOS.TMPAFFECTCUSTMS SELECT " + mRecord.CaseId+ ",A.M_NAME,"
|
| | | + "M.TELE_NUMB,M.METR_NUMB,A.M_ADDR,M.TRAN_CORD,M.CUST_TYPE,'" + customerKind + "' "
|
| | | + "FROM BASEDB.METER M,BASEDB.MSTADDR A WHERE M.METR_NUMB = A.M_CUST_NO(+) AND M.METR_NUMB = '" + mRecord.Meter+ "'";
|
| | |
|
| | | OracleCommand Command1 = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | if (Command1.ExecuteNonQuery() >= 0)
|
| | | OracleCommand command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command1.ExecuteNonQuery() >= 0)
|
| | | {
|
| | | Command1.Dispose();
|
| | | command1.Dispose();
|
| | | return true;
|
| | | }
|
| | | Command1.Dispose();
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | | else
|
| | | {
|
| | | return InsertMutilCustomer(CustomerKind, m_Record);
|
| | | return InsertMutilCustomer(customerKind, mRecord);
|
| | | }
|
| | | }
|
| | |
|
| | | private bool InsertMutilCustomer(String CustomerKind, CCS.Object.EventRecord m_Record)
|
| | | private bool InsertMutilCustomer(string customerKind, Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt = "";
|
| | | string sqlStmt = "";
|
| | | bool updateCustomer = false;
|
| | | String m_TpclidGroupID = "";
|
| | | String m_CustomerKind = "C";
|
| | | string mTpclidGroupId = "";
|
| | | string mCustomerKind = "C";
|
| | |
|
| | | SqlStmt = "SELECT COUNT(*) as COUNT FROM EOS.TMPAFFECTCUSTMS WHERE CASEID = " + m_Record.getParentID()
|
| | | + " OR CASEID IN (SELECT CASEID FROM EOS.MERGECASE WHERE PARENTID = " + m_Record.getParentID() + ")";
|
| | | sqlStmt = "SELECT COUNT(*) as COUNT FROM EOS.TMPAFFECTCUSTMS WHERE CASEID = " + mRecord.ParentId + " OR CASEID IN (SELECT CASEID FROM EOS.MERGECASE WHERE PARENTID = " + mRecord.ParentId+ ")";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _PLog.Error("無法確認是否需重新修改原始母案件之影響用戶資料.");
|
| | | _pLog.Error("無法確認是否需重新修改原始母案件之影響用戶資料.");
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | OracleCommand Command1 = null;
|
| | | OracleCommand command1 = null;
|
| | |
|
| | | if (updateCustomer)
|
| | | {
|
| | | /* 找出原始案件的影響用戶資料 */
|
| | | SqlStmt = "SELECT TPCLIDGROUPID,CUSTOMERKIND FROM EOS.TMPAFFECTCUSTMS WHERE CASEID = " + m_Record.getParentID();
|
| | | sqlStmt = "SELECT TPCLIDGROUPID,CUSTOMERKIND FROM EOS.TMPAFFECTCUSTMS WHERE CASEID = " + mRecord.ParentId;
|
| | |
|
| | | try
|
| | | {
|
| | | Command1 = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command1.ExecuteReader();
|
| | | command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command1.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | m_TpclidGroupID = reader["TPCLIDGROUPID"].ToString().Trim();
|
| | | m_CustomerKind = reader["CUSTOMERKIND"].ToString();
|
| | | mTpclidGroupId = reader["TPCLIDGROUPID"].ToString().Trim();
|
| | | mCustomerKind = reader["CUSTOMERKIND"].ToString();
|
| | | }
|
| | | reader.Close();
|
| | |
|
| | | /* 若為高壓用戶,用戶數本來就為1人..無須再作修正 */
|
| | | if (m_CustomerKind.Equals("C"))
|
| | | if (mCustomerKind.Equals("C"))
|
| | | {
|
| | | /* 刪除原始案件的既有用戶資料 */
|
| | | SqlStmt = "DELETE EOS.TMPAFFECTCUSTMS WHERE CASEID = " + m_Record.getParentID();
|
| | | sqlStmt = "DELETE EOS.TMPAFFECTCUSTMS WHERE CASEID = " + mRecord.ParentId;
|
| | |
|
| | | Command1.CommandText = SqlStmt;
|
| | | if (Command1.ExecuteNonQuery() < 0)
|
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法刪除原始案件的既有用戶資料.");
|
| | | Command1.Dispose();
|
| | | _pLog.Error("無法刪除原始案件的既有用戶資料.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | /* 將原始案件的影響用戶數改為變壓器的全部用戶 */
|
| | | SqlStmt = "INSERT INTO EOS.TMPAFFECTCUSTMS SELECT " + m_Record.getParentID() + ",A.M_NAME,"
|
| | | + "M.TELE_NUMB,M.METR_NUMB,A.M_ADDR,M.TPCLIDGROUPID,M.CUST_TYPE,'" + m_CustomerKind + "' "
|
| | | sqlStmt = "INSERT INTO EOS.TMPAFFECTCUSTMS SELECT " + mRecord.ParentId+ ",A.M_NAME,"
|
| | | + "M.TELE_NUMB,M.METR_NUMB,A.M_ADDR,M.TPCLIDGROUPID,M.CUST_TYPE,'" + mCustomerKind + "' "
|
| | | + "FROM (SELECT TELE_NUMB,METR_NUMB,TRAN_CORD as TPCLIDGROUPID,CUST_TYPE FROM BASEDB.METER " + "WHERE TRAN_CORD = '"
|
| | | + m_TpclidGroupID + "') M,BASEDB.MSTADDR A WHERE M.METR_NUMB = A.M_CUST_NO(+) ";
|
| | | + mTpclidGroupId + "') M,BASEDB.MSTADDR A WHERE M.METR_NUMB = A.M_CUST_NO(+) ";
|
| | |
|
| | | Command1.CommandText = SqlStmt;
|
| | | if (Command1.ExecuteNonQuery() <= 0)
|
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法將原始案件的影響用戶數改為變壓器的全部用戶.");
|
| | | Command1.Dispose();
|
| | | _pLog.Error("無法將原始案件的影響用戶數改為變壓器的全部用戶.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | | }
|
| | | Command1.Dispose();
|
| | | command1.Dispose();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("無法更新原始案件影響用戶資料: " + e.Message);
|
| | | _pLog.Error("無法更新原始案件影響用戶資料: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Command1.Dispose();
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | /* 新受理案件的影響用戶資料 */
|
| | | SqlStmt = "INSERT INTO EOS.TMPAFFECTCUSTMS SELECT " + m_Record.getCaseID() + ",A.M_NAME,"
|
| | | + "M.TELE_NUMB,M.METR_NUMB,A.M_ADDR,M.TPCLIDGROUPID,M.CUST_TYPE,'" + CustomerKind + "' "
|
| | | sqlStmt = "INSERT INTO EOS.TMPAFFECTCUSTMS SELECT " + mRecord.CaseId+ ",A.M_NAME,"
|
| | | + "M.TELE_NUMB,M.METR_NUMB,A.M_ADDR,M.TPCLIDGROUPID,M.CUST_TYPE,'" + customerKind + "' "
|
| | | + "FROM (SELECT TELE_NUMB,METR_NUMB,TRAN_CORD as TPCLIDGROUPID,CUST_TYPE FROM BASEDB.METER "
|
| | | + "WHERE TRAN_CORD = (SELECT TRAN_CORD FROM BASEDB.METER WHERE METR_NUMB = '" + m_Record.getMeter()
|
| | | + "')) M,BASEDB.MSTADDR A WHERE M.METR_NUMB = A.M_CUST_NO(+) ";
|
| | | + "WHERE TRAN_CORD = (SELECT TRAN_CORD FROM BASEDB.METER WHERE METR_NUMB = '" + mRecord.Meter + "')) M,BASEDB.MSTADDR A WHERE M.METR_NUMB = A.M_CUST_NO(+) ";
|
| | |
|
| | | OracleCommand Command2 = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | if (Command2.ExecuteNonQuery() < 0)
|
| | | OracleCommand command2 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command2.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法新增新受理案件的影響用戶資料.");
|
| | | Command2.Dispose();
|
| | | _pLog.Error("無法新增新受理案件的影響用戶資料.");
|
| | | command2.Dispose();
|
| | | return false;
|
| | | }
|
| | | Command2.Dispose();
|
| | | command2.Dispose();
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool UpdateImportCase(CCS.Object.EventRecord m_Record)
|
| | | private bool UpdateImportCase(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | /* 該案件不為交辦案件 */
|
| | | if (m_Record.getImportCase() != CCS.LocalVariable.isImportCase)
|
| | | if (mRecord.ImportCase!= GlobalVariable.IsImportCase)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | /* 該交辦案件為原始案件 */
|
| | | if (m_Record.getParentID() == 0)
|
| | | if (mRecord.ParentId== 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | /* 若母案件已為交辦案件,則不需再作任何更動 */
|
| | | SqlStmt = "SELECT IMPORTCASE FROM EOS.EVENTRECORD WHERE CASEID = " + m_Record.getParentID();
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | sqlStmt = "SELECT IMPORTCASE FROM EOS.EVENTRECORD WHERE CASEID = " + mRecord.ParentId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | if (Convert.ToInt32(reader["IMPORTCASE"].ToString()) == CCS.LocalVariable.isImportCase)
|
| | | if (Convert.ToInt32(reader["IMPORTCASE"].ToString()) == GlobalVariable.IsImportCase)
|
| | | return true;
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _PLog.Error("無法取得母案件之等級.");
|
| | | _pLog.Error("無法取得母案件之等級.");
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | /* 開始進行交辦案件升級動作 */
|
| | | upLevel = true;
|
| | | _upLevel = true;
|
| | |
|
| | | /* 將交辦案件改為母案件 */
|
| | | SqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + CCS.LocalVariable.ParentCase + ",MERGECASECOUNT = "
|
| | | + "(SELECT MERGECASECOUNT FROM EOS.EVENTS WHERE CASEID = " + m_Record.getParentID() + ") WHERE CASEID = " + m_Record.getCaseID();
|
| | | sqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + GlobalVariable.ParentCase + ",MERGECASECOUNT = "
|
| | | + "(SELECT MERGECASECOUNT FROM EOS.EVENTS WHERE CASEID = " + mRecord.ParentId+ ") WHERE CASEID = " + mRecord.CaseId;
|
| | |
|
| | | OracleCommand Command1 = new OracleCommand(SqlStmt, _ConnectionTPC,_Transaction);
|
| | | if (Command1.ExecuteNonQuery() <= 0)
|
| | | OracleCommand command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法將交辦案件改為母案件.");
|
| | | Command1.Dispose();
|
| | | _pLog.Error("無法將交辦案件改為母案件.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | /* 將母案件改為子案件 */
|
| | | SqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + CCS.LocalVariable.ChildCase + ",MERGECASECOUNT = 0 WHERE CASEID = " + m_Record.getParentID();
|
| | | sqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + GlobalVariable.ChildCase + ",MERGECASECOUNT = 0 WHERE CASEID = " + mRecord.ParentId;
|
| | |
|
| | | Command1.CommandText = SqlStmt;
|
| | | if (Command1.ExecuteNonQuery() <= 0)
|
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法將母案件改為子案件.");
|
| | | Command1.Dispose();
|
| | | _pLog.Error("無法將母案件改為子案件.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | // 將EOS.MERGECASE內的資料修正 1.將原先該母案件下的子案件都改掛在交辦案件下 2.將已INSERT入EOS.MERGECASE內的交辦案件資料改為原先母案件的資料(CaseID,AcceptNum)
|
| | | SqlStmt = "UPDATE EOS.MERGECASE SET PARENTID = " + m_Record.getCaseID() + " WHERE PARENTID = " + m_Record.getParentID();
|
| | | sqlStmt = "UPDATE EOS.MERGECASE SET PARENTID = " + mRecord.CaseId+ " WHERE PARENTID = " + mRecord.ParentId;
|
| | |
|
| | | Command1.CommandText = SqlStmt;
|
| | | if (Command1.ExecuteNonQuery() <= 0)
|
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法將原先該母案件下的子案件都改掛在交辦案件下.");
|
| | | Command1.Dispose();
|
| | | _pLog.Error("無法將原先該母案件下的子案件都改掛在交辦案件下.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "UPDATE EOS.MERGECASE SET (CASEID,ACCEPTNUM) = (SELECT CASEID,ACCEPTNUM FROM EOS.EVENTRECORD WHERE CASEID = "
|
| | | + m_Record.getParentID() + ") WHERE CASEID = " + m_Record.getCaseID();
|
| | | sqlStmt = "UPDATE EOS.MERGECASE SET (CASEID,ACCEPTNUM) = (SELECT CASEID,ACCEPTNUM FROM EOS.EVENTRECORD WHERE CASEID = "
|
| | | + mRecord.ParentId+ ") WHERE CASEID = " + mRecord.CaseId;
|
| | |
|
| | | Command1.CommandText = SqlStmt;
|
| | | if (Command1.ExecuteNonQuery() <= 0)
|
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法將已INSERT入EOS.MERGECASE內的交辦案件資料改為原先母案件的資料(CaseID,AcceptNum).");
|
| | | Command1.Dispose();
|
| | | _pLog.Error("無法將已INSERT入EOS.MERGECASE內的交辦案件資料改為原先母案件的資料(CaseID,AcceptNum).");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | | Command1.Dispose();
|
| | | command1.Dispose();
|
| | |
|
| | | return UpdateOtherTable(m_Record.getParentID(), m_Record.getCaseID(), m_Record.getAcceptNum());
|
| | | return UpdateOtherTable(mRecord.ParentId, mRecord.CaseId, mRecord.AcceptNum);
|
| | | }
|
| | |
|
| | | private bool UpdateOtherTable(int OldCaseID, int NewCaseID, String NewAcceptNum)
|
| | | private bool UpdateOtherTable(int oldCaseId, int newCaseId, string newAcceptNum)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | SqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + OldCaseID;
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | sqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + oldCaseId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | OriginCaseStatus = Convert.ToInt32(reader["CASESTATUS"].ToString());
|
| | | _originCaseStatus = Convert.ToInt32(reader["CASESTATUS"].ToString());
|
| | | }
|
| | | reader.Close();
|
| | |
|
| | | switch (OriginCaseStatus)
|
| | | switch (_originCaseStatus)
|
| | | {
|
| | | case 0:
|
| | | _PLog.Error("找不到原始母案件之案件狀態.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("找不到原始母案件之案件狀態.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | case CCS.LocalVariable.WaitForDespatch:
|
| | |
|
| | | case (int) CCSCaseState.WaitForDespatch:
|
| | | break;
|
| | | case CCS.LocalVariable.WaitForSponsor:
|
| | | SqlStmt = "UPDATE EOS.EVENTDESPATCH SET CASEID = " + NewCaseID + " WHERE CASEID = " + OldCaseID;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | case (int) CCSCaseState.WaitForSponsor:
|
| | | sqlStmt = "UPDATE EOS.EVENTDESPATCH SET CASEID = " + newCaseId + " WHERE CASEID = " + oldCaseId;
|
| | |
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.EVENTDESPATCH.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.EVENTDESPATCH.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "update eos.events set casestatus=" + CCS.LocalVariable.WaitForSponsor + " where caseid=" + NewCaseID;
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | sqlStmt = "update eos.events set casestatus=" + CCSCaseState.WaitForSponsor + " where caseid=" + newCaseId;
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.EVENTS.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.EVENTS.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | this.m_EventRec.setDespatched(true);
|
| | | _mEventRec.IsDespatched = true;
|
| | | break;
|
| | | }
|
| | |
|
| | | SqlStmt = "UPDATE EOS.EVENTS SET CASESTATUS = " + CCS.LocalVariable.WaitForDespatch + " WHERE CASEID = " + OldCaseID;
|
| | | sqlStmt = "UPDATE EOS.EVENTS SET CASESTATUS = " + CCSCaseState.WaitForDespatch + " WHERE CASEID = " + oldCaseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.Events的CaseStatus.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.Events的CaseStatus.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "UPDATE OCSDB.SRI SET SCENENAME = '" + NewAcceptNum + "' WHERE SCENENAME = (SELECT ACCEPTNUM FROM "
|
| | | + "EOS.EVENTRECORD WHERE CASEID = " + OldCaseID + ")";
|
| | | sqlStmt = "UPDATE OCSDB.SRI SET SCENENAME = '" + newAcceptNum + "' WHERE SCENENAME = (SELECT ACCEPTNUM FROM "
|
| | | + "EOS.EVENTRECORD WHERE CASEID = " + oldCaseId + ")";
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新OCSDB.SRI.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新OCSDB.SRI.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "SELECT COUNT(*) as COUNT FROM EOS.CRTAPOLOGY WHERE CASEID = " + OldCaseID;
|
| | | sqlStmt = "SELECT COUNT(*) as COUNT FROM EOS.CRTAPOLOGY WHERE CASEID = " + oldCaseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | reader = Command.ExecuteReader();
|
| | | int Count = 0;
|
| | | command.CommandText = sqlStmt;
|
| | | reader = command.ExecuteReader();
|
| | | int count = 0;
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | Count = Convert.ToInt32(reader["COUNT"].ToString());
|
| | | count = Convert.ToInt32(reader["COUNT"].ToString());
|
| | | }
|
| | | reader.Close();
|
| | |
|
| | | // 已有切過開關
|
| | | if (Count > 0)
|
| | | if (count > 0)
|
| | | {
|
| | | SqlStmt = "UPDATE EOS.EVENTFACILITY SET CASEID = " + NewCaseID + " WHERE CASEID = " + OldCaseID;
|
| | | sqlStmt = "UPDATE EOS.EVENTFACILITY SET CASEID = " + newCaseId + " WHERE CASEID = " + oldCaseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.EVENTFACILITY.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.EVENTFACILITY.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "UPDATE EOS.CRTAPOLOGY SET CASEID = " + NewCaseID + " WHERE CASEID = " + OldCaseID;
|
| | | sqlStmt = "UPDATE EOS.CRTAPOLOGY SET CASEID = " + newCaseId + " WHERE CASEID = " + oldCaseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.CRTAPOLOGY.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.CRTAPOLOGY.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "UPDATE EOS.EVENTAFFECT SET CASEID = " + NewCaseID + " WHERE CASEID = " + OldCaseID;
|
| | | sqlStmt = "UPDATE EOS.EVENTAFFECT SET CASEID = " + newCaseId + " WHERE CASEID = " + oldCaseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.EVENTAFFECT.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.EVENTAFFECT.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | // SqlStmt = "UPDATE EOS.VOICE SET CASEID = " + NewCaseID + " WHERE CASEID = " + OldCaseID;
|
| | |
|
| | | // if (CCS.LocalVariable.Conn.UpdateDB(SqlStmt) < 0) {
|
| | | // if (CCS.GlobalVariable.Conn.UpdateDB(SqlStmt) < 0) {
|
| | | // _PLog.error("無法更新EOS.VOICE.");
|
| | | // return false;
|
| | | // }
|
| | |
|
| | | SqlStmt = "UPDATE OCSDB.LOCKFEATURE SET DESCRIPTION = '" + NewAcceptNum + "' WHERE DESCRIPTION = (SELECT ACCEPTNUM FROM "
|
| | | + "EOS.EVENTRECORD WHERE CASEID = " + OldCaseID + ")";
|
| | | sqlStmt = "UPDATE OCSDB.LOCKFEATURE SET DESCRIPTION = '" + newAcceptNum + "' WHERE DESCRIPTION = (SELECT ACCEPTNUM FROM "
|
| | | + "EOS.EVENTRECORD WHERE CASEID = " + oldCaseId + ")";
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新OCSDB.LOCKFEATURE");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新OCSDB.LOCKFEATURE");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | }
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool UpdateRecuseOrder(CCS.Object.EventRecord m_Record)
|
| | | private bool UpdateRecuseOrder(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt;
|
| | | int Rank = 999;
|
| | | int Priority = 1;
|
| | | OracleCommand Command = null;
|
| | | string sqlStmt;
|
| | | int rank = 999;
|
| | | int priority = 1;
|
| | | OracleCommand command = null;
|
| | |
|
| | | /* 單純的子案件或不需升級的交辦案件,不需要更新EOS.RESCUE_ORDER */
|
| | | if ((m_Record.getParentID() != 0) && !(upLevel))
|
| | | if ((mRecord.ParentId!= 0) && !(_upLevel))
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | /* 該母案件已派工,無搶修順序紀錄 */
|
| | | if (OriginCaseStatus > CCS.LocalVariable.WaitForDespatch)
|
| | | if (_originCaseStatus > (int) CCSCaseState.WaitForDespatch)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | try
|
| | | {
|
| | | if (upLevel)
|
| | | if (_upLevel)
|
| | | {
|
| | | /* 將原先母案件的編號改為新的母案件編號 */
|
| | | SqlStmt = "UPDATE EOS.RESCUE_ORDER SET CASEID = " + m_Record.getCaseID() + " WHERE CASEID = " + m_Record.getParentID()
|
| | | + " AND DSUFID = " + m_Record.getLocateEquipment().getDSUFID();
|
| | | sqlStmt = "UPDATE EOS.RESCUE_ORDER SET CASEID = " + mRecord.CaseId+ " WHERE CASEID = " + mRecord.ParentId + " AND DSUFID = " + mRecord.LocateEquipment.GetDsufid();
|
| | |
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Transaction);
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.RESCUE_ORDER: 無法將原先母案件的編號改為新的母案件編號.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.RESCUE_ORDER: 無法將原先母案件的編號改為新的母案件編號.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | /* 找出該饋線的等級 */
|
| | | SqlStmt = "SELECT RANK FROM EOS.IMP_FEEDER WHERE FEEDERID = " + m_Record.getFdrID();
|
| | | sqlStmt = "SELECT RANK FROM EOS.IMP_FEEDER WHERE FEEDERID = " + mRecord.FdrId;
|
| | |
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | Rank = Convert.ToInt32(reader["RANK"].ToString());
|
| | | rank = Convert.ToInt32(reader["RANK"].ToString());
|
| | | }
|
| | | reader.Close();
|
| | |
|
| | | /* 找出同等級饋線中的最大搶修順序號碼 */
|
| | | SqlStmt = "SELECT MAX(PRIORITY) as PRIORITY FROM EOS.RESCUE_ORDER WHERE RANK = " + Rank + " AND DSUFID = "
|
| | | + m_Record.getLocateEquipment().getDSUFID();
|
| | | sqlStmt = "SELECT MAX(PRIORITY) as PRIORITY FROM EOS.RESCUE_ORDER WHERE RANK = " + rank + " AND DSUFID = "
|
| | | + mRecord.LocateEquipment.GetDsufid();
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | reader = Command.ExecuteReader();
|
| | | command.CommandText = sqlStmt;
|
| | | reader = command.ExecuteReader();
|
| | | if (reader.Read())
|
| | | {
|
| | | if ( reader["PRIORITY"].ToString().Length != 0 )
|
| | | Priority = Convert.ToInt32(reader["PRIORITY"].ToString());
|
| | | priority = Convert.ToInt32(reader["PRIORITY"].ToString());
|
| | | }
|
| | | reader.Close();
|
| | |
|
| | | /* 如果沒找到,找前一RANK的最大的Priority */
|
| | | if (Priority == 0 && Rank > 0)
|
| | | if (priority == 0 && rank > 0)
|
| | | {
|
| | | SqlStmt = "SELECT MAX(PRIORITY) as PRIORITY FROM EOS.RESCUE_ORDER WHERE RANK = "
|
| | | + "(SELECT MAX(RANK) FROM EOS.RESCUE_ORDER WHERE RANK < " + Rank + " AND DSUFID = "
|
| | | + m_Record.getLocateEquipment().getDSUFID() + ")";
|
| | | sqlStmt = "SELECT MAX(PRIORITY) as PRIORITY FROM EOS.RESCUE_ORDER WHERE RANK = "
|
| | | + "(SELECT MAX(RANK) FROM EOS.RESCUE_ORDER WHERE RANK < " + rank + " AND DSUFID = "
|
| | | + mRecord.LocateEquipment.GetDsufid() + ")";
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | reader = Command.ExecuteReader();
|
| | | command.CommandText = sqlStmt;
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | if ( reader["PRIORITY"].ToString().Length != 0 )
|
| | | Priority = Convert.ToInt32(reader["PRIORITY"].ToString());
|
| | | priority = Convert.ToInt32(reader["PRIORITY"].ToString());
|
| | | }
|
| | | reader.Close();
|
| | | }
|
| | |
|
| | | /* 如果還是沒找到,就設Priority = 0 (只有當新增案件的Rank為最小時或第一筆案件才可能發生) */
|
| | | if (Priority == 0)
|
| | | if (priority == 0)
|
| | | { // 若不寫清楚會看不懂
|
| | | Priority = 0;
|
| | | priority = 0;
|
| | |
|
| | | /* 將搶修順序號碼大於等於找出來號碼的都加1 */
|
| | | }
|
| | | SqlStmt = "UPDATE EOS.RESCUE_ORDER SET PRIORITY = PRIORITY + 1 WHERE PRIORITY > " + Priority + " AND DSUFID = "
|
| | | + m_Record.getLocateEquipment().getDSUFID();
|
| | | sqlStmt = "UPDATE EOS.RESCUE_ORDER SET PRIORITY = PRIORITY + 1 WHERE PRIORITY > " + priority + " AND DSUFID = "
|
| | | + mRecord.LocateEquipment.GetDsufid();
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.RESCUE_ORDER舊的搶修號碼.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法更新EOS.RESCUE_ORDER舊的搶修號碼.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | /* 將本身資料存入資料庫內 */
|
| | | SqlStmt = "INSERT INTO EOS.RESCUE_ORDER (CASEID,RANK,PRIORITY,DSUFID) VALUES (" + m_Record.getCaseID() + "," + Rank + ","
|
| | | + (Priority + 1) + "," + m_Record.getLocateEquipment().getDSUFID() + ")";
|
| | | sqlStmt = "INSERT INTO EOS.RESCUE_ORDER (CASEID,RANK,PRIORITY,DSUFID) VALUES (" + mRecord.CaseId+ "," + rank + ","
|
| | | + (priority + 1) + "," + mRecord.LocateEquipment.GetDsufid() + ")";
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法新增EOS.RESCUE_ORDER的資料");
|
| | | Command.Dispose();
|
| | | _pLog.Error("無法新增EOS.RESCUE_ORDER的資料");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("Problems occue during updating eos.rescue_order: " + e.Message);
|
| | | _pLog.Error("Problems occue during updating eos.rescue_order: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if ( Command != null)
|
| | | Command.Dispose();
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | // 當原先同一用戶在事故受理後又報案,不過從一般案件轉為交辦案件所需作的轉換工作
|
| | | private bool DeleteOldCase(CCS.Object.EventRecord m_Record)
|
| | | private bool DeleteOldCase(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt;
|
| | | int CaseID = 0; // 原先的事故號碼
|
| | | int CaseType = CCS.LocalVariable.ChildCase; // 原先的種類
|
| | | int Count = 0; // 原先的來電次數
|
| | | int CaseStatus = 0; // 原先的案件狀態
|
| | | OracleCommand Command = null;
|
| | | string sqlStmt;
|
| | | int caseId = 0; // 原先的事故號碼
|
| | | int caseType = GlobalVariable.ChildCase; // 原先的種類
|
| | | int count = 0; // 原先的來電次數
|
| | | int caseStatus = 0; // 原先的案件狀態
|
| | | OracleCommand command = null;
|
| | |
|
| | | SqlStmt = "SELECT R.CASEID as CASEID,E.CASETYPE as CASETYPE,E.CASESTATUS as CASESTATUS,E.COUNT as COUNT FROM "
|
| | | + "EOS.EVENTRECORD R,EOS.EVENTS E WHERE R.CASEID = E.CASEID AND R.CUSTOMERMETER = '" + m_Record.getMeter() + "' AND R.CASEID <> "
|
| | | + m_Record.getCaseID() + " AND E.CASESTATUS <= " + CCS.LocalVariable.WaitForSponsor;
|
| | | sqlStmt = "SELECT R.CASEID as CASEID,E.CASETYPE as CASETYPE,E.CASESTATUS as CASESTATUS,E.COUNT as COUNT FROM "
|
| | | + "EOS.EVENTRECORD R,EOS.EVENTS E WHERE R.CASEID = E.CASEID AND R.CUSTOMERMETER = '" + mRecord.Meter+ "' AND R.CASEID <> "
|
| | | + mRecord.CaseId+ " AND E.CASESTATUS <= " + CCSCaseState.WaitForSponsor;
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | CaseID = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | CaseType = Convert.ToInt32(reader["CASETYPE"].ToString());
|
| | | CaseStatus = Convert.ToInt32(reader["CASESTATUS"].ToString());
|
| | | Count = Convert.ToInt32(reader["COUNT"].ToString());
|
| | | caseId = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | caseType = Convert.ToInt32(reader["CASETYPE"].ToString());
|
| | | caseStatus = Convert.ToInt32(reader["CASESTATUS"].ToString());
|
| | | count = Convert.ToInt32(reader["COUNT"].ToString());
|
| | | reader.Close();
|
| | | }
|
| | | else
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | _PLog.Error("無法找到原先舊的案件.");
|
| | | command.Dispose();
|
| | | _pLog.Error("無法找到原先舊的案件.");
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "DELETE EOS.EVENTS WHERE CASEID = " + CaseID;
|
| | | sqlStmt = "DELETE EOS.EVENTS WHERE CASEID = " + caseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("刪除原先舊的案件的EOS.EVENTS發生錯誤.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTS發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "DELETE EOS.EVENTRECORD WHERE CASEID = " + CaseID;
|
| | | sqlStmt = "DELETE EOS.EVENTRECORD WHERE CASEID = " + caseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("刪除原先舊的案件的EOS.EVENTRECORD發生錯誤.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTRECORD發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "DELETE EOS.EVENTRECORD_EX WHERE CASEID = " + CaseID;
|
| | | sqlStmt = "DELETE EOS.EVENTRECORD_EX WHERE CASEID = " + caseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("刪除原先舊的案件的EOS.EVENTRECORD_EX發生錯誤.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTRECORD_EX發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "DELETE EOS.TMPAFFECTCUSTMS WHERE CASEID = " + CaseID;
|
| | | sqlStmt = "DELETE EOS.TMPAFFECTCUSTMS WHERE CASEID = " + caseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("刪除原先舊的案件的EOS.TMPAFFECTCUSTMS發生錯誤.");
|
| | | Command.Dispose();
|
| | | _pLog.Error("刪除原先舊的案件的EOS.TMPAFFECTCUSTMS發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (m_Record.getParentID() == CaseID)
|
| | | if (mRecord.ParentId== caseId)
|
| | | { // 原本舊案件為母案件
|
| | | SqlStmt = "SELECT COUNT(*) as COUNT FROM EOS.MERGECASE WHERE PARENTID = " + m_Record.getCaseID();
|
| | | sqlStmt = "SELECT COUNT(*) as COUNT FROM EOS.MERGECASE WHERE PARENTID = " + mRecord.CaseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | reader = Command.ExecuteReader();
|
| | | command.CommandText = sqlStmt;
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | switch (Convert.ToInt32(reader["COUNT"].ToString()))
|
| | | {
|
| | | case 0:
|
| | | _PLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | _pLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | case 1: // 子案件為之前受理的同一事故案件
|
| | | SqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + CCS.LocalVariable.OriginalCase + ",COUNT = " + (Count + 1)
|
| | | + ",MERGECASECOUNT = 0 WHERE CASEID = " + m_Record.getCaseID();
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | case 1: // 子案件為之前受理的同一事故案件
|
| | | sqlStmt = "UPDATE EOS.EVENTS SET CASETYPE = " + GlobalVariable.OriginalCase + ",COUNT = " + (count + 1)
|
| | | + ",MERGECASECOUNT = 0 WHERE CASEID = " + mRecord.CaseId;
|
| | |
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("無法更新原先子案件(要提升為母案件)的資料.");
|
| | | _pLog.Error("無法更新原先子案件(要提升為母案件)的資料.");
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "DELETE EOS.TMPAFFECTCUSTMS WHERE CUSTOMERMETER <> '" + m_Record.getMeter() + "' AND CASEID = "
|
| | | + m_Record.getCaseID();
|
| | | sqlStmt = "DELETE EOS.TMPAFFECTCUSTMS WHERE CUSTOMERMETER <> '" + mRecord.Meter+ "' AND CASEID = "
|
| | | + mRecord.CaseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法刪除原先子案件(要提升為母案件)EOS.TMPAFFECTYCUSTMS的資料.");
|
| | | _pLog.Error("無法刪除原先子案件(要提升為母案件)EOS.TMPAFFECTYCUSTMS的資料.");
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | default:
|
| | | SqlStmt = "UPDATE EOS.EVENTS SET MERGECASECOUNT = MERGECASECOUNT - 1,COUNT = " + (Count + 1) + " WHERE CASEID = "
|
| | | + m_Record.getCaseID();
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() < 0)
|
| | | default:
|
| | | sqlStmt = "UPDATE EOS.EVENTS SET MERGECASECOUNT = MERGECASECOUNT - 1,COUNT = " + (count + 1) + " WHERE CASEID = "
|
| | | + mRecord.CaseId;
|
| | |
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _PLog.Error("無法更新EOS.EVENTS的資料.");
|
| | | _pLog.Error("無法更新EOS.EVENTS的資料.");
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | | break;
|
| | |
| | | else
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | _PLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | command.Dispose();
|
| | | _pLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | SqlStmt = "DELETE EOS.MERGECASE WHERE CASEID = " + CaseID;
|
| | | sqlStmt = "DELETE EOS.MERGECASE WHERE CASEID = " + caseId;
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("刪除EOS.MERGECASE發生錯誤");
|
| | | Command.Dispose();
|
| | | _pLog.Error("刪除EOS.MERGECASE發生錯誤");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (Command != null)
|
| | | Command.Dispose();
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool InsertIntoSri(CCS.Object.EventRecord m_Record)
|
| | | private bool InsertIntoSri(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt;
|
| | | int Count = 0;
|
| | | OracleCommand Command = null;
|
| | | string sqlStmt;
|
| | | int count = 0;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | SqlStmt = "SELECT COUNT(*) as COUNT FROM OCSDB.SRI WHERE SCENENAME = '" + m_Record.getAcceptNum() + "'";
|
| | | sqlStmt = "SELECT COUNT(*) as COUNT FROM OCSDB.SRI WHERE SCENENAME = '" + mRecord.AcceptNum+ "'";
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | Count = Convert.ToInt32(reader["COUNT"].ToString());
|
| | | count = Convert.ToInt32(reader["COUNT"].ToString());
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("Problems occur when checking SCENE Data: " + e.Message);
|
| | | _pLog.Error("Problems occur when checking SCENE Data: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return false;
|
| | | }
|
| | |
| | | reader.Close();
|
| | | }
|
| | |
|
| | | if (Count > 0)
|
| | | if (count > 0)
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return true;
|
| | | }
|
| | |
|
| | | SqlStmt = "INSERT INTO OCSDB.SRI VALUES('" + m_Record.getAcceptNum() + "',2,-1)";
|
| | | sqlStmt = "INSERT INTO OCSDB.SRI VALUES('" + mRecord.AcceptNum+ "',2,-1)";
|
| | |
|
| | | try
|
| | | {
|
| | | Command.CommandText = SqlStmt;
|
| | | command.CommandText = sqlStmt;
|
| | |
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | return false;
|
| | | }
|
| | | catch (Exception e)
|
| | |
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool SaveCustomerTel(CCS.Object.EventRecord m_Record)
|
| | | private bool SaveCustomerTel(Object.EventRecord mRecord)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | // 無電號資料
|
| | | /*
|
| | | * if (m_Record.getisReCall() == CCS.LocalVariable.NotReCall) { return true; }
|
| | | * if (m_Record.getisReCall() == CCS.GlobalVariable.NotReCall) { return true; }
|
| | | */
|
| | |
|
| | | // 沒有回覆電話可供回存
|
| | | if (m_Record.getTel() == null || m_Record.getTel().Trim().Length == 0 )
|
| | | if (mRecord.Tel== null || mRecord.Tel.Trim().Length == 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | // 電話資料過長
|
| | | if (m_Record.getTel().Trim().Length > 24)
|
| | | if (mRecord.Tel.Trim().Length > 24)
|
| | | {
|
| | | _PLog.Warn("電話過長號碼,無法回存資料庫.");
|
| | | _pLog.Warn("電話過長號碼,無法回存資料庫.");
|
| | | return true;
|
| | | }
|
| | |
|
| | | SqlStmt = "UPDATE BASEDB.METER SET TELE_NUMB = '" + m_Record.getTel().Trim() + "' WHERE METR_NUMB = '" + m_Record.getMeter() + "'";
|
| | | sqlStmt = "UPDATE BASEDB.METER SET TELE_NUMB = '" + mRecord.Tel.Trim() + "' WHERE METR_NUMB = '" + mRecord.Meter+ "'";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Transaction);
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | _PLog.Warn("無法將用戶電話回存回資料庫.");
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | _pLog.Warn("無法將用戶電話回存回資料庫.");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | | using System.Runtime.CompilerServices;
|
| | | using System.Data.OracleClient;
|
| | | using System.Runtime.CompilerServices;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class InitialEventData
|
| | | {
|
| | | private String m_AcceptNum = "";
|
| | | private int m_CaseID = 0;
|
| | | private int m_Year = 0;
|
| | | private bool m_ChangeYear = false;
|
| | | private string m_NowYear = string.Empty;
|
| | | private String m_AcceptTime = "";
|
| | | private RecordLog _PLog;
|
| | | private OracleConnection _ConnectionTPC;
|
| | | 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, RecordLog log)
|
| | | {
|
| | | _ConnectionTPC = _Conn;
|
| | | _PLog = _Log;
|
| | | _connectionTpc = conn;
|
| | | _pLog = log;
|
| | |
|
| | | String SqlStmt = "SELECT ACCEPTNUM,CASEID,YEAR,TO_CHAR(SYSDATE,'YYYY/MM/DD') as ACCEPTTIME FROM EOS.EVENTNUM";
|
| | | string 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();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | m_AcceptNum = reader["ACCEPTNUM"].ToString();
|
| | | m_CaseID = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | m_Year = Convert.ToInt32(reader["YEAR"].ToString());
|
| | | m_AcceptTime = reader["ACCEPTTIME"].ToString();
|
| | | _mAcceptNum = reader["ACCEPTNUM"].ToString();
|
| | | _mCaseId = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | _mYear = Convert.ToInt32(reader["YEAR"].ToString());
|
| | | _mAcceptTime = reader["ACCEPTTIME"].ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | _PLog.Error("起始號碼資料遺失!");
|
| | | _pLog.Error("起始號碼資料遺失!");
|
| | | return;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("Problems occur when Initializing EventData: " + e.Message);
|
| | | _pLog.Error("Problems occur when Initializing EventData: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | CheckAcceptNum();
|
| | |
|
| | | while (!UpdateDataBase(m_ChangeYear)) {
|
| | | this.RegetNumber();
|
| | | while (!UpdateDataBase(_mChangeYear))
|
| | | {
|
| | | RegetNumber();
|
| | | CheckAcceptNum();
|
| | | }
|
| | | }
|
| | |
|
| | | public int getNewCaseID() {
|
| | | return this.m_CaseID;
|
| | | public int GetNewCaseId()
|
| | | {
|
| | | return _mCaseId;
|
| | | }
|
| | |
|
| | | public String getNewAcceptNum() {
|
| | | return this.m_AcceptNum;
|
| | | public string GetNewAcceptNum()
|
| | | {
|
| | | return _mAcceptNum;
|
| | | }
|
| | |
|
| | | private bool UpdateDataBase(bool m_ChangeYear) {
|
| | | String SqlStmt;
|
| | | bool m_Result = false;
|
| | | private bool UpdateDataBase(bool mChangeYear)
|
| | | {
|
| | | string sqlStmt;
|
| | | bool mResult = false;
|
| | |
|
| | | if (m_ChangeYear)
|
| | | SqlStmt = "UPDATE EOS.EVENTNUM SET ACCEPTNUM = '" + (Convert.ToInt32(m_AcceptNum) + 1).ToString() + "',CASEID = "
|
| | | + (m_CaseID + 1) + ",YEAR = " + m_NowYear + " WHERE CASEID = " + this.m_CaseID;
|
| | | if (mChangeYear)
|
| | | sqlStmt = "UPDATE EOS.EVENTNUM SET ACCEPTNUM = '" + (Convert.ToInt32(_mAcceptNum) + 1).ToString() + "',CASEID = "
|
| | | + (_mCaseId + 1) + ",YEAR = " + _mNowYear + " WHERE CASEID = " + _mCaseId;
|
| | | else
|
| | | SqlStmt = "UPDATE EOS.EVENTNUM SET ACCEPTNUM = '" + (Convert.ToInt32(m_AcceptNum) + 1).ToString() + "',CASEID = "
|
| | | + (m_CaseID + 1) + " WHERE CASEID = " + this.m_CaseID + " AND ACCEPTNUM = '" + m_AcceptNum + "'";
|
| | | sqlStmt = "UPDATE EOS.EVENTNUM SET ACCEPTNUM = '" + (Convert.ToInt32(_mAcceptNum) + 1).ToString() + "',CASEID = "
|
| | | + (_mCaseId + 1) + " WHERE CASEID = " + _mCaseId + " AND ACCEPTNUM = '" + _mAcceptNum + "'";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC);
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() > 0)
|
| | | m_Result = true;
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | mResult = true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("Problems occur during EventNumCreating: " + e.Message);
|
| | | _pLog.Error("Problems occur during EventNumCreating: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | throw e;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | private void CheckAcceptNum() {
|
| | | int NowYear = Convert.ToInt32(m_AcceptTime.Substring(0, 4)) - 1911;
|
| | | int NowMonth = Convert.ToInt32(m_AcceptTime.Substring(5, 2));
|
| | | String Tmp = this.m_AcceptNum;
|
| | |
|
| | | if (Convert.ToInt32(Tmp.Substring(0, 3)) == NowYear)
|
| | | private void CheckAcceptNum()
|
| | | {
|
| | | if (Convert.ToInt32(Tmp.Substring(3, 2)) != NowMonth)
|
| | | int nowYear = Convert.ToInt32(_mAcceptTime.Substring(0, 4)) - 1911;
|
| | | int nowMonth = Convert.ToInt32(_mAcceptTime.Substring(5, 2));
|
| | | string tmp = _mAcceptNum;
|
| | |
|
| | | if (Convert.ToInt32(tmp.Substring(0, 3)) == nowYear)
|
| | | {
|
| | | if (Convert.ToInt32(tmp.Substring(3, 2)) != nowMonth)
|
| | | {
|
| | | // 新月份
|
| | | if (NowMonth < 10)
|
| | | m_AcceptNum = NowYear.ToString() + "0" + NowMonth.ToString() + "0001";
|
| | | if (nowMonth < 10)
|
| | | _mAcceptNum = nowYear.ToString() + "0" + nowMonth.ToString() + "0001";
|
| | | else
|
| | | m_AcceptNum = NowYear.ToString() + NowMonth.ToString() + "0001";
|
| | | _mAcceptNum = nowYear.ToString() + nowMonth.ToString() + "0001";
|
| | | }
|
| | | } else {
|
| | | m_AcceptNum = NowYear.ToString() + "010001"; // 新年度
|
| | | m_NowYear = NowYear.ToString();
|
| | | this.m_ChangeYear = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | _mAcceptNum = nowYear.ToString() + "010001"; // 新年度
|
| | | _mNowYear = nowYear.ToString();
|
| | | _mChangeYear = true;
|
| | | }
|
| | |
|
| | | if ( !m_ChangeYear)
|
| | | if (!_mChangeYear)
|
| | | {
|
| | | }
|
| | | }
|
| | |
|
| | | private void RegetNumber()
|
| | | {
|
| | | String SqlStmt = "SELECT ACCEPTNUM,CASEID,YEAR FROM EOS.EVENTNUM";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | string sqlStmt = "SELECT ACCEPTNUM,CASEID,YEAR FROM EOS.EVENTNUM";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | m_AcceptNum = reader["ACCEPTNUM"].ToString();
|
| | | m_CaseID = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | m_Year = Convert.ToInt32(reader["YEAR"].ToString());
|
| | | _mAcceptNum = reader["ACCEPTNUM"].ToString();
|
| | | _mCaseId = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | _mYear = Convert.ToInt32(reader["YEAR"].ToString());
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using CCSTrace.CCS.Domain;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class Leach
|
| | | {
|
| | | private CCS.Function.MergeCase MergeCase = new CCS.Function.MergeCase();
|
| | | private RecordLog _PLog;
|
| | | private OracleConnection _ConnectionTPC;
|
| | | private OracleTransaction _Transaction;
|
| | | private String _traceConnectionString = String.Empty;
|
| | | 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, RecordLog log)
|
| | | {
|
| | | _ConnectionTPC = _Conn;
|
| | | _Transaction = _Trx;
|
| | | _traceConnectionString = _traceConnection;
|
| | | _PLog = _Log;
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | | _traceConnectionString = traceConnection;
|
| | | _pLog = log;
|
| | | }
|
| | |
|
| | | public int LeachCase(CCS.Object.EventRecord m_NewRec)
|
| | | public int LeachCase(Object.EventRecord mNewRec)
|
| | | {
|
| | | switch (SameCase(mNewRec))
|
| | | {
|
| | | case GlobalVariable.Success:
|
| | | return Judge(mNewRec, false);
|
| | |
|
| | | switch (SameCase(m_NewRec))
|
| | | {
|
| | | case CCS.LocalVariable.Success:
|
| | | return this.Judge(m_NewRec, false);
|
| | | case CCS.LocalVariable.CaseTypeChanged:
|
| | | return this.Judge(m_NewRec, true);
|
| | | case CCS.LocalVariable.SameCustomer:
|
| | | return CCS.LocalVariable.SameCustomer;
|
| | | case CCS.LocalVariable.Failure_By_DB:
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | case CCS.LocalVariable.CaseTransfer:
|
| | | return CCS.LocalVariable.CaseTransfer;
|
| | | case GlobalVariable.CaseTypeChanged:
|
| | | return Judge(mNewRec, true);
|
| | |
|
| | | case GlobalVariable.SameCustomer:
|
| | | return GlobalVariable.SameCustomer;
|
| | |
|
| | | case GlobalVariable.FailureByDb:
|
| | | return GlobalVariable.FailureByDb;
|
| | |
|
| | | case GlobalVariable.CaseTransfer:
|
| | | return GlobalVariable.CaseTransfer;
|
| | |
|
| | | default:
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | }
|
| | |
|
| | | public CCS.EventAI.Equipment getOldEquipment()
|
| | | public EventAI.Equipment GetOldEquipment()
|
| | | {
|
| | | return this.MergeCase.getOldEquipment();
|
| | | return _mergeCase.GetOldEquipment();
|
| | | }
|
| | |
|
| | | private int SameCase(CCS.Object.EventRecord m_NewRec)
|
| | | private int SameCase(Object.EventRecord mNewRec)
|
| | | {
|
| | | String SqlStmt = "SELECT R.ACCEPTNUM,R.CASEID as CASEID,R.IMPORTCASE as IMPORTCASE,E.CASETYPE as CASETYPE FROM EOS.EVENTRECORD R,"
|
| | | string sqlStmt = "SELECT R.ACCEPTNUM,R.CASEID as CASEID,R.IMPORTCASE as IMPORTCASE,E.CASETYPE as CASETYPE FROM EOS.EVENTRECORD R,"
|
| | | + "EOS.EVENTS E WHERE ";
|
| | | int m_Result = -1;
|
| | | int ImportCase = -1;
|
| | | int TmpCaseID = 0;
|
| | | int CaseType = -1;
|
| | | _PLog.Info("利用電號或地址檢查是否有已成立之案件.");
|
| | | int mResult = -1;
|
| | | int importCase = -1;
|
| | | int tmpCaseId = 0;
|
| | | int caseType = -1;
|
| | | _pLog.Info("利用電號或地址檢查是否有已成立之案件.");
|
| | | // 檢查資料庫中此電號或地址是否已成立案件
|
| | |
|
| | | if (m_NewRec.getMeter().Trim().Length != 0)
|
| | | if (mNewRec.Meter.Trim().Length != 0)
|
| | | {
|
| | | SqlStmt = SqlStmt + "R.CUSTOMERMETER = '" + m_NewRec.getMeter() + "' AND E.CASEID = R.CASEID AND E.CASESTATUS <= "
|
| | | + CCS.LocalVariable.WaitForSponsor;
|
| | | sqlStmt = sqlStmt + "R.CUSTOMERMETER = '" + mNewRec.Meter+ "' AND E.CASEID = R.CASEID AND E.CASESTATUS <= "
|
| | | + CCSCaseState.WaitForSponsor;
|
| | | }
|
| | | else if (m_NewRec.getAddr().Trim().Length != 0)
|
| | | else if (mNewRec.Addr.Trim().Length != 0)
|
| | | {
|
| | | SqlStmt = SqlStmt + "R.CUSTOMERADDR = '" + m_NewRec.getAddr() + "' AND E.CASEID = R.CASEID AND E.CASESTATUS <= "
|
| | | + CCS.LocalVariable.WaitForSponsor;
|
| | | sqlStmt = sqlStmt + "R.CUSTOMERADDR = '" + mNewRec.Addr+ "' AND E.CASEID = R.CASEID AND E.CASESTATUS <= "
|
| | | + CCSCaseState.WaitForSponsor;
|
| | | }
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | ImportCase = Convert.ToInt32(reader["IMPORTCASE"].ToString());
|
| | | TmpCaseID = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | CaseType = Convert.ToInt32(reader["CASETYPE"].ToString());
|
| | | m_NewRec.setTmpCaseID(TmpCaseID);
|
| | | _PLog.Info("案件已成立:" + reader["ACCEPTNUM"].ToString() + " " + TmpCaseID + " " + CaseType);
|
| | | importCase = Convert.ToInt32(reader["IMPORTCASE"].ToString());
|
| | | tmpCaseId = Convert.ToInt32(reader["CASEID"].ToString());
|
| | | caseType = Convert.ToInt32(reader["CASETYPE"].ToString());
|
| | | mNewRec.TmpCaseId = tmpCaseId;
|
| | | _pLog.Info("案件已成立:" + reader["ACCEPTNUM"].ToString() + " " + tmpCaseId + " " + caseType);
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | // 非同一用戶重複來電
|
| | | if (TmpCaseID == 0)
|
| | | if (tmpCaseId == 0)
|
| | | {
|
| | | return CCS.LocalVariable.Success;
|
| | | return GlobalVariable.Success;
|
| | | }
|
| | | switch (CaseType)
|
| | | switch (caseType)
|
| | | {
|
| | | case CCS.LocalVariable.OriginalCase:
|
| | | case CCS.LocalVariable.ParentCase:
|
| | | SqlStmt = "SELECT TO_CHAR(CLOSETIME,'YYYY/MM/DD HH24:MI:SS') as CLOSETIME,COUNT(*) as COUNT FROM EOS.EVENTFACILITY " + "WHERE CASEID = "
|
| | | + TmpCaseID + " GROUP BY CLOSETIME ORDER BY CLOSETIME DESC";
|
| | | case GlobalVariable.OriginalCase:
|
| | | case GlobalVariable.ParentCase:
|
| | | sqlStmt = "SELECT TO_CHAR(CLOSETIME,'YYYY/MM/DD HH24:MI:SS') as CLOSETIME,COUNT(*) as COUNT FROM EOS.EVENTFACILITY " + "WHERE CASEID = "
|
| | | + tmpCaseId + " GROUP BY CLOSETIME ORDER BY CLOSETIME DESC";
|
| | | break;
|
| | | case CCS.LocalVariable.ChildCase:
|
| | | SqlStmt = "SELECT TO_CHAR(CLOSETIME,'YYYY/MM/DD HH24:MI:SS') as CLOSETIME,COUNT(*) as COUNT FROM EOS.EVENTFACILITY "
|
| | | + "WHERE CASEID = (SELECT PARENTID FROM EOS.MERGECASE WHERE CASEID = " + TmpCaseID + ") GROUP BY CLOSETIME "
|
| | |
|
| | | case GlobalVariable.ChildCase:
|
| | | sqlStmt = "SELECT TO_CHAR(CLOSETIME,'YYYY/MM/DD HH24:MI:SS') as CLOSETIME,COUNT(*) as COUNT FROM EOS.EVENTFACILITY "
|
| | | + "WHERE CASEID = (SELECT PARENTID FROM EOS.MERGECASE WHERE CASEID = " + tmpCaseId + ") GROUP BY CLOSETIME "
|
| | | + "ORDER BY CLOSETIME DESC";
|
| | | break;
|
| | |
|
| | | default:
|
| | | _PLog.Error("無法辨別案件種類.");
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | _pLog.Error("無法辨別案件種類.");
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | _PLog.Info("檢查該案件有無切開關紀錄.");
|
| | | _pLog.Info("檢查該案件有無切開關紀錄.");
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | // 有開關尚未恢復
|
| | | if (reader["CLOSETIME"] == null)
|
| | | {
|
| | | _PLog.Info("有切開關且尚未恢復.");
|
| | | if ((m_NewRec.getImportCase() == ImportCase) || (ImportCase == CCS.LocalVariable.isImportCase))
|
| | | _pLog.Info("有切開關且尚未恢復.");
|
| | | if ((mNewRec.ImportCase== importCase) || (importCase == GlobalVariable.IsImportCase))
|
| | | {
|
| | | m_Result = this.AddCount(TmpCaseID);
|
| | | mResult = AddCount(tmpCaseId);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Result = CCS.LocalVariable.CaseTypeChanged;
|
| | | mResult = GlobalVariable.CaseTypeChanged;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | // 開關都已恢復(同用戶須重新受理)
|
| | | _PLog.Info("有切開關且已經恢復.");
|
| | | int CaseID;
|
| | | _pLog.Info("有切開關且已經恢復.");
|
| | | int caseId;
|
| | |
|
| | | // 找出案件編號需以母案件編號或該案件編號去找casestatus
|
| | | if (TmpCaseID == 0)
|
| | | if (tmpCaseId == 0)
|
| | | {
|
| | | CaseID = m_NewRec.getCaseID();
|
| | | caseId = mNewRec.CaseId;
|
| | | }
|
| | | else
|
| | | {
|
| | | CaseID = TmpCaseID;
|
| | | caseId = tmpCaseId;
|
| | | }
|
| | | // 判斷該案件或母案件是否移轉作後續處理
|
| | | if (this.getCastStatus(CaseID) == CCS.LocalVariable.EventTrasnfer)
|
| | | if (GetCastStatus(caseId) == (int) CCSCaseState.EventTrasnfer)
|
| | | {
|
| | | return CCS.LocalVariable.CaseTransfer;
|
| | | return GlobalVariable.CaseTransfer;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Result = CCS.LocalVariable.Success;
|
| | | mResult = GlobalVariable.Success;
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | // 未切過開關
|
| | | _PLog.Info("無切開關紀錄.");
|
| | | if ((m_NewRec.getImportCase() == ImportCase) || (ImportCase == CCS.LocalVariable.isImportCase))
|
| | | _pLog.Info("無切開關紀錄.");
|
| | | if ((mNewRec.ImportCase== importCase) || (importCase == GlobalVariable.IsImportCase))
|
| | | {
|
| | | m_Result = this.AddCount(TmpCaseID);
|
| | | mResult = AddCount(tmpCaseId);
|
| | | }
|
| | | else
|
| | | {
|
| | | int CaseID;
|
| | | int caseId;
|
| | | // 找出案件編號需以母案件編號或該案件編號去找casestatus
|
| | | if (TmpCaseID == 0)
|
| | | if (tmpCaseId == 0)
|
| | | {
|
| | | CaseID = m_NewRec.getCaseID();
|
| | | caseId = mNewRec.CaseId;
|
| | | }
|
| | | else
|
| | | {
|
| | | CaseID = TmpCaseID;
|
| | | caseId = tmpCaseId;
|
| | |
|
| | | // 判斷該案件或母案件是否移轉作後續處理
|
| | | }
|
| | | if (this.getCastStatus(CaseID) == CCS.LocalVariable.EventTrasnfer)
|
| | | if (GetCastStatus(caseId) == (int) CCSCaseState.EventTrasnfer)
|
| | | {
|
| | | return CCS.LocalVariable.CaseTransfer;
|
| | | return GlobalVariable.CaseTransfer;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Result = CCS.LocalVariable.CaseTypeChanged;
|
| | | mResult = GlobalVariable.CaseTypeChanged;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | private int AddCount(int m_CaseID)
|
| | | private int AddCount(int mCaseId)
|
| | | {
|
| | | String sqlStmt = "UPDATE EOS.EVENTS SET COUNT = COUNT + 1 WHERE CASEID = " + m_CaseID;
|
| | | OracleCommand Command = new OracleCommand(sqlStmt, _ConnectionTPC, _Transaction);
|
| | | string sqlStmt = "UPDATE EOS.EVENTS SET COUNT = COUNT + 1 WHERE CASEID = " + mCaseId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() > 0)
|
| | | return CCS.LocalVariable.SameCustomer;
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | return GlobalVariable.SameCustomer;
|
| | | else
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | private int getCastStatus(int CaseID)
|
| | | private int GetCastStatus(int caseId)
|
| | | {
|
| | | String SqlStmt;
|
| | | int Status = 0;
|
| | | string sqlStmt;
|
| | | int status = 0;
|
| | |
|
| | | 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);
|
| | | 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;
|
| | |
|
| | |
|
| | | try
|
| | | {
|
| | | reader = Command.ExecuteReader();
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | Status = Convert.ToInt32(reader["CASESTATUS"].ToString());
|
| | | status = Convert.ToInt32(reader["CASESTATUS"].ToString());
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | if ( reader != null )
|
| | | reader.Close();
|
| | |
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | return Status;
|
| | | return status;
|
| | | }
|
| | |
|
| | | private int Judge(CCS.Object.EventRecord m_NewRec, bool ChangeCaseType)
|
| | | private int Judge(Object.EventRecord mNewRec, bool changeCaseType)
|
| | | {
|
| | | int m_Result = CCS.LocalVariable.Failure_By_DB;
|
| | | int mResult = GlobalVariable.FailureByDb;
|
| | |
|
| | | if ((m_NewRec.getMeter().Trim().Length == 0))
|
| | | if ((mNewRec.Meter.Trim().Length == 0))
|
| | | {
|
| | | return CCS.LocalVariable.NoMeter;
|
| | | return GlobalVariable.NoMeter;
|
| | | }
|
| | |
|
| | | /* 已知損壞設備(ONLY FOR 饋線全停才知道損壞設備的FSC) */
|
| | | try
|
| | | {
|
| | | if (m_NewRec.getFsc() != 0)
|
| | | if (mNewRec.Fsc!= 0)
|
| | | {
|
| | | m_NewRec.getLocateEquipment().setFSC(CCS.LocalVariable.Breaker);
|
| | | m_NewRec.getLocateEquipment().setUFID(m_NewRec.getUfid());
|
| | | _PLog.Info("饋線全停:" + m_NewRec.getFsc() + ", " + m_NewRec.getUfid());
|
| | | MergeCase.Merge(m_NewRec, _ConnectionTPC, _Transaction, _traceConnectionString, _PLog);
|
| | | return CCS.LocalVariable.Success;
|
| | | mNewRec.LocateEquipment.SetFsc(GlobalVariable.Breaker);
|
| | | mNewRec.LocateEquipment.SetUfid(mNewRec.Ufid);
|
| | | _pLog.Info("饋線全停:" + mNewRec.Fsc+ ", " + mNewRec.Ufid);
|
| | | _mergeCase.Merge(mNewRec, _connectionTpc, _transaction, _traceConnectionString, _pLog);
|
| | | return GlobalVariable.Success;
|
| | | }
|
| | | }
|
| | | catch (CCS.EventAI.TraceLoopException)
|
| | | catch (EventAI.TraceLoopException)
|
| | | {
|
| | | return CCS.LocalVariable.Trace_Counts_3;
|
| | | return GlobalVariable.TraceCounts3;
|
| | | }
|
| | | catch (TraceException)
|
| | | {
|
| | | return CCS.LocalVariable.Trace_Failure;
|
| | | return GlobalVariable.TraceFailure;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _PLog.Error(ex.Message);
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | _pLog.Error(ex.Message);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | |
|
| | | try
|
| | | {
|
| | | _PLog.Info("定位損壞設備!");
|
| | | int result = getEquipment(m_NewRec);
|
| | | _PLog.Info("FSC:" + m_NewRec.getFsc() + ", Ufid:" + m_NewRec.getUfid() + ", Tpclid:" + m_NewRec.getTpclid() + ", FeederID:" + m_NewRec.getFdrID());
|
| | | _pLog.Info("定位損壞設備!");
|
| | | int result = GetEquipment(mNewRec);
|
| | | _pLog.Info("FSC:" + mNewRec.Fsc+ ", Ufid:" + mNewRec.Ufid+ ", Tpclid:" + mNewRec.Tpclid+ ", FeederID:" + mNewRec.FdrId);
|
| | |
|
| | | switch (result)
|
| | | { // get fsc,ufid,fdrid of sxfmr by meter
|
| | | case CCS.LocalVariable.Success:
|
| | | if (m_NewRec.getFdrID() == 0)
|
| | | case GlobalVariable.Success:
|
| | | if (mNewRec.FdrId== 0)
|
| | | {
|
| | | m_Result = CCS.LocalVariable.NoSupplyElc;
|
| | | mResult = GlobalVariable.NoSupplyElc;
|
| | | }
|
| | | else
|
| | | {
|
| | | // 需在未併案前作土木設備設定
|
| | | this.getLocateEquipment(m_NewRec);
|
| | | GetLocateEquipment(mNewRec);
|
| | |
|
| | | if (m_NewRec.getBrief().Length !=0 && m_NewRec.getBrief().Substring(0,1).Equals("A"))
|
| | | if (mNewRec.Brief.Length != 0 && mNewRec.Brief.Substring(0, 1).Equals("A"))
|
| | | { // A類事故原因,做追蹤合併
|
| | | _PLog.Info("<A類案件>");
|
| | | MergeCase.Merge(m_NewRec, _ConnectionTPC, _Transaction, _traceConnectionString, _PLog);
|
| | | _pLog.Info("<A類案件>");
|
| | | _mergeCase.Merge(mNewRec, _connectionTpc, _transaction, _traceConnectionString, _pLog);
|
| | | }
|
| | | else
|
| | | {
|
| | | _PLog.Info("<非A類案件>");
|
| | | _pLog.Info("<非A類案件>");
|
| | | }
|
| | |
|
| | | if (ChangeCaseType)
|
| | | if (changeCaseType)
|
| | | {
|
| | | m_Result = CCS.LocalVariable.CaseTypeChanged;
|
| | | mResult = GlobalVariable.CaseTypeChanged;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Result = CCS.LocalVariable.Success;
|
| | | mResult = GlobalVariable.Success;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case CCS.LocalVariable.No_Sxfmr:
|
| | | m_Result = CCS.LocalVariable.No_Sxfmr;
|
| | |
|
| | | case GlobalVariable.NoSxfmr:
|
| | | mResult = GlobalVariable.NoSxfmr;
|
| | | break;
|
| | | case CCS.LocalVariable.Failure_By_DB:
|
| | | m_Result = CCS.LocalVariable.Failure_By_DB;
|
| | |
|
| | | case GlobalVariable.FailureByDb:
|
| | | mResult = GlobalVariable.FailureByDb;
|
| | | break;
|
| | | }
|
| | | }
|
| | | catch (CCS.EventAI.TraceLoopException)
|
| | | catch (EventAI.TraceLoopException)
|
| | | {
|
| | | return CCS.LocalVariable.Trace_Counts_3;
|
| | | return GlobalVariable.TraceCounts3;
|
| | | }
|
| | | catch (TraceException)
|
| | | {
|
| | | m_Result = CCS.LocalVariable.Trace_Failure;
|
| | | mResult = GlobalVariable.TraceFailure;
|
| | | }
|
| | | catch (Exception ex1)
|
| | | {
|
| | | _PLog.Error(ex1.Message);
|
| | | m_Result = CCS.LocalVariable.Failure_By_DB;
|
| | | _pLog.Error(ex1.Message);
|
| | | mResult = GlobalVariable.FailureByDb;
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | private int getEquipment(CCS.Object.EventRecord m_NewRec)
|
| | | private int GetEquipment(Object.EventRecord mNewRec)
|
| | | {
|
| | | String Temp;
|
| | | String m_OwnerTpclid;
|
| | | String m_Group;
|
| | | String SqlStmt = "select tran_cord from basedb.meter where metr_numb = '" + m_NewRec.getMeter() + "'";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | string temp;
|
| | | string mOwnerTpclid;
|
| | | string mGroup;
|
| | | string sqlStmt = "select tran_cord from basedb.meter where metr_numb = '" + mNewRec.Meter+ "'";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | Temp = reader["tran_cord"].ToString().Trim();
|
| | | if ((Temp.Length == 9) || (Temp.Length == 11)) /* 架空變壓器 */
|
| | | temp = reader["tran_cord"].ToString().Trim();
|
| | | if ((temp.Length == 9) || (temp.Length == 11)) /* 架空變壓器 */
|
| | | {
|
| | | m_OwnerTpclid = Temp;
|
| | | mOwnerTpclid = temp;
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | m_NewRec.setTpclid(m_OwnerTpclid);
|
| | | return getSxfmr(m_OwnerTpclid, null, m_NewRec); /* Find the Sxfmr */
|
| | | command.Dispose();
|
| | | mNewRec.Tpclid = mOwnerTpclid;
|
| | | return GetSxfmr(mOwnerTpclid, null, mNewRec); /* Find the Sxfmr */
|
| | | }
|
| | | else
|
| | | {
|
| | | m_OwnerTpclid = Temp.Substring(0, 11).Trim(); /* 地下變壓器 */
|
| | | m_Group = Temp.Substring(14);
|
| | | mOwnerTpclid = temp.Substring(0, 11).Trim(); /* 地下變壓器 */
|
| | | mGroup = temp.Substring(14);
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | m_NewRec.setTpclid(m_OwnerTpclid + " " + m_Group);
|
| | | return getSxfmr(m_OwnerTpclid, m_Group, m_NewRec);
|
| | | command.Dispose();
|
| | | mNewRec.Tpclid = mOwnerTpclid + " " + mGroup;
|
| | | return GetSxfmr(mOwnerTpclid, mGroup, mNewRec);
|
| | | /* Find the Sxfmr */
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | return CCS.LocalVariable.No_Sxfmr;
|
| | | return GlobalVariable.NoSxfmr;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | private int getSxfmr(String m_Tpclid, String m_Group, CCS.Object.EventRecord m_NewRec)
|
| | | private int GetSxfmr(string mTpclid, string mGroup, Object.EventRecord mNewRec)
|
| | | {
|
| | | String SqlStmt;
|
| | | int m_Status = CCS.LocalVariable.Failure_By_DB;
|
| | | string sqlStmt;
|
| | | int mStatus = GlobalVariable.FailureByDb;
|
| | |
|
| | | if (m_Group == null)
|
| | | if (mGroup == null)
|
| | | {
|
| | | SqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + CCS.LocalVariable.Sxfmr + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" + m_Tpclid + "')";
|
| | | sqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + GlobalVariable.Sxfmr + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" + mTpclid + "')";
|
| | | }
|
| | | else
|
| | | {
|
| | | SqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + CCS.LocalVariable.Sxfmr + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" + m_Tpclid + "' AND GROUP1 = '" + m_Group + "')";
|
| | |
|
| | | sqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + GlobalVariable.Sxfmr + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" + mTpclid + "' AND GROUP1 = '" + mGroup + "')";
|
| | | }
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | m_NewRec.setFsc(CCS.LocalVariable.Sxfmr);
|
| | | m_NewRec.setUfid(Convert.ToInt32(reader["ufid"].ToString()));
|
| | | m_NewRec.setFdrID(Convert.ToInt32(reader["fdr1"].ToString()));
|
| | | m_Status = CCS.LocalVariable.Success;
|
| | | mNewRec.Fsc = GlobalVariable.Sxfmr;
|
| | | mNewRec.Ufid = Convert.ToInt32(reader["ufid"].ToString());
|
| | | mNewRec.FdrId = Convert.ToInt32(reader["fdr1"].ToString());
|
| | | mStatus = GlobalVariable.Success;
|
| | | }
|
| | | else
|
| | | m_Status = getHicustomer(m_Tpclid, m_Group, m_NewRec);
|
| | | mStatus = GetHicustomer(mTpclid, mGroup, mNewRec);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _PLog.Error(ex.Message);
|
| | | _pLog.Error(ex.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | return m_Status;
|
| | | return mStatus;
|
| | | }
|
| | |
|
| | |
|
| | | private int getHicustomer(String m_Tpclid, String m_Group, CCS.Object.EventRecord m_NewRec)
|
| | | private int GetHicustomer(string mTpclid, string mGroup, Object.EventRecord mNewRec)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | if (m_Group == null)
|
| | | if (mGroup == null)
|
| | | {
|
| | | SqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + CCS.LocalVariable.Hicustomer + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.HICUSTOMER WHERE OWNERTPCLID = '" + m_Tpclid + "')";
|
| | | sqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + GlobalVariable.Hicustomer + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.HICUSTOMER WHERE OWNERTPCLID = '" + mTpclid + "')";
|
| | | }
|
| | | else
|
| | | {
|
| | | SqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + CCS.LocalVariable.Hicustomer + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.HICUSTOMER WHERE OWNERTPCLID = '" + m_Tpclid + "' AND GROUP1 = '" + m_Group + "')";
|
| | |
|
| | | sqlStmt = "SELECT UFID,FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = " + GlobalVariable.Hicustomer + " AND UFID IN "
|
| | | + "(SELECT UFID FROM BASEDB.HICUSTOMER WHERE OWNERTPCLID = '" + mTpclid + "' AND GROUP1 = '" + mGroup + "')";
|
| | | }
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | m_NewRec.setFsc(CCS.LocalVariable.Hicustomer);
|
| | | m_NewRec.setUfid(Convert.ToInt32(reader["ufid"].ToString()));
|
| | | m_NewRec.setFdrID(Convert.ToInt32(reader["fdr1"].ToString()));
|
| | | return CCS.LocalVariable.Success;
|
| | | mNewRec.Fsc = GlobalVariable.Hicustomer;
|
| | | mNewRec.Ufid = Convert.ToInt32(reader["ufid"].ToString());
|
| | | mNewRec.FdrId = Convert.ToInt32(reader["fdr1"].ToString());
|
| | | return GlobalVariable.Success;
|
| | | }
|
| | | else
|
| | | return CCS.LocalVariable.No_Sxfmr;
|
| | | return GlobalVariable.NoSxfmr;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _PLog.Error(ex.Message);
|
| | | return CCS.LocalVariable.Failure_By_DB;
|
| | | _pLog.Error(ex.Message);
|
| | | return GlobalVariable.FailureByDb;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | private void getLocateEquipment(CCS.Object.EventRecord m_NewRec)
|
| | | private void GetLocateEquipment(Object.EventRecord mNewRec)
|
| | | {
|
| | | String SqlStmt;
|
| | |
|
| | | SqlStmt = "SELECT OWNERFSC as FSC,OWNERUFID as UFID,OWNERTPCLID as TPCLID FROM ";
|
| | | switch (m_NewRec.getFsc())
|
| | | var sqlStmt = "SELECT OWNERFSC as FSC,OWNERUFID as UFID,OWNERTPCLID as TPCLID FROM ";
|
| | | switch (mNewRec.Fsc)
|
| | | {
|
| | | case CCS.LocalVariable.Sxfmr:
|
| | | SqlStmt = SqlStmt + "BASEDB.SXFMR WHERE UFID = " + m_NewRec.getUfid();
|
| | | case GlobalVariable.Sxfmr:
|
| | | sqlStmt = sqlStmt + "BASEDB.SXFMR WHERE UFID = " + mNewRec.Ufid;
|
| | | break;
|
| | | case CCS.LocalVariable.Hicustomer:
|
| | | SqlStmt = SqlStmt + "BASEDB.HICUSTOMER WHERE UFID = " + m_NewRec.getUfid();
|
| | |
|
| | | case GlobalVariable.Hicustomer:
|
| | | sqlStmt = sqlStmt + "BASEDB.HICUSTOMER WHERE UFID = " + mNewRec.Ufid;
|
| | | break;
|
| | | }
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | m_NewRec.getLocateEquipment().setFSC(Convert.ToInt32(reader["FSC"].ToString()));
|
| | | m_NewRec.getLocateEquipment().setUFID(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | m_NewRec.getLocateEquipment().setTPCLID(reader["TPCLID"].ToString());
|
| | | mNewRec.LocateEquipment.SetFsc(Convert.ToInt32(reader["FSC"].ToString()));
|
| | | mNewRec.LocateEquipment.SetUfid(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | mNewRec.LocateEquipment.SetTpclid(reader["TPCLID"].ToString());
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data.OracleClient;
|
| | | using System.Net;
|
| | | using System.Net.Mail;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class MailService
|
| | | {
|
| | | private SmtpClient smtpClient = null;
|
| | | private string SMTP_IP;
|
| | | private int SMTP_Port;
|
| | | private string EMailAddr;
|
| | | private string EMailPass;
|
| | | private string ToEMail;
|
| | | private SmtpClient _smtpClient;
|
| | | private string _smtpIp;
|
| | | private int _smtpPort;
|
| | | private string _eMailAddr;
|
| | | private string _eMailPass;
|
| | | private string _toEMail;
|
| | |
|
| | | public MailService(OracleConnection _Conn)
|
| | | public MailService(OracleConnection conn)
|
| | | {
|
| | | InitialSmtpClient(_Conn);
|
| | | InitialSmtpClient(conn);
|
| | | }
|
| | |
|
| | | public void InitialSmtpClient(OracleConnection _Conn)
|
| | | public void InitialSmtpClient(OracleConnection conn)
|
| | | {
|
| | | getMailSetting(_Conn);
|
| | | smtpClient = new SmtpClient(SMTP_IP, SMTP_Port);
|
| | | smtpClient.Credentials = new System.Net.NetworkCredential(EMailAddr, EMailPass);
|
| | | smtpClient.EnableSsl = false;
|
| | | GetMailSetting(conn);
|
| | | _smtpClient = new SmtpClient(_smtpIp, _smtpPort)
|
| | | {
|
| | | Credentials = new NetworkCredential(_eMailAddr, _eMailPass),
|
| | | EnableSsl = false
|
| | | };
|
| | | }
|
| | |
|
| | | public bool SendMail(String CCSID)
|
| | | public bool SendMail(string ccsid)
|
| | | {
|
| | | Attachment objAttFle = new Attachment(CCS.LocalVariable.CCS_ListPath + CCSID + ".txt");
|
| | | Attachment objAttFle = new Attachment(GlobalVariable.CcsListPath + ccsid + ".txt");
|
| | | MailMessage objMail = new MailMessage();
|
| | |
|
| | | try
|
| | | {
|
| | | objMail.From = new MailAddress(EMailAddr);
|
| | | objMail.To.Add(ToEMail);
|
| | | objMail.From = new MailAddress(_eMailAddr);
|
| | | objMail.To.Add(_toEMail);
|
| | |
|
| | | objMail.BodyEncoding = System.Text.Encoding.UTF8;
|
| | | objMail.Subject = "CCS事故案件追蹤失敗";
|
| | |
| | | if ( objAttFle != null )
|
| | | objMail.Attachments.Add(objAttFle);
|
| | |
|
| | | smtpClient.Send(objMail);
|
| | | _smtpClient.Send(objMail);
|
| | | return true;
|
| | | }
|
| | | catch
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void getMailSetting(OracleConnection _Conn)
|
| | | private void GetMailSetting(OracleConnection conn)
|
| | | {
|
| | | String SqlStmt;
|
| | | var sqlStmt = "SELECT MAIL_ACCOUNT,MAIL_PASSWORD,MAIL_HOST,MAIL_PORT,WOS_MAIL FROM USRADMIN.SYS_MAIL";
|
| | |
|
| | | SqlStmt = "SELECT MAIL_ACCOUNT,MAIL_PASSWORD,MAIL_HOST,MAIL_PORT,WOS_MAIL FROM USRADMIN.SYS_MAIL";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Conn);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, conn);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | SMTP_IP = reader["MAIL_HOST"].ToString();
|
| | | SMTP_Port = Convert.ToInt32(reader["MAIL_PORT"].ToString());
|
| | | EMailAddr = reader["MAIL_ACCOUNT"].ToString();
|
| | | EMailPass = reader["MAIL_PASSWORD"].ToString();
|
| | | ToEMail = reader["CCS_MAIL"].ToString();
|
| | | _smtpIp = reader["MAIL_HOST"].ToString();
|
| | | _smtpPort = Convert.ToInt32(reader["MAIL_PORT"].ToString());
|
| | | _eMailAddr = reader["MAIL_ACCOUNT"].ToString();
|
| | | _eMailPass = reader["MAIL_PASSWORD"].ToString();
|
| | | _toEMail = reader["CCS_MAIL"].ToString();
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | | } |
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using CCSTrace.CCS.Object;
|
| | |
|
| | | namespace CCSTrace.CCS.Function
|
| | | {
|
| | | public class MergeCase
|
| | | {
|
| | | private CCS.Object.EventRecord l_Eventrecord;
|
| | | private CCS.EventAI.JudgeCase m_JudgeCase;
|
| | | private EventRecord _lEventrecord;
|
| | | private EventAI.JudgeCase _mJudgeCase;
|
| | |
|
| | | public MergeCase()
|
| | | {
|
| | | }
|
| | |
|
| | | public void Merge(CCS.Object.EventRecord m_Eventrecord, OracleConnection _Conn, OracleTransaction _Trx, String _traceConnection, RecordLog _Log) |
| | | public void Merge(EventRecord mEventrecord, OracleConnection conn, OracleTransaction trx, string traceConnection, RecordLog log)
|
| | | {
|
| | | try
|
| | | {
|
| | | m_JudgeCase = new CCS.EventAI.JudgeCase(m_Eventrecord.getFdrID(), m_Eventrecord.getFsc(), m_Eventrecord.getUfid(),
|
| | | m_Eventrecord.getCaseID(), m_Eventrecord.getAcceptDate(), _Conn, _Trx, _traceConnection, _Log);
|
| | | l_Eventrecord = m_Eventrecord;
|
| | | m_JudgeCase.AIBegin();
|
| | | l_Eventrecord.setParentID(m_JudgeCase.getParentCaseID());
|
| | | l_Eventrecord.setFsc(m_JudgeCase.getInferEquipment().getFSC());
|
| | | l_Eventrecord.setUfid(m_JudgeCase.getInferEquipment().getUFID());
|
| | | _mJudgeCase = new EventAI.JudgeCase(mEventrecord.FdrId, mEventrecord.Fsc, mEventrecord.Ufid,
|
| | | mEventrecord.CaseId, mEventrecord.AcceptDate, conn, trx, traceConnection, log);
|
| | | _lEventrecord = mEventrecord;
|
| | | _mJudgeCase.AiBegin();
|
| | | _lEventrecord.ParentId = _mJudgeCase.GetParentCaseId();
|
| | | _lEventrecord.Fsc = _mJudgeCase.GetInferEquipment().Fsc;
|
| | | _lEventrecord.Ufid = _mJudgeCase.GetInferEquipment().Ufid;
|
| | | }
|
| | | catch (CCS.EventAI.TraceLoopException tle) {
|
| | | _Log.Error(tle.Message);
|
| | | catch (EventAI.TraceLoopException tle)
|
| | | {
|
| | | log.Error(tle.Message);
|
| | | throw tle;
|
| | | }
|
| | | catch (Exception e) {
|
| | | _Log.Error(e.Message);
|
| | | catch (Exception e)
|
| | | {
|
| | | log.Error(e.Message);
|
| | | throw e;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public CCS.EventAI.Equipment getOldEquipment() {
|
| | | return m_JudgeCase.getOldrEquipment();
|
| | | public EventAI.Equipment GetOldEquipment()
|
| | | {
|
| | | return _mJudgeCase.GetOldrEquipment();
|
| | | }
|
| | | }
|
| | |
|
| | | class TraceException : Exception
|
| | | internal class TraceException : Exception
|
| | | {
|
| | | public TraceException()
|
| | | {
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class Addr_Contrast
|
| | | public class AddrContrast
|
| | | {
|
| | | public static Hashtable m_TotalData = null;
|
| | | public static String DefaultDept = "市區巡修課";
|
| | | private OracleConnection _ConnectionTPC;
|
| | | private RecordLog _PLog;
|
| | | public static Hashtable MTotalData = null;
|
| | | public static string DefaultDept = "市區巡修課";
|
| | | private OracleConnection _connectionTpc;
|
| | | private RecordLog _pLog;
|
| | |
|
| | | public Addr_Contrast(OracleConnection _Conn, OracleTransaction _Trx, RecordLog _Log)
|
| | | public AddrContrast(OracleConnection conn, OracleTransaction trx, RecordLog log)
|
| | | {
|
| | | _ConnectionTPC = _Conn;
|
| | | _PLog = _Log;
|
| | | _connectionTpc = conn;
|
| | | _pLog = log;
|
| | |
|
| | | String SqlStmt;
|
| | | String City;
|
| | | ArrayList m_Data = new ArrayList();
|
| | | String Tmp = "";
|
| | | string sqlStmt;
|
| | | string city;
|
| | | ArrayList mData = new ArrayList();
|
| | | string tmp = "";
|
| | |
|
| | | if (m_TotalData != null)
|
| | | if (MTotalData != null)
|
| | | return;
|
| | |
|
| | | m_TotalData = new Hashtable();
|
| | | SqlStmt = "SELECT DEPTID,CITY,TOWN,ROAD FROM CCS.ADDR_CONTRAST ORDER BY CITY,TOWN,ROAD";
|
| | | MTotalData = new Hashtable();
|
| | | sqlStmt = "SELECT DEPTID,CITY,TOWN,ROAD FROM CCS.ADDR_CONTRAST ORDER BY CITY,TOWN,ROAD";
|
| | |
|
| | | OracleCommand Command = null;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Trx);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, trx);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | while (reader.Read())
|
| | | {
|
| | | ArrayList m_Record = new ArrayList();
|
| | | City = reader["CITY"].ToString();
|
| | | m_Record.Add(City);
|
| | | m_Record.Add(reader["TOWN"].ToString());
|
| | | m_Record.Add(reader["ROAD"].ToString());
|
| | | m_Record.Add(Convert.ToInt32(reader["DEPTID"].ToString()));
|
| | | ArrayList mRecord = new ArrayList();
|
| | | city = reader["CITY"].ToString();
|
| | | mRecord.Add(city);
|
| | | mRecord.Add(reader["TOWN"].ToString());
|
| | | mRecord.Add(reader["ROAD"].ToString());
|
| | | mRecord.Add(Convert.ToInt32(reader["DEPTID"].ToString()));
|
| | |
|
| | | if (Tmp.Equals(City))
|
| | | m_Data.Add(m_Record);
|
| | | if (tmp.Equals(city))
|
| | | mData.Add(mRecord);
|
| | | else
|
| | | {
|
| | | m_TotalData.Add(Tmp, m_Data);
|
| | | Tmp = City;
|
| | | m_Data = new ArrayList();
|
| | | m_Data.Add(m_Record);
|
| | | MTotalData.Add(tmp, mData);
|
| | | tmp = city;
|
| | | mData = new ArrayList();
|
| | | mData.Add(mRecord);
|
| | | }
|
| | | }
|
| | | m_TotalData.Add(Tmp, m_Data);
|
| | | MTotalData.Add(tmp, mData);
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.StackTrace);
|
| | | m_TotalData = null;
|
| | | MTotalData = null;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public int findDeptID(String City, String Region, String Road)
|
| | | public int FindDeptId(string city, string region, string road)
|
| | | {
|
| | | int Dept = 0;
|
| | | ArrayList m_Data = (ArrayList)m_TotalData[City];
|
| | | int dept = 0;
|
| | | ArrayList mData = (ArrayList)MTotalData[city];
|
| | |
|
| | | try
|
| | | {
|
| | | for (int i = 0; i < m_Data.Count; i++)
|
| | | for (int i = 0; i < mData.Count; i++)
|
| | | {
|
| | | ArrayList Tmp = (ArrayList)m_Data[i];
|
| | | String m_Region = Tmp[1].ToString().Trim();
|
| | | String m_Road = Tmp[2].ToString().Trim();
|
| | | int DeptID = Convert.ToInt32(Tmp[3].ToString());
|
| | | ArrayList tmp = (ArrayList)mData[i];
|
| | | string mRegion = tmp[1].ToString().Trim();
|
| | | string mRoad = tmp[2].ToString().Trim();
|
| | | int deptId = Convert.ToInt32(tmp[3].ToString());
|
| | |
|
| | | if ((Region.Trim().Equals(m_Region)) && (Road.Trim().Equals(m_Road)))
|
| | | return DeptID;
|
| | | if ((region.Trim().Equals(mRegion)) && (road.Trim().Equals(mRoad)))
|
| | | return deptId;
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _PLog.Warn("無法取得所屬巡修部門代號,預設案件所屬巡修部門為市區巡修課!");
|
| | | _pLog.Warn("無法取得所屬巡修部門代號,預設案件所屬巡修部門為市區巡修課!");
|
| | | }
|
| | | // 當找不到部門別時,Default 設定為市巡
|
| | | Dept = CCS.CCSMain.EOSCodelist.getKeyID(CCS.LocalVariable.Dept, DefaultDept);
|
| | | return Dept;
|
| | | dept = GlobalVariable.EosCodelist.GetKeyId(GlobalVariable.Dept, DefaultDept);
|
| | | return dept;
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | | using System.Net;
|
| | | using System.Net.Sockets;
|
| | | using System.IO;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class AlarmData
|
| | | {
|
| | | private Hashtable m_TotalData = new Hashtable();
|
| | | private RecordLog _PLog;
|
| | | private OracleConnection _ConnectionTPC;
|
| | | private OracleTransaction _Transaction;
|
| | | 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, RecordLog log)
|
| | | {
|
| | | _ConnectionTPC = _Conn;
|
| | | _Transaction = _Trx;
|
| | | _PLog = _Log;
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | | _pLog = log;
|
| | |
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | SqlStmt = "SELECT DEPTID,IP1,IP2,IP_PATROL FROM CCS.ALARM_IP";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | sqlStmt = "SELECT DEPTID,IP1,IP2,IP_PATROL FROM CCS.ALARM_IP";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | while (reader.Read())
|
| | | {
|
| | | ArrayList Tmp = new ArrayList();
|
| | | Tmp.Add(Convert.ToInt32(reader["DEPTID"].ToString()));
|
| | | Tmp.Add(reader["IP1"].ToString());
|
| | | Tmp.Add(reader["IP2"].ToString());
|
| | | Tmp.Add(reader["IP_Patrol"].ToString());
|
| | | ArrayList tmp = new ArrayList();
|
| | | tmp.Add(Convert.ToInt32(reader["DEPTID"].ToString()));
|
| | | tmp.Add(reader["IP1"].ToString());
|
| | | tmp.Add(reader["IP2"].ToString());
|
| | | tmp.Add(reader["IP_Patrol"].ToString());
|
| | |
|
| | | m_TotalData.Add(Convert.ToInt32(reader["DeptID"].ToString()), Tmp);
|
| | | _mTotalData.Add(Convert.ToInt32(reader["DeptID"].ToString()), tmp);
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("Problems occur when fetch alarm data: (" + e.Message + ")");
|
| | | _pLog.Error("Problems occur when fetch alarm data: (" + e.Message + ")");
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | private int getSSCCode(int m_SCCode, int m_Week) {
|
| | | int ssccode = m_SCCode;
|
| | | private int GetSscCode(int mScCode, int mWeek)
|
| | | {
|
| | | int ssccode = mScCode;
|
| | |
|
| | | /* DateTime stime = DateTime.Now;
|
| | |
|
| | |
| | |
|
| | | if (stime.before(nowtime) && (endtime.after(nowtime)))
|
| | | ssccode = Rs.getInt("SSCCODE");
|
| | | |
| | | }
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | |
| | | return ssccode;
|
| | | }
|
| | |
|
| | | private ArrayList getIPAddress(int DeptCode) {
|
| | | return (ArrayList) m_TotalData[Convert.ToInt32(DeptCode)];
|
| | | private ArrayList GetIpAddress(int deptCode)
|
| | | {
|
| | | return (ArrayList)_mTotalData[Convert.ToInt32(deptCode)];
|
| | | }
|
| | |
|
| | | public bool alarm(String AcceptNum, int Dept) |
| | | public bool Alarm(string acceptNum, int dept)
|
| | | {
|
| | | |
| | | _PLog.Info("開始Alarm...");
|
| | | System.Net.Sockets.Socket m_Client;
|
| | | ArrayList IPAddressSet = this.getIPAddress(this.getSSCCode(Dept, Convert.ToInt32(DateTime.Now.DayOfWeek)));
|
| | | String IP1;
|
| | | String IP2;
|
| | | String IP_Patrol;
|
| | | _pLog.Info("開始Alarm...");
|
| | | Socket mClient;
|
| | | ArrayList ipAddressSet = GetIpAddress(GetSscCode(dept, Convert.ToInt32(DateTime.Now.DayOfWeek)));
|
| | | string ip1;
|
| | | string ip2;
|
| | | string ipPatrol;
|
| | | System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
|
| | |
|
| | | if (IPAddressSet != null)
|
| | | if (ipAddressSet != null)
|
| | | {
|
| | | _PLog.Info("已取得該部門所需通知的IP Address.");
|
| | | IP1 = IPAddressSet[1].ToString();
|
| | | IP2 = IPAddressSet[2].ToString();
|
| | | IP_Patrol = IPAddressSet[3].ToString();
|
| | | } else {
|
| | | _PLog.Warn("無法取得該部門所需通知的IP Address!");
|
| | | _pLog.Info("已取得該部門所需通知的IP Address.");
|
| | | ip1 = ipAddressSet[1].ToString();
|
| | | ip2 = ipAddressSet[2].ToString();
|
| | | ipPatrol = ipAddressSet[3].ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | _pLog.Warn("無法取得該部門所需通知的IP Address!");
|
| | | return false;
|
| | | }
|
| | |
|
| | | try {
|
| | | IPAddress serverIp = IPAddress.Parse(IP1);
|
| | | int serverPort = Convert.ToInt32(CCS.LocalVariable.AlermPort);
|
| | | IPEndPoint iep = new IPEndPoint(serverIp, serverPort);
|
| | |
|
| | | m_Client = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
| | | m_Client.Connect(iep);
|
| | |
|
| | | byte[] byteMessage = encoding.GetBytes(AcceptNum);
|
| | |
|
| | | m_Client.Send(byteMessage);
|
| | | m_Client.Shutdown(SocketShutdown.Both);
|
| | | m_Client.Close();
|
| | | this.recordAlarmIP(AcceptNum, IP1);
|
| | | _PLog.Info("已成功通知" + IP1 + " !");
|
| | | return true;
|
| | |
|
| | | } catch (Exception e) {
|
| | | _PLog.Warn("無法通知" + IP1 + ": " + e.Message);
|
| | | }
|
| | |
|
| | | try {
|
| | | IPAddress serverIp = IPAddress.Parse(IP2);
|
| | | int serverPort = Convert.ToInt32(CCS.LocalVariable.AlermPort);
|
| | | IPEndPoint iep = new IPEndPoint(serverIp, serverPort);
|
| | |
|
| | | m_Client = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
| | | m_Client.Connect(iep);
|
| | |
|
| | | byte[] byteMessage = encoding.GetBytes(AcceptNum);
|
| | |
|
| | | m_Client.Send(byteMessage);
|
| | | m_Client.Shutdown(SocketShutdown.Both);
|
| | | m_Client.Close();
|
| | | this.recordAlarmIP(AcceptNum, IP2);
|
| | | _PLog.Info("已成功通知" + IP2 + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Warn("無法通知" + IP2 + ": " + e.Message);
|
| | | }
|
| | |
|
| | | try {
|
| | | IPAddress serverIp = IPAddress.Parse(IP_Patrol);
|
| | | int serverPort = Convert.ToInt32(CCS.LocalVariable.AlermPort);
|
| | | IPEndPoint iep = new IPEndPoint(serverIp, serverPort);
|
| | |
|
| | | m_Client = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
| | | m_Client.Connect(iep);
|
| | |
|
| | | byte[] byteMessage = encoding.GetBytes(AcceptNum);
|
| | |
|
| | | m_Client.Send(byteMessage);
|
| | | m_Client.Shutdown(SocketShutdown.Both);
|
| | | m_Client.Close();
|
| | | this.recordAlarmIP(AcceptNum, IP_Patrol);
|
| | | _PLog.Info("已成功通知" + IP_Patrol + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Warn("無法通知" + IP_Patrol + ": " + e.Message);
|
| | | _PLog.Warn("三個IP均無法通知到!");
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | private void recordAlarmIP(String AccNum, String IP) {
|
| | | String SqlStmt = "insert into eos.case_dispatch (acceptnum,alarmip) values('" + AccNum + "','" + IP + "')";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | IPAddress serverIp = IPAddress.Parse(ip1);
|
| | | int serverPort = Convert.ToInt32(GlobalVariable.AlermPort);
|
| | | IPEndPoint iep = new IPEndPoint(serverIp, serverPort);
|
| | |
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | _PLog.Warn("無法紀錄Alarm IP!");
|
| | | mClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
| | | mClient.Connect(iep);
|
| | |
|
| | | byte[] byteMessage = encoding.GetBytes(acceptNum);
|
| | |
|
| | | mClient.Send(byteMessage);
|
| | | mClient.Shutdown(SocketShutdown.Both);
|
| | | mClient.Close();
|
| | | RecordAlarmIp(acceptNum, ip1);
|
| | | _pLog.Info("已成功通知" + ip1 + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("recordAlarmIP Error." + e.Message);
|
| | | _pLog.Warn("無法通知" + ip1 + ": " + e.Message);
|
| | | }
|
| | |
|
| | | try
|
| | | {
|
| | | IPAddress serverIp = IPAddress.Parse(ip2);
|
| | | int serverPort = Convert.ToInt32(GlobalVariable.AlermPort);
|
| | | IPEndPoint iep = new IPEndPoint(serverIp, serverPort);
|
| | |
|
| | | mClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
| | | mClient.Connect(iep);
|
| | |
|
| | | byte[] byteMessage = encoding.GetBytes(acceptNum);
|
| | |
|
| | | mClient.Send(byteMessage);
|
| | | mClient.Shutdown(SocketShutdown.Both);
|
| | | mClient.Close();
|
| | | RecordAlarmIp(acceptNum, ip2);
|
| | | _pLog.Info("已成功通知" + ip2 + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法通知" + ip2 + ": " + e.Message);
|
| | | }
|
| | |
|
| | | try
|
| | | {
|
| | | IPAddress serverIp = IPAddress.Parse(ipPatrol);
|
| | | int serverPort = Convert.ToInt32(GlobalVariable.AlermPort);
|
| | | IPEndPoint iep = new IPEndPoint(serverIp, serverPort);
|
| | |
|
| | | mClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
| | | mClient.Connect(iep);
|
| | |
|
| | | byte[] byteMessage = encoding.GetBytes(acceptNum);
|
| | |
|
| | | mClient.Send(byteMessage);
|
| | | mClient.Shutdown(SocketShutdown.Both);
|
| | | mClient.Close();
|
| | | RecordAlarmIp(acceptNum, ipPatrol);
|
| | | _pLog.Info("已成功通知" + ipPatrol + " !");
|
| | | return true;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Warn("無法通知" + ipPatrol + ": " + e.Message);
|
| | | _pLog.Warn("三個IP均無法通知到!");
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | private void RecordAlarmIp(string accNum, string ip)
|
| | | {
|
| | | string sqlStmt = "insert into eos.case_dispatch (acceptnum,alarmip) values('" + accNum + "','" + ip + "')";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | _pLog.Warn("無法紀錄Alarm IP!");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("recordAlarmIP Error." + e.Message);
|
| | | return;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using System.Data.OracleClient;
|
| | | using System.Linq;
|
| | | using CCSTrace.CCS.Domain;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class CCSCodelist
|
| | | public class CcsCodelist
|
| | | {
|
| | | private Hashtable m_TotalData = new Hashtable();
|
| | | private int KeyID = 1;
|
| | | private int Item = 2;
|
| | | private int Content = 3;
|
| | | private readonly Dictionary<int, Dictionary<int, Codelist>> _mTotalData = new Dictionary<int, Dictionary<int, Codelist>>();
|
| | |
|
| | | public CCSCodelist(OracleConnection _ConnectionTPC)
|
| | | public CcsCodelist(OracleConnection connectionTpc)
|
| | | {
|
| | | String SqlStmt;
|
| | | ArrayList m_Data = new ArrayList();
|
| | | int Tmp = 0;
|
| | | int IndexID; |
| | |
|
| | | SqlStmt = "SELECT INDEXID,KEYID,ITEM,CONTENT FROM CCS.CODELIST ORDER BY INDEXID,KEYID";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | var sqlStmt = "SELECT INDEXID,KEYID,ITEM,CONTENT FROM CCS.CODELIST ORDER BY INDEXID,KEYID";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
|
| | | while (reader.Read())
|
| | | {
|
| | | ArrayList m_Record = new ArrayList();
|
| | | IndexID = Convert.ToInt32(reader["INDEXID"].ToString());
|
| | | m_Record.Add(IndexID);
|
| | | m_Record.Add(Convert.ToInt32(reader["KEYID"].ToString()));
|
| | | m_Record.Add(reader["ITEM"].ToString());
|
| | | m_Record.Add(reader["CONTENT"].ToString());
|
| | | var indexId = Convert.ToInt32(reader["INDEXID"].ToString());
|
| | | 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);
|
| | | if (!_mTotalData.ContainsKey(indexId))
|
| | | {
|
| | | _mTotalData.Add(indexId, new Dictionary<int, Codelist>());
|
| | | }
|
| | | Dictionary<int, Codelist> keys = _mTotalData[indexId];
|
| | | if (keys.ContainsKey(keyId))
|
| | | {
|
| | | keys.Add(keyId, codelist);
|
| | | }
|
| | |
|
| | | if (Tmp == IndexID)
|
| | | {
|
| | | m_Data.Add(m_Record);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_TotalData.Add(Tmp, m_Data);
|
| | | Tmp = IndexID;
|
| | | m_Data = new ArrayList();
|
| | | m_Data.Add(m_Record);
|
| | | }
|
| | | }
|
| | | m_TotalData.Add(Tmp, m_Data);
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine("Error on Initial EOSCodelist: " + e.Message);
|
| | | Console.WriteLine("Error on Startup EOSCodelist: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public ArrayList getAllContent(int m_IndexID)
|
| | | public Codelist[] GetAllContent(int mIndexId)
|
| | | {
|
| | | return ((ArrayList)m_TotalData[m_IndexID]);
|
| | | return _mTotalData[mIndexId].Values.ToArray();
|
| | | }
|
| | |
|
| | | public String getContent(int m_IndexID, int m_KeyID)
|
| | | public string GetContent(int mIndexId, int mKeyId)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID];
|
| | | String m_Result = "";
|
| | | return _mTotalData[mIndexId][mKeyId].Content;
|
| | | }
|
| | |
|
| | | try
|
| | | public string GetContent(int mIndexId, string mItem)
|
| | | {
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | string mResult = "";
|
| | |
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | {
|
| | | if (Convert.ToInt32(((ArrayList)m_Tmp[i])[KeyID].ToString()) == m_KeyID)
|
| | | if (pair.Value.Item.Equals(mItem))
|
| | | {
|
| | | m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
| | | mResult = pair.Value.Content;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Console.WriteLine("Error in get CCSCodelist(getContent(int m_IndexID, int m_KeyID)): " + ex.Message);
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | public String getContent(int m_IndexID, String m_Item)
|
| | | public int GetKeyId(int mIndexId, string mContent)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID];
|
| | | String m_Result = "";
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | int mResult = 0;
|
| | |
|
| | | try
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | {
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | {
|
| | | if ( ((ArrayList)m_Tmp[i])[Item].ToString().Trim().Equals(m_Item.Trim()))
|
| | | {
|
| | | m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
| | | mResult = pair.Key;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Console.WriteLine("Error in get CCSCodelist(getContent(int m_IndexID, String m_Item)): " + ex.Message);
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | public int getKeyID(int m_IndexID, String m_Content)
|
| | | public string GetItem(int mIndexId, string mContent)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID];
|
| | | int m_Result = 0;
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | string mResult = "";
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | {
|
| | | if (((ArrayList)m_Tmp[i])[Content].ToString().Equals(m_Content))
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | {
|
| | | m_Result = Convert.ToInt32(((ArrayList)m_Tmp[i])[KeyID].ToString());
|
| | | mResult = pair.Value.Item;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | public String getItem(int m_IndexID, String m_Content)
|
| | | public int GetContentNumber(int mIndexId)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID];
|
| | | String m_Result = "";
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | {
|
| | | if (((ArrayList)m_Tmp[i])[Content].ToString().Equals(m_Content))
|
| | | {
|
| | | m_Result = ((ArrayList)m_Tmp[i])[this.Item].ToString();
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return _mTotalData[mIndexId].Count;
|
| | | }
|
| | |
|
| | | public int getContentNumber(int m_IndexID)
|
| | | {
|
| | | return ((ArrayList)m_TotalData[m_IndexID]).Count;
|
| | | }
|
| | | public int Count => _mTotalData.Count;
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class CCSRecord
|
| | | public class CcsRecord
|
| | | {
|
| | | private String Meter;
|
| | | private String CustomerName;
|
| | | private String CustomerTel;
|
| | | private String ADDR_City;
|
| | | private String ADDR_Town;
|
| | | private String ADDR_Road;
|
| | | private String ADDR_Other;
|
| | | private String RecallName;
|
| | | private String RecallTel;
|
| | | private int EventBrief;
|
| | | private String AcceptTime;
|
| | | private String CCSID;
|
| | | private int ImportCase;
|
| | | private String Dept;
|
| | | private int PartHicustomer;
|
| | | private String Note;
|
| | | private readonly string _meter;
|
| | | private readonly string _customerName;
|
| | | private readonly string _customerTel;
|
| | | private readonly string _addrCity;
|
| | | private readonly string _addrTown;
|
| | | private readonly string _addrRoad;
|
| | | private readonly string _addrOther;
|
| | | private readonly string _recallName;
|
| | | private readonly string _recallTel;
|
| | | private readonly int _eventBrief;
|
| | | private readonly string _acceptTime;
|
| | | private readonly string _ccsid;
|
| | | private readonly int _importCase;
|
| | | private readonly string _dept;
|
| | | private readonly int _partHicustomer;
|
| | | private readonly string _note;
|
| | |
|
| | | public CCSRecord(String _CCSID, String _METER, String _CUSTOMERNAME, String _CUSTOMERTEL, String _ADDR_CITY, String _ADDR_TOWN, String _ADDR_ROAD,
|
| | | String _ADDR_OTHER, String _RECALLNAME, String _RECALLTEL, int _EVENTBRIEF, String _ACCEPTTIME, int _IMPORTCASE, String _DEPT,
|
| | | int _PartHicustomer,String _NOTE)
|
| | | public CcsRecord(string ccsid, string meter, string customername, string customertel, string addrCity, string addrTown, string addrRoad,
|
| | | string addrOther, string recallname, string recalltel, int eventbrief, string accepttime, int importcase, string dept,
|
| | | int partHicustomer, string note)
|
| | | {
|
| | | this.Meter = _METER;
|
| | | this.CustomerName = _CUSTOMERNAME;
|
| | | this.CustomerTel = _CUSTOMERTEL;
|
| | | this.ADDR_City = _ADDR_CITY;
|
| | | this.ADDR_Town = _ADDR_TOWN;
|
| | | this.ADDR_Road = _ADDR_ROAD;
|
| | | this.ADDR_Other = _ADDR_OTHER;
|
| | | this.RecallName = _RECALLNAME;
|
| | | this.RecallTel = _RECALLTEL;
|
| | | this.EventBrief = _EVENTBRIEF; ;
|
| | | this.CCSID = _CCSID;
|
| | | this.ImportCase = _IMPORTCASE;
|
| | | this.Dept = _DEPT;
|
| | | this.Note = _NOTE;
|
| | | this.PartHicustomer = _PartHicustomer;
|
| | | this.AcceptTime = _ACCEPTTIME;
|
| | | _meter = meter;
|
| | | _customerName = customername;
|
| | | _customerTel = customertel;
|
| | | _addrCity = addrCity;
|
| | | _addrTown = addrTown;
|
| | | _addrRoad = addrRoad;
|
| | | _addrOther = addrOther;
|
| | | _recallName = recallname;
|
| | | _recallTel = recalltel;
|
| | | _eventBrief = eventbrief; ;
|
| | | _ccsid = ccsid;
|
| | | _importCase = importcase;
|
| | | _dept = dept;
|
| | | _note = note;
|
| | | _partHicustomer = partHicustomer;
|
| | | _acceptTime = accepttime;
|
| | | }
|
| | |
|
| | | public CCSRecord(String _CCSID, OracleConnection _ConnectionTPC, SEventLog _PLog)
|
| | | public CcsRecord(string ccsid, OracleConnection connectionTpc, SEventLog pLog)
|
| | | {
|
| | | String SqlStmt;
|
| | |
|
| | | SqlStmt = "SELECT METER,CUSTOMERNAME,CUSTOMERTEL,ADDR_CITY,ADDR_TOWN,ADDR_ROAD,ADDR_OTHER,RECALLNAME,RECALLTEL,EVENTBRIEF,"
|
| | | 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 "
|
| | | + "WHERE CCSID = '" + _CCSID + "'";
|
| | | + "WHERE CCSID = '" + ccsid + "'";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | while (reader.Read())
|
| | | {
|
| | | Meter = reader["METER"].ToString();
|
| | | CustomerName = reader["CUSTOMERNAME"].ToString();
|
| | | CustomerTel = reader["CUSTOMERTEL"].ToString();
|
| | | ADDR_City = reader["ADDR_CITY"].ToString();
|
| | | ADDR_Town = reader["ADDR_TOWN"].ToString();
|
| | | ADDR_Road = reader["ADDR_ROAD"].ToString();
|
| | | ADDR_Other = reader["ADDR_OTHER"].ToString();
|
| | | RecallName = reader["RECALLNAME"].ToString();
|
| | | RecallTel = reader["RECALLTEL"].ToString();
|
| | | EventBrief = Int32.Parse(reader["EVENTBRIEF"].ToString());
|
| | | AcceptTime = reader["ACCEPTTIME"].ToString();
|
| | | CCSID = reader["CCSID"].ToString();
|
| | | ImportCase = Int32.Parse(reader["IMPORTCASE"].ToString());
|
| | | Dept = reader["DEPT"].ToString();
|
| | | PartHicustomer = Int32.Parse(reader["PARTHICUSTOMER"].ToString());
|
| | | Note = reader["NOTE"].ToString();
|
| | | _meter = reader["METER"].ToString();
|
| | | _customerName = reader["CUSTOMERNAME"].ToString();
|
| | | _customerTel = reader["CUSTOMERTEL"].ToString();
|
| | | _addrCity = reader["ADDR_CITY"].ToString();
|
| | | _addrTown = reader["ADDR_TOWN"].ToString();
|
| | | _addrRoad = reader["ADDR_ROAD"].ToString();
|
| | | _addrOther = reader["ADDR_OTHER"].ToString();
|
| | | _recallName = reader["RECALLNAME"].ToString();
|
| | | _recallTel = reader["RECALLTEL"].ToString();
|
| | | _eventBrief = int.Parse(reader["EVENTBRIEF"].ToString());
|
| | | _acceptTime = reader["ACCEPTTIME"].ToString();
|
| | | _ccsid = reader["CCSID"].ToString();
|
| | | _importCase = int.Parse(reader["IMPORTCASE"].ToString());
|
| | | _dept = reader["DEPT"].ToString();
|
| | | _partHicustomer = int.Parse(reader["PARTHICUSTOMER"].ToString());
|
| | | _note = reader["NOTE"].ToString();
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error("無法取得CCS報案資訊!" + e.Message);
|
| | | pLog.Error("無法取得CCS報案資訊!" + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _PLog.Error(e.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | throw e;
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public bool InsertDB(OracleConnection _ConnectionTPC, System.Data.OracleClient.OracleTransaction _Transaction, SEventLog _PLog)
|
| | | public string Meter => _meter;
|
| | |
|
| | | public string CustomerName => _customerName;
|
| | |
|
| | | public string CustomerTel => _customerTel;
|
| | |
|
| | | public string AddressCity => _addrCity;
|
| | |
|
| | | public string AddressTown => _addrTown;
|
| | |
|
| | | public string AddressRoad => _addrRoad;
|
| | |
|
| | | public string AddressOther => _addrOther;
|
| | |
|
| | | public string RecallTel => _recallTel;
|
| | |
|
| | | public string RecallName => _recallName;
|
| | |
|
| | | public int EventBrief => _eventBrief;
|
| | |
|
| | | public string AcceptTime => _acceptTime;
|
| | |
|
| | | public string CcsId => _ccsid;
|
| | |
|
| | | public int ImportCase => _importCase;
|
| | |
|
| | | public string Detp => _dept;
|
| | |
|
| | | public int PartHicustomer => _partHicustomer;
|
| | |
|
| | | public string Note => _note;
|
| | |
|
| | | public bool InsertDb(OracleConnection connectionTpc, OracleTransaction transaction, SEventLog pLog)
|
| | | {
|
| | | String SqlStmt;
|
| | | var sqlStmt = "INSERT INTO CCS.EVENTRECORD VALUES ('" + _meter + "','" + _customerName + "','" + _customerTel + "','" + _addrCity + "','"
|
| | | + _addrTown + "','" + _addrRoad + "','" + _addrOther + "','" + _recallName + "','" + _recallTel + "',"
|
| | | + _eventBrief + ",TO_DATE('" + _acceptTime + "','YYYY/MM/DD HH24:MI:SS'),'" + _ccsid + "'," + _importCase + ",'" + _dept + "',"
|
| | | + _partHicustomer + ",'" + _note + "')";
|
| | |
|
| | | SqlStmt = "INSERT INTO CCS.EVENTRECORD VALUES ('" + this.Meter + "','" + CustomerName + "','" + CustomerTel + "','" + ADDR_City + "','"
|
| | | + ADDR_Town + "','" + ADDR_Road + "','" + ADDR_Other + "','" + RecallName + "','" + RecallTel + "',"
|
| | | + EventBrief + ",TO_DATE('" + AcceptTime + "','YYYY/MM/DD HH24:MI:SS'),'" + CCSID + "'," + ImportCase + ",'" + Dept + "',"
|
| | | + PartHicustomer + ",'" + Note + "')";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Transaction);
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() != 1)
|
| | | if (command.ExecuteNonQuery() != 1)
|
| | | {
|
| | | _PLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");
|
| | | pLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");
|
| | |
|
| | | throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!");
|
| | | }
|
| | |
| | | {
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _PLog.Error(e.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | _PLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!" + e.Message);
|
| | | pLog.Error("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中!" + e.Message);
|
| | | //throw new Exception("CCS 案件受理程序初始化失敗...無法將CCS報案資訊存入資料庫中");
|
| | | throw e;
|
| | | throw;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | public String getMeter()
|
| | | {
|
| | | return this.Meter;
|
| | | }
|
| | |
|
| | | public String getCustomerName()
|
| | | {
|
| | | return this.CustomerName;
|
| | | }
|
| | |
|
| | | public String getCustomerTel()
|
| | | {
|
| | | return this.CustomerTel;
|
| | | }
|
| | |
|
| | | public String getADDR_City()
|
| | | {
|
| | | return this.ADDR_City;
|
| | | }
|
| | |
|
| | | public String getADDR_Town()
|
| | | {
|
| | | return this.ADDR_Town;
|
| | | }
|
| | |
|
| | | public String getADDR_Road()
|
| | | {
|
| | | return this.ADDR_Road;
|
| | | }
|
| | |
|
| | | public String getADDR_Other()
|
| | | {
|
| | | return this.ADDR_Other;
|
| | | }
|
| | |
|
| | | public String getRecallName()
|
| | | {
|
| | | return this.RecallName;
|
| | | }
|
| | |
|
| | | public String getRecallTel()
|
| | | {
|
| | | return this.RecallTel;
|
| | | }
|
| | |
|
| | | public int getEventBrief()
|
| | | {
|
| | | return this.EventBrief;
|
| | | }
|
| | |
|
| | | public String getAcceptTime()
|
| | | {
|
| | | return this.AcceptTime;
|
| | | }
|
| | |
|
| | | public String getCCSID()
|
| | | {
|
| | | return this.CCSID;
|
| | | }
|
| | |
|
| | | public int getImportCase()
|
| | | {
|
| | | return this.ImportCase;
|
| | | }
|
| | |
|
| | | public String getDetp()
|
| | | {
|
| | | return this.Dept;
|
| | | }
|
| | |
|
| | | public int getPartHicustomer()
|
| | | {
|
| | | return PartHicustomer;
|
| | | }
|
| | |
|
| | | public String getNote()
|
| | | {
|
| | | return this.Note;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Collections;
|
| | | using System.Data.OracleClient;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class Dept_Contrast
|
| | | public class DeptContrast
|
| | | {
|
| | | private ArrayList m_TotalData = null;
|
| | | public static String DefaultDept = "市區巡修課";
|
| | | private ArrayList _mTotalData = null;
|
| | | public static string DefaultDept = "市區巡修課";
|
| | |
|
| | | public Dept_Contrast(OracleConnection _ConnectionTPC,OracleTransaction _Trx)
|
| | | public DeptContrast(OracleConnection connectionTpc, OracleTransaction trx)
|
| | | {
|
| | | if (m_TotalData == null)
|
| | | this.Initial(_ConnectionTPC,_Trx);
|
| | | if (_mTotalData == null)
|
| | | Initial(connectionTpc, trx);
|
| | | }
|
| | |
|
| | | public int getDept_Code(String m_Meter)
|
| | | public int getDept_Code(string mMeter)
|
| | | {
|
| | | //int Result = CCS.CCSMain.EOSCodelist.getKeyID(CCS.LocalVariable.Dept, DefaultDept);
|
| | | int Result = -1;
|
| | | //int Result = CCS.CCSMain.EOSCodelist.getKeyID(CCS.GlobalVariable.Dept, DefaultDept);
|
| | | int result = -1;
|
| | |
|
| | | try
|
| | | {
|
| | | for (int i = 0; i < m_TotalData.Count; i++)
|
| | | for (int i = 0; i < _mTotalData.Count; i++)
|
| | | {
|
| | | ArrayList TmpData = (ArrayList)m_TotalData[i];
|
| | | ArrayList tmpData = (ArrayList)_mTotalData[i];
|
| | |
|
| | | if (TmpData[2] == null)
|
| | | if (tmpData[2] == null)
|
| | | {
|
| | | Result = Convert.ToInt32(TmpData[1].ToString());
|
| | | result = Convert.ToInt32(tmpData[1].ToString());
|
| | | break;
|
| | | }
|
| | | else
|
| | | {// 一對多(需作比對)
|
| | | long MinMeter = Convert.ToInt64(TmpData[3].ToString());
|
| | | long MaxMeter = Convert.ToInt64(TmpData[2].ToString());
|
| | | long CustMeter = Convert.ToInt64(m_Meter);
|
| | | long minMeter = Convert.ToInt64(tmpData[3].ToString());
|
| | | long maxMeter = Convert.ToInt64(tmpData[2].ToString());
|
| | | long custMeter = Convert.ToInt64(mMeter);
|
| | |
|
| | | if ((CustMeter > MinMeter) && (CustMeter < MaxMeter))
|
| | | if ((custMeter > minMeter) && (custMeter < maxMeter))
|
| | | {
|
| | | Result = Convert.ToInt32(TmpData[1].ToString());
|
| | | result = Convert.ToInt32(tmpData[1].ToString());
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | Console.WriteLine(ex.Message);
|
| | | }
|
| | | return Result;
|
| | | return result;
|
| | | }
|
| | |
|
| | | public int getDept_Code(int SC_Code, String Meter)
|
| | | public int getDept_Code(int scCode, string meter)
|
| | | {
|
| | | int Result = CCS.CCSMain.EOSCodelist.getKeyID(CCS.LocalVariable.Dept, DefaultDept);
|
| | | int result = GlobalVariable.EosCodelist.GetKeyId(GlobalVariable.Dept, DefaultDept);
|
| | | try
|
| | | {
|
| | | for (int i = 0; i < m_TotalData.Count; i++)
|
| | | for (int i = 0; i < _mTotalData.Count; i++)
|
| | | {
|
| | | ArrayList TmpData = (ArrayList)m_TotalData[i];
|
| | | int Tmp_Dept = Convert.ToInt32(TmpData[0].ToString());
|
| | | ArrayList tmpData = (ArrayList)_mTotalData[i];
|
| | | int tmpDept = Convert.ToInt32(tmpData[0].ToString());
|
| | |
|
| | | if (Tmp_Dept == SC_Code)
|
| | | if (tmpDept == scCode)
|
| | | {
|
| | | // 一對一(無最大最小電號限制)
|
| | | if (TmpData[2] == null)
|
| | | if (tmpData[2] == null)
|
| | | {
|
| | | Result = Convert.ToInt32(TmpData[1].ToString());
|
| | | result = Convert.ToInt32(tmpData[1].ToString());
|
| | | break;
|
| | | }
|
| | | else
|
| | | {// 一對多(需作比對)
|
| | | long MinMeter = Convert.ToInt64(TmpData[3].ToString());
|
| | | long MaxMeter = Convert.ToInt64(TmpData[2].ToString());
|
| | | long CustMeter = Convert.ToInt64(Meter);
|
| | | long minMeter = Convert.ToInt64(tmpData[3].ToString());
|
| | | long maxMeter = Convert.ToInt64(tmpData[2].ToString());
|
| | | long custMeter = Convert.ToInt64(meter);
|
| | |
|
| | | if ((CustMeter > MinMeter) && (CustMeter < MaxMeter))
|
| | | if ((custMeter > minMeter) && (custMeter < maxMeter))
|
| | | {
|
| | | Result = Convert.ToInt32(TmpData[1].ToString());
|
| | | result = Convert.ToInt32(tmpData[1].ToString());
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | Console.WriteLine(ex.Message);
|
| | | }
|
| | |
|
| | | return Result;
|
| | | return result;
|
| | | }
|
| | |
|
| | | private void Initial(OracleConnection _ConnectionTPC,OracleTransaction _Trx)
|
| | | private void Initial(OracleConnection connectionTpc, OracleTransaction trx)
|
| | | {
|
| | | String SqlStmt;
|
| | | m_TotalData = new ArrayList();
|
| | | string sqlStmt;
|
| | | _mTotalData = new ArrayList();
|
| | |
|
| | | SqlStmt = "SELECT SC_CODE,DEPT_CODE,MAX_METER,MIN_METER FROM CCS.DEPT_CONTRAST";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Trx);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | sqlStmt = "SELECT SC_CODE,DEPT_CODE,MAX_METER,MIN_METER FROM CCS.DEPT_CONTRAST";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connectionTpc, trx);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
|
| | | while (reader.Read())
|
| | | {
|
| | | ArrayList Record = new ArrayList();
|
| | | int SC_Code = Convert.ToInt32(reader["SC_CODE"].ToString());
|
| | | Record.Add(SC_Code);
|
| | | Record.Add(Convert.ToInt32(reader["Dept_Code"].ToString()));
|
| | | Record.Add(reader["Max_Meter"].ToString());
|
| | | Record.Add(reader["Min_Meter"].ToString());
|
| | | ArrayList record = new ArrayList();
|
| | | int scCode = Convert.ToInt32(reader["SC_CODE"].ToString());
|
| | | record.Add(scCode);
|
| | | record.Add(Convert.ToInt32(reader["Dept_Code"].ToString()));
|
| | | record.Add(reader["Max_Meter"].ToString());
|
| | | record.Add(reader["Min_Meter"].ToString());
|
| | |
|
| | | m_TotalData.Add(Record);
|
| | | _mTotalData.Add(record);
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using System.Data.OracleClient;
|
| | | using System.Linq;
|
| | | using CCSTrace.CCS.Domain;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EOSCodelist
|
| | | public class EosCodelist
|
| | | {
|
| | | private Hashtable m_TotalData = new Hashtable();
|
| | | private int KeyID = 1;
|
| | | private int Item = 2;
|
| | | private int Content = 3;
|
| | | private readonly Dictionary<int, Dictionary<int, Codelist>> _mTotalData = new Dictionary<int, Dictionary<int, Codelist>>();
|
| | |
|
| | | public EOSCodelist(OracleConnection _Connection)
|
| | | public EosCodelist(OracleConnection connection)
|
| | | {
|
| | | String SqlStmt;
|
| | | int IndexID;
|
| | | ArrayList m_Data = new ArrayList();
|
| | | int Tmp = 0;
|
| | |
|
| | | SqlStmt = "SELECT INDEXID,KEYID,ITEM,CONTENT FROM EOS.CODELIST ORDER BY INDEXID,KEYID";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Connection);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | var sqlStmt = "SELECT INDEXID,KEYID,ITEM,CONTENT FROM EOS.CODELIST ORDER BY INDEXID,KEYID";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connection);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
|
| | | while (reader.Read())
|
| | | {
|
| | | ArrayList m_Record = new ArrayList();
|
| | | IndexID = Convert.ToInt32(reader["INDEXID"].ToString());
|
| | | m_Record.Add(IndexID);
|
| | | m_Record.Add(Convert.ToInt32(reader["KEYID"].ToString()));
|
| | | m_Record.Add(reader["ITEM"].ToString());
|
| | | m_Record.Add(reader["CONTENT"].ToString());
|
| | |
|
| | | if (Tmp == IndexID)
|
| | | m_Data.Add(m_Record);
|
| | | else
|
| | | var indexId = Convert.ToInt32(reader["INDEXID"].ToString());
|
| | | 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);
|
| | | if (!_mTotalData.ContainsKey(indexId))
|
| | | {
|
| | | m_TotalData.Add(Tmp.ToString(), m_Data);
|
| | | Tmp = IndexID;
|
| | | m_Data = new ArrayList();
|
| | | m_Data.Add(m_Record);
|
| | | _mTotalData.Add(indexId, new Dictionary<int, Codelist>());
|
| | | }
|
| | | Dictionary<int, Codelist> keys = _mTotalData[indexId];
|
| | | if (keys.ContainsKey(keyId))
|
| | | {
|
| | | keys.Add(keyId, codelist);
|
| | | }
|
| | | }
|
| | | m_TotalData.Add(Tmp.ToString(), m_Data);
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine("Error on Initial EOSCodelist: " + e.Message);
|
| | | Console.WriteLine("Error on Startup EOSCodelist: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public ArrayList getAllContent(int m_IndexID)
|
| | | public Codelist[] GetAllContent(int mIndexId)
|
| | | {
|
| | | return (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | return _mTotalData[mIndexId].Values.ToArray();
|
| | | }
|
| | |
|
| | | public String getContent(int m_IndexID, int m_KeyID)
|
| | | public string GetContent(int mIndexId, int mKeyId)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | String m_Result = "";
|
| | | return _mTotalData[mIndexId][mKeyId].Content;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | public string GetContent(int mIndexId, string mItem)
|
| | | {
|
| | | if (Convert.ToInt32(((ArrayList)m_Tmp[i])[KeyID].ToString()) == m_KeyID)
|
| | | string mResult = "";
|
| | |
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | {
|
| | | m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
| | | if (pair.Value.Item.Equals(mItem))
|
| | | {
|
| | | mResult = pair.Value.Content;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | public String getContent(int m_IndexID, String m_Item)
|
| | | public int GetKeyId(int mIndexId, string mContent)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | String m_Result = "";
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | int mResult = 0;
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | {
|
| | | if (((ArrayList)m_Tmp[i])[Item].ToString().Equals(m_Item))
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | {
|
| | | m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
| | | mResult = pair.Key;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | public int getKeyID(int m_IndexID, String m_Content)
|
| | | public int GetContentNumber(int mIndexId)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | int m_Result = 0;
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | {
|
| | | if (((ArrayList)m_Tmp[i])[Content].ToString().Equals(m_Content))
|
| | | {
|
| | | m_Result = Convert.ToInt32(((ArrayList)m_Tmp[i])[1].ToString());
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return (_mTotalData[mIndexId]).Count;
|
| | | }
|
| | |
|
| | | public int getContentNumber(int m_IndexID)
|
| | | {
|
| | | return ((ArrayList)m_TotalData[m_IndexID]).Count;
|
| | | }
|
| | | public int Count => _mTotalData.Count;
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | | using System.Data.OracleClient;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EventQuery
|
| | | {
|
| | | private String CCSID;
|
| | | private String Meter;
|
| | | private int CaseStatus;
|
| | | private String ChangeTime;
|
| | | private String HandlingSummary;
|
| | | private String AssumedTime;
|
| | | private String AssumedTime_Nth;
|
| | | private int DelayTimes = 0;
|
| | | private String Reason;
|
| | | private String EventLocation = "";
|
| | | //private CCS.Function.TransferDate convert = new CCS.Function.TransferDate();
|
| | |
|
| | | public EventQuery()
|
| | | {
|
| | | }
|
| | | public string CcsId { get; set; }
|
| | |
|
| | | public void setCCSID(String m_CCSID)
|
| | | {
|
| | | this.CCSID = m_CCSID;
|
| | | }
|
| | | public string Meter { get; set; }
|
| | |
|
| | | public String getCCSID()
|
| | | {
|
| | | return this.CCSID;
|
| | | }
|
| | | public int CaseStatus { get; set; }
|
| | |
|
| | | public void setMeter(String m_Meter)
|
| | | {
|
| | | this.Meter = m_Meter;
|
| | | }
|
| | | public string ChangeTime { get; set; }
|
| | |
|
| | | public String getMeter()
|
| | | {
|
| | | return this.Meter;
|
| | | }
|
| | | public string HandlingSummary { get; set; }
|
| | |
|
| | | /**
|
| | | * @return Returns the eventLocation.
|
| | | */
|
| | | public String getEventLocation()
|
| | | {
|
| | | return EventLocation;
|
| | | }
|
| | | public string AssumedTime { get; set; }
|
| | |
|
| | | /**
|
| | | * @param m_eventLocation The eventLocation to set.
|
| | | */
|
| | | public void setEventLocation(String m_eventLocation)
|
| | | {
|
| | | EventLocation = m_eventLocation;
|
| | | }
|
| | | public string AssumedTimeNth { get; set; }
|
| | |
|
| | | public void setCaseStatus(int m_CaseStatus)
|
| | | {
|
| | | this.CaseStatus = m_CaseStatus;
|
| | | }
|
| | | public int DelayTimes { get; set; } = 0;
|
| | |
|
| | | public void setChangeTime(String m_ChangeTime)
|
| | | {
|
| | | this.ChangeTime = m_ChangeTime;
|
| | | }
|
| | | public string Reason { get; set; }
|
| | |
|
| | | public String getChangeTime()
|
| | | {
|
| | | return this.ChangeTime;
|
| | | }
|
| | | public string EventLocation { get; set; } = "";
|
| | |
|
| | | public void setHandlingSummary(String m_HandlingSummary)
|
| | | public bool Insert(RecordLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | this.HandlingSummary = m_HandlingSummary;
|
| | | }
|
| | |
|
| | | public String getHandlingSummary()
|
| | | {
|
| | | return this.HandlingSummary;
|
| | | }
|
| | |
|
| | | public void setAssumedTime(String m_AssumedTime)
|
| | | {
|
| | | this.AssumedTime = m_AssumedTime;
|
| | | }
|
| | |
|
| | | public String getAssumedTime()
|
| | | {
|
| | | return this.AssumedTime;
|
| | | }
|
| | |
|
| | | public void setAssumedTime_Nth(String m_AssumedTime_Nth)
|
| | | {
|
| | | this.AssumedTime_Nth = m_AssumedTime_Nth;
|
| | | }
|
| | |
|
| | | public String getAssumedTime_Nth()
|
| | | {
|
| | | return this.AssumedTime_Nth;
|
| | | }
|
| | |
|
| | | public void setDelayTimes(int m_DelayTimes)
|
| | | {
|
| | | this.DelayTimes = m_DelayTimes;
|
| | | }
|
| | |
|
| | | public int getDelayTimes()
|
| | | {
|
| | | return this.DelayTimes;
|
| | | }
|
| | |
|
| | | public void setReason(String m_Reason)
|
| | | {
|
| | | this.Reason = m_Reason;
|
| | | }
|
| | |
|
| | | public String getReason()
|
| | | {
|
| | | return this.Reason;
|
| | | }
|
| | |
|
| | | public bool Insert(RecordLog _PLog, OracleConnection _Conn, OracleTransaction _Transaction)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | if (!Check())
|
| | | {
|
| | |
| | |
|
| | | if (Meter == null)
|
| | | {
|
| | | SqlStmt = "INSERT INTO CCS.EVENTQUERY (CCSID,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" + "'" + CCSID
|
| | | 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('" + AssumedTime_Nth + "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | | + 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('"
|
| | | + AssumedTime_Nth + "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | |
|
| | | 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)";
|
| | | }
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() > 0)
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public bool Insert(SEventLog _PLog, OracleConnection _Conn, OracleTransaction _Transaction)
|
| | | public bool Insert(SEventLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | if (!Check())
|
| | | {
|
| | |
| | |
|
| | | if (Meter == null)
|
| | | {
|
| | | SqlStmt = "INSERT INTO CCS.EVENTQUERY (CCSID,CASESTATUS,CHANGETIME,ASSUMEDTIME,ASSUMEDTIME_NTH,DELAYTIMES,REASON,INPUTTIME) values(" + "'" + CCSID
|
| | | 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('" + AssumedTime_Nth + "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | | + 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('"
|
| | | + AssumedTime_Nth + "','yyyy/mm/dd hh24:mi:ss')," + DelayTimes + ",'" + Reason + "',SYSDATE)";
|
| | | 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)";
|
| | | }
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() > 0)
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _PLog.Error(e.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | throw e;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | public bool Update(RecordLog _PLog, OracleConnection _Conn, OracleTransaction _Transaction)
|
| | | public bool Update(RecordLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | if (!Check())
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | String SqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS=" + this.CaseStatus + ",CHANGETIME=to_date('"
|
| | | + this.ChangeTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME=to_date('"
|
| | | + this.AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME_NTH=to_date('"
|
| | | + this.AssumedTime_Nth + "','yyyy/mm/dd hh24:mi:ss'),DELAYTIMES=" + this.DelayTimes + ",REASON='"
|
| | | + this.Reason + "',EVENTLOCATION ='" + this.EventLocation + "' WHERE CCSID='" + this.CCSID + "'";
|
| | | var sqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS=" + CaseStatus + ",CHANGETIME=to_date('"
|
| | | + ChangeTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME=to_date('"
|
| | | + AssumedTime + "','yyyy/mm/dd hh24:mi:ss'),ASSUMEDTIME_NTH=to_date('"
|
| | | + AssumedTimeNth + "','yyyy/mm/dd hh24:mi:ss'),DELAYTIMES=" + DelayTimes + ",REASON='"
|
| | | + Reason + "',EVENTLOCATION ='" + EventLocation + "' WHERE CCSID='" + CcsId + "'";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("更新CCS.EVENTQUERY資料失敗.");
|
| | | pLog.Error("更新CCS.EVENTQUERY資料失敗.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | public bool UpdateCaseStatus(SEventLog _PLog, OracleConnection _Conn, OracleTransaction _Transaction)
|
| | | public bool UpdateCaseStatus(SEventLog pLog, OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | String SqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS = " + CaseStatus + " WHERE CCSID = '" + CCSID + "'";
|
| | | var sqlStmt = "UPDATE CCS.EVENTQUERY SET CASESTATUS = " + CaseStatus + " WHERE CCSID = '" + CcsId + "'";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | var command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | try
|
| | | {
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _PLog.Error("更新CCS.EVENTQUERY的CASESTATUS失敗.");
|
| | | pLog.Error("更新CCS.EVENTQUERY的CASESTATUS失敗.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _PLog.Error(e.Message);
|
| | | pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | |
|
| | | if (LocalVariable.ShowError)
|
| | | _PLog.Error(e.StackTrace);
|
| | | if (GlobalVariable.ShowError)
|
| | | pLog.Error(e.StackTrace);
|
| | |
|
| | | throw e;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return true;
|
| | |
| | | // Not Null Check
|
| | | private bool Check()
|
| | | {
|
| | | if (CCSID == null)
|
| | | if (CcsId == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | | {
|
| | | return false;
|
| | | }
|
| | | Reason = (Reason == null ? "" : Reason);
|
| | | Reason = Reason ?? "";
|
| | | return true;
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | | using System.Data.OracleClient;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EventRecord
|
| | | {
|
| | | private int CaseID;
|
| | | private String Name = "";
|
| | | private String Meter = "";
|
| | | private String Tel = "";
|
| | | private String Addr = "";
|
| | | private String Brief = "";
|
| | | private String Log = ""; // default
|
| | | private int Dept = 0; // default
|
| | | private String AcceptNum;
|
| | | private String AcceptDate;
|
| | | private int Fsc = 0;
|
| | | private int Ufid = 0;
|
| | | private int FdrID = 0;
|
| | | private int Trace_Finish = 0;
|
| | | private int ParentID = 0;
|
| | | private int ImportCase;
|
| | | private String Note = "";
|
| | | private int isReCall;
|
| | | private String ReCallTel = "";
|
| | | private String ReCallName = "";
|
| | | private bool despatched = false;// 專案案件升級為母案件時,判斷原先案件是否已派工
|
| | | private int Level = 0;
|
| | | private int TmpCaseID = 0;
|
| | | private String tpclid = "";
|
| | | //private CCS.Function.TransferDate Convert = new CCS.Function.TransferDate();
|
| | | private CCS.Object.LocateEquipment m_Equipment;
|
| | |
|
| | | public EventRecord(int m_CaseID,System.Data.OracleClient.OracleConnection _Conn,System.Data.OracleClient.OracleTransaction _Trx)
|
| | | public EventRecord(int mCaseId, OracleConnection conn, OracleTransaction trx)
|
| | | {
|
| | | this.CaseID = m_CaseID;
|
| | | this.m_Equipment = new CCS.Object.LocateEquipment(CaseID, false,_Conn,_Trx);
|
| | | CaseId = mCaseId;
|
| | | LocateEquipment = new LocateEquipment(CaseId, false, conn, trx);
|
| | | }
|
| | |
|
| | | public CCS.Object.LocateEquipment getLocateEquipment()
|
| | | public LocateEquipment LocateEquipment { get; }
|
| | |
|
| | | public int CaseId { get; }
|
| | |
|
| | | public string Name { get; set; } = "";
|
| | |
|
| | | public string Meter { get; set; } = "";
|
| | |
|
| | | public string Tel { get; set; } = "";
|
| | |
|
| | | public string Addr { get; set; } = "";
|
| | |
|
| | | public string Brief { get; set; } = "";
|
| | |
|
| | | public string Log { get; set; } = "";
|
| | |
|
| | | public int Dept { get; set; } = 0;
|
| | |
|
| | | public string AcceptNum { get; set; }
|
| | |
|
| | | public string AcceptDate { get; set; }
|
| | |
|
| | | public int TraceFinish { get; set; } = 0;
|
| | |
|
| | | public int Fsc { get; set; } = 0;
|
| | |
|
| | | public int Ufid { get; set; } = 0;
|
| | |
|
| | | public int FdrId { get; set; } = 0;
|
| | |
|
| | | public int ParentId { get; set; } = 0;
|
| | |
|
| | | public int ImportCase { get; set; }
|
| | |
|
| | | public string Note { get; set; } = "";
|
| | |
|
| | | public int IsReCall { get; set; }
|
| | |
|
| | | public string ReCallTel { get; set; } = "";
|
| | |
|
| | | public string ReCallName { get; set; } = "";
|
| | |
|
| | | public int Level { get; set; } = 0;
|
| | |
|
| | |
|
| | | public int TmpCaseId { get; set; } = 0;
|
| | |
|
| | | public bool IsDespatched { get; set; }
|
| | |
|
| | | public string Tpclid { get; set; } = "";
|
| | |
|
| | | public void SetIsDespatched(bool mDespatched)
|
| | | {
|
| | | return this.m_Equipment;
|
| | | IsDespatched = mDespatched;
|
| | | }
|
| | |
|
| | | public int getCaseID()
|
| | | public string GetSqlStmt()
|
| | | {
|
| | | return this.CaseID;
|
| | | var sqlStmt = "INSERT INTO EOS.EVENTRECORD VALUES (" + CaseId + ",'" + Name + "','" + Meter + "','" + Tel +
|
| | | "','" + Addr + "','" + Brief + "'," + Dept + ",'" + Log + "','" + AcceptNum + "',to_date('"
|
| | | + AcceptDate + "','yyyy/mm/dd hh24:mi:ss')," + Fsc + "," + Ufid + "," + FdrId + "," +
|
| | | TraceFinish + "," + ImportCase + ",'" + Note + "'," + IsReCall + ",'"
|
| | | + ReCallTel + "','" + ReCallName + "'," + Level + ")";
|
| | |
|
| | | return sqlStmt;
|
| | | }
|
| | |
|
| | | public String getName()
|
| | | {
|
| | | return this.Name;
|
| | | }
|
| | |
|
| | | public void setName(String m_Name)
|
| | | {
|
| | | this.Name = m_Name;
|
| | | }
|
| | |
|
| | | public String getMeter()
|
| | | {
|
| | | return this.Meter;
|
| | | }
|
| | |
|
| | | public void setMeter(String m_Meter)
|
| | | {
|
| | | this.Meter = m_Meter;
|
| | | }
|
| | |
|
| | | public String getTel()
|
| | | {
|
| | | return this.Tel;
|
| | | }
|
| | |
|
| | | public void setTel(String m_Tel)
|
| | | {
|
| | | this.Tel = m_Tel;
|
| | | }
|
| | |
|
| | | public String getAddr()
|
| | | {
|
| | | return this.Addr;
|
| | | }
|
| | |
|
| | | public void setAddr(String m_Addr)
|
| | | {
|
| | | this.Addr = m_Addr;
|
| | | }
|
| | |
|
| | | public String getBrief()
|
| | | {
|
| | | return this.Brief;
|
| | | }
|
| | |
|
| | | public void setBrief(String m_Brief)
|
| | | {
|
| | | this.Brief = m_Brief;
|
| | | }
|
| | |
|
| | | public String getLog()
|
| | | {
|
| | | return this.Log;
|
| | | }
|
| | |
|
| | | public void setLog(String m_Log)
|
| | | {
|
| | | this.Log = m_Log;
|
| | | }
|
| | |
|
| | | public int getDept()
|
| | | {
|
| | | return this.Dept;
|
| | | }
|
| | |
|
| | | public void setDept(int m_Dept)
|
| | | {
|
| | | this.Dept = m_Dept;
|
| | | }
|
| | |
|
| | | public String getAcceptNum()
|
| | | {
|
| | | return this.AcceptNum;
|
| | | }
|
| | |
|
| | | public void setAcceptNum(String m_AcceptNum)
|
| | | {
|
| | | this.AcceptNum = m_AcceptNum;
|
| | | }
|
| | |
|
| | | public String getAcceptDate()
|
| | | {
|
| | | return this.AcceptDate;
|
| | | }
|
| | |
|
| | | public void setAcceptDate(String m_AcceptDate)
|
| | | {
|
| | | this.AcceptDate = m_AcceptDate;
|
| | | }
|
| | |
|
| | | public int getTrace_Finish()
|
| | | {
|
| | | return this.Trace_Finish;
|
| | | }
|
| | |
|
| | | public void setFsc(int m_Fsc)
|
| | | {
|
| | | this.Fsc = m_Fsc;
|
| | | }
|
| | |
|
| | | public int getFsc()
|
| | | {
|
| | | return this.Fsc;
|
| | | }
|
| | |
|
| | | public void setUfid(int m_Ufid)
|
| | | {
|
| | | this.Ufid = m_Ufid;
|
| | | }
|
| | |
|
| | | public int getUfid()
|
| | | {
|
| | | return this.Ufid;
|
| | | }
|
| | |
|
| | | public void setFdrID(int m_FdrID)
|
| | | {
|
| | | this.FdrID = m_FdrID;
|
| | | }
|
| | |
|
| | | public int getFdrID()
|
| | | {
|
| | | return this.FdrID;
|
| | | }
|
| | |
|
| | | public void setTrace_Finish(int m_Trace_Finish)
|
| | | {
|
| | | this.Trace_Finish = m_Trace_Finish;
|
| | | }
|
| | |
|
| | | public void setParentID(int m_ParentID)
|
| | | {
|
| | | this.ParentID = m_ParentID;
|
| | | }
|
| | |
|
| | | public int getParentID()
|
| | | {
|
| | | return this.ParentID;
|
| | | }
|
| | |
|
| | | public void setImportCase(int m_ImportCase)
|
| | | {
|
| | | this.ImportCase = m_ImportCase;
|
| | | }
|
| | |
|
| | | public int getImportCase()
|
| | | {
|
| | | return this.ImportCase;
|
| | | }
|
| | |
|
| | | public void setNote(String m_Note)
|
| | | {
|
| | | this.Note = m_Note;
|
| | | }
|
| | |
|
| | | public String getNote()
|
| | | {
|
| | | return this.Note;
|
| | | }
|
| | |
|
| | | public void setisReCall(int m_isReCall)
|
| | | {
|
| | | this.isReCall = m_isReCall;
|
| | | }
|
| | |
|
| | | public int getisReCall()
|
| | | {
|
| | | return this.isReCall;
|
| | | }
|
| | |
|
| | | public void setReCallTel(String m_ReCallTel)
|
| | | {
|
| | | this.ReCallTel = m_ReCallTel;
|
| | | }
|
| | |
|
| | | public String getReCallTel()
|
| | | {
|
| | | return this.ReCallTel;
|
| | | }
|
| | |
|
| | | public void setReCallName(String m_ReCallName)
|
| | | {
|
| | | this.ReCallName = m_ReCallName;
|
| | | }
|
| | |
|
| | | public String getReCallName()
|
| | | {
|
| | | return this.ReCallName;
|
| | | }
|
| | |
|
| | | public void setLevel(int m_Level)
|
| | | {
|
| | | this.Level = m_Level;
|
| | | }
|
| | |
|
| | | public int getLevel()
|
| | | {
|
| | | return this.Level;
|
| | | }
|
| | |
|
| | | public int getTmpCaseID()
|
| | | {
|
| | | return this.TmpCaseID;
|
| | | }
|
| | |
|
| | | public void setTmpCaseID(int CaseID)
|
| | | {
|
| | | this.TmpCaseID = CaseID;
|
| | | }
|
| | |
|
| | | public void setDespatched(bool m_Despatched)
|
| | | {
|
| | | this.despatched = m_Despatched;
|
| | | }
|
| | |
|
| | | public bool isDespatched()
|
| | | {
|
| | | return this.despatched;
|
| | | }
|
| | |
|
| | | public String getSqlStmt()
|
| | | {
|
| | | String SqlStmt;
|
| | |
|
| | | SqlStmt = "insert into eos.eventrecord values (" + getCaseID() + ",'" + getName() + "','" + getMeter() + "','" + getTel() + "','" + getAddr()
|
| | | + "','" + getBrief() + "'," + getDept() + ",'" + getLog() + "','" + getAcceptNum() + "',to_date('"
|
| | | + getAcceptDate() + "','yyyy/mm/dd hh24:mi:ss')," + getFsc() + "," + getUfid()
|
| | | + "," + getFdrID() + "," + getTrace_Finish() + "," + getImportCase() + ",'" + getNote() + "'," + getisReCall() + ",'"
|
| | | + getReCallTel() + "','" + getReCallName() + "'," + getLevel() + ")";
|
| | |
|
| | | return SqlStmt;
|
| | | }
|
| | |
|
| | | //public String getUpdateSqlStmt()
|
| | | //{
|
| | | // String SqlStmt;
|
| | | //}
|
| | | // return SqlStmt;
|
| | | // + getReCallName() + "',CASELEVEL = " + getLevel() + ",DEPT = " + getDept() + " WHERE CASEID = " + getCaseID();
|
| | | // + ",NOTE = '" + getNote() + "',ISRECALL = " + getisReCall() + ",RECALLTEL = '" + getReCallTel() + "',RECALLNAME = '"
|
| | |
|
| | | // SqlStmt = "UPDATE EOS.EVENTRECORD SET CUSTOMERADDR = '" + getAddr() + "',EVENTBRIEF = '" + getBrief() + "',IMPORTCASE = " + getImportCase()
|
| | | // + ",NOTE = '" + getNote() + "',ISRECALL = " + getisReCall() + ",RECALLTEL = '" + getReCallTel() + "',RECALLNAME = '"
|
| | | // + getReCallName() + "',CASELEVEL = " + getLevel() + ",DEPT = " + getDept() + " WHERE CASEID = " + getCaseID();
|
| | | // return SqlStmt;
|
| | | //}
|
| | | // String SqlStmt;
|
| | | //{
|
| | |
|
| | | public String getTpclid()
|
| | | {
|
| | | return tpclid;
|
| | | }
|
| | |
|
| | | public void setTpclid(String m_tpclid)
|
| | | {
|
| | | tpclid = m_tpclid;
|
| | | }
|
| | | //public String getUpdateSqlStmt()
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | |
|
| | |
| | | {
|
| | | public class LocateEquipment
|
| | | {
|
| | | private int CaseID = 0;
|
| | | private int DSUfid = -1;
|
| | | private int Fsc = 0;
|
| | | private int Ufid = 0;
|
| | | private String FDR = "";
|
| | | private String TPCLID = "";
|
| | | private int _caseId = 0;
|
| | | private int _dsUfid = -1;
|
| | | private int _fsc = 0;
|
| | | private int _ufid = 0;
|
| | | private string _fdr = "";
|
| | | private string _tpclid = "";
|
| | |
|
| | | public LocateEquipment(int m_CaseID, bool hasData,OracleConnection _Conn, OracleTransaction _Transaction)
|
| | | public LocateEquipment(int mCaseId, bool hasData, OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | String SqlStmt;
|
| | | OracleCommand Command = null;
|
| | | string sqlStmt;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | this.setCaseID(m_CaseID);
|
| | | SetCaseId(mCaseId);
|
| | |
|
| | | try
|
| | | {
|
| | | if (hasData)
|
| | | {
|
| | | SqlStmt = "SELECT DSUFID,FSC,UFID,FDR,TPCLID FROM EOS.EVENTRECORD_EX WHERE CASEID = " + m_CaseID;
|
| | | sqlStmt = "SELECT DSUFID,FSC,UFID,FDR,TPCLID FROM EOS.EVENTRECORD_EX WHERE CASEID = " + mCaseId;
|
| | |
|
| | | Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, conn, transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | this.setDSUFID(Convert.ToInt32(reader["DSUFID"].ToString()));
|
| | | this.setFSC(Convert.ToInt32(reader["FSC"].ToString()));
|
| | | this.setUFID(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | this.setFDR(reader["FDR"].ToString());
|
| | | this.setTPCLID(reader["TPCLID"].ToString());
|
| | | SetDsufid(Convert.ToInt32(reader["DSUFID"].ToString()));
|
| | | SetFsc(Convert.ToInt32(reader["FSC"].ToString()));
|
| | | SetUfid(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | SetFdr(reader["FDR"].ToString());
|
| | | SetTpclid(reader["TPCLID"].ToString());
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | SqlStmt = "SELECT UFID FROM EOS.DISASTER_EX WHERE ISDISASTER = " + CCS.LocalVariable.isDisaster;
|
| | | sqlStmt = "SELECT UFID FROM EOS.DISASTER_EX WHERE ISDISASTER = " + GlobalVariable.IsDisaster;
|
| | |
|
| | | Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, conn, transaction);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | this.setDSUFID(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | SetDsufid(Convert.ToInt32(reader["UFID"].ToString()));
|
| | | }
|
| | |
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public int getCaseID()
|
| | | public int GetCaseId()
|
| | | {
|
| | | return this.CaseID;
|
| | | return _caseId;
|
| | | }
|
| | |
|
| | | public void setCaseID(int m_CaseID)
|
| | | public void SetCaseId(int mCaseId)
|
| | | {
|
| | | this.CaseID = m_CaseID;
|
| | | _caseId = mCaseId;
|
| | | }
|
| | |
|
| | | public int getDSUFID()
|
| | | public int GetDsufid()
|
| | | {
|
| | | return this.DSUfid;
|
| | | return _dsUfid;
|
| | | }
|
| | |
|
| | | public void setDSUFID(int m_DSUfid)
|
| | | public void SetDsufid(int mDsUfid)
|
| | | {
|
| | | this.DSUfid = m_DSUfid;
|
| | | _dsUfid = mDsUfid;
|
| | | }
|
| | |
|
| | | public int getFSC()
|
| | | public int GetFsc()
|
| | | {
|
| | | return this.Fsc;
|
| | | return _fsc;
|
| | | }
|
| | |
|
| | | public void setFSC(int m_FSC)
|
| | | public void SetFsc(int mFsc)
|
| | | {
|
| | | this.Fsc = m_FSC;
|
| | | _fsc = mFsc;
|
| | | }
|
| | |
|
| | | public int getUFID()
|
| | | public int GetUfid()
|
| | | {
|
| | | return this.Ufid;
|
| | | return _ufid;
|
| | | }
|
| | |
|
| | | public void setUFID(int m_UFID)
|
| | | public void SetUfid(int mUfid)
|
| | | {
|
| | | this.Ufid = m_UFID;
|
| | | _ufid = mUfid;
|
| | | }
|
| | |
|
| | | public String getFDR()
|
| | | public string GetFdr()
|
| | | {
|
| | | return this.FDR;
|
| | | return _fdr;
|
| | | }
|
| | |
|
| | | public void setFDR(String m_FDR)
|
| | | public void SetFdr(string mFdr)
|
| | | {
|
| | | this.FDR = m_FDR;
|
| | | _fdr = mFdr;
|
| | | }
|
| | |
|
| | | public String getTPCLID()
|
| | | public string GetTpclid()
|
| | | {
|
| | | return this.TPCLID;
|
| | | return _tpclid;
|
| | | }
|
| | |
|
| | | public void setTPCLID(String m_TPCLID)
|
| | | public void SetTpclid(string mTpclid)
|
| | | {
|
| | | this.TPCLID = m_TPCLID;
|
| | | _tpclid = mTpclid;
|
| | | }
|
| | |
|
| | | public String getSqlStmt()
|
| | | public string GetSqlStmt()
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | SqlStmt = "INSERT INTO EOS.EVENTRECORD_EX (CASEID,DSUFID,FSC,UFID,TPCLID,FDR) VALUES(" + getCaseID() + "," + getDSUFID() + "," + getFSC()
|
| | | + "," + getUFID() + ",'" + getTPCLID() + "','" + getFDR() + "')";
|
| | | return SqlStmt;
|
| | | sqlStmt = "INSERT INTO EOS.EVENTRECORD_EX (CASEID,DSUFID,FSC,UFID,TPCLID,FDR) VALUES(" + GetCaseId() + "," + GetDsufid() + "," + GetFsc()
|
| | | + "," + GetUfid() + ",'" + GetTpclid() + "','" + GetFdr() + "')";
|
| | | return sqlStmt;
|
| | | }
|
| | |
|
| | | //public String getUpdateSqlStmt()
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | |
|
| | |
| | | {
|
| | | public class NumberContrast
|
| | | {
|
| | | private String CCSID;
|
| | | private String AcceptNum;
|
| | | private int CaseID;
|
| | | private string _ccsid;
|
| | | private string _acceptNum;
|
| | | private int _caseId;
|
| | |
|
| | | public NumberContrast()
|
| | | {
|
| | | }
|
| | |
|
| | | public void setCCSID(String m_CCSID)
|
| | | public void SetCcsid(string mCcsid)
|
| | | {
|
| | | this.CCSID = m_CCSID;
|
| | | _ccsid = mCcsid;
|
| | | }
|
| | |
|
| | | public String getCCSID()
|
| | | public string GetCcsid()
|
| | | {
|
| | | return this.CCSID;
|
| | | return _ccsid;
|
| | | }
|
| | |
|
| | | public void setAcceptNum(String m_AcceptNum)
|
| | | public void SetAcceptNum(string mAcceptNum)
|
| | | {
|
| | | this.AcceptNum = m_AcceptNum;
|
| | | _acceptNum = mAcceptNum;
|
| | | }
|
| | |
|
| | | public String getAcceptNum()
|
| | | public string GetAcceptNum()
|
| | | {
|
| | | return this.AcceptNum;
|
| | | return _acceptNum;
|
| | | }
|
| | |
|
| | | public void setCaseID(int m_CaseID)
|
| | | public void SetCaseId(int mCaseId)
|
| | | {
|
| | | this.CaseID = m_CaseID;
|
| | | _caseId = mCaseId;
|
| | | }
|
| | |
|
| | | public int getCaseID()
|
| | | public int GetCaseId()
|
| | | {
|
| | | return this.CaseID;
|
| | | return _caseId;
|
| | | }
|
| | |
|
| | | public bool Insert(OracleConnection _Conn,OracleTransaction _Transaction)
|
| | | public bool Insert(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | String SqlStmt;
|
| | | string sqlStmt;
|
| | |
|
| | | if (!Check())
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | SqlStmt = "INSERT INTO CCS.NUM_CONTRAST (CCSID,ACCEPTNUM,CASEID) VALUES ('" + CCSID + "','" + AcceptNum + "'," + CaseID + ")";
|
| | | sqlStmt = "INSERT INTO CCS.NUM_CONTRAST (CCSID,ACCEPTNUM,CASEID) VALUES ('" + _ccsid + "','" + _acceptNum + "'," + _caseId + ")";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | OracleCommand command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | if (Command.ExecuteNonQuery() > 0)
|
| | | if (command.ExecuteNonQuery() > 0)
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return true;
|
| | | }
|
| | |
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool Update(OracleConnection _Conn,OracleTransaction _Transaction)
|
| | | public bool Update(OracleConnection conn, OracleTransaction transaction)
|
| | | {
|
| | | if (!Check())
|
| | | {
|
| | | return false;
|
| | | }
|
| | | String SqlStmt = "UPDATE CCS.NUM_CONTRAST SET ACCEPTNUM='" + this.AcceptNum + "',CASEID=" + this.CaseID + " WHERE CCSID='" + this.CCSID + "'";
|
| | | string sqlStmt = "UPDATE CCS.NUM_CONTRAST SET ACCEPTNUM='" + _acceptNum + "',CASEID=" + _caseId + " WHERE CCSID='" + _ccsid + "'";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Conn, _Transaction);
|
| | | OracleCommand command = new OracleCommand(sqlStmt, conn, transaction);
|
| | |
|
| | | if (Command.ExecuteNonQuery() <= 0)
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool Check()
|
| | | {
|
| | | if (this.CCSID == null)
|
| | | if (_ccsid == null)
|
| | | return false;
|
| | |
|
| | | if (this.AcceptNum == null)
|
| | | if (_acceptNum == null)
|
| | | return false;
|
| | |
|
| | | if (CaseID == 0)
|
| | | if (_caseId == 0)
|
| | | return false;
|
| | |
|
| | | return true;
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Data.OracleClient;
|
| | | using System.Text;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using CCSTrace.CCS.Function;
|
| | | using CCSTrace.CCS.Object;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | |
| | |
|
| | | public class ProcessEvent
|
| | | {
|
| | | public event ThreadEndEventHandler ThreadFinish;
|
| | | private static Logger logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private CCS.Object.EventRecord m_EventRecord;
|
| | | private CCS.Object.CCSRecord m_CCSRecord;
|
| | | private RecordLog _PLog;
|
| | | private OracleConnection _ConnectionTPC;
|
| | | private OracleTransaction _Trx;
|
| | | private String _traceConnectionString = String.Empty;
|
| | | private readonly OracleConnection _connectionTpc;
|
| | | private readonly CcsRecord _mCcsRecord;
|
| | |
|
| | | public ProcessEvent(Object.CCSRecord _Record, OracleConnection _Conn, String _traceConnection)
|
| | | private EventRecord _mEventRecord;
|
| | | private readonly RecordLog _pLog;
|
| | | private readonly string _traceConnectionString = string.Empty;
|
| | | private OracleTransaction _trx;
|
| | |
|
| | | public ProcessEvent(CcsRecord record, OracleConnection conn, string traceConnection)
|
| | | {
|
| | | m_CCSRecord = _Record;
|
| | | _ConnectionTPC = _Conn;
|
| | | _traceConnectionString = _traceConnection;
|
| | | _PLog = new RecordLog(CCS.LocalVariable.CCS_ListPath + _Record.getCCSID() + ".txt");
|
| | | _mCcsRecord = record;
|
| | | _connectionTpc = conn;
|
| | | _traceConnectionString = traceConnection;
|
| | | _pLog = new RecordLog(GlobalVariable.CcsListPath + record.CcsId + ".txt");
|
| | | }
|
| | |
|
| | | public event ThreadEndEventHandler ThreadFinish;
|
| | |
|
| | | public void Run()
|
| | | {
|
| | | bool SendMail = false;
|
| | | var sendMail = false;
|
| | |
|
| | | try
|
| | | {
|
| | | int FDRID = getFDRID(m_CCSRecord.getMeter());
|
| | | var fdrid = GetFdrid(_mCcsRecord.Meter);
|
| | |
|
| | | if (FDRID != 0) //有饋線代號資料的案件才需比對同饋線上有無案件正在處理
|
| | | if (fdrid != 0) //有饋線代號資料的案件才需比對同饋線上有無案件正在處理
|
| | | {
|
| | | if (CCSMain.ProcessFDR.ContainsKey(FDRID.ToString()))
|
| | | if (CcsMain.ProcessFdr.ContainsKey(fdrid.ToString()))
|
| | | {
|
| | | CCSMain.WaitingCases.Add(new String[] { m_CCSRecord.getCCSID(), FDRID.ToString() });
|
| | | CcsMain.WaitingCases.Add(new[] {_mCcsRecord.CcsId, fdrid.ToString()});
|
| | | return;
|
| | | }
|
| | | else
|
| | | CCSMain.ProcessFDR.Add(FDRID.ToString(), null); //將要處理的案件的饋線別加入處理中饋線集合
|
| | | CcsMain.ProcessFdr.Add(fdrid.ToString(), null); //將要處理的案件的饋線別加入處理中饋線集合
|
| | | }
|
| | |
|
| | | /* int TraceCount = this.getTraceCount(m_CCSRecord.getCCSID());
|
| | | /* int TraceCount = this.getTraceCount(m_CCSRecord.CcsId);
|
| | | bool TraceError = false; //追蹤次數超過3次,改為非A類不追蹤合併
|
| | |
|
| | | switch (TraceCount)
|
| | | {
|
| | | case 0:
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(),true);
|
| | | UpdateTraceCount(m_CCSRecord.CcsId,true);
|
| | | TraceError = false;
|
| | | break;
|
| | |
|
| | | case 2:
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(),false);
|
| | | UpdateTraceCount(m_CCSRecord.CcsId,false);
|
| | | TraceError = true;
|
| | | break;
|
| | |
|
| | | default:
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(),false);
|
| | | UpdateTraceCount(m_CCSRecord.CcsId,false);
|
| | | TraceError = false;
|
| | | break;
|
| | | }
|
| | | */
|
| | | if (this.initialEventRecord(m_CCSRecord.getCCSID()))
|
| | | if (InitialEventRecord(_mCcsRecord.CcsId))
|
| | | {
|
| | | CCS.Function.Leach m_Leach = new CCS.Function.Leach(_ConnectionTPC, _Trx, _traceConnectionString, _PLog); // 案件過濾與合併
|
| | | _PLog.Info("過濾案件...");
|
| | | int Return_Status = m_Leach.LeachCase(m_EventRecord);
|
| | | var mLeach = new Leach(_connectionTpc, _trx, _traceConnectionString, _pLog); // 案件過濾與合併
|
| | | _pLog.Info("過濾案件...");
|
| | | var returnStatus = mLeach.LeachCase(_mEventRecord);
|
| | |
|
| | | switch ( Return_Status )
|
| | | switch (returnStatus)
|
| | | {
|
| | | case CCS.LocalVariable.Success:
|
| | | _PLog.Info("案件過濾完畢....");
|
| | | Process(CCS.LocalVariable.Success);
|
| | | case GlobalVariable.Success:
|
| | | _pLog.Info("案件過濾完畢....");
|
| | | Process(GlobalVariable.Success);
|
| | | break;
|
| | | case CCS.LocalVariable.NoMeter:
|
| | | _PLog.Info("案件過濾完畢,用戶無電號....");
|
| | | m_EventRecord.setTrace_Finish(CCS.LocalVariable.Trace_Finish);
|
| | | Process(CCS.LocalVariable.NoMeter);
|
| | |
|
| | | case GlobalVariable.NoMeter:
|
| | | _pLog.Info("案件過濾完畢,用戶無電號....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | | case CCS.LocalVariable.SameCustomer:
|
| | | _PLog.Info("相同用戶重複來電....");
|
| | | processSameCustomer(this.m_CCSRecord, this.m_EventRecord);
|
| | |
|
| | | case GlobalVariable.SameCustomer:
|
| | | _pLog.Info("相同用戶重複來電....");
|
| | | ProcessSameCustomer(_mCcsRecord, _mEventRecord);
|
| | | break;
|
| | | case CCS.LocalVariable.NoSupplyElc:
|
| | | _PLog.Warn("該饋線未供電,無法作事故案件追蹤合併....");
|
| | | m_EventRecord.setTrace_Finish(CCS.LocalVariable.Trace_Finish);
|
| | | Process(CCS.LocalVariable.NoMeter);
|
| | |
|
| | | case GlobalVariable.NoSupplyElc:
|
| | | _pLog.Warn("該饋線未供電,無法作事故案件追蹤合併....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | | case CCS.LocalVariable.No_Sxfmr:
|
| | | _PLog.Warn("該案件無變壓器....");
|
| | | m_EventRecord.setTrace_Finish(CCS.LocalVariable.Trace_Finish);
|
| | | Process(CCS.LocalVariable.NoMeter);
|
| | |
|
| | | case GlobalVariable.NoSxfmr:
|
| | | _pLog.Warn("該案件無變壓器....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | | case CCS.LocalVariable.CaseTypeChanged:
|
| | | _PLog.Info("變更案件狀態....");
|
| | | Process(CCS.LocalVariable.CaseTypeChanged);
|
| | |
|
| | | case GlobalVariable.CaseTypeChanged:
|
| | | _pLog.Info("變更案件狀態....");
|
| | | Process(GlobalVariable.CaseTypeChanged);
|
| | | break;
|
| | | case CCS.LocalVariable.Trace_Failure:
|
| | | _PLog.Error("故障追蹤錯誤,以一般無電號案件方式受理....");
|
| | | m_EventRecord.setTrace_Finish(CCS.LocalVariable.Trace_Finish);
|
| | | Process(CCS.LocalVariable.NoMeter);
|
| | |
|
| | | case GlobalVariable.TraceFailure:
|
| | | _pLog.Error("故障追蹤錯誤,以一般無電號案件方式受理....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | break;
|
| | |
|
| | | default:
|
| | | int TraceCount = this.getTraceCount(m_CCSRecord.getCCSID());
|
| | | var traceCount = GetTraceCount(_mCcsRecord.CcsId);
|
| | |
|
| | | if ( TraceCount < 2 )
|
| | | if (traceCount < 2)
|
| | | {
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _trx.Dispose();
|
| | |
|
| | | if (Return_Status == CCS.LocalVariable.CaseTransfer)
|
| | | _PLog.Error("案件已移轉,此事故案件暫不被受理....");
|
| | | else if (Return_Status == CCS.LocalVariable.Failure_By_DB)
|
| | | _PLog.Error("資料庫錯誤,此事故案件暫不被受理....");
|
| | | else if (Return_Status == CCS.LocalVariable.FDRLocked)
|
| | | _PLog.Error("饋線被鎖定,此事故案件暫不被受理....");
|
| | | if (returnStatus == GlobalVariable.CaseTransfer)
|
| | | _pLog.Error("案件已移轉,此事故案件暫不被受理....");
|
| | | else if (returnStatus == GlobalVariable.FailureByDb)
|
| | | _pLog.Error("資料庫錯誤,此事故案件暫不被受理....");
|
| | | else if (returnStatus == GlobalVariable.FdrLocked)
|
| | | _pLog.Error("饋線被鎖定,此事故案件暫不被受理....");
|
| | | else
|
| | | _PLog.Error("發生非預期錯誤,此事故案件暫不被受理....");
|
| | | _pLog.Error("發生非預期錯誤,此事故案件暫不被受理....");
|
| | |
|
| | | if (TraceCount == 0)
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(), true);
|
| | | if (traceCount == 0)
|
| | | UpdateTraceCount(_mCcsRecord.CcsId, true);
|
| | | else
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(), false);
|
| | |
|
| | | UpdateTraceCount(_mCcsRecord.CcsId, false);
|
| | | }
|
| | | else
|
| | | {
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(), false);
|
| | | if (Return_Status == CCS.LocalVariable.Trace_Counts_3)
|
| | | m_EventRecord.setNote(m_EventRecord.getNote() + "(本案用戶供電資料追蹤失敗)");
|
| | | UpdateTraceCount(_mCcsRecord.CcsId, false);
|
| | | if (returnStatus == GlobalVariable.TraceCounts3)
|
| | | _mEventRecord.Note = _mEventRecord.Note+ "(本案用戶供電資料追蹤失敗)";
|
| | |
|
| | | _PLog.Error("事故案件處理次數3次,仍無法正常處理,以一般無電號案件方式受理....");
|
| | | m_EventRecord.setTrace_Finish(CCS.LocalVariable.Trace_Finish);
|
| | | Process(CCS.LocalVariable.NoMeter);
|
| | | SendMail = true;
|
| | | _pLog.Error("事故案件處理次數3次,仍無法正常處理,以一般無電號案件方式受理....");
|
| | | _mEventRecord.TraceFinish = GlobalVariable.TraceFinish;
|
| | | Process(GlobalVariable.NoMeter);
|
| | | sendMail = true;
|
| | | }
|
| | | break;
|
| | | /* switch (TraceCount)
|
| | |
| | |
|
| | | _Trx.Dispose();
|
| | |
|
| | | if ( Return_Status == CCS.LocalVariable.CaseTransfer )
|
| | | if ( Return_Status == CCS.GlobalVariable.CaseTransfer )
|
| | | _PLog.Error("案件已移轉,此事故案件不被受理....");
|
| | | else if ( Return_Status == CCS.LocalVariable.Failure_By_DB )
|
| | | else if ( Return_Status == CCS.GlobalVariable.Failure_By_DB )
|
| | | _PLog.Error("資料庫錯誤,此事故案件不被受理....");
|
| | | else if ( Return_Status == CCS.LocalVariable.FDRLocked )
|
| | | else if ( Return_Status == CCS.GlobalVariable.FDRLocked )
|
| | | _PLog.Error("饋線被鎖定,此事故案件不被受理....");
|
| | | else
|
| | | _PLog.Error("此事故案件不被受理....");
|
| | |
|
| | |
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(), true);
|
| | | UpdateTraceCount(m_CCSRecord.CcsId, true);
|
| | | break;
|
| | |
|
| | | case 1:
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | |
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(), false);
|
| | | UpdateTraceCount(m_CCSRecord.CcsId, false);
|
| | |
|
| | | break;
|
| | |
|
| | | default://追蹤次數超過3次,改為非A類不追蹤合併
|
| | | UpdateTraceCount(m_CCSRecord.getCCSID(), false);
|
| | | if (Return_Status == CCS.LocalVariable.Trace_Counts_3)
|
| | | UpdateTraceCount(m_CCSRecord.CcsId, false);
|
| | | if (Return_Status == CCS.GlobalVariable.Trace_Counts_3)
|
| | | m_EventRecord.setNote(m_EventRecord.getNote() + "(本案用戶供電資料追蹤失敗)");
|
| | |
|
| | | _PLog.Error("追蹤次數3次,無法追蹤到故障設備,以一般無電號案件方式受理....");
|
| | | m_EventRecord.setTrace_Finish(CCS.LocalVariable.Trace_Finish);
|
| | | Process(CCS.LocalVariable.NoMeter);
|
| | | m_EventRecord.setTrace_Finish(CCS.GlobalVariable.Trace_Finish);
|
| | | Process(CCS.GlobalVariable.NoMeter);
|
| | | SendMail = true;
|
| | | break;
|
| | | }
|
| | |
|
| | | break;
|
| | | case CCS.LocalVariable.CaseTransfer:
|
| | |
|
| | | case CCS.GlobalVariable.CaseTransfer:
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _PLog.Error("案件已移轉,此事故案件不被受理....");
|
| | | break;
|
| | | case CCS.LocalVariable.FDRLocked:
|
| | |
|
| | | case CCS.GlobalVariable.FDRLocked:
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _PLog.Error("饋線被鎖定,此事故案件不被受理....");
|
| | | break;
|
| | | case CCS.LocalVariable.Failure_By_DB:
|
| | |
|
| | | case CCS.GlobalVariable.Failure_By_DB:
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _PLog.Error("資料庫錯誤,此事故案件不被受理....");
|
| | | break;
|
| | |
|
| | | default:
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if ( FDRID != 0 )
|
| | | CCSMain.ProcessFDR.Remove(FDRID.ToString());//將處理完的案件的饋線別從處理中饋線集合中移除
|
| | | if (fdrid != 0)
|
| | | CcsMain.ProcessFdr.Remove(fdrid.ToString()); //將處理完的案件的饋線別從處理中饋線集合中移除
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine("Error = " + e.Message + ". CCSID = " + m_CCSRecord.getCCSID());
|
| | | _PLog.Error("Error = " + e.Message + ". CCSID = " + m_CCSRecord.getCCSID());
|
| | | Console.WriteLine("Error = " + e.Message + ". CCSID = " + _mCcsRecord.CcsId);
|
| | | _pLog.Error("Error = " + e.Message + ". CCSID = " + _mCcsRecord.CcsId);
|
| | |
|
| | | if (_Trx != null)
|
| | | if (_trx != null)
|
| | | {
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _trx.Dispose();
|
| | | }
|
| | |
|
| | | if ( m_EventRecord!= null && m_EventRecord.getFdrID() != 0)
|
| | | CCSMain.ProcessFDR.Remove(m_EventRecord.getFdrID().ToString());//將處理完的案件的饋線別從處理中饋線集合中移除
|
| | | if (_mEventRecord != null && _mEventRecord.FdrId!= 0)
|
| | | CcsMain.ProcessFdr.Remove(_mEventRecord.FdrId.ToString()); //將處理完的案件的饋線別從處理中饋線集合中移除
|
| | | //throw e;
|
| | | }
|
| | | finally
|
| | | {
|
| | | _PLog.Close();
|
| | | CCSMain.ProcessCases.Remove(m_CCSRecord.getCCSID());
|
| | | this.OnThreadFinish(new ThreadEndEvent(_ConnectionTPC));
|
| | | _pLog.Close();
|
| | | CcsMain.ProcessCases.Remove(_mCcsRecord.CcsId);
|
| | | OnThreadFinish(new ThreadEndEvent(_connectionTpc));
|
| | | }
|
| | |
|
| | | if ( SendMail )
|
| | | new CCS.Function.MailService(_ConnectionTPC).SendMail(m_CCSRecord.getCCSID());
|
| | |
|
| | | if (sendMail)
|
| | | new MailService(_connectionTpc).SendMail(_mCcsRecord.CcsId);
|
| | | }
|
| | |
|
| | | private void Process(int Kind)
|
| | | private void Process(int kind)
|
| | | {
|
| | | CCS.FinishEvent FinishEvent = new CCS.FinishEvent();
|
| | | var finishEvent = new FinishEvent();
|
| | |
|
| | | try
|
| | | {
|
| | | if (FinishEvent.Finish(Kind, m_EventRecord, _ConnectionTPC, _Trx, _PLog))
|
| | | if (finishEvent.Finish(kind, _mEventRecord, _connectionTpc, _trx, _pLog))
|
| | | {
|
| | | _PLog.Info("OMS資料更新成功!");
|
| | | if (UpdateCCSData(m_EventRecord, m_CCSRecord, CCS.LocalVariable.WaitForDespatch))
|
| | | _pLog.Info("OMS資料更新成功!");
|
| | | if (UpdateCcsData(_mEventRecord, _mCcsRecord, (int) CCSCaseState.WaitForDespatch))
|
| | | {
|
| | | _PLog.Info("CCS資料更新成功!");
|
| | | _pLog.Info("CCS資料更新成功!");
|
| | | }
|
| | | else
|
| | | {
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _PLog.Error("CCS資料更新程序發生錯誤!");
|
| | | _trx.Dispose();
|
| | | _pLog.Error("CCS資料更新程序發生錯誤!");
|
| | | return;
|
| | |
|
| | | }
|
| | |
|
| | | // 須等全部動作都正確做完才可作commit的動作
|
| | | _Trx.Commit();
|
| | | _Trx.Dispose(); ;
|
| | | CCS.Object.AlarmData alarmClient = new CCS.Object.AlarmData(_ConnectionTPC, _Trx, _PLog);
|
| | | alarmClient.alarm(m_EventRecord.getAcceptNum(), m_EventRecord.getDept());
|
| | | _trx.Commit();
|
| | | _trx.Dispose();
|
| | | ;
|
| | | var alarmClient = new AlarmData(_connectionTpc, _trx, _pLog);
|
| | | alarmClient.Alarm(_mEventRecord.AcceptNum, _mEventRecord.Dept);
|
| | | }
|
| | | else
|
| | | {
|
| | | // 有錯誤需要RollBack
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | _Trx.Dispose(); ;
|
| | | _PLog.Error("OMS資料更新程序發生錯誤!");
|
| | | _trx.Dispose();
|
| | | ;
|
| | | _pLog.Error("OMS資料更新程序發生錯誤!");
|
| | | }
|
| | | _PLog.Info("CCS 案件受理程序結束.");
|
| | | _pLog.Info("CCS 案件受理程序結束.");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | throw e;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | protected virtual void OnThreadFinish(ThreadEndEvent e)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private bool UpdateCCSData(CCS.Object.EventRecord m_Record, CCS.Object.CCSRecord m_CCSRecord, int CaseStatus)
|
| | | private bool UpdateCcsData(EventRecord mRecord, CcsRecord mCcsRecord, int caseStatus)
|
| | | {
|
| | | _PLog.Info("進行CCS資料更新程序...");
|
| | | CCS.Object.EventQuery EventQuery = new CCS.Object.EventQuery();
|
| | | int Status = CaseStatus;
|
| | | _pLog.Info("進行CCS資料更新程序...");
|
| | | var eventQuery = new EventQuery();
|
| | | var status = caseStatus;
|
| | | // 設定CCSID
|
| | | EventQuery.setCCSID(m_CCSRecord.getCCSID());
|
| | | eventQuery.CcsId = mCcsRecord.CcsId;
|
| | | // 設定受理時間
|
| | | EventQuery.setChangeTime(m_CCSRecord.getAcceptTime());
|
| | | eventQuery.ChangeTime = mCcsRecord.AcceptTime;
|
| | | // 設定用戶電號
|
| | | if (m_CCSRecord.getMeter() != null)
|
| | | if (mCcsRecord.Meter != null)
|
| | | {
|
| | | EventQuery.setMeter(m_CCSRecord.getMeter());
|
| | | eventQuery.Meter = mCcsRecord.Meter;
|
| | | }
|
| | | // 如果該案件為子案件,需找出母案件的casestatus來insert eos.eventquery
|
| | | // 若母案件已派工,需一併紀錄預計復電時間等資訊
|
| | | if (m_Record.getParentID() != 0)
|
| | | if (mRecord.ParentId!= 0)
|
| | | {
|
| | | Status = this.getRealCaseStatus(m_Record.getParentID()) == CCS.LocalVariable.WaitForSponsor ? CCS.LocalVariable.EventDespatched
|
| | | : CCS.LocalVariable.WaitForDespatch;
|
| | | if (Status == CCS.LocalVariable.EventDespatched)
|
| | | status = GetRealCaseStatus(mRecord.ParentId) == (int) CCSCaseState.WaitForSponsor
|
| | | ? (int) CCSCaseState.EventDespatched
|
| | | : (int) CCSCaseState.WaitForDespatch;
|
| | | if (status == (int) CCSCaseState.EventDespatched)
|
| | | {
|
| | | setDespatchInfo(m_Record.getParentID(), EventQuery);
|
| | | SetDespatchInfo(mRecord.ParentId, eventQuery);
|
| | | }
|
| | | }
|
| | | // 若此案件為專案案件升級為母案件,則必須判斷原先案件是否已經派工
|
| | | if ((m_CCSRecord.getImportCase() == CCS.LocalVariable.isImportCase) && (m_Record.isDespatched()))
|
| | | if ((mCcsRecord.ImportCase == GlobalVariable.IsImportCase) && mRecord.IsDespatched)
|
| | | {
|
| | | Status = CCS.LocalVariable.EventDespatched;
|
| | | setDespatchInfo(m_Record.getCaseID(), EventQuery);
|
| | | status = (int) CCSCaseState.EventDespatched;
|
| | | SetDespatchInfo(mRecord.CaseId, eventQuery);
|
| | | }
|
| | | EventQuery.setCaseStatus(Status);
|
| | | eventQuery.CaseStatus = status;
|
| | | // 更新CCS.EventQuery
|
| | | if (!EventQuery.Update(_PLog,_ConnectionTPC,_Trx))
|
| | | if (!eventQuery.Update(_pLog, _connectionTpc, _trx))
|
| | | {
|
| | | _PLog.Error("更新ccs.eventquery失敗!");
|
| | | _pLog.Error("更新ccs.eventquery失敗!");
|
| | | return false;
|
| | | }
|
| | | else
|
| | | {
|
| | | _PLog.Info("更新ccs.eventquery成功!");
|
| | | CCS.Object.NumberContrast NumberContrast = new CCS.Object.NumberContrast();
|
| | | NumberContrast.setAcceptNum(m_Record.getAcceptNum());
|
| | | NumberContrast.setCaseID(m_Record.getCaseID());
|
| | | NumberContrast.setCCSID(m_CCSRecord.getCCSID());
|
| | | _pLog.Info("更新ccs.eventquery成功!");
|
| | | var numberContrast = new NumberContrast();
|
| | | numberContrast.SetAcceptNum(mRecord.AcceptNum);
|
| | | numberContrast.SetCaseId(mRecord.CaseId);
|
| | | numberContrast.SetCcsid(mCcsRecord.CcsId);
|
| | | // 更新CCS.Num_Contrast
|
| | | if (!NumberContrast.Update(_ConnectionTPC,_Trx))
|
| | | if (!numberContrast.Update(_connectionTpc, _trx))
|
| | | {
|
| | | _PLog.Error("更新ccs.num_contrast失敗!");
|
| | | _pLog.Error("更新ccs.num_contrast失敗!");
|
| | | return false;
|
| | | }
|
| | | _PLog.Info("更新ccs.num_contrast成功!");
|
| | | }
|
| | | _pLog.Info("更新ccs.num_contrast成功!");
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool initialEventRecord(String CCSID)
|
| | | private bool InitialEventRecord(string ccsid)
|
| | | {
|
| | | CCS.Function.InitialEventData InitialData = new CCS.Function.InitialEventData(_ConnectionTPC,_PLog);
|
| | | CCS.Object.NumberContrast m_Contrast = new CCS.Object.NumberContrast();
|
| | | CCS.Object.Dept_Contrast Dept_Contrast = null;
|
| | | var initialData = new InitialEventData(_connectionTpc, _pLog);
|
| | | var mContrast = new NumberContrast();
|
| | | DeptContrast deptContrast = null;
|
| | |
|
| | | // Being Transaction
|
| | | _Trx = _ConnectionTPC.BeginTransaction();
|
| | | _trx = _connectionTpc.BeginTransaction();
|
| | |
|
| | | Dept_Contrast = new CCS.Object.Dept_Contrast(_ConnectionTPC, _Trx);
|
| | | m_EventRecord = new CCS.Object.EventRecord(InitialData.getNewCaseID(), _ConnectionTPC, _Trx);
|
| | | m_EventRecord.setAcceptNum(InitialData.getNewAcceptNum());
|
| | | deptContrast = new DeptContrast(_connectionTpc, _trx);
|
| | | _mEventRecord = new EventRecord(initialData.GetNewCaseId(), _connectionTpc, _trx);
|
| | | _mEventRecord.AcceptNum = initialData.GetNewAcceptNum();
|
| | |
|
| | | m_Contrast.setAcceptNum(m_EventRecord.getAcceptNum());
|
| | | m_Contrast.setCaseID(m_EventRecord.getCaseID());
|
| | | m_Contrast.setCCSID(m_CCSRecord.getCCSID());
|
| | | mContrast.SetAcceptNum(_mEventRecord.AcceptNum);
|
| | | mContrast.SetCaseId(_mEventRecord.CaseId);
|
| | | mContrast.SetCcsid(_mCcsRecord.CcsId);
|
| | |
|
| | | if (!m_Contrast.Insert(_ConnectionTPC, _Trx))
|
| | | if (!mContrast.Insert(_connectionTpc, _trx))
|
| | | {
|
| | | _PLog.Error("初始化寫入CCS.Num_Contrast時發生錯誤!");
|
| | | _pLog.Error("初始化寫入CCS.Num_Contrast時發生錯誤!");
|
| | |
|
| | | if (_Trx.Connection.State.ToString().Equals("Open")) |
| | | _Trx.Rollback();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | return false;
|
| | | }
|
| | |
|
| | | // 設定用戶姓名
|
| | | m_EventRecord.setName(m_CCSRecord.getCustomerName());
|
| | | _mEventRecord.Name = _mCcsRecord.CustomerName;
|
| | |
|
| | | if (m_CCSRecord.getMeter() != null && m_CCSRecord.getMeter().Length != 0 )
|
| | | if (_mCcsRecord.Meter != null && _mCcsRecord.Meter.Length != 0)
|
| | | {
|
| | | // 需先找出部門代號,再找到該部門屬於哪一個巡修單位
|
| | | m_EventRecord.setMeter(m_CCSRecord.getMeter());
|
| | | int Tmp = Dept_Contrast.getDept_Code(m_CCSRecord.getMeter());
|
| | | _mEventRecord.Meter = _mCcsRecord.Meter;
|
| | | var tmp = deptContrast.getDept_Code(_mCcsRecord.Meter);
|
| | |
|
| | | if ( Tmp == -1 )
|
| | | m_EventRecord.setDept(findoutDeptByAddr(m_CCSRecord, _Trx));
|
| | | if (tmp == -1)
|
| | | _mEventRecord.Dept = FindoutDeptByAddr(_mCcsRecord, _trx);
|
| | | else
|
| | | m_EventRecord.setDept(Tmp);
|
| | | _mEventRecord.Dept = tmp;
|
| | |
|
| | | m_EventRecord.setFdrID(getFDRID(m_CCSRecord.getMeter()));
|
| | | _mEventRecord.FdrId = GetFdrid(_mCcsRecord.Meter);
|
| | | }
|
| | | else
|
| | | {
|
| | | // 當無用戶電號時,所找出的部門別不需再去找出屬於哪一個巡修股(findoutDeptByAddr會直接找到相對應的巡修股)
|
| | | int Dept = this.findoutDeptByAddr(m_CCSRecord, _Trx);
|
| | | m_EventRecord.setDept(Dept);
|
| | | var dept = FindoutDeptByAddr(_mCcsRecord, _trx);
|
| | | _mEventRecord.Dept = dept;
|
| | | }
|
| | | // 設定用戶電話號碼
|
| | | if (m_CCSRecord.getCustomerTel() != null)
|
| | | if (_mCcsRecord.CustomerTel != null)
|
| | | {
|
| | | m_EventRecord.setTel(m_CCSRecord.getCustomerTel());
|
| | | _mEventRecord.Tel = _mCcsRecord.CustomerTel;
|
| | | }
|
| | | // 檢查並設定用戶地址
|
| | | String m_Addr = m_CCSRecord.getADDR_City() + m_CCSRecord.getADDR_Town() + m_CCSRecord.getADDR_Road() + m_CCSRecord.getADDR_Other();
|
| | | var mAddr = _mCcsRecord.AddressCity + _mCcsRecord.AddressTown + _mCcsRecord.AddressRoad +
|
| | | _mCcsRecord.AddressOther;
|
| | |
|
| | | if (m_Addr.Trim().Length == 0)
|
| | | if (mAddr.Trim().Length == 0)
|
| | | {
|
| | | _PLog.Error("CCS 案件受理程序初始化失敗...地址為空白");
|
| | | _pLog.Error("CCS 案件受理程序初始化失敗...地址為空白");
|
| | |
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback() ;
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | return false;
|
| | | }
|
| | |
|
| | | m_EventRecord.setAddr(m_Addr);
|
| | | _mEventRecord.Addr = mAddr;
|
| | | // 設定事故原因
|
| | | m_EventRecord.setBrief(TransferEventBrief(m_CCSRecord.getEventBrief()));
|
| | | _mEventRecord.Brief = TransferEventBrief(_mCcsRecord.EventBrief);
|
| | | try
|
| | | {
|
| | | System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
|
| | | byte[] source = encoding.GetBytes(m_EventRecord.getBrief()); |
| | | var encoding = new ASCIIEncoding();
|
| | | var source = encoding.GetBytes(_mEventRecord.Brief);
|
| | |
|
| | | if (source.Length > 24)
|
| | | {
|
| | | byte[] dest = new byte[24];
|
| | | for (int i = 0; i < dest.Length; i++)
|
| | | var dest = new byte[24];
|
| | | for (var i = 0; i < dest.Length; i++)
|
| | | {
|
| | | dest[i] = source[i];
|
| | | }
|
| | |
|
| | | System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
| | | m_EventRecord.setBrief(enc.GetString(dest));
|
| | | var enc = Encoding.ASCII;
|
| | | _mEventRecord.Brief = enc.GetString(dest);
|
| | | source = dest = null;
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | m_EventRecord.setBrief("其他");
|
| | | _mEventRecord.Brief = "其他";
|
| | | }
|
| | |
|
| | | if (m_CCSRecord.getCCSID().StartsWith("A"))
|
| | | m_EventRecord.setLog("APP");
|
| | | else if (m_CCSRecord.getCCSID().StartsWith("W"))
|
| | | m_EventRecord.setLog("WEB");
|
| | | if (_mCcsRecord.CcsId.StartsWith("A"))
|
| | | _mEventRecord.Log = "APP";
|
| | | else if (_mCcsRecord.CcsId.StartsWith("W"))
|
| | | _mEventRecord.Log = "WEB";
|
| | | else
|
| | | m_EventRecord.setLog("CCS");
|
| | | _mEventRecord.Log = "CCS";
|
| | |
|
| | | m_EventRecord.setAcceptDate(m_CCSRecord.getAcceptTime());
|
| | | _mEventRecord.AcceptDate = _mCcsRecord.AcceptTime;
|
| | |
|
| | | // 設定用戶種類
|
| | | if (m_CCSRecord.getImportCase() == CCS.LocalVariable.isImportCase)
|
| | | if (_mCcsRecord.ImportCase == GlobalVariable.IsImportCase)
|
| | | {
|
| | | m_EventRecord.setImportCase(CCS.LocalVariable.isImportCase);
|
| | | m_EventRecord.setLevel(CCS.LocalVariable.A_Level); // default set A level
|
| | | _mEventRecord.ImportCase = GlobalVariable.IsImportCase;
|
| | | _mEventRecord.Level = GlobalVariable.ALevel; // default set A level
|
| | | }
|
| | | else
|
| | | {
|
| | | m_EventRecord.setImportCase(CCS.LocalVariable.NotImportCase);
|
| | | m_EventRecord.setLevel(CCS.LocalVariable.No_Level);
|
| | | _mEventRecord.ImportCase = GlobalVariable.NotImportCase;
|
| | | _mEventRecord.Level = GlobalVariable.NoLevel;
|
| | | }
|
| | |
|
| | | // 檢查字串中有無特殊字元' ,若有則取代為"
|
| | | if (m_CCSRecord.getNote() != null)
|
| | | m_EventRecord.setNote(m_CCSRecord.getNote().Replace('\'', '\"'));
|
| | |
|
| | | if (_mCcsRecord.Note != null)
|
| | | _mEventRecord.Note = _mCcsRecord.Note.Replace('\'', '\"');
|
| | |
|
| | | // 設定回覆姓名及電話
|
| | | if (m_CCSRecord.getRecallName() != null)
|
| | | if (_mCcsRecord.RecallName != null)
|
| | | {
|
| | | m_EventRecord.setisReCall(CCS.LocalVariable.isReCall);
|
| | | m_EventRecord.setReCallName(m_CCSRecord.getRecallName().Replace('\'', '\"'));
|
| | | m_EventRecord.setReCallTel(m_CCSRecord.getRecallTel());
|
| | | _mEventRecord.IsReCall = GlobalVariable.IsReCall;
|
| | | _mEventRecord.ReCallName = _mCcsRecord.RecallName.Replace('\'', '\"');
|
| | | _mEventRecord.ReCallTel = _mCcsRecord.RecallTel;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_EventRecord.setisReCall(CCS.LocalVariable.NotReCall);
|
| | | _mEventRecord.IsReCall = GlobalVariable.NotReCall;
|
| | | }
|
| | |
|
| | | _PLog.Info("初始化EOS.EVENTRECORD成功!");
|
| | | _pLog.Info("初始化EOS.EVENTRECORD成功!");
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | // return true;
|
| | | //}
|
| | |
|
| | | private void checkCaseAlreadyExits(CCS.Object.EventQuery m_EventQuery)
|
| | | private void CheckCaseAlreadyExits(EventQuery mEventQuery)
|
| | | {
|
| | | String SqlStmt = "select ccsid from ccs.eventquery where ccsid='" + m_EventQuery.getCCSID() + "'";
|
| | | var sqlStmt = "select ccsid from ccs.eventquery where ccsid='" + mEventQuery.CcsId + "'";
|
| | |
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Trx);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | var command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | | var reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | Command.CommandText = "delete from ccs.eventquery where ccsid='" + m_EventQuery.getCCSID() + "'";
|
| | | Command.ExecuteNonQuery();
|
| | | command.CommandText = "delete from ccs.eventquery where ccsid='" + mEventQuery.CcsId + "'";
|
| | | command.ExecuteNonQuery();
|
| | |
|
| | | Command.CommandText = "delete from ccs.num_contrast where ccsid='" + m_EventQuery.getCCSID() + "'";
|
| | | Command.ExecuteNonQuery();
|
| | | command.CommandText = "delete from ccs.num_contrast where ccsid='" + mEventQuery.CcsId + "'";
|
| | | command.ExecuteNonQuery();
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | _PLog.Warn("Problems occur during checking process: " + ex.Message);
|
| | | _pLog.Warn("Problems occur during checking process: " + ex.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | private int findoutDeptByAddr(CCS.Object.CCSRecord CCSRecord, OracleTransaction _Trx)
|
| | | private int FindoutDeptByAddr(CcsRecord ccsRecord, OracleTransaction trx)
|
| | | {
|
| | | CCS.Object.Addr_Contrast Addr_Contrast = new CCS.Object.Addr_Contrast(_ConnectionTPC, _Trx, _PLog);
|
| | | return Addr_Contrast.findDeptID(CCSRecord.getADDR_City(), CCSRecord.getADDR_Town(), CCSRecord.getADDR_Road());
|
| | | var addrContrast = new AddrContrast(_connectionTpc, trx, _pLog);
|
| | | return addrContrast.FindDeptId(ccsRecord.AddressCity, ccsRecord.AddressTown, ccsRecord.AddressRoad);
|
| | | }
|
| | |
|
| | | private String TransferEventBrief(int Code)
|
| | | private string TransferEventBrief(int code)
|
| | | {
|
| | | String Result = "";
|
| | | Result = CCS.CCSMain.CCSCodelist.getContent(CCS.LocalVariable.CCSEventBrief, Code);
|
| | | var result = "";
|
| | | result = GlobalVariable.CcsCodelist.GetContent(GlobalVariable.CcsEventBrief, code);
|
| | |
|
| | | // int MaxLength = this.getFieldLength("EOS", "EVENTRECORD", "EVENTBRIEF");
|
| | |
|
| | | // if ( Result.ToCharArray().Length > MaxLength )
|
| | | // Result.ToCharArray
|
| | |
|
| | | return Result;
|
| | | return result;
|
| | | }
|
| | |
|
| | | private int TransferDept(String DeptCode)
|
| | | private int TransferDept(string deptCode)
|
| | | {
|
| | | // 傳入部門的英文value(CONTENT),傳回相對應的keyid
|
| | | return CCS.CCSMain.CCSCodelist.getKeyID(CCS.LocalVariable.CCSDept, DeptCode);
|
| | | return GlobalVariable.CcsCodelist.GetKeyId(GlobalVariable.CcsDept, deptCode);
|
| | | }
|
| | |
|
| | | private int getRealCaseStatus(int ParentID)
|
| | | private int GetRealCaseStatus(int parentId)
|
| | | {
|
| | | String SqlStmt;
|
| | | int Status = CCS.LocalVariable.WaitForDespatch;
|
| | | string sqlStmt;
|
| | | var status = (int) CCSCaseState.WaitForDespatch;
|
| | |
|
| | | SqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + ParentID;
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Trx);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | |
|
| | | sqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + parentId;
|
| | | var command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | | var reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | {
|
| | | Status = Convert.ToInt32(reader["CaseStatus"].ToString());
|
| | | status = Convert.ToInt32(reader["CaseStatus"].ToString());
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _PLog.Warn("無法取得正確之母案件狀態.");
|
| | | _pLog.Warn("無法取得正確之母案件狀態.");
|
| | | }
|
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | return Status;
|
| | | return status;
|
| | | }
|
| | |
|
| | | private void setDespatchInfo(int m_CaseID, CCS.Object.EventQuery m_EventQry)
|
| | | private void SetDespatchInfo(int mCaseId, EventQuery mEventQry)
|
| | | {
|
| | | String SqlStmt = "select despatchtime,assumefixtime,assumedtime_nth,delaytime,reason,eventlocation from eos.eventdespatch where caseid="
|
| | | + m_CaseID;
|
| | | var sqlStmt = "select despatchtime,assumefixtime,assumedtime_nth,delaytime,reason,eventlocation from eos.eventdespatch where caseid="
|
| | | + mCaseId;
|
| | |
|
| | | OracleCommand Command = null;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | try
|
| | | {
|
| | | Command = new OracleCommand(SqlStmt, _ConnectionTPC,_Trx);
|
| | | reader = Command.ExecuteReader();
|
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | {
|
| | | m_EventQry.setChangeTime(Convert.ToDateTime(reader["despatchtime"]).ToString("yyy/MM/dd HH:mm:ss"));
|
| | | m_EventQry.setAssumedTime(Convert.ToDateTime(reader["assumefixtime"]).ToString("yyy/MM/dd HH:mm:ss"));
|
| | | m_EventQry.setAssumedTime_Nth(Convert.ToDateTime(reader["assumedtime_nth"]).ToString("yyy/MM/dd HH:mm:ss"));
|
| | | m_EventQry.setDelayTimes(Convert.ToInt32(reader["delaytime"].ToString()));
|
| | | m_EventQry.setReason(reader["reason"].ToString());
|
| | | m_EventQry.setEventLocation(reader["eventlocation"].ToString());
|
| | | mEventQry.ChangeTime = Convert.ToDateTime(reader["despatchtime"]).ToString("yyy/MM/dd HH:mm:ss");
|
| | | mEventQry.AssumedTime = Convert.ToDateTime(reader["assumefixtime"]).ToString("yyy/MM/dd HH:mm:ss");
|
| | | mEventQry.AssumedTimeNth =
|
| | | Convert.ToDateTime(reader["assumedtime_nth"]).ToString("yyy/MM/dd HH:mm:ss");
|
| | | mEventQry.DelayTimes = Convert.ToInt32(reader["delaytime"].ToString());
|
| | | mEventQry.Reason = reader["reason"].ToString();
|
| | | mEventQry.EventLocation = reader["eventlocation"].ToString();
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _PLog.Warn("無法取得母案件派工資訊.");
|
| | | _pLog.Warn("無法取得母案件派工資訊.");
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (reader != null )
|
| | | reader.Close();
|
| | |
|
| | | if (Command != null)
|
| | | Command.Dispose();
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | private void processSameCustomer(CCS.Object.CCSRecord m_CCSRecord, CCS.Object.EventRecord m_EventRec)
|
| | | private void ProcessSameCustomer(CcsRecord mCcsRecord, EventRecord mEventRec)
|
| | | {
|
| | | _PLog.Info("處理相同用戶重複來電...");
|
| | | _pLog.Info("處理相同用戶重複來電...");
|
| | | StringBuilder note = null;
|
| | |
|
| | | String SqlStmt = "select note from eos.eventrecord where caseid = " + m_EventRec.getTmpCaseID();
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Trx);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | var sqlStmt = "select note from eos.eventrecord where caseid = " + mEventRec.TmpCaseId;
|
| | | var command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | | var reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | if ((!note.ToString().EndsWith("|")) && (!note.ToString().Trim().Equals("")))
|
| | | if (!note.ToString().EndsWith("|") && !note.ToString().Trim().Equals(""))
|
| | | note.Append(" | ");
|
| | |
|
| | | if ((m_EventRec.getNote() != null) && (m_EventRec.getNote().Length != 0))
|
| | | note.Append(m_EventRec.getAcceptDate() + " " + m_EventRec.getNote());
|
| | | if ((mEventRec.Note!= null) && (mEventRec.Note.Length != 0))
|
| | | note.Append(mEventRec.AcceptDate+ " " + mEventRec.Note);
|
| | | else
|
| | | note.Append(m_EventRec.getAcceptDate() + " 用戶再次報案");
|
| | |
|
| | | note.Append(mEventRec.AcceptDate+ " 用戶再次報案");
|
| | |
|
| | | // 判斷重複來電的用戶最初成立的案件是否是由CCS受理
|
| | | bool acceptByCCS = false;
|
| | | var acceptByCcs = false;
|
| | |
|
| | | String SqlStmt1 = "select count(*) as count from ccs.num_contrast c,ccs.eventquery q where c.ccsid=q.ccsid and caseid="
|
| | | + m_EventRec.getTmpCaseID();
|
| | | OracleCommand Command1 = new OracleCommand(SqlStmt1, _ConnectionTPC,_Trx);
|
| | | OracleDataReader reader1 = Command1.ExecuteReader();
|
| | | var sqlStmt1 = "select count(*) as count from ccs.num_contrast c,ccs.eventquery q where c.ccsid=q.ccsid and caseid="
|
| | | + mEventRec.TmpCaseId;
|
| | | var command1 = new OracleCommand(sqlStmt1, _connectionTpc, _trx);
|
| | | var reader1 = command1.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | {
|
| | | if (Convert.ToInt32(reader1["count"].ToString()) != 0)
|
| | | {
|
| | | acceptByCCS = true;
|
| | | acceptByCcs = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | finally
|
| | | {
|
| | | reader1.Close();
|
| | | Command1.Dispose();
|
| | | command1.Dispose();
|
| | | }
|
| | |
|
| | | String updCCSEventQuery = null;
|
| | | string updCcsEventQuery = null;
|
| | | // 若先前案件由CCS受理,則直接從ccs.eventquery取出先前的案件狀態資料寫入
|
| | | if (acceptByCCS)
|
| | | if (acceptByCcs)
|
| | | {
|
| | | updCCSEventQuery = "update ccs.eventquery set (casestatus,changetime,handlingsummary,assumedtime,assumedtime_nth,delaytimes,reason,eventlocation) = (select casestatus,changetime,handlingsummary,assumedtime,assumedtime_nth,delaytimes,reason,eventlocation from ccs.eventquery where ccsid=(select ccsid from ccs.num_contrast where caseid="
|
| | | + m_EventRec.getTmpCaseID() + " and rownum<2)) where CCSID='" + m_CCSRecord.getCCSID() + "'";
|
| | | updCcsEventQuery = "update ccs.eventquery set (casestatus,changetime,handlingsummary,assumedtime,assumedtime_nth,delaytimes,reason,eventlocation) = (select casestatus,changetime,handlingsummary,assumedtime,assumedtime_nth,delaytimes,reason,eventlocation from ccs.eventquery where ccsid=(select ccsid from ccs.num_contrast where caseid="
|
| | | + mEventRec.TmpCaseId+ " and rownum<2)) where CCSID='" + mCcsRecord.CcsId + "'";
|
| | | // 若非由CCS受理(OMS,Web)則從EOS的table中尋找先前案件的狀態資料
|
| | | }
|
| | | else
|
| | | {
|
| | | String accepttime = null, despatchtime = null, sponsortime = null, assumefixtime = null, assumedtime_nth = null, changetime = null, handling = null, reason = null, eventlocation = null;
|
| | | string accepttime = null,
|
| | | despatchtime = null,
|
| | | sponsortime = null,
|
| | | assumefixtime = null,
|
| | | assumedtimeNth = null,
|
| | | changetime = null,
|
| | | handling = null,
|
| | | reason = null,
|
| | | eventlocation = null;
|
| | | int casestatus = 0, delaytime = 0;
|
| | |
|
| | | OracleCommand Command2 = null;
|
| | | OracleCommand command2 = null;
|
| | | OracleDataReader reader2 = null;
|
| | |
|
| | | try
|
| | | {
|
| | | var sqlStmt2 = "select 1,to_char(r.accepttime,'YYYY/MM/DD HH24:MI:SS') as ACCEPTTIME,to_char(d.despatchtime,'YYYY/MM/DD HH24:MI:SS') as DESPATCHTIME,to_char(s.reconditiontime,'YYYY/MM/DD HH24:MI:SS')SPONSORTIME,e.casestatus,s.handling,to_char(d.assumefixtime,'YYYY/MM/DD HH24:MI:SS') as assumefixtime,to_char(d.assumedtime_nth,'YYYY/MM/DD HH24:MI:SS') as assumedtime_nth,d.delaytime,d.reason,d.eventlocation from eos.eventrecord r,eos.events e,eos.eventdespatch d,eos.eventsponsor s where (r.caseid=e.caseid) and (r.caseid=d.caseid(+)) and (r.caseid=s.caseid(+)) and r.caseid="
|
| | | + mEventRec.TmpCaseId + " union "
|
| | | +
|
| | | "select 2,to_char(r.accepttime,'YYYY/MM/DD HH24:MI:SS') as ACCEPTTIME,to_char(d.despatchtime,'YYYY/MM/DD HH24:MI:SS') as DESPATCHTIME,to_char(s.reconditiontime,'YYYY/MM/DD HH24:MI:SS')SPONSORTIME,e.casestatus,s.handling,to_char(d.assumefixtime,'YYYY/MM/DD HH24:MI:SS') as assumefixtime,to_char(d.assumedtime_nth,'YYYY/MM/DD HH24:MI:SS') as assumedtime_nth,d.delaytime,d.reason,d.eventlocation from eos.eventrecord r,eos.events e,eos.eventdespatch d,eos.eventsponsor s where (r.caseid=e.caseid) and (r.caseid=d.caseid(+)) and (r.caseid=s.caseid(+)) and r.caseid= (select parentid from eos.mergecase where caseid="
|
| | | + mEventRec.TmpCaseId+ ")";
|
| | |
|
| | | String SqlStmt2 = "select 1,to_char(r.accepttime,'YYYY/MM/DD HH24:MI:SS') as ACCEPTTIME,to_char(d.despatchtime,'YYYY/MM/DD HH24:MI:SS') as DESPATCHTIME,to_char(s.reconditiontime,'YYYY/MM/DD HH24:MI:SS')SPONSORTIME,e.casestatus,s.handling,to_char(d.assumefixtime,'YYYY/MM/DD HH24:MI:SS') as assumefixtime,to_char(d.assumedtime_nth,'YYYY/MM/DD HH24:MI:SS') as assumedtime_nth,d.delaytime,d.reason,d.eventlocation from eos.eventrecord r,eos.events e,eos.eventdespatch d,eos.eventsponsor s where (r.caseid=e.caseid) and (r.caseid=d.caseid(+)) and (r.caseid=s.caseid(+)) and r.caseid="
|
| | | + m_EventRec.getTmpCaseID()
|
| | | + " union "
|
| | | + "select 2,to_char(r.accepttime,'YYYY/MM/DD HH24:MI:SS') as ACCEPTTIME,to_char(d.despatchtime,'YYYY/MM/DD HH24:MI:SS') as DESPATCHTIME,to_char(s.reconditiontime,'YYYY/MM/DD HH24:MI:SS')SPONSORTIME,e.casestatus,s.handling,to_char(d.assumefixtime,'YYYY/MM/DD HH24:MI:SS') as assumefixtime,to_char(d.assumedtime_nth,'YYYY/MM/DD HH24:MI:SS') as assumedtime_nth,d.delaytime,d.reason,d.eventlocation from eos.eventrecord r,eos.events e,eos.eventdespatch d,eos.eventsponsor s where (r.caseid=e.caseid) and (r.caseid=d.caseid(+)) and (r.caseid=s.caseid(+)) and r.caseid= (select parentid from eos.mergecase where caseid="
|
| | | + m_EventRec.getTmpCaseID() + ")";
|
| | |
|
| | | Command2 = new OracleCommand(SqlStmt2, _ConnectionTPC, _Trx);
|
| | | reader2 = Command2.ExecuteReader();
|
| | | command2 = new OracleCommand(sqlStmt2, _connectionTpc, _trx);
|
| | | reader2 = command2.ExecuteReader();
|
| | |
|
| | | while (reader2.Read())
|
| | | {
|
| | |
| | | despatchtime = reader2["DESPATCHTIME"].ToString();
|
| | | sponsortime = reader2["SPONSORTIME"].ToString();
|
| | | assumefixtime = reader2["ASSUMEFIXTIME"] == null ? "" : reader2["ASSUMEFIXTIME"].ToString();
|
| | | assumedtime_nth = reader2["ASSUMEDTIME_NTH"] == null ? "" : reader2["ASSUMEDTIME_NTH"].ToString();
|
| | | assumedtimeNth = reader2["ASSUMEDTIME_NTH"] == null ? "" : reader2["ASSUMEDTIME_NTH"].ToString();
|
| | | handling = reader2["HANDLING"] == null ? "" : reader2["HANDLING"].ToString();
|
| | | reason = reader2["REASON"] == null ? "" : reader2["REASON"].ToString();
|
| | | casestatus = Convert.ToInt32(reader2["CASESTATUS"].ToString());
|
| | | delaytime = reader2["DELAYTIME"].ToString().Length == 0 ? 0 : Convert.ToInt32(reader2["DELAYTIME"].ToString());
|
| | | delaytime = reader2["DELAYTIME"].ToString().Length == 0
|
| | | ? 0
|
| | | : Convert.ToInt32(reader2["DELAYTIME"].ToString());
|
| | | eventlocation = reader2["EVENTLOCATION"] == null ? "" : reader2["EVENTLOCATION"].ToString();
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | changetime = accepttime;
|
| | | }
|
| | | if (despatchtime != null && despatchtime.Length != 0)
|
| | | if (!string.IsNullOrEmpty(despatchtime))
|
| | | {
|
| | | changetime = despatchtime;
|
| | | }
|
| | | if (sponsortime != null && sponsortime.Length != 0)
|
| | | if (!string.IsNullOrEmpty(sponsortime))
|
| | | {
|
| | | changetime = sponsortime;
|
| | | }
|
| | | updCCSEventQuery = "update ccs.eventquery set casestatus=" + casestatus + ",changetime=to_date('" + changetime
|
| | | + "','YYYY/MM/DD HH24:MI:SS'),handlingsummary='" + handling + "',assumedtime=to_date('" + assumefixtime
|
| | | + "','YYYY/MM/DD HH24:MI:SS'),assumedtime_nth=to_date('" + assumedtime_nth + "','YYYY/MM/DD HH24:MI:SS'),delaytimes="
|
| | | + delaytime + ",reason='" + reason + "',eventlocation='" + eventlocation + "' where ccsid='" + m_CCSRecord.getCCSID() + "'";
|
| | | updCcsEventQuery = "update ccs.eventquery set casestatus=" + casestatus + ",changetime=to_date('" +
|
| | | changetime
|
| | | + "','YYYY/MM/DD HH24:MI:SS'),handlingsummary='" + handling +
|
| | | "',assumedtime=to_date('" + assumefixtime
|
| | | + "','YYYY/MM/DD HH24:MI:SS'),assumedtime_nth=to_date('" + assumedtimeNth +
|
| | | "','YYYY/MM/DD HH24:MI:SS'),delaytimes="
|
| | | + delaytime + ",reason='" + reason + "',eventlocation='" + eventlocation +
|
| | | "' where ccsid='" + mCcsRecord.CcsId + "'";
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | if (reader2 != null)
|
| | | reader2.Close();
|
| | |
|
| | | if (Command2 != null)
|
| | | Command2.Dispose();
|
| | | if (command2 != null)
|
| | | command2.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | String updEOSEventRecord = "update eos.eventrecord set note = '" + TrimToLimit(note.ToString(), 127)
|
| | | + "' where caseid = " + m_EventRecord.getTmpCaseID();
|
| | | String updCCSNum_Contrast = "update ccs.num_contrast set(acceptnum,caseid) = (select acceptnum," + m_EventRec.getTmpCaseID()
|
| | | + " from eos.eventrecord where caseid = " + m_EventRec.getTmpCaseID() + ") where ccsid='" + m_CCSRecord.getCCSID() + "'";
|
| | | 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+
|
| | | ") where ccsid='" + mCcsRecord.CcsId + "'";
|
| | |
|
| | | OracleCommand ExeCommand = new OracleCommand(updCCSEventQuery, _ConnectionTPC,_Trx);
|
| | | var exeCommand = new OracleCommand(updCcsEventQuery, _connectionTpc, _trx);
|
| | | // 將用戶重複來電案件資料寫回CCS.EventQuery
|
| | | if (ExeCommand.ExecuteNonQuery() <= 0)
|
| | | if (exeCommand.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | ExeCommand.Dispose();
|
| | | exeCommand.Dispose();
|
| | |
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _PLog.Error("Fail in write back to ccs.eventquery");
|
| | | _trx.Dispose();
|
| | | _pLog.Error("Fail in write back to ccs.eventquery");
|
| | | return;
|
| | | }
|
| | |
|
| | | ExeCommand.CommandText = updEOSEventRecord;
|
| | | exeCommand.CommandText = updEosEventRecord;
|
| | | // 將CCS案件備註資料Append到EOS.EventRecord
|
| | | if (ExeCommand.ExecuteNonQuery() <= 0)
|
| | | if (exeCommand.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | ExeCommand.Dispose();
|
| | | exeCommand.Dispose();
|
| | |
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _PLog.Error("Fail in update eos.eventquery");
|
| | | _trx.Dispose();
|
| | | _pLog.Error("Fail in update eos.eventquery");
|
| | | return;
|
| | | }
|
| | |
|
| | | ExeCommand.CommandText = updCCSNum_Contrast;
|
| | | exeCommand.CommandText = updCcsNumContrast;
|
| | | // 寫入ccsid <=> caseid 到CCS.Num_Contrast
|
| | | if (ExeCommand.ExecuteNonQuery() <= 0)
|
| | | if (exeCommand.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | ExeCommand.Dispose();
|
| | | if (_Trx.Connection.State.ToString().Equals("Open"))
|
| | | _Trx.Rollback();
|
| | | exeCommand.Dispose();
|
| | | if (_trx.Connection.State.ToString().Equals("Open"))
|
| | | _trx.Rollback();
|
| | |
|
| | | _Trx.Dispose();
|
| | | _PLog.Error("Fail in insert into ccs.num_contrast");
|
| | | _trx.Dispose();
|
| | | _pLog.Error("Fail in insert into ccs.num_contrast");
|
| | | return;
|
| | | }
|
| | |
|
| | | ExeCommand.Dispose();
|
| | | _Trx.Commit();
|
| | | _Trx.Dispose();
|
| | | _PLog.Info("CCS 案件受理程序結束");
|
| | | exeCommand.Dispose();
|
| | | _trx.Commit();
|
| | | _trx.Dispose();
|
| | | _pLog.Info("CCS 案件受理程序結束");
|
| | | }
|
| | |
|
| | | private String TrimToLimit(String Msg, int MaxLen)
|
| | | private string TrimToLimit(string msg, int maxLen)
|
| | | {
|
| | | try
|
| | | {
|
| | | if (Msg.Length <= 1)
|
| | | if (msg.Length <= 1)
|
| | | {
|
| | | return "";
|
| | | }
|
| | | if (Msg.Length <= MaxLen)
|
| | | if (msg.Length <= maxLen)
|
| | | {
|
| | | return Msg;
|
| | | return msg;
|
| | | }
|
| | | Msg = Msg.Substring(Msg.IndexOf("|") + 1);
|
| | | return TrimToLimit(Msg, MaxLen);
|
| | | msg = msg.Substring(msg.IndexOf("|") + 1);
|
| | | return TrimToLimit(msg, maxLen);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private int getFieldLength(String Owner, String TableName, String FieldName)
|
| | | private int GetFieldLength(string owner, string tableName, string fieldName)
|
| | | {
|
| | | String SqlStmt = "SELECT DATA_LENGTH FROM ALL_TAB_COLUMNS WHERE OWNER = '" + Owner + "' AND TABLE_NAME = '" + TableName + "' AND COLUMN_NAME = '" + FieldName + "'";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Trx);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | int MaxLength = -1;
|
| | | var sqlStmt = "SELECT DATA_LENGTH FROM ALL_TAB_COLUMNS WHERE OWNER = '" + owner + "' AND TABLE_NAME = '" +
|
| | | tableName + "' AND COLUMN_NAME = '" + fieldName + "'";
|
| | | var command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | | var reader = command.ExecuteReader();
|
| | | var maxLength = -1;
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | MaxLength = Convert.ToInt32(reader["DATA_LENGTH"].ToString());
|
| | | maxLength = Convert.ToInt32(reader["DATA_LENGTH"].ToString());
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return MaxLength;
|
| | | return maxLength;
|
| | | }
|
| | |
|
| | | private int getFDRID(string Meter)
|
| | | private int GetFdrid(string meter)
|
| | | {
|
| | | string SqlStmt = "SELECT TRAN_CORD FROM BASEDB.METER WHERE METR_NUMB = '" + Meter + "'"; |
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Trx);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | string TPCLID = "";
|
| | | int FDRID = 0;
|
| | | String group = "";
|
| | | var sqlStmt = "SELECT TRAN_CORD FROM BASEDB.METER WHERE METR_NUMB = '" + meter + "'";
|
| | | var command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | | var reader = command.ExecuteReader();
|
| | | var tpclid = "";
|
| | | var fdrid = 0;
|
| | | var group = "";
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | TPCLID = reader["TRAN_CORD"].ToString();
|
| | | tpclid = reader["TRAN_CORD"].ToString();
|
| | |
|
| | | if ( TPCLID.Length == 0 )
|
| | | return FDRID;
|
| | | if (tpclid.Length == 0)
|
| | | return fdrid;
|
| | |
|
| | | if (TPCLID.Length > 11)
|
| | | if (tpclid.Length > 11)
|
| | | {
|
| | | group = TPCLID.Substring(TPCLID.Length - 3);
|
| | | TPCLID = TPCLID.Substring(0, 11).Trim();
|
| | | SqlStmt = "SELECT FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = 115 AND UFID = (SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" + TPCLID |
| | | group = tpclid.Substring(tpclid.Length - 3);
|
| | | tpclid = tpclid.Substring(0, 11).Trim();
|
| | | sqlStmt =
|
| | | "SELECT FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = 115 AND UFID = (SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" +
|
| | | tpclid
|
| | | + "' AND GROUP1='" + group + "' AND ROWNUM < 2)";
|
| | | }
|
| | | else
|
| | | {
|
| | | SqlStmt = "SELECT FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = 115 AND UFID = (SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" + TPCLID |
| | | sqlStmt =
|
| | | "SELECT FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = 115 AND UFID = (SELECT UFID FROM BASEDB.SXFMR WHERE OWNERTPCLID = '" +
|
| | | tpclid
|
| | | + "' AND ROWNUM < 2)";
|
| | | }
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | reader = Command.ExecuteReader();
|
| | | command.CommandText = sqlStmt;
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | FDRID = Convert.ToInt32(reader["FDR1"].ToString());
|
| | | fdrid = Convert.ToInt32(reader["FDR1"].ToString());
|
| | | else
|
| | | {
|
| | | SqlStmt = "SELECT FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = 107 AND UFID = (SELECT UFID FROM BASEDB.HICUSTOMER WHERE OWNERTPCLID = '" + TPCLID + "' AND ROWNUM < 2)";
|
| | | sqlStmt =
|
| | | "SELECT FDR1 FROM BASEDB.CONNECTIVITY WHERE FSC = 107 AND UFID = (SELECT UFID FROM BASEDB.HICUSTOMER WHERE OWNERTPCLID = '" +
|
| | | tpclid + "' AND ROWNUM < 2)";
|
| | |
|
| | | Command.CommandText = SqlStmt;
|
| | | reader = Command.ExecuteReader();
|
| | | command.CommandText = sqlStmt;
|
| | | reader = command.ExecuteReader();
|
| | |
|
| | | if (reader.Read())
|
| | | FDRID = Convert.ToInt32(reader["FDR1"].ToString());
|
| | | fdrid = Convert.ToInt32(reader["FDR1"].ToString());
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return FDRID;
|
| | | return fdrid;
|
| | | }
|
| | |
|
| | | private int getTraceCount(String CCSID)
|
| | | private int GetTraceCount(string ccsid)
|
| | | {
|
| | | String SqlStmt = "SELECT TRACECOUNT FROM CCS.TRACECOUNTS WHERE CCSID = '" + CCSID + "'";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Trx);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | int Count = 0;
|
| | | var sqlStmt = "SELECT TRACECOUNT FROM CCS.TRACECOUNTS WHERE CCSID = '" + ccsid + "'";
|
| | | var command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | | var reader = command.ExecuteReader();
|
| | | var count = 0;
|
| | |
|
| | | try
|
| | | {
|
| | | if (reader.Read())
|
| | | Count = Convert.ToInt32(reader["TRACECOUNT"].ToString());
|
| | | count = Convert.ToInt32(reader["TRACECOUNT"].ToString());
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | finally
|
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | |
|
| | | return Count;
|
| | | return count;
|
| | | }
|
| | |
|
| | | private bool UpdateTraceCount(String CCSID,bool isNew)
|
| | | private bool UpdateTraceCount(string ccsid, bool isNew)
|
| | | {
|
| | | String SqlStmt ;
|
| | | string sqlStmt;
|
| | |
|
| | | if (isNew)
|
| | | SqlStmt = "INSERT INTO CCS.TRACECOUNTS (CCSID,TRACECOUNT) VALUES ('" + CCSID + "',1)";
|
| | | sqlStmt = "INSERT INTO CCS.TRACECOUNTS (CCSID,TRACECOUNT) VALUES ('" + ccsid + "',1)";
|
| | | else
|
| | | SqlStmt = "UPDATE CCS.TRACECOUNTS SET TRACECOUNT = TRACECOUNT + 1 WHERE CCSID = '" + CCSID + "'";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _ConnectionTPC, _Trx);
|
| | | sqlStmt = "UPDATE CCS.TRACECOUNTS SET TRACECOUNT = TRACECOUNT + 1 WHERE CCSID = '" + ccsid + "'";
|
| | | var command = new OracleCommand(sqlStmt, _connectionTpc, _trx);
|
| | |
|
| | | try
|
| | | {
|
| | | int Result = Command.ExecuteNonQuery();
|
| | | var result = command.ExecuteNonQuery();
|
| | |
|
| | | if (Result == 1)
|
| | | if (result == 1)
|
| | | return true;
|
| | | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | }
|
| | | finally
|
| | | {
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | | using System.IO;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class RecordLog
|
| | | {
|
| | | private System.IO.StreamWriter _SWriter = null;
|
| | | private readonly StreamWriter _sWriter = null;
|
| | |
|
| | | public RecordLog(String FilePath)
|
| | | public RecordLog(string filePath)
|
| | | {
|
| | | _SWriter = new System.IO.StreamWriter(FilePath,true);
|
| | | _sWriter = new StreamWriter(filePath, true);
|
| | | }
|
| | |
|
| | | public void Debug(object message)
|
| | | {
|
| | | _SWriter.WriteLine("[Debug] [" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | _sWriter.WriteLine("[Debug] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | }
|
| | |
|
| | | public void Error(object message)
|
| | | {
|
| | | _SWriter.WriteLine("[Error] [" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | _sWriter.WriteLine("[Error] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | }
|
| | |
|
| | | public void Fatal(object message)
|
| | | {
|
| | | _SWriter.WriteLine("[Fatal] [" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | _sWriter.WriteLine("[Fatal] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | }
|
| | |
|
| | | public void Info(object message)
|
| | | {
|
| | | _SWriter.WriteLine("[Info] [" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | _sWriter.WriteLine("[Info] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | }
|
| | |
|
| | | public void Warn(object message)
|
| | | {
|
| | | _SWriter.WriteLine("[Warn] [" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | _sWriter.WriteLine("[Warn] [" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "] : " + message);
|
| | | }
|
| | |
|
| | | public void Close()
|
| | | {
|
| | | _SWriter.Close();
|
| | | _sWriter.Close();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | using System;
|
| | | using System.Diagnostics;
|
| | | using System.Diagnostics;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class SEventLog
|
| | | {
|
| | | static string sSource = "CCSTrace";
|
| | | static string sLog = "Application";
|
| | | private const string SSource = "CCSTrace";
|
| | | private const string SLog = "Application";
|
| | |
|
| | | public SEventLog()
|
| | | {
|
| | |
| | |
|
| | | public void Debug(object message)
|
| | | {
|
| | | if (!EventLog.SourceExists(sSource))
|
| | | EventLog.CreateEventSource(sSource, sLog);
|
| | | if (!EventLog.SourceExists(SSource))
|
| | | EventLog.CreateEventSource(SSource, SLog);
|
| | |
|
| | | //EventLog.WriteEntry(sSource, message.ToString());
|
| | | EventLog.WriteEntry(sSource, message.ToString(), EventLogEntryType.Information, 001);
|
| | | EventLog.WriteEntry(SSource, message.ToString(), EventLogEntryType.Information, 001);
|
| | | }
|
| | |
|
| | | public void Error(object message)
|
| | |
| | |
|
| | | public void Fatal(object message)
|
| | | {
|
| | | if (!EventLog.SourceExists(sSource))
|
| | | EventLog.CreateEventSource(sSource, sLog);
|
| | | if (!EventLog.SourceExists(SSource))
|
| | | EventLog.CreateEventSource(SSource, SLog);
|
| | |
|
| | | //EventLog.WriteEntry(sSource, message.ToString());
|
| | | EventLog.WriteEntry(sSource, message.ToString(), EventLogEntryType.FailureAudit, 001);
|
| | | EventLog.WriteEntry(SSource, message.ToString(), EventLogEntryType.FailureAudit, 001);
|
| | | }
|
| | |
|
| | | public void Info(object message)
|
| | |
| | |
|
| | | public void Warn(object message)
|
| | | {
|
| | | if (!EventLog.SourceExists(sSource))
|
| | | EventLog.CreateEventSource(sSource, sLog);
|
| | | if (!EventLog.SourceExists(SSource))
|
| | | EventLog.CreateEventSource(SSource, SLog);
|
| | |
|
| | | //EventLog.WriteEntry(sSource, message.ToString());
|
| | | EventLog.WriteEntry(sSource, message.ToString(), EventLogEntryType.Warning, 001);
|
| | | EventLog.WriteEntry(SSource, message.ToString(), EventLogEntryType.Warning, 001);
|
| | | }
|
| | |
|
| | | public void Close()
|
| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | | using System.Data.OracleClient;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class ThreadEndEvent
|
| | | {
|
| | | private System.Data.OracleClient.OracleConnection _Conn;
|
| | | private OracleConnection _conn;
|
| | |
|
| | | internal ThreadEndEvent(System.Data.OracleClient.OracleConnection _ConnectionTPC)
|
| | | internal ThreadEndEvent(OracleConnection connectionTpc)
|
| | | {
|
| | | _Conn = _ConnectionTPC;
|
| | | _conn = connectionTpc;
|
| | | }
|
| | |
|
| | | public System.Data.OracleClient.OracleConnection getConnection()
|
| | | public OracleConnection GetConnection()
|
| | | {
|
| | | return _Conn;
|
| | | return _conn;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | </FileUpgradeFlags>
|
| | | <OldToolsVersion>3.5</OldToolsVersion>
|
| | | <UpgradeBackupLocation />
|
| | | <UseIISExpress>false</UseIISExpress>
|
| | | <UseIISExpress>true</UseIISExpress>
|
| | | <TargetFrameworkProfile />
|
| | | <IISExpressSSLPort />
|
| | | <IISExpressAnonymousAuthentication />
|
| | | <IISExpressWindowsAuthentication />
|
| | | <IISExpressUseClassicPipelineMode />
|
| | | <UseGlobalApplicationHostFile />
|
| | | </PropertyGroup>
|
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
| | | <DebugSymbols>true</DebugSymbols>
|
| | |
| | | <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
| | | </PropertyGroup>
|
| | | <ItemGroup>
|
| | | <Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
| | | <HintPath>..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
|
| | | <Private>True</Private>
|
| | | </Reference>
|
| | | <Reference Include="Interop.TRACEROBJECTLib, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
| | | <SpecificVersion>False</SpecificVersion>
|
| | | <HintPath>bin\Resources\Lib\Interop.TRACEROBJECTLib.DLL</HintPath>
|
| | | </Reference>
|
| | | <Reference Include="NHibernate, Version=3.4.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
| | | <HintPath>..\packages\NHibernate.3.4.1.4000\lib\Net35\NHibernate.dll</HintPath>
|
| | | <Private>True</Private>
|
| | | </Reference>
|
| | | <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
| | | <HintPath>..\packages\NLog.4.3.3\lib\net35\NLog.dll</HintPath>
|
| | | <Private>True</Private>
|
| | | </Reference>
|
| | | <Reference Include="SmartThreadPool, Version=2.2.3.0, Culture=neutral, PublicKeyToken=1126fe8b671e8a79, processorArchitecture=MSIL">
|
| | | <HintPath>..\packages\SmartThreadPool.dll.2.2.3\lib\SmartThreadPool.dll</HintPath>
|
| | | <Private>True</Private>
|
| | | </Reference>
|
| | | <Reference Include="System" />
|
| | | <Reference Include="System.Data" />
|
| | |
| | | <Reference Include="System.Data.OracleClient" />
|
| | | <Reference Include="System.Drawing" />
|
| | | <Reference Include="System.Web" />
|
| | | <Reference Include="System.Web.DynamicData" />
|
| | | <Reference Include="System.Web.Entity" />
|
| | | <Reference Include="System.Web.Extensions" />
|
| | | <Reference Include="System.Windows.Forms" />
|
| | | <Reference Include="System.Xml" />
|
| | |
| | | <Reference Include="System.Xml.Linq" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Content Include="App_Data\DBConfig.xml">
|
| | | <SubType>Designer</SubType>
|
| | | </Content>
|
| | | <Content Include="DBConfig.xml" />
|
| | | <Content Include="Global.asax" />
|
| | | <Content Include="Service1.asmx" />
|
| | | <Content Include="Web.config" />
|
| | | <Content Include="TPower\DMMS\Model\BaseDB\CONNECTIVITY.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\BaseDB\HICUSTOMER.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\BaseDB\METER.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\BaseDB\MSTADDR.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\BaseDB\SXFMR.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\ADDRCONTRAST.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\ALARMIP.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\CODELIST.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\DEPTCONTRAST.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\EVENTQUERY.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\EVENTRECORD.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\NUMCONTRAST.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\SCGROUP.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\SCGROUPTIME.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\CCS\TMP.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\EOS\CODELIST.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\EOS\CRTAPOLOGY.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\EOS\EVENT.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\EOS\EVENTFACILITY.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\EOS\EVENTRECORD.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\EOS\EVENTRECORDEX.hbm.xml" />
|
| | | <Content Include="TPower\DMMS\Model\EOS\TMPAFFECTCUSTM.hbm.xml" />
|
| | | <Content Include="Web.config">
|
| | | <SubType>Designer</SubType>
|
| | | </Content>
|
| | | </ItemGroup>
|
| | | <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="CCS\Function\MergeCase.cs" />
|
| | | <Compile Include="CCS\LocalVariable.cs" />
|
| | | <Compile Include="CCS\Object\Addr_Contrast.cs" />
|
| | | <Compile Include="CCS\Object\AlarmData.cs" />
|
| | | <Compile Include="CCS\Object\CCSCodelist.cs" />
|
| | |
| | | <Compile Include="CCS\ProcessEvent.cs" />
|
| | | <Compile Include="CCS\RecordLog.cs" />
|
| | | <Compile Include="CCS\ThreadEndEvent.cs" />
|
| | | <Compile Include="Global.asax.cs">
|
| | | <DependentUpon>Global.asax</DependentUpon>
|
| | | </Compile>
|
| | | <Compile Include="Service1.asmx.cs">
|
| | | <DependentUpon>Service1.asmx</DependentUpon>
|
| | | <SubType>Component</SubType>
|
| | | </Compile>
|
| | | <Compile Include="Properties\AssemblyInfo.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\BaseDB\CONNECTIVITY.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\BaseDB\HICUSTOMER.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\BaseDB\METER.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\BaseDB\MSTADDR.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\DEPTCONTRAST.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\EVENTQUERY.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\EVENTRECORD.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\NUMCONTRAST.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\SCGROUP.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\SCGROUPTIME.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\CCS\TMP.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\EOS\CODELIST.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\EOS\CRTAPOLOGY.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\EOS\EVENT.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\EOS\EVENTFACILITY.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\EOS\EVENTRECORD.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\EOS\EVENTRECORDEX.cs" />
|
| | | <Compile Include="TPower\DMMS\Model\EOS\TMPAFFECTCUSTM.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <WCFMetadata Include="Service References\" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="App_Data\" />
|
| | | <COMReference Include="TRACEROBJECTLib">
|
| | | <Guid>{B8D2F30F-2520-11D1-91D1-0000F877ED89}</Guid>
|
| | | <VersionMajor>1</VersionMajor>
|
| | | <VersionMinor>2</VersionMinor>
|
| | | <Lcid>0</Lcid>
|
| | | <WrapperTool>tlbimp</WrapperTool>
|
| | | <Isolated>False</Isolated>
|
| | | <EmbedInteropTypes>True</EmbedInteropTypes>
|
| | | </COMReference>
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Content Include="packages.config" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Content Include="NLog.config">
|
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
| | | </Content>
|
| | | <None Include="NLog.xsd">
|
| | | <SubType>Designer</SubType>
|
| | | </None>
|
| | | </ItemGroup>
|
| | | <ItemGroup />
|
| | | <PropertyGroup>
|
| | | <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
| | | <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
| | |
| | | <AutoAssignPort>True</AutoAssignPort>
|
| | | <DevelopmentServerPort>2853</DevelopmentServerPort>
|
| | | <DevelopmentServerVPath>/</DevelopmentServerVPath>
|
| | | <IISUrl>http://localhost/CCSTrace</IISUrl>
|
| | | <OverrideIISAppRootUrl>True</OverrideIISAppRootUrl>
|
| | | <IISAppRootUrl>http://localhost/CCSTrace</IISAppRootUrl>
|
| | | <IISUrl>http://localhost:2853/</IISUrl>
|
| | | <NTLMAuthentication>False</NTLMAuthentication>
|
| | | <UseCustomServer>False</UseCustomServer>
|
| | | <CustomServerUrl>
|
| | |
| | | // by using the '*' as shown below:
|
| | | [assembly: AssemblyVersion("6.0.0.0")]
|
| | | [assembly: AssemblyFileVersion("6.0.0.0")]
|
| | | [assembly: InternalsVisibleTo("CCSTrace.Tests")]
|
| | | [assembly: InternalsVisibleTo("CCSTrace.Explorables")]
|
| | |
|
| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.ComponentModel;
|
| | | using System.Data;
|
| | | using System.Web;
|
| | | using System.ComponentModel;
|
| | | using System.Web.Services;
|
| | | using System.Web.Services.Protocols;
|
| | |
|
| | | namespace CCSTrace
|
| | | {
|
| | |
| | | [ToolboxItem(false)]
|
| | | // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
|
| | | [System.Web.Script.Services.ScriptService]
|
| | | public class Service1 : System.Web.Services.WebService
|
| | | public class Service1 : WebService
|
| | | {
|
| | |
|
| | | public Service1()
|
| | |
| | | }
|
| | |
|
| | | [WebMethod]
|
| | | public void AcceptCase(String _CCSID, String _METER, String _CUSTOMERNAME, String _CUSTOMERTEL, String _ADDR_CITY, String _ADDR_TOWN, String _ADDR_ROAD,
|
| | | String _ADDR_OTHER, String _RECALLNAME, String _RECALLTEL, int _EVENTBRIEF, String _ACCEPTTIME, int _IMPORTCASE, String _DEPT,
|
| | | int _PartHicustomer, String _NOTE)
|
| | | public void AcceptCase(string ccsid, string meter, string customername, string customertel, string addrCity, string addrTown, string addrRoad,
|
| | | string addrOther, string recallname, string recalltel, int eventbrief, string accepttime, int importcase, string dept,
|
| | | int partHicustomer, string note)
|
| | | {
|
| | | CCS.Object.CCSRecord _Record = new CCSTrace.CCS.Object.CCSRecord(_CCSID, _METER, _CUSTOMERNAME, _CUSTOMERTEL, _ADDR_CITY, _ADDR_TOWN, _ADDR_ROAD,
|
| | | _ADDR_OTHER, _RECALLNAME, _RECALLTEL, _EVENTBRIEF, _ACCEPTTIME, _IMPORTCASE, _DEPT,
|
| | | _PartHicustomer, _NOTE);
|
| | | CCS.Object.CcsRecord record = new CCS.Object.CcsRecord(ccsid, meter, customername, customertel, addrCity, addrTown, addrRoad,
|
| | | addrOther, recallname, recalltel, eventbrief, accepttime, importcase, dept,
|
| | | partHicustomer, note);
|
| | | //_CCSMain.AcceptEvent(_Record);
|
| | | CCSTrace.CCS.CCSMain.Instance().AcceptEvent(_Record);
|
| | | CCSTrace.CCS.CcsMain.Instance().AcceptEvent(record);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | <configSections>
|
| | | <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
| | | <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
| | | <remove name="scriptResourceHandler" />
|
| | | <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
| | | <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
| | | <remove name="jsonSerialization" />
|
| | | <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
|
| | | <remove name="profileService" />
|
| | | <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
| | | <remove name="authenticationService" />
|
| | | <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
| | | <remove name="roleService" />
|
| | | <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
| | | </sectionGroup>
|
| | | </sectionGroup>
|