- 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
' 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
@@ -1,4 +1,5 @@
Imports System.Data.Entity.ModelConfiguration.Configuration.Properties
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
@@ -143,9 +144,33 @@ Public Class RawPartManagerVM
Map.refCALCPanelVM.Verify()
Return
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
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
Private Function Produce(MachGroup As MyMachGroupVM, ByRef ErrorMsg As String) As Boolean
@@ -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
' 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