Compare commits
2 Commits
d0a53379db
...
54c1a482b4
| Author | SHA1 | Date |
|---|---|---|
|
|
54c1a482b4 | |
|
|
51619ceb8f |
|
|
@ -38,9 +38,9 @@ public class DokumentServiceImpl implements DokumentService {
|
||||||
* Alle Abhängigkeiten werden injiziert (Dependency Injection).
|
* Alle Abhängigkeiten werden injiziert (Dependency Injection).
|
||||||
*/
|
*/
|
||||||
public DokumentServiceImpl(DokumentRepository repository,
|
public DokumentServiceImpl(DokumentRepository repository,
|
||||||
ProductLookup productLookup,
|
ProductLookup productLookup,
|
||||||
CustomerLookup customerLookup,
|
CustomerLookup customerLookup,
|
||||||
PdfExportService pdfExportService) {
|
PdfExportService pdfExportService) {
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.productLookup = productLookup;
|
this.productLookup = productLookup;
|
||||||
this.customerLookup = customerLookup;
|
this.customerLookup = customerLookup;
|
||||||
|
|
@ -113,21 +113,18 @@ public class DokumentServiceImpl implements DokumentService {
|
||||||
public Auftragsbestaetigung erstelleAuftragsbestaetigung(String angebotsNummer) {
|
public Auftragsbestaetigung erstelleAuftragsbestaetigung(String angebotsNummer) {
|
||||||
Angebot angebot = ladeAngebot(angebotsNummer);
|
Angebot angebot = ladeAngebot(angebotsNummer);
|
||||||
|
|
||||||
// Doppelte AB zuerst (PH-DP-05 / MT-DP-06): wenn bereits eine AB für
|
// Duplikat-Check zuerst (PH-DP-05 / MT-DP-06): wenn bereits eine AB existiert,
|
||||||
// dieses Angebot existiert, ist das Angebot zwangsläufig UEBERFUEHRT
|
// ist das Angebot zwangsläufig UEBERFUEHRT und beide Prüfungen würden anschlagen.
|
||||||
// und die Status-Prüfung würde ebenfalls anschlagen. Die Spec verlangt
|
// Die Spec verlangt in diesem Szenario explizit DuplicateDocumentException.
|
||||||
// in diesem Szenario eindeutig DuplicateDocumentException, deshalb
|
|
||||||
// muss diese Prüfung vor dem allgemeinen Status-Check stehen.
|
|
||||||
if (repository.existsFolgedokument(angebotsNummer)) {
|
if (repository.existsFolgedokument(angebotsNummer)) {
|
||||||
throw new DuplicateDocumentException(angebotsNummer);
|
throw new DuplicateDocumentException(angebotsNummer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allgemeine Status-Prüfung (PH-DP-04): blockiert auch andere
|
// Allgemeiner Status-Check (PH-DP-04): greift bei anderen Nicht-OFFEN-Zuständen.
|
||||||
// Nicht-OFFEN-Zustände (z. B. ABGELEHNT, falls künftig ergänzt).
|
|
||||||
if (angebot.getStatus() != DokumentStatus.OFFEN) {
|
if (angebot.getStatus() != DokumentStatus.OFFEN) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Angebot " + angebotsNummer + " ist nicht mehr OFFEN (Status: " +
|
"Angebot " + angebotsNummer + " ist nicht mehr OFFEN (Status: " +
|
||||||
angebot.getStatus() + "). Auftragsbestätigung kann nicht erzeugt werden.");
|
angebot.getStatus() + "). Auftragsbestätigung kann nicht erzeugt werden.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// AB erzeugen – Positionen 1:1 übernehmen
|
// AB erzeugen – Positionen 1:1 übernehmen
|
||||||
|
|
@ -161,8 +158,8 @@ public class DokumentServiceImpl implements DokumentService {
|
||||||
|
|
||||||
if (ab.getStatus() != DokumentStatus.BESTAETIGT) {
|
if (ab.getStatus() != DokumentStatus.BESTAETIGT) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Auftragsbestätigung " + auftragsNummer + " hat nicht den Status BESTAETIGT " +
|
"Auftragsbestätigung " + auftragsNummer + " hat nicht den Status BESTAETIGT " +
|
||||||
"(aktueller Status: " + ab.getStatus() + ").");
|
"(aktueller Status: " + ab.getStatus() + ").");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Positionen ohne Preis-Snapshot (PH-DP-07)
|
// Positionen ohne Preis-Snapshot (PH-DP-07)
|
||||||
|
|
@ -194,8 +191,8 @@ public class DokumentServiceImpl implements DokumentService {
|
||||||
|
|
||||||
if (ls.getStatus() != DokumentStatus.GELIEFERT) {
|
if (ls.getStatus() != DokumentStatus.GELIEFERT) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Lieferschein " + lieferscheinNummer + " hat nicht den Status GELIEFERT " +
|
"Lieferschein " + lieferscheinNummer + " hat nicht den Status GELIEFERT " +
|
||||||
"(aktueller Status: " + ls.getStatus() + ").");
|
"(aktueller Status: " + ls.getStatus() + ").");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kundendaten für Pflichtangaben holen
|
// Kundendaten für Pflichtangaben holen
|
||||||
|
|
@ -325,4 +322,4 @@ public class DokumentServiceImpl implements DokumentService {
|
||||||
pa.setLeistungsdatum(lieferdatum);
|
pa.setLeistungsdatum(lieferdatum);
|
||||||
return pa;
|
return pa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue