StationTypeService.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. protected $modelClass=StationType::class;
  11. /** @var StationRuleBatchService $stationRuleBatchService */
  12. private $stationRuleBatchService;
  13. public function __construct()
  14. {
  15. $this->stationRuleBatchService=null;
  16. }
  17. function getByBatch(Batch $batch)
  18. {
  19. $this->instant($this->stationRuleBatchService,'StationRuleBatchService');
  20. // return $stationRuleBatch['stationType'];
  21. return StationType::query()->where('name','料箱监视器')->first();
  22. }
  23. function getForCommodity(): StationType
  24. {
  25. /** @var StationType $stationType */
  26. $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
  27. return $stationType;
  28. }
  29. function getForMaterialBox_onBatchProcess(): StationType
  30. {
  31. /** @var StationType $stationType */
  32. $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
  33. return $stationType;
  34. }
  35. }