wsp forge 取得 db_id update 到 device_node

This commit is contained in:
GiteaAdmin 2023-03-03 18:35:58 +08:00
parent 44252d029c
commit b146283d13
5 changed files with 30 additions and 13 deletions

View File

@ -792,18 +792,18 @@ namespace Backend.Controllers
await backendRepository.UpdateOneByCustomTable(deviceForLight, "device", $@" device_guid = '{device_guid}'");
}
//燈具
Dictionary<string, object> device = new Dictionary<string, object>();
device.Add("@device_node_guid", Guid.NewGuid());
device.Add("@deleted", 0);
device.Add("@device_guid", device_guid);
device.Add("@device_node_coordinate_3d", idfc.device_coordinate_3d);
device.Add("@forge_dbid", idfc.forge_dbid);
device.Add("@device_node_coordinate_3d", (idfc.node == null) ? idfc.device_coordinate_3d: idfc.node.device_coordinate_3d);
device.Add("@forge_dbid", (idfc.node == null) ? idfc.forge_dbid: idfc.node.forge_dbid);
device.Add("@device_number", (idfc.node == null) ? idfc.device_number : idfc.node.device_number);
device.Add("@priority", node_priority);
device.Add("@created_by", myUserInfo.Userinfo_guid);
device.Add("@created_at", DateTime.Now);
node_priority++;
node_priority++;
await backendRepository.AddOneByCustomTableReturnId(device, "device_node", false);
}
else
@ -816,8 +816,9 @@ namespace Backend.Controllers
device.Add("@updated_at", DateTime.Now);
await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'");
}
//更新device資料表 room_dbid 欄位
string sql = @"
}
//更新device資料表 room_dbid 欄位
string sql = @"
SET SQL_SAFE_UPDATES = 0;
UPDATE
device AS de,
@ -827,8 +828,7 @@ namespace Backend.Controllers
) AS re
SET de.room_dbid = re.room_id
WHERE de.room_name = re.room_name;";
await backendRepository.ExecuteSql(sql);
}
await backendRepository.ExecuteSql(sql);
}
apiResult.Code = "0000";
apiResult.Msg = "編輯成功";

View File

@ -95,7 +95,8 @@ namespace Backend.Controllers
{ "@created_by", myUserInfo.Userinfo_guid}
};
if (actionName != "CompareData" && controllerName != "NiagaraDataSynchronize") //skip the log
if ((actionName != "CompareData" && controllerName != "NiagaraDataSynchronize") &&
(actionName != "ImportDevForCor" && controllerName != "DeviceImport")) //skip the log
backendRepository.InsertOperatorLog(operatorLog, "operation_back_log");
//operatorLogRepository.Add(operatorLog, properties);

View File

@ -265,6 +265,19 @@ namespace Backend.Models
}
public class ImportDevForCoo
{
public string device_number { get; set; }
public string? device_coordinate_3d { get; set; }
public int forge_dbid { get; set; }
public string room_name { get; set; }
/// <summary>
/// 燈具放在子類別 node 中
/// </summary>
public device_node? node { get; set; }
}
public class device_node
{
public string device_number { get; set; }
public string device_coordinate_3d { get; set; }

View File

@ -414,6 +414,7 @@
}
function ImportDevForCor() {//callback = null
console.log(tagIdDevList)
var url = "/DeviceImport/ImportDevForCor";
$.ajax({

View File

@ -300,7 +300,8 @@ function onDocumentLoadSuccess(doc) {
{
device_number: item.displayValue,
device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }',
forge_dbid: e.dbId, room_name: ""
forge_dbid: e.dbId, room_name: "",
node: null
});
}
@ -353,7 +354,8 @@ function onDocumentLoadSuccess(doc) {
device_number: item.displayValue,
device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }',
forge_dbid: e.dbId,
room_name: ""
room_name: "",
node: null
})
}
}