- correzione su creazione Id delle lavorazioni

- gestione sezione ruotata
- corretto visibilita' colonna materiale
- migliorata gestione materiale nullo
- migliorata conversione file warehouse su Db
This commit is contained in:
Emmanuele Sassi
2024-07-02 10:55:48 +02:00
parent 43b89de822
commit cfabbc6eff
18 changed files with 228 additions and 150 deletions
@@ -215,20 +215,46 @@ Public Class MyMachGroupPanelM
If nBWType = BWType.WALL Then
' salvo parametri Q
QArray(Duploindex) = New Dictionary(Of String, Dictionary(Of String, String))
' ciclo sulle feature
Dim nGlobPRId As Integer = 1
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
If nPRId > nGlobPRId Then nGlobPRId = nPRId
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
' ciclo sugli outline
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nGlobPRId As Integer = 1
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) OrElse nPRId < nGlobPRId Then
nGlobPRId += 1
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
nPRId = nGlobPRId
nGlobPRId += 1
Else
If nPRId > nGlobPRId Then nGlobPRId = nPRId
End If
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
@@ -243,29 +269,6 @@ Public Class MyMachGroupPanelM
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
' ciclo sulle feature
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
If nFeatureLayer <> GDB_ID.NULL Then
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
While nFeatureId <> GDB_ID.NULL
' verifico che sia feature
Dim nPRC As Integer
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
nPRId = 0
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
Dim sKey As String = nPRId & "." & nPRC
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
For QIndex = 1 To 10
Dim QKey As String = "Q" & QIndex.ToString("D2")
Dim QValue As Integer = 0
If EgtGetInfo(nFeatureId, QKey, QValue) Then
QArray(Duploindex)(sKey).Add(QKey, QValue)
End If
Next
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End If
End If
Next
' aggiornamento dei Duplo
+3
View File
@@ -20,6 +20,9 @@ Public Class MaterialM
Return m_sMaterial
End Get
End Property
Public Sub SetMaterial(sMaterial As String)
m_sMaterial = sMaterial
End Sub
Protected m_sWarehouseMaterial As String
Public ReadOnly Property sWarehouseMaterial As String
@@ -151,7 +151,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
var item2update = localDbCtx
.AliasList
.Where(x => x.Family == updItem.Family && x.ValueOriginal == updItem.ValueOriginal)
.Where(x => x.Family == updItem.Family && x.ValueOriginal.Equals(updItem.ValueOriginal, StringComparison.InvariantCulture))
.SingleOrDefault();
if (item2update != null)
@@ -1001,7 +1001,7 @@ Public Class BTLStructureVM
For Each BTLPartVM As BTLPartVM In m_BTLPartVMList
' verifico sezione, gruppo e sottogruppo per inserirli nei filtri
If Not SectionList.Contains(BTLPartVM.Section) Then
Dim NewSection = BTLPartVM.Section
Dim NewSection As SectionXMaterial = New SectionXMaterial(BTLPartVM.MaterialM)
Map.refProjectVM.BTLStructureVM.SectionList.Add(NewSection)
End If
If Not GroupList.Contains(BTLPartVM.sGROUP) Then
@@ -1394,7 +1394,7 @@ Public Class BTLStructureVM
Select Case SearchRes.Tipo
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dW = Part.dW AndAlso x.dH = Part.dH)
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dW = Math.Min(Part.dW, Part.dH) AndAlso x.dH = Math.Max(Part.dW, Part.dH))
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = SearchRes.Result.FirstOrDefault(Function(x) x.dH = Part.dH)
End If
@@ -235,7 +235,7 @@ Public Class CALCPanelVM
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
Map.refProjManagerVM.Save()
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
Map.refProdManagerVM.Save()
Map.refProdManagerVM.Save(False)
End If
End If
' se modalita' assemblato attiva
@@ -146,7 +146,7 @@ Public Class BTLPartListVM
m_PartList_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(PartList_IsEnabled))
End Sub
Friend Sub UpdateMaterialColumns()
' mostro colonna materiali
Dim ColumnToCollapse As EgtDataGridColumn
@@ -155,7 +155,7 @@ Public Class BTLPartListVM
Else
ColumnToCollapse = PartColumns.FirstOrDefault(Function(x) x.Name = COL_WAREHOUSEMATERIAL)
End If
ColumnToCollapse.ColumnVisibility = Visibility.Collapsed
ColumnToCollapse.Visible = False
End Sub
End Class
@@ -279,11 +279,19 @@ Public Class MyMachGroupPanelVM
Next
Else
Dim Material As MaterialM = Nothing
' verifico che il materiale non sia nullo
If (String.IsNullOrWhiteSpace(MachGroup.RawPartM.Material.sMaterial) OrElse String.IsNullOrWhiteSpace(MachGroup.RawPartM.Material.sWarehouseMaterial)) AndAlso MachGroup.PartVMList.Count > 0 Then
MachGroup.MyMachGroupM.sMATERIAL = MachGroup.PartVMList(0).sMATERIAL
MachGroup.RawPartM.Material.SetMaterial(MachGroup.PartVMList(0).sMATERIAL)
MachGroup.RawPartM.Material.SetWarehouseMaterial(MachGroup.PartVMList(0).sWAREHOUSEMATERIAL)
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.sMATERIAL))
MachGroup.NotifyPropertyChanged(NameOf(MachGroup.sWAREHOUSEMATERIAL))
End If
Dim SearchMaterial As DataLayer.Controllers.MaterialsController.SearchResult = DbControllers.m_MaterialsController.SearchFilt(MachGroup.RawPartM.Material.sMaterial)
Select Case SearchMaterial.Tipo
Case DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.ALIAS, DataLayer.Controllers.MaterialsController.SearchResult.TypeFound.MATERIAL
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Material = SearchMaterial.Result.FirstOrDefault(Function(x) Math.Abs(x.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.dH - MachGroup.dH) < m_DimensionRange)
Material = SearchMaterial.Result.FirstOrDefault(Function(x) Math.Abs(x.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Material = SearchMaterial.Result.FirstOrDefault(Function(x) Math.Abs(x.dH - MachGroup.dH) < m_DimensionRange)
End If
@@ -297,7 +305,7 @@ Public Class MyMachGroupPanelVM
End Select
Dim SearchRawPart As List(Of RawPartM) = DbControllers.m_RawItemsController.GetFilt(Material.nId)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
End If
@@ -314,7 +322,7 @@ Public Class MyMachGroupPanelVM
If nRawPartId > 0 Then
SearchRawPart = DbControllers.m_RawItemsController.GetFilt(Material.nId)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.Material.dW - Math.Min(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - Math.Max(MachGroup.dW, MachGroup.dH)) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
RawPart = SearchRawPart.FirstOrDefault(Function(x) Math.Abs(x.dW - MachGroup.dW) < m_DimensionRange AndAlso Math.Abs(x.Material.dH - MachGroup.dH) < m_DimensionRange AndAlso Math.Abs(x.dL - MachGroup.dL) < m_DimensionRange)
End If
@@ -237,9 +237,9 @@ Public Class PartVM
MyBase.New(PartM, ParentMachGroupVM)
' aggiungo MaterialM
If Map.refProjectVM.BTLStructureVM.BTLStructureM.nPROJTYPE = BWType.BEAM Then
PartM.MaterialM = New MaterialM(Math.Min(dW, dH), Math.Max(dW, dH), 0, PartM.sMATERIAL)
PartM.MaterialM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = PartM.nBTLPartId).MaterialM
Else
PartM.MaterialM = New MaterialM(0, dH, 0, PartM.sMATERIAL)
PartM.MaterialM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = PartM.nBTLPartId).MaterialM
End If
' aggiorno stato calcolo
CalcGlobalUpdate()
@@ -139,6 +139,8 @@ Public Class MainWindowVM
'Map.refStatusBarVM.SetMeasureUnit(If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH))
' imposto MainWindow per finestra di Loading
LoadingWndHelper.SetMainWindow(Application.Current.MainWindow)
' verifico se convertire file magazzino su Db
ReadWarehouseFile()
' leggo riga di comando
Dim nCommandType As Integer = 0
Dim nPage As Pages = Pages.VIEW
@@ -174,92 +176,6 @@ Public Class MainWindowVM
' avvio thread di gestione della macchina che avvia la connessione
m_SupervisorCommThread.Start()
' verifico se devo copiare file warehouse in Db
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If File.Exists(sWarehousePath) Then
Dim bOk As Boolean = False
' leggo materiali da file
Dim MaterialList As New List(Of IdMaterial)
Dim SectXMatList As New List(Of SectionXMaterial)
Dim nSectXMatIndex As Integer = 1
Dim sSxMValue As String = ""
While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dW As Double = 0
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
Dim NewMaterial As New MaterialM(dW, dH, 0, sSectXMatValues(2), "")
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
Dim ParamIndex As Integer = 1
Dim sValue As String = String.Empty
' leggo grezzi da file
While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 2 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
' creo parametro
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dL)
If sParamValues.Count >= 3 Then Integer.TryParse(sParamValues(2), nQty)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, 0, dL, nQty, nActive > 0))
End If
ParamIndex += 1
End While
' ricavo SectionXMaterial tramite Wall_List
MaterialList.Clear()
nSectXMatIndex = 1
sSxMValue = ""
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dH)
Dim NewMaterial As New MaterialM(0, dH, 0, sSectXMatValues(1), "")
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
ParamIndex = 1
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 3 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
' creo parametro
Dim dW As Double = 0
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dW)
StringToLenAdv(sParamValues(2), dL)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nQty)
If sParamValues.Count >= 5 Then Integer.TryParse(sParamValues(4), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, dW, dL, nQty, nActive > 0))
End If
ParamIndex += 1
End While
'If bOk Then
' File.Move(sWarehousePath, Path.ChangeExtension(sWarehousePath, ".old.ini"))
'End If
End If
' se magazzino di rete attivo
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 Then
' forzo aggiornamento eventuali dati non inviati su Db
@@ -366,6 +282,133 @@ Public Class MainWindowVM
End Select
End Sub
' funzione che legge il magazzino formato file e lo converte su DB
Private Sub ReadWarehouseFile()
' verifico se devo copiare file warehouse in Db
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If File.Exists(sWarehousePath) Then
Dim bOk As Boolean = False
' leggo materiali da file
Dim MaterialList As New List(Of IdMaterial)
Dim SectXMatList As New List(Of SectionXMaterial)
Dim nSectXMatIndex As Integer = 1
Dim sSxMValue As String = ""
While EgtUILib.GetPrivateProfileString(S_BEAM_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dW As Double = 0
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dW)
StringToLenAdv(sSectXMatValues(1), dH)
Dim NewMaterial As MaterialM = Nothing
If Not String.IsNullOrWhiteSpace(sSectXMatValues(2)) Then
NewMaterial = New MaterialM(dW, dH, 0, "", sSectXMatValues(2))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
End If
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
Dim ParamIndex As Integer = 1
Dim sValue As String = String.Empty
' leggo grezzi da file
While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 2 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
If Not IsNothing(RawPartIdMaterial.Material) Then
' creo parametro
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dL)
If sParamValues.Count >= 3 Then Integer.TryParse(sParamValues(2), nQty)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, 0, dL, nQty, nActive > 0))
End If
End If
ParamIndex += 1
End While
Dim dStartOffset As Double = EgtUILib.GetPrivateProfileDouble(S_BEAM, K_STARTOFFSET, 0, sWarehousePath)
Dim dOffset As Double = EgtUILib.GetPrivateProfileDouble(S_BEAM, K_OFFSET, 0, sWarehousePath)
For Each Machine In Map.refMachinePanelVM.MachineList
If Directory.Exists(Machine.DirPath & "\Beam") Then
GenInterface.WritePrivateProfileString(WRH_BEAM, WRH_STARTOFFSET, DoubleToString(dStartOffset, 9), Machine.DirPath & "\Beam\NestingData.ini")
GenInterface.WritePrivateProfileString(WRH_BEAM, WRH_OFFSET, DoubleToString(dOffset, 9), Machine.DirPath & "\Beam\NestingData.ini")
End If
Next
' ricavo SectionXMaterial tramite Wall_List
MaterialList.Clear()
nSectXMatIndex = 1
sSxMValue = ""
While EgtUILib.GetPrivateProfileString(S_WALL_LIST, nSectXMatIndex, String.Empty, sSxMValue, sWarehousePath)
Dim sSectXMatValues() As String = sSxMValue.Split(","c)
' creo parametro
Dim dH As Double = 0
StringToLenAdv(sSectXMatValues(0), dH)
Dim NewMaterial As MaterialM = Nothing
If Not String.IsNullOrWhiteSpace(sSectXMatValues(1)) Then
NewMaterial = New MaterialM(0, dH, 0, "", sSectXMatValues(1))
NewMaterial.SetId(DbControllers.m_MaterialsController.Insert(NewMaterial))
End If
MaterialList.Add(New IdMaterial(nSectXMatIndex, NewMaterial))
nSectXMatIndex += 1
End While
ParamIndex = 1
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 3 Then
' cancello spazi
For Index = 0 To sParamValues.Count - 1
sParamValues(Index) = sParamValues(Index).Trim()
Next
Dim RawPartIdMaterial As IdMaterial = MaterialList.FirstOrDefault(Function(x) x.nIndex = sParamValues(0))
If Not IsNothing(RawPartIdMaterial.Material) Then
' creo parametro
Dim dW As Double = 0
Dim dL As Double = 0
Dim nQty As Integer = 0
Dim nActive As Integer = 1
StringToLenAdv(sParamValues(1), dW)
StringToLenAdv(sParamValues(2), dL)
If sParamValues.Count >= 4 Then Integer.TryParse(sParamValues(3), nQty)
If sParamValues.Count >= 5 Then Integer.TryParse(sParamValues(4), nActive)
DbControllers.m_RawItemsController.Upsert(New RawPartM(RawPartIdMaterial.Material, dW, dL, nQty, nActive > 0))
End If
End If
ParamIndex += 1
End While
Dim dKerf As Double = EgtUILib.GetPrivateProfileDouble(S_WALL, K_KERF, 0, sWarehousePath)
dOffset = EgtUILib.GetPrivateProfileDouble(S_WALL, K_OFFSET, 0, sWarehousePath)
For Each Machine In Map.refMachinePanelVM.MachineList
If Directory.Exists(Machine.DirPath & "\Wall") Then
GenInterface.WritePrivateProfileString(WRH_WALL, WRH_KERF, DoubleToString(dKerf, 9), Machine.DirPath & "\Wall\NestingData.ini")
GenInterface.WritePrivateProfileString(WRH_WALL, WRH_OFFSET, DoubleToString(dOffset, 9), Machine.DirPath & "\Wall\NestingData.ini")
Dim nRangeIndex = 0
Dim sRange As String = ""
While EgtUILib.GetPrivateProfileString(S_WALL, K_RANGE & nRangeIndex + 1, String.Empty, sRange, sWarehousePath)
WritePrivateProfileString(S_WALL, K_RANGE & nRangeIndex + 1, sRange, Machine.DirPath & "\Wall\NestingData.ini")
nRangeIndex += 1
End While
End If
Next
Dim sOldWarehousePath As String = Path.ChangeExtension(sWarehousePath, ".oldbck.ini")
Try
If File.Exists(sOldWarehousePath) Then
File.Delete(sOldWarehousePath)
End If
File.Move(sWarehousePath, Path.ChangeExtension(sWarehousePath, ".oldbck.ini"))
Catch ex As Exception
EgtOutLog("Error! Impossible moving old file Warehouse!")
End Try
End If
End Sub
Friend m_ManagingSupervisorStop As Boolean = False
Private Sub SupervisorTimer_Tick()
@@ -34,12 +34,14 @@
ItemsSource="{Binding DataContext.WarehouseMaterialList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MaterialNameManagerV}}}"
SelectedItem="{Binding sSelWarehouseMaterial}"
Visibility="{Binding IsChecked, ElementName=NewNameCheck, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Inverted}"
ToolTip="{Binding DataContext.WarehouseMaterialList_Tooltip, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MaterialNameManagerV}}}"
Margin="0,0,2.5,0"/>
<TextBox Grid.Column="1"
Text="{Binding sNewName}"
Visibility="{Binding IsChecked, ElementName=NewNameCheck, Converter={StaticResource BooleanToVisibilityConverter}}"
Margin="2.5,0,2.5,0"/>
<CheckBox x:Name="NewNameCheck"
ToolTip="{Binding DataContext.NewName_Tooltip, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MaterialNameManagerV}}}"
Grid.Column="2"
IsChecked="{Binding bNewName_IsChecked}"
Margin="2.5,0,0,0"/>
@@ -37,6 +37,18 @@ Public Class MaterialNameManagerVM
End Get
End Property
Public ReadOnly Property WarehouseMaterialList_Tooltip As String
Get
Return EgtMsg(61784)
End Get
End Property
Public ReadOnly Property NewName_Tooltip As String
Get
Return EgtMsg(61785)
End Get
End Property
Public ReadOnly Property Ok_Msg As String
Get
Return EgtMsg(61761)
@@ -81,8 +93,12 @@ Public Class MaterialNameManagerVM
Next
If m_NewMaterialList.Count > 0 Then
' recupero la lista dei materiali presenti in Warehouse
Dim WhSectXMatList As List(Of SectionXMaterial) = WarehouseWndVM.GetSectionXMaterialsFromWarehouse()
m_WarehouseMaterialList = WhSectXMatList.Select(Function(x) x.MaterialM.sWarehouseMaterial).Distinct().ToList()
'Dim WhSectXMatList As List(Of SectionXMaterial) = WarehouseWndVM.GetSectionXMaterialsFromWarehouse()
'm_WarehouseMaterialList = WhSectXMatList.Select(Function(x) x.MaterialM.sWarehouseMaterial).Distinct().ToList()
Dim AliasList = DbControllers.m_AliasController.GetFilt("MatCode")
m_WarehouseMaterialList = (From MatAlias In AliasList
Where MatAlias.ValueOriginal = MatAlias.ValueAlias
Select MatAlias.ValueOriginal).ToList()
Return True
Else Return False
End If
@@ -131,7 +147,10 @@ Public Class MaterialNameManagerVM
For Each Part In EmptyMatPartList
EgtSetInfo(Part.BTLPartM.nPartId, BTL_PRT_MATERIAL, sMaterialName)
Part.BTLPartM.sMATERIAL = sMaterialName
Part.BTLPartM.MaterialM.SetMaterial(sMaterialName)
Part.BTLPartM.MaterialM.SetWarehouseMaterial(sMaterialName)
Part.NotifyPropertyChanged(NameOf(Part.sMATERIAL))
Part.NotifyPropertyChanged(NameOf(Part.sWAREHOUSEMATERIAL))
Next
' se nuovo materiale
If Material.bNewName_IsChecked Then
@@ -293,7 +293,7 @@ Public Class NestingRunningWndVM
For Each SectionProgress In m_SectionProgressList
'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 = SectionProgress.Section AndAlso x.bDO AndAlso x.nCNT + x.nADDED > x.nINPROD AndAlso
Where x.MaterialM = SectionProgress.Section.MaterialM AndAlso x.bDO AndAlso x.nCNT + x.nADDED > x.nINPROD AndAlso
(m_SelPartType = OptimizePanelVM.PartType.ALL OrElse ((Map.refProjectVM.BTLStructureVM.SelGroup = "" OrElse x.sGROUP = Map.refProjectVM.BTLStructureVM.SelGroup) AndAlso
(Map.refProjectVM.BTLStructureVM.SelSubGroup = "" OrElse x.sSTOREY = Map.refProjectVM.BTLStructureVM.SelSubGroup) AndAlso
(Map.refProjectVM.BTLStructureVM.SelSearchParam.Id = BTLPartParam.NULL OrElse Map.refProjectVM.BTLStructureVM.SearchText = String.Empty OrElse (
@@ -345,7 +345,7 @@ Public Class NestingRunningWndVM
dOffset = WarehouseHelper.GetWallOffsetByWidth(SectionProgress.Section.dH)
End If
' passo a lua lista id pezzi da nestare
If SectionProgress.SectionPartList.Count > 0 AndAlso SectionProgress.SParamList.Count > 0 AndAlso
If SectionProgress.SectionPartList.Count > 0 AndAlso SectionProgress.SParamList.Count > 0 AndAlso SectionProgress.SParamList.Sum(Function(x) Math.Max(0, x.RawPart.nQuantity)) > 0 AndAlso
Not ExecNesting(sLogPath, CurrentMachine.sMachineName, SectionProgress.SectionPartList, SectionProgress.SParamList, dStartOffset, dOffset, dKerf, m_bLDIntersOther, m_nMinScore, SectionProgress.dCalcNestTime) Then
Exit For
End If
@@ -597,7 +597,8 @@ Public Class OptimizePanelVM
Next
Case BWType.WALL
For Each MachGroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
Dim RawPart As RawPartM = RawPartList.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.Material.sMaterial = MachGroup.Section.sMaterial)
'Dim RawPart As RawPartM = RawPartList.FirstOrDefault(Function(x) x.dW = MachGroup.dW AndAlso x.Material.dH = MachGroup.dH AndAlso x.dL = MachGroup.dL AndAlso x.Material.sMaterial = MachGroup.Section.sMaterial)
Dim RawPart As RawPartM = RawPartList.FirstOrDefault(Function(x) x.nId = MachGroup.MyMachGroupM.RawPartM.nId)
If Not IsNothing(RawPart) Then
RawPart.nQuantity += 1
Else
@@ -404,7 +404,7 @@ Public Class ProdManagerVM
Save(True)
End Sub
Public Function Save(Optional bShowLoading As Boolean = False) As Boolean
Public Function Save(Optional bShowLoading As Boolean = False, Optional bAskWarehouseUpload As Boolean = False) As Boolean
If IsNothing(m_CurrProd) Then Return False
If bShowLoading Then LoadingWndHelper.OpenLoadingWnd(ActiveIds.SAVEPROD, 2, EgtMsg(63007), EgtMsg(63012), 70) ' Project saving ' Saving geometry
Dim bOk As Boolean = Map.refSceneHostVM.SaveProject()
@@ -443,14 +443,13 @@ Public Class ProdManagerVM
Map.refMainWindowVM.UpdateTitle()
NotifyPropertyChanged(NameOf(MruFileNames))
' se magazzino di rete attivo e carica nesting su salvataggio attiva
If GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 AndAlso
(GetMainPrivateProfileInt(S_WAREHOUSE, K_SENDESTIMONSAVE, 0) = 1 OrElse
MessageBox.Show("Optimization saved but not uploaded to Db. Would you like to upload it?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes) Then
If bAskWarehouseUpload AndAlso GetMainPrivateProfileInt(S_WAREHOUSE, K_NETWAREHOUSE, 0) = 1 AndAlso
(GetMainPrivateProfileInt(S_WAREHOUSE, K_SENDESTIMONSAVE, 0) = 1 OrElse (Map.refMachGroupPanelVM.MachGroupVMList.Count > 0 AndAlso
MessageBox.Show("Optimization saved but not uploaded to Db. Would you like to upload it?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes)) Then
' forzo aggiornamento eventuali dati non inviati su Db
DbControllers.m_MagmanController.ForceSyncroSend()
' carico progetto su magazzino di rete
Map.refOptimizePanelVM.UploadNesting(False)
End If
If bShowLoading Then LoadingWndHelper.CloseLoadingWnd(ActiveIds.SAVEPROD)
Return bOk
@@ -142,7 +142,7 @@ Public Class ProdFileVM
Select Case VerifyResult
Case MessageBoxResult.Yes
' salvo proj
Map.refProdManagerVM.Save()
Map.refProdManagerVM.Save(False, True)
Case MessageBoxResult.Cancel
Return MessageBoxResult.Cancel
Case Else ' No
@@ -34,12 +34,12 @@ Module WarehouseHelper
End Function
' funzione che restituisce la path dell'ini del nesting
Public Function GetNestingDataIniPath() As String
Public Function GetNestingDataIniPath(Type As BWType) As String
Dim sWarehouseIniPath As String = CurrentMachine.sMachDir
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
sWarehouseIniPath = sWarehouseIniPath & "/Beam/"
If Type = BWType.BEAM Then
sWarehouseIniPath = sWarehouseIniPath & "\Beam\"
Else
sWarehouseIniPath = sWarehouseIniPath & "/Beam/"
sWarehouseIniPath = sWarehouseIniPath & "\Wall\"
End If
sWarehouseIniPath = sWarehouseIniPath & WH_NESTINGDATA_INI_FILE_NAME
Return sWarehouseIniPath
@@ -48,10 +48,10 @@ Module WarehouseHelper
' funzione che restituisce l'offset
Public Function GetOffset(Type As BWType) As Double
If Type = BWType.BEAM Then
Dim dOffset As Double = GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, GetNestingDataIniPath())
Dim dOffset As Double = GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, GetNestingDataIniPath(Type))
Return Math.Max(dOffset, CurrentMachine.dMinOffset)
Else
Return GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, GetNestingDataIniPath())
Return GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, GetNestingDataIniPath(Type))
End If
End Function
@@ -60,7 +60,7 @@ Module WarehouseHelper
Dim dOffset As Double = 0
Dim nRangeIndex As Integer = 1
Dim sRange As String = ""
While GenInterface.GetPrivateProfileString(WRH_WALL, WRH_RANGE & nRangeIndex, "", sRange, GetNestingDataIniPath()) >= 0 AndAlso Not String.IsNullOrWhiteSpace(sRange)
While GenInterface.GetPrivateProfileString(WRH_WALL, WRH_RANGE & nRangeIndex, "", sRange, GetNestingDataIniPath(BWType.WALL)) >= 0 AndAlso Not String.IsNullOrWhiteSpace(sRange)
Dim sRanges() As String = sRange.Split(","c)
If sRanges.Count() >= 2 Then
Dim dMaxThickness As Double = 0
@@ -75,18 +75,18 @@ Module WarehouseHelper
End Function
Public Function SetOffset(Type As BWType, Offset As Double) As Boolean
Return GenInterface.WritePrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), WRH_OFFSET, DoubleToString(Offset, 9), GetNestingDataIniPath())
Return GenInterface.WritePrivateProfileString(If(Type = BWType.BEAM, WRH_BEAM, WRH_WALL), WRH_OFFSET, DoubleToString(Offset, 9), GetNestingDataIniPath(Type))
End Function
#Region "Beam"
' funzione che restituisce l'offset iniziale
Public Function GetStartOffset() As Double
Return GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, GetNestingDataIniPath())
Return GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, GetNestingDataIniPath(BWType.BEAM))
End Function
Public Function SetStartOffset(StartOffset As Double) As Boolean
Return GenInterface.WritePrivateProfileString(WRH_BEAM, WRH_STARTOFFSET, DoubleToString(StartOffset, 9), GetNestingDataIniPath())
Return GenInterface.WritePrivateProfileString(WRH_BEAM, WRH_STARTOFFSET, DoubleToString(StartOffset, 9), GetNestingDataIniPath(BWType.BEAM))
End Function
#End Region ' Beam
@@ -95,11 +95,11 @@ Module WarehouseHelper
' funzione che restituisce l'offset
Public Function GetKerf() As Double
Return GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, GetNestingDataIniPath())
Return GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, GetNestingDataIniPath(BWType.WALL))
End Function
Public Function SetKerf(dKerf As Double) As Boolean
Return GenInterface.WritePrivateProfileString(WRH_WALL, WRH_KERF, DoubleToString(dKerf, 9), GetNestingDataIniPath())
Return GenInterface.WritePrivateProfileString(WRH_WALL, WRH_KERF, DoubleToString(dKerf, 9), GetNestingDataIniPath(BWType.WALL))
End Function
#End Region ' Wall
@@ -488,7 +488,7 @@ Module WarehouseHelper
Public Function GetRangeParamFromWarehouse(ParamIndex As Integer) As WhWallParam
Dim sValue As String = String.Empty
If EgtUILib.GetPrivateProfileString(S_WALL, K_RANGE & ParamIndex, String.Empty, sValue, GetNestingDataIniPath()) Then
If EgtUILib.GetPrivateProfileString(S_WALL, K_RANGE & ParamIndex, String.Empty, sValue, GetNestingDataIniPath(BWType.WALL)) Then
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
If sParamValues.Count >= 2 Then
@@ -509,9 +509,9 @@ Module WarehouseHelper
Public Function SetRangeParamFromWarehouse(ParamIndex As Integer, WhWallParam As WhWallParam) As Boolean
If Not IsNothing(WhWallParam) Then
Return WritePrivateProfileString(S_WALL, K_RANGE & ParamIndex + 1, DoubleToString(WhWallParam.dOffset, 9) & "," & DoubleToString(WhWallParam.dMaxThickness, 9), GetNestingDataIniPath())
Return WritePrivateProfileString(S_WALL, K_RANGE & ParamIndex, DoubleToString(WhWallParam.dOffset, 9) & "," & DoubleToString(WhWallParam.dMaxThickness, 9), GetNestingDataIniPath(BWType.WALL))
Else
Return WritePrivateProfileString(S_WALL, K_RANGE & ParamIndex + 1, Nothing, GetNestingDataIniPath())
Return WritePrivateProfileString(S_WALL, K_RANGE & ParamIndex, Nothing, GetNestingDataIniPath(BWType.WALL))
End If
End Function
@@ -797,7 +797,7 @@ Public Class WarehouseWndVM
Next
' Se ci sono parametri da rimuovere li rimuovo
For Index = ParamIndex To ParamIndex + m_RemovedWhWallParamsCount
WarehouseHelper.SetRangeParamFromWarehouse(Index, Nothing)
WarehouseHelper.SetRangeParamFromWarehouse(Index + 1, Nothing)
Next
For Each SPItem In SParamList
'Dim sW As String = String.Empty
Binary file not shown.