|
|
@@ -2,9 +2,11 @@ |
|
|
|
using CnasSynchronousCommon; |
|
|
|
using CnasSynchronusClient; |
|
|
|
using CnasSynchrousModel; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Data; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
@@ -145,7 +147,12 @@ namespace CNAS_SyncService |
|
|
|
if (query.Count == 1) |
|
|
|
{ |
|
|
|
string strCompareTime = ""; |
|
|
|
string strDateTime = CnasDataOperationFact.CnasDataOperation().GetMaxTimeByTableName(syncInstrumentItem.SyncTargetDBInfo, syncInstrumentItem.LstSyncPramas[0].TargetTable, query[0].TargetField, syncInstrumentItem.CnasInstrumentColumn, syncInstrumentItem.GUID); |
|
|
|
string strDateTime = ""; |
|
|
|
Dictionary<string, string> times = this.ReadSyncTime(); |
|
|
|
if (true == times?.ContainsKey(syncInstrumentItem.Code)) |
|
|
|
{ |
|
|
|
strDateTime = $"{times[syncInstrumentItem.Code]}"; |
|
|
|
} |
|
|
|
|
|
|
|
//strDateTime = "2016-07-01 00:00:00"; |
|
|
|
if (strDateTime == "1899-1-1") |
|
|
@@ -368,5 +375,43 @@ namespace CNAS_SyncService |
|
|
|
} |
|
|
|
return config; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// |
|
|
|
/// </summary> |
|
|
|
private Dictionary<string, string> ReadSyncTime() |
|
|
|
{ |
|
|
|
Dictionary<string, string> times = null; |
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Cache", $"SyncTime.bin"))) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
using (StreamReader reader = new StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Cache", $"SyncTime.bin"), Encoding.UTF8)) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
string json = reader.ReadToEnd(); |
|
|
|
times = JsonConvert.DeserializeObject<Dictionary<string, string>>(json); |
|
|
|
} |
|
|
|
catch |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
reader.Close(); |
|
|
|
reader.Dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception exception) |
|
|
|
{ |
|
|
|
Debug.WriteLine(exception.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return times; |
|
|
|
} |
|
|
|
} |
|
|
|
} |