Zhouzhendong преди 4 години
родител
ревизия
298c68dde3

+ 19 - 0
app/Http/Controllers/StorageController.php

@@ -392,4 +392,23 @@ sql;
             $this->error($e->getMessage());
         }
     }
+
+    public function bindModelIndex(){
+        $models = MaterialBoxModel::query()->get();
+        return view("store.inStorage.boxBindModel",compact("models"));
+    }
+
+    public function searchIde()
+    {
+        $ide = request("ide");
+        $box = MaterialBox::query()->where("code",$ide)->first();
+        if (!$box)$this->error("料箱不存在");
+        $this->success($box->material_box_model_id);
+    }
+
+    public function boxBindModel()
+    {
+        $this->success(MaterialBox::query()->where("code",request("ide"))
+            ->update(["material_box_model_id"=>request("material_box_model_id")]));
+    }
 }

+ 1 - 0
resources/views/store/inStorage/androidIndex.blade.php

@@ -22,6 +22,7 @@
                 <a href="{{url('store/inStorage/cacheRackStorage')}}"><button class="btn btn-info w-75 text-white" style="height: 60px"><h4>整箱入库</h4></button></a>
                 <a href="{{url('store/inStorage/halfChestStorage')}}"><button class="btn btn-info w-75 mt-3 text-white" style="height: 60px"><h4>半箱入库</h4></button></a>
                 <a href="{{url('store/inStorage/boxBindShelf')}}"><button class="btn btn-info w-75 mt-3 text-white" style="height: 60px"><h4>新箱上架</h4></button></a>
+                <a href="{{url('store/inStorage/boxBindModel')}}"><button class="btn btn-info w-75 mt-3 text-white" style="height: 60px"><h4>料箱型号</h4></button></a>
             </div>
         </div>
     </div>

+ 75 - 0
resources/views/store/inStorage/boxBindModel.blade.php

@@ -0,0 +1,75 @@
+@extends('layouts.app')
+@section('title')料箱绑定货架-入库管理@endsection
+
+@section('content')
+    <div class="container-fluid d-none" id="container">
+        <div class="mt-3 col-8 offset-2">
+            <div class="form-group row">
+                <label for="ide">料箱编码</label>
+                <input id="ide" type="text" class="form-control" v-model="info.ide" @blur="completion()"></input>
+            </div>
+            <div class="form-group row mt-4">
+                <label for="model">选择型号</label>
+                <select class="form-control" id="model" v-model="info.material_box_model_id">
+                    <option v-for="model in models" :value="model.id">@{{ model.description }}</option>
+                </select>
+            </div>
+            <div class="input-group row mt-5">
+                <button type="submit" id="submit" class="btn btn-success offset-2 col-10" @click="submitBind()">提交</button>
+            </div>
+        </div>
+    </div>
+@stop
+
+@section('lastScript')
+    <script type="text/javascript">
+        new Vue({
+            el:"#container",
+            data:{
+                models:[@foreach($models as $model)@json($model),@endforeach],
+                before:{},
+                isAndroid:false,
+                info:{},
+            },
+            mounted(){
+                if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
+                this.createBefore();
+                this.pageInit();
+                $("#container").removeClass("d-none");
+            },
+            methods:{
+                //页面初始化
+                pageInit(){
+                    if (!this.isAndroid)return;
+                    let element = document.getElementById("navbarSupportedContent").parentElement;
+                    element.className = "row";
+                    element.children[0].className += " col-5";
+                    element.children[0].href = "#";
+                    element.innerHTML = element.children[0].outerHTML;
+                    let e1 = document.getElementById("menu");
+                    let e2 = document.getElementById("demand-div");
+                    if (e1)e1.remove();
+                    if (e2)e2.remove();
+                    document.getElementById("container").style.height = (window.innerHeight-100)+"px";
+                },
+                createBefore(){
+                    this.before.ide = 'IDE000000';
+                },
+                completion(){
+                    if(!this.info.ide)return;
+                    let len = this.info.ide.length;
+                    if (len<10)this.info.ide = this.before.ide.substr(0,10-len)+this.info.ide;
+                    window.tempTip.postBasicRequest("{{url('store/inStorage/searchIde')}}",{ide:this.info.ide},res=>{
+                        this.info.material_box_model_id = res;
+                    },true)
+                },
+                submitBind(){
+                    window.tempTip.postBasicRequest("{{url('store/inStorage/boxBindModel')}}",this.info,()=>{
+                        this.info = {};
+                        return "绑定成功";
+                    })
+                },
+            },
+        });
+    </script>
+@stop

+ 3 - 0
routes/web.php

@@ -475,7 +475,10 @@ Route::group(['middleware'=>'auth'],function ($route){
             Route::get('android.index',function (){return view('store.inStorage.androidIndex');});
             Route::post('android.login','StorageController@androidLogin');
             Route::get('boxBindShelf',function (){return view("store.inStorage.bindShelf");});
+            Route::get('boxBindModel','StorageController@bindModelIndex');
             Route::post('bindBox','StorageController@bindBox');
+            Route::post('searchIde','StorageController@searchIde');
+            Route::post('boxBindModel','StorageController@boxBindModel');
         });
         Route::group(['prefix'=>'fast'],function() {
             Route::resource('storeItem','StoreItemController');