|
|
|
@@ -1,503 +0,0 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Services;
|
|
|
|
|
using GMW_data;
|
|
|
|
|
using GMW;
|
|
|
|
|
using SteamWare;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace GMW.WS
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// WebService per gestioen 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.37")]
|
|
|
|
|
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
|
|
|
|
[System.ComponentModel.ToolboxItem(false)]
|
|
|
|
|
public class bilance : System.Web.Services.WebService
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region area init
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// init del metodo
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bilance()
|
|
|
|
|
{
|
|
|
|
|
gestEl = new GMW.Type.elenchi();
|
|
|
|
|
logLevel = memLayer.ML.confReadInt("_logLevel");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected GMW.Type.elenchi gestEl;
|
|
|
|
|
protected int logLevel = 0;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region area anagrafiche
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Elenco anagrafico combinazioni company/sito
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafico combinazioni company/sito")]
|
|
|
|
|
public GMW.Type.CompanySito[] ElencoCompanySito()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
gestEl.caricaCompanySito(DataProxy.obj.taAnagCS.GetData());
|
|
|
|
|
return gestEl.elencoCompanySito;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// fornisce l'anagrafica clienti
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafico clienti")]
|
|
|
|
|
public GMW.Type.Cliente[] ElencoClienti()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
gestEl.caricaClienti(DataProxy.obj.taAnagClienti.GetData());
|
|
|
|
|
return gestEl.elencoClienti;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// fornisce l'anagrafica operatori
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafico operatori")]
|
|
|
|
|
public GMW.Type.Operatore[] ElencoOperatori()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
gestEl.caricaOperatori(DataProxy.obj.taAnagOperatore.GetData());
|
|
|
|
|
return gestEl.elencoOperatori;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fornisce l'elenco dei tipi di dichiarazione ammessi
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Fornisce l'elenco dei tipi di dichiarazione ammessi")]
|
|
|
|
|
public GMW.Type.TipoDichiarazione[] ElencoTipoDichiarazioni()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
gestEl.caricaTipoDichiarazioni(DataProxy.obj.taTipoDich.GetData());
|
|
|
|
|
return gestEl.elencoTipoDichiaraz;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fornisce l'elenco degli stati dei prodotti ammessi
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Fornisce l'elenco degli stati dei prodotti ammessi")]
|
|
|
|
|
public GMW.Type.StatiProdotto[] ElencoStatiProdotto()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
gestEl.caricaStatiProdotto(DataProxy.obj.taStatiProd.GetData());
|
|
|
|
|
return gestEl.elencoStatiProdotto;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Elenco anagrafico impianti
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafico impianti")]
|
|
|
|
|
public GMW.Type.Impianto[] ElencoImpianti()
|
|
|
|
|
{
|
|
|
|
|
gestEl.caricaImpianti(DataProxy.obj.taAnagImp.GetData());
|
|
|
|
|
return gestEl.elencoImpianti;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Elenco anagrafico imballi
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafico imballi")]
|
|
|
|
|
public GMW.Type.Imballo[] ElencoImballi()
|
|
|
|
|
{
|
|
|
|
|
gestEl.caricaImballi(DataProxy.obj.taAnagImballi.GetData());
|
|
|
|
|
return gestEl.elencoImballi;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Elenco anagrafica impianti dati codice company e sito (no dataset)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CodCS">Codice company/sito</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafica impianti dati codice company/sito (no dataset)")]
|
|
|
|
|
public GMW.Type.Impianto[] ElencoImpiantiByCompanySito(string CodCS)
|
|
|
|
|
{
|
|
|
|
|
gestEl.caricaImpianti(DataProxy.obj.taAnagImp.stp_getByCodCS(CodCS));
|
|
|
|
|
return gestEl.elencoImpianti;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// fornisce l'anagrafica bilance
|
|
|
|
|
/// </summary>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafico Bilance")]
|
|
|
|
|
public GMW.Type.Bilancia[] ElencoBilance()
|
|
|
|
|
{
|
|
|
|
|
gestEl.caricaBilance(DataProxy.obj.taAnagBil.GetData());
|
|
|
|
|
return gestEl.elencoBilance;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// fornisce l'anagrafica bilance dati codice company e sito
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CodCS">Codice company/sito</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[WebMethod(Description = "Elenco anagrafico Bilance dati codice company e sito")]
|
|
|
|
|
public GMW.Type.Bilancia[] ElencoBilanceByCompanySito(string CodCS)
|
|
|
|
|
{
|
|
|
|
|
gestEl.caricaBilance(DataProxy.obj.taAnagBil.stp_getByCodCS(CodCS));
|
|
|
|
|
return gestEl.elencoBilance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region gestione UDC: metodi di controllo (info)
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Richiede la tara per l'UDC indicato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UDC">codice dell'UDC</param>
|
|
|
|
|
/// <returns>restituisce la tara salvata in precedenza</returns>
|
|
|
|
|
[WebMethod(Description = "Richiede la tara per l'UDC indicato")]
|
|
|
|
|
public double UdcInfo_GetTara(string UDC)
|
|
|
|
|
{
|
|
|
|
|
double answ = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
answ = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0].Tara;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{ }
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Restituisce l'elenco degli UDC parent di quello specificato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UDC">codice dell'UDC</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[WebMethod(Description = "Restituisce l'elenco degli UDC parent di quello specificato")]
|
|
|
|
|
public string[] UdcInfo_GetUdcParentList(string UDC)
|
|
|
|
|
{
|
|
|
|
|
GMW_data.DS_Applicazione.RelazUDCDataTable tabRelUdc = DataProxy.obj.taRelazUDC.stp_getParent(UDC);
|
|
|
|
|
int numRec = tabRelUdc.Rows.Count;
|
|
|
|
|
string[] answ = new string[numRec];
|
|
|
|
|
// caricare dati!
|
|
|
|
|
for (int i = 0; i < numRec; i++)
|
|
|
|
|
{
|
|
|
|
|
answ[i] = tabRelUdc[i].UDC_parent;
|
|
|
|
|
}
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Restituisce l'elenco degli UDC child di quello specificato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UDC">codice dell'UDC</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[WebMethod(Description = "Restituisce l'elenco degli UDC child di quello specificato")]
|
|
|
|
|
public string[] UdcInfo_GetUdcChildList(string UDC)
|
|
|
|
|
{
|
|
|
|
|
GMW_data.DS_Applicazione.RelazUDCDataTable tabRelUdc = DataProxy.obj.taRelazUDC.stp_getChild(UDC);
|
|
|
|
|
int numRec = tabRelUdc.Rows.Count;
|
|
|
|
|
string[] answ = new string[numRec];
|
|
|
|
|
// caricare dati!
|
|
|
|
|
for (int i = 0; i < numRec; i++)
|
|
|
|
|
{
|
|
|
|
|
answ[i] = tabRelUdc[i].UDC_child;
|
|
|
|
|
}
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Restituisce tutti i dati dell'UDC indicato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UDC">codice dell'UDC</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[WebMethod(Description = "Restituisce tutti i dati dell'UDC indicato")]
|
|
|
|
|
public GMW.Type.Cartellino UdcInfo_GetFullData(string UDC)
|
|
|
|
|
{
|
|
|
|
|
GMW.Type.Cartellino answ = new GMW.Type.Cartellino(DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0]);
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Controlla che il codice imballo inviato sia valido (pre creazione TARA)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CodImballo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[WebMethod(Description = "Controlla che il codice imballo inviato sia valido (pre creazione TARA)")]
|
|
|
|
|
public bool UdcInfo_CheckCodImballo(string CodImballo)
|
|
|
|
|
{
|
|
|
|
|
bool answ = false;
|
|
|
|
|
// cerco se ci sia il codice imballo indicato
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
answ = DataProxy.obj.taAnagImballi.stp_getImballoByCod(CodImballo).Rows.Count > 0;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{ }
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fornisce l'elenco degli articoli in produzione per impianto, data e turno
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CodImpianto">Codice impianto (da anagrafica)</param>
|
|
|
|
|
/// <param name="dataRic">data di riferimento</param>
|
|
|
|
|
/// <param name="turnoRic">turno di riferimento (1-2-3)</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[WebMethod(Description = "Elenco impianti ed articoli in produzione (per codice anagrafico)")]
|
|
|
|
|
public GMW.Type.ArtInProd[] UdcInfo_ArtInProd4ImpDataTurno(string CodImpianto, DateTime dataRic, int turnoRic)
|
|
|
|
|
{
|
|
|
|
|
// calcolo quante ore sono il turno di riferimento...
|
|
|
|
|
int oreTurno = 7 + (turnoRic - 1) * 8;
|
|
|
|
|
// calrolo la data di riferimento come data richeista + ore x turno richiesto
|
|
|
|
|
DateTime dataRif = dataRic.Date.AddHours(oreTurno);
|
|
|
|
|
gestEl.caricaArtInProd(DataProxy.obj.taArtInProd.stp_byImpData(CodImpianto, dataRif));
|
|
|
|
|
return gestEl.elencoArtInProd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region gestione UDC: creazione ed editing
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Fornisce un nuovo codice UDC tipo TARA 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="tara">peso in kg (0 se non noto) da associare all'UDC come tara del contenitore</param>
|
|
|
|
|
/// <param name="CodImballo">codice dell'imballo (tipo cassone) - string LIBERO (non facciamo controlli in input)</param>
|
|
|
|
|
/// <param name="CodTipoDichiarazione">tipo di dichiarazione (vedere relativa anagrafica consentita, es U=uomo, M=macchina...)</param>
|
|
|
|
|
/// <param name="CodOperatore">codice dell'operatore</param>
|
|
|
|
|
/// <returns>UDC: codice univoco del contenitore</returns>
|
|
|
|
|
[WebMethod(Description = "Fornisce un nuovo codice UDC tipo TARA a partire dalla richiesta e salva i dati")]
|
|
|
|
|
public string UdcCall_GetNew_Tara(string CodBilancia, double Tara, string CodImballo, string CodTipoDichiarazione, string CodOperatore)
|
|
|
|
|
{
|
|
|
|
|
// 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");
|
|
|
|
|
}
|
|
|
|
|
// inserico riga generando il codice
|
|
|
|
|
DS_Applicazione.ElencoCartelliniDataTable tabCartellini = DataProxy.obj.taCartellini.stp_insNew(CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), Tara, CodImballo, CodTipoDichiarazione, CodOperatore, "UDC_TARA"); // ATTENZIONE: "UDC_TARA" è "hard coded" nel db... !!!
|
|
|
|
|
// leggo la riga
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
answ = tabCartellini[0].UDC;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{ }
|
|
|
|
|
// output risultato
|
|
|
|
|
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</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 = 20; // hard coded: è la postazione POST fusione di ambivere!!!
|
|
|
|
|
// 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>
|
|
|
|
|
/// Modifica (se possibile poiché sbloccato) un cartellino esistente dato il suo UDC e salva i dati, restituendo conferma avvenuta modifica (true/false)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UDC_edit">codice UDC del cartellino che si vuole modificare</param>
|
|
|
|
|
/// <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 = "Modifica (se possibile poiché sbloccato) un cartellino esistente dato il suo UDC e salva i dati, restituendo conferma avvenuta modifica (true/false)")]
|
|
|
|
|
public bool UdcCall_ModificaCartellino(string UDC_edit, 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";
|
|
|
|
|
bool answ = false;
|
|
|
|
|
// controllo se si possa aggiornare...
|
|
|
|
|
GMW.Type.Cartellino currCart = new GMW.Type.Cartellino(DataProxy.obj.taCartellini.stp_getByUdc(UDC_edit)[0]);
|
|
|
|
|
int maxTimeMod = memLayer.ML.confReadInt("MinutiFinestraEditUDC");
|
|
|
|
|
double elapsedTime = DateTime.Now.Subtract(currCart.ModDate).TotalMinutes;
|
|
|
|
|
if (DateTime.Now.Subtract(currCart.ModDate).TotalMinutes > maxTimeMod)
|
|
|
|
|
{
|
|
|
|
|
logger.lg.scriviLog(string.Format("NEGATA Richiesta modifica UDC codice {0} fuori tempo massimo: finestra ammessa {1} min, sono passati {2} min da creazione/sblocco", UDC_edit, maxTimeMod, elapsedTime), tipoLog.WARNING);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.lg.scriviLog(string.Format("Concessa Richiesta modifica UDC codice {0} fuori tempo massimo: finestra ammessa {1} min, sono passati {2} min da creazione/sblocco", UDC_edit, maxTimeMod, elapsedTime), tipoLog.INFO);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CodCS = DataProxy.obj.taAnagBil.stp_getByCodBilancia(CodBilancia)[0].CodCS;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
CodCS = memLayer.ML.confReadString("CodCS");
|
|
|
|
|
}
|
|
|
|
|
int IdxPosizione = 20; // hard coded: è la postazione POST fusione di ambivere!!!
|
|
|
|
|
// faccio update!
|
|
|
|
|
DS_Applicazione.ElencoCartelliniDataTable tabUdc = DataProxy.obj.taCartellini.stp_updateUDC(UDC_edit, CodCS, CodBilancia, string.Format("{0:yy}", DateTime.Now), CodCliente, Particolare, CodImpianto, CodStampo, Esponente, Figura, DataRif, TurnoRif, CodImballo, CodSoggetto, Tara, IdxPosizione, CodTipoDichiarazione, "UDC_MOD", Quantita, PesoTot, PesoCad, CodStato, UDC_Parent); // ATTENZIONE: "UDC_MOD" è "hard coded" nel db... !!!
|
|
|
|
|
// leggo la riga
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (UDC_edit == tabUdc[0].UDC)
|
|
|
|
|
{
|
|
|
|
|
answ = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Annulla un dato UDC (se permesso)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UDC_req">codice dell'UDC)</param>
|
|
|
|
|
/// <param name="CodSoggetto">codice dell'operatore</param>
|
|
|
|
|
/// <returns>restituisce true/false a seconda che sia riuscito ad annullare l'UDC</returns>
|
|
|
|
|
[WebMethod(Description = "Annulla un dato UDC (se permesso)")]
|
|
|
|
|
public bool UdcCall_annullaUDC(string UDC_req, string CodSoggetto)
|
|
|
|
|
{
|
|
|
|
|
// init
|
|
|
|
|
bool answ = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
GMW_data.DataProxy.obj.taCartellini.stp_annullaUDC(UDC_req, CodSoggetto);
|
|
|
|
|
answ = true;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{ }
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sblocca un dato UDC (se la chiave passata è valida)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UDC_req">codice dell'UDC che si vuole sbloccare</param>
|
|
|
|
|
/// <param name="CodSoggetto">codice dell'operatore</param>
|
|
|
|
|
/// <param name="passkey">parola chiave x effettuare lo sblocco</param>
|
|
|
|
|
/// <returns>restituisce true/false a seconda che sia riuscito ad annullare l'UDC</returns>
|
|
|
|
|
[WebMethod(Description = "Annulla un dato UDC (se permesso)")]
|
|
|
|
|
public bool UdcCall_sbloccaUDC(string UDC_req, string CodSoggetto, string passkey)
|
|
|
|
|
{
|
|
|
|
|
// init
|
|
|
|
|
bool answ = false;
|
|
|
|
|
// controllo la passkey
|
|
|
|
|
string passkeyOk = memLayer.ML.confReadString("passkey");
|
|
|
|
|
if (passkeyOk == passkey)
|
|
|
|
|
{
|
|
|
|
|
GMW_data.DataProxy.obj.taCartellini.stp_sbloccaUdc(UDC_req, CodSoggetto);
|
|
|
|
|
answ = true;
|
|
|
|
|
}
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region area stampe
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Stampa un cartellino dato tipo e codice UDC
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="place">posizione che effettua la richiesta (codice della pesa)</param>
|
|
|
|
|
/// <param name="cartellino">tipo di cartellino richiesto</param>
|
|
|
|
|
/// <param name="UDC">codice UDC univoco</param>
|
|
|
|
|
/// <returns>restituisce true/false a seconda che sia riuscito a stampare o meno</returns>
|
|
|
|
|
[WebMethod(Description = "Effettua la stampa richiesta per l'UDC indicato")]
|
|
|
|
|
public bool UdcCall_PrintLabel(string place, tipoCartellino cartellino, string UDC)
|
|
|
|
|
{
|
|
|
|
|
bool answ = false;
|
|
|
|
|
string printerName = "";
|
|
|
|
|
string outForm = "";
|
|
|
|
|
string pagWidth = "";
|
|
|
|
|
string pagHeigth = "";
|
|
|
|
|
string margin = "";
|
|
|
|
|
reportRichiesto report = reportRichiesto.CartellinoPesa;
|
|
|
|
|
switch (cartellino)
|
|
|
|
|
{
|
|
|
|
|
case tipoCartellino.soloTara:
|
|
|
|
|
printerName = memLayer.ML.confReadString("printerCartTara");
|
|
|
|
|
outForm = "EMF";
|
|
|
|
|
pagWidth = memLayer.ML.confReadString("PageWidthCartTara");
|
|
|
|
|
pagHeigth = memLayer.ML.confReadString("PageHeightCartTara");
|
|
|
|
|
margin = memLayer.ML.confReadString("MarginTara");
|
|
|
|
|
report = reportRichiesto.CartellinoTara;
|
|
|
|
|
break;
|
|
|
|
|
case tipoCartellino.completo:
|
|
|
|
|
printerName = memLayer.ML.confReadString("printerCartCompleto");
|
|
|
|
|
outForm = "EMF";
|
|
|
|
|
pagWidth = memLayer.ML.confReadString("PageWidthCartCompleto");
|
|
|
|
|
pagHeigth = memLayer.ML.confReadString("PageHeightCartCompleto");
|
|
|
|
|
margin = memLayer.ML.confReadString("MarginCompleto");
|
|
|
|
|
report = reportRichiesto.CartellinoPesa;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
devInfoParam deviceInfo = new devInfoParam(outForm, pagHeigth, pagWidth, margin, margin, margin, margin);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (logLevel > 5) logger.lg.scriviLog(String.Format("Sto per inviare un report alla stampante {0}", printerName), tipoLog.INFO);
|
|
|
|
|
reportPrinter.obj.printReport(report, printerName, UDC, deviceInfo);
|
|
|
|
|
if (logLevel > 5) logger.lg.scriviLog(String.Format("inviato comando print alla stampante {0}", printerName), tipoLog.INFO);
|
|
|
|
|
answ = true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
logger.lg.scriviLog(String.Format("Errore in fase di creazione e stampa report: stampante {0}, errore riscontrato {1}", printerName, e), tipoLog.EXCEPTION);
|
|
|
|
|
}
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|