Merge commit 'ac0c0a8d62e9b6388c5149466824641a2929d352' into SDK/Icoel
This commit is contained in:
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
|
||||
|
||||
/*------------------------------------------------
|
||||
* Aggiunto fix come da link seguente:
|
||||
*
|
||||
*
|
||||
* https://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded
|
||||
*
|
||||
*
|
||||
* I solved this by adding an using stament on top of my DBContext class, like so:
|
||||
* using SqlProviderServices= System.Data.Entity.SqlServer.SqlProviderServices;
|
||||
*
|
||||
@@ -21,18 +21,15 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
/// </summary>
|
||||
public class DbController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
#if false
|
||||
private static EntrataDbContext dbEntrataCtx;
|
||||
private static ExportDbContext dbExportCtx;
|
||||
private static TrackerDbContext dbTrackerCtx;
|
||||
#endif
|
||||
private static SyncStateDbContext dbSyncStateCtx;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Avvio dell'oggetto gestione DB con le 3 stringhe di connessione specifiche
|
||||
/// </summary>
|
||||
@@ -51,11 +48,16 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
dbSyncStateCtx = new SyncStateDbContext(connSyncState);
|
||||
Log.Info("Avviata classe dbSyncStateCtx");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
|
||||
#region Public Methods
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Avvio dell'oggetto gestione DB con stringa di connessione specifica
|
||||
/// </summary>
|
||||
/// <param name="connSyncState">Connessione DB locale di SYNC</param>
|
||||
public DbController(string connSyncState)
|
||||
{
|
||||
dbSyncStateCtx = new SyncStateDbContext(connSyncState);
|
||||
Log.Info("Avviata classe dbSyncStateCtx");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose classe
|
||||
@@ -63,12 +65,15 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
#if false
|
||||
dbEntrataCtx.Dispose();
|
||||
dbExportCtx.Dispose();
|
||||
dbTrackerCtx.Dispose();
|
||||
#endif
|
||||
dbSyncStateCtx.Dispose();
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Elenco record Entrata Merce (Frontiera)
|
||||
/// </summary>
|
||||
@@ -137,9 +142,11 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi restitusice in output la tab di SyncState x verificare lo stato
|
||||
/// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi
|
||||
/// restitusice in output la tab di SyncState x verificare lo stato
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.SyncStateModel> SyncStateDoImportAll()
|
||||
@@ -155,7 +162,8 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi restitusice in output la tab di SyncState x verificare lo stato
|
||||
/// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi
|
||||
/// restitusice in output la tab di SyncState x verificare lo stato
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.SyncStateModel> SyncStateDoExportAll()
|
||||
@@ -184,6 +192,8 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Elenco record DettConfezioni (da Icoel TrackerLotti)
|
||||
/// </summary>
|
||||
@@ -220,7 +230,8 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dettaglio conferimento x PackId (da Icoel TrackerLotti)
|
||||
/// ATTENZIONE: in caso di mancata associazione lotto ingresso con lavorazione corrente la vista restituisce nuovo (possibile lavorare senza lotto ingresso e senza tracking)
|
||||
/// ATTENZIONE: in caso di mancata associazione lotto ingresso con lavorazione corrente la
|
||||
/// vista restituisce nuovo (possibile lavorare senza lotto ingresso e senza tracking)
|
||||
/// </summary>
|
||||
/// <param name="packId">idx da cui partire a recuperare</param>
|
||||
/// <returns></returns>
|
||||
@@ -236,7 +247,6 @@ namespace EgwProxy.Icoel.DataLayer.Controllers
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,10 @@ namespace EgwProxy.Icoel.Test
|
||||
string userInput = "";
|
||||
|
||||
Console.WriteLine("------------ Test DB ------------");
|
||||
EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("EntrataFrontiera"), ReadSetting("TrackerLotti"), ReadSetting("ExportIcoel"), ReadSetting("SyncState"));
|
||||
#if false
|
||||
EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("EntrataFrontiera"), ReadSetting("TrackerLotti"), ReadSetting("ExportIcoel"), ReadSetting("SyncState"));
|
||||
#endif
|
||||
EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("SyncState"));
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("--- SyncState ---");
|
||||
bool needRedo = true;
|
||||
@@ -266,6 +269,7 @@ namespace EgwProxy.Icoel.Test
|
||||
Console.WriteLine("Premere un tasto x continuare...");
|
||||
Console.ReadKey();
|
||||
|
||||
#if false
|
||||
Console.WriteLine("--- Entrata Frontiera ---");
|
||||
var elencoBarcode = dbProxy.DataController.EntrateGetLast(10);
|
||||
if (elencoBarcode != null)
|
||||
@@ -317,7 +321,8 @@ namespace EgwProxy.Icoel.Test
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Premere un tasto x continuare...");
|
||||
userInput = Console.ReadLine();
|
||||
userInput = Console.ReadLine();
|
||||
#endif
|
||||
|
||||
// oggetto x connessione al sizer icoel
|
||||
Connector IcoelSizer = new Connector(ReadSetting("IndirizzoIpSizer"), ReadSetting("SizerTcpPort"));
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace EgwProxy.Icoel
|
||||
/// </summary>
|
||||
public DbController DataController { get; set; }
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Inizializzazione proxy
|
||||
/// </summary>
|
||||
@@ -24,9 +25,18 @@ namespace EgwProxy.Icoel
|
||||
/// <param name="connTracker">stringa connesisone DB Tracker</param>
|
||||
/// <param name="connExport">stringa connesisone DB Export</param>
|
||||
/// <param name="connSyncState">Connessione DB locale di SYNC</param>
|
||||
public DbProxy(string connEntrata, string connTracker, string connExport, string connSyncState)
|
||||
public DbProxy(string connEntrata, string connTracker, string connExport, string connSyncState)
|
||||
{
|
||||
DataController = new DbController(connEntrata, connTracker, connExport, connSyncState);
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Inizializzazione proxy
|
||||
/// </summary>
|
||||
/// <param name="connSyncState">Connessione DB locale di SYNC</param>
|
||||
public DbProxy(string connSyncState)
|
||||
{
|
||||
DataController = new DbController(connSyncState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,6 +525,7 @@ namespace IOB_UT_NEXT
|
||||
ULog
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Tipologia dato Raw Transfer (derivare da MapoSdk e togliere qui)
|
||||
/// </summary>
|
||||
@@ -544,5 +545,6 @@ namespace IOB_UT_NEXT
|
||||
/// Icoel: Variety + layout info relative
|
||||
/// </summary>
|
||||
IcoelVarInfo
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -117,6 +117,7 @@ namespace IOB_UT_NEXT
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Classe di base per trasferimento informazioni di tipo RawTransfer
|
||||
/// FixMe Todo Fare !!!: elimnare usando SDK MAPO
|
||||
@@ -164,7 +165,7 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array valori tipo BaseRawTransf inviati come JSon
|
||||
@@ -178,6 +179,7 @@ namespace IOB_UT_NEXT
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Cache a tempo valori INT
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
;Accesso gestione sync DB x sync ICOEL --> MoonPro_ISF --> MoonPro_IS
|
||||
CNCTYPE=IcoelDb
|
||||
PING_MS_TIMEOUT=500
|
||||
;IOB_NAME=GIACO_ICOEL
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=ICOEL
|
||||
MODEL=Impianto Ciliegie Turi
|
||||
|
||||
[CNC]
|
||||
IP=192.168.137.50
|
||||
PORT=8001
|
||||
GETPRGNAME=false
|
||||
|
||||
[SERVER]
|
||||
MPIP=http://192.168.1.14
|
||||
MPURL=/MP/IO
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDRAWTRANSF=/IOB/rawTransfJson/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/sendReboot.aspx?idxMacchina=
|
||||
|
||||
[MEMORY]
|
||||
ADDR_READ=DB9999.DBB0
|
||||
ADDR_WRITE=DB9999.DBB0
|
||||
SIZE_READ=0
|
||||
SIZE_WRITE=0
|
||||
;BIT0=CONN
|
||||
;BIT1=DB60.DBB1
|
||||
;BIT2=PZCOUNT.STD.DB700.DBW22
|
||||
;BIT3=DB60.DBB3
|
||||
;BIT4=DB60.DBB4
|
||||
|
||||
|
||||
[BLINK]
|
||||
;MAX_COUNTER_BLINK = 30
|
||||
MAX_COUNTER_BLINK = 15
|
||||
;bit0 = 0
|
||||
;bit1 = 0
|
||||
;bit2 = 1
|
||||
;bit3 = 1
|
||||
;bit4 = 1
|
||||
;bit5 = 0
|
||||
;bit6 = 0
|
||||
;bit7 = 0
|
||||
BLINK_FILT=0
|
||||
;BLINK_FILT=28
|
||||
|
||||
[OPTPAR]
|
||||
AUTO_CHANGE_ODL=false
|
||||
CHANGE_ODL_MODE=TIME
|
||||
CHANGE_ODL_HOURS=24
|
||||
CHANGE_ODL_IDLE_MIN=5
|
||||
PZCOUNT_MODE=Icoel
|
||||
DISABLE_PZCOUNT=FALSE
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
ENABLE_DATA_FILTER=TRUE
|
||||
ENABLE_CLI_RESTART=TRUE
|
||||
VETO_SIG_IN=TRUE
|
||||
|
||||
; clock base (da 10ms)
|
||||
timerIntMs=10
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
PARAM_CONF=GIACO_ICOEL_003.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"mMapWrite": {
|
||||
|
||||
},
|
||||
"mMapRead": {
|
||||
"VelTonnOra": {
|
||||
"name": "VelTonnOra",
|
||||
"description": "Velocità Impianto Tonnellate / Ora",
|
||||
"memAddr": "VelTonnOra",
|
||||
"tipoMem": "Real",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "MEDIAN",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"VelFruttiMinuto": {
|
||||
"name": "VelFruttiMinuto",
|
||||
"description": "Velocità Impianto Frutti / Minuto",
|
||||
"memAddr": "VelFruttiMinuto",
|
||||
"tipoMem": "Real",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "MEDIAN",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"PercRiemp": {
|
||||
"name": "PercRiemp",
|
||||
"description": "Percentuale riempimento carrelli",
|
||||
"memAddr": "PercRiemp",
|
||||
"tipoMem": "Real",
|
||||
"index": 0,
|
||||
"size": 0,
|
||||
"func": "MEDIAN",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,8 +105,8 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>ExtLib\krcc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MapoSDK, Version=6.14.2204.2616, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2204.2616\lib\MapoSDK.dll</HintPath>
|
||||
<Reference Include="MapoSDK, Version=6.14.2205.2808, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2205.2808\lib\MapoSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MathNet.Numerics, Version=4.15.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll</HintPath>
|
||||
|
||||
+62
-17
@@ -29,21 +29,15 @@ namespace IOB_WIN_NEXT
|
||||
* todo's
|
||||
* --------------------------------------
|
||||
* - init obj comunicazione da conf e nuget
|
||||
* - test comunicazione
|
||||
* - estensione IOB come OPT_PAR di OVERRIDE (x inviare dati di un unico iOB da più IOB programs)
|
||||
* - gestione processCustomTaskLF
|
||||
* - x lettura dei 2 batch correnti (sx/dx)
|
||||
* - calcolo batch in corso/chiusi da date inizio/fine
|
||||
* - trasmettere a MP/IO risultato valutazioni
|
||||
* - gestione executeTasks
|
||||
* - task di invio batch configurato in coda
|
||||
* - task di recupero info anagrafiche (grower, variety, layout,...)
|
||||
* - contapezzi (SE ha senso con sizer oppure saltare)
|
||||
* - lanciare sync e verifica stato sync
|
||||
*/
|
||||
string connEntrataFrontiera = utils.CRS("EntrataFrontiera");
|
||||
string connTrackerLotti = utils.CRS("TrackerLotti");
|
||||
string connExportIcoel = utils.CRS("ExportIcoel");
|
||||
string connSyncState = utils.CRS("SyncState");
|
||||
|
||||
dbProxy = new DbProxy(connEntrataFrontiera, connTrackerLotti, connExportIcoel, connSyncState);
|
||||
|
||||
#if false
|
||||
IcoelSizer = new Connector(IOBConf.cncIpAddr, IOBConf.cncPort);
|
||||
#endif
|
||||
lastPING = DateTime.Now.AddHours(-1);
|
||||
}
|
||||
|
||||
@@ -60,6 +54,7 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
B_input = 1;
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
#if false
|
||||
if (currBatchList == null)
|
||||
{
|
||||
// se nullo --> provo a leggere!
|
||||
@@ -68,10 +63,8 @@ namespace IOB_WIN_NEXT
|
||||
if (currBatch != null)
|
||||
{
|
||||
currBatchList = currBatch;
|
||||
#if false
|
||||
// accodo invio!
|
||||
string rawBatch = JsonConvert.SerializeObject(currBatch);
|
||||
#endif
|
||||
accodaRawData(IOB_UT_NEXT.rawTransfType.IcoelBatch, currBatch);
|
||||
}
|
||||
}
|
||||
@@ -83,6 +76,7 @@ namespace IOB_WIN_NEXT
|
||||
B_input = 3;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -98,6 +92,9 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
// valore non presente in vers default... se gestito fare override
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
|
||||
// mettere conteggio dei record trasferiti?!?
|
||||
#if false
|
||||
// recupero da libreria il dizionario dei performance parameters...
|
||||
var perfParamDict = IcoelSizer.GetPerfMeters();
|
||||
foreach (var item in perfParamDict)
|
||||
@@ -105,6 +102,7 @@ namespace IOB_WIN_NEXT
|
||||
saveValue(ref outVal, item.Value, item.Key);
|
||||
}
|
||||
|
||||
#endif
|
||||
lastReadPLC = DateTime.Now;
|
||||
return outVal;
|
||||
}
|
||||
@@ -142,6 +140,51 @@ namespace IOB_WIN_NEXT
|
||||
public override void processCustomTaskLF()
|
||||
{
|
||||
lgInfo($"Richiesto processCustomTaskLF");
|
||||
|
||||
// fare processing DB secondo il seguente scehma:
|
||||
|
||||
/*
|
||||
*
|
||||
EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("EntrataFrontiera"), ReadSetting("TrackerLotti"), ReadSetting("ExportIcoel"), ReadSetting("SyncState"));
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("--- SyncState ---");
|
||||
bool needRedo = true;
|
||||
var elencoSyncState = dbProxy.DataController.SyncStateGetAll();
|
||||
while (needRedo)
|
||||
{
|
||||
Console.WriteLine(" --- PRE --- ");
|
||||
if (elencoSyncState != null)
|
||||
{
|
||||
foreach (var item in elencoSyncState)
|
||||
{
|
||||
Console.WriteLine($"TAB: {item.TableName} | IdxIN / IdxLocal {item.LastIdxIn} / {item.LastIdx} | NumIn / NumLocal {item.NumRecIn} / {item.NumRec}");
|
||||
// verifico se serva redo..
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Premere un tasto x continuare...");
|
||||
Console.ReadKey();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
elencoSyncState = dbProxy.DataController.SyncStateDoImportAll();
|
||||
sw.Stop();
|
||||
Console.WriteLine($" process time: {sw.ElapsedMilliseconds} ms ");
|
||||
Console.WriteLine(" --- POST --- ");
|
||||
if (elencoSyncState != null)
|
||||
{
|
||||
foreach (var item in elencoSyncState)
|
||||
{
|
||||
Console.WriteLine($"TAB: {item.TableName} | IdxIN / IdxLocal {item.LastIdxIn} / {item.LastIdx} | NumIn / NumLocal {item.NumRecIn} / {item.NumRec}");
|
||||
// verifico se serva redo..
|
||||
}
|
||||
}
|
||||
// processo
|
||||
needRedo = testNeedRedo(elencoSyncState);
|
||||
}
|
||||
*
|
||||
*
|
||||
* */
|
||||
|
||||
#if false
|
||||
var currBatch = IcoelSizer.GetCurrentBatch();
|
||||
if (currBatch != null)
|
||||
@@ -255,7 +298,7 @@ namespace IOB_WIN_NEXT
|
||||
protected Dictionary<int, Batch> currBatchList { get; set; }
|
||||
#endif
|
||||
|
||||
protected Connector IcoelSizer { get; set; }
|
||||
protected EgwProxy.Icoel.DbProxy dbProxy { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
@@ -266,6 +309,7 @@ namespace IOB_WIN_NEXT
|
||||
/// </summary>
|
||||
protected void refreshVarietyData()
|
||||
{
|
||||
#if false
|
||||
///determina se recuperare SOLO varietà attive o tutte
|
||||
bool soloAttive = false;
|
||||
var varList = IcoelSizer.GetVarietyList(soloAttive);
|
||||
@@ -274,7 +318,8 @@ namespace IOB_WIN_NEXT
|
||||
var varietyData = IcoelSizer.GetLayoutForVarietyList(varList);
|
||||
// invio dai al server IO
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
lastReadPLC = DateTime.Now;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user