src/Entity/System/StockAvailable.php line 20

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