wsp forge 取得 db_id update 到 device_node
This commit is contained in:
		
							parent
							
								
									44252d029c
								
							
						
					
					
						commit
						b146283d13
					
				| @ -792,13 +792,13 @@ namespace Backend.Controllers | |||||||
|                                     await backendRepository.UpdateOneByCustomTable(deviceForLight, "device", $@" device_guid = '{device_guid}'"); |                                     await backendRepository.UpdateOneByCustomTable(deviceForLight, "device", $@" device_guid = '{device_guid}'"); | ||||||
|                                 } |                                 } | ||||||
| 
 | 
 | ||||||
|                                 //燈具 |  | ||||||
|                                 Dictionary<string, object> device = new Dictionary<string, object>(); |                                 Dictionary<string, object> device = new Dictionary<string, object>(); | ||||||
|                                 device.Add("@device_node_guid", Guid.NewGuid()); |                                 device.Add("@device_node_guid", Guid.NewGuid()); | ||||||
|                                 device.Add("@deleted", 0); |                                 device.Add("@deleted", 0); | ||||||
|                                 device.Add("@device_guid", device_guid); |                                 device.Add("@device_guid", device_guid); | ||||||
|                                 device.Add("@device_node_coordinate_3d", idfc.device_coordinate_3d); |                                 device.Add("@device_node_coordinate_3d", (idfc.node == null) ? idfc.device_coordinate_3d: idfc.node.device_coordinate_3d); | ||||||
|                                 device.Add("@forge_dbid", idfc.forge_dbid); |                                 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("@priority", node_priority); | ||||||
|                                 device.Add("@created_by", myUserInfo.Userinfo_guid); |                                 device.Add("@created_by", myUserInfo.Userinfo_guid); | ||||||
|                                 device.Add("@created_at", DateTime.Now); |                                 device.Add("@created_at", DateTime.Now); | ||||||
| @ -816,6 +816,7 @@ namespace Backend.Controllers | |||||||
|                                 device.Add("@updated_at", DateTime.Now); |                                 device.Add("@updated_at", DateTime.Now); | ||||||
|                                 await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'"); |                                 await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'"); | ||||||
|                             }  |                             }  | ||||||
|  |                         } | ||||||
|                         //更新device資料表  room_dbid 欄位 |                         //更新device資料表  room_dbid 欄位 | ||||||
|                         string sql = @"
 |                         string sql = @"
 | ||||||
|                         SET SQL_SAFE_UPDATES = 0; |                         SET SQL_SAFE_UPDATES = 0; | ||||||
| @ -829,7 +830,6 @@ namespace Backend.Controllers | |||||||
|                           WHERE de.room_name = re.room_name;";
 |                           WHERE de.room_name = re.room_name;";
 | ||||||
|                         await backendRepository.ExecuteSql(sql); |                         await backendRepository.ExecuteSql(sql); | ||||||
|                     } |                     } | ||||||
|                     } |  | ||||||
|                     apiResult.Code = "0000"; |                     apiResult.Code = "0000"; | ||||||
|                     apiResult.Msg = "編輯成功"; |                     apiResult.Msg = "編輯成功"; | ||||||
|                 } |                 } | ||||||
|  | |||||||
| @ -95,7 +95,8 @@ namespace Backend.Controllers | |||||||
|                 { "@created_by", myUserInfo.Userinfo_guid} |                 { "@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"); |                 backendRepository.InsertOperatorLog(operatorLog, "operation_back_log"); | ||||||
| 
 | 
 | ||||||
|             //operatorLogRepository.Add(operatorLog, properties); |             //operatorLogRepository.Add(operatorLog, properties); | ||||||
|  | |||||||
| @ -265,6 +265,19 @@ namespace Backend.Models | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public class ImportDevForCoo |     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_number { get; set; } | ||||||
|         public string device_coordinate_3d { get; set; } |         public string device_coordinate_3d { get; set; } | ||||||
|  | |||||||
| @ -414,6 +414,7 @@ | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         function ImportDevForCor() {//callback = null |         function ImportDevForCor() {//callback = null | ||||||
|  |             console.log(tagIdDevList) | ||||||
|             var url = "/DeviceImport/ImportDevForCor"; |             var url = "/DeviceImport/ImportDevForCor"; | ||||||
| 
 | 
 | ||||||
|             $.ajax({ |             $.ajax({ | ||||||
|  | |||||||
| @ -300,7 +300,8 @@ function onDocumentLoadSuccess(doc) { | |||||||
|                         { |                         { | ||||||
|                             device_number: item.displayValue, |                             device_number: item.displayValue, | ||||||
|                             device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', |                             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_number: item.displayValue, | ||||||
|                           device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', |                           device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', | ||||||
|                           forge_dbid: e.dbId, |                           forge_dbid: e.dbId, | ||||||
|                           room_name: "" |                           room_name: "", | ||||||
|  |                           node: null | ||||||
|                       }) |                       }) | ||||||
|                   } |                   } | ||||||
|               } |               } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user