diff --git a/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb b/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb index c8ec7bb0..b9dd3031 100644 --- a/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb +++ b/EgtBEAMWALL.Core/CALCPanel/CalcIntegration.vb @@ -155,7 +155,7 @@ Public Module CalcIntegration Else vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """ " & """" & vBar(nCurrBar).nProjType & """ " & - """" & vBar(nCurrBar).nMachineName & """ " & vBar(nCurrBar).nCmdType + """" & vBar(nCurrBar).nMachineName & """ " & vBar(nCurrBar).nCmdType & " " & vBar(nCurrBar).nBarState End If vProc(j).Proc.StartInfo.UseShellExecute = False @@ -475,7 +475,7 @@ Public Module CalcIntegration End Module Public Class Bar - Public nBarState As Integer + Public nBarState As Integer = -1 Public nBarId As Integer Public sBarPath As String Public bBarOk As Boolean diff --git a/EgtBEAMWALL.Core/My Project/AssemblyInfo.vb b/EgtBEAMWALL.Core/My Project/AssemblyInfo.vb index 31f41472..a7df1fac 100644 --- a/EgtBEAMWALL.Core/My Project/AssemblyInfo.vb +++ b/EgtBEAMWALL.Core/My Project/AssemblyInfo.vb @@ -38,5 +38,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/EgtBEAMWALL.DataLayer/Properties/AssemblyInfo.cs b/EgtBEAMWALL.DataLayer/Properties/AssemblyInfo.cs index 0b2c9fdb..3f080980 100644 --- a/EgtBEAMWALL.DataLayer/Properties/AssemblyInfo.cs +++ b/EgtBEAMWALL.DataLayer/Properties/AssemblyInfo.cs @@ -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("3.1.5.2")] -[assembly: AssemblyFileVersion("3.1.5.2")] +[assembly: AssemblyVersion("3.1.5.3")] +[assembly: AssemblyFileVersion("3.1.5.3")] diff --git a/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml b/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml index 49a0e1dd..cf81b6be 100644 --- a/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml +++ b/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml @@ -68,116 +68,140 @@ diff --git a/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml.vb b/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml.vb index 60d3f798..133addef 100644 --- a/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml.vb +++ b/EgtBEAMWALL.Optimizer/BTLDataWnd/BTLDataWndV.xaml.vb @@ -6,6 +6,7 @@ ' This call is required by the designer. InitializeComponent() Me.DataContext = BTLDataWndVM + Me.Tag = Map.refProjectVM.BTLStructureVM ' Assegno al riferimento locale al VM il VM preso dal DataContext m_BTLDataWndVM = BTLDataWndVM End Sub diff --git a/EgtBEAMWALL.Optimizer/BTLPartManager/BTLPartManagerVM.vb b/EgtBEAMWALL.Optimizer/BTLPartManager/BTLPartManagerVM.vb index 3680a9f7..b0bfc5e0 100644 --- a/EgtBEAMWALL.Optimizer/BTLPartManager/BTLPartManagerVM.vb +++ b/EgtBEAMWALL.Optimizer/BTLPartManager/BTLPartManagerVM.vb @@ -194,7 +194,7 @@ Public Class BTLPartManagerVM ' creo copia Dim NewPart As BTLPartM = SelPart.Copy() If Not IsNothing(NewPart) Then - Map.refProjectVM.UpdatePart(NewPart.nPartId) + If Map.refProdManagerVM.ListProjAsseBase.Count > 0 Then Map.refProjectVM.UpdatePart(NewPart.nPartId) ' 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 @@ -242,7 +242,7 @@ Public Class BTLPartManagerVM End If ' Eseguo cancellazione EgtBeamSetPart(BTLPartToDelete.nPartId) - RemoveScenePart(BTLPartToDelete) + If Map.refProdManagerVM.ListProjAsseBase.Count > 0 Then RemoveScenePart(BTLPartToDelete) ' seleziono elemento precedente Dim Index As Integer = Map.refProjectVM.BTLStructureVM.BTLPartVMList.IndexOf(BTLPartToDelete) Dim FilteredIndex As Integer = Map.refProjectVM.BTLStructureVM.BTLPartVMList_View.IndexOf(BTLPartToDelete) @@ -272,14 +272,18 @@ Public Class BTLPartManagerVM Private Sub RemoveScenePart(BTLPartToDelete As BTLPartVM) ' Rimuovo pezzo dalla scena - Dim IdAsseBase As Integer = Map.refProdManagerVM.ListProjAsseBase(BTLPartToDelete.nPROJ) - If IdAsseBase < 0 Then Return + Dim IdAsseBase As Integer = 0 + Dim DeletePartId As Integer = 0 + If Not Map.refProdManagerVM.ListProjAsseBase.TryGetValue(BTLPartToDelete.nPROJ, IdAsseBase) Then + Return + End If ' Setto il nuovo contesto EgtSetCurrentContext(Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx()) If EgtBeamGetBuildingIsOn(IdAsseBase) Then EgtBeamShowBuilding(IdAsseBase, False) - Dim DeletePartId As Integer = Map.refSceneShowBuldingVM.MapInfo(BTLPartToDelete.nPartId) - EgtErase(DeletePartId) - Map.refSceneShowBuldingVM.MapInfo.Remove(BTLPartToDelete.nPartId) + If Map.refSceneShowBuldingVM.MapInfo.TryGetValue(BTLPartToDelete.nPartId, DeletePartId) Then + EgtErase(DeletePartId) + Map.refSceneShowBuldingVM.MapInfo.Remove(BTLPartToDelete.nPartId) + End If EgtBeamShowBuilding(IdAsseBase, True) EgtZoom(ZM.ALL) ' Ritorno al contesto corrente diff --git a/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb b/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb index 104dc88d..3df1001d 100644 --- a/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb +++ b/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb @@ -188,7 +188,9 @@ Public Class BTLPartVM Get Dim nOrigGroupId As Integer = nPartId If EgtGetCurrentContext() = Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx() Then - nOrigGroupId = Map.refSceneShowBuldingVM.MapInfo(nPartId) + If Not Map.refSceneShowBuldingVM.MapInfo.TryGetValue(nPartId, nOrigGroupId) Then + EgtOutLog(nPartId & " non presente") + End If End If If EgtBeamGetBuildingIsOn() AndAlso Map.refShowBeamPanelVM.bShowAll Then nOrigGroupId = GetOrigFrameGroup(nPartId) @@ -249,7 +251,9 @@ Public Class BTLPartVM Get Dim nOrigGroupId As Integer = nPartId If EgtGetCurrentContext() = Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx() Then - nOrigGroupId = Map.refSceneShowBuldingVM.MapInfo(nPartId) + If Not Map.refSceneShowBuldingVM.MapInfo.TryGetValue(nPartId, nOrigGroupId) Then + EgtOutLog(nPartId & " non presente") + End If End If If EgtBeamGetBuildingIsOn() AndAlso Map.refShowBeamPanelVM.bShowAll Then nOrigGroupId = GetOrigFrameGroup(nPartId) @@ -310,7 +314,9 @@ Public Class BTLPartVM Get Dim nOrigGroupId As Integer = nPartId If EgtGetCurrentContext() = Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx() Then - nOrigGroupId = Map.refSceneShowBuldingVM.MapInfo(nPartId) + If Not Map.refSceneShowBuldingVM.MapInfo.TryGetValue(nPartId, nOrigGroupId) Then + EgtOutLog(nPartId & " non presente") + End If End If If EgtBeamGetBuildingIsOn() AndAlso Map.refShowBeamPanelVM.bShowAll Then nOrigGroupId = GetOrigFrameGroup(nPartId) diff --git a/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj b/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj index 350cc382..f6c7abdc 100644 --- a/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj +++ b/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj @@ -66,6 +66,17 @@ Resources\EgtBEAMWALL.ico + + true + true + true + bin\x86\RemoteDebug\ + EgtBEAMWALL.Optimizer.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + full + x86 + true + ..\EgtBEAMWALL.Core\bin\Debug\EgtBEAMWALL.Core.dll diff --git a/EgtBEAMWALL.Optimizer/ExecProcessManager/MyExecProcessManager.vb b/EgtBEAMWALL.Optimizer/ExecProcessManager/MyExecProcessManager.vb index ff40f63e..feea2777 100644 --- a/EgtBEAMWALL.Optimizer/ExecProcessManager/MyExecProcessManager.vb +++ b/EgtBEAMWALL.Optimizer/ExecProcessManager/MyExecProcessManager.vb @@ -44,6 +44,7 @@ Module MyExecProcessManager Dim sEnvironment As String = "" Dim sPipeLuaFile As String = "" Dim nMaxCamInstances As Integer = 0 + Dim bDebug As Boolean = False While GetMainPrivateProfileString(S_EXECGROUP & nGroupIndex.ToString(), K_ENVIRONMENT, "", sEnvironment) > 0 AndAlso GetMainPrivateProfileString(S_EXECGROUP & nGroupIndex.ToString(), K_PIPELUAFILE, "", sPipeLuaFile) AndAlso GetMainPrivateProfileString(S_EXECGROUP & nGroupIndex.ToString(), K_MAXCAMINSTANCES, "", nMaxCamInstances) @@ -64,7 +65,10 @@ Module MyExecProcessManager nGroupIndex += 1 Continue While End If - Dim NewExecProcessManager As New ExecProcessManager(nGroupIndex, Environment, sCamExePath, PipeLuaPath, nMaxCamInstances, ExecProcessManager.ReturnModes.EVENT_, False) + ' leggo se modalita' debug + Dim nDebug As Integer = GetMainPrivateProfileInt(S_EXECGROUP & nGroupIndex.ToString(), K_DEBUG, 0) + bDebug = (nDebug = 1) + Dim NewExecProcessManager As New ExecProcessManager(nGroupIndex, Environment, sCamExePath, PipeLuaPath, nMaxCamInstances, ExecProcessManager.ReturnModes.EVENT_, bDebug) AddHandler NewExecProcessManager.m_AnswerReceived, AddressOf ExecProcessManager_AnswerReceived NewExecProcessManager.StartExecutionThread() m_ExecProcessManagerList.Add(Environment, NewExecProcessManager) @@ -101,7 +105,9 @@ Module MyExecProcessManager End If If nPreRotate > 0 Then Dim dAng As Integer = nPreRotate * 90 - PartItem.ForwardRotation(True, True, dAng, False) + Application.Current.Dispatcher.BeginInvoke(Sub() + PartItem.ForwardRotation(True, True, dAng, False) + End Sub) End If Dim prefix As String = "INFONGEPART_" diff --git a/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupPanelVM.vb b/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupPanelVM.vb index 9eae0e00..dc0bd4ce 100644 --- a/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupPanelVM.vb +++ b/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupPanelVM.vb @@ -160,11 +160,11 @@ Public Class MyMachGroupPanelVM Dim Beam As PartVM = BeamMachGroup.PartVMList.FirstOrDefault(Function(x) x.nPartId = nDuploId) EgtSetCurrMachGroup(BeamMachGroup.Id) Beam.DeletePart() + ' reset necessario per poter ottenere nMachGroupId corretto + EgtResetCurrMachGroup() + ' aggiorno dati utilizzo barra + BeamMachGroup.UpdateUsage() End If - ' reset necessario per poter ottenere nMachGroupId corretto - EgtResetCurrMachGroup() - ' aggiorno dati utilizzo barra - BeamMachGroup.UpdateUsage() Next ' aggiorno quantita' in prod Dim BTLPart As BTLPartVM = CALCPanelVM.GetBTLPartVMFromBTLPartId(nPartId) diff --git a/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupVM.vb b/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupVM.vb index be9dc284..51e08c2f 100644 --- a/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupVM.vb +++ b/EgtBEAMWALL.Optimizer/MachGroupPanel/MyMachGroupVM.vb @@ -803,6 +803,10 @@ Public Class MyMachGroupVM End If Part.nProduction_State = ItemState.ND Part.NotifyPropertyChanged(NameOf(Part.Background)) + Part.NotifyPropertyChanged(NameOf(Part.ButtonIsEnabled)) + For Each Feature As BTLFeatureVM In Part.FeatureVMList + Feature.NotifyPropertyChanged(NameOf(Feature.IsEnabled)) + Next If bDuploToUpdate Then Dim Duplo As PartVM = CALCPanelVM.GetPartVMFromPartId(Part.nPartId) Duplo.ResetCalcTotalPart() @@ -818,6 +822,7 @@ Public Class MyMachGroupVM End If NotifyPropertyChanged(NameOf(IsReadOnly)) NotifyPropertyChanged(NameOf(Background)) + NotifyPropertyChanged(NameOf(ButtonIsEnabled)) End Sub Private Sub RefreshPartList_Tick() @@ -980,6 +985,7 @@ Public Class MyMachGroupVM .bBarOk = True, .nMachineName = MachineName, .nCmdType = CalcIntegration.CmdTypes.SIMULATE, + .nBarState = SelMachGroup.nProduction_State, .nGlobState = SelMachGroup.nGlobalState} If SelMachGroup.nGlobalState = CalcStates.NOTCALCULATED Then Dim sMachGroupFilePath As String = ProjectManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe" diff --git a/EgtBEAMWALL.Optimizer/MainWindow/MainWindowVM.vb b/EgtBEAMWALL.Optimizer/MainWindow/MainWindowVM.vb index 92a210af..ab61b043 100644 --- a/EgtBEAMWALL.Optimizer/MainWindow/MainWindowVM.vb +++ b/EgtBEAMWALL.Optimizer/MainWindow/MainWindowVM.vb @@ -269,7 +269,7 @@ Public Class MainWindowVM ' recupero secondo parametro Dim sProdId As String = Environment.GetCommandLineArgs(2) If Not Integer.TryParse(sProdId, nProdId) OrElse nProdId <= 0 Then Return False - nPage = Pages.MACHINING + nPage = Pages.OPTIMIZERPAGE Return True Case 2 ' apri pagina specifica senza progetto specifico ' recupero secondo parametro diff --git a/EgtBEAMWALL.Optimizer/My Project/AssemblyInfo.vb b/EgtBEAMWALL.Optimizer/My Project/AssemblyInfo.vb index d80e9ab8..0373d2d4 100644 --- a/EgtBEAMWALL.Optimizer/My Project/AssemblyInfo.vb +++ b/EgtBEAMWALL.Optimizer/My Project/AssemblyInfo.vb @@ -67,5 +67,5 @@ Imports System.Windows ' Revision ' - - + + diff --git a/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml b/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml index 34757f74..b2d862ee 100644 --- a/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml +++ b/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml @@ -85,8 +85,7 @@ diff --git a/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml.vb b/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml.vb index 9fcd8af8..e0c3959e 100644 --- a/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml.vb +++ b/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndV.xaml.vb @@ -14,4 +14,5 @@ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_PartParametersWndVM.m_CloseWindow Me.DialogResult = bDialogResult End Sub + End Class diff --git a/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndVM.vb b/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndVM.vb index 4e9ce09e..03f221fc 100644 --- a/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndVM.vb +++ b/EgtBEAMWALL.Optimizer/PartParametersWnd/PartParametersWndVM.vb @@ -8,6 +8,13 @@ Public Class PartParametersWndVM Friend Event m_CloseWindow(bDialogResult As Boolean) + Private m_CurrPart As BTLPartVM + Public ReadOnly Property CurrPart As BTLPartVM + Get + Return m_CurrPart + End Get + End Property + ' Definizione comandi Private m_cmdOk As ICommand @@ -271,8 +278,8 @@ Public Class PartParametersWndVM #Region "CONSTRUCTOR" - Sub New() - + Sub New(CurrPart As BTLPartVM) + m_CurrPart = CurrPart End Sub #End Region ' CONSTRUCTOR diff --git a/EgtBEAMWALL.Optimizer/ProdManager/ProdManagerVM.vb b/EgtBEAMWALL.Optimizer/ProdManager/ProdManagerVM.vb index 88692c99..d1f68a82 100644 --- a/EgtBEAMWALL.Optimizer/ProdManager/ProdManagerVM.vb +++ b/EgtBEAMWALL.Optimizer/ProdManager/ProdManagerVM.vb @@ -1327,7 +1327,7 @@ Public Class ProdManagerVM End Sub Public Sub OpenProjectFromSupervisor(ProjIdToOpen As Integer) - If Not IsNothing(ProjectManagerVM.CurrProd) Then + If (Not IsNothing(ProjectManagerVM.CurrProd) AndAlso ProjIdToOpen <> ProjectManagerVM.CurrProd.nProdId) OrElse Map.refMainMenuVM.SelPage <> Pages.OPTIMIZERPAGE Then m_nProjIdToOpen = ProjIdToOpen m_bOpenProj = True End If @@ -1365,7 +1365,9 @@ Public Class ProdManagerVM While nPartLayerId <> GDB_ID.NULL Dim nNewId As Integer = EgtCopyEx(Map.refSceneHostVM.MainScene.GetCtx(), nPartLayerId, Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx(), nRef) ' Salvo le info dei pezzi per associarli in modo corretto - Map.refSceneShowBuldingVM.MapInfo.Add(nPartLayerId, nNewId) + If nNewId > 0 AndAlso Not Map.refSceneShowBuldingVM.MapInfo.ContainsKey(nPartLayerId) Then + Map.refSceneShowBuldingVM.MapInfo.Add(nPartLayerId, nNewId) + End If nPartLayerId = EgtGetNextPart(nPartLayerId) End While @@ -1378,14 +1380,17 @@ Public Class ProdManagerVM While nIdF <> GDB_ID.NULL Dim Sou As Integer = 0 EgtGetInfo(nIdF, "!SOU", Sou) - EgtSetInfo(nIdF, "!SOU", Map.refSceneShowBuldingVM.MapInfo(Sou)) + If EgtGetInfo(nIdF, "!SOU", Sou) AndAlso Map.refSceneShowBuldingVM.MapInfo.ContainsKey(Sou) Then + EgtSetInfo(nIdF, "!SOU", Map.refSceneShowBuldingVM.MapInfo(Sou)) + End If nIdF = EgtGetNext(nIdF) End While Map.refProjectVM.BTLStructureVM.ShowBuilding(nListAsseBase(IdAsseBase), True) If IdAsseBase > 0 Then EgtSetStatus(nListAsseBase(IdAsseBase), GDB_ST.OFF) Dim nProj As Integer = 0 - EgtGetInfo(nListAsseBase(IdAsseBase), PROJ, nProj) - m_nListProjAsseBase.Add(nProj, nListAsseBase(IdAsseBase)) + If EgtGetInfo(nListAsseBase(IdAsseBase), PROJ, nProj) AndAlso Not m_nListProjAsseBase.ContainsKey(nProj) Then + m_nListProjAsseBase.Add(nProj, nListAsseBase(IdAsseBase)) + End If Next EgtZoom(ZM.ALL) diff --git a/EgtBEAMWALL.Optimizer/Project/ProjectVM.vb b/EgtBEAMWALL.Optimizer/Project/ProjectVM.vb index c79625d0..b280e9ac 100644 --- a/EgtBEAMWALL.Optimizer/Project/ProjectVM.vb +++ b/EgtBEAMWALL.Optimizer/Project/ProjectVM.vb @@ -497,8 +497,8 @@ Public Class ProjectVM ''' Funzione che permette di eliminare un pezzo modificato e reinserirlo nell'assemblato ''' Friend Sub UpdatePart(nPartId As Integer) - Dim IdAsseBase As Integer = Map.refProdManagerVM.ListProjAsseBase(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPROJ) - If IdAsseBase < 0 Then Return + Dim IdAsseBase As Integer = 0 + If Not Map.refProdManagerVM.ListProjAsseBase.TryGetValue(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPROJ, IdAsseBase) Then Return Dim IdPart As Integer = 0 Dim NewId As Integer = 0 ' Setto il nuovo contesto @@ -930,7 +930,7 @@ Public Class ProjectVM End Property Friend Sub Parameter() - Dim PartParametersWnd As New PartParametersWndV(Application.Current.MainWindow, New PartParametersWndVM()) + Dim PartParametersWnd As New PartParametersWndV(Application.Current.MainWindow, New PartParametersWndVM(m_BTLStructureVM.SelBTLPart)) PartParametersWnd.ShowDialog() End Sub diff --git a/EgtBEAMWALL.Optimizer/SupervisorCommThread/SupervisorComm.vb b/EgtBEAMWALL.Optimizer/SupervisorCommThread/SupervisorComm.vb index b104733d..92227211 100644 --- a/EgtBEAMWALL.Optimizer/SupervisorCommThread/SupervisorComm.vb +++ b/EgtBEAMWALL.Optimizer/SupervisorCommThread/SupervisorComm.vb @@ -33,10 +33,10 @@ Public Class SupervisorComm Select Case Message.ItemType Case StatusMapItemType.Comm Select Case Message.Operation - Case StatusMapOpType.OpenPageInViewOptimRequest - Map.refMainMenuVM.OpenPageFromSupervisor(Math.Abs(Message.ItemId)) Case StatusMapOpType.ChangeProdInOptimizerRequest Map.refProdManagerVM.OpenProjectFromSupervisor(Message.ItemId) + Case StatusMapOpType.OpenPageInViewOptimRequest + Map.refMainMenuVM.OpenPageFromSupervisor(Math.Abs(Message.ItemId)) End Select End Select Next diff --git a/EgtBEAMWALL.Optimizer/WarehouseWnd/WarehouseWndVM.vb b/EgtBEAMWALL.Optimizer/WarehouseWnd/WarehouseWndVM.vb index 1fe96900..2d9f4d4f 100644 --- a/EgtBEAMWALL.Optimizer/WarehouseWnd/WarehouseWndVM.vb +++ b/EgtBEAMWALL.Optimizer/WarehouseWnd/WarehouseWndVM.vb @@ -439,6 +439,13 @@ Public Class WarehouseWndVM ' Creo riferimento a questa classe in Map Map.SetRefWarehouseWndVM(Me) + ' Ricavo il tipo di Warehouse settato nell'INI + Dim nDefault As Integer = 2 + If GetMainPrivateProfileInt(S_WAREHOUSE, EgtBEAMWALL.Core.ConstIni.K_TYPE, nDefault) = WarehouseType.MEDIUM Then + ' Se di tipo Medium confronto le Sezioni del BTL importato con quelle in Warehouse + WarehouseWndVM.UpdateSectionXMaterial() + End If + ' setto il tipo in base alla macchina selezionata come macchina corrente Dim nMachType As MachineType = Map.refProjectVM.BTLStructureVM.nPROJTYPE SectionXMaterial.SetType(nMachType) diff --git a/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb b/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb index 3b760195..f9508fd1 100644 --- a/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb +++ b/EgtBEAMWALL.Supervisor/CALCPanel/CALCPanelVM.vb @@ -496,7 +496,8 @@ Public Class CALCPanelVM .nProjType = ProjType, .bBarOk = True, .nMachineName = MachineName, - .nCmdType = CalcIntegration.CmdTypes.SIMULATE} + .nCmdType = CalcIntegration.CmdTypes.SIMULATE, + .nBarState = SelMachGroup.nProduction_State} If SelMachGroup.nGlobalState = CalcStates.NOTCALCULATED Then Dim sMachGroupFilePath As String = Map.refSupervisorManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe" If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath) diff --git a/EgtBEAMWALL.Supervisor/Comms/SIEMENSSharp7Comm.vb b/EgtBEAMWALL.Supervisor/Comms/SIEMENSSharp7Comm.vb new file mode 100644 index 00000000..155bb877 --- /dev/null +++ b/EgtBEAMWALL.Supervisor/Comms/SIEMENSSharp7Comm.vb @@ -0,0 +1,521 @@ +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 + + Private m_RefreshTime As Integer = 10 + Private m_WaitingRefreshTime As Integer = 20 + Private m_RefreshCounter As Integer = 0 + Private m_IsRefreshing As Boolean = False + + 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 + + Friend Sub RefreshConnection() + If m_RefreshCounter < m_RefreshTime Then + m_RefreshCounter += 1 + Else + ' riavvio connessione + m_IsRefreshing = True + CloseConnection() + InitConnection() + m_IsRefreshing = False + m_RefreshCounter = 0 + End If + End Sub + + Private Function WaitingRefresh() As Boolean + If Not m_IsRefreshing Then Return True + Dim WaitingCounter As Integer = 0 + While m_IsRefreshing < m_WaitingRefreshTime + If Not m_IsRefreshing Then Return True + Threading.Thread.Sleep(100) + End While + EgtOutLog("Waiting reconnection timeout!") + Return False + End Function + +#Region "Read Variables" + + Public Sub RefreshAllVars() + WaitingRefresh() + 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 = 46 + 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 + WaitingRefresh() + 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 + Case 4 + Dim dValue As Single = 0 + If Not StringToDoubleAdv(Value, dValue) Then Return False + If Map.refMachManaging.Debug > 1 Then + EgtOutLog("Scrittura variabile " & Address & " (Tipo 4) con valore " & Value) + End If + Dim bResult As Boolean = WriteReal(nDBAddress, nStartIndex, dValue) + 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 + WaitingRefresh() + ' 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 + WaitingRefresh() + 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 + WaitingRefresh() + ' 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 + WaitingRefresh() + + 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 + WaitingRefresh() + ' 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 + WaitingRefresh() + 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 + WaitingRefresh() + ' 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 + WaitingRefresh() + 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 + WaitingRefresh() + ' 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 + WaitingRefresh() + + 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 Function ResetStep(bReset As Boolean) As Boolean + WaitingRefresh() + Dim varResetStep 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") + varResetStep.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) + Dim ResetMachine As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RESET_STATE) + While nResetStepOk <> 1 + If ResetMachine.sValue = "1" Then + Return False + End If + 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 + varResetStep.sValue = 0 + Map.refMachManaging.DebugMessage(1, "Imposto variabile ResetStep a 0") + Return True + End Function + + Friend Sub ReadPLCMessages() + WaitingRefresh() + + 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 diff --git a/EgtBEAMWALL.Supervisor/Constants/ConstCommVar.vb b/EgtBEAMWALL.Supervisor/Constants/ConstCommVar.vb index 0b184020..da04958f 100644 --- a/EgtBEAMWALL.Supervisor/Constants/ConstCommVar.vb +++ b/EgtBEAMWALL.Supervisor/Constants/ConstCommVar.vb @@ -19,6 +19,7 @@ Module ConstCommVar NUM_FLEXIUM = 2 NUM_AXIUM_APSERVER = 3 NUM_AXIUM_PCTOOLKIT = 4 + SIEMENS_SHARP7 = 5 End Enum ' Assi @@ -54,6 +55,42 @@ 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" + ' variabile per larghezza barra al carico + Public Const W_CARICO As String = "W_Carico" + ' variabile per lunghezza prossima barra + Public Const NEXTPART_L As String = "NextPartL" + ' variabile per larghezza prossima barra + Public Const NEXTPART_W As String = "NextPartW" + ' variabile per altezza prossima barra + Public Const NEXTPART_H As String = "NextPartH" + ' variabile per PressX1 prossima barra + Public Const NEXTPART_PRESSX1 As String = "NextPartPressX1" + ' variabile per Feed prossima barra + Public Const NEXTPART_FEED As String = "NextPartFeed" + ' variabile per Accelerazione prossima barra + Public Const NEXTPART_ACC As String = "NextPartAcc" + ' variabile per Ref1 prossima barra + Public Const NEXTPART_REF1 As String = "NextPartRef1" + ' variabile per Ref2 prossima barra + Public Const NEXTPART_REF2 As String = "NextPartRef2" + ' variabile per Ref2 prossima barra + Public Const STOP_WORKING As String = "Stop_Working" Public Enum OPStates Start = 1 @@ -72,4 +109,11 @@ 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 diff --git a/EgtBEAMWALL.Supervisor/EgtBEAMWALL.Supervisor.vbproj b/EgtBEAMWALL.Supervisor/EgtBEAMWALL.Supervisor.vbproj index edf5bbdf..73955118 100644 --- a/EgtBEAMWALL.Supervisor/EgtBEAMWALL.Supervisor.vbproj +++ b/EgtBEAMWALL.Supervisor/EgtBEAMWALL.Supervisor.vbproj @@ -117,7 +117,8 @@ ..\ExtLibs\Interop.FXServer.dll True - + + False ..\ExtLibs\ISOCNC.Remoting.dll @@ -167,6 +168,9 @@ ..\packages\Zebra.Printer.SDK.2.15.2634\lib\net471\SdkApi.Desktop.Usb.dll + + ..\ExtLibs\Sharp7.net.dll + ..\packages\Lextm.SharpSnmpLib.10.0.9\lib\net452\SharpSnmpLib.dll @@ -280,6 +284,7 @@ + ConfigurationPageV.xaml diff --git a/EgtBEAMWALL.Supervisor/LeftPanel/LeftPanelVM.vb b/EgtBEAMWALL.Supervisor/LeftPanel/LeftPanelVM.vb index 6a87f28f..65fdd880 100644 --- a/EgtBEAMWALL.Supervisor/LeftPanel/LeftPanelVM.vb +++ b/EgtBEAMWALL.Supervisor/LeftPanel/LeftPanelVM.vb @@ -147,6 +147,17 @@ 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 @@ -268,7 +279,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, 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 Or CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7, Visibility.Visible, Visibility.Collapsed) End Get End Property @@ -428,7 +439,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 + Case NCTypes.NUM_FLEXIUM, NCTypes.NUM_AXIUM_APSERVER, NCTypes.NUM_AXIUM_PCTOOLKIT, NCTypes.SIEMENS_SHARP7 m_OPStateList = New List(Of OPState) From {New OPState("Start", OPStates.Start), New OPState("Stop", OPStates.Stop), New OPState("Reset", OPStates.End), @@ -454,6 +465,13 @@ Public Class LeftPanelVM New OPState("Manual", OPModes.Manual), New OPState("Home", OPModes.Home) } + Case 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 diff --git a/EgtBEAMWALL.Supervisor/MachCommandMessagePanel/MachCommandMessagePanelV.xaml b/EgtBEAMWALL.Supervisor/MachCommandMessagePanel/MachCommandMessagePanelV.xaml index c54ccd56..46e3c1e0 100644 --- a/EgtBEAMWALL.Supervisor/MachCommandMessagePanel/MachCommandMessagePanelV.xaml +++ b/EgtBEAMWALL.Supervisor/MachCommandMessagePanel/MachCommandMessagePanelV.xaml @@ -20,10 +20,12 @@ Style="{StaticResource MachCommandMessagePanel_Button}"/>