223 lines
3.7 KiB
Transact-SQL
223 lines
3.7 KiB
Transact-SQL
set xact_abort on
|
|
go
|
|
|
|
begin transaction
|
|
go
|
|
|
|
set ANSI_NULLS on
|
|
go
|
|
|
|
/*****************************************
|
|
* STORED stp_EDM_getByCode
|
|
*
|
|
* Recupera datamatrix da codice
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2011.05.05
|
|
*
|
|
****************************************/
|
|
create PROCEDURE stp_EDM_getByCode
|
|
(
|
|
@CodDataMatrix NUMERIC(23)
|
|
)
|
|
AS
|
|
|
|
SELECT *
|
|
FROM ElencoDataMatrix
|
|
WHERE CodDataMatrix = @CodDataMatrix
|
|
|
|
RETURN
|
|
go
|
|
|
|
/*****************************************
|
|
* STORED stp_EDM_spostaDataMtx
|
|
*
|
|
* Sposta un datamatrix in un nuovo gitterbox
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2011.05.05
|
|
*
|
|
****************************************/
|
|
create PROCEDURE stp_EDM_spostaDataMtx
|
|
(
|
|
@CodDataMatrix NUMERIC(23),
|
|
@CodGitterbox NVARCHAR(10)
|
|
)
|
|
AS
|
|
|
|
-- salvo codice gitterbox di partenza
|
|
DECLARE @CodGitterboxFrom AS NVARCHAR(10)
|
|
SET @CodGitterboxFrom = ( SELECT CodGitterbox FROM ElencoDataMatrix WHERE CodDataMatrix = @CodDataMatrix )
|
|
|
|
UPDATE ElencoDataMatrix
|
|
SET CodGitterbox = @CodGitterbox
|
|
WHERE CodDataMatrix = @CodDataMatrix
|
|
|
|
-- aggiorno valori QTA gitterbox di partenza...
|
|
UPDATE ElencoCartellini
|
|
SET Qta = ( SELECT COUNT(*) FROM ElencoDataMatrix WHERE CodGitterbox = @CodGitterboxFrom )
|
|
WHERE UDC = @CodGitterboxFrom
|
|
-- aggiorno valoti QTA gitterbox destinazione
|
|
UPDATE ElencoCartellini
|
|
SET Qta = ( SELECT COUNT(*) FROM ElencoDataMatrix WHERE CodGitterbox = @CodGitterbox )
|
|
WHERE UDC = @CodGitterbox
|
|
|
|
SELECT *
|
|
FROM ElencoDataMatrix
|
|
WHERE CodDataMatrix = @CodDataMatrix
|
|
|
|
RETURN
|
|
go
|
|
|
|
/*****************************************
|
|
* STORED stp_EDM_svuotaGitterbox
|
|
*
|
|
* Elimina il codice gitterbox dai datamatrix associati (svuotandolo...)
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2011.05.06
|
|
*
|
|
****************************************/
|
|
create PROCEDURE stp_EDM_svuotaGitterbox
|
|
(
|
|
@CodGitterbox NVARCHAR(10)
|
|
)
|
|
AS
|
|
|
|
UPDATE ElencoDataMatrix
|
|
SET CodGitterbox = ''
|
|
WHERE CodGitterbox = @CodGitterbox
|
|
|
|
RETURN
|
|
go
|
|
|
|
commit
|
|
go
|
|
|
|
|
|
|
|
|
|
set xact_abort on
|
|
go
|
|
|
|
begin transaction
|
|
go
|
|
|
|
set ANSI_NULLS on
|
|
go
|
|
|
|
/*****************************************
|
|
* STORED stp_UDC_getByUdc
|
|
*
|
|
* Recupera UDC da codice
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2011.05.05
|
|
*
|
|
****************************************/
|
|
create PROCEDURE stp_UDC_getByUdc
|
|
(
|
|
@UDC NVARCHAR(50)
|
|
)
|
|
AS
|
|
|
|
SELECT *
|
|
FROM ElencoCartellini
|
|
WHERE LTRIM(RTRIM(UDC)) = @UDC
|
|
|
|
RETURN
|
|
go
|
|
|
|
commit
|
|
go
|
|
|
|
|
|
|
|
|
|
/***************************************
|
|
* STORED stp_rappQualGetByNumRapQual
|
|
*
|
|
* Ottiene l'elenco dei record di rapp qualità di AS dato il numero del rapporto di qualità
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2010.09.23
|
|
*
|
|
****************************************/
|
|
ALTER PROCEDURE stp_rappQualGetByNumRapQual
|
|
(
|
|
@nRapQual INT
|
|
)
|
|
AS
|
|
-- restituisce le righe richieste
|
|
SELECT *
|
|
FROM RilPro.RapQual
|
|
WHERE (nRapQual = @nRapQual)
|
|
AND LegaScaric = 'N'
|
|
|
|
RETURN
|
|
|
|
|
|
|
|
/***************************************
|
|
* STORED stp_rappQualGetByNumRapQualSenzaUdc
|
|
*
|
|
* Ottiene l'elenco dei record di rapp qualità di AS dato il numero del rapporto di qualità che NON HANNO UDC
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2011.05.06
|
|
*
|
|
****************************************/
|
|
create PROCEDURE stp_rappQualGetByNumRapQualSenzaUdc
|
|
(
|
|
@nRapQual INT
|
|
)
|
|
AS
|
|
-- restituisce le righe richieste
|
|
SELECT *
|
|
FROM RilPro.RapQual
|
|
WHERE (nRapQual = @nRapQual) AND (UDC IS NULL)
|
|
AND LegaScaric = 'N'
|
|
|
|
RETURN
|
|
|
|
set xact_abort on
|
|
go
|
|
|
|
begin transaction
|
|
go
|
|
|
|
set ANSI_NULLS on
|
|
go
|
|
|
|
/*****************************************
|
|
* STORED stp_EDM_getByGitterBox
|
|
*
|
|
* Recupera datamatrix da codice gitterbox
|
|
*
|
|
* Steamware, S.E.L.
|
|
* mod: 2011.05.06
|
|
*
|
|
****************************************/
|
|
create PROCEDURE stp_EDM_getByGitterBox
|
|
(
|
|
@CodGitterbox NVARCHAR(10)
|
|
)
|
|
AS
|
|
|
|
SELECT *
|
|
FROM ElencoDataMatrix
|
|
WHERE CodGitterbox = @CodGitterbox
|
|
|
|
RETURN
|
|
go
|
|
|
|
commit
|
|
go
|
|
|
|
|
|
|
|
|
|
-- registro versione...
|
|
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(370, GETDATE())
|
|
GO
|