[後端] 調整同步流程
This commit is contained in:
parent
cd83cf2133
commit
2cb01620ec
@ -525,33 +525,6 @@ namespace Repository.BackendRepository.Implement
|
||||
stopwatchSection = new Stopwatch();
|
||||
stopwatchSection.Start();
|
||||
foreach (var data in result2)
|
||||
{
|
||||
if (data.device_system_tag.Equals("S") && data.device_name_tag.Equals("C"))
|
||||
{
|
||||
var sqlString = new StringBuilder();
|
||||
sqlString.Append("select * from device_kind where device_building_tag = '" + data.device_building_tag + "' and device_system_tag = '" + data.device_system_tag + "' and device_name_tag = '" + data.device_name_tag + "' and device_model_tag = '" + data.device_model_tag + "'");
|
||||
var dk = (await conn.QueryAsync<device_kind>(sqlString.ToString())).ToList<device_kind>();
|
||||
|
||||
if (dk.Count == 0)
|
||||
{
|
||||
sb2.Append($@"INSERT device_kind (device_kind_guid, device_building_tag, device_system_tag, device_name_tag,
|
||||
device_normal_flashing, device_close_flashing, device_error_flashing, device_error_independent,
|
||||
created_by, created_at, device_model_tag, is_link)
|
||||
VALUES (uuid(), '" + data.device_building_tag + "', '" + data.device_system_tag + "', '" + data.device_name_tag +
|
||||
"', 0, 0, 1, 0, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now(), '" + data.device_model_tag + "', 1);");
|
||||
count += 1;
|
||||
if (count >= 100)
|
||||
{
|
||||
using (TransactionScope scope = new TransactionScope((TransactionScopeOption)TransactionScopeAsyncFlowOption.Enabled))
|
||||
{
|
||||
await conn.ExecuteAsync(sb2.ToString());
|
||||
}
|
||||
sb2.Clear();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var sqlString = new StringBuilder();
|
||||
sqlString.Append("select * from device_kind where device_building_tag = '" + data.device_building_tag + "' and device_system_tag = '" + data.device_system_tag + "' and device_name_tag = '" + data.device_name_tag + "'");
|
||||
@ -576,7 +549,6 @@ namespace Repository.BackendRepository.Implement
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sb2.Length > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user