- Completato diff versione 255 (GMW_00255.sql)
- Update installer WS git-svn-id: https://keyhammer.ath.cx/svn/GMW/trunk@253 365432ac-a1b5-4ffd-bb28-6d3099d32164
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+25
-163
@@ -14,7 +14,7 @@ namespace GMW_WS
|
||||
/// <summary>
|
||||
/// WebService per gestione sw bilance
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://www.steamware.net/", Description = "Web Services che funziona da collettore di tutte le richieste delle applicazioni per le bilance integrate a <b>GMW</b> 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 <b>GMW</b> 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
|
||||
/// <summary>
|
||||
/// Fornisce un nuovo codice UDC tipo completo (con pezzi) a partire dalla richiesta e salva i dati
|
||||
/// </summary>
|
||||
/// <param name="CodBilancia">codice anagrafico della bilanca che effettua la richiesta (codice della pesa)</param>
|
||||
/// <param name="CodCliente">codice anagrafico del cliente</param>
|
||||
/// <param name="Particolare">codice del particolare (articolo) - da anagrafica!</param>
|
||||
/// <param name="CodImpianto">Codice dell'impianto</param>
|
||||
/// <param name="CodStampo">Codice dello stampo</param>
|
||||
/// <param name="Esponente">codice dell'esponente dello stampo</param>
|
||||
/// <param name="Figura">Codice figura</param>
|
||||
/// <param name="DataRif">Data di rif per la dichiarazione</param>
|
||||
/// <param name="TurnoRif">Turno di rif per la dichiarazione</param>
|
||||
/// <param name="CodImballo">codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)</param>
|
||||
/// <param name="CodSoggetto">codice dell'operatore</param>
|
||||
/// <param name="UDC_Parent">codice dell'UDC parent (UDC della tara)</param>
|
||||
/// <param name="tara">peso in kg (0 se non noto) da associare all'UDC come tara del contenitore</param>
|
||||
/// <param name="CodTipoDichiarazione">tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)</param>
|
||||
/// <param name="Quantita">numero pezzi associati all'UDC</param>
|
||||
/// <param name="PesoTot">Peso totale rilevato</param>
|
||||
/// <param name="PesoCad">Peso unitario rilevato</param>
|
||||
/// <param name="CodStato">Codice dello stato del pezzo (da anagrafica: sabbiato, ...)</param>
|
||||
/// <returns>UDC del nuovo cartellino</returns>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce un nuovo codice UDC tipo completo (con pezzi) a partire dalla richiesta e salva i dati
|
||||
/// </summary>
|
||||
/// <param name="CodBilancia">codice anagrafico della bilanca che effettua la richiesta (codice della pesa)</param>
|
||||
/// <param name="CodCliente">codice anagrafico del cliente</param>
|
||||
/// <param name="Particolare">codice del particolare (articolo) - da anagrafica!</param>
|
||||
/// <param name="CodImpianto">Codice dell'impianto</param>
|
||||
/// <param name="CodStampo">Codice dello stampo</param>
|
||||
/// <param name="Esponente">codice dell'esponente dello stampo</param>
|
||||
/// <param name="Figura">Codice figura</param>
|
||||
/// <param name="DataRif">Data di rif per la dichiarazione</param>
|
||||
/// <param name="TurnoRif">Turno di rif per la dichiarazione</param>
|
||||
/// <param name="CodImballo">codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)</param>
|
||||
/// <param name="CodSoggetto">codice dell'operatore</param>
|
||||
/// <param name="UDC_Parent">codice dell'UDC parent (UDC della tara)</param>
|
||||
/// <param name="tara">peso in kg (0 se non noto) da associare all'UDC come tara del contenitore</param>
|
||||
/// <param name="CodTipoDichiarazione">tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)</param>
|
||||
/// <param name="Quantita">numero pezzi associati all'UDC</param>
|
||||
/// <param name="PesoTot">Peso totale rilevato</param>
|
||||
/// <param name="PesoCad">Peso unitario rilevato</param>
|
||||
/// <param name="CodStato">Codice dello stato del pezzo (da anagrafica: sabbiato, ...)</param>
|
||||
/// <returns>UDC del nuovo cartellino per FINITI</returns>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce un nuovo codice UDC tipo completo (con pezzi) a partire dalla richiesta e salva i dati
|
||||
/// </summary>
|
||||
/// <param name="CodBilancia">codice anagrafico della bilanca che effettua la richiesta (codice della pesa)</param>
|
||||
/// <param name="CodCliente">codice anagrafico del cliente</param>
|
||||
/// <param name="Particolare">codice del particolare (articolo) - da anagrafica!</param>
|
||||
/// <param name="CodImpianto">Codice dell'impianto</param>
|
||||
/// <param name="CodStampo">Codice dello stampo</param>
|
||||
/// <param name="Esponente">codice dell'esponente dello stampo</param>
|
||||
/// <param name="Figura">Codice figura</param>
|
||||
/// <param name="DataRif">Data di rif per la dichiarazione</param>
|
||||
/// <param name="TurnoRif">Turno di rif per la dichiarazione</param>
|
||||
/// <param name="CodImballo">codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)</param>
|
||||
/// <param name="CodSoggetto">codice dell'operatore</param>
|
||||
/// <param name="UDC_Parent">codice dell'UDC parent (UDC della tara)</param>
|
||||
/// <param name="tara">peso in kg (0 se non noto) da associare all'UDC come tara del contenitore</param>
|
||||
/// <param name="CodTipoDichiarazione">tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)</param>
|
||||
/// <param name="Quantita">numero pezzi associati all'UDC</param>
|
||||
/// <param name="PesoTot">Peso totale rilevato</param>
|
||||
/// <param name="PesoCad">Peso unitario rilevato</param>
|
||||
/// <param name="CodStato">Codice dello stato del pezzo (da anagrafica: sabbiato, ...)</param>
|
||||
/// <returns>UDC del nuovo cartellino per FINITI</returns>
|
||||
[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
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce un nuovo codice UDC tipo completo (con pezzi e cod magazzino) a partire dalla richiesta e salva i dati
|
||||
/// </summary>
|
||||
@@ -478,10 +322,11 @@ namespace GMW_WS
|
||||
/// <param name="PesoTot">Peso totale rilevato</param>
|
||||
/// <param name="PesoCad">Peso unitario rilevato</param>
|
||||
/// <param name="CodStato">Codice dello stato del pezzo (da anagrafica: sabbiato, ...)</param>
|
||||
/// <param name="CodMag">Codice INT del magazzino in cui inserire l'UDC</param>
|
||||
/// <param name="CodMag">Codice del magazzino in cui inserire l'UDC</param>
|
||||
/// <param name="toAS400">TRUE = genera movimento AS400, FALSE = NON genera movimento di magazzino</param>
|
||||
/// <returns>UDC del nuovo cartellino</returns>
|
||||
[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
|
||||
/// <param name="PesoTot">Peso totale rilevato</param>
|
||||
/// <param name="PesoCad">Peso unitario rilevato</param>
|
||||
/// <param name="CodStato">Codice dello stato del pezzo (da anagrafica: sabbiato, ...)</param>
|
||||
/// <param name="CodMag">Codice INT del magazzino in cui inserire l'UDC</param>
|
||||
/// <param name="CodMag">Codice del magazzino in cui inserire l'UDC</param>
|
||||
/// <param name="toAS400">TRUE = genera movimento AS400, FALSE = NON genera movimento di magazzino</param>
|
||||
/// <returns>UDC del nuovo cartellino per FINITI</returns>
|
||||
[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
|
||||
/// <param name="PesoTot">Peso totale rilevato</param>
|
||||
/// <param name="PesoCad">Peso unitario rilevato</param>
|
||||
/// <param name="CodStato">Codice dello stato del pezzo (da anagrafica: sabbiato, ...)</param>
|
||||
/// <param name="CodMag">Codice INT del magazzino in cui inserire l'UDC</param>
|
||||
/// <param name="CodMag">Codice del magazzino in cui inserire l'UDC</param>
|
||||
/// <param name="toAS400">TRUE = genera movimento AS400, FALSE = NON genera movimento di magazzino</param>
|
||||
/// <returns>UDC del nuovo cartellino per FINITI</returns>
|
||||
[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
|
||||
{
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user