Files
WebGIM/GIM_dataLayer/sql/GIM_0001.sql
T
2017-02-08 14:14:24 +01:00

2909 lines
77 KiB
Transact-SQL

/****************************************************************
* SteamWare s.r.l.
*
* Setup iniziale DB applicazione WebGIM con creazione tabelle
*
* modificato: 2009-01-23 S.E.L.
*
****************************************************************/
/* creo tabelle */
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
CREATE TABLE AnagAmbitoGuasto(
idxAmbito INT NOT NULL IDENTITY CONSTRAINT PK_AnagAmbitoGuasto PRIMARY KEY,
descrAmbitoGuasto NVARCHAR(50)
)
GO
CREATE TABLE AnagCausali(
idxCausale INT NOT NULL IDENTITY CONSTRAINT PK_AnagCausali PRIMARY KEY,
descrCausale NVARCHAR(50)
)
GO
CREATE TABLE AnagEventi(
idxEvento INT NOT NULL CONSTRAINT PK_AnagEventi PRIMARY KEY,
DescrEvento NVARCHAR(50)
)
GO
CREATE TABLE AnagFamMacchine(
idxFamMacchine INT NOT NULL IDENTITY CONSTRAINT PK_AnagFamMacchine PRIMARY KEY,
nomeFamMacch NVARCHAR(50)
)
GO
CREATE TABLE AnagFrequenze(
codFrequenza NCHAR(2) NOT NULL CONSTRAINT PK_AnagFrequenze PRIMARY KEY,
frequenza NVARCHAR(50)
)
GO
CREATE TABLE AnagImpianti(
idxImpianto INT NOT NULL IDENTITY CONSTRAINT PK_AnagImpianti PRIMARY KEY,
codImpianto NVARCHAR(50),
nomeImpianto NVARCHAR(50),
tipoImpianto NVARCHAR(50),
funzDal DATETIME,
funzAl DATETIME
)
GO
CREATE TABLE AnagMacchine(
idxMacchina INT NOT NULL IDENTITY CONSTRAINT PK_AnagMacchine PRIMARY KEY,
idxImpianto INT,
codMacchina NVARCHAR(50),
nomeMacchina NVARCHAR(50),
modello NVARCHAR(50),
matricola NVARCHAR(50),
anno INT,
kgPeso FLOAT NOT NULL CONSTRAINT DF_AnagMacchine_kgPeso DEFAULT (0),
kwConsumo FLOAT NOT NULL CONSTRAINT DF_AnagMacchine_kwConsumo DEFAULT (0),
funzDal DATETIME,
funzAl DATETIME
)
GO
ALTER TABLE AnagMacchine ADD
CONSTRAINT FK_AnagMacchine_AnagImpianti FOREIGN KEY(idxImpianto) REFERENCES AnagImpianti(idxImpianto) ON UPDATE CASCADE
GO
CREATE TABLE AnagPeriodi(
codPeriodo NVARCHAR(20) NOT NULL CONSTRAINT PK_AnagPeriodi PRIMARY KEY,
lemmaPeriodo NVARCHAR(50)
)
GO
CREATE TABLE AnagPriorita(
idxPriorita INT NOT NULL CONSTRAINT PK_AnagPriorita PRIMARY KEY,
descrPriorita NVARCHAR(50),
stile NVARCHAR(50)
)
GO
CREATE TABLE AnagSemafori(
codSemaforo NVARCHAR(50) NOT NULL CONSTRAINT PK_AnagSemafori PRIMARY KEY,
descrSemaforo NVARCHAR(50)
)
GO
CREATE TABLE AnagStati(
idxStato INT NOT NULL CONSTRAINT PK_AnagStati PRIMARY KEY,
DescrStato NVARCHAR(50),
stile NVARCHAR(50)
)
GO
CREATE TABLE AnagTipoGuasto(
idxTipo INT NOT NULL IDENTITY CONSTRAINT PK_AnagTipoGuasto PRIMARY KEY,
descrTipo NVARCHAR(50)
)
GO
CREATE TABLE CalendFesteFerie(
data DATETIME NOT NULL CONSTRAINT PK_CalendFesteFerie PRIMARY KEY,
descrizione NVARCHAR(50)
)
GO
CREATE TABLE Causali2FamMacchine(
idxCausale INT NOT NULL,
idxFamMacchine INT NOT NULL,
CONSTRAINT PK_Causali2FamMacchine PRIMARY KEY(idxCausale,idxFamMacchine)
)
GO
ALTER TABLE Causali2FamMacchine ADD
CONSTRAINT FK_Causali2FamMacchine_AnagCausali FOREIGN KEY(idxCausale) REFERENCES AnagCausali(idxCausale) ON UPDATE CASCADE,
CONSTRAINT FK_Causali2FamMacchine_AnagFamMacchine FOREIGN KEY(idxFamMacchine) REFERENCES AnagFamMacchine(idxFamMacchine) ON UPDATE CASCADE
GO
CREATE TABLE FiltroImpianti(
username NVARCHAR(50) NOT NULL,
idxImpianto INT NOT NULL,
CONSTRAINT PK_FiltroImpianti PRIMARY KEY(username,idxImpianto)
)
GO
ALTER TABLE FiltroImpianti ADD
CONSTRAINT FK_FiltroImpianti_AnagImpianti FOREIGN KEY(idxImpianto) REFERENCES AnagImpianti(idxImpianto) ON UPDATE CASCADE ON DELETE CASCADE
GO
CREATE TABLE FiltroMacchine(
username NVARCHAR(50) NOT NULL,
idxMacchina INT NOT NULL,
CONSTRAINT PK_FiltroMacchine PRIMARY KEY(username,idxMacchina)
)
GO
ALTER TABLE FiltroMacchine ADD
CONSTRAINT FK_FiltroMacchine_AnagMacchine FOREIGN KEY(idxMacchina) REFERENCES AnagMacchine(idxMacchina) ON UPDATE CASCADE ON DELETE CASCADE
GO
CREATE TABLE FiltroStati(
username NVARCHAR(50) NOT NULL,
idxStato INT NOT NULL,
CONSTRAINT PK_FiltroStati PRIMARY KEY(username,idxStato)
)
GO
ALTER TABLE FiltroStati ADD
CONSTRAINT FK_FiltroStati_AnagStati FOREIGN KEY(idxStato) REFERENCES AnagStati(idxStato) ON UPDATE CASCADE ON DELETE CASCADE
GO
CREATE TABLE InterventiMtz(
numIntMtz INT NOT NULL IDENTITY CONSTRAINT PK_InterventiMtz PRIMARY KEY,
richiesta DATETIME NOT NULL,
dataLav DATETIME NOT NULL,
turnoLav INT NOT NULL,
matr NVARCHAR(10) NOT NULL,
guasto DATETIME NOT NULL,
idxAmbito INT NOT NULL,
idxPriorita INT NOT NULL,
isFermo BIT NOT NULL CONSTRAINT DF_InterventiMtz_isFermo DEFAULT (1),
idxTipo INT NOT NULL,
idxImpianto INT NOT NULL,
idxMacchina INT NOT NULL,
descrizione NVARCHAR(500) NOT NULL,
idxStato INT NOT NULL,
presaInCarico DATETIME,
inizioIntervento DATETIME,
fineIntervento DATETIME,
descrizioneIntervento NVARCHAR(500),
isPreventivabile BIT NOT NULL CONSTRAINT DF_InterventiMtz_isPreventivabile DEFAULT (0),
idxCausale INT
)
GO
ALTER TABLE InterventiMtz ADD
CONSTRAINT FK_InterventiMtz_AnagPriorita FOREIGN KEY(idxPriorita) REFERENCES AnagPriorita(idxPriorita) ON UPDATE CASCADE,
CONSTRAINT FK_InterventiMtz_AnagStati FOREIGN KEY(idxStato) REFERENCES AnagStati(idxStato) ON UPDATE CASCADE,
CONSTRAINT FK_InterventiMtz_AnagImpianti FOREIGN KEY(idxImpianto) REFERENCES AnagImpianti(idxImpianto),
CONSTRAINT FK_InterventiMtz_AnagTipoGuasto FOREIGN KEY(idxTipo) REFERENCES AnagTipoGuasto(idxTipo) ON UPDATE CASCADE,
CONSTRAINT FK_InterventiMtz_AnagAmbitoGuasto FOREIGN KEY(idxAmbito) REFERENCES AnagAmbitoGuasto(idxAmbito) ON UPDATE CASCADE,
CONSTRAINT FK_InterventiMtz_AnagCausali FOREIGN KEY(idxCausale) REFERENCES AnagCausali(idxCausale) ON UPDATE CASCADE,
CONSTRAINT FK_InterventiMtz_AnagMacchine FOREIGN KEY(idxMacchina) REFERENCES AnagMacchine(idxMacchina) ON UPDATE CASCADE
GO
CREATE TABLE InterventoOpMtz(
numIntMtz INT NOT NULL,
matrOp NVARCHAR(10) NOT NULL,
durataMinuti INT,
CONSTRAINT PK_InterventoOpMtz PRIMARY KEY(numIntMtz,matrOp)
)
GO
ALTER TABLE InterventoOpMtz ADD
CONSTRAINT FK_InterventoOpMtz_InterventiMtz FOREIGN KEY(numIntMtz) REFERENCES InterventiMtz(numIntMtz) ON UPDATE CASCADE
GO
CREATE TABLE LogUpdateDb(
Versione INT NOT NULL CONSTRAINT PK_LogUpdateDb PRIMARY KEY,
Data DATETIME
)
GO
CREATE TABLE Macchine2FamMacchine(
idxMacchina INT NOT NULL,
idxFamMacchine INT NOT NULL,
CONSTRAINT PK_Macchine2FamMacchine PRIMARY KEY(idxMacchina,idxFamMacchine)
)
GO
ALTER TABLE Macchine2FamMacchine ADD
CONSTRAINT FK_Macchine2FamMacchine_AnagMacchine FOREIGN KEY(idxMacchina) REFERENCES AnagMacchine(idxMacchina) ON UPDATE CASCADE,
CONSTRAINT FK_Macchine2FamMacchine_AnagFamMacchine FOREIGN KEY(idxFamMacchine) REFERENCES AnagFamMacchine(idxFamMacchine) ON UPDATE CASCADE
GO
CREATE TABLE MtzProgPending(
idxPending INT NOT NULL IDENTITY CONSTRAINT PK_MtzProgPending PRIMARY KEY,
idxIntPro INT NOT NULL,
idxMacchina INT,
data DATETIME,
descrizione NVARCHAR(500),
idxPriorita INT,
isFermo BIT CONSTRAINT DF_MtzProgPending_isFermo DEFAULT (1),
idxTipo INT
)
GO
CREATE TABLE MtzProgrammata(
idxIntPro INT NOT NULL IDENTITY CONSTRAINT PK_MtzProgrammata PRIMARY KEY,
idxMacchina INT,
inizio DATETIME,
codFrequenza NCHAR(2),
cadenza INT,
descrizione NVARCHAR(500),
idxPriorita INT,
isFermo BIT CONSTRAINT DF_MtzProgrammata_isFermo DEFAULT (1),
idxTipo INT
)
GO
ALTER TABLE MtzProgrammata ADD
CONSTRAINT FK_MtzProgrammata_AnagFrequenze FOREIGN KEY(codFrequenza) REFERENCES AnagFrequenze(codFrequenza) ON UPDATE CASCADE,
CONSTRAINT FK_MtzProgrammata_AnagMacchine FOREIGN KEY(idxMacchina) REFERENCES AnagMacchine(idxMacchina) ON UPDATE CASCADE
GO
CREATE TABLE OreAperturaSett(
giorno INT NOT NULL CONSTRAINT PK_OreAperturaSett PRIMARY KEY,
descrGiorno NVARCHAR(50),
apertura DECIMAL(4,2)
)
GO
CREATE TABLE Permessi(
COD_PERMESSO VARCHAR(50) NOT NULL CONSTRAINT PK_Permessi PRIMARY KEY,
URL VARCHAR(250) NOT NULL,
GRUPPO INT,
NUMERO INT,
NOME VARCHAR(50),
DESCRIZIONE VARCHAR(50)
)
GO
CREATE TABLE Permessi2Funzione(
COD_PERMESSO VARCHAR(50) NOT NULL,
COD_FUNZIONE NVARCHAR(31) NOT NULL,
READWRITE CHAR(1),
CONSTRAINT PK_Permessi2Funzione PRIMARY KEY(COD_PERMESSO,COD_FUNZIONE)
)
GO
ALTER TABLE Permessi2Funzione ADD
CONSTRAINT FK_Permessi2Funzione_Permessi FOREIGN KEY(COD_PERMESSO) REFERENCES Permessi(COD_PERMESSO) ON UPDATE CASCADE
GO
CREATE TABLE Tra_Ev2Stati(
idxStato INT NOT NULL,
idxEvento INT NOT NULL,
nextIdxStato INT NOT NULL,
CONSTRAINT PK_Tra_Ev2Stati PRIMARY KEY(idxStato,idxEvento)
)
GO
ALTER TABLE Tra_Ev2Stati ADD
CONSTRAINT FK_Tra_Ev2Stati_AnagStati FOREIGN KEY(idxStato) REFERENCES AnagStati(idxStato) ON UPDATE CASCADE,
CONSTRAINT FK_Tra_Ev2Stati_AnagEventi FOREIGN KEY(idxEvento) REFERENCES AnagEventi(idxEvento) ON UPDATE CASCADE
GO
ALTER TABLE MtzProgPending ADD
CONSTRAINT FK_MtzProgPending_MtzProgrammata FOREIGN KEY(idxIntPro) REFERENCES MtzProgrammata(idxIntPro) ON UPDATE CASCADE ON DELETE CASCADE
GO
COMMIT
GO
/* creo funzioni */
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
CREATE FUNCTION f_padLeft (@string VARCHAR(255), @desired_length INTEGER, @pad_character CHAR(1))
RETURNS VARCHAR(255) AS
BEGIN
-- Prefix the required number of spaces to bulk up the string and then replace the spaces with the desired character
RETURN CASE
WHEN LEN(@string) < @desired_length
THEN REPLACE(SPACE(@desired_length - LEN(@string)), ' ', @pad_character) + @string
ELSE @string
END
END
GO
CREATE FUNCTION rightDivision
(
@dividendo FLOAT,
@divisore FLOAT
)
RETURNS FLOAT
AS
BEGIN
DECLARE @errore AS INT
DECLARE @risultato AS FLOAT
SET @errore =0
SET @errore = CASE WHEN (isnull(@dividendo,0))<=0 THEN 1 END
SET @errore = CASE WHEN (isnull(@divisore,0)) <=0 THEN 1 END
SET @risultato= CASE WHEN (@errore=1) THEN -1 ELSE @dividendo/@divisore END
RETURN @risultato
END
GO
COMMIT
GO
/* creo stored e funzioni */
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
/*************************************
* STORED PROCEDURE sp_clonaImpianto
* Clona i dati dell'impianto indicato
*
* modif.: S.E.L. - 2009.01.14
**************************************/
CREATE PROCEDURE sp_clonaImpianto
(
@idxImpianto INT
)
AS
BEGIN TRAN
INSERT INTO AnagImpianti
(codImpianto, nomeImpianto, tipoImpianto, funzDal, funzAl)
SELECT codImpianto + '-clone' AS Expr1, nomeImpianto + '-clone' AS Expr2, tipoImpianto, funzDal, funzAl
FROM AnagImpianti AS AnagImpianti_1
WHERE (idxImpianto = @idxImpianto)
COMMIT TRAN
RETURN
GO
/*************************************
* STORED PROCEDURE sp_clonaMacchina
* Clona i dati della macchina indicata
*
* modif.: S.E.L. - 2009.01.14
**************************************/
CREATE PROCEDURE sp_clonaMacchina
(
@idxMacchina INT
)
AS
BEGIN TRAN
INSERT INTO AnagMacchine
(idxImpianto, codMacchina, nomeMacchina, modello, anno, kgPeso, kwConsumo, funzDal, funzAl)
SELECT idxImpianto, codMacchina + '-clone' AS Expr1, nomeMacchina + '-clone' AS Expr2, modello, anno, kgPeso, kwConsumo, funzDal, funzAl
FROM AnagMacchine AS AnagMacchine_1
WHERE (idxMacchina = @idxMacchina)
COMMIT TRAN
RETURN
GO
/*************************************
* STORED PROCEDURE sp_elencoIntMTBF_MTTR
* Restituisce elenco degli interventi x fare il calcolo MTBF/MTTR FILTRANDO per:
* - idxStati
* - idxImpianto
* - idxMacchina
*
* modif.: S.E.L. - 2009.02.11
**************************************/
CREATE PROCEDURE sp_elencoIntMTBF_MTTR
(
@inizio DATETIME,
@fine DATETIME,
@username VARCHAR(100)
)
AS
SELECT COUNT(v_elencoIntervFilt.numIntMtz) AS numInterventi, SUM(v_elencoIntervFilt.durataMtz) AS totOreMtz, SUM(v_elencoIntervFilt.durataOff) AS totOreOfficina,
v_elencoIntervFilt.codImpianto, v_elencoIntervFilt.codMacchina, v_elencoIntervFilt.nomeImpianto, v_elencoIntervFilt.nomeMacchina
FROM FiltroImpianti INNER JOIN
FiltroMacchine INNER JOIN
v_elencoIntervFilt INNER JOIN
FiltroStati ON v_elencoIntervFilt.idxStato = FiltroStati.idxStato ON FiltroMacchine.idxMacchina = v_elencoIntervFilt.idxMacchina ON
FiltroImpianti.idxImpianto = v_elencoIntervFilt.idxImpianto
WHERE (v_elencoIntervFilt.richiesta BETWEEN @inizio AND @fine) AND (FiltroStati.username = @username) AND (FiltroMacchine.username = @username) AND
(FiltroImpianti.username = @username)
GROUP BY v_elencoIntervFilt.codImpianto, v_elencoIntervFilt.codMacchina, v_elencoIntervFilt.nomeImpianto, v_elencoIntervFilt.nomeMacchina
RETURN
GO
/*************************************
* STORED PROCEDURE sp_insRichiesta
* Inserisce nuova richiesta di intervento
*
* modif.: S.E.L. - 2009.01.22
**************************************/
CREATE PROCEDURE sp_insRichiesta
(
@richiesta DATETIME,
@dataLav DATETIME,
@turnoLav INT,
@matr VARCHAR(10),
@guasto DATETIME,
@idxAmbito INT,
@idxPriorita INT,
@isFermo BIT,
@idxTipo INT,
@idxImpianto INT,
@idxMacchina INT,
@descrizione VARCHAR(500),
@numIntMtz INT output
)
AS
BEGIN TRAN
INSERT INTO InterventiMtz
(richiesta, dataLav, turnoLav, matr, guasto, idxAmbito, idxPriorita, isFermo, idxTipo, idxImpianto, idxMacchina, descrizione, idxStato)
VALUES (@richiesta,@dataLav,@turnoLav,@matr,@guasto,@idxAmbito,@idxPriorita,@isFermo,@idxTipo,@idxImpianto,@idxMacchina,@descrizione, 1)
/*************************************
* salvo idx del nuovo record
**************************************/
SET @numIntMtz = SCOPE_IDENTITY()
COMMIT TRAN
RETURN (@numIntMtz)
GO
/*************************************
* STORED PROCEDURE sp_procStatEv
* esegue la chiamata d processing x stati in base all'attuale stato ed all'evento associato
*
* modif.: S.E.L.
* il: 2009.01.22
**************************************/
CREATE PROCEDURE sp_procStatEv
(
@numIntMtz INT,
@idxEvento INT,
@idxStatoNew INT OUTPUT
)
AS
-- chiamo la query di update, che cerca una riga nella tab transizioni x lo stato e l'evento richiesti e se li trova esegue update del ciclo...
DECLARE @currIdxStato AS INT
DECLARE @procedere AS INT
BEGIN TRAN
-- calcolo stato corrente del ciclo...
SET @currIdxStato = ISNULL((SELECT idxStato
FROM InterventiMtz
WHERE (numIntMtz = @numIntMtz)),0)
-- cerco transizione da stato ed evento associati...
SET @procedere = ISNULL((SELECT COUNT(*) FROM Tra_Ev2Stati WHERE idxEvento=@idxEvento AND idxStato=@currIdxStato),0)
-- se trovo eseguo transizione...
IF(@procedere >0)
BEGIN
UPDATE InterventiMtz
SET idxStato = Tra_Ev2Stati.nextIdxStato
FROM InterventiMtz INNER JOIN
Tra_Ev2Stati ON InterventiMtz.idxStato = Tra_Ev2Stati.idxStato
WHERE (InterventiMtz.numIntMtz = @numIntMtz) AND (Tra_Ev2Stati.idxEvento = @idxEvento)
END
COMMIT TRAN
-- calcolo lo stato nuovo...
SET @idxStatoNew = ISNULL((SELECT idxStato
FROM InterventiMtz
WHERE (numIntMtz = @numIntMtz)),0)
RETURN (@idxStatoNew)
GO
/*************************************
* STORED PROCEDURE sp_setPresaInCarico
* indica la richiesta come presa in carico con data/ora attuale del server
*
* modif.: S.E.L. - 2009.01.22
**************************************/
CREATE PROCEDURE sp_setPresaInCarico
(
@numIntMtz INT,
@idxStatoNew INT OUTPUT
)
AS
BEGIN TRAN
-- inserisco data presa in carico
UPDATE InterventiMtz
SET presaInCarico = GETDATE()
WHERE (numIntMtz = @numIntMtz)
-- aggiorno da machcian a stati...
EXEC sp_procStatEv @numIntMtz, 1, @idxStatoNew
COMMIT TRAN
RETURN (@idxStatoNew)
GO
/*************************************
* STORED PROCEDURE sp_spostaMacchina
* Sposta la macchina all'impianto indicato
*
* modif.: S.E.L. - 2009.01.14
**************************************/
CREATE PROCEDURE sp_spostaMacchina
(
@idxMacchina INT,
@idxImpiantoTo INT
)
AS
UPDATE AnagMacchine
SET idxImpianto = @idxImpiantoTo
WHERE (idxMacchina = @idxMacchina)
RETURN
GO
/*************************************
* STORED PROCEDURE sp_updateIntervento
* aggiorna i dati dell'intervento compilati dalla manutenzione
*
* modif.: S.E.L. - 2009.01.28
**************************************/
CREATE PROCEDURE sp_updateIntervento
(
@Original_numIntMtz INT,
@idxStato INT,
@inizioIntervento DATETIME,
@fineIntervento DATETIME,
@isPreventivabile BIT,
@descrizioneIntervento VARCHAR(500)
)
AS
UPDATE InterventiMtz
SET inizioIntervento = @inizioIntervento, fineIntervento = @fineIntervento, descrizioneIntervento = @descrizioneIntervento, isPreventivabile = @isPreventivabile, idxStato = @idxStato
WHERE (numIntMtz = @Original_numIntMtz)
RETURN
GO
/*************************************
* STORED PROCEDURE sp_updateInterventoFull
* aggiorna TUTTI i dati dell'intervento
*
* modif.: S.E.L. - 2009.02.02
**************************************/
CREATE PROCEDURE sp_updateInterventoFull
(
@Original_numIntMtz INT,
@idxStato INT,
@inizioIntervento DATETIME,
@fineIntervento DATETIME,
@isPreventivabile BIT,
@descrizioneIntervento VARCHAR(500),
@matr VARCHAR(50),
@guasto DATETIME,
@isFermo BIT,
@idxImpianto INT,
@idxMacchina INT,
@idxAmbito INT,
@idxPriorita INT,
@descrizione VARCHAR(500),
@idxTipo INT,
@presaInCarico DATETIME
)
AS
UPDATE InterventiMtz
SET inizioIntervento = @inizioIntervento, fineIntervento = @fineIntervento, descrizioneIntervento = @descrizioneIntervento, isPreventivabile = @isPreventivabile,
idxStato = @idxStato, matr = @matr, guasto = @guasto, idxAmbito = @idxAmbito, idxPriorita = @idxPriorita, isFermo = @isFermo, idxTipo = @idxTipo,
idxImpianto = @idxImpianto, idxMacchina = @idxMacchina, descrizione = @descrizione, presaInCarico = @presaInCarico
WHERE (numIntMtz = @Original_numIntMtz)
RETURN
GO
COMMIT
GO
/* creo viste */
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
CREATE VIEW v_vocabolario
AS
SELECT Lingua, Lemma, Traduzione
FROM SteamWare_Vocabolario.dbo.Vocabolario
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "Vocabolario (SteamWare_Vocabolario.dbo)"
Begin Extent =
Top = 6
Left = 38
Bottom = 99
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_vocabolario'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_vocabolario'
GO
COMMIT
GO
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
CREATE VIEW v_selAmbiti
AS
SELECT TOP (100) PERCENT idxAmbito AS value, descrAmbitoGuasto AS label
FROM dbo.AnagAmbitoGuasto
ORDER BY label
GO
CREATE VIEW v_selCausaliMacchine
AS
SELECT dbo.AnagCausali.idxCausale AS value, dbo.AnagCausali.descrCausale AS label, dbo.Macchine2FamMacchine.idxMacchina AS conditio
FROM dbo.Causali2FamMacchine INNER JOIN
dbo.Macchine2FamMacchine ON dbo.Causali2FamMacchine.idxFamMacchine = dbo.Macchine2FamMacchine.idxFamMacchine INNER JOIN
dbo.AnagCausali ON dbo.Causali2FamMacchine.idxCausale = dbo.AnagCausali.idxCausale
GO
CREATE VIEW v_selFamMacc
AS
SELECT dbo.Macchine2FamMacchine.idxFamMacchine, dbo.AnagMacchine.idxMacchina, dbo.AnagFamMacchine.nomeFamMacch AS famiglia,
ISNULL(dbo.AnagMacchine.codMacchina, 'n.d.') + ' - ' + dbo.AnagMacchine.nomeMacchina + ', mod. ' + ISNULL(dbo.AnagMacchine.modello, 'n.d.')
+ ' (' + ISNULL(dbo.AnagMacchine.matricola, 'n.d.') + ')' AS macchina
FROM dbo.Macchine2FamMacchine INNER JOIN
dbo.AnagFamMacchine ON dbo.Macchine2FamMacchine.idxFamMacchine = dbo.AnagFamMacchine.idxFamMacchine INNER JOIN
dbo.AnagMacchine ON dbo.Macchine2FamMacchine.idxMacchina = dbo.AnagMacchine.idxMacchina
GO
CREATE VIEW v_selFreq
AS
SELECT codFrequenza AS value, frequenza AS label
FROM dbo.AnagFrequenze
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagFrequenze"
Begin Extent =
Top = 6
Left = 38
Bottom = 84
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selFreq'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selFreq'
GO
CREATE VIEW v_selImpianti
AS
SELECT TOP (100) PERCENT idxImpianto AS value, nomeImpianto + ' - ' + ISNULL(tipoImpianto, 'n.d.') + ' (' + ISNULL(codImpianto, 'n.d.') + ')' AS label
FROM dbo.AnagImpianti
ORDER BY label
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagImpianti"
Begin Extent =
Top = 6
Left = 38
Bottom = 114
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 4185
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selImpianti'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selImpianti'
GO
CREATE VIEW v_selMacchine
AS
SELECT TOP (100) PERCENT idxMacchina AS value, LTRIM(RTRIM(nomeMacchina)) + ' (' + ISNULL(codMacchina, 'n.d.') + ') ' + ', mod. ' + ISNULL(modello, 'n.d.')
+ ' (' + ISNULL(matricola, 'n.d.') + ')' AS label, idxImpianto AS conditio
FROM dbo.AnagMacchine
ORDER BY label
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = -384
Left = 0
End
Begin Tables =
Begin Table = "AnagMacchine"
Begin Extent =
Top = 6
Left = 38
Bottom = 114
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 6795
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selMacchine'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selMacchine'
GO
CREATE VIEW v_selPeriodiTrad
AS
SELECT TOP (100) PERCENT dbo.AnagPeriodi.codPeriodo AS value, dbo.v_vocabolario.Traduzione AS label, dbo.v_vocabolario.Lingua AS conditio
FROM dbo.AnagPeriodi INNER JOIN
dbo.v_vocabolario ON dbo.AnagPeriodi.lemmaPeriodo = dbo.v_vocabolario.Lemma
ORDER BY label
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagPeriodi"
Begin Extent =
Top = 6
Left = 38
Bottom = 84
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "v_vocabolario"
Begin Extent =
Top = 6
Left = 227
Bottom = 99
Right = 378
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selPeriodiTrad'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selPeriodiTrad'
GO
CREATE VIEW v_selPrior
AS
SELECT TOP (100) PERCENT idxPriorita AS value, CAST(idxPriorita AS VARCHAR(4)) + ' - ' + descrPriorita AS label
FROM dbo.AnagPriorita
ORDER BY label
GO
CREATE VIEW v_selSemafori
AS
SELECT TOP (100) PERCENT codSemaforo AS value, descrSemaforo AS label
FROM dbo.AnagSemafori
ORDER BY label
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagSemafori"
Begin Extent =
Top = 6
Left = 38
Bottom = 84
Right = 190
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selSemafori'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selSemafori'
GO
CREATE VIEW v_selStato
AS
SELECT idxStato AS value, DescrStato AS label
FROM dbo.AnagStati
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagStati"
Begin Extent =
Top = 6
Left = 38
Bottom = 99
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selStato'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selStato'
GO
CREATE VIEW v_selTipoGuasto
AS
SELECT TOP (100) PERCENT idxTipo AS value, descrTipo AS label
FROM dbo.AnagTipoGuasto
ORDER BY label
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagTipoGuasto"
Begin Extent =
Top = 6
Left = 38
Bottom = 84
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selTipoGuasto'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selTipoGuasto'
GO
COMMIT
GO
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
CREATE VIEW v_interventiErogati
AS
SELECT numIntMtz, SUM(durataMinuti) AS totMinErogati
FROM dbo.InterventoOpMtz
GROUP BY numIntMtz
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "InterventoOpMtz"
Begin Extent =
Top = 6
Left = 38
Bottom = 99
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 12
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_interventiErogati'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_interventiErogati'
GO
CREATE VIEW v_intervExp
AS
SELECT TOP (100) PERCENT dbo.InterventiMtz.numIntMtz, dbo.InterventiMtz.richiesta, dbo.InterventiMtz.dataLav, dbo.InterventiMtz.turnoLav, dbo.InterventiMtz.matr,
dbo.InterventiMtz.guasto, dbo.InterventiMtz.idxAmbito, dbo.AnagAmbitoGuasto.descrAmbitoGuasto, dbo.InterventiMtz.idxPriorita,
dbo.AnagPriorita.descrPriorita, dbo.InterventiMtz.isFermo, dbo.InterventiMtz.idxTipo, dbo.AnagTipoGuasto.descrTipo, dbo.InterventiMtz.idxImpianto,
dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto, dbo.InterventiMtz.idxMacchina, dbo.AnagMacchine.codMacchina,
dbo.AnagMacchine.nomeMacchina, dbo.InterventiMtz.descrizione, dbo.InterventiMtz.idxStato, dbo.AnagStati.DescrStato,
ISNULL(dbo.InterventiMtz.presaInCarico, dbo.InterventiMtz.richiesta) AS presaInCarico, ISNULL(dbo.InterventiMtz.inizioIntervento,
ISNULL(dbo.InterventiMtz.presaInCarico, dbo.InterventiMtz.richiesta)) AS inizioIntervento, ISNULL(dbo.InterventiMtz.fineIntervento, GETDATE())
AS fineIntervento, dbo.InterventiMtz.descrizioneIntervento, dbo.InterventiMtz.isPreventivabile, dbo.InterventiMtz.idxCausale,
ISNULL(dbo.AnagCausali.descrCausale, 'N.D.') AS descrCausale
FROM dbo.InterventiMtz INNER JOIN
dbo.AnagAmbitoGuasto ON dbo.InterventiMtz.idxAmbito = dbo.AnagAmbitoGuasto.idxAmbito INNER JOIN
dbo.AnagImpianti ON dbo.InterventiMtz.idxImpianto = dbo.AnagImpianti.idxImpianto INNER JOIN
dbo.AnagMacchine ON dbo.InterventiMtz.idxMacchina = dbo.AnagMacchine.idxMacchina INNER JOIN
dbo.AnagTipoGuasto ON dbo.InterventiMtz.idxTipo = dbo.AnagTipoGuasto.idxTipo INNER JOIN
dbo.AnagPriorita ON dbo.InterventiMtz.idxPriorita = dbo.AnagPriorita.idxPriorita INNER JOIN
dbo.AnagStati ON dbo.InterventiMtz.idxStato = dbo.AnagStati.idxStato LEFT OUTER JOIN
dbo.AnagCausali ON dbo.InterventiMtz.idxCausale = dbo.AnagCausali.idxCausale
ORDER BY dbo.InterventiMtz.numIntMtz DESC
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "InterventiMtz"
Begin Extent =
Top = 5
Left = 576
Bottom = 360
Right = 761
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagAmbitoGuasto"
Begin Extent =
Top = 4
Left = 213
Bottom = 82
Right = 386
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagImpianti"
Begin Extent =
Top = 113
Left = 834
Bottom = 221
Right = 985
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagMacchine"
Begin Extent =
Top = 181
Left = 227
Bottom = 289
Right = 378
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagTipoGuasto"
Begin Extent =
Top = 91
Left = 228
Bottom = 169
Right = 379
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagPriorita"
Begin Extent =
Top = 19
Left = 834
Bottom = 97
Right = 985
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagStati"
Begin Extent =
Top = 237
Left = 834
Bottom = 315
Right = 985
', 'SCHEMA', 'dbo', 'VIEW', 'v_intervExp'
GO
EXEC sp_addextendedproperty 'MS_DiagramPane2', ' End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagCausali"
Begin Extent =
Top = 295
Left = 235
Bottom = 373
Right = 386
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 30
Width = 284
Width = 1500
Width = 1665
Width = 1185
Width = 1500
Width = 1500
Width = 1830
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_intervExp'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 2, 'SCHEMA', 'dbo', 'VIEW', 'v_intervExp'
GO
CREATE VIEW v_macchine
AS
SELECT dbo.AnagMacchine.idxMacchina, dbo.AnagMacchine.idxImpianto, dbo.AnagMacchine.codMacchina, dbo.AnagMacchine.nomeMacchina, dbo.AnagMacchine.modello,
dbo.AnagMacchine.matricola, dbo.AnagMacchine.anno, dbo.AnagMacchine.kgPeso, dbo.AnagMacchine.kwConsumo, dbo.AnagMacchine.funzDal,
dbo.AnagMacchine.funzAl, dbo.AnagImpianti.codImpianto + ' - ' + dbo.AnagImpianti.nomeImpianto AS descrImpianto
FROM dbo.AnagMacchine INNER JOIN
dbo.AnagImpianti ON dbo.AnagMacchine.idxImpianto = dbo.AnagImpianti.idxImpianto
GO
CREATE VIEW v_mtzProgExp
AS
SELECT dbo.MtzProgrammata.idxIntPro, dbo.MtzProgrammata.idxMacchina, dbo.AnagMacchine.codMacchina, dbo.AnagMacchine.nomeMacchina, dbo.MtzProgrammata.inizio,
dbo.MtzProgrammata.codFrequenza, dbo.AnagFrequenze.frequenza, dbo.MtzProgrammata.cadenza, dbo.MtzProgrammata.descrizione,
dbo.MtzProgrammata.idxPriorita, dbo.AnagPriorita.descrPriorita, dbo.MtzProgrammata.isFermo, dbo.MtzProgrammata.idxTipo, dbo.AnagTipoGuasto.descrTipo
FROM dbo.MtzProgrammata INNER JOIN
dbo.AnagMacchine ON dbo.MtzProgrammata.idxMacchina = dbo.AnagMacchine.idxMacchina INNER JOIN
dbo.AnagFrequenze ON dbo.MtzProgrammata.codFrequenza = dbo.AnagFrequenze.codFrequenza INNER JOIN
dbo.AnagPriorita ON dbo.MtzProgrammata.idxPriorita = dbo.AnagPriorita.idxPriorita INNER JOIN
dbo.AnagTipoGuasto ON dbo.MtzProgrammata.idxTipo = dbo.AnagTipoGuasto.idxTipo
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "MtzProgrammata"
Begin Extent =
Top = 6
Left = 38
Bottom = 275
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagMacchine"
Begin Extent =
Top = 6
Left = 227
Bottom = 114
Right = 378
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagFrequenze"
Begin Extent =
Top = 6
Left = 416
Bottom = 84
Right = 567
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagPriorita"
Begin Extent =
Top = 6
Left = 605
Bottom = 99
Right = 756
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagTipoGuasto"
Begin Extent =
Top = 6
Left = 794
Bottom = 84
Right = 945
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 15
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width ', 'SCHEMA', 'dbo', 'VIEW', 'v_mtzProgExp'
GO
EXEC sp_addextendedproperty 'MS_DiagramPane2', '= 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_mtzProgExp'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 2, 'SCHEMA', 'dbo', 'VIEW', 'v_mtzProgExp'
GO
COMMIT
GO
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
CREATE VIEW v_elencoImpiantiMacchine
AS
SELECT dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto, dbo.AnagImpianti.tipoImpianto, dbo.AnagMacchine.codMacchina, dbo.AnagMacchine.nomeMacchina,
dbo.AnagMacchine.modello, ISNULL(dbo.AnagMacchine.matricola, 'n.d.') AS matricola, dbo.AnagMacchine.anno, dbo.AnagMacchine.kgPeso,
dbo.AnagMacchine.kwConsumo
FROM dbo.AnagImpianti INNER JOIN
dbo.AnagMacchine ON dbo.AnagImpianti.idxImpianto = dbo.AnagMacchine.idxImpianto
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagImpianti"
Begin Extent =
Top = 6
Left = 38
Bottom = 171
Right = 189
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagMacchine"
Begin Extent =
Top = 6
Left = 227
Bottom = 207
Right = 378
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 11
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_elencoImpiantiMacchine'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_elencoImpiantiMacchine'
GO
CREATE VIEW v_elencoIntervFilt
AS
SELECT TOP (100) PERCENT dbo.InterventiMtz.numIntMtz, dbo.InterventiMtz.richiesta, dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto,
dbo.AnagMacchine.codMacchina, dbo.AnagMacchine.nomeMacchina, dbo.InterventiMtz.descrizione, dbo.InterventiMtz.inizioIntervento,
dbo.InterventiMtz.fineIntervento, ISNULL(dbo.InterventiMtz.descrizioneIntervento, 'n.d. (report mtz)') AS descrizioneIntervento, ISNULL(dbo.AnagCausali.descrCausale,
'n.d. (causale)') AS descrCausale, ISNULL(dbo.v_interventiErogati.totMinErogati / 60, 0) AS minErogati, ISNULL(DATEDIFF(hour, dbo.InterventiMtz.inizioIntervento,
dbo.InterventiMtz.fineIntervento), 0) AS durataMtz, ISNULL(DATEDIFF(hour, dbo.InterventiMtz.guasto, dbo.InterventiMtz.fineIntervento), 0) AS durataOff,
dbo.InterventiMtz.guasto, dbo.InterventiMtz.idxStato, dbo.InterventiMtz.idxImpianto, dbo.InterventiMtz.idxMacchina
FROM dbo.InterventiMtz INNER JOIN
dbo.AnagAmbitoGuasto ON dbo.InterventiMtz.idxAmbito = dbo.AnagAmbitoGuasto.idxAmbito INNER JOIN
dbo.AnagImpianti ON dbo.InterventiMtz.idxImpianto = dbo.AnagImpianti.idxImpianto INNER JOIN
dbo.AnagMacchine ON dbo.InterventiMtz.idxMacchina = dbo.AnagMacchine.idxMacchina INNER JOIN
dbo.AnagTipoGuasto ON dbo.InterventiMtz.idxTipo = dbo.AnagTipoGuasto.idxTipo INNER JOIN
dbo.AnagPriorita ON dbo.InterventiMtz.idxPriorita = dbo.AnagPriorita.idxPriorita INNER JOIN
dbo.AnagStati ON dbo.InterventiMtz.idxStato = dbo.AnagStati.idxStato LEFT OUTER JOIN
dbo.v_interventiErogati ON dbo.InterventiMtz.numIntMtz = dbo.v_interventiErogati.numIntMtz LEFT OUTER JOIN
dbo.AnagCausali ON dbo.InterventiMtz.idxCausale = dbo.AnagCausali.idxCausale
ORDER BY dbo.InterventiMtz.numIntMtz DESC
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = -23
Left = 0
End
Begin Tables =
Begin Table = "InterventiMtz"
Begin Extent =
Top = 8
Left = 486
Bottom = 354
Right = 671
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagAmbitoGuasto"
Begin Extent =
Top = 11
Left = 82
Bottom = 89
Right = 255
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagImpianti"
Begin Extent =
Top = 123
Left = 219
Bottom = 231
Right = 370
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagMacchine"
Begin Extent =
Top = 190
Left = 826
Bottom = 298
Right = 977
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagTipoGuasto"
Begin Extent =
Top = 90
Left = 1143
Bottom = 168
Right = 1294
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagPriorita"
Begin Extent =
Top = 23
Left = 958
Bottom = 116
Right = 1109
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagStati"
Begin Extent =
Top = 263
Left = 90
Bottom = 356
Right = 241
', 'SCHEMA', 'dbo', 'VIEW', 'v_elencoIntervFilt'
GO
EXEC sp_addextendedproperty 'MS_DiagramPane2', ' End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "v_interventiErogati"
Begin Extent =
Top = 3
Left = 739
Bottom = 81
Right = 890
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "AnagCausali"
Begin Extent =
Top = 291
Left = 1011
Bottom = 369
Right = 1162
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 30
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1575
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_elencoIntervFilt'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 2, 'SCHEMA', 'dbo', 'VIEW', 'v_elencoIntervFilt'
GO
COMMIT
GO
SET xact_abort ON
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
CREATE VIEW v_datiMTBFMTTR
AS
SELECT COUNT(numIntMtz) AS numInterventi, SUM(durataMtz) AS totOreMtz, SUM(durataOff) AS totOreOfficina, codImpianto, codMacchina, nomeImpianto,
nomeMacchina
FROM dbo.v_elencoIntervFilt
GROUP BY codImpianto, codMacchina, nomeImpianto, nomeMacchina
GO
EXEC sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[41] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "v_elencoIntervFilt"
Begin Extent =
Top = 6
Left = 38
Bottom = 391
Right = 223
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 2235
Width = 3210
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 12
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_datiMTBFMTTR'
GO
EXEC sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_datiMTBFMTTR'
GO
COMMIT
GO
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(1, GETDATE())
GO