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\Rangements\Caisse")
  201.      * @ORM\JoinColumn(nullable=true)
  202.      */
  203.     private $caisseOption;
  204.     /**
  205.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\RaisonAnomalie",  cascade={"persist"})
  206.      * @ORM\JoinColumn(nullable=true)
  207.      */
  208.     private $raisonAnomalie;
  209.     /**
  210.      * @ORM\Column(type="text", nullable=true)
  211.      */
  212.     private $commentaireAnomalie;
  213.     public function __construct()
  214.     {
  215.     $this->date = new Datetime();
  216.         $this->dateFabrication          = new Datetime();
  217.         $this->quantiteReceptionnee     0;
  218.         $this->articleCommande          = new ArrayCollection();
  219.         $this->historiqueIntervention   = new ArrayCollection();
  220.         $this->fabricationsParente      = new ArrayCollection();
  221.         $this->mouvementStock           = new ArrayCollection();
  222.         $this->articlesComposants       = new ArrayCollection();
  223.     }
  224.     public function getId(): int
  225.     {
  226.         return $this->id;
  227.     }
  228.     public function setQuantite(int $quantite): Fabrication
  229.     {
  230.         $this->quantite $quantite;
  231.         return $this;
  232.     }
  233.     public function getQuantite(): int
  234.     {
  235.         return $this->quantite;
  236.     }
  237.     public function setQuantiteReceptionnee(int $quantiteReceptionnee): Fabrication
  238.     {
  239.         $this->quantiteReceptionnee $quantiteReceptionnee;
  240.         return $this;
  241.     }
  242.     public function getQuantiteReceptionnee(): int
  243.     {
  244.         return $this->quantiteReceptionnee;
  245.     }
  246.     public function setCommentaire(?string $commentaire): Fabrication
  247.     {
  248.         $this->commentaire $commentaire;
  249.         return $this;
  250.     }
  251.     public function getCommentaire(): ?string
  252.     {
  253.         return $this->commentaire;
  254.     }
  255.     public function setDate(DateTime $date): Fabrication
  256.     {
  257.         $this->date $date;
  258.         return $this;
  259.     }
  260.     public function getDate(): DateTime
  261.     {
  262.         return $this->date;
  263.     }
  264.     public function setDateSuppression(?DateTime $dateSuppression): Fabrication
  265.     {
  266.         $this->dateSuppression $dateSuppression;
  267.         return $this;
  268.     }
  269.     public function getDateSuppression(): ?DateTime
  270.     {
  271.         return $this->dateSuppression;
  272.     }
  273.     public function setDateMaj(?DateTime $dateMaj): Fabrication
  274.     {
  275.         $this->dateMaj $dateMaj;
  276.         return $this;
  277.     }
  278.     public function getDateMaj(): ?DateTime
  279.     {
  280.         return $this->dateMaj;
  281.     }
  282.     public function setDateMajPrix(?DateTime $dateMajPrix): Fabrication
  283.     {
  284.         $this->dateMajPrix $dateMajPrix;
  285.         return $this;
  286.     }
  287.     public function getDateMajPrix(): ?DateTime
  288.     {
  289.         return $this->dateMajPrix;
  290.     }
  291.     public function setUtilisateur(?Utilisateur $utilisateur): Fabrication
  292.     {
  293.         $this->utilisateur $utilisateur;
  294.         return $this;
  295.     }
  296.     public function getUtilisateur(): ?Utilisateur
  297.     {
  298.         return $this->utilisateur;
  299.     }
  300.     public function setMagasinier(?Utilisateur $magasinier): Fabrication
  301.     {
  302.         $this->magasinier $magasinier;
  303.         return $this;
  304.     }
  305.     public function getMagasinier(): ?Utilisateur
  306.     {
  307.         return $this->magasinier;
  308.     }
  309.     public function addArticlesComposant(ArticleComposant $articlesComposants): Fabrication
  310.     {
  311.         $this->articlesComposants[] = $articlesComposants;
  312.         return $this;
  313.     }
  314.     public function removeArticlesComposant(ArticleComposant $articlesComposants)
  315.     {
  316.         $this->articlesComposants->removeElement($articlesComposants);
  317.     }
  318.     public function getArticlesComposants(): Collection
  319.     {
  320.         return $this->articlesComposants;
  321.     }
  322.     public function setArticle(?Article $article): Fabrication
  323.     {
  324.         $this->article $article;
  325.         
  326.         if(is_object($this->article) && is_object($this->article->getAtelier())) {
  327.             $this->atelier $this->article->getAtelier();
  328.         }
  329.         else {
  330.             $this->atelier NULL;
  331.         }
  332.         return $this;
  333.     }
  334.     public function getArticle(): ?Article
  335.     {
  336.         return $this->article;
  337.     }
  338.     public function addArticleCommande(ArticleCommande $articleCommande): Fabrication
  339.     {
  340.         $this->articleCommande[] = $articleCommande;
  341.         return $this;
  342.     }
  343.     public function removeArticleCommande(ArticleCommande $articleCommande)
  344.     {
  345.         $this->articleCommande->removeElement($articleCommande);
  346.     }
  347.     public function getArticleCommande(): Collection
  348.     {
  349.         return $this->articleCommande;
  350.     }
  351.     public function setReference(?string $reference): Fabrication
  352.     {
  353.         $this->reference $reference;
  354.         return $this;
  355.     }
  356.     public function getReference(): ?string
  357.     {
  358.         return $this->reference;
  359.     }
  360.     public function setDateFabrication(DateTime $dateFabrication): Fabrication
  361.     {
  362.         $this->dateFabrication $dateFabrication;
  363.         return $this;
  364.     }
  365.     public function getDateFabrication(): DateTime
  366.     {
  367.         return $this->dateFabrication;
  368.     }
  369.     public function addMouvementStock(MouvementStock $mouvementStock): Fabrication
  370.     {
  371.         $this->mouvementStock[] = $mouvementStock;
  372.         return $this;
  373.     }
  374.     public function removeMouvementStock(MouvementStock $mouvementStock)
  375.     {
  376.         $this->mouvementStock->removeElement($mouvementStock);
  377.     }
  378.     public function getMouvementStock(): Collection
  379.     {
  380.         return $this->mouvementStock;
  381.     }
  382.     public function setQuantiteFabriquable(?int $quantiteFabriquable): Fabrication
  383.     {
  384.         $this->quantiteFabriquable $quantiteFabriquable;
  385.         return $this;
  386.     }
  387.     public function getQuantiteFabriquable(): ?int
  388.     {
  389.         return $this->quantiteFabriquable;
  390.     }
  391.     public function setFabricationMultiple(?FabricationMultiple $fabricationMultiple): Fabrication
  392.     {
  393.         $this->fabricationMultiple $fabricationMultiple;
  394.         return $this;
  395.     }
  396.     public function getFabricationMultiple(): ?FabricationMultiple
  397.     {
  398.         return $this->fabricationMultiple;
  399.     }
  400.     public function setFabricationParente(?Fabrication $fabricationParente): Fabrication
  401.     {
  402.         $this->fabricationParente $fabricationParente;
  403.         return $this;
  404.     }
  405.     public function getFabricationParente(): ?Fabrication
  406.     {
  407.         return $this->fabricationParente;
  408.     }
  409.     public function addFabricationsParente(Fabrication $fabricationsParente): Fabrication
  410.     {
  411.         $this->fabricationsParente[] = $fabricationsParente;
  412.         return $this;
  413.     }
  414.     public function removeFabricationsParente(Fabrication $fabricationsParente)
  415.     {
  416.         $this->fabricationsParente->removeElement($fabricationsParente);
  417.     }
  418.     public function getFabricationsParente(): Collection
  419.     {
  420.         return $this->fabricationsParente;
  421.     }
  422.     public function setPrestation(?FabricationMultiple $prestation): Fabrication
  423.     {
  424.         $this->prestation $prestation;
  425.         return $this;
  426.     }
  427.     public function getPrestation(): ?FabricationMultiple
  428.     {
  429.         return $this->prestation;
  430.     }
  431.     public function setFabriquable(?int $fabriquable): Fabrication
  432.     {
  433.         $this->fabriquable $fabriquable;
  434.         return $this;
  435.     }
  436.     public function getFabriquable(): ?int
  437.     {
  438.         return $this->fabriquable;
  439.     }
  440.     public function setCommandeFournisseur(?CommandeFournisseur $commandeFournisseur): Fabrication
  441.     {
  442.         $this->commandeFournisseur $commandeFournisseur;
  443.         return $this;
  444.     }
  445.     public function getCommandeFournisseur(): ?CommandeFournisseur
  446.     {
  447.         return $this->commandeFournisseur;
  448.     }
  449.     
  450.     public function getQuantitePrestation(): int
  451.     {
  452.         $total 0;
  453.         foreach($this->articleCommande as $ac){
  454.             if($ac->getArticle()->getPrestation() == 1){
  455.                 $total += $ac->getQuantite();
  456.             }
  457.         }
  458.         return $total;
  459.     }
  460.     
  461.     public function getQuantiteArticles(): int
  462.     {
  463.         $total 0;
  464.         foreach($this->articleCommande as $ac){
  465.             if($ac->getArticle()->getPrestation() != 1){
  466.                 $total += $ac->getQuantite();
  467.             }
  468.         }
  469.         return $total;
  470.     }
  471.     public function setSousFabrication(?bool $sousFabrication): Fabrication
  472.     {
  473.         $this->sousFabrication $sousFabrication;
  474.         return $this;
  475.     }
  476.     public function getSousFabrication(): ?bool
  477.     {
  478.         return $this->sousFabrication;
  479.     }
  480.     public function setGenererFabriquer(?int $genererFabriquer): Fabrication
  481.     {
  482.         $this->genererFabriquer $genererFabriquer;
  483.         return $this;
  484.     }
  485.     public function getGenererFabriquer(): ?int
  486.     {
  487.         return $this->genererFabriquer;
  488.     }
  489.     public function setAtelier(?Atelier $atelier): Fabrication
  490.     {
  491.         $this->atelier $atelier;
  492.         return $this;
  493.     }
  494.     public function getAtelier(): ?Atelier
  495.     {
  496.         return $this->atelier;
  497.     }
  498.     public function addHistoriqueIntervention(HistoriqueIntervention $historiqueIntervention): Fabrication
  499.     {
  500.         $this->historiqueIntervention[] = $historiqueIntervention;
  501.         return $this;
  502.     }
  503.     public function removeHistoriqueIntervention(HistoriqueIntervention $historiqueIntervention)
  504.     {
  505.         $this->historiqueIntervention->removeElement($historiqueIntervention);
  506.     }
  507.     public function getHistoriqueIntervention(): Collection
  508.     {
  509.         return $this->historiqueIntervention;
  510.     }
  511.     public function setArticleCommandeCommandeClient(?ArticleCommande $articleCommandeCommandeClient): Fabrication
  512.     {
  513.         $this->articleCommandeCommandeClient $articleCommandeCommandeClient;
  514.         return $this;
  515.     }
  516.     public function getArticleCommandeCommandeClient(): ?ArticleCommande
  517.     {
  518.         return $this->articleCommandeCommandeClient;
  519.     }
  520.     public function setCommande(?Commande $commande): Fabrication
  521.     {
  522.         $this->commande $commande;
  523.         return $this;
  524.     }
  525.     public function getCommande(): ?Commande
  526.     {
  527.         return $this->commande;
  528.     }
  529.     public function setStatutFabrication(?StatutFabrication $statutFabrication): Fabrication
  530.     {
  531.         $this->statutFabrication $statutFabrication;
  532.         return $this;
  533.     }
  534.     public function getStatutFabrication(): ?StatutFabrication
  535.     {
  536.         return $this->statutFabrication;
  537.     }
  538.     public function getTypeFabrication()
  539.     {
  540.         return $this->typeFabrication;
  541.     }
  542.     public function setTypeFabrication($typeFabrication)
  543.     {
  544.         $this->typeFabrication $typeFabrication;
  545.         return $this;
  546.     }
  547.     public function getFabricationEtiquette()
  548.     {
  549.         return $this->fabricationEtiquette;
  550.     }
  551.     public function setFabricationEtiquette($fabricationEtiquette)
  552.     {
  553.         $this->fabricationEtiquette $fabricationEtiquette;
  554.         return $this;
  555.     }
  556.     public function setCaisse(?Caisse $caisse): Fabrication
  557.     {
  558.         $this->caisse $caisse;
  559.         return $this;
  560.     }
  561.     public function getCaisse(): ?Caisse
  562.     {
  563.         return $this->caisse;
  564.     }
  565.     public function isSousFabrication(): ?bool
  566.     {
  567.         return $this->sousFabrication;
  568.     }
  569.     public function getRaisonAnomalie(): ?RaisonAnomalie
  570.     {
  571.         return $this->raisonAnomalie;
  572.     }
  573.     public function setRaisonAnomalie(?RaisonAnomalie $raisonAnomalie): self
  574.     {
  575.         $this->raisonAnomalie $raisonAnomalie;
  576.         return $this;
  577.     }
  578.     public function getCommentaireAnomalie(): ?string
  579.     {
  580.         return $this->commentaireAnomalie;
  581.     }
  582.     public function setCommentaireAnomalie(?string $commentaireAnomalie): self
  583.     {
  584.         $this->commentaireAnomalie $commentaireAnomalie;
  585.         return $this;
  586.     }
  587.     public function getCaisseOption(): ?Caisse
  588.     {
  589.         return $this->caisseOption;
  590.     }
  591.     public function setCaisseOption(?Caisse $caisseOption): self
  592.     {
  593.         $this->caisseOption $caisseOption;
  594.         return $this;
  595.     }
  596. }