[後端] 修改同步重複問題, 修改前台api新需求, 修改model 衝突問題
This commit is contained in:
parent
a848dac30a
commit
8914bb7ac2
@ -82,7 +82,6 @@ namespace Backend.Models
|
||||
public List<DeviceDisaster> Device_disasters { get; set; } //防災類型
|
||||
public List<DeviceNode> Device_nodes { get; set; } //設備子節點
|
||||
|
||||
public System.DateTime created_at { get; set; }
|
||||
/// <summary>
|
||||
/// 前次成功日期;下次重新歸檔日期
|
||||
/// </summary>
|
||||
|
@ -520,7 +520,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
if (!string.IsNullOrEmpty(projectName) && projectName.Contains("ibms_dome") && (post.main_system_tag == "S" && post.sub_system_tag == "P"))
|
||||
{
|
||||
sub_system_guidsql = $@" and (d.device_name_tag = '{post.sub_system_tag}' or d.device_name_tag = 'B')";
|
||||
sub_system_guidsql = $@" and (d.device_name_tag = '{post.sub_system_tag}' or d.device_name_tag = 'B') and d.device_number not like '%ATS%'";
|
||||
singleSubSql = $"and (di.device_name_tag = '{post.sub_system_tag}' or di.device_name_tag = 'B')";
|
||||
}
|
||||
else
|
||||
|
@ -407,11 +407,34 @@ namespace Repository.BackendRepository.Implement
|
||||
{
|
||||
await conn.ExecuteAsync(sb.ToString());
|
||||
}
|
||||
|
||||
stopwatchSection.Stop();
|
||||
await KeepTimeLog("update device_item parent_path", stopwatchSection.ElapsedMilliseconds);
|
||||
|
||||
stopwatch.Stop();
|
||||
await KeepTimeLog("InsertItemFromNiagara", stopwatch.ElapsedMilliseconds);
|
||||
|
||||
//delete the same point in
|
||||
await conn.ExecuteAsync(@"DELETE ini1
|
||||
FROM import_niagara_item ini1
|
||||
JOIN (
|
||||
SELECT DISTINCT ini1.id
|
||||
FROM import_niagara_item ini1
|
||||
JOIN import_niagara_item ini2 ON ini1.id != ini2.id
|
||||
AND ini1.device_building_tag = ini2.device_building_tag
|
||||
AND ini1.device_system_tag = ini2.device_system_tag
|
||||
AND ini1.device_name_tag = ini2.device_name_tag
|
||||
AND ini1.device_point_name = ini2.device_point_name
|
||||
AND ini1.full_name = ini2.full_name
|
||||
AND ini1.parent_path = ini2.parent_path
|
||||
AND ini1.is_history = ini2.is_history
|
||||
WHERE ini1.id NOT IN (
|
||||
SELECT MIN(id)
|
||||
FROM import_niagara_item
|
||||
GROUP BY device_building_tag, device_system_tag, device_name_tag, device_point_name, full_name
|
||||
HAVING COUNT(device_point_name) > 1
|
||||
)
|
||||
) AS to_delete ON ini1.id = to_delete.id;");
|
||||
#endregion
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
Loading…
Reference in New Issue
Block a user