Index: TAOR-rework-bugfixing/TAOR rework/Rework/HoofdAansturingRework.vb
===================================================================
diff -u -r1597 -r1598
--- TAOR-rework-bugfixing/TAOR rework/Rework/HoofdAansturingRework.vb (.../HoofdAansturingRework.vb) (revision 1597)
+++ TAOR-rework-bugfixing/TAOR rework/Rework/HoofdAansturingRework.vb (.../HoofdAansturingRework.vb) (revision 1598)
@@ -3,91 +3,126 @@
Private _productieData As ZijkamerFreesProductieData
Private ReadOnly _productieDatas As New List(Of ZijkamerFreesProductieData)
- Public Sub verwerkRug(rug As Rework)
+ Public Sub VerwerkRug(rug As Rework)
'Naar Ardis sturen.
- HerzagenOnderdelen(rug)
- 'de opdracht resetten in de afkanter
- resetOpdrachtAfkanter(rug.barcode)
+ HerzaagRework(rug)
+ 'De opdracht resetten in de afkanter.
+ ResetOpdrachtAfkanter(rug.barcode)
End Sub
- Public Sub verwerkFront(front As Rework)
+ Public Sub VerwerkFront(front As Rework)
'Naar Ardis sturen.
- HerzagenOnderdelen(front)
- 'de opdracht resetten in de afkanter
- resetOpdrachtAfkanter(front.barcode)
+ HerzaagRework(front)
+ 'De opdracht resetten in de afkanter.
+ ResetOpdrachtAfkanter(front.barcode)
End Sub
- Public Sub verwerkBodem(bodem As Rework)
+ Public Sub VerwerkBodem(bodem As Rework)
'Naar Ardis sturen.
- HerzagenOnderdelen(bodem)
- 'Productie tabel wordt nooit gewist op stemasC en insert moet dus niet worden uitgevoerd
+ HerzaagRework(bodem)
+ 'Productie tabel wordt nooit gewist op stemasC en insert moet dus niet worden uitgevoerd.
End Sub
- Private Sub resetOpdrachtAfkanter(ByVal barcodeID As String)
- Try
- 'kijken of het wel moet worden opgeslagen
- If Configs.geefVerwerkStatus Then
- KantenbandMapper.resetOpdracht(barcodeID)
- End If
- Catch ex As Exception
- Throw ex
- End Try
+ '''
+ ''' Herzagen van het de rework.
+ '''
+ ''' De rework die zal herzaagt worden.
+ Private Sub HerzaagRework(rework As Rework)
+ 'Andere functie aanroepen met lege tray- en slotnummer.
+ HerzaagRework(rework, String.Empty, String.Empty)
End Sub
- Private Sub HerzagenOnderdelen(rework As Rework, Optional trayNummer As String = "", Optional slotNummer As String = "")
- Try
- If rework.opslaanArdis Then
- If rework.onderdeel.ToLower.Contains("zijkant") Then
- Dim LinksEnOfRechts As String = rework.onderdeel.ToLower.Replace("zijkant", "").Replace("i", "").Replace("e", "").Trim.ToUpper
- If LinksEnOfRechts.Equals("L") Or LinksEnOfRechts.Equals("LR") Then
- HerzaagZijkant(rework, "L", trayNummer, slotNummer)
- End If
- If LinksEnOfRechts.Equals("R") Or LinksEnOfRechts.Equals("LR") Then
- HerzaagZijkant(rework, "R", trayNummer, slotNummer)
- End If
- If LinksEnOfRechts.Equals("") Then
- HerzaagZijkant(rework, "", trayNummer, slotNummer)
- End If
+ '''
+ ''' Bepalen hoe de rework verwerkt moet worden, afhankelijk of het een zijkant is of niet.
+ ''' Indien het een zijkant is wordt gekeken of het links of rechts is.
+ '''
+ ''' De rework die zal herzaagt worden.
+ ''' De traynummer.
+ ''' Het slotnummer.
+ Private Sub HerzaagRework(rework As Rework, trayNummer As String, slotNummer As String)
+ 'Controleer of het wel moet worden opgeslagen in Ardis.
+ If Not rework.opslaanArdis Then Return
+
+ 'Zo ja, controleer of het onderdeel geen zijkant is.
+ If Not rework.onderdeel.ToLower.Contains("zijkant") Then
+ 'Reworks van niet-zijkanten worden herzaagt aan de hand van hun barcode.
+ HerzaagMetBarcode(rework.barcode)
+ Else
+ 'Voor zijkanten wordt gekeken of het links, rechts, beide of gewoon een zijkant is.
+ Dim linksEnOfRechts As String = rework.onderdeel.ToUpper()
+
+ 'Kijk of het een normale zijkant is.
+ If Not linksEnOfRechts.Contains("L") And Not linksEnOfRechts.Contains("R") Then
+ 'Gewone zijkant zonder type.
+ HerzaagZijkant(rework, "", trayNummer, slotNummer)
+ Else
+ 'Kijk of het een LR zijkant is.
+ If linksEnOfRechts.Contains("LR") Then
+ 'Zo ja, Herzaag zowel voor links als voor rechts.
+ HerzaagZijkant(rework, "L", trayNummer, slotNummer)
+ HerzaagZijkant(rework, "R", trayNummer, slotNummer)
+ ElseIf linksEnOfRechts.Contains("L") Then
+ 'Herzaag links.
+ HerzaagZijkant(rework, "L", trayNummer, slotNummer)
Else
- HerzaagOnderdeel(rework.barcode)
+ 'Herzaag rechts.
+ HerzaagZijkant(rework, "R", trayNummer, slotNummer)
End If
End If
+ End If
+ End Sub
+
+ Private Sub HerzaagZijkant(rework As Rework, linksOfRechts As String, trayNummer As String, slotNummer As String)
+ Try
+ Dim ardisData As ArdisData = ArdisMapper.OphalenData(rework.barcode)
+ If ardisData Is Nothing Then
+ Throw New Exception("Ardisdata kon niet worden opgevraagd voor rework met barcode: " & rework.barcode)
+ End If
+ 'als het een speciale zijkant is moeten we het corresponderende plankje vinden, aka A of B
+ Dim barcodes As List(Of String)
+ If Not (ardisData.isSpecialGegenereerd()) Then
+ barcodes = ArdisMapper.geefBarcode(ardisData.PartGroup, ardisData.PartExt02, ardisData.PartL, linksOfRechts)
+ Else
+ barcodes = ArdisMapper.geefBarcodeGegenereerdePlankjes(ardisData.PartGroup, ardisData.PartExt02, ardisData.PartL)
+ End If
+
+ If barcodes Is Nothing Then
+ Throw New Exception("Er is iets foutgelopen bij het ophalen van de barcodes van de zijkanten uit de Ardis databank")
+ ElseIf barcodes.Count > 2 Then
+ Throw New Exception("Er zijn teveel barcodes gevonden bij het ophalen van de barcodes van de zijkanten uit de Ardis databank, Partgroup, PartExt02: " & ardisData.PartGroup & ", " & ardisData.PartExt02)
+ End If
+ For Each barcode In barcodes
+ HerzaagMetBarcode(barcode, trayNummer, slotNummer)
+ Next
Catch ex As Exception
Throw ex
End Try
End Sub
- Private Sub MaakFreesOpdrachtInReworkTray(ByVal barcodeID As String, ByVal linksOfRechts As String, ByVal nieuwTrayNummer As String, ByVal slotNr As String, ByVal voorVoorraad As Boolean, etiketTekst As String, Optional barcodeID2 As String = "", Optional andereZijkantLinksOfRechts As String = "")
+#Region "Tray"
+ Public Sub VerwerkTray(tray As ReworkTray)
Try
- _productieData = AutomillingMapper.OphalenUitProductie(barcodeID)
- If _productieData Is Nothing Then
- _productieData = AutomillingMapper.OphalenUitHistoriek(barcodeID)
- If _productieData Is Nothing Then
- Throw New Exception("De productieData kon niet worden opgehaald uit automiling met barcode: " & barcodeID)
- End If
- End If
+ For Each slot As Slot In tray.geefNietLegeSlots
+ If slot.zijkanten.Count > 0 Then
- 'als het een uit een paar is updaten met de informatie uit de andere van het paar
- If barcodeID2.Equals("") Then
- _productieData.aanpassenData(linksOfRechts, nieuwTrayNummer, slotNr, voorVoorraad, etiketTekst)
- Else
- Dim productieDataAndere As ZijkamerFreesProductieData
- productieDataAndere = AutomillingMapper.OphalenUitProductie(barcodeID2)
- If productieDataAndere Is Nothing Then
- productieDataAndere = AutomillingMapper.OphalenUitHistoriek(barcodeID2)
- If productieDataAndere Is Nothing Then
- Throw New Exception("De productieData kon niet worden opgehaald uit automiling met barcode: " & barcodeID)
- End If
+ opslaanInAutomilling()
+
+ For Each zijkant As Rework In slot.zijkanten
+ 'de opdracht resetten in de afkanter
+ ResetOpdrachtAfkanter(zijkant.barcode)
+ Next
+
+ 'als het een paar is de andere van het paar verwijderen
+ slot.verwijderTweedeVanPaar()
+
End If
- _productieData.aanpassenData(linksOfRechts, nieuwTrayNummer, slotNr, voorVoorraad, etiketTekst, productieDataAndere, andereZijkantLinksOfRechts)
- End If
- _productieDatas.Add(_productieData.ShallowCopy)
+ Next
Catch ex As Exception
Throw ex
End Try
End Sub
- Private Sub opslaanInAutomilling()
+ Private Sub OpslaanInAutomilling()
For Each data As ZijkamerFreesProductieData In _productieDatas
If data Is Nothing Then
_productieDatas.Clear()
@@ -100,35 +135,24 @@
Next
_productieDatas.Clear()
End Sub
+#End Region
- Private Sub HerzaagZijkant(rework As Rework, linksOfRechts As String, trayNummer As String, slotNummer As String)
+ '''
+ ''' De opdracht resetten in de afkanter.
+ '''
+ ''' De barcode van het onderdeel.
+ Private Shared Sub ResetOpdrachtAfkanter(ByVal barcodeId As String)
Try
- Dim ardisData As ArdisData = ArdisMapper.OphalenData(rework.barcode)
- If ardisData Is Nothing Then
- Throw New Exception("Ardisdata kon niet worden opgevraagd voor rework met barcode: " & rework.barcode)
+ 'kijken of het wel moet worden opgeslagen
+ If Configs.geefVerwerkStatus Then
+ KantenbandMapper.resetOpdracht(barcodeId)
End If
- 'als het een speciale zijkant is moeten we het corresponderende plankje vinden, aka A of B
- Dim barcodes As List(Of String)
- If Not (ardisData.isSpecialGegenereerd()) Then
- barcodes = ArdisMapper.geefBarcode(ardisData.PartGroup, ardisData.PartExt02, ardisData.PartL, linksOfRechts)
- Else
- barcodes = ArdisMapper.geefBarcodeGegenereerdePlankjes(ardisData.PartGroup, ardisData.PartExt02, ardisData.PartL)
- End If
-
- If barcodes Is Nothing Then
- Throw New Exception("Er is iets foutgelopen bij het ophalen van de barcodes van de zijkanten uit de Ardis databank")
- ElseIf barcodes.Count > 2 Then
- Throw New Exception("Er zijn teveel barcodes gevonden bij het ophalen van de barcodes van de zijkanten uit de Ardis databank, Partgroup, PartExt02: " & ardisData.PartGroup & ", " & ardisData.PartExt02)
- End If
- For Each barcode In barcodes
- HerzaagOnderdeel(barcode, trayNummer, slotNummer)
- Next
Catch ex As Exception
Throw ex
End Try
End Sub
- Private Sub HerzaagOnderdeel(ByVal BarcodeID As String, Optional trayNummer As String = "", Optional slotNummer As String = "")
+ Private Sub HerzaagMetBarcode(ByVal BarcodeID As String, Optional trayNummer As String = "", Optional slotNummer As String = "")
Try
Dim ardisData As ArdisData = ArdisMapper.OphalenData(BarcodeID)
ardisData.aanpassenDataRework()
@@ -141,8 +165,6 @@
End Try
End Sub
-
-
Public Sub updateTray(tray As ReworkTray)
Try
For Each slot As Slot In tray.geefNietLegeSlots
@@ -166,31 +188,39 @@
slot.zijkanten(0).height = _productieData.height
'In ARDIS per zijkant twee planken zagen (er moet maar 1 zijkant worden meegegeven, onderdeel is naar LR gezet)
- HerzagenOnderdelen(slot.zijkanten(0), tray.nummer, slot.nummer)
+ HerzaagRework(slot.zijkanten(0), tray.nummer, slot.nummer)
End If
Next
Catch ex As Exception
Throw ex
End Try
End Sub
- Public Sub verwerkTray(tray As ReworkTray)
+ Private Sub MaakFreesOpdrachtInReworkTray(ByVal barcodeID As String, ByVal linksOfRechts As String, ByVal nieuwTrayNummer As String, ByVal slotNr As String, ByVal voorVoorraad As Boolean, etiketTekst As String, Optional barcodeID2 As String = "", Optional andereZijkantLinksOfRechts As String = "")
Try
- For Each slot As Slot In tray.geefNietLegeSlots
- If slot.zijkanten.Count > 0 Then
+ _productieData = AutomillingMapper.OphalenUitProductie(barcodeID)
+ If _productieData Is Nothing Then
+ _productieData = AutomillingMapper.OphalenUitHistoriek(barcodeID)
+ If _productieData Is Nothing Then
+ Throw New Exception("De productieData kon niet worden opgehaald uit automiling met barcode: " & barcodeID)
+ End If
+ End If
- opslaanInAutomilling()
-
- For Each zijkant As Rework In slot.zijkanten
- 'de opdracht resetten in de afkanter
- resetOpdrachtAfkanter(zijkant.barcode)
- Next
-
- 'als het een paar is de andere van het paar verwijderen
- slot.verwijderTweedeVanPaar()
-
+ 'als het een uit een paar is updaten met de informatie uit de andere van het paar
+ If barcodeID2.Equals("") Then
+ _productieData.aanpassenData(linksOfRechts, nieuwTrayNummer, slotNr, voorVoorraad, etiketTekst)
+ Else
+ Dim productieDataAndere As ZijkamerFreesProductieData
+ productieDataAndere = AutomillingMapper.OphalenUitProductie(barcodeID2)
+ If productieDataAndere Is Nothing Then
+ productieDataAndere = AutomillingMapper.OphalenUitHistoriek(barcodeID2)
+ If productieDataAndere Is Nothing Then
+ Throw New Exception("De productieData kon niet worden opgehaald uit automiling met barcode: " & barcodeID)
+ End If
End If
- Next
+ _productieData.aanpassenData(linksOfRechts, nieuwTrayNummer, slotNr, voorVoorraad, etiketTekst, productieDataAndere, andereZijkantLinksOfRechts)
+ End If
+ _productieDatas.Add(_productieData.ShallowCopy)
Catch ex As Exception
Throw ex
End Try