Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 52c1fa654e | |||
| 43ebd3db5b | |||
| 3aab1d8d8c | |||
| 96e78e1c72 | |||
| 7cc1eb1561 | |||
| 29c0ea3537 | |||
| 76d7ef8c25 | |||
| 130b71aaf7 | |||
| 33c55dfc62 | |||
| 080a9cfbf2 | |||
| 8f1b068850 | |||
| f1624982c6 | |||
| 4449a73137 | |||
| a7e5206f45 | |||
| dbeef11a90 |
@@ -593,13 +593,4 @@ Public Class ProcessResult
|
||||
m_nTIME = TIME
|
||||
End Sub
|
||||
|
||||
Public Sub ResetTypeFeature()
|
||||
m_Type = ProcessResultTypes.PART
|
||||
m_nTASKID = 0
|
||||
End Sub
|
||||
Public Sub ResetTypePart()
|
||||
m_Type = ProcessResultTypes.BAR
|
||||
m_nCUTID = 0
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -186,13 +186,7 @@ Public Class MyMachGroupPanelM
|
||||
While nOutlineId <> GDB_ID.NULL
|
||||
' verifico che sia feature
|
||||
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
|
||||
Dim nCurrPrId As Integer = GDB_ID.NULL
|
||||
If EgtGetInfo(nOutlineId, MGR_FTR_PRID, nCurrPrId) AndAlso nCurrPrId <> GDB_ID.NULL Then
|
||||
If nCurrPrId < nPRId Then
|
||||
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
|
||||
nPRId += 1
|
||||
End If
|
||||
nPRId = Math.Max(nPRId - 1, nCurrPrId) + 1
|
||||
If EgtExistsInfo(nOutlineId, MGR_FTR_PRID) Then
|
||||
nOutlineId = EgtGetNext(nOutlineId)
|
||||
Continue While
|
||||
Else
|
||||
|
||||
@@ -16,7 +16,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||
<Assembly: AssemblyProduct("EgtBEAMWALL.Core")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2024 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.6.6.1")>
|
||||
<Assembly: AssemblyFileVersion("2.6.6.1")>
|
||||
<Assembly: AssemblyVersion("2.5.12.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.12.2")>
|
||||
|
||||
@@ -6,6 +6,7 @@ using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
@@ -24,9 +25,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="authToken">Token di autorizzazione</param>
|
||||
public MagmanController(string ServerAddress, string AuthToken)
|
||||
{
|
||||
commLib = new DataSyncro(ServerAddress, AuthToken);
|
||||
// forzo a 30 sec...
|
||||
int timeout = 30000;
|
||||
commLib = new DataSyncro(ServerAddress, AuthToken, timeout);
|
||||
bool servOk = commLib.CheckRemote();
|
||||
Log.Info($"Avviato MagmanController | server: {ServerAddress} | timeout: standard (500ms)| CheckRemote OK: {servOk}");
|
||||
Log.Info($"Avviato MagmanController | server: {ServerAddress} | timeout: {timeout}ms | CheckRemote OK: {servOk}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -371,8 +374,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
// eseguo il sync!
|
||||
List<MaterialDTO> list2send = matListDb.Select(x => MaterialsController.ConvToDto(x)).ToList();
|
||||
// preparo pacchetto invio...
|
||||
bool okMat = commLib.MaterialsSend(list2send);
|
||||
// preparo pacchetto invio... 10 alla volta...
|
||||
bool okMat = false;
|
||||
#if false
|
||||
int numRec = list2send.Count;
|
||||
if (numRec > 10)
|
||||
{
|
||||
for (int i = 0; i < numRec / 10; i++)
|
||||
{
|
||||
var currList = list2send.Skip(10 * i).Take(10).ToList();
|
||||
okMat = commLib.MaterialsSend(currList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
okMat = commLib.MaterialsSend(list2send);
|
||||
}
|
||||
#endif
|
||||
okMat = commLib.MaterialsSend(list2send);
|
||||
// se inviato, scarico x merge locale
|
||||
if (!okMat)
|
||||
{
|
||||
@@ -873,11 +892,85 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// loggo completato
|
||||
Log.Info($"ProjAllSyncro | Eseguita sincronizzazione di {numSent}/{recList.Count} record");
|
||||
}
|
||||
/*------------------------------------------------
|
||||
* 2024.07.10 ora faccio giro differente:
|
||||
* - calcolo data limite da MagmanSync x tipo ProjAllSyncro, ultimo rec --> data limite
|
||||
* - recupero progetti modificati dopo data limite (DtLastMod)
|
||||
* - invio TUTTI i record modificati dopo data limite
|
||||
* - recupero tutti i record remoti modificati dopo la stessa data limite
|
||||
* - merge locale (x archiviato)
|
||||
*------------------------------------------------ */
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary> Effettua sync stato archiviato progetti locali <--> cloud </summary> <returns></returns>
|
||||
public SyncResult ProjArchSync()
|
||||
{
|
||||
SyncResult answ = SyncResult.ERR_ND;
|
||||
// per prima cosa calcolo limite sync come ultimo record registrato
|
||||
DateTime dtLastSync = DateTime.MinValue;
|
||||
DateTime adesso = DateTime.Now;
|
||||
string syncType = "ProjArchSync";
|
||||
using (MagmanSyncController msContr = new MagmanSyncController())
|
||||
{
|
||||
var lastRec = msContr.GetLastBySync(syncType);
|
||||
dtLastSync = lastRec.DtReq;
|
||||
// ora uso controller x gestione progetti
|
||||
using (ProdController prodContr = new ProdController())
|
||||
{
|
||||
// recupero elenco prod da inviare...
|
||||
var list2send = prodContr.GetModAfter(dtLastSync);
|
||||
// converto x inviare
|
||||
bool servOk = commLib.CheckRemote();
|
||||
if (!servOk)
|
||||
{
|
||||
answ = SyncResult.ERR_ServerKo;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// converto gli oggetti
|
||||
Dictionary<int, bool> proj2send = list2send.ToDictionary(x => x.ProjCloudId, x => x.IsArchived);
|
||||
// effettuo invio...
|
||||
bool resOk = commLib.ProjectArchSend(proj2send);
|
||||
if (!resOk)
|
||||
{
|
||||
answ = SyncResult.ERR_CloudResNotSent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ora chiedo da online elenco proj modificati x sync locale...
|
||||
Dictionary<int, bool> cloudUpdated = commLib.ProjectArchGet(dtLastSync);
|
||||
if (cloudUpdated != null)
|
||||
{
|
||||
prodContr.UpdateListArchived(cloudUpdated);
|
||||
}
|
||||
// registro nuovo sync fatto ora...
|
||||
MagmanSyncModel newRec = new MagmanSyncModel()
|
||||
{
|
||||
CloudId = 0,
|
||||
SyncType = syncType,
|
||||
DtReq = adesso,
|
||||
Payload = ""
|
||||
};
|
||||
int syncId = msContr.Insert(newRec);
|
||||
answ = SyncResult.ALL_OK;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
answ = SyncResult.ERR_ServerKo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// restituisco
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue invio info avanzamento di un SINGOLO PROD dato il suo Id + info avanzamento
|
||||
/// </summary>
|
||||
|
||||
@@ -114,6 +114,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero ultimo record di sync dato tipo
|
||||
/// </summary>
|
||||
/// <param name="SyncType">TIpo di sync richiesto, tipicamente ProjArchSync x fix stato archived</param>
|
||||
/// <returns></returns>
|
||||
public MagmanSyncModel GetLastBySync(string SyncType)
|
||||
{
|
||||
// record default a 1 anno fa...
|
||||
DateTime dtLim = DateTime.Today.AddYears(-1);
|
||||
MagmanSyncModel dbResult = new MagmanSyncModel()
|
||||
{
|
||||
CloudId = 0,
|
||||
SyncType = SyncType,
|
||||
DtReq = dtLim,
|
||||
Payload = ""
|
||||
};
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var rawRes = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => (!string.IsNullOrEmpty(SyncType) && x.SyncType == SyncType))
|
||||
.OrderByDescending(x => x.DtReq)
|
||||
.FirstOrDefault();
|
||||
if (rawRes != null)
|
||||
{
|
||||
dbResult = rawRes;
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista record NON inviati filtrati x tipo e num max
|
||||
/// </summary>
|
||||
|
||||
@@ -88,9 +88,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
MatId = coreRec.nId,
|
||||
MatCode = coreRec.sWarehouseMaterial,
|
||||
HMm = (decimal)Math.Round(coreRec.dH,2),
|
||||
LMm = (decimal)Math.Round(coreRec.dL,2),
|
||||
WMm = (decimal)Math.Round(coreRec.dW,2),
|
||||
HMm = (decimal)Math.Round(coreRec.dH, 2),
|
||||
LMm = (decimal)Math.Round(coreRec.dL, 2),
|
||||
WMm = (decimal)Math.Round(coreRec.dW, 2),
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
@@ -231,7 +231,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|
||||
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|
||||
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
.OrderBy(x => x.MatId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
@@ -415,7 +416,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
item2update.MatCloudId = updItem.MatCloudId;
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
// aggiorno SE presente...
|
||||
if (!string.IsNullOrEmpty(updItem.MatDesc))
|
||||
{
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
}
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
@@ -454,7 +459,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
item2update.MatCloudId = updItem.MatCloudId;
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
// aggiorno SE presente...
|
||||
if (!string.IsNullOrEmpty(updItem.MatDesc))
|
||||
{
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
}
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
@@ -22,6 +23,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ProjectDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec">record in formato ProdModel</param>
|
||||
/// <returns></returns>
|
||||
public static ProjectDTO ConvToDto(ProdModel currRec)
|
||||
{
|
||||
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
|
||||
ProjectDTO answ = new ProjectDTO()
|
||||
{
|
||||
ProjCloudId = currRec.ProjCloudId,
|
||||
ProjLocalId = currRec.ProdDbId,
|
||||
ProjExtId = currRec.ProdId,
|
||||
// è calcolato sul cloud, da token --> machine ID
|
||||
MachineCloudId = 0,
|
||||
// è calcolato sul cloud, da token --> KeyNum
|
||||
KeyNum = 0,
|
||||
// disponibile solo su PROJ
|
||||
BTLFileName = "",
|
||||
PType = (EgwProxy.MagMan.BWType)currRec.PType,
|
||||
Machine = currRec.Machine,
|
||||
ProjDescription = currRec.Description,
|
||||
DtCreated = currRec.DtCreated,
|
||||
DtLastAction = DateTime.MinValue,
|
||||
DtSchedule = DateTime.MinValue,
|
||||
DtStartProd = DateTime.MinValue,
|
||||
// disponibile solo su PROJ
|
||||
ListName = "",
|
||||
ProcTimeEst = 0,
|
||||
ProcTimeReal = 0,
|
||||
IsActive = currRec.IsActive,
|
||||
IsArchived = currRec.IsArchived
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta di un PROJ ad un PROD
|
||||
/// </summary>
|
||||
@@ -59,41 +96,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ProjectDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec">record in formato ProdModel</param>
|
||||
/// <returns></returns>
|
||||
public static ProjectDTO ConvToDto(ProdModel currRec)
|
||||
{
|
||||
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
|
||||
ProjectDTO answ = new ProjectDTO()
|
||||
{
|
||||
ProjCloudId = currRec.ProjCloudId,
|
||||
ProjLocalId = currRec.ProdDbId,
|
||||
ProjExtId = currRec.ProdId,
|
||||
// è calcolato sul cloud, da token --> machine ID
|
||||
MachineCloudId = 0,
|
||||
// è calcolato sul cloud, da token --> KeyNum
|
||||
KeyNum = 0,
|
||||
// disponibile solo su PROJ
|
||||
BTLFileName = "",
|
||||
PType = (EgwProxy.MagMan.BWType)currRec.PType,
|
||||
Machine = currRec.Machine,
|
||||
ProjDescription = currRec.Description,
|
||||
DtCreated = currRec.DtCreated,
|
||||
DtLastAction = DateTime.MinValue,
|
||||
DtSchedule = DateTime.MinValue,
|
||||
DtStartProd = DateTime.MinValue,
|
||||
// disponibile solo su PROJ
|
||||
ListName = "",
|
||||
ProcTimeEst = 0,
|
||||
ProcTimeReal = 0,
|
||||
IsActive = currRec.IsActive,
|
||||
IsArchived = currRec.IsArchived
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Helper conversione modelli verso Core.ProdItem
|
||||
/// </summary>
|
||||
@@ -124,7 +126,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public Core.ProdFileM ConvToCoreFile(ProdModel currProd)
|
||||
{
|
||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjCloudId);
|
||||
//Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProdId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -166,6 +167,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
// segno eliminazione logica al prod
|
||||
currProd.IsActive = false;
|
||||
currProd.DtLastMod = DateTime.Now;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
@@ -533,6 +535,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero i dati modificati dopo la data richiesta x sincr su cloud
|
||||
/// </summary>
|
||||
/// <param name="DtLimit"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdModel> GetModAfter(DateTime DtLimit)
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.DtLastMod >= DtLimit)
|
||||
.OrderBy(x => x.ProdDbId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
||||
/// </summary>
|
||||
@@ -587,7 +607,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero i dati NON sincronizzati in ordine crescente fino al num max indicato
|
||||
/// Recupero i dati NON sincronizzati
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
@@ -625,7 +645,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return numAssigned > 0;
|
||||
}
|
||||
|
||||
/// <summary> Return Lock by ProdId (proj & prod) </summary> <param name="ProdId"></param> <returns></returns>
|
||||
/// <summary>
|
||||
/// Return Lock by ProdId (proj & prod)
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsLockByProdId(int ProdId)
|
||||
{
|
||||
bool bIsLock = false;
|
||||
@@ -655,9 +679,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return bIsLock;
|
||||
}
|
||||
|
||||
/// <summary> Manage Lock by ProdId (proj & prod) </summary> <param name="ProdId"></param>
|
||||
/// <param name="Locked">Stato Lock da impostare</param> <param name="UserKey">User ID / Key
|
||||
/// number</param> <returns></returns>
|
||||
/// <summary>
|
||||
/// Manage Lock by ProdId (proj & prod)
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="Locked">Stato Lock da impostare</param>
|
||||
/// <param name="UserKey">User ID / Key number</param>
|
||||
/// <returns></returns>
|
||||
public ProdModel LockByProdId(int ProdId, bool Locked, string UserKey = "USER01")
|
||||
{
|
||||
ProdModel currProd;
|
||||
@@ -674,7 +702,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
currProd.Locked = Locked;
|
||||
currProd.LockDate = DateTime.Now;
|
||||
currProd.LockedBy = Locked ? UserKey : "";
|
||||
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
|
||||
localDbCtx.Entry(currProd).State = EntityState.Modified;
|
||||
|
||||
var currProj = localDbCtx
|
||||
.ProjList
|
||||
@@ -687,7 +715,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
item.Locked = Locked;
|
||||
item.LockDate = DateTime.Now;
|
||||
item.LockedBy = Locked ? UserKey : "";
|
||||
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
||||
localDbCtx.Entry(item).State = EntityState.Modified;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,6 +778,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue syncro sul DB dell'elenco dei record
|
||||
/// </summary>
|
||||
/// <param name="cloudStatus">Dizionario valori cloudId / isArchived</param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateListArchived(Dictionary<int, bool> cloudStatus)
|
||||
{
|
||||
bool fatto = false;
|
||||
int numDone = 0;
|
||||
int num2do = cloudStatus.Count;
|
||||
try
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
// ciclo tutti i record e segno update...
|
||||
foreach (var item in cloudStatus)
|
||||
{
|
||||
// chiamo metodo singolo
|
||||
numDone += UpdateArchivedByCloudId(item.Key, item.Value) ? 1 : 0;
|
||||
}
|
||||
fatto = numDone == num2do;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateListArchived: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x campo IsArchived
|
||||
/// </summary>
|
||||
@@ -778,6 +836,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.IsArchived = IsArchived;
|
||||
currData.DtLastMod = DateTime.Now;
|
||||
|
||||
// update dei proj relativi
|
||||
foreach (var item in proj2update)
|
||||
@@ -1231,7 +1290,64 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
var ProjCtr = new ProjController();
|
||||
return ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
|
||||
//return DbManager.obj.ProjCtr.GetByProdAsc(ProdId).Select(y => y.nProjId).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update record su DB x campo IsArchived dato CloudId
|
||||
/// </summary>
|
||||
/// <param name="ProjCloudId"></param>
|
||||
/// <param name="IsArchived"></param>
|
||||
/// <returns></returns>
|
||||
protected bool UpdateArchivedByCloudId(int ProjCloudId, bool IsArchived)
|
||||
{
|
||||
bool fatto = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
// cerco specifico Prod
|
||||
ProdModel currData = new ProdModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProjCloudId == ProjCloudId)
|
||||
.SingleOrDefault();
|
||||
if (currData != null)
|
||||
{
|
||||
// sel dei proj da aggiornare...
|
||||
var proj2update = localDbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProdDbId == currData.ProdDbId)
|
||||
.ToList();
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currData.IsArchived = IsArchived;
|
||||
currData.DtLastMod = adesso;
|
||||
|
||||
// update dei proj relativi
|
||||
foreach (var item in proj2update)
|
||||
{
|
||||
item.IsArchived = IsArchived;
|
||||
}
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateArchivedByCloudId:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateArchivedByCloudId: req item was not found | ProjCloudId {ProjCloudId} | IsArchived {IsArchived}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemLocalId = currRec.RawItemId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
IsDeleted = currRec.IsDeleted,
|
||||
QtyAvail = currRec.QtyAvail,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
@@ -76,7 +77,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm,
|
||||
MatId = currRec.MatLocalId,
|
||||
IsDeleted = currRec.IsDeleted,
|
||||
IsRemn = currRec.IsRemn,
|
||||
// attivo = selezionato x nesting
|
||||
IsActive = isActive,
|
||||
UseQty = true,
|
||||
Note = currRec.Note
|
||||
@@ -102,7 +105,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
WMm = currRec.WMm,
|
||||
MatId = matLocalId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
IsActive = currRec.IsActive,
|
||||
IsDeleted = currRec.IsDeleted,
|
||||
UseQty = true,
|
||||
Note = currRec.Note
|
||||
};
|
||||
@@ -123,9 +126,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
RawItemId = coreRec.nId,
|
||||
MatId = coreRec.Material.nId,
|
||||
HMm = (decimal)Math.Round(coreRec.Material.dH,2),
|
||||
LMm = (decimal)Math.Round(coreRec.dL,2),
|
||||
WMm = coreRec.dW > 0 ? (decimal)Math.Round(coreRec.dW,2) : (decimal)Math.Round(coreRec.Material.dW,2),
|
||||
HMm = (decimal)Math.Round(coreRec.Material.dH, 2),
|
||||
LMm = (decimal)Math.Round(coreRec.dL, 2),
|
||||
WMm = coreRec.dW > 0 ? (decimal)Math.Round(coreRec.dW, 2) : (decimal)Math.Round(coreRec.Material.dW, 2),
|
||||
IsActive = coreRec.bActive,
|
||||
UseQty = coreRec.bUseQuantity,
|
||||
QtyAvail = coreRec.nQuantity
|
||||
@@ -178,13 +181,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.RawItemList
|
||||
.Where(x => x.RawItemId == RawItemId);
|
||||
.Where(x => x.RawItemId == RawItemId)
|
||||
.FirstOrDefault();
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.RawItemList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
// verifico SE esista
|
||||
if (items2del != null)
|
||||
{
|
||||
// verifico seabbia un cloud id (fa canc logica)...
|
||||
if (items2del.RawItemCloudId > 0)
|
||||
{
|
||||
items2del.IsDeleted = true;
|
||||
localDbCtx.Entry(items2del).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ...o meno: fa eliminazione vera
|
||||
localDbCtx.RawItemList.Remove(items2del);
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -278,17 +295,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.RawItemList
|
||||
.Where(x => (updItem.RawItemId > 0 && x.RawItemId == updItem.RawItemId)
|
||||
|| (x.MatId == updItem.MatId && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
.FirstOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);\
|
||||
item2update.RawItemCloudId = updItem.RawItemCloudId;
|
||||
// se ho un valore > 0 x CloudId sennò NON modifica
|
||||
if (updItem.RawItemCloudId > 0)
|
||||
{
|
||||
item2update.RawItemCloudId = updItem.RawItemCloudId;
|
||||
}
|
||||
item2update.HMm = updItem.HMm;
|
||||
item2update.LMm = updItem.LMm;
|
||||
item2update.WMm = updItem.WMm;
|
||||
item2update.IsActive = updItem.IsActive;
|
||||
item2update.IsDeleted = updItem.IsDeleted;
|
||||
item2update.IsRemn = updItem.IsRemn;
|
||||
if (changeUseQty)
|
||||
{
|
||||
@@ -297,7 +317,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
if (changeQtyAvail)
|
||||
{
|
||||
item2update.QtyAvail = updItem.QtyAvail;
|
||||
item2update.LastSync = DateTime.Now;
|
||||
item2update.LastSync = DateTime.Now;
|
||||
}
|
||||
localDbCtx.Entry(item2update).State = EntityState.Modified;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
public DateTime LockDate { get; set; } = new DateTime(1900, 01, 01);
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
@@ -106,6 +106,13 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Data Creazione
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("DtLastMod")]
|
||||
public DateTime DtLastMod { get; set; } = new DateTime(1900, 01, 01);
|
||||
|
||||
/// <summary>
|
||||
/// Collezione oggetti Proj associati (almeno 1 by design)
|
||||
/// </summary>
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
/// dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
public DateTime LockDate { get; set; } = new DateTime(1900, 01, 01);
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Active/ = can be used
|
||||
/// Active = can be used
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = false;
|
||||
|
||||
@@ -46,6 +46,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
/// </summary>
|
||||
public bool IsRemn { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Deleted = from cloud, not to use
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Lenght
|
||||
/// </summary>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2406.2911\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2408.514\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
@@ -273,6 +273,14 @@
|
||||
<Compile Include="Migrations\202406070826284_AddStoredProc01.Designer.cs">
|
||||
<DependentUpon>202406070826284_AddStoredProc01.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202407170704518_AddProdDtLastMod.cs" />
|
||||
<Compile Include="Migrations\202407170704518_AddProdDtLastMod.Designer.cs">
|
||||
<DependentUpon>202407170704518_AddProdDtLastMod.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202408051054365_AddRawItemLogicalDelete.cs" />
|
||||
<Compile Include="Migrations\202408051054365_AddRawItemLogicalDelete.Designer.cs">
|
||||
<DependentUpon>202408051054365_AddRawItemLogicalDelete.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
@@ -357,6 +365,12 @@
|
||||
<EmbeddedResource Include="Migrations\202406070826284_AddStoredProc01.resx">
|
||||
<DependentUpon>202406070826284_AddStoredProc01.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202407170704518_AddProdDtLastMod.resx">
|
||||
<DependentUpon>202407170704518_AddProdDtLastMod.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202408051054365_AddRawItemLogicalDelete.resx">
|
||||
<DependentUpon>202408051054365_AddRawItemLogicalDelete.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="SqlScripts\Stored\stp_LogMachineFixPid.sql">
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddProdDtLastMod : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProdDtLastMod));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202407170704518_AddProdDtLastMod"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddProdDtLastMod : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProdList", "DtLastMod", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900-01-01')"));
|
||||
CreateIndex("dbo.ProdList", "DtLastMod");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.ProdList", new[] { "DtLastMod" });
|
||||
DropColumn("dbo.ProdList", "DtLastMod");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddRawItemLogicalDelete : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddRawItemLogicalDelete));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202408051054365_AddRawItemLogicalDelete"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddRawItemLogicalDelete : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.RawItemList", "IsDeleted", c => c.Boolean(nullable: false, defaultValue: false, defaultValueSql: "0"));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.RawItemList", "IsDeleted");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Egalware s.r.l.")]
|
||||
[assembly: AssemblyProduct("EgtBEAMWALL.DataLayer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020-2024 by Egalware s.r.l.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.6.6.1")]
|
||||
[assembly: AssemblyFileVersion("2.6.6.1")]
|
||||
[assembly: AssemblyVersion("2.5.12.2")]
|
||||
[assembly: AssemblyFileVersion("2.5.12.2")]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
|
||||
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2406.2911" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2408.514" targetFramework="net472" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||
<package id="Google.Protobuf" version="3.27.0" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />
|
||||
|
||||
@@ -1,456 +0,0 @@
|
||||
Imports System.Buffers.Binary
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports Sharp7
|
||||
|
||||
Public Class SIEMENSSharp7Comm
|
||||
|
||||
Private m_DBVariableList As New List(Of DBBuffer) ' Buffer list
|
||||
|
||||
Private IntBuffer() As Byte = {0, 0}
|
||||
Private BoolBuffer() As Byte = {0}
|
||||
Private DIntBuffer() As Byte = {0, 0, 0, 0}
|
||||
Private RealBuffer() As Byte = {0, 0, 0, 0}
|
||||
Private StringBuffer(65536) As Byte ' Buffer
|
||||
Private Client As New S7Client ' Client Object
|
||||
|
||||
' lista variabili in lettura
|
||||
Private Shared m_ReadingVars(100) As CommVar
|
||||
|
||||
' lista dei messaggi di errore attivi
|
||||
Private m_ActiveMessages As New List(Of SiemensReadMessages)
|
||||
|
||||
Private m_MachManaging As MachManaging
|
||||
Friend ReadOnly Property MachManaging As MachManaging
|
||||
Get
|
||||
Return m_MachManaging
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub New(MachManaging As MachManaging)
|
||||
m_MachManaging = MachManaging
|
||||
End Sub
|
||||
|
||||
Public Shared Function InitVar(Variable As CommVar) As CommVar
|
||||
Dim Index As Integer = Array.IndexOf(m_ReadingVars, Nothing)
|
||||
m_ReadingVars(Index) = Variable
|
||||
Return m_ReadingVars(Index)
|
||||
End Function
|
||||
|
||||
' Avvio la connessione Hardware-Client
|
||||
Friend Function InitConnection() As Boolean
|
||||
' Ip del PLC
|
||||
Dim sIp As String = ""
|
||||
GetPrivateProfileString(S_GENERAL, K_IP, "", sIp, CurrentMachine.sMachIniFile)
|
||||
' unità usate dal PLC (Rack e Slot)
|
||||
Dim nRack As Integer = GetPrivateProfileInt(S_GENERAL, K_RACK, 0, CurrentMachine.sMachIniFile)
|
||||
Dim nSlot As Integer = GetPrivateProfileInt(S_GENERAL, K_SLOT, 0, CurrentMachine.sMachIniFile)
|
||||
Map.refMachManaging.DebugMessage(1, "Tentativo di connessione a CN Siemens con Sharp7")
|
||||
Map.refMachManaging.DebugMessage(1, "IP: " & sIp)
|
||||
Map.refMachManaging.DebugMessage(1, "Rack: " & nRack)
|
||||
Map.refMachManaging.DebugMessage(1, "Slot: " & nSlot)
|
||||
Dim nResult As Integer = Client.ConnectTo(sIp, nRack, nSlot)
|
||||
If nResult = 0 Then
|
||||
Map.refMachManaging.DebugMessage(1, "Connessione effettuata")
|
||||
Else
|
||||
Map.refMachManaging.DebugMessage(1, "Connessione fallita con codice di errore: " & nResult)
|
||||
End If
|
||||
' se la connessione è restituisce 0
|
||||
Return nResult = 0
|
||||
End Function
|
||||
|
||||
' chiudo la connessione
|
||||
Friend Sub CloseConnection()
|
||||
Dim nResult As Integer = Client.Disconnect()
|
||||
If Map.refMachManaging.Debug > 0 Then
|
||||
If nResult = 0 Then
|
||||
EgtOutLog("Disconnessione effettuata")
|
||||
Else
|
||||
EgtOutLog("Disconnessione fallita con codice di errore: " & nResult)
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "Read Variables"
|
||||
|
||||
Public Sub RefreshAllVars()
|
||||
m_DBVariableList.Clear()
|
||||
For Each Var In m_ReadingVars
|
||||
' rileggo solo variabili continue
|
||||
If Not IsNothing(Var) AndAlso Var.nReadType = CommVar.ReadTypes.CONTINUOUS Then
|
||||
Dim CompleteAddressSplit() As String = Var.sAddress.Split(":"c)
|
||||
Dim nDBAddress As Integer = 0
|
||||
Integer.TryParse(CompleteAddressSplit(0), nDBAddress)
|
||||
If nDBAddress = 0 Then Return
|
||||
Dim DBBuffer As DBBuffer = m_DBVariableList.FirstOrDefault(Function(x) x.DBAddress = nDBAddress)
|
||||
If IsNothing(DBBuffer) Then
|
||||
Dim Buffer(65536) As Byte
|
||||
Dim nAddressByte As Integer = 0
|
||||
Select Case nDBAddress
|
||||
Case 301
|
||||
nAddressByte = 8
|
||||
Case 302
|
||||
nAddressByte = 34
|
||||
End Select
|
||||
Map.refMachManaging.DebugMessage(1, "Lettura di " & nAddressByte & " byte dalla variabile " & nDBAddress)
|
||||
Dim nResult As Integer = 1234567890
|
||||
Try
|
||||
nResult = Client.DBRead(nDBAddress, 0, nAddressByte, Buffer)
|
||||
Catch ex As Exception
|
||||
nResult = 1234567890
|
||||
Map.refMachManaging.DebugMessage(1, "Lettura di " & nDBAddress & " ha generato un'eccezione")
|
||||
Map.refMachManaging.DebugMessage(1, ex.ToString())
|
||||
End Try
|
||||
If nResult = 0 Then
|
||||
Map.refMachManaging.DebugMessage(1, "Lettura di " & nDBAddress & " effettuata")
|
||||
If Map.refMachManaging.Debug > 1 Then
|
||||
For Index = 0 To Buffer.Count - 1
|
||||
Map.refMachManaging.DebugMessage(2, Index & ": " & Buffer(Index))
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
Map.refMachManaging.DebugMessage(2, "Lettura fallita con codice di errore: " & nResult)
|
||||
End If
|
||||
If nResult = 0 Then
|
||||
DBBuffer = New DBBuffer(nDBAddress, Buffer)
|
||||
m_DBVariableList.Add(DBBuffer)
|
||||
End If
|
||||
End If
|
||||
If Not IsNothing(DBBuffer) Then
|
||||
Dim PositionAddressSplit() As String = CompleteAddressSplit(1).Split("."c)
|
||||
Dim nStartIndex As Integer = 0
|
||||
Integer.TryParse(PositionAddressSplit(0), nStartIndex)
|
||||
Select Case CompleteAddressSplit(2)
|
||||
Case 1
|
||||
Dim nBytePositionIndex As Integer = 0
|
||||
Integer.TryParse(PositionAddressSplit(1), nBytePositionIndex)
|
||||
Dim nPower As Integer = Math.Pow(2, nBytePositionIndex)
|
||||
' Dim bValue As Boolean = (TestBuffer(nStartIndex) And nPower) = nPower
|
||||
Map.refMachManaging.DebugMessage(2, "Lettura variabile " & nDBAddress & ":" & nStartIndex & "." & nBytePositionIndex)
|
||||
Var.SetValue(If((DBBuffer.DBValue(nStartIndex) And nPower) = nPower, 1, 0))
|
||||
Map.refMachManaging.DebugMessage(2, "Variabile " & nDBAddress & ":" & nStartIndex & "." & nBytePositionIndex & " (Tipo 1) = " & Var.sValue)
|
||||
Case 2
|
||||
'Dim x = BitConverter.ToInt16(TestBuffer, nStartIndex)
|
||||
Dim nValue As Int16 = BitConverter.ToInt16(DBBuffer.DBValue, nStartIndex)
|
||||
Map.refMachManaging.DebugMessage(2, "Lettura variabile " & nDBAddress & ":" & nStartIndex)
|
||||
Var.SetValue(BinaryPrimitives.ReverseEndianness(nValue))
|
||||
Map.refMachManaging.DebugMessage(2, "Variabile " & nDBAddress & ":" & nStartIndex & " (Tipo 2) = " & Var.sValue)
|
||||
Case 3
|
||||
' Dim x = BitConverter.ToInt32(TestBuffer, nStartIndex)
|
||||
Dim nValue As Integer = BitConverter.ToInt32(DBBuffer.DBValue, nStartIndex)
|
||||
Map.refMachManaging.DebugMessage(2, "Lettura variabile " & nDBAddress & ":" & nStartIndex)
|
||||
Var.SetValue(BinaryPrimitives.ReverseEndianness(nValue))
|
||||
Map.refMachManaging.DebugMessage(2, "Variabile " & nDBAddress & ":" & nStartIndex & " (Tipo 3) = " & Var.sValue)
|
||||
End Select
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Function WriteVariable(Address As String, Value As String) As Boolean
|
||||
Dim CompleteAddressSplit() As String = Address.Split(":"c)
|
||||
Dim nDBAddress As Integer = 0
|
||||
Integer.TryParse(CompleteAddressSplit(0), nDBAddress)
|
||||
If nDBAddress = 0 Then Return False
|
||||
Dim PositionAddressSplit() As String = CompleteAddressSplit(1).Split("."c)
|
||||
Dim nStartIndex As Integer = 0
|
||||
Integer.TryParse(PositionAddressSplit(0), nStartIndex)
|
||||
Select Case CompleteAddressSplit(2)
|
||||
Case 1
|
||||
' rileggo int16
|
||||
Dim Buffer(1) As Byte
|
||||
Client.DBRead(nDBAddress, nStartIndex, 1, Buffer)
|
||||
Dim nBytePositionIndex As Integer = 0
|
||||
Integer.TryParse(PositionAddressSplit(1), nBytePositionIndex)
|
||||
Dim nPower As Integer = Math.Pow(2, nBytePositionIndex)
|
||||
Dim nNewValue As Integer = 0
|
||||
If Not Integer.TryParse(Value, nNewValue) Then Return False
|
||||
Dim nOldValue As Integer = If((Buffer(0) And nPower) = nPower, 1, 0)
|
||||
If nOldValue = nNewValue Then
|
||||
Return True
|
||||
ElseIf nOldValue = 0 Then
|
||||
Buffer(0) = Buffer(0) Or nPower
|
||||
ElseIf nOldValue = 1 Then
|
||||
Buffer(0) = Buffer(0) Xor nPower
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
' Buffer(0) = Buffer(0) And nPower
|
||||
If Map.refMachManaging.Debug > 1 Then
|
||||
EgtOutLog("Scrittura variabile " & Address & " (Tipo 1) con valore " & Value)
|
||||
For Index = 0 To Buffer.Count - 1
|
||||
EgtOutLog(Index & ": " & Buffer(Index))
|
||||
Next
|
||||
End If
|
||||
Dim nResult As Integer = Client.DBWrite(nDBAddress, nStartIndex, 1, Buffer) ' DbNumber, Start, Amount, Buffer
|
||||
' Return WriteBool(nDBAddress, nStartIndex, bValue)
|
||||
If Map.refMachManaging.Debug > 1 Then
|
||||
If nResult <> 0 Then
|
||||
EgtOutLog("Scrittura variabile " & nDBAddress & ":" & nStartIndex & " con valore " & Value & " effettuata")
|
||||
Else
|
||||
EgtOutLog("Scrittura variabile " & nDBAddress & ":" & nStartIndex & " con valore " & Value & " fallita")
|
||||
End If
|
||||
End If
|
||||
Return nResult = 0
|
||||
Case 2
|
||||
Dim nValue As Int16 = 0
|
||||
If Not Int16.TryParse(Value, nValue) Then Return False
|
||||
If Map.refMachManaging.Debug > 1 Then
|
||||
EgtOutLog("Scrittura variabile " & Address & " (Tipo 2) con valore " & Value)
|
||||
End If
|
||||
Dim bResult As Boolean = WriteInt(nDBAddress, nStartIndex, nValue)
|
||||
If Map.refMachManaging.Debug > 1 Then
|
||||
If bResult Then
|
||||
EgtOutLog("Scrittura variabile " & nDBAddress & ":" & nStartIndex & " con valore " & Value & " effettuata")
|
||||
Else
|
||||
EgtOutLog("Scrittura variabile " & nDBAddress & ":" & nStartIndex & " con valore " & Value & " fallita")
|
||||
End If
|
||||
End If
|
||||
Return bResult
|
||||
Case 3
|
||||
Dim nValue As Integer = 0
|
||||
If Not Integer.TryParse(Value, nValue) Then Return False
|
||||
If Map.refMachManaging.Debug > 1 Then
|
||||
EgtOutLog("Scrittura variabile " & Address & " (Tipo 3) con valore " & Value)
|
||||
End If
|
||||
Dim bResult As Boolean = WriteDInt(nDBAddress, nStartIndex, nValue)
|
||||
If Map.refMachManaging.Debug > 1 Then
|
||||
If bResult Then
|
||||
EgtOutLog("Scrittura variabile " & nDBAddress & ":" & nStartIndex & " con valore " & Value & " effettuata")
|
||||
Else
|
||||
EgtOutLog("Scrittura variabile " & nDBAddress & ":" & nStartIndex & " con valore " & Value & " fallita")
|
||||
End If
|
||||
End If
|
||||
Return bResult
|
||||
End Select
|
||||
End Function
|
||||
|
||||
#End Region ' Read Variables
|
||||
|
||||
Friend Function ReadInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
|
||||
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
|
||||
Dim Result As Integer = Client.DBRead(DBNumber, Start, 2, IntBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
If Result = 0 Then
|
||||
Value = S7.GetIntAt(IntBuffer, 0)
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Friend Function WriteInt(DBNumber As Integer, Start As Integer, Value As Int16) As Boolean
|
||||
S7.SetIntAt(IntBuffer, 0, Value)
|
||||
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
|
||||
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 2, IntBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
Return Result = 0
|
||||
End Function
|
||||
|
||||
Friend Function ReadBool(DBNumber As Integer, Start As Integer, ByRef Value As Boolean) As Boolean
|
||||
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
|
||||
Dim Result As Integer = Client.DBRead(DBNumber, Start, 1, BoolBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
If Result = 0 Then
|
||||
Value = BitConverter.ToBoolean(BoolBuffer, 0)
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Friend Function WriteBool(DBNumber As Integer, Start As Integer, Value As Boolean) As Boolean
|
||||
If Value Then
|
||||
BoolBuffer(0) = &H1
|
||||
Else
|
||||
BoolBuffer(0) = &H0
|
||||
End If
|
||||
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
|
||||
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 1, BoolBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
Return Result = 0
|
||||
End Function
|
||||
|
||||
Friend Function ReadDInt(DBNumber As Integer, Start As Integer, ByRef Value As Integer) As Boolean
|
||||
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
|
||||
Dim Result As Integer = Client.DBRead(DBNumber, Start, 4, DIntBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
If Result = 0 Then
|
||||
Value = S7.GetDIntAt(DIntBuffer, 0)
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Friend Function WriteDInt(DBNumber As Integer, Start As Integer, Value As Integer) As Boolean
|
||||
S7.SetDIntAt(DIntBuffer, 0, Value)
|
||||
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
|
||||
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 4, DIntBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
Return Result = 0
|
||||
End Function
|
||||
|
||||
Friend Function ReadReal(DBNumber As Integer, Start As Integer, ByRef Value As Double) As Boolean
|
||||
' Read 4 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
|
||||
Dim Result As Integer = Client.DBRead(DBNumber, Start, 4, RealBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
If Result = 0 Then
|
||||
Value = S7.GetRealAt(RealBuffer, 0)
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Friend Function WriteReal(DBNumber As Integer, Start As Integer, Value As Single) As Boolean
|
||||
S7.SetRealAt(RealBuffer, 0, Value)
|
||||
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
|
||||
Dim Result As Integer = Client.DBWrite(DBNumber, Start, 4, RealBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
Return Result = 0
|
||||
End Function
|
||||
|
||||
Friend Function ReadString(DBNumber As Integer, Start As Integer, Length As Integer, ByRef Value As String) As Boolean
|
||||
' Read 2 bytes from the DBNumber starting from Start and puts them into ReadBuffer.
|
||||
Dim Result As Integer = Client.DBRead(DBNumber, Start, Length, StringBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
If Result = 0 Then
|
||||
Value = S7.GetStringAt(StringBuffer, 0)
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Friend Function WriteString(DBNumber As Integer, Start As Integer, Value As String) As Boolean
|
||||
If Value.Length > 65535 Then
|
||||
Return False
|
||||
End If
|
||||
S7.SetStringAt(StringBuffer, 0, 65535, Value)
|
||||
' Read "Size" bytes from the DB "DBNumber" starting from 0 and puts them into Buffer.
|
||||
Dim Result As Integer = Client.DBWrite(DBNumber, Start, Value.Length + 2, StringBuffer) ' DbNumber, Start, Amount, Buffer
|
||||
Return Result = 0
|
||||
End Function
|
||||
|
||||
Friend Sub ResetStep(bReset As Boolean)
|
||||
Dim ResetStep As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList(19) ' Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RESET_STEP)
|
||||
If bReset Then
|
||||
Map.refMachManaging.DebugMessage(1, "Imposto variabile ResetStep a 1")
|
||||
ResetStep.sValue = 1
|
||||
Threading.Thread.Sleep(100)
|
||||
Dim nResetStepOk As Integer = 0
|
||||
Dim ResetStepOk As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RESET_STEP_OK)
|
||||
While nResetStepOk <> 1
|
||||
Map.refMachManaging.DebugMessage(1, "Rileggo variabili")
|
||||
RefreshAllVars()
|
||||
Map.refMachManaging.DebugMessage(1, "Leggo valore ResetStepOk")
|
||||
Integer.TryParse(ResetStepOk.sValue, nResetStepOk)
|
||||
Threading.Thread.Sleep(1000)
|
||||
End While
|
||||
End If
|
||||
ResetStep.sValue = 0
|
||||
Map.refMachManaging.DebugMessage(1, "Imposto variabile ResetStep a 0")
|
||||
End Sub
|
||||
|
||||
Friend Sub ReadPLCMessages()
|
||||
|
||||
Dim nPlc_Msg As New List(Of Byte)
|
||||
For Index As Integer = 1 To 6
|
||||
Dim nIndex As Integer = Index
|
||||
Dim PLCMessagesVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = PLC_MESSAGES & nIndex)
|
||||
If IsNothing(PLCMessagesVariable) OrElse IsNothing(PLCMessagesVariable.sValue) Then Return
|
||||
Dim nTemp As Int16 = 0
|
||||
Int16.TryParse(PLCMessagesVariable.sValue, nTemp)
|
||||
nTemp = BinaryPrimitives.ReverseEndianness(nTemp)
|
||||
Dim Bytes As Byte() = BitConverter.GetBytes(nTemp)
|
||||
nPlc_Msg.AddRange(Bytes)
|
||||
Next
|
||||
Dim BitArray As New BitArray(nPlc_Msg.ToArray())
|
||||
Dim ErrorList As New List(Of Integer)
|
||||
For BitIndex = 0 To BitArray.Count - 1
|
||||
If BitIndex <= 169 AndAlso BitArray(BitIndex) Then
|
||||
ErrorList.Add(BitIndex)
|
||||
End If
|
||||
Next
|
||||
ShowPLCError(ErrorList)
|
||||
End Sub
|
||||
|
||||
Friend Sub ShowPLCError(ErrorNumber As List(Of Integer))
|
||||
' resetto stati bFound
|
||||
For Each Message In m_ActiveMessages
|
||||
Message.bFound = False
|
||||
Next
|
||||
|
||||
For index As Integer = 0 To ErrorNumber.Count - 1
|
||||
Dim nIndex As Integer = index
|
||||
Dim NewMessageInList As SiemensReadMessages = m_ActiveMessages.FirstOrDefault(Function(x) x.nIndex = 0.ToString())
|
||||
' se il messaggio e' gia' in lista
|
||||
If Not IsNothing(NewMessageInList) Then
|
||||
' lo segno come trovato
|
||||
NewMessageInList.bFound = True
|
||||
Else
|
||||
' lo aggiungo
|
||||
Dim NewMessage As SiemensReadMessages = New SiemensReadMessages(0.ToString())
|
||||
NewMessage.bFound = True
|
||||
m_ActiveMessages.Add(NewMessage)
|
||||
m_SiemensAlarmCallbackDlg(0, 0)
|
||||
End If
|
||||
Next
|
||||
|
||||
' cancello messaggi non trovati
|
||||
For Index = m_ActiveMessages.Count - 1 To 0 Step -1
|
||||
Dim Message As SiemensReadMessages = m_ActiveMessages(Index)
|
||||
If Not Message.bFound Then
|
||||
m_SiemensAlarmCallbackDlg(Message.nIndex, 1)
|
||||
m_ActiveMessages.RemoveAt(Index)
|
||||
End If
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Friend Class DBBuffer
|
||||
|
||||
Private m_DBAddress As Integer
|
||||
Public ReadOnly Property DBAddress As Integer
|
||||
Get
|
||||
Return m_DBAddress
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_DBValue(65536) As Byte
|
||||
Public ReadOnly Property DBValue As Byte()
|
||||
Get
|
||||
Return m_DBValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(DBAddress As Integer, DBValue As Byte())
|
||||
m_DBAddress = DBAddress
|
||||
m_DBValue = DBValue
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class SiemensReadMessages
|
||||
|
||||
Private m_nIndex As Integer
|
||||
Public ReadOnly Property nIndex As Integer
|
||||
Get
|
||||
Return m_nIndex
|
||||
End Get
|
||||
End Property
|
||||
Private m_sMessage As String
|
||||
Public ReadOnly Property sMessage As String
|
||||
Get
|
||||
Return m_sMessage
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetMessage(sValue As String)
|
||||
m_sMessage = sValue
|
||||
End Sub
|
||||
|
||||
Private m_bFound As Boolean = False
|
||||
Friend Property bFound As Boolean
|
||||
Get
|
||||
Return m_bFound
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bFound = value
|
||||
End Set
|
||||
End Property
|
||||
Public Sub New(nIndex As Integer)
|
||||
m_nIndex = nIndex
|
||||
m_sMessage = sMessage
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -19,8 +19,6 @@ Module ConstCommVar
|
||||
NUM_FLEXIUM = 2
|
||||
NUM_AXIUM_APSERVER = 3
|
||||
NUM_AXIUM_PCTOOLKIT = 4
|
||||
SIEMENS_SHARP7 = 5
|
||||
SIEMENS_MYHMI = 6
|
||||
End Enum
|
||||
|
||||
' Assi
|
||||
@@ -56,22 +54,6 @@ Module ConstCommVar
|
||||
Public Const PLC_MESSAGES As String = "PLC_Messages"
|
||||
' variabile per leggere e scrivere permesso invio cn a macchina
|
||||
Public Const SENDPERMISSION As String = "SendPermission"
|
||||
' variabile per confermare lettura dati di stato pezzo
|
||||
Public Const DATAREADED As String = "Data_Readed"
|
||||
' variabile per confermare lettura stato reset
|
||||
Public Const RESETREADED As String = "Reset_Readed"
|
||||
' variabile per confermare lettura stato reset
|
||||
Public Const DATATOREAD As String = "Data_ToRead"
|
||||
' variabile per confermare lettura stato reset
|
||||
Public Const RESET_STEP As String = "Reset_Step"
|
||||
' variabile per confermare lettura stato reset
|
||||
Public Const RESET_STEP_OK As String = "Reset_Step_Ok"
|
||||
' variabile per stato CN
|
||||
Public Const NC_STATUS As String = "NC_Status"
|
||||
' variabile per modo CN
|
||||
Public Const NC_MODE As String = "NC_Mode"
|
||||
' variabile per apertura pinze manuale
|
||||
Public Const OPEN_CLAMP As String = "Open_Clamp"
|
||||
|
||||
Public Enum OPStates
|
||||
Start = 1
|
||||
@@ -90,11 +72,4 @@ Module ConstCommVar
|
||||
Home = 8
|
||||
End Enum
|
||||
|
||||
' Variabili Siemens
|
||||
Public Const K_IP As String = "Ip"
|
||||
Public Const K_RACK As String = "Rack"
|
||||
Public Const K_SLOT As String = "Slot"
|
||||
Public Const K_TIMERINTERVAL As String = "TimerInterval"
|
||||
Public Const K_ISOFILEDIR As String = "IsoFileDir"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -16,6 +16,31 @@
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>true</IncrementalBuild>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>false</IncrementalBuild>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
@@ -28,6 +53,29 @@
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
@@ -54,6 +102,27 @@
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\RemoteDebug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\RemoteDebug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.Supervisor.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
@@ -92,7 +161,7 @@
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2406.2617\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2407.1708\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
@@ -163,15 +232,9 @@
|
||||
<Reference Include="SdkApi.Desktop.Usb, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Desktop.Usb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sharp7.net">
|
||||
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Sharp7.net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpSnmpLib, Version=12.1.0.0, Culture=neutral, PublicKeyToken=4c00852d3788e005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Lextm.SharpSnmpLib.12.1.0\lib\net471\SharpSnmpLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Siemens_Dll">
|
||||
<HintPath>..\ExtLibs\Siemens_Dll.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -289,7 +352,6 @@
|
||||
<Compile Include="Comms\NUMAxiumComm.vb" />
|
||||
<Compile Include="Comms\NUMAxiumPcToolkitComm.vb" />
|
||||
<Compile Include="Comms\NUMFlexiumComm.vb" />
|
||||
<Compile Include="Comms\SIEMENSSharp7Comm.vb" />
|
||||
<Compile Include="Comms\TPAComm.vb" />
|
||||
<Compile Include="Constants\ConstMachMsg.vb" />
|
||||
<Compile Include="MachineLogPage\MachineLogPageV.xaml.vb">
|
||||
|
||||
@@ -49,8 +49,7 @@
|
||||
Visibility="{Binding E80002_Visibility}"/>
|
||||
</UniformGrid>
|
||||
<Expander Grid.Row="4"
|
||||
Header="Axis"
|
||||
Visibility="{Binding Axis_Visibility}">
|
||||
Header="Axis">
|
||||
<EgtBEAMWALL:AxesPanelV DataContext="{StaticResource AxesPanelVM}"/>
|
||||
</Expander>
|
||||
|
||||
|
||||
@@ -148,17 +148,6 @@ Public Class LeftPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property m_Axis_Visibility As Visibility
|
||||
Public ReadOnly Property Axis_Visibility As Visibility
|
||||
Get
|
||||
Return m_Axis_Visibility
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetAxisVisibility()
|
||||
m_Axis_Visibility = If(CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7, Visibility.Collapsed, Visibility.Visible)
|
||||
NotifyPropertyChanged(NameOf(Axis_Visibility))
|
||||
End Sub
|
||||
|
||||
Private m_bRestart As Boolean = False
|
||||
Public Property bRestart As Boolean
|
||||
Get
|
||||
@@ -280,7 +269,7 @@ Public Class LeftPanelVM
|
||||
|
||||
Public ReadOnly Property OPMode_Visibility As Visibility
|
||||
Get
|
||||
Return If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT Or CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7, Visibility.Visible, Visibility.Collapsed)
|
||||
Return If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -441,7 +430,7 @@ Public Class LeftPanelVM
|
||||
New OPState("Pending", OPStates.Pending),
|
||||
New OPState("Unspecified", OPStates.Unspecified)
|
||||
}
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT, NCTypes.SIEMENS_SHARP7
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
m_OPStateList = New List(Of OPState) From {
|
||||
New OPState("Start", OPStates.Start),
|
||||
New OPState("Stop", OPStates.Stop),
|
||||
@@ -473,19 +462,12 @@ Public Class LeftPanelVM
|
||||
New OPState("Manual", OPModes.Manual),
|
||||
New OPState("Home", OPModes.Home)
|
||||
}
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT, NCTypes.SIEMENS_SHARP7
|
||||
m_OPModeList = New List(Of OPState) From {
|
||||
New OPState("Auto", OPModes.Auto),
|
||||
New OPState("Mdi", OPModes.Mdi),
|
||||
New OPState("Manual", OPModes.Manual),
|
||||
New OPState("Reference Point", OPModes.Home)
|
||||
}
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Friend Sub SetE80000Visibility()
|
||||
' imposto visibilità variabili E80000 e seconda del tipo di controllo
|
||||
If CurrentMachine.NCType = NCTypes.TPA OrElse CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
|
||||
If CurrentMachine.NCType = NCTypes.TPA Then
|
||||
m_E80000_Visibility = Visibility.Collapsed
|
||||
m_E80002_Visibility = Visibility.Collapsed
|
||||
Else
|
||||
|
||||
@@ -324,7 +324,7 @@ Public Class MachCommandMessagePanelVM
|
||||
m_MachManagingThread = New Thread(Sub()
|
||||
MachineCommThread.MachManagingThreadFunction(AddressOf ResultCallbackDlg, AddressOf CloseCallbackDlg,
|
||||
AddressOf UpdateCallbackDlg, AddressOf TPAAlarmCallbackDlg, AddressOf NUMAlarmCallbackDlg,
|
||||
AddressOf SiemensAlarmCallbackDlg, AddressOf AxisCoordinatesCallbackDlg, AddressOf OpStateCallbackDlg,
|
||||
AddressOf AxisCoordinatesCallbackDlg, AddressOf OpStateCallbackDlg,
|
||||
AddressOf OpModeCallbackDlg, AddressOf ChannelCallbackDlg, AddressOf ReadVarCallbackDlg)
|
||||
End Sub)
|
||||
' avvio thread di gestione della macchina che avvia la connessione
|
||||
@@ -804,42 +804,6 @@ Public Class MachCommandMessagePanelVM
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateAlarmLog(DateTime.Now(), AlarmOperation & LogEvent.cSeparator & ErrorTyp & LogEvent.cSeparator & AlarmMessage & LogEvent.cSeparator & AlarmCode & LogEvent.cSeparator, DbControllers.m_SupervisorId))
|
||||
End Sub
|
||||
|
||||
Friend Sub SiemensAlarmCallbackDlg(nIndex As Integer, AlarmOperation As Integer)
|
||||
|
||||
' se aggiungo allarme e non ce ne erano
|
||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) AndAlso m_ErrCycle.Count = 0 AndAlso m_Iso.Count = 0 AndAlso m_Message.Count = 0 AndAlso m_ErrSystem.Count = 0 Then
|
||||
' avvio il timer degli allarmi
|
||||
m_AlarmTimer.Start()
|
||||
End If
|
||||
Dim AlarmMessage As String = nIndex
|
||||
|
||||
' costruisco messaggio errore in base al tipo
|
||||
Dim sErrorMessage As String = AlarmMessage
|
||||
If bMsgTranslationActive Then
|
||||
Dim sTranslatedMsg = MachMsg(MsgParagraphs.PLC, nIndex)
|
||||
If Not String.IsNullOrWhiteSpace(sTranslatedMsg) Then
|
||||
sErrorMessage = sTranslatedMsg
|
||||
End If
|
||||
End If
|
||||
AlarmMessage = If(Not String.IsNullOrWhiteSpace(sErrorMessage), sErrorMessage, "")
|
||||
|
||||
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
|
||||
m_ErrCycle.Add(Alarm.CreateAlarm(nIndex, AlarmMessage))
|
||||
Else
|
||||
m_ErrCycle.RemoveAll(Function(x) x.sCode = nIndex)
|
||||
End If
|
||||
|
||||
' forzo aggiornamento allarmi
|
||||
AlarmTimer_Tick()
|
||||
' se non ci sono errori
|
||||
If m_ErrCycle.Count = 0 AndAlso m_Iso.Count = 0 AndAlso m_Message.Count = 0 AndAlso m_ErrSystem.Count = 0 Then
|
||||
' fermo timer degli allarmi
|
||||
m_AlarmTimer.Stop()
|
||||
End If
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateAlarmLog(AlarmOperation, ErrorTyp, AlarmMessage, AlarmCode, DateTime.Now))
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateAlarmLog(DateTime.Now(), AlarmOperation & LogEvent.cSeparator & nIndex & LogEvent.cSeparator & sErrorMessage, DbControllers.m_SupervisorId))
|
||||
End Sub
|
||||
|
||||
Friend Sub AxisCoordinatesCallbackDlg(AxisValue As Double, AxisIndex As Integer)
|
||||
Map.refAxesPanelVM.AxisCoordinatesCallbackDlg(AxisValue, AxisIndex)
|
||||
End Sub
|
||||
@@ -857,7 +821,7 @@ Public Class MachCommandMessagePanelVM
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT, NCTypes.SIEMENS_SHARP7
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Map.refLeftPanelVM.SetOPState(NewState)
|
||||
End Select
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||
@@ -871,7 +835,7 @@ Public Class MachCommandMessagePanelVM
|
||||
Return
|
||||
End If
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT, NCTypes.SIEMENS_SHARP7
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Map.refLeftPanelVM.SetOPMode(NewState)
|
||||
End Select
|
||||
'DbControllers.m_LogMachineController.Create(MachLog.CreateOPStateLog(newOpState))
|
||||
|
||||
@@ -22,14 +22,13 @@ Public Class MyMachGroupVM
|
||||
ElseIf m_bToBeProduced OrElse m_bSentToMachine Then
|
||||
Return False
|
||||
' se la macchina e' ferma
|
||||
ElseIf CurrentMachine.NCType <> NCTypes.SIEMENS_SHARP7 AndAlso
|
||||
(IsNothing(Map.refLeftPanelVM.SelOPState) OrElse
|
||||
(Map.refLeftPanelVM.SelOPState.Id = 0 OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.End OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Stop OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Unspecified)) Then
|
||||
ElseIf IsNothing(Map.refLeftPanelVM.SelOPState) OrElse
|
||||
(Map.refLeftPanelVM.SelOPState.Id = 0 OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.End OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Stop OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Unspecified) Then
|
||||
' verifico se c'e' un pezzo non finito
|
||||
Dim ToBeRestartedPart As MyMachGroupVM = Map.refSupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x As MyMachGroupVM) x.nProduction_State = Global.EgtBEAMWALL.Core.ItemState.WIP And Not x.m_bToBeProduced)
|
||||
Dim ToBeRestartedPart As MyMachGroupVM = Map.refSupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x As MyMachGroupVM) x.nProduction_State = Global.EgtBEAMWALL.Core.ItemState.WIP And Not m_bToBeProduced)
|
||||
' se c'e', attivo solo il pezzo non finito
|
||||
Return Not (Not IsNothing(ToBeRestartedPart) AndAlso Not ToBeRestartedPart Is Me)
|
||||
Else
|
||||
@@ -49,12 +48,11 @@ Public Class MyMachGroupVM
|
||||
Case ItemState.WIP
|
||||
If Not m_bToBeProduced AndAlso Not m_bSentToMachine Then
|
||||
Return True
|
||||
ElseIf CurrentMachine.NCType <> NCTypes.SIEMENS_SHARP7 AndAlso
|
||||
(IsNothing(Map.refLeftPanelVM.SelOPState) OrElse
|
||||
(Map.refLeftPanelVM.SelOPState.Id = 0 OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.End OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Stop OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Unspecified)) Then
|
||||
ElseIf IsNothing(Map.refLeftPanelVM.SelOPState) OrElse
|
||||
(Map.refLeftPanelVM.SelOPState.Id = 0 OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.End OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Stop OrElse
|
||||
Map.refLeftPanelVM.SelOPState.Id = OPStates.Unspecified) Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
@@ -233,45 +231,27 @@ Public Class MyMachGroupVM
|
||||
End If
|
||||
' se progetto travi e lavorazione interrotta da reset
|
||||
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM AndAlso (bResetWhileCutting OrElse dtStartTime <> DateTime.MinValue) And Not Map.refLeftPanelVM.bRestart Then
|
||||
Dim bRedo As MessageBoxResult = MessageBoxResult.No
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 AndAlso Not IsNothing(Map.refMachManaging) Then
|
||||
' leggo pinze aperte
|
||||
Dim Open_ClampVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = OPEN_CLAMP)
|
||||
Map.refMachManaging.Siemens_Sharp7.RefreshAllVars()
|
||||
Map.refMachManaging.DebugMessage(1, "Leggo variabile pinze aperte " & Open_ClampVariable.sValue)
|
||||
If Open_ClampVariable.sValue = 1 Then
|
||||
Map.refMachManaging.DebugMessage(1, "Pinze aperte, ripartenza impossibile")
|
||||
bRedo = MessageBoxResult.No
|
||||
MessageBox.Show("Pinze aperte, ripartenza impossibile!!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
|
||||
Else
|
||||
' chiedo se riprendere o rifare la barra da zero
|
||||
bRedo = MessageBox.Show(EgtMsg(62509), "", MessageBoxButton.YesNo, MessageBoxImage.Information)
|
||||
End If
|
||||
Else
|
||||
' chiedo se riprendere o rifare la barra da zero
|
||||
bRedo = MessageBox.Show(EgtMsg(62509), "", MessageBoxButton.YesNo, MessageBoxImage.Information)
|
||||
End If
|
||||
' chiedo se riprendere o rifare la barra da zero
|
||||
Dim bRedo As MessageBoxResult = MessageBox.Show(EgtMsg(62509), "", MessageBoxButton.YesNo, MessageBoxImage.Information)
|
||||
Select Case bRedo
|
||||
Case MessageBoxResult.Yes
|
||||
If CurrentMachine.NCType <> NCTypes.SIEMENS_SHARP7 Then
|
||||
' segno da rifare pezzi non completamente lavorati
|
||||
For Each Part As PartVM In PartVMList
|
||||
If Part.dtEndTime <> DateTime.MinValue Then
|
||||
Part.bDO = False
|
||||
Else
|
||||
Part.SetDo(True)
|
||||
End If
|
||||
'Part.bDO = (Part.dtEndTime = DateTime.MinValue)
|
||||
'Part.NotifyPropertyChanged(NameOf(Part.bRedo))
|
||||
Next
|
||||
' se ripresa, mostro lista feature e colonne Redo
|
||||
Map.refLeftPanelVM.bRestart = True
|
||||
' blocco produzione di tutti gli altri
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
' riabilito bottoni di comunicazione a fine invio programma
|
||||
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||
Return
|
||||
End If
|
||||
' segno da rifare pezzi non completamente lavorati
|
||||
For Each Part As PartVM In PartVMList
|
||||
If Part.dtEndTime <> DateTime.MinValue Then
|
||||
Part.bDO = False
|
||||
Else
|
||||
Part.SetDo(True)
|
||||
End If
|
||||
'Part.bDO = (Part.dtEndTime = DateTime.MinValue)
|
||||
'Part.NotifyPropertyChanged(NameOf(Part.bRedo))
|
||||
Next
|
||||
' se ripresa, mostro lista feature e colonne Redo
|
||||
Map.refLeftPanelVM.bRestart = True
|
||||
' blocco produzione di tutti gli altri
|
||||
MyMachGroupVM.UpdateProduceIsEnabledForAll()
|
||||
' riabilito bottoni di comunicazione a fine invio programma
|
||||
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
|
||||
Return
|
||||
Case MessageBoxResult.No
|
||||
' annullo stati dei pezzi gia' fatti
|
||||
For Each Part In PartVMList
|
||||
|
||||
@@ -21,7 +21,6 @@ Module MachCommConst
|
||||
Public Delegate Sub UpdateCallbackDlg(Param As String, Params As String)
|
||||
Public Delegate Sub TPAAlarmCallbackDlg(ByVal AlarmOperation As Integer, ByVal AlarmType As Integer, ByVal AlarmMessage As String, ByVal AlarmCode As String, ByVal AlarmDateTime As String)
|
||||
Public Delegate Sub NUMAlarmCallbackDlg(ByVal CncNumber As Integer, ByVal numberOfError As Integer, ByVal ErrorTyp As String, ByVal ErrorIndex As String, ByVal ErrorNumber As String, ByVal ErrorLine As String, ByVal ErrorMessage As String, ByVal ErrorAdditional As String)
|
||||
Public Delegate Sub SiemensAlarmCallbackDlg(nIndex As Integer, AlarmOperation As Integer)
|
||||
Public Delegate Sub AxisCoordinatesCallbackDlg(ByVal AxisValue As Double, ByVal AxisIndex As Integer)
|
||||
Public Delegate Sub OpStateCallbackDlg(ByVal newOpState As Integer)
|
||||
Public Delegate Sub OpModeCallbackDlg(ByVal newOpState As Integer)
|
||||
@@ -33,7 +32,6 @@ Module MachCommConst
|
||||
Friend m_UpdateCallbackDlg As UpdateCallbackDlg
|
||||
Friend m_TPAAlarmCallbackDlg As TPAAlarmCallbackDlg
|
||||
Friend m_NUMAlarmCallbackDlg As NUMAlarmCallbackDlg
|
||||
Friend m_SiemensAlarmCallbackDlg As SiemensAlarmCallbackDlg
|
||||
Friend m_AxisCoordinatesCallbackDlg As AxisCoordinatesCallbackDlg
|
||||
Friend m_OpStateCallbackDlg As OpStateCallbackDlg
|
||||
Friend m_OpModeCallbackDlg As OpModeCallbackDlg
|
||||
|
||||
@@ -7,7 +7,6 @@ Imports EgtWPFLib5
|
||||
Imports System.IO
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.Supervisor.CommVar
|
||||
Imports System.Windows.Forms.VisualStyles
|
||||
|
||||
Public Class MachManaging
|
||||
|
||||
@@ -50,11 +49,6 @@ Public Class MachManaging
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Siemens_Sharp7 As SIEMENSSharp7Comm
|
||||
Get
|
||||
Return m_CN
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Shared WithEvents m_CommandList As New ObservableCollection(Of ThreadCommand)
|
||||
Public Shared ReadOnly Property CommandList As ObservableCollection(Of ThreadCommand)
|
||||
@@ -103,20 +97,7 @@ Public Class MachManaging
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' variabile che indica prima barra dopo start (Siemens)
|
||||
Private m_bFirstRaw As Boolean = False
|
||||
|
||||
' variabile che indica se emettere ii messaggi di debug
|
||||
Private m_Debug As Integer = 0
|
||||
Public ReadOnly Property Debug As Integer
|
||||
Get
|
||||
Return m_Debug
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
' leggo variabile debug da ini
|
||||
m_Debug = GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0, CurrentMachine.sMachIniFile)
|
||||
' imposto in Map
|
||||
Map.SetRefMachManaging(Me)
|
||||
AddHandler m_CommandList.CollectionChanged, AddressOf CommandList_CollectionChanged
|
||||
@@ -260,7 +241,7 @@ Public Class MachManaging
|
||||
' Threading.Thread.Sleep(300)
|
||||
' End If
|
||||
' End If
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.TPA, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT, NCTypes.SIEMENS_SHARP7
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.TPA, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
' eseguo ciclo principale
|
||||
Dim nReset_State As Integer
|
||||
Dim nStart_State As Boolean
|
||||
@@ -273,9 +254,6 @@ Public Class MachManaging
|
||||
Dim nISO_Sent As Integer
|
||||
Dim nRunning As Integer
|
||||
Dim nCurrMachIndex As Integer
|
||||
Dim nDataWrite As Integer
|
||||
Dim nNCStatus As Integer
|
||||
Dim nNCMode As Integer
|
||||
Dim ResetVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RESET_STATE)
|
||||
Dim StartVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = START_STATE)
|
||||
Dim StopVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = STOP_STATE)
|
||||
@@ -287,11 +265,6 @@ Public Class MachManaging
|
||||
Dim ISOSentVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = ISO_SENT)
|
||||
Dim RunningVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RUNNING)
|
||||
Dim MachIndexVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = MACHINDEX)
|
||||
Dim DataReadedVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = DATAREADED)
|
||||
Dim ResetReadedVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RESETREADED)
|
||||
Dim DataToReadVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = DATATOREAD)
|
||||
Dim NCStatusVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = NC_STATUS)
|
||||
Dim NCModeVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = NC_MODE)
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
' leggo tutte le variabili
|
||||
@@ -468,73 +441,7 @@ Public Class MachManaging
|
||||
'EgtOutLog("Pre lettura posizioni")
|
||||
Num_Axium_PCToolkit.ReadPosition()
|
||||
'EgtOutLog("Post lettura messaggi")
|
||||
Case NCTypes.SIEMENS_SHARP7
|
||||
' leggo tutte le variabili
|
||||
Map.refMachManaging.DebugMessage(1, "Leggo tutte le variabili")
|
||||
Siemens_Sharp7.RefreshAllVars()
|
||||
If Not IsNothing(ResetVariable.sValue) Then
|
||||
Integer.TryParse(ResetVariable.sValue, nReset_State)
|
||||
Else
|
||||
nReset_State = 1
|
||||
End If
|
||||
If Not IsNothing(ProdVariable.sValue) Then
|
||||
Integer.TryParse(ProdVariable.sValue, nP_Prod)
|
||||
Else
|
||||
nP_Prod = -1
|
||||
End If
|
||||
If Not IsNothing(MachGroupVariable.sValue) Then
|
||||
Integer.TryParse(MachGroupVariable.sValue, nP_Machgroup)
|
||||
Else
|
||||
nP_Machgroup = -1
|
||||
End If
|
||||
If Not IsNothing(PartVariable.sValue) Then
|
||||
Integer.TryParse(PartVariable.sValue, nP_Part)
|
||||
Else
|
||||
nP_Part = -1
|
||||
End If
|
||||
If Not IsNothing(StateVariable.sValue) Then
|
||||
Integer.TryParse(StateVariable.sValue, nP_State)
|
||||
Else
|
||||
nP_State = -1
|
||||
End If
|
||||
If Not IsNothing(ISONumVariable.sValue) Then
|
||||
Integer.TryParse(ISONumVariable.sValue, nISO_Num)
|
||||
Else
|
||||
nISO_Num = -1
|
||||
End If
|
||||
If Not IsNothing(RunningVariable.sValue) Then
|
||||
Integer.TryParse(RunningVariable.sValue, nRunning)
|
||||
Else
|
||||
nRunning = -1
|
||||
End If
|
||||
If Not IsNothing(DataReadedVariable.sValue) Then
|
||||
Integer.TryParse(DataReadedVariable.sValue, nDataWrite)
|
||||
Else
|
||||
nDataWrite = -1
|
||||
End If
|
||||
If Not IsNothing(NCStatusVariable.sValue) Then
|
||||
Integer.TryParse(NCStatusVariable.sValue, nNCStatus)
|
||||
Else
|
||||
nNCStatus = -1
|
||||
End If
|
||||
If Not IsNothing(NCModeVariable.sValue) Then
|
||||
Integer.TryParse(NCModeVariable.sValue, nNCMode)
|
||||
Else
|
||||
nNCMode = -1
|
||||
End If
|
||||
' leggo messaggi plc
|
||||
Siemens_Sharp7.ReadPLCMessages()
|
||||
End Select
|
||||
' se SiemensSharp7 e reset a 0, verifico che conferma lettura reset sia a zero
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 And ResetReadedVariable.sValue = "1" And ResetVariable.sValue = "0" Then
|
||||
Map.refMachManaging.DebugMessage(1, "Azzero lettura reset")
|
||||
ResetReadedVariable.sValue = "0"
|
||||
End If
|
||||
' se SiemensSharp7 e dati letti a 1 e dati scritti a 0, verifico che dati letti sia a zero
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 And DataReadedVariable.sValue = "1" And DataToReadVariable.sValue = "0" Then
|
||||
Map.refMachManaging.DebugMessage(1, "Azzero lettura dati")
|
||||
DataReadedVariable.sValue = "0"
|
||||
End If
|
||||
' se NUM aggiorno stato della macchina
|
||||
If CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Then
|
||||
Dim OpState As OPStates
|
||||
@@ -562,41 +469,6 @@ Public Class MachManaging
|
||||
If IsNothing(Map.refLeftPanelVM.SelOPState) OrElse OpState <> Map.refLeftPanelVM.SelOPState.Id Then
|
||||
m_OpStateCallbackDlg(OpState)
|
||||
End If
|
||||
ElseIf CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
|
||||
Dim OpState As OPStates
|
||||
If nNCStatus > 0 Then
|
||||
Select Case nNCStatus
|
||||
Case 1
|
||||
OpState = OPStates.End
|
||||
Case 2
|
||||
OpState = OPStates.Stop
|
||||
Case 3
|
||||
OpState = OPStates.Start
|
||||
Case Else
|
||||
OpState = OPStates.Unspecified
|
||||
End Select
|
||||
End If
|
||||
If IsNothing(Map.refLeftPanelVM.SelOPState) OrElse OpState <> Map.refLeftPanelVM.SelOPState.Id Then
|
||||
Map.refMachManaging.DebugMessage(1, "Imposto stato CN: " & OpState)
|
||||
m_OpStateCallbackDlg(OpState)
|
||||
End If
|
||||
Dim OpMode As OPModes
|
||||
If nNCMode > 0 Then
|
||||
Select Case nNCMode
|
||||
Case 1
|
||||
OpMode = OPModes.Manual
|
||||
Case 2
|
||||
OpMode = OPModes.Auto
|
||||
Case 3
|
||||
OpMode = OPModes.Mdi
|
||||
Case 4 ' Reference Point
|
||||
OpMode = OPModes.Home
|
||||
End Select
|
||||
End If
|
||||
If IsNothing(Map.refLeftPanelVM.SelOPMode) OrElse OpMode <> Map.refLeftPanelVM.SelOPMode.Id Then
|
||||
Map.refMachManaging.DebugMessage(1, "Imposto modo CN: " & OpMode)
|
||||
m_OpModeCallbackDlg(OpMode)
|
||||
End If
|
||||
End If
|
||||
' se TPA e non ancora fatto, preparo variabili barra successiva
|
||||
If CurrentMachine.NCType = NCTypes.TPA AndAlso CurrentMachine.Flow = FlowTypes.CONTINUOUS AndAlso m_NextBarId = 0 Then
|
||||
@@ -610,31 +482,19 @@ Public Class MachManaging
|
||||
nISO_Sent = 1) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT AndAlso
|
||||
Not Num_Axium_PCToolkit.bIsTransferActive AndAlso
|
||||
nISO_Sent = 1) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 AndAlso
|
||||
(nISO_Num = 0 OrElse
|
||||
nISO_Num = nRunning)) Then
|
||||
nISO_Sent = 1) Then
|
||||
' verifico se c'e' un programma da lanciare
|
||||
Map.refMachManaging.DebugMessage(1, "Entro in SendNextProgram")
|
||||
SendNextProgram()
|
||||
End If
|
||||
' verifico se scattato stato reset
|
||||
If nReset_State <> 0 Then
|
||||
Map.refMachManaging.DebugMessage(1, "Scattato Reset")
|
||||
' resetto tutti i programmi
|
||||
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then Map.refProjectVM.SupervisorMachGroupPanelVM.ResetAllMachGroups()
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
|
||||
'resetto programma corrente
|
||||
Map.refMachManaging.DebugMessage(1, "Resetto programma corrente")
|
||||
ISONumVariable.sValue = "0"
|
||||
m_bFirstRaw = True
|
||||
Else
|
||||
' resetto variabili P
|
||||
ProdVariable.sValue = "0"
|
||||
MachGroupVariable.sValue = "0"
|
||||
PartVariable.sValue = "0"
|
||||
StateVariable.sValue = "0"
|
||||
End If
|
||||
' resetto variabili P
|
||||
ProdVariable.sValue = "0"
|
||||
MachGroupVariable.sValue = "0"
|
||||
PartVariable.sValue = "0"
|
||||
StateVariable.sValue = "0"
|
||||
'Tpa.RWVariableManager.WriteVar(P_PROD, 0)
|
||||
'Tpa.RWVariableManager.WriteVar(P_MACHGROUP, 0)
|
||||
'Tpa.RWVariableManager.WriteVar(P_PART, 0)
|
||||
@@ -644,12 +504,7 @@ Public Class MachManaging
|
||||
RemoveAllProgram() ' rimuovo programma default per pending
|
||||
End If
|
||||
' azzero variabile reset
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
|
||||
Map.refMachManaging.DebugMessage(1, "Confermo lettura reset")
|
||||
ResetReadedVariable.sValue = "1"
|
||||
Else
|
||||
ResetVariable.sValue = "0"
|
||||
End If
|
||||
ResetVariable.sValue = "0"
|
||||
'Tpa.remObject.SetVariableCommand(CInt(ISOCNC.Remoting.VariableCommands.WriteVar),
|
||||
' RWVariableManager.GetReadVarFromName(RESET_STATE).sAddress, "0")
|
||||
' resetto prossima barra e variabili V
|
||||
@@ -673,17 +528,10 @@ Public Class MachManaging
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
' verifico stati inizio e fine pezzi
|
||||
ElseIf (CurrentMachine.NCType <> NCTypes.SIEMENS_SHARP7 AndAlso
|
||||
nP_Prod <> 0 AndAlso
|
||||
nP_Machgroup <> 0 AndAlso
|
||||
nP_Part <> 0) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 AndAlso
|
||||
DataToReadVariable.sValue = "1" AndAlso
|
||||
nP_Prod <> 0 AndAlso
|
||||
nP_Machgroup <> 0 AndAlso
|
||||
nP_Part <> 0) Then
|
||||
ElseIf nP_Prod <> 0 AndAlso
|
||||
nP_Machgroup <> 0 AndAlso
|
||||
nP_Part <> 0 Then
|
||||
If nP_State = PartState.START Then
|
||||
Map.refMachManaging.DebugMessage(1, "Leggo dati start")
|
||||
Dim dtStart As DateTime = DateTime.Now()
|
||||
' recupero gruppo di lavorazione del pezzo
|
||||
Dim MachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = nP_Machgroup)
|
||||
@@ -725,9 +573,6 @@ Public Class MachManaging
|
||||
Tpa.RWVariableManager.WriteVarByName(P_STATE, 0)
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
StateVariable.sValue = "0"
|
||||
Case NCTypes.SIEMENS_SHARP7
|
||||
Map.refMachManaging.DebugMessage(1, "Confermo lettura dati start")
|
||||
DataReadedVariable.sValue = "1"
|
||||
End Select
|
||||
' se nessun pezzo della barra diverso da quello corrente e' in start
|
||||
If Not MachGroup.PartVMList.Any(Function(x) x.nPartId <> nP_Part AndAlso x.nProduction_State = 1) Then
|
||||
@@ -745,11 +590,9 @@ Public Class MachManaging
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
DebugMessage(1, "Fine lettura dati start")
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
ElseIf nP_State = PartState.END_ Then
|
||||
DebugMessage(1, "Leggo dati end")
|
||||
Dim dtEnd As DateTime = DateTime.Now()
|
||||
' recupero gruppo di lavorazione del pezzo
|
||||
Dim MachGroup As MyMachGroupVM = Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.FirstOrDefault(Function(x) x.Id = nP_Machgroup)
|
||||
@@ -809,16 +652,10 @@ Public Class MachManaging
|
||||
' scrivo evento fine MachGroup su DB
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateMachGroupStateLog(dtEnd, nP_Prod, nP_Machgroup, nP_State, DbControllers.SupervisorId))
|
||||
' azzero tutte le variabilli per iniziare barra successiva
|
||||
' azzero variabile per far ripartire macchina
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
|
||||
DebugMessage(1, "Confermo lettura dati end")
|
||||
DataReadedVariable.sValue = "1"
|
||||
Else
|
||||
ProdVariable.sValue = "0"
|
||||
MachGroupVariable.sValue = "0"
|
||||
PartVariable.sValue = "0"
|
||||
StateVariable.sValue = "0"
|
||||
End If
|
||||
ProdVariable.sValue = "0"
|
||||
MachGroupVariable.sValue = "0"
|
||||
PartVariable.sValue = "0"
|
||||
StateVariable.sValue = "0"
|
||||
|
||||
' se non impostata data start
|
||||
If MachGroup.dtStartTime = DateTime.MinValue Then
|
||||
@@ -846,11 +683,7 @@ Public Class MachManaging
|
||||
End If
|
||||
Else
|
||||
' azzero variabile per far ripartire macchina
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
|
||||
DataReadedVariable.sValue = "1"
|
||||
Else
|
||||
StateVariable.sValue = "0"
|
||||
End If
|
||||
StateVariable.sValue = "0"
|
||||
End If
|
||||
' aggiorno utilizzo barra da magazzino
|
||||
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 AndAlso MachGroup.PartVMList(0).nPartId = nP_Part AndAlso MachGroup.nProduction_State <> ItemState.Scrapped Then
|
||||
@@ -884,7 +717,6 @@ Public Class MachManaging
|
||||
End If
|
||||
' flag di aggiornamento log macchina
|
||||
Map.refMachineLogPageVM.UpdateMachineLogList(False)
|
||||
DebugMessage(1, "Fine lettura dati end")
|
||||
' attesa per essere sicuro che abbia scritto e riletto variabili
|
||||
Threading.Thread.Sleep(300)
|
||||
End If
|
||||
@@ -934,28 +766,25 @@ Public Class MachManaging
|
||||
If (CurrentMachine.NCType = NCTypes.TPA AndAlso Not m_bStartPending AndAlso Tpa.opState = MachineOperatingState.Pending) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM AndAlso Not Num_Flexium.bIsTransferActive) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER AndAlso Not Num_Axium_APServer.bIsTransferActive) OrElse
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT AndAlso Not Num_Axium_PCToolkit.bIsTransferActive) OrElse
|
||||
CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then ' Or Tpa.opState = MachineOperatingState.Start) Then
|
||||
(CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT AndAlso Not Num_Axium_PCToolkit.bIsTransferActive) Then ' Or Tpa.opState = MachineOperatingState.Start) Then
|
||||
' verifico se c'e' un programma da lanciare
|
||||
If Not IsNothing(Map.refProjectVM.SupervisorMachGroupPanelVM) Then
|
||||
' EgtOutLog("Start " & DateTime.Now())
|
||||
Dim bMachGroupNotReady As Boolean = False
|
||||
SyncLock m_Lock_SendProgram
|
||||
For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
|
||||
DebugMessage(1, "Ciclo alla ricerca di un programma da mandare")
|
||||
' EgtOutLog("Ciclo su name: " & MyMachGroup.Name & " id: " & MyMachGroup.Id)
|
||||
If Not MyMachGroup.bSentToMachine AndAlso (If(CurrentMachine.NCType <> NCTypes.SIEMENS_SHARP7, MyMachGroup.dtStartTime = DateTime.MinValue, MyMachGroup.dtEndTime = DateTime.MinValue) OrElse
|
||||
If Not MyMachGroup.bSentToMachine AndAlso (MyMachGroup.dtStartTime = DateTime.MinValue OrElse
|
||||
(Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL AndAlso MyMachGroup.bResetWhileCutting)) Then
|
||||
' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " è da fare")
|
||||
' verifico se ricalcolo finito
|
||||
If MyMachGroup.bReadyForMachining AndAlso If(CurrentMachine.NCType = NCTypes.NUM_FLEXIUM Or CurrentMachine.NCType = NCTypes.NUM_AXIUM_APSERVER OrElse CurrentMachine.NCType = NCTypes.NUM_AXIUM_PCTOOLKIT, Not MyMachGroup.bSendingToMachine, True) Then
|
||||
' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " pronto per essere lavorato")
|
||||
' lo lancio
|
||||
DebugMessage(1, "Eseguo SendProgram")
|
||||
bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name, MyMachGroup)
|
||||
bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name)
|
||||
' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA, NCTypes.SIEMENS_SHARP7
|
||||
Case NCTypes.TPA
|
||||
MyMachGroup.SetSentToMachine(bSent)
|
||||
Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
MyMachGroup.SetSendingToMachine(bSent)
|
||||
@@ -972,14 +801,6 @@ Public Class MachManaging
|
||||
End If
|
||||
Next
|
||||
End SyncLock
|
||||
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 AndAlso Not Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList.Any(Function(x As MyMachGroupVM) x.nProduction_State < ItemState.WIP And x.bReadyForMachining) Then
|
||||
Dim ISONumVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = ISO_NUM)
|
||||
Dim nISONum As Integer = 0
|
||||
If Not Integer.TryParse(ISONumVariable.sValue, nISONum) Or nISONum <> 0 Then
|
||||
DebugMessage(1, "Resetto programma da inviare")
|
||||
ISONumVariable.sValue = 0
|
||||
End If
|
||||
End If
|
||||
If bMachGroupNotReady Then Return False
|
||||
' EgtOutLog("End " & DateTime.Now())
|
||||
End If
|
||||
@@ -1097,46 +918,6 @@ Public Class MachManaging
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
Case NCTypes.SIEMENS_SHARP7
|
||||
Try
|
||||
m_CN = New SIEMENSSharp7Comm(Me)
|
||||
If Siemens_Sharp7.InitConnection() Then
|
||||
m_bConnected = True
|
||||
' imposto stato manuale
|
||||
Dim ManualMode As OPState = Map.refLeftPanelVM.OPModeList.FirstOrDefault(Function(x) x.Id = OPModes.Manual)
|
||||
Map.refLeftPanelVM.SetOPMode(ManualMode)
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
Else
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End If
|
||||
' creo classe di gestione variabili
|
||||
Catch ex As Exception
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
Case NCTypes.SIEMENS_MYHMI
|
||||
Try
|
||||
Dim SiemensCN = New Siemens_Dll.SiemensDll
|
||||
Dim sLog As String = Path.GetDirectoryName(Map.refMainWindowVM.MainWindowM.sLogFile) & "\SiemensLog.txt"
|
||||
SiemensCN.SetLogPath(Path.GetDirectoryName(Map.refMainWindowVM.MainWindowM.sLogFile) & "\SiemensLog.txt")
|
||||
Dim x As Boolean = SiemensCN.Init()
|
||||
|
||||
'If Siemens_Sharp7.InitConnection() Then
|
||||
' m_bConnected = True
|
||||
' ' imposto stato manuale
|
||||
' Dim ManualMode As OPState = Map.refLeftPanelVM.OPModeList.FirstOrDefault(Function(x) x.Id = OPModes.Manual)
|
||||
' Map.refLeftPanelVM.SetOPMode(ManualMode)
|
||||
' m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
'Else
|
||||
' m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
' Return
|
||||
'End If
|
||||
' creo classe di gestione variabili
|
||||
Catch ex As Exception
|
||||
m_ResultCallbackDlg(CommandTypes.CONNECT, CommandStates.ERROR_, ResultTypes.EXECUTED, "Errore: impossibile connettersi!")
|
||||
Return
|
||||
End Try
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -1169,13 +950,6 @@ Public Class MachManaging
|
||||
' chiudo classe Num_Flexium
|
||||
Me.OnDispose()
|
||||
'Num_Flexium.OnDispose()
|
||||
Case NCTypes.SIEMENS_SHARP7
|
||||
m_bConnected = False
|
||||
Siemens_Sharp7.CloseConnection()
|
||||
m_ResultCallbackDlg(CommandTypes.DISCONNECT, CommandStates.OK, ResultTypes.EXECUTED, "")
|
||||
' chiudo classe Num_Flexium
|
||||
Me.OnDispose()
|
||||
'Num_Flexium.OnDispose()
|
||||
End Select
|
||||
' termino thread di comunicazione
|
||||
MachineCommThread.StopThread()
|
||||
@@ -1291,7 +1065,7 @@ Public Class MachManaging
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Function SendProgram(ProgramPath As String, ProgramId As String, Optional MyMachGroup As MyMachGroupVM = Nothing) As Boolean
|
||||
Public Function SendProgram(ProgramPath As String, ProgramId As String) As Boolean
|
||||
Select Case CurrentMachine.NCType
|
||||
Case NCTypes.TPA
|
||||
If Tpa.opState = MachineOperatingState.Pending Then
|
||||
@@ -1322,27 +1096,6 @@ Public Class MachManaging
|
||||
Num_Axium_PCToolkit.FileDownload(nFileType * 10, ProgramPath)
|
||||
End If
|
||||
Return True
|
||||
Case NCTypes.SIEMENS_SHARP7
|
||||
' EgtOutLog("Pre Download")
|
||||
Dim nFileType As Integer = 0
|
||||
If Integer.TryParse(ProgramId, nFileType) AndAlso nFileType > 0 Then
|
||||
Dim sDestDir As String = ""
|
||||
GetPrivateProfileString(S_GENERAL, K_ISOFILEDIR, "c:/Saomad/ISO", sDestDir, CurrentMachine.sMachIniFile)
|
||||
DebugMessage(1, "Copio programma")
|
||||
File.Copy(ProgramPath, sDestDir & "/" & nFileType & ".mpf", True)
|
||||
' imposto numero programma scritto
|
||||
Dim ISONumVariable As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = ISO_NUM)
|
||||
DebugMessage(1, "Imposto programma inviato: " & nFileType)
|
||||
ISONumVariable.sValue = nFileType
|
||||
' se primo dopo start
|
||||
If m_bFirstRaw Then
|
||||
m_bFirstRaw = False
|
||||
DebugMessage(1, "Primo grezzo")
|
||||
' annullo step di ripartenza
|
||||
Map.refMachManaging.Siemens_Sharp7.ResetStep(Not (MyMachGroup.dtStartTime <> DateTime.MinValue OrElse MyMachGroup.nProduction_State = ItemState.WIP))
|
||||
End If
|
||||
End If
|
||||
Return True
|
||||
End Select
|
||||
Return False
|
||||
End Function
|
||||
@@ -1435,13 +1188,6 @@ Public Class MachManaging
|
||||
Case CommVar.Types.CN
|
||||
Num_Axium_PCToolkit.WriteNCVariables(Address, Value)
|
||||
End Select
|
||||
Case NCTypes.SIEMENS_SHARP7
|
||||
Select Case Type
|
||||
Case CommVar.Types.PLC
|
||||
Siemens_Sharp7.WriteVariable(Address, Value)
|
||||
'Case CommVar.Types.CN
|
||||
' Num_Axium_PCToolkit.WriteNCVariables(Address, Value)
|
||||
End Select
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
@@ -1457,8 +1203,6 @@ Public Class MachManaging
|
||||
Return NUMAxiumComm.InitVar(NewVar)
|
||||
Case NCTypes.NUM_AXIUM_PCTOOLKIT
|
||||
Return NUMAxiumPcToolkitComm.InitVar(NewVar)
|
||||
Case NCTypes.SIEMENS_SHARP7
|
||||
Return SIEMENSSharp7Comm.InitVar(NewVar)
|
||||
End Select
|
||||
Return Nothing
|
||||
End Function
|
||||
@@ -1551,14 +1295,4 @@ Public Class MachManaging
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
#Region "Debug"
|
||||
|
||||
Friend Sub DebugMessage(nLevel As Integer, sMessage As String)
|
||||
If m_Debug >= nLevel Then
|
||||
EgtOutLog(sMessage)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' Debug
|
||||
|
||||
End Class
|
||||
|
||||
@@ -21,7 +21,7 @@ Class MachineCommThread
|
||||
Private Shared sResetVarName As String = "0.FUNM.E80048"
|
||||
|
||||
Public Shared Sub MachManagingThreadFunction(ResultCallbackDlg As ResultCallbackDlg, CloseCallbackDlg As CloseCallbackDlg, UpdateCallbackDlg As UpdateCallbackDlg,
|
||||
TPAAlarmCallbackDlg As TPAAlarmCallbackDlg, NUMAlarmCallbackDlg As NUMAlarmCallbackDlg, SiemensAlarmCallbackDlg As SiemensAlarmCallbackDlg, AxisCoordinatesCallbackDlg As AxisCoordinatesCallbackDlg,
|
||||
TPAAlarmCallbackDlg As TPAAlarmCallbackDlg, NUMAlarmCallbackDlg As NUMAlarmCallbackDlg, AxisCoordinatesCallbackDlg As AxisCoordinatesCallbackDlg,
|
||||
OpStateCallbackDlg As OpStateCallbackDlg, OpModeCallbackDlg As OpModeCallbackDlg, ChannelCallbackDlg As ChannelCallbackDlg,
|
||||
ReadVarCallbackDlg As ReadVarCallbackDlg)
|
||||
' inizializzo callback
|
||||
@@ -30,7 +30,6 @@ Class MachineCommThread
|
||||
m_UpdateCallbackDlg = UpdateCallbackDlg
|
||||
m_TPAAlarmCallbackDlg = TPAAlarmCallbackDlg
|
||||
m_NUMAlarmCallbackDlg = NUMAlarmCallbackDlg
|
||||
m_SiemensAlarmCallbackDlg = SiemensAlarmCallbackDlg
|
||||
m_AxisCoordinatesCallbackDlg = AxisCoordinatesCallbackDlg
|
||||
m_OpStateCallbackDlg = OpStateCallbackDlg
|
||||
m_OpModeCallbackDlg = OpModeCallbackDlg
|
||||
|
||||
@@ -176,7 +176,7 @@ Public Class MainMenuVM
|
||||
#Region "METHODS"
|
||||
|
||||
Friend Sub SetInputOutputVisibility()
|
||||
If CurrentMachine.NCType = NCTypes.TPA OrElse CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
|
||||
If CurrentMachine.NCType = NCTypes.TPA Then
|
||||
m_Inputs_Visibility = Visibility.Collapsed
|
||||
m_Outputs_Visibility = Visibility.Collapsed
|
||||
End If
|
||||
|
||||
@@ -248,8 +248,8 @@ Public Class MainWindowM
|
||||
EgtSetLockId( sLockId)
|
||||
End If
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2606, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2606, 1, m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2512, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2512, 1, m_nKeyOptions)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
m_sLogFile = m_sTempDir & "\" & SUPGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
|
||||
@@ -158,7 +158,7 @@ Public Class MainWindowVM
|
||||
' sincronizzo tutti i progetti
|
||||
DbControllers.m_MagmanController.ProjAllSyncro()
|
||||
' sincronizzo log macchina
|
||||
DbControllers.m_MagmanController.CloudLogMaccSyncro(100, 5000, True)
|
||||
'DbControllers.m_MagmanController.CloudLogMaccSyncro(100, 5000, True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -240,7 +240,7 @@ Public Class MainWindowVM
|
||||
Public Sub CloseApplication()
|
||||
' se macchina sta funzionando
|
||||
If Not IsNothing(Map.refMachManaging) AndAlso Map.refMachManaging.bConnected AndAlso
|
||||
(If(Not IsNothing(Map.refLeftPanelVM.SelOPState), Map.refLeftPanelVM.SelOPState.Id <> OPStates.End AndAlso Map.refLeftPanelVM.SelOPState.Id <> OPStates.Unspecified, True)) Then
|
||||
(Map.refLeftPanelVM.SelOPState.Id <> OPStates.End AndAlso Map.refLeftPanelVM.SelOPState.Id <> OPStates.Unspecified) Then
|
||||
MessageBox.Show("Impossible closing software while machine is working. If you want to close, first press reset and stop the machine!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
Return
|
||||
End If
|
||||
@@ -255,7 +255,7 @@ Public Class MainWindowVM
|
||||
' loggo chiusura programma
|
||||
DbControllers.m_LogMachineController.Create(LogEvent.CreateSoftwareOnOffLog(False, DbControllers.m_SupervisorId))
|
||||
' sincronizzo
|
||||
DbControllers.m_MagmanController.CloudLogMaccSyncro(100, 5000, True)
|
||||
' DbControllers.m_MagmanController.CloudLogMaccSyncro(100, 5000, True)
|
||||
End If
|
||||
' Termino il Model
|
||||
MainWindowM.Close()
|
||||
|
||||
@@ -30,7 +30,7 @@ Imports System.Windows
|
||||
#End if
|
||||
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||
<Assembly: AssemblyProduct("EgtBEAMWALL.Supervisor")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2024 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: ComVisible(false)>
|
||||
|
||||
@@ -70,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.6.1.1")>
|
||||
<Assembly: AssemblyFileVersion("2.6.1.1")>
|
||||
<Assembly: AssemblyVersion("2.5.12.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.12.2")>
|
||||
|
||||
@@ -268,8 +268,6 @@ Public Module CurrentMachine
|
||||
Map.refLeftPanelVM.LoadOPModes()
|
||||
' Imposto visibilità variabili E80000
|
||||
Map.refLeftPanelVM.SetE80000Visibility()
|
||||
' Imposto visibilita' assi
|
||||
Map.refLeftPanelVM.SetAxisVisibility()
|
||||
End Sub
|
||||
|
||||
#End Region 'Init
|
||||
|
||||
@@ -186,7 +186,7 @@ Public Class LogEvent
|
||||
End Sub
|
||||
|
||||
Public Shared Function CreateMachLog(EventType As MachLogTypes, EventDateTime As DateTime, Value As String, SupervisorID As String)
|
||||
Return MachLog.CreateMachLog(EventType, EventDateTime, Value, If(Not IsNothing(Map.refSupervisorManagerVM.CurrProd), Map.refSupervisorManagerVM.CurrProd.nProdId, 0), SupervisorID)
|
||||
Return MachLog.CreateMachLog(EventType, EventDateTime, Value, Map.refSupervisorManagerVM.CurrProd.nProdId, SupervisorID)
|
||||
End Function
|
||||
|
||||
Public Shared Function CreatePartStateLog(dtEvent As DateTime, Prod As Integer, MachGroup As Integer, Part As Integer, State As Integer, SupervisorID As String)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
|
||||
<package id="Csv" version="1.0.31" targetFramework="net472" />
|
||||
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2406.2617" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2407.1708" targetFramework="net472" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||
<package id="FluentFTP" version="19.2.2" targetFramework="net472" />
|
||||
<package id="Google.Protobuf" version="3.27.0" targetFramework="net472" />
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-111.2.0.0" newVersion="111.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-111.1.0.0" newVersion="111.1.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
|
||||
|
||||
@@ -468,7 +468,7 @@ Public Class BTLPartVM
|
||||
Else
|
||||
m_BTLPartM.MaterialM = New MaterialM(0, dH, 0, m_BTLPartM.sMATERIAL)
|
||||
End If
|
||||
Map.refProjectVM.BTLStructureVM.ReadMaterialFromDb(Me, Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE, False)
|
||||
Map.refProjectVM.BTLStructureVM.ReadMaterialFromDb(Me, False)
|
||||
' se sezione nuova non presente
|
||||
If Not Map.refProjectVM.BTLStructureVM.SectionList.Contains(Section) Then
|
||||
' creo nuova sezione
|
||||
|
||||
@@ -1319,27 +1319,27 @@ Public Class BTLStructureVM
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Sub ReadAllMaterialFromDb(nPROJTYPE As BWType)
|
||||
Friend Sub ReadAllMaterialFromDb()
|
||||
m_MaterialDbList.Clear()
|
||||
' aggiornamento materiale
|
||||
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
||||
If IsNothing(Part.BTLPartM.MaterialM) OrElse Part.BTLPartM.MaterialM.nId = 0 OrElse String.IsNullOrWhiteSpace(Part.BTLPartM.MaterialM.sWarehouseMaterial) Then
|
||||
ReadMaterialFromDb(Part, nPROJTYPE, True)
|
||||
ReadMaterialFromDb(Part, True)
|
||||
End If
|
||||
Next
|
||||
m_MaterialDbList.Clear()
|
||||
End Sub
|
||||
|
||||
Friend Sub ReadMaterialFromDb(Part As BTLPartVM, nPROJTYPE As BWType, Optional bUseList As Boolean = False)
|
||||
Friend Sub ReadMaterialFromDb(Part As BTLPartVM, Optional bUseList As Boolean = False)
|
||||
If Not IsNothing(Part.BTLPartM.MaterialM) AndAlso Part.BTLPartM.MaterialM.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(Part.BTLPartM.MaterialM.sWarehouseMaterial) Then Return
|
||||
' aggiornamento materiale
|
||||
Dim Material As MaterialM = Nothing
|
||||
If bUseList Then
|
||||
Dim SearchMaterialRes As SearchMaterialRes = m_MaterialDbList.FirstOrDefault(Function(x) x.sMaterialName = Part.MaterialM.sMaterial)
|
||||
If Not IsNothing(SearchMaterialRes) Then
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
Material = SearchMaterialRes.SearchRes.Result.FirstOrDefault(Function(x) x.dW = Part.dW AndAlso x.dH = Part.dH)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
Material = SearchMaterialRes.SearchRes.Result.FirstOrDefault(Function(x) x.dH = Part.dH)
|
||||
End If
|
||||
End If
|
||||
@@ -1351,9 +1351,9 @@ Public Class BTLStructureVM
|
||||
Dim SearchRes As DataLayer.Controllers.MaterialsController.SearchResult = DbControllers.m_MaterialsController.SearchFilt(Part.MaterialM.sMaterial)
|
||||
Select Case SearchRes.Tipo
|
||||
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dW = Part.dW AndAlso x.dH = Part.dH)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dH = Part.dH)
|
||||
End If
|
||||
If IsNothing(Material) Then
|
||||
@@ -1377,9 +1377,9 @@ Public Class BTLStructureVM
|
||||
If IsNothing(Part.MaterialM.sWarehouseMaterial) Then
|
||||
Part.MaterialM.SetWarehouseMaterial(Part.MaterialM.sMaterial)
|
||||
End If
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
DbControllers.m_MaterialsController.Insert(New MaterialM(Math.Min(Part.dW, Part.dH), Math.Max(Part.dW, Part.dH), 0, 0, Part.MaterialM.sWarehouseMaterial))
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
DbControllers.m_MaterialsController.Insert(New MaterialM(0, Part.dH, 0, 0, Part.MaterialM.sWarehouseMaterial))
|
||||
End If
|
||||
SearchRes = DbControllers.m_MaterialsController.SearchFilt(Part.MaterialM.sWarehouseMaterial)
|
||||
@@ -1393,16 +1393,16 @@ Public Class BTLStructureVM
|
||||
End If
|
||||
Select Case SearchRes.Tipo
|
||||
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dW = Math.Min(Part.dW, Part.dH) AndAlso x.dH = Math.Max(Part.dW, Part.dH))
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dH = Part.dH)
|
||||
End If
|
||||
If IsNothing(Material) Then
|
||||
EgtOutLog("Error! Impossible creating material on Db!")
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
Material = New MaterialM(Math.Min(Part.dW, Part.dH), Math.Max(Part.dW, Part.dH), 0, 0, Part.MaterialM.sMaterial)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
Material = New MaterialM(0, Part.dH, 0, 0, Part.MaterialM.sMaterial)
|
||||
End If
|
||||
End If
|
||||
@@ -1410,9 +1410,9 @@ Public Class BTLStructureVM
|
||||
Part.MaterialM.SetWarehouseMaterial(Material.sWarehouseMaterial)
|
||||
Case Else
|
||||
EgtOutLog("Error! Impossible creating material on Db!")
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
Material = New MaterialM(Math.Min(Part.dW, Part.dH), Math.Max(Part.dW, Part.dH), 0, 0, Part.MaterialM.sMaterial)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
Material = New MaterialM(0, Part.dH, 0, 0, Part.MaterialM.sMaterial)
|
||||
End If
|
||||
Part.MaterialM.SetId(Material.nId)
|
||||
|
||||
@@ -387,15 +387,15 @@ Public Class CALCPanelVM
|
||||
' aggiorno nuovo pezzo
|
||||
CurrBTLPartVM = GetBTLPartVMFromBTLPartId(Line.nCUTID)
|
||||
If IsNothing(CurrBTLPartVM) Then
|
||||
Line.ResetTypePart()
|
||||
EgtOutLog("Error in CALC ProcessResult. CUTID " & Line.nCUTID & "not found in project(BTLPartVM).")
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
' aggiorno nuovo pezzo
|
||||
CurrPartVM = GetPartVMFromPartId(Line.nCUTID)
|
||||
If IsNothing(CurrPartVM) Then
|
||||
Line.ResetTypePart()
|
||||
EgtOutLog("Error in CALC ProcessResult. CUTID " & Line.nCUTID & "not found in project(PartVM).")
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -422,14 +422,14 @@ Public Class CALCPanelVM
|
||||
If nProgramPage = ProjectType.PROJ Then
|
||||
CurrBTLFeatureVM = GetBTLFeatureVMFromBTLPartId(CurrBTLPartVM, Line.nTASKID)
|
||||
If IsNothing(CurrBTLFeatureVM) Then
|
||||
Line.ResetTypeFeature()
|
||||
EgtOutLog("Error in CALC ProcessResult. TASKID " & Line.nTASKID & "not found in BTLPartVM " & CurrBTLPartVM.nPartId)
|
||||
Continue For
|
||||
End If
|
||||
Else
|
||||
CurrBTLFeatureVM = GetFeatureVMFromPartId(CurrPartVM, Line.nTASKID)
|
||||
If IsNothing(CurrBTLFeatureVM) Then
|
||||
Line.ResetTypeFeature()
|
||||
EgtOutLog("Error in CALC ProcessResult. TASKID " & Line.nTASKID & "not found in PartVM " & CurrPartVM.nPartId)
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
@@ -1135,7 +1135,7 @@ Public Class CALCPanelVM
|
||||
' rigenero struttura BTL
|
||||
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(ProjId))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
End Sub
|
||||
|
||||
#End Region ' Ok
|
||||
|
||||
@@ -32,6 +32,31 @@
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>true</IncrementalBuild>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.ViewerOptimizer.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>false</IncrementalBuild>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.ViewerOptimizer.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
@@ -44,6 +69,29 @@
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.ViewerOptimizer.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.ViewerOptimizer.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
@@ -73,6 +121,27 @@
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\RemoteDebug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.ViewerOptimizer.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\x64\RemoteDebug\</OutputPath>
|
||||
<DocumentationFile>EgtBEAMWALL.ViewerOptimizer.xml</DocumentationFile>
|
||||
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RemoteDebug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
@@ -100,7 +169,7 @@
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2406.2617\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2407.1708\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
|
||||
@@ -427,7 +427,7 @@ Public Class FreeContourManagerVM
|
||||
' posiziono la griglia sul riferimento del contorno libero
|
||||
Dim frFace As New Frame3d
|
||||
EgtBeamGetSideData(SelFeature.nSelSIDE, frFace)
|
||||
Dim frFrame As New Frame3d(SelFeature.BTLFeatureM.frFRAME)
|
||||
Dim frFrame As Frame3d = SelFeature.BTLFeatureM.frFRAME
|
||||
frFrame.ToGlob( frFace)
|
||||
EgtSetGridFrame(frFrame)
|
||||
EgtSetGridShow(True, True)
|
||||
|
||||
@@ -495,7 +495,7 @@ Public Class LeftPanelVM
|
||||
' aggiorno dati utilizzo barra
|
||||
BeamMachGroup.UpdateUsage()
|
||||
' aggiorno RawPartM da Db
|
||||
Map.refMachGroupPanelVM.ReadRawPartFromDb(BeamMachGroup, Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refMachGroupPanelVM.ReadRawPartFromDb(BeamMachGroup)
|
||||
' imposto il materiale selezionato come ultimo utilizzato
|
||||
SetLastMaterial(BeamMachGroup.RawPartM)
|
||||
Core.ViewPanelVM.BWSetView(VT.ISO_SW, False)
|
||||
@@ -545,7 +545,7 @@ Public Class LeftPanelVM
|
||||
' aggiorno dati ultilizzo barra
|
||||
WallMachGroup.UpdateUsage()
|
||||
' aggiorno RawPartM da Db
|
||||
Map.refMachGroupPanelVM.ReadRawPartFromDb(WallMachGroup, Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refMachGroupPanelVM.ReadRawPartFromDb(WallMachGroup)
|
||||
' imposto il materiale selezionato come ultimo utilizzato
|
||||
SetLastMaterial(WallMachGroup.RawPartM)
|
||||
Core.ViewPanelVM.BWSetView(VT.TOP, False)
|
||||
@@ -989,7 +989,7 @@ Public Class LeftPanelVM
|
||||
Dim NewPart As BTLPartM = SelPart.Copy()
|
||||
If Not IsNothing(NewPart) Then
|
||||
' aggiorno materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
' selezione ultimo che e' quello appena creato
|
||||
Map.refProjectVM.BTLStructureVM.SetSelBTLPart(Map.refProjectVM.BTLStructureVM.BTLPartVMList(Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1), False, True)
|
||||
End If
|
||||
@@ -1065,7 +1065,7 @@ Public Class LeftPanelVM
|
||||
End If
|
||||
If Not IsNothing(NewPartVM) Then
|
||||
' aggiorno MaterialM da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadMaterialFromDb(NewPartVM, Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadMaterialFromDb(NewPartVM)
|
||||
EgtZoom(ZM.ALL)
|
||||
Map.refProjectVM.BTLStructureVM.SetSelBTLPart(NewPartVM, False, True)
|
||||
' verifico se aggiungere sezione alla lista
|
||||
|
||||
@@ -52,6 +52,7 @@ Public Class MyMachGroupPanelVM
|
||||
MachGroup.UpdateUsage()
|
||||
End If
|
||||
Next
|
||||
ReadAllRawPartFromDb()
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
@@ -250,18 +251,18 @@ Public Class MyMachGroupPanelVM
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Sub ReadAllRawPartFromDb(nPROJTYPE As BWType)
|
||||
Friend Sub ReadAllRawPartFromDb()
|
||||
m_RawPartDbList.Clear()
|
||||
' aggiornamento materiale
|
||||
For Each MachGroup As MyMachGroupVM In Map.refMachGroupPanelVM.m_MachGroupVMList
|
||||
If IsNothing(MachGroup.MyMachGroupM.RawPartM) OrElse MachGroup.MyMachGroupM.RawPartM.nId = 0 OrElse MachGroup.MyMachGroupM.RawPartM.Material.nId = 0 OrElse String.IsNullOrWhiteSpace(MachGroup.MyMachGroupM.RawPartM.Material.sWarehouseMaterial) Then
|
||||
ReadRawPartFromDb(MachGroup, nPROJTYPE, True)
|
||||
ReadRawPartFromDb(MachGroup, True)
|
||||
End If
|
||||
Next
|
||||
m_RawPartDbList.Clear()
|
||||
End Sub
|
||||
|
||||
Friend Sub ReadRawPartFromDb(MachGroup As MyMachGroupVM, nPROJTYPE As BWType, Optional bUseList As Boolean = False)
|
||||
Friend Sub ReadRawPartFromDb(MachGroup As MyMachGroupVM, Optional bUseList As Boolean = False)
|
||||
If Not IsNothing(MachGroup.MyMachGroupM.RawPartM) AndAlso MachGroup.MyMachGroupM.RawPartM.nId > 0 AndAlso MachGroup.MyMachGroupM.RawPartM.Material.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(MachGroup.MyMachGroupM.RawPartM.Material.sWarehouseMaterial) Then Return
|
||||
' aggiornamento materiale
|
||||
Dim RawPart As RawPartM = Nothing
|
||||
@@ -289,23 +290,23 @@ Public Class MyMachGroupPanelVM
|
||||
Dim SearchMaterial As DataLayer.Controllers.MaterialsController.SearchResult = DbControllers.m_MaterialsController.SearchFilt(MachGroup.RawPartM.Material.sMaterial)
|
||||
Select Case SearchMaterial.Tipo
|
||||
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
Material = SearchMaterial.Result.FirstOrDefault(Function(x) Math.Abs(x.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
Material = SearchMaterial.Result.FirstOrDefault(Function(x) Math.Abs(x.dH - MachGroup.dH) < m_DimensionRange)
|
||||
End If
|
||||
Case Else
|
||||
EgtOutLog("Error! MachGroup material not found!!")
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
Material = New MaterialM(MachGroup.dW, MachGroup.dH, 0, 0, MachGroup.sMATERIAL)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
Material = New MaterialM(0, MachGroup.dH, 0, 0, MachGroup.sMATERIAL)
|
||||
End If
|
||||
End Select
|
||||
Dim SearchRawPart As List(Of RawPartM) = DbControllers.m_RawItemsController.GetFilt(Material.nId)
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
|
||||
End If
|
||||
If Not IsNothing(RawPart) Then
|
||||
@@ -317,12 +318,17 @@ Public Class MyMachGroupPanelVM
|
||||
Part.MaterialM.SetWarehouseMaterial(RawPart.Material.sWarehouseMaterial)
|
||||
Next
|
||||
Else
|
||||
Dim nRawPartId As Integer = DbControllers.m_RawItemsController.Upsert(New RawPartM(Material, MachGroup.dW, MachGroup.dL, 0, False))
|
||||
Dim nRawPartId As Integer = 0
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
nRawPartId = DbControllers.m_RawItemsController.Upsert(New RawPartM(Material, 0, MachGroup.dL, 0, False))
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
nRawPartId = DbControllers.m_RawItemsController.Upsert(New RawPartM(Material, MachGroup.dW, MachGroup.dL, 0, False))
|
||||
End If
|
||||
If nRawPartId > 0 Then
|
||||
SearchRawPart = DbControllers.m_RawItemsController.GetFilt(Material.nId)
|
||||
If nPROJTYPE = BWType.BEAM Then
|
||||
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
|
||||
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
|
||||
ElseIf nPROJTYPE = BWType.WALL Then
|
||||
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
|
||||
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
|
||||
End If
|
||||
If IsNothing(RawPart) Then
|
||||
|
||||
@@ -279,7 +279,7 @@ Public Class MainMenuVM
|
||||
' se si rigenero BTLStructure
|
||||
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
' carico filtri di ricerca
|
||||
Map.refProjectVM.BTLStructureVM.LoadFilters()
|
||||
End If
|
||||
@@ -358,7 +358,7 @@ Public Class MainMenuVM
|
||||
' se si rigenero BTLStructure
|
||||
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
' carico filtri di ricerca
|
||||
Map.refProjectVM.BTLStructureVM.LoadFilters()
|
||||
End If
|
||||
@@ -373,8 +373,6 @@ Public Class MainMenuVM
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.GOTOPROD, 3, EgtMsg(63002), 30, 100) ' Loading machining groups
|
||||
' carico lista dei MachGroup
|
||||
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refMachGroupPanelVM.ReadAllRawPartFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
' fisso indice sessione di comunicazione
|
||||
If CommIndex > -1 Then
|
||||
Map.refProdManagerVM.CurrProd.SetModificationIndex(CommIndex)
|
||||
|
||||
@@ -242,8 +242,8 @@ Public Class MainWindowM
|
||||
EgtSetLockId( sLockId)
|
||||
End If
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2606, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2606, 1, m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(5327, 2512, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(5327, 2512, 1, m_nKeyOptions)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
m_sLogFile = m_sTempDir & "\" & VWOPTGENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
|
||||
@@ -30,7 +30,7 @@ Imports System.Windows
|
||||
#End If
|
||||
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||
<Assembly: AssemblyProduct("EgtBEAMWALL.ViewerOptimizer")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2024 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2023 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: ComVisible(false)>
|
||||
|
||||
@@ -70,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.6.6.1")>
|
||||
<Assembly: AssemblyFileVersion("2.6.6.1")>
|
||||
<Assembly: AssemblyVersion("2.5.12.2")>
|
||||
<Assembly: AssemblyFileVersion("2.5.12.2")>
|
||||
|
||||
@@ -356,7 +356,7 @@ Public Class NestingRunningWndVM
|
||||
' seleziono ultimo gruppo
|
||||
Map.refProjectVM.MachGroupPanelVM.SelLastMachGroup()
|
||||
' aggiorno barre con MaterialM da Db
|
||||
Map.refMachGroupPanelVM.ReadAllRawPartFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refMachGroupPanelVM.ReadAllRawPartFromDb()
|
||||
' riabilito interfaccia
|
||||
Map.refProjectVM.SetCalcRunning(False)
|
||||
' fermo timer e chiudo finestra
|
||||
|
||||
@@ -140,6 +140,7 @@ Public Class NewOpenProjectFileDialogVM
|
||||
If Not IsNothing(SelProject.ProdFileVM) Then
|
||||
' archivio il progetto
|
||||
DbControllers.m_ProdController.UpdateArchived(SelProject.ProdFileVM.nProdId, Not SelProject.bIsArchived)
|
||||
DbControllers.m_MagmanController.ProjSyncro(SelProject.ProdFileVM.nProdId)
|
||||
NotifyPropertyChanged(NameOf(Archive_Msg))
|
||||
End If
|
||||
' aggiorno lista progetti
|
||||
|
||||
@@ -306,8 +306,6 @@ Public Class ProdManagerVM
|
||||
MessageBox.Show(EgtMsg(61885), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
|
||||
Map.refProjManagerVM.NewProject()
|
||||
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refMachGroupPanelVM.ReadAllRawPartFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Else
|
||||
If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
|
||||
Map.refProjectVM.SetOptimizePanel_Visibility(True)
|
||||
|
||||
@@ -308,7 +308,7 @@ Public Class ProjManagerVM
|
||||
Private Sub ReloadBTLStructure()
|
||||
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
' verifico se volume pezzi calcolato
|
||||
Dim bIsCalculated As Boolean = False
|
||||
For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
||||
@@ -1599,7 +1599,7 @@ Public Class ProjManagerVM
|
||||
' costruisco BTLStructure del proj
|
||||
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(nImportProjId))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(nType)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
' scrivo info proj su tutti i pezzi di questo progetto
|
||||
For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
||||
EgtSetInfo(BTLPart.nPartId, BTL_PRT_PROJ, nNewProjId)
|
||||
@@ -1682,8 +1682,6 @@ Public Class ProjManagerVM
|
||||
Map.refProdManagerVM.CurrProd = Nothing
|
||||
' carico Machgroup che non verrebbero altrimenti importati
|
||||
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refMachGroupPanelVM.ReadAllRawPartFromDb(nType)
|
||||
If Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.Count > 0 Then
|
||||
' inizializzo nuovo progetto PROD
|
||||
Dim nProdId As Integer = 0
|
||||
|
||||
@@ -593,7 +593,7 @@ Public Class MySceneHostVM
|
||||
Map.refCALCPanelVM.LoadMachineList()
|
||||
End If
|
||||
' aggiornamento materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
If bManageMaterial Then
|
||||
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
||||
Part.NotifyPropertyChanged(NameOf(Part.sWAREHOUSEMATERIAL))
|
||||
@@ -616,8 +616,6 @@ Public Class MySceneHostVM
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.GOTOPROD, 3, EgtMsg(63002), 50, 100) ' Loading machining groups
|
||||
' carico gruppi di lavorazione
|
||||
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refMachGroupPanelVM.ReadAllRawPartFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
' fisso indice sessione di comunicazione
|
||||
If CommIndex > -1 Then
|
||||
Map.refProdManagerVM.CurrProd.SetModificationIndex(CommIndex)
|
||||
@@ -644,8 +642,6 @@ Public Class MySceneHostVM
|
||||
Map.refProjManagerVM.NewProject()
|
||||
If Map.refMainMenuVM.SelPage = Pages.MACHINING Then
|
||||
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
|
||||
' aggiornamento materiale da Db
|
||||
Map.refMachGroupPanelVM.ReadAllRawPartFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -731,7 +727,7 @@ Public Class MySceneHostVM
|
||||
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 2, EgtMsg(63005), 50, 70) ' Loading parts
|
||||
End If
|
||||
' aggiornamento materiale da Db
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb(Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE)
|
||||
Map.refProjectVM.BTLStructureVM.ReadAllMaterialFromDb()
|
||||
If bManageMaterial Then
|
||||
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
||||
Part.NotifyPropertyChanged(NameOf(Part.sWAREHOUSEMATERIAL))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
|
||||
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2406.2617" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2407.1708" targetFramework="net472" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||
<package id="Google.Protobuf" version="3.27.0" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />
|
||||
|
||||
@@ -13,33 +13,58 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtBEAMWALL.Core", "EgtBEAM
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
RemoteDebug|x64 = RemoteDebug|x64
|
||||
RemoteDebug|x86 = RemoteDebug|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x64.Build.0 = Debug|x64
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x86.Build.0 = Debug|x86
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Release|x64.ActiveCfg = Release|x64
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Release|x64.Build.0 = Release|x64
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Release|x86.ActiveCfg = Release|x86
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.Release|x86.Build.0 = Release|x86
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.RemoteDebug|x64.ActiveCfg = RemoteDebug|x64
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.RemoteDebug|x64.Build.0 = RemoteDebug|x64
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.RemoteDebug|x86.ActiveCfg = RemoteDebug|x86
|
||||
{57291955-F9C4-4466-8D53-476D43BA3659}.RemoteDebug|x86.Build.0 = RemoteDebug|x86
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x64.Build.0 = Debug|x64
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x86.Build.0 = Debug|x86
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x64.ActiveCfg = Release|x64
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x64.Build.0 = Release|x64
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x86.ActiveCfg = Release|x86
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x86.Build.0 = Release|x86
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.RemoteDebug|x64.ActiveCfg = RemoteDebug|x64
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.RemoteDebug|x64.Build.0 = RemoteDebug|x64
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.RemoteDebug|x86.ActiveCfg = RemoteDebug|x86
|
||||
{B71DA327-38C8-4305-BBA1-34F3F3F32405}.RemoteDebug|x86.Build.0 = RemoteDebug|x86
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Release|x64.Build.0 = Release|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.Release|x86.Build.0 = Release|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.RemoteDebug|x64.ActiveCfg = Release|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.RemoteDebug|x86.ActiveCfg = Release|Any CPU
|
||||
{24D7760E-662A-47E4-B729-B70126C24A31}.RemoteDebug|x86.Build.0 = Release|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.RemoteDebug|x64.ActiveCfg = Release|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.RemoteDebug|x86.ActiveCfg = Release|Any CPU
|
||||
{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.RemoteDebug|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user