Rešitev je zgrajena z uporabo ogrodij in tehnologij operacijskega sistema Windows in temelji na ogrodju Gemma Fusion in platformi Win32, pri čemer je del sistema izpostavljen kot komponenta operacijskega sistema preko Windows Runtime (WinRT) za namen pouporabe funkcionalnosti iz ostalih programskih jezikov. Strežniške storitve in spletna aplikacija temeljijo na ogrodju ASP.NET 6.
Storitve in spletna aplikacija delujeta brez aplikacijskega strežnika.
Sistem sestavljajo naslednje komponente in moduli:
Komponenta | Vrsta | Programski jezik | Ogrodja |
---|---|---|---|
Isuv.Services.exe | Storitve VegeLine | C# | ASP.NET 6 |
Isuv.Services.Worker.exe | Program za orkestracijo | C++ | Isuv, Gemma Fusion |
Isuv.Services.Shared.dll | Komponenta VegeLine | C# | .NET 6, Isuv |
Isuv.ManagementApp.exe | Nadzorniška aplikacija | C# | ASP.NET 6, Blazor |
Isuv.dll | Komponenta VegeLine | C++ | Windows Runtime |
Isuv.Shared.Runtime.dll | Komponenta VegeLine | C++ | Isuv, Gemma Fusion |
Isuv.Module.Lidar.exe | Program za obdelavo podatkov | C++ | Isuv, Gemma Fusion |
Isuv.Module.Vegetation.exe | Program za obdelavo podatkov | C++ | Isuv, Gemma Fusion |
Isuv.Module.Assessment.exe | Program za obdelavo podatkov | C++ | Isuv, Gemma Fusion |
Isuv.Module.Database.exe | Program za upravljanje PB | C++ | Isuv, Gemma Fusion |
Isuv.Module.Replication.exe | Program za replikacijo | C++ | Isuv, Gemma Fusion |
Isuv.Module.Planning.exe | Program za arhive in planiranje | C++ | Isuv, Gemma Fusion |
Isuv.Module.Sample.exe | Primeri | C++ | Isuv, Gemma Fusion |
Isuv | Programska knjižnica | C++ | Gemma Fusion |
Gemma Fusion | Programska knjižnica | C++ | Win32, Ostalo |
Moduli predstavljajo posamezne sklope celotnega sistema in so namenjeni obdelavi podatkov. V večini primerih se moduli izvajajo samodejno tekom sprememb podatkov v sistemu VegeLine. Kljub temu pa je možno zaganjati module ročno neposredno na strežniku preko ukazne vrstice (pwsh, cmd). Spodaj so na kratko opisani moduli in njihove naloge.
Namen modula Lidar je izdelava modelov terena in višin iz podatkov lidar. Modul prav tako omogoča upodabljanje podatkov LiDAR v obliki 2D rastrske karte. Dodatno vsebuje še ukaze za uporavljanje s podatkovno bazo, v kateri si modul hrani vse metapodatke o posnetkih v prostorskem sloju dbo.Lidar.
Ob uvozu novega snemanja se zanj izluščijo meje in datum snemanja.
Uporabo modula najdete v Lidar
Namen modula je izdelava zadnjih modelov višin in terena, posodabljanje modelov iz uporabniških podatkov in izvajanje napovedi do poljubnega leta. Modul prav tako omogoča upodabljanje vseh rastrov.
Razlika pri ustvarjanju višinskih modelov od modula Lidar je v tem, da si Lidar vodi rastre posamično za vsako snemanje, Vegetation pa jih združi glede na zadnjo stanje v enakomerno porazdeljeno mrežo celic velikost 1 km² ločljivosti 0.5 m.
Uporabo modula najdete v Vegetation
Namen modula je izračun dovoljenih višin, ogroženosti in karte ažurnosti podatkov. Modul se prav tako uporablja za sinhronizacijo posegov končanih delovnih nalogov, kateri se lahko uporabijo pri posodabljanju modelov višin vegetacije v modulu Vegetation.
Uporabo modula najdete v Assessment
Namen modula je vzpostavitev in uporavljanje podatkovne baze preko ukazne vrstice. Modul se ne izvaja samodejno, kar pomeni da je njegove ukaze možno poganjati zgolj neposredno na strežniku.
Modul prav tako omogoča pregled in sprememo konfiguracije sistema, kot tudi vpogled v stanje sistema, če so pripravljeni vsi podatki, ki so potrebni za delovanje celotnega sistema VegeLine.
Modul se uporabi tudi za posodabljanje podatkovnih modelov v primeru posodobitve sistema.
Dodatno se ta modul uporablja za podrobno preverjanje stanja in napak podatkov (validacija).
Uporabo modula najdete v Database
Namen modula je replikacija podatkov tretjih podatkovnih virov. Replikator omogoča dostop do storitev ArcGIS, WFS, do registriranih podatkovnih baz in do spletnih naslovov. Replikator zna odpakirati sloje s pomočjo priloženega 7zip in zna shranit podatke v podatkovno bazo z uporabo ogr2ogr iz zbirke GDAL.
Modul Replication se lahko proži ročno preko nadzorniške aplikacije v komponenti urejanja podatkovnih virov ali preko ukazne vrstice na strežniku. Prav tako je priporočen vnos v upravitelja opravi (TaskScheduler) na strežniku za samodejno replikacijo.
Uporabo modula najdete v Replication
Namen modula je arhiviranje podatkov. Modul se proži iz orodja VegeLine preko dialoga za ustvarjanje novega arhiva.
Namen modula je orkestracija ostalih modulov za sinhrono izvajanje obdelave celotnega podatkov potrebnih za delovanje celotnega sistema VegeLine.
Uporabo modula najdete v Services worker
Datotečno strukturo za podatke je možno konfigurirat v datoteki isuv.config.json. Seznam konfigurabilnih spremenljivk najdete v poglavju Osnovna konfiguracija.
Sistemske datoteke sistema VegeLine ki se delijo v podmapah:
Podatkovni prostor sistema, kamor se odlagajo vhodni in izhodni podatki:
Podatkovni prostor za začasne datoteke tekom izvajanja posameznih procesov. Te datoteke se brišejo samodejno ob koncu izvajanja programov.
Spodaj so opisi tabel v podatkovni bazi, ki so potrebne za delovanje sistema VegeLine. Tabele je najlažje ustvariti kar preko modula Database.
Tabela | Geometrija | Opis |
---|---|---|
dbo.Basemaps | Vsebuje povezave do osnovnih slojev, katere je možno izbirati v orodju VegeLine | |
dbo.Databases | Vsebuje povezave do ostalih podatkovnih baz, ki vsebujejo podatkovne vire, kateri niso izpostavljeni preko ostalih storitev | |
dbo.Configuration | Vsebuje dinamično konfiguracijo cevovooda za obdelavo podatkov. | |
dbo.Lidar | ✔️ | Vsebuje območja snemanj, projekcijo in čas snemanja |
dbo.Restrictions | ✔️ | Vsebuje geometrijo in atribute ročno vnešenih omejitev preko orodja VegeLine |
dbo.Clearances | ✔️ | Vsebuje geometrijo in atribute ročno vnešenih posegov preko orodja VegeLine |
dbo.DTM | ✔️ | Vsebuje geometrijo in atribute ročno vnešenih območij popravkov modela terena preko orodja VegeLine |
dbo.CHM | ✔️ | Vsebuje geometrijo in atribute ročno vnešenih območij popravkov višin vegetacije preko orodja VegeLine |
dbo.Sources | Vsebuje registirane podatkovne vire, ki jih sistem potrebuje za izvedbo svojih nalog. Primeri so podatki o prenosnem omrežju in sloji omejitev | |
dbo.Tasks | Vsebuje zgodovino izvajanj opravil obdelave podatkov | |
dbo.WorkOrders | Tabela za ročno vodenje delovnih nalogov, kadar rešitev ni integrirana z IBM Maximo. Uporabno samo v razvojnem okolju. | |
dbo.SpanClearances | ✔️ | Vsebuje geometrijo in atribute samodejno vnešenih posegov zaključenih razpetin preko orodja VegeLine |
dbo.Activities | Vsebuje evidenco aktivnosti (ugotovitve, posegi, omejitve) za posamezne razpetine | |
dbo.ActivityLink | Vsebuje povezave med aktivnostmi in delovnimi nalogi | |
dbo.Layers | Vsebuje metapodatke internih slojev vegetacije | |
dbo.Users | Vsebuje seznam uporabnikov in njihovih pravic pri uporabi sistema | |
dbo.Patches | Vsebuje evidenco posodobitev podatkovnega modela baze. |
Spodaj so skripte za ročno ustvarjanje tabel za različico 2022.6.1376.0.
USE [Isuv]
GO
/****** Object: Table [dbo].[Basemaps] Script Date: 20. 05. 2021 08:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Basemaps]
CREATE TABLE [dbo].[Basemaps](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Name] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Type] [nvarchar](100) NOT NULL,
[Url] [nvarchar](2048) NOT NULL,
[Order] [int] NOT NULL,
[SingleLevel] [bit] NOT NULL,
[CacheLocally] [bit] NOT NULL,
[Enabled] [bit] NOT NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL
)
GO
ALTER TABLE [dbo].[Basemaps]
ADD CONSTRAINT UQ_Basemaps_Name UNIQUE ([Name]);
GO
CREATE TRIGGER BasemapsTriggerAfterUpdate
ON [dbo].[Basemaps]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Basemaps]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Basemaps].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Databases] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Databases]
CREATE TABLE [dbo].[Databases](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Key] [nvarchar](400) NOT NULL,
[Name] [nvarchar](400) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Type] [nvarchar](400) NOT NULL, /** Types such as Postgres or MSSQL */
[ConnectionString] [nvarchar](400) NOT NULL,
[Driver] [nvarchar](400) NULL,
[Inserted] [datetime2] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime2] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL
)
GO
ALTER TABLE [dbo].[Databases]
ADD CONSTRAINT UQ_Databases_Id UNIQUE ([Id]);
GO
CREATE TRIGGER DatabasesTriggerAfterUpdate
ON [dbo].[Databases]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Databases]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Databases].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Configuration] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Configuration]
CREATE TABLE [dbo].[Configuration](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Name] [nvarchar](200) NOT NULL,
[Value] [nvarchar](200) NOT NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL
)
GO
ALTER TABLE [dbo].[Configuration]
ADD CONSTRAINT UQ_Configuration_Key UNIQUE ([Name]);
GO
DROP TRIGGER IF EXISTS ConfigurationTriggerAfterUpdate
GO
CREATE TRIGGER ConfigurationTriggerAfterUpdate
ON [dbo].[Configuration]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Configuration]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Configuration].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Lidar] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Lidar]
CREATE TABLE [dbo].[Lidar](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Geometry] [geometry] NOT NULL,
[Uuid] [uniqueidentifier] NOT NULL,
[Name] [nvarchar](512) NOT NULL,
[Source] [nvarchar](100) NULL,
[SrsId] [int] NOT NULL,
[SrsWkt] [nvarchar](max) NOT NULL,
[SrsProj4] [nvarchar](400) NOT NULL,
[Acquired] [datetime] NOT NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME()
)
GO
ALTER TABLE [dbo].[Lidar]
ADD CONSTRAINT UQ_Lidar_Uuid UNIQUE ([Uuid]);
GO
CREATE TRIGGER LidarTriggerAfterUpdate
ON [dbo].[Lidar]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Lidar]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Lidar].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Restrictions] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Restrictions]
CREATE TABLE [dbo].[Restrictions](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Geometry] [geometry] NOT NULL,
[Source] [nvarchar](260) NOT NULL,
[SourceId] [nvarchar](260) NOT NULL,
[Name] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Validity] [nvarchar](max) NOT NULL,
[Metadata] [nvarchar](max) NOT NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](260) NOT NULL,
[Uuid] [nvarchar](260) NOT NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TRIGGER RestrictionsTriggerAfterUpdate
ON [dbo].[Restrictions]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Restrictions]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Restrictions].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Clearances] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Clearances]
CREATE TABLE [dbo].[Clearances](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Geometry] [geometry] NOT NULL,
[VegetationType] [nvarchar](260) NOT NULL,
[Name] [nvarchar](260) NOT NULL,
[Clearance] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Offset] [float] NOT NULL default 0,
[Date] [datetime] NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](260) NOT NULL,
[Uuid] [nvarchar](260) NOT NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TRIGGER ClearancesTriggerAfterUpdate
ON [dbo].[Clearances]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Clearances]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Clearances].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[DTM] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[DTM]
CREATE TABLE [dbo].[DTM](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Geometry] [geometry] NOT NULL,
[Type] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Param] [float] NOT NULL default 0,
[Date] [datetime] NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](260) NOT NULL,
[Uuid] [nvarchar](260) NOT NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TRIGGER DTMTriggerAfterUpdate
ON [dbo].[DTM]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[DTM]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[DTM].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[CHM] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[CHM]
CREATE TABLE [dbo].[CHM](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Geometry] [geometry] NOT NULL,
[Type] [nvarchar](260) NOT NULL,
[VegetationType] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Param] [float] NOT NULL default 0,
[Date] [datetime] NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](260) NOT NULL,
[Uuid] [nvarchar](260) NOT NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TRIGGER CHMTriggerAfterUpdate
ON [dbo].[CHM]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[CHM]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[CHM].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Sources] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Sources]
CREATE TABLE [dbo].[Sources](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Name] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Type] [nvarchar](100) NOT NULL,
[SourceConnectionType] [nvarchar](100) NOT NULL, /** Data source connection type: ArcGisRestServices, Wfs, Database, Url */
[SourceConnection] [nvarchar](max) NOT NULL, /** Structure depends on selected SourceConnectionType*/
[TargetConnectionType] [nvarchar](100) NOT NULL, /** Replication target: None, Database, File */
[TargetConnection] [nvarchar](max) NULL, /** Structure depends on selected SourceConnectionType*/
[AttributeMap] [nvarchar](max) NULL, /** Structure depends on selected Type */
[AttributeSchema] [nvarchar](max) NULL, /** Attribute schema for display purposes */
[GeometryStyle] [nvarchar](max) NULL, /** Geometry styles */
[LastUpdate] [datetime] NULL,
[LastError] [nvarchar](max) NULL,
[RefreshSpan] [bigint] NULL,
[IsValid] [bit] NOT NULL,
[Enabled] [bit] NOT NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](max) NOT NULL
)
GO
ALTER TABLE [dbo].[Sources]
ADD CONSTRAINT UQ_Sources_Name UNIQUE ([Name]);
GO
DROP TRIGGER IF EXISTS SourcesTriggerAfterUpdate
GO
CREATE TRIGGER SourcesTriggerAfterUpdate
ON [dbo].[Sources]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Sources]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Sources].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Tasks] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/***
Status:
Created
Started
Stopped
Succeeded
Failed
Crashed
*/
DROP TABLE IF EXISTS [dbo].[Tasks]
CREATE TABLE [dbo].[Tasks](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[InstanceId] [uniqueidentifier] NOT NULL,
[TaskId] [uniqueidentifier] NOT NULL,
[ParentTaskId] [uniqueidentifier] NULL,
[ModuleName] [nvarchar](400) NOT NULL,
[CommandLine] [nvarchar](max) NOT NULL,
[LogFile] [nvarchar](400) NOT NULL,
[Started] [datetime2] NULL,
[Ended] [datetime2] NULL,
[ReturnCode] [int] NULL,
[ErrorMessage] [nvarchar](max) NULL,
[ProgressMessage] [nvarchar](max) NULL,
[ProgressStep] [int] NULL,
[ProgressCount] [int] NULL,
[ProcessId] [bigint] NULL,
[Status] [nvarchar](260) NOT NULL,
[Type] [int] NOT NULL,
[Inserted] [datetime2] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime2] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL
)
GO
ALTER TABLE [dbo].[Tasks]
ADD CONSTRAINT UQ_Tasks_TaskId UNIQUE ([TaskId]);
GO
CREATE TRIGGER TasksTriggerAfterUpdate
ON [dbo].[Tasks]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Tasks]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Tasks].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[WorkOrders] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[WorkOrders]
CREATE TABLE [dbo].[WorkOrders](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[WoNum] [nvarchar](200) NULL,
[WoNumParent] [nvarchar](200) NULL,
[SiteId] [nvarchar](200) NULL,
[Href] [nvarchar](4000) NULL,
[Key] [nvarchar](2048) NULL,
[Description] [nvarchar](max) NULL,
[Wo6] [nvarchar](60) NULL,
[Wo18] [nvarchar](60) NULL,
[Wo6Description] [nvarchar](200) NULL,
[WoClass] [nvarchar](60) NULL,
[Status] [nvarchar](60) NULL,
[StatusDescription] [nvarchar](60) NULL,
[StatusUpdated] [datetime] NULL,
[WorkType] [nvarchar](60) NULL,
[FailDate] [datetime] NULL,
[FailureCode] [nvarchar](60) NULL,
[AssetNum] [nvarchar](60) NULL,
[Location] [nvarchar](60) NULL,
[Originvegetation] [bit] NULL,
[ActualFinishDate] [datetime] NULL,
[SchedStart] [datetime] NULL,
[SchedFinish] [datetime] NULL,
[ReportDate] [datetime] NULL,
[EstDur] [float] NULL,
[Owner] [nvarchar](200) NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL
)
GO
ALTER TABLE [dbo].[WorkOrders]
ADD CONSTRAINT UQ_WorkOrders_Key UNIQUE ([Key]);
GO
DROP TRIGGER IF EXISTS WorkOrdersTriggerAfterUpdate
GO
CREATE TRIGGER WorkOrdersTriggerAfterUpdate
ON [dbo].[WorkOrders]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[WorkOrders]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[WorkOrders].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[SpanClearances] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[SpanClearances]
CREATE TABLE [dbo].[SpanClearances](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Geometry] [geometry] NOT NULL,
[VegetationType] [nvarchar](260) NOT NULL,
[Name] [nvarchar](260) NOT NULL,
[Clearance] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Offset] [float] NOT NULL default 0,
[Date] [datetime] NULL,
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](260) NOT NULL,
[Uuid] [nvarchar](260) NOT NULL,
[Year] [int] NOT NULL,
[Cipo] [nvarchar](60) NOT NULL,
[SnapshotId] [uniqueidentifier] NOT NULL,
[PowerlineId] [bigint] NOT NULL,
[SpanId] [bigint] NOT NULL,
[Use] [bit] NOT NULL,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TRIGGER SpanClearancesTriggerAfterUpdate
ON [dbo].[SpanClearances]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[SpanClearances]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[SpanClearances].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Activities] Script Date: 09. 03. 2022 13:00:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Activities]
CREATE TABLE [dbo].[Activities](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
/* SPAN PLANNING INFO */
[Key] [nvarchar](64) NULL, /* Unique key composed from year, powerlineid, spanid, typeid and shortname.ToLower().Trim() as SHA256 hash*/
[Year] [int] NOT NULL,
[Cipo] [nvarchar](60) NOT NULL,
[SnapshotId] [uniqueidentifier] NOT NULL,
[PowerlineId] [bigint] NOT NULL,
[SpanId] [bigint] NOT NULL,
[SpanName] [nvarchar](200) NOT NULL,
[TypeId] [int] NOT NULL,
[InternalStatus] [int] NOT NULL,
[SyncStatus] [int] NOT NULL,
[ShortName] [nvarchar](max) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
/* IBM MAXIMO */
[MxAssetNum] [nvarchar](60) NULL,
[MxLocation] [nvarchar](60) NULL,
[MxSiteId] [nvarchar](60) NULL,
/* VegeLine estimates */
[CostEstimate] [float] NULL,
[DurationEstimate] [float] NULL,
[DetectionDate] [datetime] NULL,
[ProtocolUrl] [nvarchar](2048) NULL,
/* GENERIC INFO */
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL,
/* Flags and options used by findings only */
[SolveOwnership] [bit] NOT NULL, /* Add solve ownership restriction when synchronizing with MX */
)
GO
ALTER TABLE [dbo].[Activities]
ADD CONSTRAINT UQ_Activities_Key UNIQUE ([Key]);
GO
DROP TRIGGER IF EXISTS ActivitiesTriggerAfterUpdate
GO
CREATE TRIGGER ActivitiesTriggerAfterUpdate
ON [dbo].[Activities]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Activities]
SET [Updated] = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Activities].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[ActivityLink] Script Date: 09. 03. 2022 13:00:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[ActivityLink]
CREATE TABLE [dbo].[ActivityLink](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Key] [nvarchar](64) NOT NULL, /* Unique activity key composed from year, powerlineid, spanid, typeid and shortname.ToLower().Trim() as SHA256 hash*/
/* IBM MAXIMO INFO */
[MxWoNumParent] [nvarchar](200) NULL,
[MxWoNum] [nvarchar](200) NULL,
[MxWorkOrderId] [bigint] NULL,
[MxHref] [nvarchar](2048) NULL,
[MxKey] [nvarchar](2048) NULL,
[MxPriority] [int] NULL,
[MxStatus] [nvarchar](200) NULL,
[MxLastStatusUpdate] [datetime] NULL,
[MxActualFinishDate] [datetime] NULL,
[MxIsInternal] [bit] NULL,
/* GENERIC INFO */
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL,
)
GO
DROP TRIGGER IF EXISTS ActivityLinkTriggerAfterUpdate
GO
CREATE TRIGGER ActivityLinkTriggerAfterUpdate
ON [dbo].[ActivityLink]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[ActivityLink]
SET [Updated] = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[ActivityLink].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Layers] Script Date: 20. 05. 2021 08:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE IF EXISTS [dbo].[Layers]
CREATE TABLE [dbo].[Layers](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[Name] [nvarchar](260) NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[Type] [nvarchar](100) NOT NULL,
[AttributeMap] [nvarchar](max) NULL, /** Structure depends on selected Type */
[AttributeSchema] [nvarchar](max) NULL, /** Attribute schema for display purposes */
[GeometryStyle] [nvarchar](max) NULL, /** Geometry styles */
[Inserted] [datetime] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime] NOT NULL default SYSUTCDATETIME(),
[UserId] [nvarchar](200) NOT NULL
)
GO
ALTER TABLE [dbo].[Layers]
ADD CONSTRAINT UQ_Layers_Name UNIQUE ([Name]);
GO
CREATE TRIGGER LayersTriggerAfterUpdate
ON [dbo].[Layers]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Layers]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Layers].Id
END
USE [Isuv]
GO
/****** Object: Table [dbo].[Users] Script Date: 12. 04. 2021 12:17:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/***
UserRole:
None,
View,
Modify,
Admin
UserType:
None,
User,
Service
*/
DROP TABLE IF EXISTS [dbo].[Users]
CREATE TABLE [dbo].[Users](
[Id] [bigint] NOT NULL IDENTITY PRIMARY KEY,
[UserId] [nvarchar](200) NOT NULL,
[UserRole] [nvarchar](260) NOT NULL,
[UserType] [nvarchar](260) NOT NULL,
[Inserted] [datetime2] NOT NULL default SYSUTCDATETIME(),
[Updated] [datetime2] NOT NULL default SYSUTCDATETIME()
)
GO
ALTER TABLE [dbo].[Users]
ADD CONSTRAINT UQ_Users_UserId UNIQUE ([UserId]);
GO
CREATE TRIGGER UsersTriggerAfterUpdate
ON [dbo].[Users]
AFTER UPDATE
AS BEGIN
UPDATE [dbo].[Users]
SET Updated = SYSUTCDATETIME()
FROM INSERTED i
WHERE i.Id = [dbo].[Users].Id
END