diff --git a/EgtBEAMWALL.Core/Constants/ConstBeam.vb b/EgtBEAMWALL.Core/Constants/ConstBeam.vb
index c59f0b65..46fc2942 100644
--- a/EgtBEAMWALL.Core/Constants/ConstBeam.vb
+++ b/EgtBEAMWALL.Core/Constants/ConstBeam.vb
@@ -210,6 +210,10 @@
Friend Const MGR_PRT_DES As String = "DES"
Friend Const MGR_PRT_STARTCUT As String = "STARTCUT"
Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
+ Friend Const MGR_PRT_ROT As String = "ROT"
+ Friend Const MGR_PRT_FLIP As String = "FLIP"
+ Friend Const MGR_PRT_POSX As String = "POSX"
+ Friend Const MGR_PRT_POSY As String = "POSY"
Friend Const MGR_FTR_GRP As String = "GRP"
Friend Const MGR_FTR_PRC As String = "PRC"
diff --git a/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb b/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb
index 52a62a4d..30e3b1d8 100644
--- a/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb
+++ b/EgtBEAMWALL.Core/MachGroup Model/MyMachGroupPanelM.vb
@@ -81,6 +81,8 @@ Public Class MyMachGroupPanelM
ElseIf UsedMachine.nType = MachineType.WALL Then
TempList.Add(WallMachGroupM.CreateWallMachGroup(nId, sName, sMachine))
End If
+ ' rimuovo info
+ EgtSetInfo(nId, "UPDATEUI", "")
End If
nId = EgtGetNextMachGroup(nId)
End While
diff --git a/EgtBEAMWALL.Core/WallM.vb b/EgtBEAMWALL.Core/WallM.vb
index bc02735c..e65b73db 100644
--- a/EgtBEAMWALL.Core/WallM.vb
+++ b/EgtBEAMWALL.Core/WallM.vb
@@ -62,26 +62,30 @@ Public Class WallM
End If
NewWallM.SetInverted(nTemp)
' leggo PosX, PosY, Rot e Flip
- Dim sInfo As String = ""
- Dim Index = 1
- Dim sSplitInfo() As String
- Dim bFound As Boolean = False
- While EgtGetInfo(NewWallM.m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
- If Not String.IsNullOrWhiteSpace(sInfo) Then
- sSplitInfo = sInfo.Split(","c)
- If sSplitInfo(0) = nPartId Then
- bFound = True
- Exit While
- End If
- End If
- Index += 1
- End While
- If bFound Then
- StringToDouble(sSplitInfo(1), NewWallM.m_dPOSX)
- StringToDouble(sSplitInfo(2), NewWallM.m_dPOSY)
- StringToDouble(sSplitInfo(3), NewWallM.m_dROT)
- StringToDouble(sSplitInfo(4), NewWallM.m_bFLIP)
- End If
+ EgtGetInfo(nPartId, MGR_PRT_POSX, NewWallM.m_dPOSX)
+ EgtGetInfo(nPartId, MGR_PRT_POSY, NewWallM.m_dPOSY)
+ EgtGetInfo(nPartId, MGR_PRT_ROT, NewWallM.m_dROT)
+ EgtGetInfo(nPartId, MGR_PRT_FLIP, NewWallM.m_bFLIP)
+ 'Dim sInfo As String = ""
+ 'Dim Index = 1
+ 'Dim sSplitInfo() As String
+ 'Dim bFound As Boolean = False
+ 'While EgtGetInfo(NewWallM.m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
+ ' If Not String.IsNullOrWhiteSpace(sInfo) Then
+ ' sSplitInfo = sInfo.Split(","c)
+ ' If sSplitInfo(0) = nPartId Then
+ ' bFound = True
+ ' Exit While
+ ' End If
+ ' End If
+ ' Index += 1
+ 'End While
+ 'If bFound Then
+ ' StringToDouble(sSplitInfo(1), NewWallM.m_dPOSX)
+ ' StringToDouble(sSplitInfo(2), NewWallM.m_dPOSY)
+ ' StringToDouble(sSplitInfo(3), NewWallM.m_dROT)
+ ' StringToDouble(sSplitInfo(4), NewWallM.m_bFLIP)
+ 'End If
' leggo feature
NewWallM.m_FeatureMList = LoadBTLFeatures(nPartId)
Return NewWallM
diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
index d374fcb7..cb061951 100644
--- a/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
+++ b/EgtBEAMWALL.DataLayer/Controllers/ProjController.cs
@@ -6,484 +6,485 @@ using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
- public class ProjController : IDisposable
- {
- #region Private Fields
+ public class ProjController : IDisposable
+ {
+ #region Private Fields
- private DatabaseContext dbCtx;
+ private DatabaseContext dbCtx;
- #endregion Private Fields
+ #endregion Private Fields
- #region Public Constructors
+ #region Public Constructors
- public ProjController()
- {
- // Initialize database context
- dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
- }
+ public ProjController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext(Constants.CONNECTION_STRING);
+ }
- #endregion Public Constructors
+ #endregion Public Constructors
- #region Protected Methods
+ #region Protected Methods
- ///
- /// Helper conversione modelli
- ///
- ///
- ///
- protected Core.ProjFileM coreConv(ProjModel currProj)
- {
- Core.ProjFileM answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked);
- return answ;
- }
+ ///
+ /// Helper conversione modelli
+ ///
+ ///
+ ///
+ protected Core.ProjFileM coreConv(ProjModel currProj)
+ {
+ Core.ProjFileM answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked);
+ return answ;
+ }
- ///
- /// Get LAST paginated data from DB (DESC ordered)
- ///
- ///
- ///
- protected List GetLastDbModelDesc(int numRecord)
- {
- // se numRecord = 0 --> passo tutti
- if (numRecord == 0)
- {
- numRecord = dbCtx.ProjList.Count();
- }
- // retrieve
- return dbCtx
- .ProjList
- .OrderByDescending(x => x.ProjId)
- .Take(numRecord)
- .ToList();
- }
+ ///
+ /// Get LAST paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ protected List GetLastDbModelDesc(int numRecord)
+ {
+ // se numRecord = 0 --> passo tutti
+ if (numRecord == 0)
+ {
+ numRecord = dbCtx.ProjList.Count();
+ }
+ // retrieve
+ return dbCtx
+ .ProjList
+ .OrderByDescending(x => x.ProjId)
+ .Take(numRecord)
+ .ToList();
+ }
- ///
- /// Get ProdId by ProdDbId, 0 se non trovato
- ///
- ///
- ///
- protected int ProdIdByProdDbId(int? ProdDbId)
- {
- int answ = 0;
+ ///
+ /// Get ProdId by ProdDbId, 0 se non trovato
+ ///
+ ///
+ ///
+ protected int ProdIdByProdDbId(int? ProdDbId)
+ {
+ int answ = 0;
- if (ProdDbId != null)
- {
- var prodRecord = dbCtx
- .ProdList
- .Where(x => x.ProdDbId == ProdDbId)
- .SingleOrDefault();
-
- if (prodRecord != null)
- {
- answ = prodRecord.ProdId;
- }
- }
- return answ;
- }
-
- #endregion Protected Methods
-
- #region Public Methods
-
- public bool DeleteProj(int ProjId)
- {
- bool done = false;
-
- var currProj = FindByProjId(ProjId);
-
- // sel delle BTLParts da proj
- var parts2del = dbCtx
- .BTLPartList
- .Where(x => x.ProjDbId == currProj.ProjDbId);
-
- try
- {
- // remove from database
- dbCtx.BTLPartList.RemoveRange(parts2del);
- dbCtx.ProjList.Remove(currProj);
- // Commit changes
- dbCtx.SaveChanges();
- done = true;
- }
- catch (Exception exc)
- {
- Console.WriteLine($"EXCEPTION on DeleteProj: {exc}");
- }
- return done;
- }
-
- public void Dispose()
- {
- // Clear database context
- dbCtx.Dispose();
- }
-
- ///
- /// Get record by ProjDbId
- ///
- ///
- ///
- public ProjModel FindByProjDbId(int ProjDbId)
- {
- ProjModel answ = dbCtx
- .ProjList
- .Where(x => x.ProjDbId == ProjDbId)
- .SingleOrDefault();
- return answ;
- }
-
- ///
- /// Get record by ProjId
- ///
- ///
- ///
- public ProjModel FindByProjId(int ProjId)
- {
- var answ = dbCtx
- .ProjList
- .Where(x => x.ProjId == ProjId)
- .SingleOrDefault();
- return answ;
- }
-
- ///
- /// Get record by ProjId converted
- ///
- ///
- ///
- public Core.ProjFileM FindByProjIdConv(int ProjId)
- {
- return coreConv(FindByProjId(ProjId));
- }
-
- ///
- /// Get filtered data by ProdId (ASC ordered)
- ///
- ///
- ///
- public List GetByProdAsc(int ProdId)
- {
- List answ = new List();
- int ProdDbId = 0;
- try
- {
- var currProd = dbCtx
- .ProdList
- .Where(x => x.ProdId == ProdId)
- .FirstOrDefault();
- if (currProd != null)
- {
- ProdDbId = currProd.ProdDbId;
- }
- }
- catch (Exception exc)
- {
- Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
- }
- // retrieve
- answ = dbCtx
- .ProjList
+ if (ProdDbId != null)
+ {
+ var prodRecord = dbCtx
+ .ProdList
.Where(x => x.ProdDbId == ProdDbId)
- .OrderBy(x => x.ProdDbId)
- .ToList();
- return answ;
- }
+ .SingleOrDefault();
- ///
- /// Get filtered data by ProdId (DESC ordered)
- ///
- ///
- ///
- public List GetByProdDesc(int ProdId)
- {
- List answ = new List();
- int ProdDbId = 0;
- try
+ if (prodRecord != null)
{
- var currProd = dbCtx
- .ProdList
- .Where(x => x.ProdId == ProdId)
- .FirstOrDefault();
- if (currProd != null)
- {
- ProdDbId = currProd.ProdDbId;
- }
+ answ = prodRecord.ProdId;
}
- catch (Exception exc)
- {
- Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
- }
- // retrieve
- var dbRes = dbCtx
- .ProjList
- .Where(x => x.ProdDbId == ProdDbId)
- .OrderByDescending(x => x.ProdDbId)
- .ToList();
- // conversione
- answ = dbRes.Select(x => coreConv(x)).ToList();
- return answ;
- }
+ }
+ return answ;
+ }
- ///
- /// Elenco progetti
- ///
- ///
- ///
- public List GetLastDesc(int numRecord)
- {
- List answ = new List();
+ #endregion Protected Methods
- // se numRecord = 0 --> passo tutti
- if (numRecord == 0)
- {
- numRecord = dbCtx.ProjList.Count();
- }
- // retrieve
- var dbRes = dbCtx
- .ProjList
- .OrderByDescending(x => x.ProjId)
- .Take(numRecord)
- .ToList();
- // conversione
- answ = dbRes.Select(x => coreConv(x)).ToList();
- return answ;
- }
+ #region Public Methods
- ///
- /// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
- ///
- ///
- public int GetNextIndex()
- {
- int nextId = 0;
+ public bool DeleteProj(int ProjId)
+ {
+ bool done = false;
- // cerco se ne ho ALMENO 1....
- var numRec = dbCtx.ProjList.Count();
- if (numRec == 0)
- {
- nextId = 1;
- }
- else
- {
- // retrieve ultimo...
- var maxRecord = dbCtx
- .ProjList
- .OrderByDescending(x => x.ProjId)
- .Take(1)
- .FirstOrDefault();
- // incremento
- nextId = maxRecord.ProjId + 1;
- }
+ var currProj = FindByProjId(ProjId);
- // creo nuovo...
- var newRec = dbCtx
- .ProjList
- .Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
+ // sel delle BTLParts da proj
+ var parts2del = dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == currProj.ProjDbId);
+ try
+ {
+ // remove from database
+ dbCtx.BTLPartList.RemoveRange(parts2del);
+ dbCtx.ProjList.Remove(currProj);
// Commit changes
dbCtx.SaveChanges();
+ done = true;
+ }
+ catch (Exception exc)
+ {
+ Console.WriteLine($"EXCEPTION on DeleteProj: {exc}");
+ }
+ return done;
+ }
- return nextId;
- }
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
- ///
- /// Manage Lock by ProjId (proj & prod)
- ///
- /// ProjID
- /// Stato Lock da impostare
- ///
- public Core.ProjFileM LockByProjId(int ProjId, bool Locked)
- {
- var currProj = dbCtx
- .ProjList
- .Where(x => x.ProjId == ProjId)
- .SingleOrDefault();
- // aggiorno stato del proj
- currProj.Locked = Locked;
- dbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
+ ///
+ /// Get record by ProjDbId
+ ///
+ ///
+ ///
+ public ProjModel FindByProjDbId(int ProjDbId)
+ {
+ ProjModel answ = dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId == ProjDbId)
+ .SingleOrDefault();
+ return answ;
+ }
- // seleziono il prod e lo blocco...
+ ///
+ /// Get record by ProjId
+ ///
+ ///
+ ///
+ public ProjModel FindByProjId(int ProjId)
+ {
+ var answ = dbCtx
+ .ProjList
+ .Where(x => x.ProjId == ProjId)
+ .SingleOrDefault();
+ return answ;
+ }
+
+ ///
+ /// Get record by ProjId converted
+ ///
+ ///
+ ///
+ public Core.ProjFileM FindByProjIdConv(int ProjId)
+ {
+ return coreConv(FindByProjId(ProjId));
+ }
+
+ ///
+ /// Get filtered data by ProdId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdAsc(int ProdId)
+ {
+ List answ = new List();
+ int ProdDbId = 0;
+ try
+ {
var currProd = dbCtx
.ProdList
- .Where(x => x.ProdDbId == currProj.ProdDbId)
- .SingleOrDefault();
-
+ .Where(x => x.ProdId == ProdId)
+ .FirstOrDefault();
if (currProd != null)
{
- // blocco prod corrente
- currProd.Locked = Locked;
+ ProdDbId = currProd.ProdDbId;
+ }
+ }
+ catch (Exception exc)
+ {
+ Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
+ }
+ // retrieve
+ answ = dbCtx
+ .ProjList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderBy(x => x.ProdDbId)
+ .ToList();
+ return answ;
+ }
- // ora blocco altri proj del prod...
- var currProjs = dbCtx
+ ///
+ /// Get filtered data by ProdId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdDesc(int ProdId)
+ {
+ List answ = new List();
+ int ProdDbId = 0;
+ try
+ {
+ var currProd = dbCtx
+ .ProdList
+ .Where(x => x.ProdId == ProdId)
+ .FirstOrDefault();
+ if (currProd != null)
+ {
+ ProdDbId = currProd.ProdDbId;
+ }
+ }
+ catch (Exception exc)
+ {
+ Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
+ }
+ // retrieve
+ var dbRes = dbCtx
+ .ProjList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderByDescending(x => x.ProdDbId)
+ .ToList();
+ // conversione
+ answ = dbRes.Select(x => coreConv(x)).ToList();
+ return answ;
+ }
+
+ ///
+ /// Elenco progetti
+ ///
+ ///
+ ///
+ public List GetLastDesc(int numRecord)
+ {
+ List answ = new List();
+
+ // se numRecord = 0 --> passo tutti
+ if (numRecord == 0)
+ {
+ numRecord = dbCtx.ProjList.Count();
+ }
+ // retrieve
+ var dbRes = dbCtx
+ .ProjList
+ .OrderByDescending(x => x.ProjId)
+ .Take(numRecord)
+ .ToList();
+ // conversione
+ answ = dbRes.Select(x => coreConv(x)).ToList();
+ return answ;
+ }
+
+ ///
+ /// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
+ ///
+ ///
+ public int GetNextIndex()
+ {
+ int nextId = 0;
+
+ // cerco se ne ho ALMENO 1....
+ var numRec = dbCtx.ProjList.Count();
+ if (numRec == 0)
+ {
+ nextId = 1;
+ }
+ else
+ {
+ // retrieve ultimo...
+ var maxRecord = dbCtx
+ .ProjList
+ .OrderByDescending(x => x.ProjId)
+ .Take(1)
+ .FirstOrDefault();
+ // incremento
+ nextId = maxRecord.ProjId + 1;
+ }
+
+ // creo nuovo...
+ var newRec = dbCtx
+ .ProjList
+ .Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
+
+ // Commit changes
+ dbCtx.SaveChanges();
+
+ return nextId;
+ }
+
+ ///
+ /// Manage Lock by ProjId (proj & prod)
+ ///
+ /// ProjID
+ /// Stato Lock da impostare
+ ///
+ public Core.ProjFileM LockByProjId(int ProjId, bool Locked)
+ {
+ var currProj = dbCtx
+ .ProjList
+ .Where(x => x.ProjId == ProjId)
+ .SingleOrDefault();
+ // aggiorno stato del proj
+ currProj.Locked = Locked;
+ dbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
+
+ // seleziono il prod e lo blocco...
+ var currProd = dbCtx
+ .ProdList
+ .Where(x => x.ProdDbId == currProj.ProdDbId)
+ .SingleOrDefault();
+
+ if (currProd != null)
+ {
+ // blocco prod corrente
+ currProd.Locked = Locked;
+ dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
+
+ // ora blocco altri proj del prod...
+ var currProjs = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
.ToList();
- //currProjs.ForEach(x => x.Locked = Locked);
- foreach (var item in currProjs)
- {
- item.Locked = Locked;
- dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
- }
- }
- // salvataggio
- dbCtx.SaveChanges();
-
- return coreConv(currProj);
- }
-
- ///
- /// Reimposta come NEW
- ///
- /// ProjID
- /// Stato Lock da impostare
- ///
- public Core.ProjFileM ResetNew(int ProjId)
- {
- var currProj = dbCtx
- .ProjList
- .Where(x => x.ProjId == ProjId)
- .SingleOrDefault();
-
- // aggiorno stato
- currProj.IsNew = false;
- dbCtx.SaveChanges();
-
- return coreConv(currProj);
- }
-
- ///
- /// Update single PROJ
- ///
- ///
- ///
- public bool Update(ProjModel updItem)
- {
- bool done = false;
- var item2update = dbCtx
- .ProjList
- .Where(x => x.ProjDbId == updItem.ProjDbId)
- .SingleOrDefault();
- try
+ //currProjs.ForEach(x => x.Locked = Locked);
+ foreach (var item in currProjs)
{
- // update, vers 1...
- dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
-
- //// update, vers 2
- //dbCtx.PartList.Remove(item2del);
- //dbCtx.PartList.Add(updItem);
-
- // Commit changes
- dbCtx.SaveChanges();
- done = true;
+ item.Locked = Locked;
+ dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
- catch
- { }
- return done;
- }
+ }
+ // salvataggio
+ dbCtx.SaveChanges();
- ///
- /// Update record su DB x elenco BTLParts
- ///
- ///
- ///
- ///
- public ProjModel UpdateBtlParts(int ProjId, List BtlPartList)
- {
- // record del proj corrente
- var currData = FindByProjId(ProjId);
+ return coreConv(currProj);
+ }
- // 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
+ ///
+ /// Reimposta come NEW
+ ///
+ /// ProjID
+ /// Stato Lock da impostare
+ ///
+ public Core.ProjFileM ResetNew(int ProjId)
+ {
+ var currProj = dbCtx
+ .ProjList
+ .Where(x => x.ProjId == ProjId)
+ .SingleOrDefault();
- // sel delle BTLParts del proj
- List oldBtlParts = dbCtx
- .BTLPartList
- .Where(x => x.ProjDbId == currData.ProjDbId)
- .ToList();
+ // aggiorno stato
+ currProj.IsNew = false;
+ dbCtx.SaveChanges();
- // converto le BtlParts da core --> DB
- List newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
+ return coreConv(currProj);
+ }
- try
- {
- // elementi BtlPartId NON + presenti da eliminare
- List bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
- List bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
- List bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
+ ///
+ /// Update single PROJ
+ ///
+ ///
+ ///
+ public bool Update(ProjModel updItem)
+ {
+ bool done = false;
+ var item2update = dbCtx
+ .ProjList
+ .Where(x => x.ProjDbId == updItem.ProjDbId)
+ .SingleOrDefault();
+ try
+ {
+ // update, vers 1...
+ dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
- // aggiorno existing...
- foreach (var currPartId in bpiExis)
- {
- // recupero item da aggiornare...
- var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
- // dati nuovo item
- var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
- if (newItem != null && oldItem != null)
- {
- oldItem.CALC_State = newItem.CALC_State;
- oldItem.CNT = newItem.CNT;
- oldItem.DO = newItem.DO;
- oldItem.H = newItem.H;
- oldItem.L = newItem.L;
- oldItem.W = newItem.W;
- oldItem.Material = newItem.Material;
- oldItem.NAM = newItem.NAM;
- oldItem.PDN = newItem.PDN;
- }
- }
-
- // aggiungo le nuove part
- foreach (var newPartId in bpi2add)
- {
- var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
- dbCtx.BTLPartList.Add(newItem);
- }
-
- // elimino dal DB i non + esistenti
- foreach (var oldPartId in bpi2rem)
- {
- // elimino parts nei MachGroup
- var oldIstPartList = dbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
- dbCtx.PartList.RemoveRange(oldIstPartList);
- // elimino BtlParts
- var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
- dbCtx.BTLPartList.Remove(oldItem);
- }
- }
- catch
- { }
-
- // aggiorno valore isNew a false
- currData.IsNew = false;
+ //// update, vers 2
+ //dbCtx.PartList.Remove(item2del);
+ //dbCtx.PartList.Add(updItem);
// Commit changes
dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
- return currData;
- }
+ ///
+ /// Update record su DB x elenco BTLParts
+ ///
+ ///
+ ///
+ ///
+ public ProjModel UpdateBtlParts(int ProjId, List BtlPartList)
+ {
+ // record del proj corrente
+ var currData = FindByProjId(ProjId);
- ///
- /// Update record su DB x nomeBTL, ListName, ExportDate
- ///
- ///
- ///
- ///
- ///
- ///
- public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported)
- {
- var currData = FindByProjId(ProjId);
- // aggiorno valore BTL
- currData.BTLFileName = BTLFileName;
- currData.DtExported = DtExported;
- currData.ListName = ListName;
+ // 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
- // Commit changes
- dbCtx.SaveChanges();
+ // sel delle BTLParts del proj
+ List oldBtlParts = dbCtx
+ .BTLPartList
+ .Where(x => x.ProjDbId == currData.ProjDbId)
+ .ToList();
- return coreConv(currData);
- }
+ // converto le BtlParts da core --> DB
+ List newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
- #endregion Public Methods
- }
+ try
+ {
+ // elementi BtlPartId NON + presenti da eliminare
+ List bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
+ List bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
+ List bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
+
+ // aggiorno existing...
+ foreach (var currPartId in bpiExis)
+ {
+ // recupero item da aggiornare...
+ var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
+ // dati nuovo item
+ var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
+ if (newItem != null && oldItem != null)
+ {
+ oldItem.CALC_State = newItem.CALC_State;
+ oldItem.CNT = newItem.CNT;
+ oldItem.DO = newItem.DO;
+ oldItem.H = newItem.H;
+ oldItem.L = newItem.L;
+ oldItem.W = newItem.W;
+ oldItem.Material = newItem.Material;
+ oldItem.NAM = newItem.NAM;
+ oldItem.PDN = newItem.PDN;
+ }
+ }
+
+ // aggiungo le nuove part
+ foreach (var newPartId in bpi2add)
+ {
+ var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
+ dbCtx.BTLPartList.Add(newItem);
+ }
+
+ // elimino dal DB i non + esistenti
+ foreach (var oldPartId in bpi2rem)
+ {
+ // elimino parts nei MachGroup
+ var oldIstPartList = dbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
+ dbCtx.PartList.RemoveRange(oldIstPartList);
+ // elimino BtlParts
+ var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
+ dbCtx.BTLPartList.Remove(oldItem);
+ }
+ }
+ catch
+ { }
+
+ // aggiorno valore isNew a false
+ currData.IsNew = false;
+
+ // Commit changes
+ dbCtx.SaveChanges();
+
+ return currData;
+ }
+
+ ///
+ /// Update record su DB x nomeBTL, ListName, ExportDate
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported)
+ {
+ var currData = FindByProjId(ProjId);
+ // aggiorno valore BTL
+ currData.BTLFileName = BTLFileName;
+ currData.DtExported = DtExported;
+ currData.ListName = ListName;
+
+ // Commit changes
+ dbCtx.SaveChanges();
+
+ return coreConv(currData);
+ }
+
+ #endregion Public Methods
+ }
}
\ No newline at end of file
diff --git a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml
index 039a5431..b2f3d618 100644
--- a/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml
+++ b/EgtBEAMWALL.ViewerOptimizer/BTLParam/PartInRawPartListV.xaml
@@ -134,7 +134,7 @@
-
@@ -142,7 +142,7 @@
-
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstBeam.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstBeam.vb
index 63efe5c6..be506dac 100644
--- a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstBeam.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstBeam.vb
@@ -207,6 +207,8 @@
Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
Friend Const MGR_PRT_ROT As String = "ROT"
Friend Const MGR_PRT_FLIP As String = "FLIP"
+ Friend Const MGR_PRT_POSX As String = "POSX"
+ Friend Const MGR_PRT_POSY As String = "POSY"
Friend Const MGR_FTR_GRP As String = "GRP"
Friend Const MGR_FTR_PRC As String = "PRC"
@@ -254,6 +256,7 @@
Friend Const WRH_CURRENT As String = "Current"
Friend Const WRH_STARTOFFSET As String = "StartOffset"
Friend Const WRH_OFFSET As String = "Offset"
+ Friend Const WRH_QUANTITY As String = "Quantity"
Friend Const WRH_L As String = "L"
Friend Const WRH_KERF As String = "Kerf"
Friend Const WRH_S As String = "S"
diff --git a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstIni.vb b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstIni.vb
index 957af8cf..fe1a351a 100644
--- a/EgtBEAMWALL.ViewerOptimizer/Constants/ConstIni.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/Constants/ConstIni.vb
@@ -80,6 +80,7 @@ Module ConstIni
Public Const S_IMPORT As String = "Import"
Public Const K_BTLFLAG As String = "BtlFlag"
+ Public Const K_WALLBTLFLAG As String = "WallBtlFlag"
Public Const S_MACH As String = "Mach"
Public Const K_MACHINESDIR As String = "MachinesDir"
diff --git a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb
index c1e9af03..8da17a4a 100644
--- a/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/LeftPanel/LeftPanelVM.vb
@@ -113,11 +113,14 @@ Public Class LeftPanelVM
BeamMachGroup.m_BeamMachGroupM.RefreshGroupData()
' aggiorno dati ultilizzo barra
BeamMachGroup.UpdateUsage()
+ EgtSetView(VT.ISO_SW, False)
ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
' scrivo dati in gruppo di lavorazione
+ Dim dPosX = 10
+ Dim dPosY = 10
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELLEN, AddRawPartWndVM.VariableList(0).dValue)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELWIDTH, AddRawPartWndVM.VariableList(1).dValue)
- EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & 10 & "," & 10 & "," & 0 & "," & 0)
+ EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
Dim WallMachGroup As WallMachGroupVM = DirectCast(Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 1), WallMachGroupVM)
' eseguo script creazione grezzo
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then
@@ -128,13 +131,18 @@ Public Class LeftPanelVM
End If
Return
End If
- 'aggiorno lista pezzi
+ ' scrivo dati pezzo
+ EgtSetInfo(nPartDuploId, MGR_PRT_POSX, dPosX)
+ EgtSetInfo(nPartDuploId, MGR_PRT_POSY, dPosY)
+ EgtSetInfo(nPartDuploId, MGR_PRT_ROT, 0)
+ EgtSetInfo(nPartDuploId, MGR_PRT_FLIP, False)
+ ' aggiorno lista pezzi
WallMachGroup.m_WallMachGroupM.RefreshPartList()
WallMachGroup.m_WallMachGroupM.RefreshGroupData()
' aggiorno dati ultilizzo barra
WallMachGroup.UpdateUsage()
+ EgtSetView(VT.TOP, False)
End If
- EgtSetView(VT.ISO_SW, False)
EgtZoom(ZM.ALL)
End Sub
@@ -208,6 +216,7 @@ Public Class LeftPanelVM
End If
' aggiorno dati ultilizzo barra
BeamMachGroup.UpdateUsage()
+ EgtSetView(VT.ISO_SW, False)
ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
Dim WallMachGroup As WallMachGroupVM = DirectCast(SelMachGroup, WallMachGroupVM)
' verifico spessore
@@ -221,8 +230,8 @@ Public Class LeftPanelVM
End If
' aggiorno dati ultilizzo barra
WallMachGroup.UpdateUsage()
+ EgtSetView(VT.TOP, False)
End If
- EgtSetView(VT.ISO_SW, False)
EgtZoom(ZM.ALL)
End Sub
@@ -328,15 +337,23 @@ Public Class LeftPanelVM
dPosY = 10
End If
End If
- ' scrivo dati in gruppo di lavorazione
- EgtSetInfo(WallMachGroup.Id, MGR_RPT_PART & WallMachGroup.PartVMList.Count + 1, nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
- ' eseguo script creazione grezzo
- Dim nRawId As Integer = EgtGetFirstRawPart()
- While nRawId <> GDB_ID.NULL
- EgtRemoveRawPart(nRawId)
- nRawId = EgtGetFirstRawPart()
- End While
- If Not ExecWall(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return False
+ If EgtAddPartToRawPart(nPartDuploId, New Point3d(dPosX, dPosY, 0), WallMachGroup.m_WallMachGroupM.nRawPartId) Then
+ EgtSetInfo(nPartDuploId, MGR_PRT_POSX, dPosX)
+ EgtSetInfo(nPartDuploId, MGR_PRT_POSY, dPosY)
+ EgtSetInfo(nPartDuploId, MGR_PRT_ROT, 0)
+ EgtSetInfo(nPartDuploId, MGR_PRT_FLIP, False)
+ Else
+ Return False
+ End If
+ '' scrivo dati in gruppo di lavorazione
+ 'EgtSetInfo(WallMachGroup.Id, MGR_RPT_PART & WallMachGroup.PartVMList.Count + 1, nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
+ '' eseguo script creazione grezzo
+ 'Dim nRawId As Integer = EgtGetFirstRawPart()
+ 'While nRawId <> GDB_ID.NULL
+ ' EgtRemoveRawPart(nRawId)
+ ' nRawId = EgtGetFirstRawPart()
+ 'End While
+ 'If Not ExecWall(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return False
'aggiorno lista pezzi
WallMachGroup.m_WallMachGroupM.RefreshPartList()
' seleziono pezzo aggiunto
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb
index 2cc26abd..52665074 100644
--- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/MyMachGroupPanelVM.vb
@@ -75,8 +75,6 @@ Public Class MyMachGroupPanelVM
End Function
Public Function RefreshMachGroupList() As Boolean
- ' Svuoto precedente lista di MachGroup
- MachGroupVMList.Clear()
' carico lista dei gruppi di lavorazione
For Each MachGroup As MyMachGroupM In MyMachGroupPanelM.UpdateFromNestingMyMachGroups(Map.refMachinePanelVM.MachineList.ToList())
m_MachGroupPanelM.AddMachGroup(MachGroup)
@@ -183,7 +181,18 @@ Public Class MyMachGroupPanelVM
Public Overrides Function OnPostSetCurrMachGroup() As Boolean
' Imposto vista solo tavola
EgtSetMachineLook(MCH_LOOK.TAB)
- EgtSetView(VT.ISO_SW, False)
+ Dim View As VT
+ For Each Mach As MyMachine In Map.refMachinePanelVM.MachineList
+ If Mach.Name = SelectedMachGroup.Machine Then
+ If Mach.nType = Core.ConstBeam.MachineType.BEAM Then
+ View = VT.ISO_SW
+ Else
+ View = VT.TOP
+ End If
+ Exit For
+ End If
+ Next
+ EgtSetView(View, False)
EgtZoom(ZM.ALL)
Return True
End Function
diff --git a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallVM.vb b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallVM.vb
index 0fdc67f0..88f411ab 100644
--- a/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/WallVM.vb
@@ -22,7 +22,9 @@ Public Class WallVM
If StringToLen(value, dValue) Then
Dim dOldValue As Double = m_WallM.dPOSX
m_WallM.dPOSX = dValue
- If Not EgtMovePartInRawPart(nPartId, New Vector3d(dValue - dOldValue, 0, 0)) Then
+ If EgtMovePartInRawPart(nPartId, New Vector3d(dValue - dOldValue, 0, 0)) Then
+ EgtSetInfo(nPartId, MGR_PRT_POSX, dValue)
+ Else
' rispristino vecchio valore
m_WallM.dPOSX = dOldValue
End If
@@ -42,7 +44,9 @@ Public Class WallVM
If StringToLen(value, dValue) Then
Dim dOldValue As Double = m_WallM.dPOSY
m_WallM.dPOSY = dValue
- If Not EgtMovePartInRawPart(nPartId, New Vector3d(0, dValue - dOldValue, 0)) Then
+ If EgtMovePartInRawPart(nPartId, New Vector3d(0, dValue - dOldValue, 0)) Then
+ EgtSetInfo(nPartId, MGR_PRT_POSY, dValue)
+ Else
' rispristino vecchio valore
m_WallM.dPOSY = dOldValue
End If
@@ -75,6 +79,7 @@ Public Class WallVM
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
If EgtRotate(nPartId, b3Part.Center, Vector3d.X_AX, 180) Then
m_WallM.bFLIP = value
+ EgtSetInfo(nPartId, MGR_PRT_FLIP, value)
Else
NotifyPropertyChanged(NameOf(bFLIP))
End If
@@ -125,8 +130,6 @@ Public Class WallVM
ParentMachGroupVM.SelPart = ParentMachGroupVM.PartVMList(Index - 1)
End If
ParentMachGroupVM.PartVMList.Remove(Me)
- Dim WallParentMachGroup As WallMachGroupVM = DirectCast(ParentMachGroupVM, WallMachGroupVM)
- If Not IsNothing(WallParentMachGroup) Then WallParentMachGroup.ReDrawWallMachgroup()
' aggiorno contatore pezzi usati in Prod
If Not IsNothing(BTLPart) Then BTLPart.RefreshPartInProd()
EgtDraw()
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
index 0941175f..d1377379 100644
--- a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb
@@ -126,6 +126,7 @@ Public Class MainMenuVM
' apro progetto proj
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
+ DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
End If
Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
Return True
@@ -142,10 +143,6 @@ Public Class MainMenuVM
Map.refProjectVM.SetProdManager_Visibility(True)
' verifico se progetto modificato, e chiedo se salvare
If bVerifyModification Then ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ)
- ' sblocco progetto
- If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
- DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, False)
- End If
Return True
End Function
@@ -165,6 +162,7 @@ Public Class MainMenuVM
If File.Exists(Map.refProdManagerVM.CurrProd.sProdPath) Then
' apro progetto
Map.refSceneHostVM.MainController.OpenProject(Map.refProdManagerVM.CurrProd.sProdPath, False)
+ DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True)
' seleziono prima barra
Map.refProjectVM.MachGroupPanelVM.SelFirstMachGroup()
Else
@@ -190,10 +188,6 @@ Public Class MainMenuVM
' verifico se progetto modificato, e chiedo se salvare
If bVerifyModification Then ProdFileVM.VerifyProjectModification(Map.refProdManagerVM.CurrProd)
EgtResetCurrMachGroup()
- ' sblocco progetto
- If Not IsNothing(Map.refProdManagerVM.CurrProd) Then
- DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, False)
- End If
Return True
End Function
diff --git a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
index 31d5b59f..0e3aab22 100644
--- a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowVM.vb
@@ -63,13 +63,13 @@ Public Class MainWindowVM
Select Case Map.refMainMenuVM.SelPage
Case Pages.VIEW
If Map.refProjManagerVM.CurrProj.bIsNew Then
- m_Title = "New"
+ m_Title = "New - " & Map.refProjManagerVM.CurrProj.nProjId.ToString("0000")
Else
m_Title = Map.refProjManagerVM.CurrProj.nProjId.ToString("0000") & " - " & Map.refProjManagerVM.CurrProj.sBTLFileName
End If
Case Pages.MACHINING
If Map.refProdManagerVM.CurrProd.bIsNew Then
- m_Title = "New"
+ m_Title = "New" & Map.refProdManagerVM.CurrProd.nProdId.ToString("0000")
Else
m_Title = Map.refProdManagerVM.CurrProd.nProdId.ToString("0000")
End If
diff --git a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb
index de526af0..ac7ce28b 100644
--- a/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/OptimizePanel/OptimizePanelVM.vb
@@ -102,17 +102,20 @@ Public Class OptimizePanelVM
Dim dKerf As Double = 0
Select Case WhType
Case WarehouseType.BASIC
+ Dim nQuantity As Integer = 0
sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
' leggo lunghezza barra
Dim nCurrentL As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_CURRENT & WRH_S, 1, sWarehouseIniPath)
dRawL = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_L & nCurrentL, 0, sWarehouseIniPath)
- ' leggo start offset ed offset
+ ' leggo start offset, offset e quantity
dStartOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, sWarehouseIniPath)
dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, sWarehouseIniPath)
+ Integer.TryParse(EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_QUANTITY, 0, sWarehouseIniPath), nQuantity)
' riporto la stessa lunghezza in tutte le sezioni
For Each Section In SectionList
Section.dL = dRawL
+ Section.nQuantity = nQuantity
Next
ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath)
@@ -121,28 +124,37 @@ Public Class OptimizePanelVM
EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, sWarehouseIniPath)
If Not String.IsNullOrWhiteSpace(sPanelDim) Then sPanelDims = sPanelDim.Split(","c)
If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return
+ ' leggo start offset, offset e quantity
dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath)
dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath)
+ Integer.TryParse(EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_QUANTITY, 0, sWarehouseIniPath), nQuantity)
' riporto le stesse dimensioni in tutte le sezioni
For Each Section In SectionList
Section.dL = dRawL
Section.dW = dRawW
+ Section.nQuantity = nQuantity
Next
End If
Case WarehouseType.MEDIUM
+ Dim sCurrL As String
+ Dim nIndex As Integer = 1
sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
' aggiungo le sezioni con diverse lunghezze in base al warehouse
If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
- ' leggo lunghezza barra
- Dim nCurrentL As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_CURRENT & WRH_S, 1, sWarehouseIniPath)
- dRawL = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_L & nCurrentL, 0, sWarehouseIniPath)
' leggo start offset ed offset
dStartOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, sWarehouseIniPath)
dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, sWarehouseIniPath)
- ' riporto la stessa lunghezza in tutte le sezioni
- For Each Section In SectionList
- Section.dL = dRawL
- Next
+ ' leggo lunghezza barra e quantity
+ While EgtUILib.GenInterface.GetPrivateProfileString(WRH_BEAM, WRH_CURRENT & nIndex, "", sCurrL, sWarehouseIniPath) > 0
+ Dim sLValues() As String = sCurrL.Split(","c)
+ For Each Section In SectionList
+ If Section.SectXMat.dW = sLValues(0) AndAlso Section.SectXMat.dH = sLValues(1) AndAlso Section.SectXMat.MaterialForSameSection_List(0) = sLValues(2) Then
+ StringToDouble(sLValues(3), Section.dL)
+ Integer.TryParse(sLValues(4), Section.nQuantity)
+ End If
+ Next
+ nIndex += 1
+ End While
ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath)
Dim sPanelDim As String = ""
@@ -152,11 +164,18 @@ Public Class OptimizePanelVM
If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return
dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath)
dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath)
- ' riporto le stesse dimensioni in tutte le sezioni
- For Each Section In SectionList
- Section.dL = dRawL
- Section.dW = dRawW
- Next
+ ' leggo lunghezza barra e quantity
+ While EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_CURRENT & nIndex, "", sCurrL, sWarehouseIniPath) > 0
+ Dim sLValues() As String = sCurrL.Split(","c)
+ For Each Section In SectionList
+ If Section.SectXMat.dH = sLValues(0) AndAlso Section.SectXMat.MaterialForSameSection_List(0) = sLValues(1) Then
+ StringToDouble(sLValues(2), Section.dW)
+ StringToDouble(sLValues(3), Section.dL)
+ Integer.TryParse(sLValues(4), Section.nQuantity)
+ End If
+ Next
+ nIndex += 1
+ End While
End If
End Select
' attivo loading progress
@@ -164,10 +183,10 @@ Public Class OptimizePanelVM
For Each Section In SectionList
'Dim SectionPartList As New List(Of BTLPartM)(Map.refProjectVM.BTLStructureVM.BTLPartVMList.Where(Function(x) x.Section = Section.SectXMat).ToList())
Dim SectionPartList As List(Of BTLPartM) = (From x In Map.refProjectVM.BTLStructureVM.BTLPartVMList
- Where x.Section = Section.SectXMat
+ Where x.Section = Section.SectXMat AndAlso x.bDO
Select x.BTLPartM).ToList()
' passo a lua lista id pezzi da nestare
- ExecNesting(sLogPath, CurrentMachine.sMachineName, SectionPartList, Section.dL, Section.dW, dStartOffset, dOffset, dKerf)
+ ExecNesting(sLogPath, CurrentMachine.sMachineName, SectionPartList, Section.dL, Section.dW, dStartOffset, dOffset, dKerf, Section.nQuantity)
Next
' update liste grezzi e pezzi della grafica
Map.refProjectVM.MachGroupPanelVM.RefreshMachGroupList()
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
index db75035c..dc47b3fa 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProdManager/ProdManagerVM.vb
@@ -134,26 +134,15 @@ Public Class ProdManagerVM
If File.Exists(sFilePath) Then
If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
m_CurrProd = TempCurrProd
- Map.refMainWindowVM.UpdateTitle()
- 'If Map.refMachGroupPanelVM.InitMachGroupList() Then
- ' m_CurrProd = TempCurrProd
- ' Map.refMainWindowVM.SetTitle(CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL")
- 'Else
- 'MessageBox.Show("Impossibile aprire gruppi di lavorazione del file!!")
- 'Map.refSceneHostVM.MainController.NewProject()
- 'Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
- 'End If
- Else
- MessageBox.Show("Impossibile aprire il file!!")
- Map.refSceneHostVM.MainController.NewProject()
- Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
+ DbControllers.m_ProdController.LockByProdId(m_CurrProd.nProdId, True)
End If
Else
MessageBox.Show("File non trovato!!")
Map.refSceneHostVM.MainController.NewProject()
Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
End If
-
+ ' aggiorno titolo
+ Map.refMainWindowVM.UpdateTitle()
End Sub
#End Region ' OpenCommand
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
index 12ac7f8c..45cadf67 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjManager/ProjManagerVM.vb
@@ -194,9 +194,6 @@ Public Class ProjManagerVM
End Function
Public Function SetCurrProj(nProjId As Integer) As Boolean
- If Not IsNothing(m_CurrProj) Then
- DbControllers.m_ProjController.LockByProjId(m_CurrProj.nProjId, False)
- End If
Dim Currproj As ProjFileM = DbControllers.m_ProjController.FindByProjIdConv(nProjId)
If IsNothing(Currproj) Then Return False
m_CurrProj = New ProjFileVM(Currproj)
@@ -292,7 +289,6 @@ Public Class ProjManagerVM
If Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) Then
m_CurrProj = TempCurrProj
DbControllers.m_ProjController.LockByProjId(m_CurrProj.nProjId, True)
- Map.refMainWindowVM.UpdateTitle()
End If
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProdFileVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProdFileVM.vb
index 02149424..a201b97e 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProdFileVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProdFileVM.vb
@@ -207,6 +207,7 @@ Public Class ProdFileVM
Return False
End If
End If
+ DbControllers.m_ProdController.LockByProdId(CurrProject.nProdId, False)
Return True
End Function
diff --git a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjFileVM.vb b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjFileVM.vb
index 01fd5b61..0fb50e0c 100644
--- a/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjFileVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/ProjectManager/ProjFileVM.vb
@@ -230,6 +230,7 @@ Public Class ProjFileVM
Return False
End If
End If
+ DbControllers.m_ProjController.LockByProjId(CurrProject.nProjId, False)
Return True
End Function
diff --git a/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb b/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
index 4ff91a1c..db639327 100644
--- a/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/SceneHost/MySceneHostVM.vb
@@ -272,7 +272,13 @@ Public Class MySceneHostVM
Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer)
If nType = FT.BTL Or nType = FT.BTLX Then
- nFlag = GetMainPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
+ Dim sBTLFlag As String
+ If Map.refMachinePanelVM.SelectedMachine.nType = Core.ConstBeam.MachineType.BEAM Then
+ sBTLFlag = K_BTLFLAG
+ Else
+ sBTLFlag = K_WALLBTLFLAG
+ End If
+ nFlag = GetMainPrivateProfileInt(S_IMPORT, sBTLFlag, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
Else
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error
End If
diff --git a/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb b/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb
index 90b0ff17..d4d75a92 100644
--- a/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb
+++ b/EgtBEAMWALL.ViewerOptimizer/Utility/LuaExec.vb
@@ -70,7 +70,7 @@ Module LuaExec
Return bOk
End Function
- Friend Function ExecNesting(sFile As String, sMachine As String, PartList As List(Of BTLPartM), dLength As Double, dWidth As Double, dStartOffset As Double, dOffset As Double, dKerf As Double) As Boolean
+ Friend Function ExecNesting(sFile As String, sMachine As String, PartList As List(Of BTLPartM), dLength As Double, dWidth As Double, dStartOffset As Double, dOffset As Double, dKerf As Double, nQty As Integer) As Boolean
EgtOutLog("-- Start ExecNest --")
' Recupero lo script da eseguire
Dim sExecPath As String = ""
@@ -96,6 +96,7 @@ Module LuaExec
EgtLuaSetGlobNumVar("NEST.STARTOFFSET", dStartOffset)
EgtLuaSetGlobNumVar("NEST.OFFSET", dOffset)
EgtLuaSetGlobNumVar("NEST.KERF", dKerf)
+ EgtLuaSetGlobNumVar("NEST.QTY", nQty)
EgtLuaCreateGlobTable("PART")
For PartIndex = 0 To PartList.Count - 1
EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).m_nCNT + PartList(PartIndex).m_nADDED - PartList(PartIndex).nINPROD)