src/Entity/System/StockAvailable.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * @ORM\Table(name="ps_stock_available", indexes={
  6. *
  7. * @ORM\Index(name="depends_on_stock", columns={"depends_on_stock"})
  8. * },
  9. * uniqueConstraints={
  10. *
  11. * @ORM\UniqueConstraint(name="uk_product_product_attribute", columns={"id_product", "id_product_attribute"})
  12. * })
  13. *
  14. * @ORM\Entity(repositoryClass="App\Repository\System\StockAvailableRepository")
  15. */
  16. class StockAvailable
  17. {
  18. public const AVAILABLE_STOCK = 'AVAILABLE';
  19. public const COMING_STOCK = 'FUTURE';
  20. public const JIT_STOCK = 'SUPPLIER';
  21. public const JIT_3_5_STOCK = 'SUP_3_5';
  22. public const DO_NOT_DEPENDS_ON_STOCK = 0;
  23. public const DEPENDS_ON_STOCK = 2;
  24. public const MIN_PRODUCT_STOCK_PERCENTAGE = 0.6;
  25. public const OUT_OF_STOCK = 2;
  26. public const JIT_MIN_DAYS = 1;
  27. public const JIT_MAX_DAYS = 2;
  28. public const JIT_3_5_MIN_DAYS = 3;
  29. public const JIT_3_5_MAX_DAYS = 5;
  30. public const IMMEDIATE_STOCK_MIN_DAYS = 0;
  31. public const IMMEDIATE_STOCK_MAX_DAYS = 0;
  32. public const UNLIMITED_STOCK_FOR_NO_DEPENDS_ON_STOCK_QUANTITY = 500;
  33. /**
  34. * @var int
  35. *
  36. * @ORM\Column(name="id_stock_available", type="integer")
  37. *
  38. * @ORM\Id
  39. *
  40. * @ORM\GeneratedValue(strategy="AUTO")
  41. */
  42. private $id;
  43. /**
  44. * @var Product
  45. *
  46. * @ORM\ManyToOne(targetEntity="Product", inversedBy="stocks")
  47. *
  48. * @ORM\JoinColumn(name="id_product", referencedColumnName="id_product", nullable=false)
  49. *
  50. * @ORM\OrderBy({"id_product_attribute" = "ASC", "reference" = "DESC"})
  51. */
  52. private $product;
  53. /**
  54. * @var Warehouse
  55. *
  56. * @ORM\ManyToOne(targetEntity="App\Entity\System\Warehouse")
  57. *
  58. * @ORM\JoinColumn(name="id_warehouse", referencedColumnName="id", nullable=false, options={"default":1})
  59. */
  60. private $warehouse;
  61. /**
  62. * @var ProductAttribute|null
  63. *
  64. * @ORM\OneToOne(targetEntity="ProductAttribute", inversedBy="stock")
  65. *
  66. * @ORM\JoinColumn(name="id_product_attribute", referencedColumnName="id_product_attribute", nullable=true)
  67. */
  68. private $productAttribute;
  69. /**
  70. * @ORM\Column(type="integer", options={"default":0})
  71. */
  72. private int $quantity;
  73. /**
  74. * @ORM\Column(type="integer", options={"default":0})
  75. */
  76. private int $quantityStockSupplier;
  77. /**
  78. * @ORM\Column(type="integer", nullable=true, options={"default":0})
  79. */
  80. private ?int $quantityStockSupplierToShow;
  81. /**
  82. * @ORM\Column(name="quantity_stock_supplier_3_5", type="integer", nullable=false, options={"default":0})
  83. */
  84. private int $quantityStockSupplier3To5;
  85. /**
  86. * @ORM\Column(type="integer", options={"default":0})
  87. */
  88. private int $quantityFutureStock;
  89. /**
  90. * @ORM\Column(type="integer", nullable=false, options={"default":0})
  91. */
  92. private int $stockExtern;
  93. /**
  94. * @ORM\Column(name="stock_extern_3_5", type="integer", nullable=false, options={"default":0})
  95. */
  96. private int $stockExtern3To5;
  97. /**
  98. * @ORM\Column(type="integer", nullable=false, options={"unsigned":true, "default":2})
  99. */
  100. private int $dependsOnStock;
  101. /**
  102. * @ORM\Column(type="integer", nullable=false, options={"unsigned":true, "default":2})
  103. */
  104. private int $outOfStock;
  105. /**
  106. * @var \DateTime
  107. *
  108. * @ORM\Column(type="datetime", options={"default" : "CURRENT_TIMESTAMP"})
  109. */
  110. private $dateUpd;
  111. /**
  112. * @return int
  113. */
  114. public function getId(): int
  115. {
  116. return $this->id;
  117. }
  118. public function setId(int $id): StockAvailable
  119. {
  120. $this->id = $id;
  121. return $this;
  122. }
  123. public function getProduct(): Product
  124. {
  125. return $this->product;
  126. }
  127. /**
  128. * @param Product $product
  129. *
  130. * @return StockAvailable
  131. */
  132. public function setProduct(Product $product): StockAvailable
  133. {
  134. $this->product = $product;
  135. return $this;
  136. }
  137. public function getProductAttribute(): ?ProductAttribute
  138. {
  139. return $this->productAttribute;
  140. }
  141. public function setProductAttribute(?ProductAttribute $productAttribute = null): StockAvailable
  142. {
  143. $this->productAttribute = $productAttribute;
  144. return $this;
  145. }
  146. /**
  147. * @return int
  148. */
  149. public function getQuantity(): int
  150. {
  151. return $this->quantity;
  152. }
  153. /**
  154. * @param int $quantity
  155. *
  156. * @return StockAvailable
  157. */
  158. public function setQuantity(int $quantity): StockAvailable
  159. {
  160. $this->quantity = $quantity;
  161. return $this;
  162. }
  163. public function getQuantityStockSupplier(): int
  164. {
  165. return $this->quantityStockSupplier;
  166. }
  167. public function setQuantityStockSupplier(int $quantityStockSupplier): StockAvailable
  168. {
  169. $this->quantityStockSupplier = $quantityStockSupplier;
  170. return $this;
  171. }
  172. public function getQuantityFutureStock(): int
  173. {
  174. return $this->quantityFutureStock;
  175. }
  176. public function setQuantityFutureStock(int $quantityFutureStock): StockAvailable
  177. {
  178. $this->quantityFutureStock = $quantityFutureStock;
  179. return $this;
  180. }
  181. /**
  182. * @return int|null
  183. */
  184. public function getStockExtern(): ?int
  185. {
  186. return $this->stockExtern;
  187. }
  188. /**
  189. * @param int|null $stockExtern
  190. *
  191. * @return StockAvailable
  192. */
  193. public function setStockExtern(?int $stockExtern): StockAvailable
  194. {
  195. $this->stockExtern = $stockExtern;
  196. return $this;
  197. }
  198. /**
  199. * @return int
  200. */
  201. public function isDependsOnStock(): int
  202. {
  203. return $this->dependsOnStock;
  204. }
  205. /**
  206. * @param int $dependsOnStock
  207. *
  208. * @return StockAvailable
  209. */
  210. public function setDependsOnStock(int $dependsOnStock): StockAvailable
  211. {
  212. $this->dependsOnStock = $dependsOnStock;
  213. return $this;
  214. }
  215. public function isOutOfStock(): int
  216. {
  217. return $this->outOfStock;
  218. }
  219. public function setOutOfStock(int $outOfStock): StockAvailable
  220. {
  221. $this->outOfStock = $outOfStock;
  222. return $this;
  223. }
  224. /**
  225. * @return \DateTime
  226. */
  227. public function getDateUpd(): \DateTime
  228. {
  229. return $this->dateUpd;
  230. }
  231. /**
  232. * @param \DateTime $dateUpd
  233. *
  234. * @return StockAvailable
  235. */
  236. public function setDateUpd(\DateTime $dateUpd): StockAvailable
  237. {
  238. $this->dateUpd = $dateUpd;
  239. return $this;
  240. }
  241. public function getQuantityStockSupplier3To5(): int
  242. {
  243. return $this->quantityStockSupplier3To5;
  244. }
  245. public function setQuantityStockSupplier3To5(int $quantityStockSupplier3To5): void
  246. {
  247. $this->quantityStockSupplier3To5 = $quantityStockSupplier3To5;
  248. }
  249. public function getStockExtern3To5(): int
  250. {
  251. return $this->stockExtern3To5;
  252. }
  253. public function setStockExtern3To5(int $stockExtern3To5): void
  254. {
  255. $this->stockExtern3To5 = $stockExtern3To5;
  256. }
  257. public function getWarehouse(): Warehouse
  258. {
  259. return $this->warehouse;
  260. }
  261. public function setWarehouse(Warehouse $warehouse): void
  262. {
  263. $this->warehouse = $warehouse;
  264. }
  265. public function getQuantityStockSupplierToShow(): ?int
  266. {
  267. return $this->quantityStockSupplierToShow;
  268. }
  269. public function setQuantityStockSupplierToShow(?int $quantityStockSupplierToShow): StockAvailable
  270. {
  271. $this->quantityStockSupplierToShow = $quantityStockSupplierToShow;
  272. return $this;
  273. }
  274. }