StationTypeService.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Services;
  3. use App\Batch;
  4. use App\StationRuleBatch;
  5. use App\StationType;
  6. use App\Traits\ServiceAppAop;
  7. class StationTypeService
  8. {
  9. use ServiceAppAop;
  10. /** @var StationRuleBatchService $stationRuleBatchService */
  11. private $stationRuleBatchService;
  12. public function __construct()
  13. {
  14. $this->stationRuleBatchService=null;
  15. }
  16. function getByBatch(Batch $batch): StationType
  17. {
  18. $this->instant($this->stationRuleBatchService,'StationRuleBatchService');
  19. $stationRuleBatch=$this->stationRuleBatchService->getByBatch($batch);
  20. return $stationRuleBatch['stationType'];
  21. }
  22. function getForCommodity(): StationType
  23. {
  24. /** @var StationType $stationType */
  25. $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
  26. return $stationType;
  27. }
  28. function getForMaterialBox(): StationType
  29. {
  30. /** @var StationType $stationType */
  31. $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
  32. return $stationType;
  33. }
  34. }