src/Entity/GestionComerciale/Fabrication.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity\GestionComerciale;
  3. use App\Entity\Articles\Article;
  4. use App\Entity\Articles\ArticleComposant;
  5. use App\Entity\Articles\MouvementStock;
  6. use App\Entity\FO\Atelier;
  7. use App\Entity\Utilisateur\HistoriqueIntervention;
  8. use App\Entity\Utilisateur\Utilisateur;
  9. use App\Entity\Rangements\Caisse;
  10. use DateTime;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Gedmo\Mapping\Annotation as Gedmo;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use App\Annotations\SecuredEntity;
  16. /**
  17.  * Fabrication
  18.  *
  19.  * @ORM\Table("commerciale__fabrication")
  20.  * @ORM\Entity(repositoryClass="App\Repository\GestionComerciale\FabricationRepository")
  21.  * @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
  22.  * @SecuredEntity(name="Fabrication", group="ARTICLES")
  23.  */
  24. class Fabrication
  25. {
  26.     /**
  27.      * @ORM\Column(name="id", type="integer")
  28.      * @ORM\Id
  29.      * @ORM\GeneratedValue(strategy="AUTO")
  30.      */
  31.     private $id;
  32.     
  33.     /**
  34.      * @ORM\Column(name="reference", type="string", length=255, nullable=true)
  35.      */
  36.     private $reference;
  37.     
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="fabrications")
  40.      * @ORM\JoinColumn(nullable=true)
  41.      */
  42.     private $utilisateur;
  43.     
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="fabricationsMagasinier")
  46.      * @ORM\JoinColumn(nullable=true)
  47.      */
  48.     private $magasinier;
  49.     
  50.     /**
  51.      * @ORM\Column(name="commentaire", type="text", nullable=true)
  52.     */
  53.     private $commentaire;
  54.     /**
  55.      * @ORM\Column(name="date", type="datetime")
  56.      */
  57.     private $date;
  58.     
  59.     /**
  60.      * @ORM\Column(name="date_fabrication", type="datetime")
  61.      */
  62.     private $dateFabrication;
  63.     
  64.      /**
  65.      * @ORM\Column(name="date_supression", type="datetime", nullable=true)
  66.      */
  67.     private $dateSuppression;
  68.     
  69.      /**
  70.      * @ORM\Column(name="date_maj", type="datetime", nullable=true)
  71.      * @Gedmo\Timestampable(on="update")
  72.      */
  73.     private $dateMaj;
  74.     
  75.      /**
  76.      * @ORM\Column(name="date_maj_prix", type="datetime", nullable=true)
  77.      
  78.      */
  79.     private $dateMajPrix;
  80.     /**
  81.      * @ORM\Column(name="quantite", type="integer")
  82.      */
  83.     private $quantite;
  84.     /**
  85.      * @ORM\Column(name="quantiteReceptionnee", type="integer")
  86.      */
  87.     private $quantiteReceptionnee;
  88.     
  89.     /**
  90.     * @ORM\OneToMany(targetEntity="App\Entity\Articles\ArticleComposant", cascade={"persist"},mappedBy="fabrication")
  91.     */
  92.     private $articlesComposants;
  93.     
  94.     /**
  95.     * @ORM\ManyToOne(targetEntity="App\Entity\Articles\Article", inversedBy="fabrications")
  96.     */
  97.     private $article;
  98.     
  99.     /**
  100.     * @ORM\ManyToOne(targetEntity="App\Entity\FO\Atelier")
  101.     */
  102.     private $atelier;
  103.     
  104.     /**
  105.     * @ORM\OneToMany(targetEntity="App\Entity\GestionComerciale\ArticleCommande", mappedBy="fabrication")
  106.     */
  107.     private $articleCommande;
  108.     /**
  109.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\ArticleCommande", inversedBy="fabricationArticleCommandeCommandeClient" )
  110.      * @ORM\JoinColumn(nullable=true)
  111.      */
  112.     private $articleCommandeCommandeClient;
  113.     /**
  114.     * @ORM\OneToMany(targetEntity="App\Entity\Articles\MouvementStock", mappedBy="fabrication")
  115.     */
  116.     private $mouvementStock;
  117.     /**
  118.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\StatutFabrication", inversedBy="fabrications")
  119.      * @ORM\JoinColumn(nullable=true)
  120.      */
  121.     private $statutFabrication;
  122.     
  123.     /**
  124.      * @ORM\Column(name="fabriquable", type="integer", nullable=true)
  125.      */
  126.     private $fabriquable;
  127.     
  128.     /**
  129.      * @ORM\Column(name="quantiteFabriquable", type="integer", nullable=true)
  130.      */
  131.     private $quantiteFabriquable;
  132.     
  133.     /**
  134.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\FabricationMultiple", inversedBy="fabrications")
  135.      * @ORM\JoinColumn(nullable=true)
  136.      */
  137.     private $fabricationMultiple;
  138.     
  139.     /**
  140.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\FabricationMultiple", inversedBy="fabricationsPrestation")
  141.      * @ORM\JoinColumn(nullable=true)
  142.      */
  143.     private $prestation;
  144.     
  145.     /**
  146.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\Fabrication", inversedBy="fabricationsParente")
  147.      * @ORM\JoinColumn(nullable=true)
  148.      */
  149.     private $fabricationParente;
  150.     
  151.     /**
  152.     * @ORM\OneToMany(targetEntity="App\Entity\GestionComerciale\Fabrication", mappedBy="fabricationParente")
  153.     */
  154.     private $fabricationsParente;
  155.     
  156.     /**
  157.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\CommandeFournisseur", inversedBy="fabrications")
  158.      * @ORM\JoinColumn(nullable=true)
  159.      */
  160.     private $commandeFournisseur;
  161.     
  162.     /**
  163.      * @ORM\Column(name="sous_fabrication", type="boolean", nullable=true)
  164.      */
  165.     private $sousFabrication;
  166.     
  167.     /**
  168.      * @ORM\Column(name="generer_fabriquer", type="integer", nullable=true)
  169.      */
  170.     private $genererFabriquer;
  171.     /**
  172.      * @ORM\OneToMany(targetEntity="App\Entity\Utilisateur\HistoriqueIntervention", mappedBy="fabrication")
  173.      */
  174.     private $historiqueIntervention
  175.     /**
  176.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\Commande")
  177.      * @ORM\JoinColumn(nullable=true)
  178.      */
  179.     private $commande;
  180.     public const NAME = [
  181.         1  => 'Fabrication ADDITIVE',
  182.         2  => 'Fabrication DEDUCTIVE',
  183.     ];
  184.     public const ADDITIVE 1;
  185.     public const DEDUCTIVE 2;
  186.     /**
  187.      * @ORM\Column(name="type_fabrication", type="smallint", nullable=true)
  188.      */
  189.     private $typeFabrication;
  190.     /**
  191.      * @ORM\Column(name="fabrication_etiquette", type="string",length=3, nullable=true)
  192.      */
  193.     private $fabricationEtiquette;
  194.     /**
  195.      * @ORM\ManyToOne(targetEntity="App\Entity\Rangements\Caisse")
  196.      * @ORM\JoinColumn(nullable=true)
  197.      */
  198.     private $caisse;
  199.     /**
  200.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\RaisonAnomalie",  cascade={"persist"})
  201.      * @ORM\JoinColumn(nullable=true)
  202.      */
  203.     private $raisonAnomalie;
  204.     /**
  205.      * @ORM\Column(type="text", nullable=true)
  206.      */
  207.     private $commentaireAnomalie;
  208.     public function __construct()
  209.     {
  210.     $this->date = new Datetime();
  211.         $this->dateFabrication          = new Datetime();
  212.         $this->quantiteReceptionnee     0;
  213.         $this->articleCommande          = new ArrayCollection();
  214.         $this->historiqueIntervention   = new ArrayCollection();
  215.         $this->fabricationsParente      = new ArrayCollection();
  216.         $this->mouvementStock           = new ArrayCollection();
  217.         $this->articlesComposants       = new ArrayCollection();
  218.     }
  219.     public function getId(): int
  220.     {
  221.         return $this->id;
  222.     }
  223.     public function setQuantite(int $quantite): Fabrication
  224.     {
  225.         $this->quantite $quantite;
  226.         return $this;
  227.     }
  228.     public function getQuantite(): int
  229.     {
  230.         return $this->quantite;
  231.     }
  232.     public function setQuantiteReceptionnee(int $quantiteReceptionnee): Fabrication
  233.     {
  234.         $this->quantiteReceptionnee $quantiteReceptionnee;
  235.         return $this;
  236.     }
  237.     public function getQuantiteReceptionnee(): int
  238.     {
  239.         return $this->quantiteReceptionnee;
  240.     }
  241.     public function setCommentaire(?string $commentaire): Fabrication
  242.     {
  243.         $this->commentaire $commentaire;
  244.         return $this;
  245.     }
  246.     public function getCommentaire(): ?string
  247.     {
  248.         return $this->commentaire;
  249.     }
  250.     public function setDate(DateTime $date): Fabrication
  251.     {
  252.         $this->date $date;
  253.         return $this;
  254.     }
  255.     public function getDate(): DateTime
  256.     {
  257.         return $this->date;
  258.     }
  259.     public function setDateSuppression(?DateTime $dateSuppression): Fabrication
  260.     {
  261.         $this->dateSuppression $dateSuppression;
  262.         return $this;
  263.     }
  264.     public function getDateSuppression(): ?DateTime
  265.     {
  266.         return $this->dateSuppression;
  267.     }
  268.     public function setDateMaj(?DateTime $dateMaj): Fabrication
  269.     {
  270.         $this->dateMaj $dateMaj;
  271.         return $this;
  272.     }
  273.     public function getDateMaj(): ?DateTime
  274.     {
  275.         return $this->dateMaj;
  276.     }
  277.     public function setDateMajPrix(?DateTime $dateMajPrix): Fabrication
  278.     {
  279.         $this->dateMajPrix $dateMajPrix;
  280.         return $this;
  281.     }
  282.     public function getDateMajPrix(): ?DateTime
  283.     {
  284.         return $this->dateMajPrix;
  285.     }
  286.     public function setUtilisateur(?Utilisateur $utilisateur): Fabrication
  287.     {
  288.         $this->utilisateur $utilisateur;
  289.         return $this;
  290.     }
  291.     public function getUtilisateur(): ?Utilisateur
  292.     {
  293.         return $this->utilisateur;
  294.     }
  295.     public function setMagasinier(?Utilisateur $magasinier): Fabrication
  296.     {
  297.         $this->magasinier $magasinier;
  298.         return $this;
  299.     }
  300.     public function getMagasinier(): ?Utilisateur
  301.     {
  302.         return $this->magasinier;
  303.     }
  304.     public function addArticlesComposant(ArticleComposant $articlesComposants): Fabrication
  305.     {
  306.         $this->articlesComposants[] = $articlesComposants;
  307.         return $this;
  308.     }
  309.     public function removeArticlesComposant(ArticleComposant $articlesComposants)
  310.     {
  311.         $this->articlesComposants->removeElement($articlesComposants);
  312.     }
  313.     public function getArticlesComposants(): Collection
  314.     {
  315.         return $this->articlesComposants;
  316.     }
  317.     public function setArticle(?Article $article): Fabrication
  318.     {
  319.         $this->article $article;
  320.         
  321.         if(is_object($this->article) && is_object($this->article->getAtelier())) {
  322.             $this->atelier $this->article->getAtelier();
  323.         }
  324.         else {
  325.             $this->atelier NULL;
  326.         }
  327.         return $this;
  328.     }
  329.     public function getArticle(): ?Article
  330.     {
  331.         return $this->article;
  332.     }
  333.     public function addArticleCommande(ArticleCommande $articleCommande): Fabrication
  334.     {
  335.         $this->articleCommande[] = $articleCommande;
  336.         return $this;
  337.     }
  338.     public function removeArticleCommande(ArticleCommande $articleCommande)
  339.     {
  340.         $this->articleCommande->removeElement($articleCommande);
  341.     }
  342.     public function getArticleCommande(): Collection
  343.     {
  344.         return $this->articleCommande;
  345.     }
  346.     public function setReference(?string $reference): Fabrication
  347.     {
  348.         $this->reference $reference;
  349.         return $this;
  350.     }
  351.     public function getReference(): ?string
  352.     {
  353.         return $this->reference;
  354.     }
  355.     public function setDateFabrication(DateTime $dateFabrication): Fabrication
  356.     {
  357.         $this->dateFabrication $dateFabrication;
  358.         return $this;
  359.     }
  360.     public function getDateFabrication(): DateTime
  361.     {
  362.         return $this->dateFabrication;
  363.     }
  364.     public function addMouvementStock(MouvementStock $mouvementStock): Fabrication
  365.     {
  366.         $this->mouvementStock[] = $mouvementStock;
  367.         return $this;
  368.     }
  369.     public function removeMouvementStock(MouvementStock $mouvementStock)
  370.     {
  371.         $this->mouvementStock->removeElement($mouvementStock);
  372.     }
  373.     public function getMouvementStock(): Collection
  374.     {
  375.         return $this->mouvementStock;
  376.     }
  377.     public function setQuantiteFabriquable(?int $quantiteFabriquable): Fabrication
  378.     {
  379.         $this->quantiteFabriquable $quantiteFabriquable;
  380.         return $this;
  381.     }
  382.     public function getQuantiteFabriquable(): ?int
  383.     {
  384.         return $this->quantiteFabriquable;
  385.     }
  386.     public function setFabricationMultiple(?FabricationMultiple $fabricationMultiple): Fabrication
  387.     {
  388.         $this->fabricationMultiple $fabricationMultiple;
  389.         return $this;
  390.     }
  391.     public function getFabricationMultiple(): ?FabricationMultiple
  392.     {
  393.         return $this->fabricationMultiple;
  394.     }
  395.     public function setFabricationParente(?Fabrication $fabricationParente): Fabrication
  396.     {
  397.         $this->fabricationParente $fabricationParente;
  398.         return $this;
  399.     }
  400.     public function getFabricationParente(): ?Fabrication
  401.     {
  402.         return $this->fabricationParente;
  403.     }
  404.     public function addFabricationsParente(Fabrication $fabricationsParente): Fabrication
  405.     {
  406.         $this->fabricationsParente[] = $fabricationsParente;
  407.         return $this;
  408.     }
  409.     public function removeFabricationsParente(Fabrication $fabricationsParente)
  410.     {
  411.         $this->fabricationsParente->removeElement($fabricationsParente);
  412.     }
  413.     public function getFabricationsParente(): Collection
  414.     {
  415.         return $this->fabricationsParente;
  416.     }
  417.     public function setPrestation(?FabricationMultiple $prestation): Fabrication
  418.     {
  419.         $this->prestation $prestation;
  420.         return $this;
  421.     }
  422.     public function getPrestation(): ?FabricationMultiple
  423.     {
  424.         return $this->prestation;
  425.     }
  426.     public function setFabriquable(?int $fabriquable): Fabrication
  427.     {
  428.         $this->fabriquable $fabriquable;
  429.         return $this;
  430.     }
  431.     public function getFabriquable(): ?int
  432.     {
  433.         return $this->fabriquable;
  434.     }
  435.     public function setCommandeFournisseur(?CommandeFournisseur $commandeFournisseur): Fabrication
  436.     {
  437.         $this->commandeFournisseur $commandeFournisseur;
  438.         return $this;
  439.     }
  440.     public function getCommandeFournisseur(): ?CommandeFournisseur
  441.     {
  442.         return $this->commandeFournisseur;
  443.     }
  444.     
  445.     public function getQuantitePrestation(): int
  446.     {
  447.         $total 0;
  448.         foreach($this->articleCommande as $ac){
  449.             if($ac->getArticle()->getPrestation() == 1){
  450.                 $total += $ac->getQuantite();
  451.             }
  452.         }
  453.         return $total;
  454.     }
  455.     
  456.     public function getQuantiteArticles(): int
  457.     {
  458.         $total 0;
  459.         foreach($this->articleCommande as $ac){
  460.             if($ac->getArticle()->getPrestation() != 1){
  461.                 $total += $ac->getQuantite();
  462.             }
  463.         }
  464.         return $total;
  465.     }
  466.     public function setSousFabrication(?bool $sousFabrication): Fabrication
  467.     {
  468.         $this->sousFabrication $sousFabrication;
  469.         return $this;
  470.     }
  471.     public function getSousFabrication(): ?bool
  472.     {
  473.         return $this->sousFabrication;
  474.     }
  475.     public function setGenererFabriquer(?int $genererFabriquer): Fabrication
  476.     {
  477.         $this->genererFabriquer $genererFabriquer;
  478.         return $this;
  479.     }
  480.     public function getGenererFabriquer(): ?int
  481.     {
  482.         return $this->genererFabriquer;
  483.     }
  484.     public function setAtelier(?Atelier $atelier): Fabrication
  485.     {
  486.         $this->atelier $atelier;
  487.         return $this;
  488.     }
  489.     public function getAtelier(): ?Atelier
  490.     {
  491.         return $this->atelier;
  492.     }
  493.     public function addHistoriqueIntervention(HistoriqueIntervention $historiqueIntervention): Fabrication
  494.     {
  495.         $this->historiqueIntervention[] = $historiqueIntervention;
  496.         return $this;
  497.     }
  498.     public function removeHistoriqueIntervention(HistoriqueIntervention $historiqueIntervention)
  499.     {
  500.         $this->historiqueIntervention->removeElement($historiqueIntervention);
  501.     }
  502.     public function getHistoriqueIntervention(): Collection
  503.     {
  504.         return $this->historiqueIntervention;
  505.     }
  506.     public function setArticleCommandeCommandeClient(?ArticleCommande $articleCommandeCommandeClient): Fabrication
  507.     {
  508.         $this->articleCommandeCommandeClient $articleCommandeCommandeClient;
  509.         return $this;
  510.     }
  511.     public function getArticleCommandeCommandeClient(): ?ArticleCommande
  512.     {
  513.         return $this->articleCommandeCommandeClient;
  514.     }
  515.     public function setCommande(?Commande $commande): Fabrication
  516.     {
  517.         $this->commande $commande;
  518.         return $this;
  519.     }
  520.     public function getCommande(): ?Commande
  521.     {
  522.         return $this->commande;
  523.     }
  524.     public function setStatutFabrication(?StatutFabrication $statutFabrication): Fabrication
  525.     {
  526.         $this->statutFabrication $statutFabrication;
  527.         return $this;
  528.     }
  529.     public function getStatutFabrication(): ?StatutFabrication
  530.     {
  531.         return $this->statutFabrication;
  532.     }
  533.     public function getTypeFabrication()
  534.     {
  535.         return $this->typeFabrication;
  536.     }
  537.     public function setTypeFabrication($typeFabrication)
  538.     {
  539.         $this->typeFabrication $typeFabrication;
  540.         return $this;
  541.     }
  542.     public function getFabricationEtiquette()
  543.     {
  544.         return $this->fabricationEtiquette;
  545.     }
  546.     public function setFabricationEtiquette($fabricationEtiquette)
  547.     {
  548.         $this->fabricationEtiquette $fabricationEtiquette;
  549.         return $this;
  550.     }
  551.     public function setCaisse(?Caisse $caisse): Fabrication
  552.     {
  553.         $this->caisse $caisse;
  554.         return $this;
  555.     }
  556.     public function getCaisse(): ?Caisse
  557.     {
  558.         return $this->caisse;
  559.     }
  560.     public function isSousFabrication(): ?bool
  561.     {
  562.         return $this->sousFabrication;
  563.     }
  564.     public function getRaisonAnomalie(): ?RaisonAnomalie
  565.     {
  566.         return $this->raisonAnomalie;
  567.     }
  568.     public function setRaisonAnomalie(?RaisonAnomalie $raisonAnomalie): self
  569.     {
  570.         $this->raisonAnomalie $raisonAnomalie;
  571.         return $this;
  572.     }
  573.     public function getCommentaireAnomalie(): ?string
  574.     {
  575.         return $this->commentaireAnomalie;
  576.     }
  577.     public function setCommentaireAnomalie(?string $commentaireAnomalie): self
  578.     {
  579.         $this->commentaireAnomalie $commentaireAnomalie;
  580.         return $this;
  581.     }
  582. }