新增forgeImportLog,資料錯誤記Log,其他資料繼續匯入

系統監控選單新增判斷buildmenu.is_link = 1
This commit is contained in:
史萬澤 2023-03-02 11:36:47 +08:00
parent 4349620dc9
commit fb37ac3014
2 changed files with 682 additions and 674 deletions

View File

@ -766,6 +766,7 @@ namespace Backend.Controllers
await backendRepository.TruncateTable("device_node"); await backendRepository.TruncateTable("device_node");
int node_priority = 1; int node_priority = 1;
foreach (var idfc in post) foreach (var idfc in post)
{ {
if (idfc.device_number.IndexOf("_LT_L1") > -1) if (idfc.device_number.IndexOf("_LT_L1") > -1)
@ -773,6 +774,12 @@ namespace Backend.Controllers
//取得device_guid //取得device_guid
var sWhere = $@" deleted = 0 and device_number = '" + idfc.device_number + "'"; var sWhere = $@" deleted = 0 and device_number = '" + idfc.device_number + "'";
var device_guid = await backendRepository.GetOneColAsync("device", sWhere, "device_guid"); var device_guid = await backendRepository.GetOneColAsync("device", sWhere, "device_guid");
if (device_guid == null)
{
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "【ERROR:forge匯入不存在device設備】" + idfc.device_number);
continue;
}
if (device_guid.ToString() != device_guid_record) if (device_guid.ToString() != device_guid_record)
{ {
device_guid_record = device_guid.ToString(); device_guid_record = device_guid.ToString();
@ -801,6 +808,7 @@ namespace Backend.Controllers
} }
else else
{ {
Logger.LogError("測試設備匯入:" + idfc.device_number);
Dictionary<string, object> device = new Dictionary<string, object>(); Dictionary<string, object> device = new Dictionary<string, object>();
device.Add("@device_coordinate_3d", idfc.device_coordinate_3d); device.Add("@device_coordinate_3d", idfc.device_coordinate_3d);
device.Add("@forge_dbid", idfc.forge_dbid); device.Add("@forge_dbid", idfc.forge_dbid);

View File

@ -75,7 +75,7 @@ namespace FrontendWebApi.ApiControllers
left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
-- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0 -- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
join ( join (
select distinct main_system_tag, sub_system_tag from building_menu where building_tag = @building_tag select distinct main_system_tag, sub_system_tag from building_menu where building_tag = @building_tag and is_link = 1
) as bm on v2.system_value = bm.sub_system_tag and v1.system_value = bm.main_system_tag ) as bm on v2.system_value = bm.sub_system_tag and v1.system_value = bm.main_system_tag
where c.account = @account where c.account = @account
order by v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag }); order by v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });