ソースを参照

库存盘点的性能问题

LD 5 年 前
コミット
0a38d86919

+ 1 - 1
app/Http/Controllers/OrderController.php

@@ -20,7 +20,7 @@ use Illuminate\Support\Facades\Http;
 class OrderController extends Controller
 {
     public function delivering(Request $request){
-        if(!Gate::allows('订单管理-查询')){ return redirect(url('/'));  }
+        if(!Gate::allows('订单管理-查询')){ return view('order/index');  }
         /** @var OrderService $orderService */
         $orderService = app('orderService');
         $request = $request->input();

+ 0 - 30
public/t.php

@@ -1,33 +1,3 @@
 <?php
-;
-?>
-<script>
-    // 0.5秒后返回input*input的计算结果:
-    function multiply(input) {
-        return new Promise(function (resolve, reject) {
-            console.log('calculating ' + input + ' x ' + input + '...');
-            setTimeout(resolve, 500, input * input);
-        });
-    }
 
-    // 0.5秒后返回input+input的计算结果:
-    function add(input) {
-        return new Promise(function (resolve, reject) {
-            console.log('calculating ' + input + ' + ' + input + '...');
-            setTimeout(resolve, 500, input + input);
-        });
-    }
 
-    var p = new Promise(function (resolve, reject) {
-        console.log('start new Promise...');
-        resolve(123);
-    });
-
-    p.then(multiply)
-        .then(add)
-        .then(multiply)
-        .then(add)
-        .then(function (result) {
-            console.log('Got value: ' + result);
-        });
-</script>

+ 36 - 18
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -11,7 +11,7 @@
         <div class="mt-3">
             <span class="mt-3" >
                 @can('库存管理-盘点-完结')
-                <span><button class="btn btn-sm btn-outline-info" v-if="inventory.status==='复盘中' &&!listMode" @click="完结盘点任务(inventory.id,inventory.owner.name,inventory.type)">完结</button></span>
+                    <span><button class="btn btn-sm btn-outline-info" v-if="inventory.status==='复盘中' &&!listMode" @click="完结盘点任务(inventory.id,inventory.owner.name,inventory.type)">完结</button></span>
                 @endcan
 
                 @can('库存管理-盘点-查看')
@@ -81,12 +81,16 @@
             <div class="mt-3 form-inline " v-if="!listMode" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'row-cols-3':'row-cols-5'">
         <span class="form-group">
             <label for="location" class="text-secondary font-weight-bold">请输库位</label>
-            <input id="inventoryInput"  v-model="inputs.location" @keypress="locationPress($event)"
+            <input id="inventoryInput"  @keypress="locationPress($event)"
+                   @change="locationChange($event)"
+                   v-bind:value="inputs.location"
                    name="location" type="text" class="form-control  input"  autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
         </span>
                 <span class="form-group ml-4">
             <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
-                <input id="barcode" name="barcode"  @keypress="barcodePress($event)" v-model="inputs.barcode"
+                <input id="barcode" name="barcode"  @keypress="barcodePress($event)"
+                       @change="barcodeChange($event)"
+                       v-bind:value="inputs.barcode"
                        type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control  input" autocomplete="off">
 
         </span>
@@ -350,7 +354,7 @@
                         <td v-if="!listMode">
                             {{--                        <span class="btn  btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>--}}
                             <span class="btn  btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'" @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
-{{--                            <span class="btn  btn-sm btn-outline-secondary" v-if="inventory.type=='动盘'" @click="选中盘点起始位置(inventoryMission.location)">以此为起点</span>--}}
+                            {{--                            <span class="btn  btn-sm btn-outline-secondary" v-if="inventory.type=='动盘'" @click="选中盘点起始位置(inventoryMission.location)">以此为起点</span>--}}
                         </td>
                     @endcan
                 </tr>
@@ -495,6 +499,8 @@
         };
         window.onresize= hideHeaderTitle;
         window.onscroll=hideHeaderTitle;
+
+
         let listVue = new Vue({
             el: "#list",
             data: {
@@ -563,11 +569,8 @@
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
                 $("#list").removeClass('d-none');
 
-                (function 焦点放置(){
-                    let inventoryInput=$('#inventoryInput')
-                    if(inventoryInput.length>0)
-                        $('#inventoryInput').focus()
-                })();
+
+                this.放置焦点光标至正确位置();
                 (function 初始化列表模式(){
                     let listMode=getGetVal('listMode')
                     if(listMode==='true'){_this.listMode=true;return;}
@@ -624,19 +627,31 @@
                 },
                 barcodePress(e){
                     if(e.key==='Enter') {
+                        this.inputs.barcode=e.target.value;
                         this.放置焦点光标至正确位置();
                         this.提交库位和条码();
                     }
                 },
+                barcodeChange(e){
+                    this.inputs.barcode=e.target.value;
+                    this.放置焦点光标至正确位置();
+                    this.提交库位和条码();
+                },
                 amountPress(e){
                     if(e.key==='Enter') this.提交新增并盘点();
                 },
                 locationPress(e){
                     if(e.key==='Enter'){
+                        this.inputs.location=e.target.value;
                         this.放置焦点光标至正确位置();
                         this.提交库位和条码();
                     }
                 },
+                locationChange(e){
+                    this.inputs.location=e.target.value;
+                    this.放置焦点光标至正确位置();
+                    this.提交库位和条码();
+                },
                 selectingRow(e){
                     let id = $(e.target).attr('data_id');
                     this.selectingId=id;
@@ -788,11 +803,9 @@
                                 _this.lastStockInventoryRecord=inventoryMission;
                                 _this.stockInventoryPersons=inventoryMission.stockInventoryPersons;
                                 if (_this.inventory.status!=='复盘中') $("#lastStockInventoryRecord").modal('show');
-                            }else{
-                                //初盘且未盘点过
-                                _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
-                                _this.清空指定盘点记录列();
                             }
+                            _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
+                            _this.清空指定盘点记录列();
                             return false;
                         }
                         return true;
@@ -1007,7 +1020,7 @@
                                     return true
                                 });
                                 _this.重排序并标记全列表类型(_this.inventoryMissions);
-                                _this.inputs={};
+                                _this.清空inputs();
                                 tempTip.setDuration(3000);
                                 tempTip.showSuccess('增加系统之外的盘点记录成功!');
                             }
@@ -1077,7 +1090,7 @@
                                 return true;
                             });
                             _this.重排序并标记全列表类型(_this.inventoryMissions);
-                            _this.inputs={};
+                            _this.清空inputs();
                             tempTip.setDuration(3000);
                             tempTip.showSuccess('盘点成功!');
                         }).catch(function (err) {
@@ -1085,10 +1098,15 @@
                         tempTip.show('盘点失败!'+'网络错误'+err);
                     })
                 },
+                清空inputs(){
+                    for(let key in this.inputs){
+                        this.inputs[key]='';
+                    }
+                },
                 不覆盖(){
                     let _this=this;
                     _this.清空指定盘点记录列();
-                    _this.inputs={};
+                    _this.清空inputs();
                 },
                 覆盖(){
                     let _this=this;
@@ -1099,7 +1117,7 @@
                     let id=_this.selectingId;
                     _this.清空指定盘点记录列();
                     this.盘点(id,location,barcode,inventoryId,count);
-                    _this.inputs={};
+                    _this.清空inputs();
                 },
                 盘点选中任务(id,produced_at,valid_at,batch_number){
                     let _this=this;
@@ -1142,7 +1160,7 @@
                                     return true;
                                 });
                                 _this.重排序并标记全列表类型(_this.inventoryMissions);
-                                _this.inputs={};
+                                _this.清空inputs();
                                 tempTip.setDuration(3000);
                                 tempTip.showSuccess('盘点成功!');
                             }

+ 13 - 0
resources/views/order/index.blade.php

@@ -0,0 +1,13 @@
+@extends('layouts.app')
+@section('title')订单管理@endsection
+
+@section('content')
+    @component('order.menu')@endcomponent
+    <div class="container-fluid">
+
+    </div>
+@endsection
+
+@section('lastScript')
+
+@endsection