summaryrefslogtreecommitdiffstats
path: root/Master/Daten- und Systemintegration/Praktikum/Projekte/DSI-Praktikum-1/ausgang/DSI-ejb/src/java/beans/auftragsAbwicklung/AuftragsAbwicklungBean.java
diff options
context:
space:
mode:
Diffstat (limited to 'Master/Daten- und Systemintegration/Praktikum/Projekte/DSI-Praktikum-1/ausgang/DSI-ejb/src/java/beans/auftragsAbwicklung/AuftragsAbwicklungBean.java')
-rw-r--r--Master/Daten- und Systemintegration/Praktikum/Projekte/DSI-Praktikum-1/ausgang/DSI-ejb/src/java/beans/auftragsAbwicklung/AuftragsAbwicklungBean.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/Master/Daten- und Systemintegration/Praktikum/Projekte/DSI-Praktikum-1/ausgang/DSI-ejb/src/java/beans/auftragsAbwicklung/AuftragsAbwicklungBean.java b/Master/Daten- und Systemintegration/Praktikum/Projekte/DSI-Praktikum-1/ausgang/DSI-ejb/src/java/beans/auftragsAbwicklung/AuftragsAbwicklungBean.java
new file mode 100644
index 0000000..625261f
--- /dev/null
+++ b/Master/Daten- und Systemintegration/Praktikum/Projekte/DSI-Praktikum-1/ausgang/DSI-ejb/src/java/beans/auftragsAbwicklung/AuftragsAbwicklungBean.java
@@ -0,0 +1,70 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package beans.auftragsAbwicklung;
+
+import beans.bestell.BestellRemote;
+import beans.lieferant.LieferantRemote;
+import beans.lager.LagerRemote;
+import beans.*;
+import beans.artikelManager.ArtikelManagerRemote;
+import entities.Artikel;
+import exceptions.AuftragsAbwicklungException;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+
+/**
+ * Eine Klasse für das abwickeln von Aufträgen
+ * @author jmueller
+ */
+@Stateless(mappedName="AuftragsAbwicklungBean")
+public class AuftragsAbwicklungBean implements AuftragsAbwicklungRemote {
+ @EJB
+ private BestellRemote bestellBean;
+ @EJB
+ private ArtikelManagerRemote artikelManagerBean;
+
+ @EJB
+ private LieferantRemote lieferantBean;
+ @EJB
+ private LagerRemote lagerBean;
+
+
+ /**
+ * simuliert die Bestellung eines Artikels durch einen Kunden
+ *
+ * @param kundenId Id des Kunden
+ * @param artikelId Id des Artikels
+ * @param artikelAnzahl Anzahl des Artikels
+ *
+ * @return String Bericht
+ * @throws java.lang.Exception
+ */
+ public String bestelleArtikel(long kundenId, long artikelId, long artikelAnzahl ) throws Exception{
+
+
+ if( bestellBean.validiereBestellung(artikelId, artikelAnzahl, kundenId) != true){
+ throw new AuftragsAbwicklungException("Bestellung nicht valide!");
+ }
+
+ Artikel artikel = artikelManagerBean.readArtikel(artikelId);
+
+
+ // falls nicht verfuegbar -> nachbestellen
+ if (lagerBean.pruefeVerfuegbarkeit(artikelId, artikelAnzahl) != true) {
+ long mindestMenge = 10L;
+ long imLager = artikel.getAnzahl();
+ long anzahlNachbestellen = artikelAnzahl - imLager + mindestMenge;
+ lieferantBean.bestelleNach(artikelId, anzahlNachbestellen);
+ }
+
+ lagerBean.bucheArtikelAus(artikelId, artikelAnzahl);
+ double preisOhneMwSt = bestellBean.berechneGesamtpreis(artikelAnzahl, artikel.getPreis());
+ double MwSt = bestellBean.berechneMehrwertSteuer(preisOhneMwSt);
+
+ return "";
+ }
+
+
+}