CacheShelfController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\MaterialBox;
  4. use App\Station;
  5. use Illuminate\Contracts\Foundation\Application;
  6. use Illuminate\Contracts\View\Factory;
  7. use Illuminate\Database\Eloquent\Builder;
  8. use Illuminate\Http\Request;
  9. use Illuminate\View\View;
  10. class CacheShelfController extends Controller
  11. {
  12. /**
  13. * 缓存货架
  14. * @return Application|Factory|View
  15. */
  16. public function index()
  17. {
  18. $stations = Station::query()->with('stationType:name', 'parent:name')->whereHas('stationType', function ($query) {
  19. /** @var Builder $query */
  20. $query->where('name', '缓存架');
  21. })->paginate(100);
  22. return view('station.cachingShelf.list.index', compact('stations'));
  23. }
  24. /**
  25. * 获取缓存货架上的任务列表
  26. * @param Request $request
  27. */
  28. public function getTasksApi(Request $request)
  29. {
  30. /** @var Station $station */
  31. $station = Station::query()->where('id', $request['id'])->first();
  32. /** @var MaterialBox $materialBox */
  33. $materialBox = MaterialBox::query()->firstOrCreate(['code' => $request['code'],['code'=>$request['code']]]);
  34. }
  35. /**
  36. * 往缓存架上放料箱
  37. * @param Request $request
  38. */
  39. public function pushTaskApi(Request $request)
  40. {
  41. /** @var Station $station */
  42. $station = Station::query()->where('id', $request['id'])->first();
  43. /** @var MaterialBox $materialBox */
  44. $materialBox = MaterialBox::query()->firstOrCreate(['code' => $request['code'],['code'=>$request['code']]]);
  45. }
  46. }