- riportato modifiche precedenti perse durante il merge

This commit is contained in:
Emmanuele Sassi
2025-04-02 15:50:44 +02:00
parent 6188c67845
commit 9aa89adf29
2 changed files with 76 additions and 7 deletions
@@ -192,7 +192,13 @@ Public Class MyMachGroupPanelM
While nOutlineId <> GDB_ID.NULL While nOutlineId <> GDB_ID.NULL
' verifico che sia feature ' verifico che sia feature
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then 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) nOutlineId = EgtGetNext(nOutlineId)
Continue While Continue While
Else Else
@@ -231,7 +237,14 @@ Public Class MyMachGroupPanelM
Dim nPRC As Integer Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0 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) EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
nPRId = nGlobPRId nPRId = nGlobPRId
nGlobPRId += 1 nGlobPRId += 1
@@ -1,4 +1,5 @@
Imports System.Data.Entity.ModelConfiguration.Configuration.Properties Imports System.Data.Entity.ModelConfiguration.Configuration.Properties
Imports System.IO
Imports EgtBEAMWALL.Core Imports EgtBEAMWALL.Core
Imports EgtUILib Imports EgtUILib
Imports EgtWPFLib5 Imports EgtWPFLib5
@@ -143,9 +144,33 @@ Public Class RawPartManagerVM
Map.refCALCPanelVM.Verify() Map.refCALCPanelVM.Verify()
Return Return
End If End If
' 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 If Not Produce(Map.refMachGroupPanelVM.SelectedMachGroup, ErrorMsg) AndAlso Not String.IsNullOrWhiteSpace(ErrorMsg) Then
MessageBox.Show(ErrorMsg) MessageBox.Show(ErrorMsg)
End If 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 End Sub
Private Function Produce(MachGroup As MyMachGroupVM, ByRef ErrorMsg As String) As Boolean Private Function Produce(MachGroup As MyMachGroupVM, ByRef ErrorMsg As String) As Boolean
@@ -210,12 +235,43 @@ Public Class RawPartManagerVM
End If End If
If Map.refMachGroupPanelVM.MachGroupVMList.Count > 0 Then If Map.refMachGroupPanelVM.MachGroupVMList.Count > 0 Then
Dim MachgroupErrorList As New List(Of MachGroupVM) Dim MachgroupErrorList As New List(Of MachGroupVM)
Dim sErrorMessage As String = ""
Dim bErrorMessage As Boolean = False
For Each Machgroup In Map.refMachGroupPanelVM.MachGroupVMList For Each Machgroup In Map.refMachGroupPanelVM.MachGroupVMList
' verifico se modalita' supervisore attiva
If GetPrivateProfileInt(S_GENERAL, K_SUPERVISOR, 1, CurrentMachine.sMachIniFile) = 1 Then
Dim ErrorMsg As String = "" Dim ErrorMsg As String = ""
If Not Produce(Machgroup, ErrorMsg) AndAlso Not String.IsNullOrWhiteSpace(ErrorMsg) Then If Not Produce(Machgroup, ErrorMsg) AndAlso Not String.IsNullOrWhiteSpace(ErrorMsg) Then
MachgroupErrorList.Add(Machgroup) MachgroupErrorList.Add(Machgroup)
End If 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 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 If MachgroupErrorList.Count > 0 Then
Dim sMachGroups As String = "" Dim sMachGroups As String = ""
For Each MachGroup In MachgroupErrorList For Each MachGroup In MachgroupErrorList