From 9aa89adf292455d926561c4d1852e245a436983e Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Wed, 2 Apr 2025 15:50:44 +0200 Subject: [PATCH] - riportato modifiche precedenti perse durante il merge --- .../MachGroupModel/MyMachGroupPanelM.vb | 17 ++++- .../RawPartManager/RawPartManagerVM.vb | 66 +++++++++++++++++-- 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/EgtBEAMWALL.Core/MachGroupModel/MyMachGroupPanelM.vb b/EgtBEAMWALL.Core/MachGroupModel/MyMachGroupPanelM.vb index 3ac7cdc9..577ec7df 100644 --- a/EgtBEAMWALL.Core/MachGroupModel/MyMachGroupPanelM.vb +++ b/EgtBEAMWALL.Core/MachGroupModel/MyMachGroupPanelM.vb @@ -192,7 +192,13 @@ Public Class MyMachGroupPanelM While nOutlineId <> GDB_ID.NULL ' verifico che sia feature If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then - If EgtExistsInfo(nOutlineId, MGR_FTR_PRID) 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 nOutlineId = EgtGetNext(nOutlineId) Continue While Else @@ -231,7 +237,14 @@ Public Class MyMachGroupPanelM Dim nPRC As Integer If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then nPRId = 0 - If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then + If EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then + If nPRId < nGlobPRId Then + EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId) + nPRId = nGlobPRId + nGlobPRId += 1 + End If + nGlobPRId = Math.Max(nGlobPRId - 1, nPRId) + 1 + Else EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId) nPRId = nGlobPRId nGlobPRId += 1 diff --git a/EgtBEAMWALL.ViewerOptimizer/RawPartManager/RawPartManagerVM.vb b/EgtBEAMWALL.ViewerOptimizer/RawPartManager/RawPartManagerVM.vb index 5cd94250..389fab21 100644 --- a/EgtBEAMWALL.ViewerOptimizer/RawPartManager/RawPartManagerVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/RawPartManager/RawPartManagerVM.vb @@ -1,4 +1,5 @@ Imports System.Data.Entity.ModelConfiguration.Configuration.Properties +Imports System.IO Imports EgtBEAMWALL.Core Imports EgtUILib Imports EgtWPFLib5 @@ -143,8 +144,32 @@ Public Class RawPartManagerVM Map.refCALCPanelVM.Verify() Return End If - If Not Produce(Map.refMachGroupPanelVM.SelectedMachGroup, ErrorMsg) AndAlso Not String.IsNullOrWhiteSpace(ErrorMsg) Then - MessageBox.Show(ErrorMsg) + ' verifico se modalita' supervisore attiva + If GetPrivateProfileInt(S_GENERAL, K_SUPERVISOR, 1, CurrentMachine.sMachIniFile) = 1 Then + If Not Produce(Map.refMachGroupPanelVM.SelectedMachGroup, ErrorMsg) AndAlso Not String.IsNullOrWhiteSpace(ErrorMsg) Then + MessageBox.Show(ErrorMsg) + End If + Else + ' altrimenti lo copio se path disponibile + If Map.refMachGroupPanelVM.SelectedMachGroup.nGlobalState = CalcStates.OK Or Map.refMachGroupPanelVM.SelectedMachGroup.nGlobalState = CalcStates.INFO Then + Dim sSaveCncPath As String = "" + GetPrivateProfileString(S_GENERAL, K_SAVECNCPATH, "", sSaveCncPath, CurrentMachine.sMachIniFile) + Dim sSaveExt As String = "" + GetPrivateProfileString(S_GENERAL, K_SAVEEXT, "", sSaveExt, CurrentMachine.sMachIniFile) + If String.IsNullOrWhiteSpace(sSaveExt) Then + sSaveExt = ".cnc" + ElseIf sSaveExt(0) <> "." Then + sSaveExt = "." & sSaveExt + End If + Try + Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & Map.refMachGroupPanelVM.SelectedMachGroup.Name.ToString() & ".cnc" + Dim sNewPath As String = sSaveCncPath & "\" & Map.refProdManagerVM.CurrProd.sProdId & "-" & Map.refMachGroupPanelVM.SelectedMachGroup.Name.ToString() & sSaveExt + File.Copy(sMachGroupFilePath, sNewPath, True) + MessageBox.Show(String.Format("File copied! You can find it at {0}", {sNewPath}), "Info", MessageBoxButton.OK, MessageBoxImage.Information) + Catch ex As Exception + MessageBox.Show(String.Format("Copy to {0} folder failed!", {sSaveCncPath}), "Error", MessageBoxButton.OK, MessageBoxImage.Error) + End Try + End If End If End Sub @@ -210,12 +235,43 @@ Public Class RawPartManagerVM End If If Map.refMachGroupPanelVM.MachGroupVMList.Count > 0 Then Dim MachgroupErrorList As New List(Of MachGroupVM) + Dim sErrorMessage As String = "" + Dim bErrorMessage As Boolean = False For Each Machgroup In Map.refMachGroupPanelVM.MachGroupVMList - Dim ErrorMsg As String = "" - If Not Produce(Machgroup, ErrorMsg) AndAlso Not String.IsNullOrWhiteSpace(ErrorMsg) Then - MachgroupErrorList.Add(Machgroup) + ' verifico se modalita' supervisore attiva + If GetPrivateProfileInt(S_GENERAL, K_SUPERVISOR, 1, CurrentMachine.sMachIniFile) = 1 Then + Dim ErrorMsg As String = "" + If Not Produce(Machgroup, ErrorMsg) AndAlso Not String.IsNullOrWhiteSpace(ErrorMsg) Then + MachgroupErrorList.Add(Machgroup) + End If + Else + ' altrimenti lo copio se path disponibile + If Map.refMachGroupPanelVM.SelectedMachGroup.nGlobalState = CalcStates.OK Or Map.refMachGroupPanelVM.SelectedMachGroup.nGlobalState = CalcStates.INFO Then + Dim sSaveCncPath As String = "" + GetPrivateProfileString(S_GENERAL, K_SAVECNCPATH, "", sSaveCncPath, CurrentMachine.sMachIniFile) + Dim sSaveExt As String = "" + GetPrivateProfileString(S_GENERAL, K_SAVEEXT, "", sSaveExt, CurrentMachine.sMachIniFile) + If String.IsNullOrWhiteSpace(sSaveExt) Then + sSaveExt = ".cnc" + ElseIf sSaveExt(0) <> "." Then + sSaveExt = "." & sSaveExt + End If + If String.IsNullOrWhiteSpace(sSaveCncPath) OrElse Not Directory.Exists(sSaveCncPath) Then Return + Try + Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & Machgroup.Name.ToString() & ".cnc" + Dim sNewPath As String = sSaveCncPath & "\" & Map.refProdManagerVM.CurrProd.sProdId & "-" & Machgroup.Name.ToString() & sSaveExt + File.Copy(sMachGroupFilePath, sNewPath, True) + sErrorMessage &= String.Format("File copied! You can find it at {0}", {sNewPath}) & Environment.NewLine + Catch ex As Exception + sErrorMessage &= String.Format("Copy to {0} folder failed!", {sSaveCncPath}) & Environment.NewLine + End Try + End If End If Next + If Not String.IsNullOrWhiteSpace(sErrorMessage) Then + sErrorMessage = "Results for all the parts generated:" & Environment.NewLine & sErrorMessage + MessageBox.Show(sErrorMessage, If(bErrorMessage, "Error", "Info"), MessageBoxButton.OK, MessageBoxImage.Information) + End If If MachgroupErrorList.Count > 0 Then Dim sMachGroups As String = "" For Each MachGroup In MachgroupErrorList