StationTypeService.php 1.0 KB

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