diff --git a/GMW/GMW/bin/GMW.dll b/GMW/GMW/bin/GMW.dll index 7e983dba..271ebc6d 100644 Binary files a/GMW/GMW/bin/GMW.dll and b/GMW/GMW/bin/GMW.dll differ diff --git a/GMW/GMW/bin/GMW_data.dll b/GMW/GMW/bin/GMW_data.dll index 8b007512..3f59409a 100644 Binary files a/GMW/GMW/bin/GMW_data.dll and b/GMW/GMW/bin/GMW_data.dll differ diff --git a/GMW/GMW/bin/SteamWare.dll b/GMW/GMW/bin/SteamWare.dll index de0f194c..138a5124 100644 Binary files a/GMW/GMW/bin/SteamWare.dll and b/GMW/GMW/bin/SteamWare.dll differ diff --git a/GMW/GMW/obj/Release/GMW.dll b/GMW/GMW/obj/Release/GMW.dll index 7e983dba..271ebc6d 100644 Binary files a/GMW/GMW/obj/Release/GMW.dll and b/GMW/GMW/obj/Release/GMW.dll differ diff --git a/GMW/GMW/obj/Release/ResolveAssemblyReference.cache b/GMW/GMW/obj/Release/ResolveAssemblyReference.cache index b3c22079..173a6e99 100644 Binary files a/GMW/GMW/obj/Release/ResolveAssemblyReference.cache and b/GMW/GMW/obj/Release/ResolveAssemblyReference.cache differ diff --git a/GMW/GMW_WS/bilance.asmx.cs b/GMW/GMW_WS/bilance.asmx.cs index 21c24c68..33acdd0c 100644 --- a/GMW/GMW_WS/bilance.asmx.cs +++ b/GMW/GMW_WS/bilance.asmx.cs @@ -14,7 +14,7 @@ namespace GMW_WS /// /// WebService per gestione sw bilance /// - [WebService(Namespace = "http://www.steamware.net/", Description = "Web Services che funziona da collettore di tutte le richieste delle applicazioni per le bilance integrate a GMW v.1.0.250")] + [WebService(Namespace = "http://www.steamware.net/", Description = "Web Services che funziona da collettore di tutte le richieste delle applicazioni per le bilance integrate a GMW v.1.0.255")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class bilance : System.Web.Services.WebService @@ -301,162 +301,6 @@ namespace GMW_WS return answ; } - // metodi SENZA specifica cod magazzino... -#if false - /// - /// Fornisce un nuovo codice UDC tipo completo (con pezzi) a partire dalla richiesta e salva i dati - /// - /// codice anagrafico della bilanca che effettua la richiesta (codice della pesa) - /// codice anagrafico del cliente - /// codice del particolare (articolo) - da anagrafica! - /// Codice dell'impianto - /// Codice dello stampo - /// codice dell'esponente dello stampo - /// Codice figura - /// Data di rif per la dichiarazione - /// Turno di rif per la dichiarazione - /// codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input) - /// codice dell'operatore - /// codice dell'UDC parent (UDC della tara) - /// peso in kg (0 se non noto) da associare all'UDC come tara del contenitore - /// tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...) - /// numero pezzi associati all'UDC - /// Peso totale rilevato - /// Peso unitario rilevato - /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...) - /// UDC del nuovo cartellino - [WebMethod(Description = "Fornisce un nuovo codice UDC tipo completo (con pezzi) a partire dalla richiesta e salva i dati")] - public string UdcCall_GetNew_Pesa(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato) - { - // ricavo cod company... - string CodCS = "ND"; - string answ = "NA"; - try - { - CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilancia)[0].CodCS; - } - catch - { - CodCS = memLayer.ML.confReadString("CodCS"); - } - int IdxPosizione = memLayer.ML.confReadInt("IdxPosNewFusi"); - // creo nuovo cartellino! - DS_Applicazione.ElencoCartelliniDataTable tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), CodCliente, Particolare, CodImpianto, CodStampo, Esponente, Figura, DataRif, TurnoRif, CodImballo, CodSoggetto, Tara, IdxPosizione, CodTipoDichiarazione, "UDC_PESA", Quantita, PesoTot, PesoCad, CodStato, UDC_Parent); // ATTENZIONE: "UDC_PESA" è "hard coded" nel db... !!! - // leggo la riga - try - { - answ = tabUdc[0].UDC; - // salvo associazioen parent-child tra UDC! - DataProxy.obj.taRelazUDC.Insert(UDC_Parent, answ); - } - catch - { } - return answ; - } - - /// - /// Fornisce un nuovo codice UDC tipo completo (con pezzi) a partire dalla richiesta e salva i dati - /// - /// codice anagrafico della bilanca che effettua la richiesta (codice della pesa) - /// codice anagrafico del cliente - /// codice del particolare (articolo) - da anagrafica! - /// Codice dell'impianto - /// Codice dello stampo - /// codice dell'esponente dello stampo - /// Codice figura - /// Data di rif per la dichiarazione - /// Turno di rif per la dichiarazione - /// codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input) - /// codice dell'operatore - /// codice dell'UDC parent (UDC della tara) - /// peso in kg (0 se non noto) da associare all'UDC come tara del contenitore - /// tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...) - /// numero pezzi associati all'UDC - /// Peso totale rilevato - /// Peso unitario rilevato - /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...) - /// UDC del nuovo cartellino per FINITI - [WebMethod(Description = "Fornisce un nuovo codice UDC FINITI tipo completo (con pezzi) a partire dalla richiesta e salva i dati")] - public string UdcCall_GetNew_Finito(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato) - { - // ricavo cod company... - string CodCS = "ND"; - string answ = "NA"; - try - { - CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilancia)[0].CodCS; - } - catch - { - CodCS = memLayer.ML.confReadString("CodCS"); - } - int IdxPosizione = memLayer.ML.confReadInt("IdxPosNewFinito"); - // creo nuovo cartellino! - DS_Applicazione.ElencoCartelliniDataTable tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), CodCliente, Particolare, CodImpianto, CodStampo, Esponente, Figura, DataRif, TurnoRif, CodImballo, CodSoggetto, Tara, IdxPosizione, CodTipoDichiarazione, "UDC_FINITO", Quantita, PesoTot, PesoCad, CodStato, UDC_Parent); // ATTENZIONE: "UDC_FINITO" è "hard coded" nel db... !!! - // leggo la riga - try - { - answ = tabUdc[0].UDC; - // salvo associazioen parent-child tra UDC! - DataProxy.obj.taRelazUDC.Insert(UDC_Parent, answ); - } - catch - { } - return answ; - } - - /// - /// Fornisce un nuovo codice UDC tipo completo (con pezzi) a partire dalla richiesta e salva i dati - /// - /// codice anagrafico della bilanca che effettua la richiesta (codice della pesa) - /// codice anagrafico del cliente - /// codice del particolare (articolo) - da anagrafica! - /// Codice dell'impianto - /// Codice dello stampo - /// codice dell'esponente dello stampo - /// Codice figura - /// Data di rif per la dichiarazione - /// Turno di rif per la dichiarazione - /// codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input) - /// codice dell'operatore - /// codice dell'UDC parent (UDC della tara) - /// peso in kg (0 se non noto) da associare all'UDC come tara del contenitore - /// tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...) - /// numero pezzi associati all'UDC - /// Peso totale rilevato - /// Peso unitario rilevato - /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...) - /// UDC del nuovo cartellino per FINITI - [WebMethod(Description = "Fornisce un nuovo codice UDC WIP tipo completo (con pezzi) a partire dalla richiesta e salva i dati")] - public string UdcCall_GetNew_WIP(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato) - { - // ricavo cod company... - string CodCS = "ND"; - string answ = "NA"; - try - { - CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilancia)[0].CodCS; - } - catch - { - CodCS = memLayer.ML.confReadString("CodCS"); - } - int IdxPosizione = memLayer.ML.confReadInt("IdxPosNewWip"); - // creo nuovo cartellino! - DS_Applicazione.ElencoCartelliniDataTable tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), CodCliente, Particolare, CodImpianto, CodStampo, Esponente, Figura, DataRif, TurnoRif, CodImballo, CodSoggetto, Tara, IdxPosizione, CodTipoDichiarazione, "UDC_WIP", Quantita, PesoTot, PesoCad, CodStato, UDC_Parent); // ATTENZIONE: "UDC_WIP" è "hard coded" nel db... !!! - // leggo la riga - try - { - answ = tabUdc[0].UDC; - // salvo associazioen parent-child tra UDC! - DataProxy.obj.taRelazUDC.Insert(UDC_Parent, answ); - } - catch - { } - return answ; - } -#endif - /// /// Fornisce un nuovo codice UDC tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e salva i dati /// @@ -478,10 +322,11 @@ namespace GMW_WS /// Peso totale rilevato /// Peso unitario rilevato /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...) - /// Codice INT del magazzino in cui inserire l'UDC + /// Codice del magazzino in cui inserire l'UDC + /// TRUE = genera movimento AS400, FALSE = NON genera movimento di magazzino /// UDC del nuovo cartellino [WebMethod(Description = "Fornisce un nuovo codice UDC tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e salva i dati")] - public string UdcCall_GetNew_Pesa(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag) + public string UdcCall_GetNew_Pesa(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag, bool toAS400) { // ricavo cod company... string CodCS = "ND"; @@ -505,6 +350,11 @@ namespace GMW_WS } // creo nuovo cartellino! DS_Applicazione.ElencoCartelliniDataTable tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), CodCliente, Particolare, CodImpianto, CodStampo, Esponente, Figura, DataRif, TurnoRif, CodImballo, CodSoggetto, Tara, IdxPosizione, CodTipoDichiarazione, "UDC_PESA", Quantita, PesoTot, PesoCad, CodStato, UDC_Parent); // ATTENZIONE: "UDC_PESA" è "hard coded" nel db... !!! + // se NON richiesto di generare movimento a magazzino crea rettifica in tab batch + if (!toAS400) + { + DataProxy.obj.taCartellini.stp_rettMovAs400(Particolare, IdxPosizione.ToString(), Quantita); + } // leggo la riga try { @@ -538,10 +388,11 @@ namespace GMW_WS /// Peso totale rilevato /// Peso unitario rilevato /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...) - /// Codice INT del magazzino in cui inserire l'UDC + /// Codice del magazzino in cui inserire l'UDC + /// TRUE = genera movimento AS400, FALSE = NON genera movimento di magazzino /// UDC del nuovo cartellino per FINITI [WebMethod(Description = "Fornisce un nuovo codice UDC FINITI tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e salva i dati")] - public string UdcCall_GetNew_Finito(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag) + public string UdcCall_GetNew_Finito(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag, bool toAS400) { // ricavo cod company... string CodCS = "ND"; @@ -565,6 +416,11 @@ namespace GMW_WS } // creo nuovo cartellino! DS_Applicazione.ElencoCartelliniDataTable tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), CodCliente, Particolare, CodImpianto, CodStampo, Esponente, Figura, DataRif, TurnoRif, CodImballo, CodSoggetto, Tara, IdxPosizione, CodTipoDichiarazione, "UDC_FINITO", Quantita, PesoTot, PesoCad, CodStato, UDC_Parent); // ATTENZIONE: "UDC_FINITO" è "hard coded" nel db... !!! + // se NON richiesto di generare movimento a magazzino crea rettifica in tab batch + if (!toAS400) + { + DataProxy.obj.taCartellini.stp_rettMovAs400(Particolare, IdxPosizione.ToString(), Quantita); + } // leggo la riga try { @@ -598,10 +454,11 @@ namespace GMW_WS /// Peso totale rilevato /// Peso unitario rilevato /// Codice dello stato del pezzo (da anagrafica: sabbiato, ...) - /// Codice INT del magazzino in cui inserire l'UDC + /// Codice del magazzino in cui inserire l'UDC + /// TRUE = genera movimento AS400, FALSE = NON genera movimento di magazzino /// UDC del nuovo cartellino per FINITI [WebMethod(Description = "Fornisce un nuovo codice UDC WIP tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e salva i dati")] - public string UdcCall_GetNew_WIP(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag) + public string UdcCall_GetNew_WIP(string CodBilancia, string CodCliente, string Particolare, string CodImpianto, string CodStampo, string Esponente, string Figura, string UDC_Parent, double Tara, string CodImballo, string CodTipoDichiarazione, string CodSoggetto, int Quantita, float PesoTot, float PesoCad, DateTime DataRif, int TurnoRif, string CodStato, int CodMag, bool toAS400) { // ricavo cod company... string CodCS = "ND"; @@ -625,6 +482,11 @@ namespace GMW_WS } // creo nuovo cartellino! DS_Applicazione.ElencoCartelliniDataTable tabUdc = DataProxy.obj.taCartellini.stp_insNewFull(CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), CodCliente, Particolare, CodImpianto, CodStampo, Esponente, Figura, DataRif, TurnoRif, CodImballo, CodSoggetto, Tara, IdxPosizione, CodTipoDichiarazione, "UDC_WIP", Quantita, PesoTot, PesoCad, CodStato, UDC_Parent); // ATTENZIONE: "UDC_WIP" è "hard coded" nel db... !!! + // se NON richiesto di generare movimento a magazzino crea rettifica in tab batch + if (!toAS400) + { + DataProxy.obj.taCartellini.stp_rettMovAs400(Particolare, IdxPosizione.ToString(), Quantita); + } // leggo la riga try { diff --git a/GMW/GMW_WS/bin/GMW.dll b/GMW/GMW_WS/bin/GMW.dll index 7e983dba..271ebc6d 100644 Binary files a/GMW/GMW_WS/bin/GMW.dll and b/GMW/GMW_WS/bin/GMW.dll differ diff --git a/GMW/GMW_WS/bin/GMW_WS.dll b/GMW/GMW_WS/bin/GMW_WS.dll index 75b34644..a1b234dc 100644 Binary files a/GMW/GMW_WS/bin/GMW_WS.dll and b/GMW/GMW_WS/bin/GMW_WS.dll differ diff --git a/GMW/GMW_WS/bin/GMW_data.dll b/GMW/GMW_WS/bin/GMW_data.dll index 8b007512..3f59409a 100644 Binary files a/GMW/GMW_WS/bin/GMW_data.dll and b/GMW/GMW_WS/bin/GMW_data.dll differ diff --git a/GMW/GMW_WS/bin/SteamWare.dll b/GMW/GMW_WS/bin/SteamWare.dll index de0f194c..138a5124 100644 Binary files a/GMW/GMW_WS/bin/SteamWare.dll and b/GMW/GMW_WS/bin/SteamWare.dll differ diff --git a/GMW/GMW_WS/obj/Release/GMW_WS.dll b/GMW/GMW_WS/obj/Release/GMW_WS.dll index 75b34644..a1b234dc 100644 Binary files a/GMW/GMW_WS/obj/Release/GMW_WS.dll and b/GMW/GMW_WS/obj/Release/GMW_WS.dll differ diff --git a/GMW/GMW_WS/obj/Release/ResolveAssemblyReference.cache b/GMW/GMW_WS/obj/Release/ResolveAssemblyReference.cache index 42bb8f8d..8585b6b7 100644 Binary files a/GMW/GMW_WS/obj/Release/ResolveAssemblyReference.cache and b/GMW/GMW_WS/obj/Release/ResolveAssemblyReference.cache differ diff --git a/GMW/GMW_WS_installer/Release/GMW_WS_installer.msi b/GMW/GMW_WS_installer/Release/GMW_WS_installer.msi index 3fec2e36..4d2cc47d 100644 Binary files a/GMW/GMW_WS_installer/Release/GMW_WS_installer.msi and b/GMW/GMW_WS_installer/Release/GMW_WS_installer.msi differ diff --git a/GMW/GMW_data/SqlScripts/GMW_00255.sql b/GMW/GMW_data/SqlScripts/GMW_00255.sql index 2592f129..1ae81278 100644 --- a/GMW/GMW_data/SqlScripts/GMW_00255.sql +++ b/GMW/GMW_data/SqlScripts/GMW_00255.sql @@ -1,6 +1,3 @@ --- update permessi x magazzino logico - - --- nuovi eventi x gestione triggers variazioni quantità magazzino AS set xact_abort on go @@ -24,6 +21,269 @@ commit transaction go +-- tab x gestioen batch AS400 +set xact_abort on +go + +begin transaction +go + +create table AS400_BatchMovimenti( + DataIns datetime not null, + CodEvento nvarchar(10) not null, + Particolare nvarchar(15) not null, + CodMagAS nvarchar(50) not null, + Quantita decimal(10,2) not null, + DataBatch datetime, + DataVerifica datetime, + + constraint PK_AS400_BatchMovimenti primary key(DataIns,CodEvento,Particolare,CodMagAS) +) +go + +alter table AS400_BatchMovimenti add + constraint FK_AS400_BatchMovimenti_AnagTipoEvento foreign key(CodEvento) references AnagTipoEvento(CodEvento) on update cascade +go + +exec sp_addextendedproperty 'MS_Description', 'dataora inserimento in coda caricamento', 'SCHEMA', 'dbo', 'TABLE', 'AS400_BatchMovimenti', 'COLUMN', 'DataIns' +go + +exec sp_addextendedproperty 'MS_Description', 'NON MODIFICARE: nel codice si usano questi campi x chiamate...', 'SCHEMA', 'dbo', 'TABLE', 'AS400_BatchMovimenti', 'COLUMN', 'CodEvento' +go + +exec sp_addextendedproperty 'MS_Description', 'dataora di caricamento batch verso AS', 'SCHEMA', 'dbo', 'TABLE', 'AS400_BatchMovimenti', 'COLUMN', 'DataBatch' +go + +exec sp_addextendedproperty 'MS_Description', N'dataora in cui è stato verificato il caricamento su AS', 'SCHEMA', 'dbo', 'TABLE', 'AS400_BatchMovimenti', 'COLUMN', 'DataVerifica' +go + +create table AS400_MagCont( + CodMagAS nvarchar(50) not null constraint PK_AS400_MagCont primary key, + Descrizione nvarchar(50), + Attivo bit +) +go + +alter table AS400_BatchMovimenti add + constraint FK_AS400_BatchMovimenti_AS400_MagCont foreign key(CodMagAS) references AS400_MagCont(CodMagAS) on update cascade +go + +commit +go + + +set xact_abort on +go + +begin transaction +go + +INSERT INTO dbo.AS400_MagCont + VALUES (N'54', N'Finiti', 1) +INSERT INTO dbo.AS400_MagCont + VALUES (N'56', N'Materia Prima', 1) +INSERT INTO dbo.AS400_MagCont + VALUES (N'80', N'Fusi', 1) +INSERT INTO dbo.AS400_MagCont + VALUES (N'84', N'WIP', 1) +INSERT INTO dbo.AS400_MagCont + VALUES (N'88', N'Rientro da terzista', 1) +go + +commit transaction +go + + +-- triggers! +set xact_abort on +go + +begin transaction +go + +set ANSI_NULLS on +go + +-- ============================================= +-- Author: Samuele E. Locatelli +-- Create date: 2009-09-20 +-- Description: trigger x inserimento movimenti +-- nella coda di trasferimento batch +-- verso AS400 x UPDATE UDC +-- ============================================= +create TRIGGER trg_updMovAS + ON ElencoCartellini + AFTER UPDATE +AS +BEGIN + + -- setup variabili e verbosità + SET NOCOUNT ON; + DECLARE @partOk AS BIT + DECLARE @IdxPosFrom AS INT + DECLARE @IdxPosTo AS INT + DECLARE @magFrom AS NVARCHAR(50) + DECLARE @magTo AS NVARCHAR(50) + DECLARE @qta AS DECIMAL(10,2) + + -- controllo che CI SIA il particolare (altrimenti non eseguo) + SET @partOk = (SELECT CASE WHEN ISNULL(Particolare,'n.d.') = 'n.d.' THEN 0 ELSE 1 END FROM deleted) + + IF(@partOk = 1) + SET @qta = (SELECT Qta FROM inserted) + -- se c'è stata modifica di quantità inizio a rettificare quella + IF UPDATE(Qta) + BEGIN + INSERT INTO AS400_BatchMovimenti(DataIns, CodEvento, Particolare, CodMagAS, Quantita) + ( + SELECT GETDATE(), 'UDC_MOD', Particolare, CAST(IdxPosizione AS NVARCHAR(50)), @qta-Qta + FROM deleted + ) + END + + -- controllo poi se sia cambiato il magazzino, altrimenti non lo inserisco + IF UPDATE(IdxPosizione) + BEGIN + -- Prendo le posizioni di magazzino precedente e nuova + SET @IdxPosFrom = (SELECT IdxPosizione FROM deleted) + SET @IdxPosTo = (SELECT IdxPosizione FROM inserted) + -- Le trasformo nelle equivalenti stringhe del codMag SE attive + SET @magFrom = (SELECT ISNULL(CodMagAS,'---') FROM AS400_MagCont WHERE Attivo = 1 AND CodMagAs = CAST(@IdxPosFrom AS NVARCHAR(50))) + SET @magTo = (SELECT ISNULL(CodMagAS,'---') FROM AS400_MagCont WHERE Attivo = 1 AND CodMagAs = CAST(@IdxPosTo AS NVARCHAR(50))) + + -- inserisco un movimento di deposito verso mag nuovo (SE attivo) + IF (@magFrom <> '---') + BEGIN + INSERT INTO AS400_BatchMovimenti(DataIns, CodEvento, Particolare, CodMagAS, Quantita) + ( + SELECT GETDATE(), 'UDC_MOV', Particolare, CAST(IdxPosizione AS NVARCHAR(50)), -@qta + FROM deleted + ) + END + -- inserisco un movimento di prelievo verso mag vecchio (SE attivo) + IF (@magTo <> '---') + BEGIN + INSERT INTO AS400_BatchMovimenti(DataIns, CodEvento, Particolare, CodMagAS, Quantita) + ( + SELECT GETDATE(), 'UDC_MOV', Particolare, CAST(IdxPosizione AS NVARCHAR(50)), @qta + FROM inserted + ) + END + END + +END +go + +-- ============================================= +-- Author: Samuele E. Locatelli +-- Create date: 2009-09-20 +-- Description: trigger x inserimento movimenti +-- nella coda di trasferimento batch +-- verso AS400 x DELETE UDC +-- ============================================= +create TRIGGER trg_DelMovAS + ON ElencoCartellini + AFTER DELETE +AS +BEGIN + + -- setup variabili e verbosità + SET NOCOUNT ON; + DECLARE @partOk AS BIT + + -- controllo che CI SIA il particoalre (altrimenti non eseguo) + SET @partOk = (SELECT CASE WHEN ISNULL(Particolare,'n.d.') = 'n.d.' THEN 0 ELSE 1 END FROM deleted) + + IF(@partOk = 1) + BEGIN + -- metto in storico la posizione attuale dell'UDC (SE esiste) CANCELLATO + INSERT INTO AS400_BatchMovimenti(DataIns, CodEvento, Particolare, CodMagAS, Quantita) + ( + SELECT GETDATE(), 'UDC_DEL', Particolare, CAST(IdxPosizione AS NVARCHAR(50)), -Qta + FROM deleted + ) + END + +END +go + +-- ============================================= +-- Author: Samuele E. Locatelli +-- Create date: 2009-09-20 +-- Description: trigger x inserimento movimenti +-- nella coda di trasferimento batch +-- verso AS400 x INSERT UDC +-- ============================================= +create TRIGGER trg_InsMovAS + ON ElencoCartellini + AFTER INSERT +AS +BEGIN + + -- setup variabili e verbosità + SET NOCOUNT ON; + DECLARE @partOk AS BIT + + -- controllo che CI SIA il particoalre (altrimenti non eseguo) + SET @partOk = (SELECT CASE WHEN ISNULL(Particolare,'n.d.') = 'n.d.' THEN 0 ELSE 1 END FROM inserted) + + IF(@partOk = 1) + BEGIN + -- metto in storico la posizione attuale dell'UDC (SE esiste) CANCELLATO + INSERT INTO AS400_BatchMovimenti(DataIns, CodEvento, Particolare, CodMagAS, Quantita) + ( + SELECT GETDATE(), 'UDC_NEW', Particolare, CAST(IdxPosizione AS NVARCHAR(50)), Qta + FROM inserted + ) + END + +END +go + +commit +go + + +set xact_abort on +go + +begin transaction +go + +set ANSI_NULLS on +go + +/*************************************** +* STORED stp_rettMovAs400 +* +* inserisce nella tabella per i trasferimenti batch verso magazzino AS una quantità di rettifica (con segno - )per UDC eventualmente già scaricati a sistema +* +* Steamware, S.E.L. +* mod: 2010.09.20 +* +****************************************/ +create PROCEDURE stp_rettMovAs400 +( + @Particolare NVARCHAR(50), + @CodMagAS NVARCHAR(50), + @Qta DECIMAL(10,2) +) +AS + +BEGIN + + INSERT INTO AS400_BatchMovimenti(DataIns, CodEvento, Particolare, CodMagAS, Quantita) + VALUES (GETDATE(), 'UDC_NOQTY', @Particolare, @CodMagAS, -@Qta) + +END + +RETURN +go + +commit +go + + diff --git a/GMW/GMW_data/bin/Release/GMW_data.dll b/GMW/GMW_data/bin/Release/GMW_data.dll index 8b007512..3f59409a 100644 Binary files a/GMW/GMW_data/bin/Release/GMW_data.dll and b/GMW/GMW_data/bin/Release/GMW_data.dll differ diff --git a/GMW/GMW_data/bin/Release/SteamWare.dll b/GMW/GMW_data/bin/Release/SteamWare.dll index de0f194c..138a5124 100644 Binary files a/GMW/GMW_data/bin/Release/SteamWare.dll and b/GMW/GMW_data/bin/Release/SteamWare.dll differ diff --git a/GMW/GMW_data/obj/Release/GMW_data.dll b/GMW/GMW_data/obj/Release/GMW_data.dll index 8b007512..3f59409a 100644 Binary files a/GMW/GMW_data/obj/Release/GMW_data.dll and b/GMW/GMW_data/obj/Release/GMW_data.dll differ diff --git a/GMW/GMW_data/obj/Release/ResolveAssemblyReference.cache b/GMW/GMW_data/obj/Release/ResolveAssemblyReference.cache index 998c6fa0..fa07b644 100644 Binary files a/GMW/GMW_data/obj/Release/ResolveAssemblyReference.cache and b/GMW/GMW_data/obj/Release/ResolveAssemblyReference.cache differ