refactor:device_item檢查full_name為空,以points替代

This commit is contained in:
史萬澤 2023-02-07 17:55:29 +08:00
parent f6dffd0ef3
commit 0db40ce635
3 changed files with 35 additions and 2 deletions

View File

@ -146,6 +146,7 @@ namespace Backend.Controllers
var building = ds.FirstOrDefault().device_building_tag;
await niagaraDataSynchronizeRepository.InsertItemFromNiagara(ds, building);
await niagaraDataSynchronizeRepository.DeviceItemComparison();
await niagaraDataSynchronizeRepository.ItemCheckFullNameEmptyReplaceByDeviceName();
result = true;
apiResult.Code = "0000";

View File

@ -520,7 +520,37 @@ namespace Repository.BackendRepository.Implement
try
{
StringBuilder sb = new StringBuilder();
sb.Append("update bims_mitsubishi.device set full_name=device_number where full_Name='';");
sb.Append("update device set full_name=device_number where full_Name='';");
await conn.ExecuteAsync(sb.ToString());
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
}
}
}
/// <summary>
/// 檢查device_item內FullName為空的值以points取代
/// </summary>
/// <returns></returns>
public async Task ItemCheckFullNameEmptyReplaceByDeviceName()
{
using (IDbConnection conn = GetDbConnection())
{
conn.Open();
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
try
{
StringBuilder sb = new StringBuilder();
sb.Append("update device_item set full_name = points where full_Name = '''''';");
await conn.ExecuteAsync(sb.ToString());
}
catch (Exception exception)

View File

@ -36,6 +36,8 @@ namespace Repository.BackendRepository.Interface
/// </summary>
/// <returns></returns>
Task DeviceItemComparison();
Task ItemCheckFullNameEmptyReplaceByDeviceName();
/// <summary>
/// 新增資料至 buildingMenu
/// </summary>