src/Entity/Movimientos/MovimientoStock.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Movimientos;
  3. use App\Repository\Movimientos\MovimientoStockRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use App\Entity\Almacen\Deposito;
  10. use App\Entity\User;
  11. use App\Entity\Mantenimiento\PedidoReparacionDiagramado;
  12. use App\Entity\Mantenimiento\Preventivo\TareaPlanDiagramada;
  13. /**
  14.  * @ORM\Entity(repositoryClass=MovimientoStockRepository::class)
  15.  * @ORM\Table(name="mov_movimiento_stock")
  16.  * @ORM\InheritanceType("SINGLE_TABLE")
  17.  * @ORM\DiscriminatorColumn(name="discr", type="string")
  18.  * @ORM\DiscriminatorMap({"ms"=MovimientoStock::class, "oc"=OrdenCompra::class, "tr"=Transferencia::class, "ph"=PrestamoHerramienta::class, "or"=OrdenReparacion::class, "as"=AjusteStock::class, "ore"=OrdenReparacionExterna::class})
  19.  * @ORM\HasLifecycleCallbacks()
  20.  */
  21. abstract class MovimientoStock
  22. {
  23.     /**
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue
  26.      * @ORM\Column(type="integer")
  27.      */
  28.     private $id;
  29.     /**
  30.      * @ORM\Column(type="date")
  31.      * @Assert\NotNull(message="El campo es requerido")
  32.      */
  33.     private $fecha;
  34.     /**
  35.      * @ORM\Column(type="integer")
  36.      */
  37.     private $numero;
  38.     /**
  39.      * @ORM\Column(type="boolean")
  40.      */
  41.     private $eliminado false;
  42.     /**
  43.      * @ORM\Column(type="boolean", options={"default"=false})
  44.      */
  45.     private $pendiente true;
  46.     /**
  47.      * @ORM\Column(name="fecha_ingreso", type="datetime")
  48.      */
  49.     private $fechaIngreso;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=Deposito::class)
  52.      * @ORM\JoinColumn(name="id_deposito", referencedColumnName="id", nullable=true)
  53.      */
  54.     private $deposito;
  55.     /**
  56.      * @ORM\OneToMany(targetEntity=ItemMovimiento::class, mappedBy="movimiento", cascade={"persist"}) 
  57.      */
  58.     private $items;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=User::class)
  61.      * @ORM\JoinColumn(name="id_user_alta", referencedColumnName="id", nullable=true)
  62.      */
  63.     private $userAlta;
  64.     /**
  65.      * @ORM\Column(name="ya_procesada", type="boolean")
  66.      */
  67.     private $yaProcesada false;
  68.     /**
  69.      * @ORM\Column(name="observaciones", type="text", nullable=true)
  70.      */
  71.     private $observaciones;
  72.     /**
  73.      * @ORM\Column(name="finalizo_circuito", type="boolean", options={"default"=false})
  74.      */
  75.     private $finalizoCircuito false//Representa el caso en que se lleven mas repuestos para realizar una reparacion y se devuelvan algunos
  76.     /**
  77.      * @ORM\ManyToOne(targetEntity=Deposito::class)
  78.      * @ORM\JoinColumn(name="id_destino", referencedColumnName="id", nullable=true)
  79.      */
  80.     private $destino;
  81.     /**
  82.      * @ORM\ManyToOne(targetEntity=PedidoReparacionDiagramado::class)
  83.      * @ORM\JoinColumn(name="id_tarea_diag", referencedColumnName="id", nullable=true)
  84.      */
  85.     private $tareaDiagramada;
  86.     /**
  87.      * @ORM\ManyToOne(targetEntity=TareaPlanDiagramada::class)
  88.      * @ORM\JoinColumn(name="id_tare_preventivo", referencedColumnName="id", nullable=true)
  89.      */
  90.     private $tareaPreventivo;
  91.     public static abstract function isToolArticle();
  92.     public abstract function getInstance();
  93.     public abstract function getDescripcion();
  94.     public function getAsociaPedidoReparacion()
  95.     {
  96.         return false;
  97.     }
  98.     public function getResponsable()
  99.     {
  100.         return "";
  101.     }
  102.     public function getArticulo($articulo)
  103.     {
  104.         $data = array();
  105.         foreach ($this->items as $it)
  106.         {
  107.             if($it->getArticulo() == $articulo)
  108.             {
  109.                 $data[] = $it->getCantidad();
  110.             }
  111.         }
  112.         return $data;
  113.     }
  114.     public function getFinalizable()
  115.     {
  116.         return false;
  117.     }
  118.     public function getIsDevuelta()
  119.     {
  120.         return true;
  121.     }
  122.     public function setIsDevuelta($flag$fecha)
  123.     {
  124.     }
  125.     public function isModificable()
  126.     {
  127.         return !$this->yaProcesada;
  128.     }
  129.     public function getDetalle()
  130.     {
  131.         return "";
  132.     }
  133.     public function __construct()
  134.     {
  135.         $this->items = new ArrayCollection();
  136.     }
  137.     /**
  138.      * @ORM\PrePersist
  139.      */
  140.     public function setCreatedAtValue()
  141.     {
  142.         $this->fechaIngreso = new \DateTimeImmutable();
  143.     }
  144.     public function getId(): ?int
  145.     {
  146.         return $this->id;
  147.     }
  148.     public function getFecha(): ?\DateTimeInterface
  149.     {
  150.         return $this->fecha;
  151.     }
  152.     public function setFecha(?\DateTimeInterface $fecha): self
  153.     {
  154.         $this->fecha $fecha;
  155.         return $this;
  156.     }
  157.     public function isEliminado(): ?bool
  158.     {
  159.         return $this->eliminado;
  160.     }
  161.     public function setEliminado(bool $eliminado): self
  162.     {
  163.         $this->eliminado $eliminado;
  164.         return $this;
  165.     }
  166.     public function getFechaIngreso(): ?\DateTimeInterface
  167.     {
  168.         return $this->fechaIngreso;
  169.     }
  170.     public function setFechaIngreso(\DateTimeInterface $fechaIngreso): self
  171.     {
  172.         $this->fechaIngreso $fechaIngreso;
  173.         return $this;
  174.     }
  175.     public function getDeposito(): ?Deposito
  176.     {
  177.         return $this->deposito;
  178.     }
  179.     public function setDeposito(?Deposito $deposito): self
  180.     {
  181.         $this->deposito $deposito;
  182.         return $this;
  183.     }
  184.     /**
  185.      * @return Collection<int, ItemMovimiento>
  186.      */
  187.     public function getItems(): Collection
  188.     {
  189.         return $this->items;
  190.     }
  191.     public function addItem(ItemMovimiento $item): self
  192.     {
  193.         if (!$this->items->contains($item)) {
  194.             $this->items[] = $item;
  195.             $item->setMovimiento($this);
  196.         }
  197.         return $this;
  198.     }
  199.     public function removeItem(ItemMovimiento $item): self
  200.     {
  201.         if ($this->items->removeElement($item)) {
  202.             // set the owning side to null (unless already changed)
  203.             if ($item->getMovimiento() === $this) {
  204.                 $item->setMovimiento(null);
  205.             }
  206.         }
  207.         return $this;
  208.     }
  209.     public function getUserAlta(): ?User
  210.     {
  211.         return $this->userAlta;
  212.     }
  213.     public function setUserAlta(?User $userAlta): self
  214.     {
  215.         $this->userAlta $userAlta;
  216.         return $this;
  217.     }
  218.     public function isYaProcesada(): ?bool
  219.     {
  220.         return $this->yaProcesada;
  221.     }
  222.     public function setYaProcesada(bool $yaProcesada): self
  223.     {
  224.         $this->yaProcesada $yaProcesada;
  225.         return $this;
  226.     }
  227.     public function getObservaciones(): ?string
  228.     {
  229.         return $this->observaciones;
  230.     }
  231.     public function setObservaciones(?string $observaciones): self
  232.     {
  233.         $this->observaciones $observaciones;
  234.         return $this;
  235.     }
  236.     public function isPendiente(): ?bool
  237.     {
  238.         return $this->pendiente;
  239.     }
  240.     public function setPendiente(bool $pendiente): self
  241.     {
  242.         $this->pendiente $pendiente;
  243.         return $this;
  244.     }
  245.     public function isFinalizoCircuito(): ?bool
  246.     {
  247.         return $this->finalizoCircuito;
  248.     }
  249.     public function setFinalizoCircuito(bool $finalizoCircuito): self
  250.     {
  251.         $this->finalizoCircuito $finalizoCircuito;
  252.         return $this;
  253.     }
  254.     public function getNumero(): ?int
  255.     {
  256.         return $this->numero;
  257.     }
  258.     public function setNumero(int $numero): self
  259.     {
  260.         $this->numero $numero;
  261.         return $this;
  262.     }
  263.     public function getDestino(): ?Deposito
  264.     {
  265.         return $this->destino;
  266.     }
  267.     public function setDestino(?Deposito $destino): self
  268.     {
  269.         $this->destino $destino;
  270.         return $this;
  271.     }
  272.     public function getTareaDiagramada(): ?PedidoReparacionDiagramado
  273.     {
  274.         return $this->tareaDiagramada;
  275.     }
  276.     public function setTareaDiagramada(?PedidoReparacionDiagramado $tareaDiagramada): self
  277.     {
  278.         $this->tareaDiagramada $tareaDiagramada;
  279.         return $this;
  280.     }
  281.     public function getTareaPreventivo(): ?TareaPlanDiagramada
  282.     {
  283.         return $this->tareaPreventivo;
  284.     }
  285.     public function setTareaPreventivo(?TareaPlanDiagramada $tareaPreventivo): self
  286.     {
  287.         $this->tareaPreventivo $tareaPreventivo;
  288.         return $this;
  289.     }
  290. }