| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?php
- namespace App\Http\Controllers;
- use App\Station;
- use App\StationTypeBinMonitor;
- use Illuminate\Database\Eloquent\Builder;
- use Illuminate\Http\Request;
- class StationController extends Controller
- {
- /**
- * Display a listing of the resource.
- *
- * @return void
- */
- public function index()
- {
- }
- public function monitorIndex()
- {
- $stations = Station::query()->with('stationType:name','parent:name')->whereHas('stationType',function($query){
- /** @var Builder $query */
- $query->where('name','料箱监视器');
- })->paginate(100);
- return view('station.monitor.index',compact('stations'));
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function create()
- {
- //
- }
- /**
- * Store a newly created resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\Response
- */
- public function store(Request $request)
- {
- //
- }
- public function show(Station $station)
- {
- //
- }
- public function monitorShow(Station $station)
- {
- // $stationTypeBinMonitor = StationTypeBinMonitor::query()->where("station_id",$station->id)->first();
- $station->loadMissing([
- "stationTasks_today.stationTaskCommodities.commodity.barcodes",
- "stationTasks_today.stationTaskCommodities.materialBox",
- "stationTasks_today.stationTaskBatches.batch.owner",
- "stationTasks_today.stationTaskMaterialBoxes.materialBox",
- "stationTypeBinMonitor",
- ]);
- if (!$station['stationTypeBinMonitor']){
- StationTypeBinMonitor::query()->create([
- 'station_id' => $station['id'],
- 'bin_row_length' => 4,
- 'bin_column_length' => 5,
- 'bin_wall_amount' => 2,
- ]);
- $station->load("stationTypeBinMonitor");
- }
- // dd(
- // data_get($station['stationTasks_today'],'*.id')
- // ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.batch.code')
- // ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.id')
- // ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.batch.id')
- // ,data_get(data_get($station['stationTasks_today'],'*.stationTaskCommodities')[7],'*.id')
- // ,data_get(data_get($station['stationTasks_today'],'*.stationTaskCommodities')[9],'*.id')
- // );
- // $station=$station->toJson();
- return view('station.monitor.show',compact('station'));
- }
- /**
- * Show the form for editing the specified resource.
- *
- * @param \App\Station $station
- * @return \Illuminate\Http\Response
- */
- public function edit(Station $station)
- {
- //
- }
- /**
- * Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param \App\Station $station
- * @return \Illuminate\Http\Response
- */
- public function update(Request $request, Station $station)
- {
- //
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param \App\Station $station
- * @return \Illuminate\Http\Response
- */
- public function destroy(Station $station)
- {
- //
- }
- }
|