소스 검색

库存复盘的前端控制和显示功能

LD 5 년 전
부모
커밋
acd4a48d1d

+ 6 - 2
app/Http/Controllers/InventoryAccountController.php

@@ -71,9 +71,13 @@ class InventoryAccountController extends Controller
         $inventoryId=$request->input('inventoryId');
         $count=$request->input('count');
         if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
-        $inventoryAccountMission=app('inventoryAccountService')->stockInventory($location,$barcode,$count,$inventoryId);
+        /** @var InventoryAccountService $inventoryAccountMission */
+        $inventoryAccountService=app('inventoryAccountService');
+        $inventoryAccountMission=$inventoryAccountService->stockInventory($location,$barcode,$count,$inventoryId);
         if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
-        $inventoryAccount=app('inventoryAccountService')->updateInventory($inventoryId);
+        /** @var InventoryAccountService $inventoryService */
+        $inventoryService=app('inventoryAccountService');
+        $inventoryAccount=$inventoryService->updateInventory($inventoryId);
         return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount];
     }
     //根据该库存和产品条码查询该条盘点记录

+ 8 - 6
app/Services/InventoryAccountService.php

@@ -192,18 +192,19 @@ class InventoryAccountService
         })->where('location',$location)->where('inventory_account_id',$inventoryAccountId)->first();
         if (!$inventoryAccountMission) return null;
         $inventory=InventoryAccount::find($inventoryAccountId);
-        if ($inventory->surplus!=0){
-            $inventoryAccountMission->verified_amount=$count;
-            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
-            $inventoryAccountMission->checked='是';
-        }else{
+        if($inventory->status=='复盘中'){
             $inventoryAccountMission->re_checked_amount=$count;
             $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
+            $inventoryAccountMission->checked='已复核';
             if ($inventoryAccountMission->difference_amount==0){
                 $inventoryAccountMission->returned='是';
             }else{
                 $inventoryAccountMission->returned='否';
             }
+        }else{
+            $inventoryAccountMission->verified_amount=$count;
+            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
+            $inventoryAccountMission->checked='是';
         }
         $inventoryAccountMission->update();
         $request=[
@@ -221,7 +222,8 @@ class InventoryAccountService
         $inventoryAccount->processed=$inventoryAccount->getProcessedAmount();
         $inventoryAccount->difference=$inventoryAccount->getDifferenceAmount();
         $inventoryAccount->returned=$inventoryAccount->getReturnedAmount();
-        $inventoryAccount->status='盘点中';
+        if($inventoryAccount->status=='待盘点')
+            $inventoryAccount->status='盘点中';
         $inventoryAccount->update();
         Controller::logS(__METHOD__,"盘点修改盘点任务中的已盘条数__".__FUNCTION__,json_encode($inventoryAccountId));
         return $inventoryAccount;

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 146 - 342
composer.lock


+ 33 - 0
database/migrations/2020_09_01_111054_change_inventory_account_mission_column_checked_to_three.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeInventoryAccountMissionColumnCheckedToThree extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核') default '否'");
+        Schema::table('inventory_account_missions', function (Blueprint $table) {
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否') default '否'");
+        Schema::table('inventory_account_missions', function (Blueprint $table) {
+        });
+    }
+}

+ 3 - 3
public/js/app.js

@@ -61974,8 +61974,8 @@ module.exports = tempTip;
 /*! no static exports found */
 /***/ (function(module, exports, __webpack_require__) {
 
-__webpack_require__(/*! D:\wamp64\www\bswas\resources\js\app.js */"./resources/js/app.js");
-module.exports = __webpack_require__(/*! D:\wamp64\www\bswas\resources\sass\app.scss */"./resources/sass/app.scss");
+__webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\js\app.js */"./resources/js/app.js");
+module.exports = __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\sass\app.scss */"./resources/sass/app.scss");
 
 
 /***/ }),
@@ -61991,4 +61991,4 @@ module.exports = __webpack_require__(/*! D:\wamp64\www\bswas\resources\sass\app.
 
 /***/ })
 
-/******/ });
+/******/ });

+ 8 - 3
public/t.php

@@ -2,7 +2,12 @@
 ;
 ?>
 <script>
-    (function t(){
-        alert(22);
-    })();
+    let a=[3,5,1]
+    a.sort(function(a,b){
+        console.log(a,b)
+        if(a>b)return 1;
+        if(a<b)return -1;
+        return 0;
+    })
+    console.log(a)
 </script>

+ 16 - 18
resources/sass/layout.scss

@@ -27,7 +27,7 @@
     }
 }
 
-table{
+table,table.table-striped tbody{
     th {
         padding-bottom: 0;
         &.table-header-layer-1{
@@ -59,7 +59,7 @@ table{
             background: #f8eea0;
         }
     }
-    td{
+    td,tr:nth-of-type(odd){
         &.td-warm{
             background: rgb(246, 238, 232);
         }
@@ -74,7 +74,7 @@ table{
         }
     }
 
-    tr:nth-child(even) td{
+    tr:nth-child(even) td, tr:nth-child(even){
         &.td-warm{
             background: rgb(248, 244, 241);
         }
@@ -88,24 +88,22 @@ table{
             background: #f8f5e4;
         }
     }
-    tr:hover{
-        td{
-            &.td-warm{
-                background: rgb(246, 233, 220);
-            }
-            &.td-cool{
-                background: #d3e0f1;
-            }
-            &.td-helpful{
-                background: #d7f3e5;
-            }
-            &.td-yellow{
-                background: #fdf3db;
-            }
+    tr:hover td, tr:hover {
+        &.td-warm{
+            background: rgb(246, 233, 220);
+        }
+        &.td-cool{
+            background: #d3e0f1;
+        }
+        &.td-helpful{
+            background: #d7f3e5;
+        }
+        &.td-yellow{
+            background: #fdf3db;
         }
     }
 }
 .row-even{
-   background-color: rgba(0, 0, 0, .05)
+    background-color: rgba(0, 0, 0, .05)
 }
 

+ 140 - 32
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -50,8 +50,8 @@
             @{{ inventory.type }}
         </span>
             <span v-if="!listMode">
-            <span v-if="inventory.status=='盘点中' ||inventory.status=='待盘点'" class="btn  col-md-2 font-weight-bold btn-outline-secondary" style="max-width: 160px" @click="stockInventoryEnd(inventory.id)">结束</span>
-            <span v-if="inventory.status=='复盘中'" class="btn  col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'btn-outline-info disabled':'bg-info'">复盘</span>
+            <span v-if="inventory.status==='盘点中' ||inventory.status=='待盘点'" class="btn  col-md-2 font-weight-bold btn-outline-secondary" style="max-width: 160px" @click="stockInventoryEnd(inventory.id)">结束</span>
+            <span v-if="inventory.status==='复盘中'" class="btn  col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'btn-outline-info disabled':'bg-info'">复盘</span>
         </span>
         </div>
 
@@ -92,7 +92,7 @@
         </form>
 
 
-        <table class="table table-sm table-striped table-bordered table-hover text-nowrap d-none d-sm-block  mt-2">
+        <table class="table table-sm table-striped table-bordered table-hover text-nowrap d-none d-md-block  mt-2">
             <tr>
                 <th>序号</th>
                 <th>库位</th>
@@ -111,7 +111,14 @@
                 <th>盘点差异</th>
                 <th>分配数量</th>
             </tr>
-            <tr v-for="(inventoryMission,i) in inventoryMissions" v-if="inventoryMission.checked=='是'||listMode"  @click="selectedColor(inventoryMission.id)" :style="{'font-weight': inventory.id==selectedStyle?'bold':''}">
+            <tr v-for="(inventoryMission,i) in inventoryMissions" v-if="inventoryMission.checked==='是'||inventory.status==='复盘中'||listMode"  @click="selectedColor(inventoryMission.id)"
+                :style="{'font-weight': inventory.id==selectedStyle?'bold':''}" :class="[
+                    inventoryMission.mark==='已复盘有差异'?'td-cool':'',
+                    inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
+                    inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
+                    inventoryMission.mark==='无差异'?'text-muted':'',
+                    inventoryMission.mark==='未盘'?'td-yellow':'',
+                    ]">
                 <td>@{{ i+1 }}</td>
                 <td>@{{ inventoryMission.location }}</td>
                 <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</td>
@@ -138,9 +145,16 @@
             </tr>
         </table>
 
-        <table class="table table-striped table-sm table-bordered table-hover p-0 d-block d-sm-none" style="background: rgb(255, 255, 255);" >
+        <table class="table table-striped table-sm table-bordered table-hover p-0 d-block d-md-none" style="background: rgb(255, 255, 255);" >
             <tbody>
-            <tr v-for="inventoryMission in inventoryMissions" v-if="inventoryMission.checked=='是'||listMode">
+            <tr v-for="inventoryMission in inventoryMissions" v-if="inventoryMission.checked==='是'||inventory.status==='复盘中'||listMode"
+                :class="[
+                    inventoryMission.mark==='已复盘有差异'?'td-cool':'',
+                    inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
+                    inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
+                    inventoryMission.mark==='无差异'?'text-muted':'',
+                    inventoryMission.mark==='未盘'?'td-yellow':'',
+                    ]">
                 <td style="filter:grayscale(30%); ">
                     <div  class="mt-3">
                         <div style="transform:scale(0.9)" class="pl-0">
@@ -156,7 +170,7 @@
                     </select>
                             </span>
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品条码:</span><span style="color:#af7651" v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</span></span>
-                            <div v-if="inventory.status=='复盘中'">
+                            <div v-if="inventory.status==='复盘中'">
                                 <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点数量:</span><span style="color:#af7651">@{{ inventoryMission.verified_amount }}</span></span>
                                 <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">复盘数量:</span><span style="color:#af7651">@{{ inventoryMission.re_checked_amount }}</span></span>
                                 <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点差异:</span><span >@{{ inventoryMission.difference_amount }}</span></span>
@@ -183,6 +197,10 @@
                 selectedStyle:'',
                 inventoryMissionRecord:{},
                 listMode:false,
+                中:'3232lll',
+            },
+            beforeMount: function () {
+                this.重排序并标记全列表类型();
             },
             mounted: function () {
                 let _this=this;
@@ -206,7 +224,6 @@
                         let inputs = $("#form .input");
                         let idx = inputs.index($(e.target));     // 获取当前焦点输入框所处的位置
                         let location=document.getElementById('inventoryInput').value;
-                        console.log(idx)
                         if (idx == 2) {       // 判断是否是最后一个输入框
                             if (location==''){
                                 document.getElementById('inventoryInput').focus();
@@ -231,7 +248,7 @@
                 //验证输入盘点产品条码对应是否有商品
                 searchBarcode(){
                     let _this=this;
-                    let barcode=document.getElementById('barcode').value;
+                    let barcode=document.getElementById('barcode').value.trim();
                     let location=document.getElementById('inventoryInput').value;
                     let inventoryId=_this.inventory.id;
                     let barcodes=[];
@@ -263,36 +280,38 @@
                 submitStockInventory(){
                     let _this=this;
                     let url='{{url('inventory/stockInventory')}}';
-                    let location=document.getElementById('inventoryInput').value;
-                    let barcode=document.getElementById('barcode').value;
-                    let count=document.getElementById('count').value;
+                    let location=document.getElementById('inventoryInput').value.trim();
+                    let barcode=document.getElementById('barcode').value.trim();
+                    let count=document.getElementById('count').value.trim();
                     let inventoryId=_this.inventory.id;
                     axios.post(url,{location:location,barcode:barcode,count:count,inventoryId:inventoryId})
                         .then(function (response) {
                             if (!response.data.success){
                                 tempTip.setDuration(2000);
                                 tempTip.show('盘点失败!'+'   '+response.data.data);
-                            }else {
-                                if (_this.inventory.id==response.data.inventory.id){
-                                    _this.inventory.processed=response.data.inventory.processed;
-                                    _this.inventory.surplus=response.data.inventory.surplus;
-                                    _this.inventory.check_surplus=response.data.inventory.check_surplus;
-                                }
-                                _this.inventoryMissions.every(function (inventoryMission,i) {
-                                    if (inventoryMission.id==response.data.inventoryMission.id){
-                                        inventoryMission.checked=response.data.inventoryMission.checked;
-                                        inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
-                                        inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
-                                        inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
-                                        _this.inventoryMissions.splice(i,1)
-                                        _this.inventoryMissions.unshift(inventoryMission);
-                                        return false;
-                                    }
-                                    return true;
-                                });
-                                tempTip.setDuration(3000);
-                                tempTip.showSuccess('盘点成功!');
+                                return;
                             }
+                            if (_this.inventory.id===response.data.inventory.id){
+                                _this.inventory.processed=response.data.inventory.processed;
+                                _this.inventory.surplus=response.data.inventory.surplus;
+                                _this.inventory.check_surplus=response.data.inventory.check_surplus;
+                            }
+                            _this.inventoryMissions.every(function (inventoryMission,i) {
+                                if (inventoryMission.id===response.data.inventoryMission.id){
+                                    inventoryMission.checked=response.data.inventoryMission.checked;
+                                    inventoryMission.verified_amount=response.data.inventoryMission.verified_amount;
+                                    inventoryMission.difference_amount=response.data.inventoryMission.difference_amount;
+                                    inventoryMission.re_checked_amount=response.data.inventoryMission.re_checked_amount;
+                                    _this.inventoryMissions.splice(i,1)
+                                    _this.inventoryMissions.unshift(inventoryMission);
+                                    return false;
+                                }
+                                return true;
+                            });
+                            _this.重排序并标记全列表类型(_this.inventoryMissions);
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('盘点成功!');
+
                         }).catch(function (err) {
                         tempTip.setDuration(2000);
                         tempTip.show('盘点失败!'+'网络错误'+err);
@@ -316,6 +335,95 @@
                         tempTip.show('结束初盘失败!'+'网络错误'+err);
                     })
                 },
+                重排序并标记全列表类型(){
+                    let _this=this;
+                    _this.已复盘有差异列=[];
+                    _this.未复盘有差异列=[];
+                    _this.已复盘无差异列=[];
+                    _this.无差异列=[];
+                    _this.未盘列=[];
+                    _this.inventoryMissions.forEach(function (mission,i){
+                        switch(mission.checked){
+                            case '已复核':
+                                if(mission.difference_amount){_this.已复盘有差异列.push(mission); mission.mark='已复盘有差异';return;}
+                                _this.已复盘无差异列.push(mission); mission.mark='已复盘无差异'; return;
+                            case '是':
+                                if(mission.difference_amount){_this.未复盘有差异列.push(mission); mission.mark='未复盘有差异'; return;}
+                                _this.无差异列.push(mission); mission.mark='无差异'; return;
+                            case '否':
+                                _this.未盘列.push(mission); mission.mark='未盘'; return;
+                        }
+                    });
+                    _this.已复盘有差异列=_this.按库位排序_且合并SKU一起(_this.已复盘有差异列);
+                    _this.未复盘有差异列=_this.按库位排序_且合并SKU一起(_this.未复盘有差异列);
+                    _this.已复盘无差异列=_this.按库位排序_且合并SKU一起(_this.已复盘无差异列);
+                    _this.无差异列=_this.按库位排序_且合并SKU一起(_this.无差异列);
+                    _this.未盘列=_this.按库位排序_且合并SKU一起(_this.未盘列);
+                    function 重推入(目标数组,推入数组){
+                        推入数组.forEach(function (元素){
+                            目标数组.push(元素);
+                        })
+                    }
+                    _this.inventoryMissions=[];
+                    重推入(_this.inventoryMissions,_this.已复盘有差异列);
+                    重推入(_this.inventoryMissions,_this.未复盘有差异列);
+                    重推入(_this.inventoryMissions,_this.未盘列);
+                    重推入(_this.inventoryMissions,_this.已复盘无差异列);
+                    重推入(_this.inventoryMissions,_this.无差异列);
+                },
+                按库位排序_且合并SKU一起(inventoryMissions){
+                    let 结果列=[];
+                    let 已出现字典列=[];
+                    inventoryMissions.sort(function(a,b){
+                        if(a.location>b.location)return 1;
+                        if(a.location<b.location)return -1;
+                        return 0;
+                    })
+                    function 迭代查重转移(目标列,进度下标){
+                        if(!进度下标){
+                            进度下标=0;
+                        }
+                        for(;进度下标<目标列.length;进度下标++){
+                            let 目标=目标列[进度下标];
+                            if(已出现字典列[目标.commodity.barcode]===true){
+                                目标列.splice(进度下标,1)
+                                let 最后一次重复下标=-1;//为了给相同条码依次排序设定
+                                结果列.some(function(结果,i){
+                                    if(结果.commodity.barcode===目标.commodity.barcode){
+                                        最后一次重复下标=i;
+                                        if(最后一次重复下标===结果列.length-1){
+                                            结果列.splice(最后一次重复下标+1,0,目标);
+                                            return true;
+                                        }
+                                    }
+                                    else if(最后一次重复下标>-1){
+                                        结果列.splice(最后一次重复下标+1,0,目标);
+                                        return true;
+                                    }
+                                    return false;
+                                })
+                                迭代查重转移(目标列,进度下标);
+                                return;
+                            }
+                            已出现字典列[目标.commodity.barcode]=true;
+                            结果列.push(目标);
+                        }
+                    }
+                    迭代查重转移(inventoryMissions)
+                    return 结果列;
+                }
+                ,
+                // 单条排序并着色(inventoryMission){
+                //     let _this=this;
+                //     let 所在临时分类列=[];
+                //     switch(inventoryMission.mark){
+                //         case '已复盘有差异':所在临时分类列=_this.已复盘有差异列;break;
+                //         case '已复盘无差异':所在临时分类列=_this.已复盘无差异列;break;
+                //         case '未复盘有差异':所在临时分类列=_this.未复盘有差异列;break;
+                //         case '无差异':所在临时分类列=_this.无差异列;break;
+                //         case '未盘':所在临时分类列=_this.未盘列;break;
+                //     }
+                // },
             }
         });
     </script>

+ 1 - 1
resources/views/layouts/app.blade.php

@@ -10,7 +10,7 @@
     <title>@yield('title') {{ config('app.name', '宝时WAS') }}</title>
     @yield('head')
     <!-- Styles -->
-    <link href="{{ asset('css/app200811.css') }}" rel="stylesheet">
+    <link href="{{ asset('css/app200901.css') }}" rel="stylesheet">
 </head>
 <body>
 <div id="app">

+ 1 - 1
webpack.mix.js

@@ -12,7 +12,7 @@ const mix = require('laravel-mix');
  */
 
 mix.js('resources/js/app.js', 'public/js')
-    .sass('resources/sass/app.scss', 'public/css/app200811.css');
+    .sass('resources/sass/app.scss', 'public/css/app200901.css');
 mix.copy('resources/sass/fonts/','public/fonts');
 mix.copy('resources/icon','public/icon');
 mix.copy('resources/images','public/images');

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.