Ver Fonte

临时提交

ajun há 5 anos atrás
pai
commit
d435cb00e9

+ 36 - 0
app/Http/Controllers/StationController.php

@@ -6,6 +6,9 @@ use App\Station;
 use App\StationTypeBinMonitor;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
+use Illuminate\Contracts\Foundation\Application;
+use Illuminate\Contracts\View\Factory;
+use Illuminate\View\View;
 
 class StationController extends Controller
 {
@@ -27,6 +30,19 @@ class StationController extends Controller
         return view('station.monitor.index',compact('stations'));
     }
 
+    /**
+     * 缓存货架
+     * @return Application|Factory|View
+     */
+    public function cachingShelfIndex()
+    {
+        $stations = Station::query()->with('stationType:name','parent:name')->whereHas('stationType',function($query){
+            /** @var Builder $query */
+            $query->where('name','缓存架');
+        })->paginate(100);
+        return view('station.cachingShelf.list.index',compact('stations'));
+    }
+
     /**
      * Show the form for creating a new resource.
      *
@@ -107,4 +123,24 @@ class StationController extends Controller
     {
         //
     }
+
+    /**
+     * @param Request $request
+     * @param $id
+     * @return array
+     */
+    public function cachingShelfApi(Request $request,$id): array
+    {
+        $station = Station::query()->where('id',$id)->with([
+            'stationTypeBinMonitor',
+            'currentStationTask'=>function($query){
+                /** @var Builder $query */
+                $query->with(['stationTaskCommodities'=>function($query){
+                    /** @var Builder $query */
+                    $query->with(['commodity.barcodes','materialBox','batch','materialBox']);
+                }]);
+            }
+        ])->first();
+        return ['success' => true,'data' => $station];
+    }
 }

+ 69 - 0
database/migrations/2021_04_13_140632_add_station_type_and_add_station.php

@@ -0,0 +1,69 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use App\Station;
+use App\StationType;
+use App\Authority;
+
+class AddStationTypeAndAddStation extends Migration
+{
+
+    public $stationTypeNames = ['缓存架'];
+
+    public $stationNames = ['缓存架01', '缓存架02'];
+
+    public $authorityName = ['站管理-缓存架'];
+
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->stationTypeNames as $name) {
+            if (StationType::query()->where('name', $name)->exists()) continue;
+            StationType::query()->create(['name' => $name]);
+        }
+
+        $stationType = StationType::query()->where('name', '缓存架')->first();
+        foreach ($this->stationNames as $stationName) {
+            if (Station::query()->where('name', $stationName)->exists()) continue;
+            Station::query()->create([
+                'name' => $stationName,
+                'code' => $stationName,
+                'station_type_id' => $stationType['id'],
+            ]);
+        }
+
+        foreach ($this->authorityName as $name) {
+            if(Authority::query()->where('name',$name)->exists())continue;
+            Authority::query()->create(['name'=>$name,
+                'alias_name'=>$name]);
+        }
+
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        foreach ($this->stationNames as $stationName) {
+            if (!Station::query()->where('name', $stationName)->exists()) continue;
+            Station::query()->where('name', $stationName)->delete();
+        }
+
+        foreach ($this->stationTypeNames as $name) {
+            if (!Station::query()->where('name', $name)->exists()) continue;
+            Station::query()->where('name', $name)->delete();
+        }
+
+        foreach ($this->authorityName as $name) {
+            if(!Authority::query()->where('name',$name)->exists())continue;
+            Authority::query()->where('name',$name)->delete();
+        }
+    }
+}

+ 53 - 0
resources/views/station/cachingShelf/list/_fillBox.blade.php

@@ -0,0 +1,53 @@
+<div class="modal face" id="box">
+    <div class="modal-dialog ":class="boxClass">
+        <div class="modal-content">
+            <div class="modal-header">
+                <div class="modal-title">入料箱</div>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <input type="text" class="form-control col" @keydown.enter="">
+                </div>
+                <div class="container d-flex  flex-column-reverse">
+                    <div class="row d-flex flex-row-reverse">
+                        <div class="col">
+                            <textarea class="form-control">1</textarea>
+
+                        </div>
+                        <div class="col">
+                            <textarea class="form-control">2</textarea>
+                        </div>
+                        <div class="col">
+                            <textarea class="form-control">3</textarea>
+                        </div>
+                    </div>
+                    <div class="row d-flex flex-row-reverse">
+                        <div class="col">
+                            <textarea class="form-control">4</textarea>
+                        </div>
+                        <div class="col">
+                            <textarea class="form-control">5</textarea>
+                        </div>
+                        <div class="col">
+                            <textarea class="form-control">6</textarea>
+                        </div>
+                    </div>
+                    <div class="row d-flex flex-row-reverse">
+                        <div class="col">
+                            <textarea class="form-control">7</textarea>
+                        </div>
+                        <div class="col">
+                            <textarea class="form-control">8</textarea>
+                        </div>
+                        <div class="col">
+                            <textarea class="form-control">9</textarea>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 55 - 0
resources/views/station/cachingShelf/list/_table.blade.php

@@ -0,0 +1,55 @@
+<table class="table table-striped table-md table-hover" id="table">
+    <thead>
+        <tr>
+            <th>
+                设备id
+            </th>
+            <th>
+                入料箱
+            </th>
+            <th>
+                名称
+            </th>
+            <th>
+                父级设备
+            </th>
+            <th>
+                硬件id
+            </th>
+            <th>
+                备注
+            </th>
+            <th>
+                录入时间
+            </th>
+        </tr>
+        <template v-if="stations.length > 0">
+            <tr v-for="(station,i) in stations" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
+                <td>
+                    @{{ station.id }}
+                </td>
+                <td>
+                    <button class="btn btn-primary" @click="showFeedBox(station)">入料箱</button>
+                </td>
+                <td>
+                    @{{ station.name }}
+                </td>
+                <td>
+                    @{{ station.parent ? station.parent.name  : ''}}
+                </td>
+                <td>
+                    @{{ station.created_at }}
+                </td>
+            </tr>
+        </template>
+        <template v-else>
+            <tr>
+                <td colspan="2">
+                    <div class="alert alert-info">
+                        查询数据为空
+                    </div>
+                </td>
+            </tr>
+        </template>
+    </thead>
+</table>

+ 68 - 0
resources/views/station/cachingShelf/list/index.blade.php

@@ -0,0 +1,68 @@
+@extends('layouts.app')
+
+@section('title','列表')
+
+@section('content')
+    <div id="nav2">
+        @component('station.menu')@endcomponent
+        @component('station.cachingShelf.menu')@endcomponent
+    </div>
+    <div class="container-fluid" id="list">
+        @include('station.cachingShelf.list._table')
+        @include('station.cachingShelf.list._fillBox')
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:'#list',
+            data:{
+                stations:{!! $stations->toJson() !!}['data'],
+                selectTr:null,
+                currentStation:{},
+                boxClass:'modal-sm'
+            },
+            created() {
+            },
+            mounted() {
+                this.initBox();
+            },
+            methods:{
+                initBox(){
+                    if(window.screen.width >= 520) this.boxClass = 'modal-sm';
+                    if(window.screen.width >= 720) this.boxClass = 'modal-md';
+                    if(window.screen.width >= 960) this.boxClass = 'modal-lg';
+                    if(window.screen.width >= 1200) this.boxClass = 'modal-xl';
+                },
+                /** 展示modal */
+                showFeedBox(){
+                    $('#box').modal('show');
+                },
+                getStation(id){
+                    let url = '{{url('apiLocal/station/cachingShelf')}}'+'/'+id;
+                    window.tempTip.setIndex(1099);
+                    window.tempTip.setDuration(3000);
+                    window.axios.get(url).then(res=>{
+                        if(res.data.data){
+                            return ;
+                        }
+                        window.tempTip.show('获取缓存货架信息失败');
+                    }).catch(err=>{
+                        window.tempTip.show('获取缓存货架信息异常:'+err);
+                    });
+                },
+
+                /** 填写九宫格 */
+                fillBoxes(){
+
+                },
+                /** 入箱任务 */
+                inBoxTask(){
+
+                }
+            }
+        })
+    </script>
+@endsection
+

+ 9 - 0
resources/views/station/cachingShelf/menu.blade.php

@@ -0,0 +1,9 @@
+<div class="container-fluid nav3">
+    <div class="card">
+        <ul class="nav nav-pills">
+            <li class="nav-item">
+                <a target="station/cachingShelf/index" class="nav-link" href="{{url('station/cachingShelf/index')}}" :class="{active:isActive('cachingShelf',2)}">列表</a>
+            </li>
+        </ul>
+    </div>
+</div>

+ 7 - 0
routes/apiLocal.php

@@ -162,3 +162,10 @@ Route::group(['prefix' => 'facilitator'], function () {
     Route::delete('destroy', 'FacilitatorController@destroyApi')->name('facilitator.destroyApi');
     Route::post('gainStatement', 'FacilitatorController@gainStatementApi')->name('facilitator.gainStatementApi');
 });
+
+/** 缓存架 */
+Route::group(['prefix' => 'station'],function(){
+    Route::group(['prefix'=>'cachingShelf'],function(){
+        Route::get('/{id}','StationController@cachingShelfApi')->name('station,cachingShelf.cachingShelfApi');
+    });
+});

+ 3 - 0
routes/web.php

@@ -789,6 +789,9 @@ Route::group(['prefix'=>'station'],function(){
         Route::get('/index','StationController@monitorIndex');
         Route::get('/{station}','StationController@monitorShow');
     });
+    Route::group(['prefix'=>'cachingShelf'],function(){
+        Route::get('/index','StationController@cachingShelfIndex');
+    });
 });
 /** 控制台 */
 Route::group(['prefix'=>'control'],function () {