Просмотр исходного кода

Merge branch 'master' into zengjun

# Conflicts:
#	resources/views/order/issue/index.blade.php
ajun 5 лет назад
Родитель
Сommit
34ff96d39f

+ 12 - 0
app/Http/Controllers/InventoryAccountController.php

@@ -8,6 +8,7 @@ use App\InventoryAccountMission;
 use App\Owner;
 use App\Services\InventoryAccountService;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
 use Maatwebsite\Excel\Facades\Excel;
 
@@ -101,6 +102,7 @@ class InventoryAccountController extends Controller
         }
         $row=[[
             'id'=>'盘点编号',
+            'status'=>'盘点状态',
             'created_at'=>'创建时间',
             'owner_id'=>'货主',
             'type'=>'任务类型',
@@ -117,6 +119,7 @@ class InventoryAccountController extends Controller
             $inventoryAccount=$inventoryAccounts[$i];
             $w=[
                 'id'=>isset($inventoryAccount->id)?$inventoryAccount->id:'',
+                'status'=>isset($inventoryAccount->status)?$inventoryAccount->status:'',
                 'created_at'=>isset($inventoryAccount->created_at)?$inventoryAccount->created_at:'',
                 'owner_id'=>isset($inventoryAccount->owner->name)?$inventoryAccount->owner->name:'',
                 'type'=>isset($inventoryAccount->type)?$inventoryAccount->type:'',
@@ -132,4 +135,13 @@ class InventoryAccountController extends Controller
         }
         return Excel::download(new Export($row,$list),date('YmdHis', time()).'-盘点任务记录单.xlsx');
     }
+    public function stockInventoryEnd(Request $request){
+        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
+        $id=$request->input('id');
+        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
+        $inventoryAccount=InventoryAccount::query()->where('id',$id)->update(['status'=>'复盘中']);
+        $this->log(__METHOD__,'结束初盘任务'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+        if ($inventoryAccount>0) return ['success'=>true,'data'=>'复盘中'];
+        return ['success'=>false,'data'=>'参数错误!'];
+    }
 }

+ 40 - 0
app/Http/Controllers/InventoryCompareController.php

@@ -2,8 +2,14 @@
 
 namespace App\Http\Controllers;
 
+use App\Imports\InventoryCompareImport;
 use App\InventoryCompare;
+use App\Services\OwnerService;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Gate;
+use Maatwebsite\Excel\Facades\Excel;
 
 class InventoryCompareController extends Controller
 {
@@ -82,4 +88,38 @@ class InventoryCompareController extends Controller
     {
         //
     }
+    function inventoryCompare(Request $request,OwnerService $ownerService){
+        if (!Gate::allows('库存管理-库存-库存对比')){return redirect(url('/')); }
+        $owners = $ownerService->getSelection();
+        $inventoryCompares=app('InventoryCompareService')->getInventoryCompare($request->all());
+        $param = $request->input();
+        return view('inventory.statement.inventoryCompare',compact('owners','inventoryCompares','param'));
+    }
+    function importExcel(Request $request){
+        if (!Gate::allows('库存管理-库存-库存对比')){return redirect(url('/')); }
+        $owner_id=$request->owner_id;
+        if(!$owner_id) return '<h1 class="text-danger">导入Excel失败<br><p style="color: red">您还未选择相应货主!</p></h1>';
+        $fileSuffix = $request->file()['file']->getClientOriginalExtension();
+        if (in_array($fileSuffix, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv','txt'])) {
+            ini_set('max_execution_time', 2100);
+            ini_set('memory_limit', '512M');
+            $extension = $request->file()['file']->getClientOriginalExtension();
+            $extension[0] = strtoupper($extension[0]);
+            Excel::import(new InventoryCompareImport($owner_id), $request->file('file')->path(), null, $extension);
+            if (Cache::has('error')) {
+                return '<h1 class="text-danger">导入Excel失败<br><p style="color: red">' . Cache::pull('error') . '</p></h1>';
+            } else {
+                $exception = Cache::get('exception');
+                $a = '';
+                for ($i = 0; $i < count($exception); $i++) {
+                    $a .= implode(',', $exception[$i]) . '&#10';
+                };
+                $this->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
+                return '<h1 class="text-danger">导入Excel成功<br><textarea style="width: 50%;height: 50%">' . $a . '</textarea></h1>';
+
+            }
+        } else {
+            return '<h1 class="text-danger">失败<br><p style="color: red">不支持该文件类型</p></h1>';
+        }
+    }
 }

+ 0 - 34
app/Http/Controllers/InventoryController.php

@@ -274,38 +274,4 @@ class InventoryController extends Controller
         return ['success'=>true,'data'=>$loggingOwner->owner_id];
     }
 
-    function inventoryCompare(Request $request,OwnerService $ownerService){
-        if (!Gate::allows('库存管理-库存-库存对比')){return redirect(url('/')); }
-        $owners = $ownerService->getSelection();
-        $inventoryCompares=app('inventoryCompareService')->getInventoryCompare($request->all());
-        $param = $request->input();
-        return view('inventory.statement.inventoryCompare',compact('owners','inventoryCompares','param'));
-    }
-    function importExcel(Request $request){
-        if (!Gate::allows('库存管理-库存-库存对比')){return redirect(url('/')); }
-        $owner_id=$request->owner_id;
-        if(!$owner_id) return '<h1 class="text-danger">导入Excel失败<br><p style="color: red">您还未选择相应货主!</p></h1>';
-        $fileSuffix = $request->file()['file']->getClientOriginalExtension();
-        if (in_array($fileSuffix, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv'])) {
-            ini_set('max_execution_time', 2100);
-            ini_set('memory_limit', '512M');
-            $extension = $request->file()['file']->getClientOriginalExtension();
-            $extension[0] = strtoupper($extension[0]);
-            Excel::import(new InventoryCompareImport($owner_id), $request->file('file')->path(), null, $extension);
-            if (Cache::has('error')) {
-                return '<h1 class="text-danger">导入Excel失败<br><p style="color: red">' . Cache::pull('error') . '</p></h1>';
-            } else {
-                $exception = Cache::get('exception');
-                $a = '';
-                for ($i = 0; $i < count($exception); $i++) {
-                    $a .= implode(',', $exception[$i]) . '&#10';
-                };
-                $this->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
-                return '<h1 class="text-danger">导入Excel成功<br><textarea style="width: 50%;height: 50%">' . $a . '</textarea></h1>';
-
-            }
-        } else {
-            return '<h1 class="text-danger">失败<br><p style="color: red">不支持该文件类型</p></h1>';
-        }
-    }
 }

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

@@ -449,7 +449,7 @@ class OrderIssueController extends Controller
                 return ['success' => true, 'order' => $order, 'rejectedBill' => $rejectedBill];
             }
         } else {
-            return ['success' => true, 'meg' => '没有对应的退回单号,但仍可以录入'];
+            return ['success' => true, 'meg' => '没有对应的退回单号,不与WMS同步'];
         }
     }
 

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

@@ -23,6 +23,7 @@ use App\ProcessStatistic;
 use App\Rejected;
 use App\RejectedBill;
 use App\RejectedBillItem;
+use App\Services\InventoryCompareService;
 use App\Unit;
 use App\UploadFile;
 use App\User;
@@ -90,8 +91,11 @@ class TestController extends Controller
     { //x        $packagesBatch=Package::where('batch_number',$batch_number)->first();
 
 
-        $hasSku = OracleBasSKU::query()->where('sku', "2140100024")->where('customerid', "ONKYO")->first();
-        dd($hasSku);
+        $inventoryCompareService = new InventoryCompareService();
+        echo ($inventoryCompareService)->getCreatingMissionCode('安桥主品');
+        echo ($inventoryCompareService)->getCreatingMissionCode('安桥主品');
+        echo ($inventoryCompareService)->getCreatingMissionCode('安桥主品');
+        echo ($inventoryCompareService)->getCreatingMissionCode('安桥主品');
 
     }
 

+ 3 - 1
app/Imports/InventoryCompareImport.php

@@ -82,7 +82,9 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
                     $owner=Owner::find($this->owner_id);
                     $commodityInWMS = OracleBasSKU::query()->where('sku', "$row[$skuName]")->where('customerid', "$owner->code")->first();
                     $commodity=Commodity::query()->firstOrCreate(['owner_id'=>$this->owner_id,'sku'=>$row[$skuName],'name'=>$commodityInWMS['descr_c'],'length'=>$commodityInWMS['skulength'],'width'=>$commodityInWMS['skuwidth'],'height'=>$commodityInWMS['skuhigh'],'volumn'=>$commodityInWMS['skulength']*$commodityInWMS['skuwidth']*$commodityInWMS['skuhigh']]);
-                    $commodity->newBarcode($commodityInWMS['alternate_sku1']);
+                    $barcode = $commodityInWMS['alternate_sku1']??$commodityInWMS['alternate_sku2']??$commodityInWMS['alternate_sku3'];
+                    if($barcode)
+                        $commodity->newBarcode($barcode);
                 }
                 if (!$commodityInWMS){
                     array_push($exception, ['该货主下不存在产品编号:'.$row[$skuName]]);

+ 1 - 1
app/InventoryAccount.php

@@ -11,7 +11,7 @@ class InventoryAccount extends Model
     use ModelTimeFormat;
     use SoftDeletes;
     protected $fillable=[
-        'id','owner_id','type', 'start_at', 'end_at','total','processed','difference','returned','deleted_at','created_at',
+        'id','owner_id','type', 'start_at', 'end_at','total','processed','difference','returned','deleted_at','created_at','status',
     ];
     protected $appends = [
             'surplus','check_surplus'

+ 2 - 0
app/Providers/AppServiceProvider.php

@@ -3,6 +3,7 @@
 namespace App\Providers;
 
 use App\Http\Controllers\Controller;
+use App\Services\InventoryCompareService;
 use App\Services\OrderIssuePerformanceService;
 use Illuminate\Queue\Events\JobFailed;
 use Illuminate\Support\Facades\Queue;
@@ -23,6 +24,7 @@ class AppServiceProvider extends ServiceProvider
     {
         //
         app()->singleton('orderIssuePerformanceService',OrderIssuePerformanceService::class);
+        app()->singleton('InventoryCompareService',InventoryCompareService::class);
     }
 
     /**

+ 1 - 0
app/Services/InventoryAccountService.php

@@ -221,6 +221,7 @@ class InventoryAccountService
         $inventoryAccount->processed=$inventoryAccount->getProcessedAmount();
         $inventoryAccount->difference=$inventoryAccount->getDifferenceAmount();
         $inventoryAccount->returned=$inventoryAccount->getReturnedAmount();
+        $inventoryAccount->status='盘点中';
         $inventoryAccount->update();
         Controller::logS(__METHOD__,"盘点修改盘点任务中的已盘条数__".__FUNCTION__,json_encode($inventoryAccountId));
         return $inventoryAccount;

+ 21 - 25
app/Services/InventoryCompareService.php

@@ -9,12 +9,14 @@ use App\InventoryCompare;
 use App\Owner;
 use App\Services\common\QueryService;
 use Carbon\Carbon;
+use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 use Overtrue\Pinyin\Pinyin;
 use Ramsey\Uuid\Uuid;
 
 class InventoryCompareService
 {
+    static private $missionCode;
     private function conditionQuery($SKU,$LotAtt05,$descr_c){
         $sql='select * from (select result.*,rownum rn from (';
         $sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
@@ -37,10 +39,19 @@ class InventoryCompareService
     }
 
 
-
+    public function getCreatingMissionCode($ownerName=''){
+        if(self::$missionCode)return self::$missionCode;
+        $sequence=Cache::get('InventoryCompareMissionSequence');
+        if(!$sequence||$sequence>998)$sequence=0;
+        $sequence++;
+        Cache::put('InventoryCompareMissionSequence',$sequence,300);
+        $pinyin=new Pinyin();
+        $ownerFirstLetter=strtoupper($pinyin->abbr($ownerName));
+        self::$missionCode= $ownerFirstLetter.date ("ymd").'KCBD'.str_pad($sequence,3,"0",STR_PAD_LEFT);
+        return self::$missionCode;
+    }
     public function createInventoryCompare_underImport($SKU, $customLocation, $amount, $ownerId){
         $owner=Owner::find($ownerId);
-        $ownerName=$owner['name'];
         $request=[
             '产品编码'=>$SKU,
             '属性仓'=>$customLocation,
@@ -51,8 +62,7 @@ class InventoryCompareService
         $ccAmount=0;
         $amountTotal=0;
 
-        $pinyin=new Pinyin();
-        $owner=strtoupper($pinyin->abbr($ownerName));
+        $creatingMissionCode = $this->getCreatingMissionCode($owner['name']);
         $commodityId=Commodity::where('sku',$SKU)->where('owner_id',$ownerId)->value('id');
         $inventoryCompare=new InventoryCompare();
         $inventoryCompare->owner_id=$ownerId;
@@ -64,11 +74,9 @@ class InventoryCompareService
         $inventoryCompare->amount_in_sys=0;
         $inventoryCompare->amount_in_compare=$amount;
         $inventoryCompare->differ=0-$amount;
+        $inventoryCompare->mission_code= $creatingMissionCode;
         $inventoryCompare->save();
-        Controller::logS(__METHOD__,"创建库存对比__".__FUNCTION__,json_encode($request));
-        $mission_code =$owner.date ("ymd").'KCBD'.str_pad($inventoryCompare['id']>99999?$inventoryCompare['id']%99999:$inventoryCompare['id'],4,"0",STR_PAD_LEFT);
-        $inventoryCompare->update(['mission_code' => $mission_code ]);
-        Controller::logS(__METHOD__,"修改库存对比任务号__".__FUNCTION__,json_encode($mission_code));
+        Controller::logS(__METHOD__,"修改库存对比任务号__".__FUNCTION__,json_encode($creatingMissionCode));
         return $inventoryCompare;
     }
     public function createInventoryCompare($SKU,$LotAtt05,$amount,$ownerId){
@@ -102,8 +110,7 @@ class InventoryCompareService
             }
         }
         $unknownStatusAmount=$amountTotal-$ccAmount-$zpAmount;
-        $pinyin=new Pinyin();
-        $owner=strtoupper($pinyin->abbr($ownerName));
+        $creatingMissionCode = $this->getCreatingMissionCode($ownerName);
         $commodityId=Commodity::where('sku',$SKU)->where('owner_id',$ownerId)->value('id');
         $inventoryCompare=new InventoryCompare();
         $inventoryCompare->owner_id=$ownerId;
@@ -111,35 +118,24 @@ class InventoryCompareService
         $inventoryCompare->mission_code=Uuid::uuid1();
         $inventoryCompare->custom_location=$LotAtt05;
         $inventoryCompare->created_at=Carbon::now()->format('Y-m-d H:i:s');
+        $inventoryCompare->mission_code=$creatingMissionCode;
         if ($zpAmount!=0){
             $inventoryCompare->quality='正品';
             $inventoryCompare->amount_in_sys=$zpAmount;
             $inventoryCompare->amount_in_compare=$amount;
             $inventoryCompare->differ=$zpAmount-$amount;
-            $inventoryCompare->save();
-            Controller::logS(__METHOD__,"创建库存对比__".__FUNCTION__,json_encode($request));
-            $mission_code =$owner.date ("ymd").'KCBD'.str_pad($inventoryCompare['id']>99999?$inventoryCompare['id']%99999:$inventoryCompare['id'],4,"0",STR_PAD_LEFT);
-            $inventoryCompare->update(['mission_code' => $mission_code ]);
-            Controller::logS(__METHOD__,"修改库存对比任务号__".__FUNCTION__,json_encode($mission_code));
         }
         if ($ccAmount!=0){
             $inventoryCompare->quality='次品';
             $inventoryCompare['amount_in_sys']=$ccAmount;
-            $inventoryCompare->save();
-            Controller::logS(__METHOD__,"创建库存对比__".__FUNCTION__,json_encode($request));
-            $mission_code =$owner.date ("ymd").'KCBD'.str_pad($inventoryCompare['id']>99999?$inventoryCompare['id']%99999:$inventoryCompare['id'],4,"0",STR_PAD_LEFT);
-            $inventoryCompare->update(['mission_code' => $mission_code ]);
-            Controller::logS(__METHOD__,"修改库存对比任务号__".__FUNCTION__,json_encode($mission_code));
         }
         if ($unknownStatusAmount!=0){
             $inventoryCompare->quality='未知';
             $inventoryCompare->amount_in_sys=$unknownStatusAmount;
-            $inventoryCompare->save();
-            Controller::logS(__METHOD__,"创建库存对比__".__FUNCTION__,json_encode($request));
-            $mission_code =$owner.date ("ymd").'KCBD'.str_pad($inventoryCompare['id']>99999?$inventoryCompare['id']%99999:$inventoryCompare['id'],4,"0",STR_PAD_LEFT);
-            $inventoryCompare->update(['mission_code' => $mission_code ]);
-            Controller::logS(__METHOD__,"修改库存对比任务号__".__FUNCTION__,json_encode($mission_code));
         }
+        $inventoryCompare->save();
+        Controller::logS(__METHOD__,"创建库存对比__".__FUNCTION__,json_encode($request));
+        Controller::logS(__METHOD__,"修改库存对比任务号__".__FUNCTION__,json_encode($creatingMissionCode));
         return $inventoryCompare;
     }
 

+ 1 - 1
database/migrations/2020_07_29_160826_create_order_issues_table.php

@@ -26,7 +26,7 @@ class CreateOrderIssuesTable extends Migration
             $table->string('order_issue_type_id')->nullable()->comment('问题类别');
             $table->string('result_explain')->nullable()->comment('处理结果说明');
             $table->integer('second_order_id')->nullable()->comment('二次订单号');
-            $table->enum('final_status', ['已解决', '待退回', '退回中'])->index()->nullable()->comment('最终态');
+            $table->enum('final_status', ['已解决', '待退回', '退回中'])->index()->nullable()->comment('最终态');
             $table->decimal('logistic_indemnity_money')->index()->nullable()->comment('承运商赔偿金额');
             $table->enum('logistic_express_remission', ['原单减免', '部分减免', '全部减免'])->index()->nullable()->comment('承运商快递减免');
             $table->decimal('baoshi_indemnity_money')->index()->nullable()->comment('宝时赔偿金额');

+ 32 - 0
database/migrations/2020_08_31_102647_add_inventory_accounts_status.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddInventoryAccountsStatus extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('inventory_accounts', function (Blueprint $table) {
+            $table->enum('status',['待盘点','盘点中','复盘中','已完成'])->default('待盘点')->comment('盘点状态');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('inventory_accounts', function (Blueprint $table) {
+            $table->dropColumn('status');
+        });
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
public/js/app.js


+ 1 - 0
resources/views/inventory/statement/inventoryCompare.blade.php

@@ -112,6 +112,7 @@
                     <td>@{{ inventoryCompare.differ }}</td>
                 </tr>
             </table>
+            {{$inventoryCompares->appends($param)->links()}}
         </div>
     </div>
 @endsection

+ 37 - 15
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -29,16 +29,16 @@
 
         <div class="mt-3">
         <span class="h5">
-            <span class="form-group mb-5" v-if="inventory.surplus!=0">
+            <span class="form-group mb-5" v-if="inventory.status=='盘点中' ||inventory.status=='待盘点'">
                 <label class=" font-weight-bold">已盘点:</label><span>@{{ inventory.processed }}/总数:@{{ inventory.total }}</span>
             </span>
-            <span class="form-group mb-5" v-if="inventory.surplus!=0">
+            <span class="form-group mb-5" v-if="inventory.status=='盘点中' ||inventory.status=='待盘点'">
                 <label class=" font-weight-bold">剩余数:</label><span>@{{ inventory.surplus }}</span>
             </span>
-            <span class="form-group mb-5" v-if="inventory.surplus==0">
+            <span class="form-group mb-5" v-if="inventory.status=='复盘中'">
                 <label class=" font-weight-bold">盘点记录数:</label><span>@{{ inventory.total }}</span>
             </span>
-            <span class="form-group mb-5" v-if="inventory.surplus==0">
+            <span class="form-group mb-5" v-if="inventory.status=='复盘中'">
                 <label class=" font-weight-bold">复盘剩余数:</label><span>@{{ inventory.check_surplus }}/复盘总数:@{{ inventory.total }}</span>
             </span>
             </span>
@@ -46,14 +46,15 @@
 
 
         <div class="mt-3" >
-        <span v-if="!listMode" class="btn  col-md-2 font-weight-bold"  style="cursor: default;max-width: 160px" :class="inventory.surplus!=0?'bg-info':'btn-outline-info disabled'">
+        <span v-if="!listMode" class="btn  col-md-2 font-weight-bold"  style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'bg-info':'btn-outline-info disabled'">
             @{{ inventory.type }}
         </span>
-            <span v-if="!listMode" class="btn  col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.surplus!=0?'btn-outline-info disabled':'bg-info'">复盘</span>
+            <span v-if="!listMode && 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="!listMode && 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>
         </div>
 
 
-        <form id="form"  class="mt-3 form-inline " v-if="!listMode" :class="inventory.surplus!=0?'row-cols-3':'row-cols-5'">
+        <form id="form"  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" @keypress="inputSwitch($event)"
@@ -70,7 +71,7 @@
                    name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
         </span>
 
-            <span v-if="inventory.surplus==0">
+            <span v-if="inventory.status=='复盘中'" class="form-group ml-4">
             <label for="count" class="text-secondary font-weight-bold">上一次盘点数</label>
             <span v-if="!inventoryMissionRecord.re_checked_amount">
                 <input type="text" id="count"  @keypress="inputSwitch($event)"
@@ -81,10 +82,10 @@
                        name="count" v-model="inventoryMissionRecord.re_checked_amount" class="form-control  input" readonly>
             </span>
         </span>
-            <span v-if="inventory.surplus==0">
+            <span v-if="inventory.status=='复盘中'" class="form-group ml-4">
             <label for="count" class="text-secondary font-weight-bold">盘点差异数</label>
-            <input type="text" id="count"  @keypress="inputSwitch($event)"
-                   name="count" v-model="inventoryMissionRecord.difference_amount" class="form-control  input" readonly>
+            <input type="text" id="difference_amount"  @keypress="inputSwitch($event)"
+                   name="difference_amount" v-model="inventoryMissionRecord.difference_amount" class="form-control  input" readonly>
         </span>
         </form>
 
@@ -137,7 +138,7 @@
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">库位:</span><span style="color:#af7651">@{{ inventoryMission.location }}</span></span>
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品名称:</span><span style="color:#af7651" v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</span></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.surplus==0">
+                            <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>
@@ -187,8 +188,9 @@
                         let inputs = $("#form .input");
                         let idx = inputs.index($(e.target));     // 获取当前焦点输入框所处的位置
                         let location=document.getElementById('inventoryInput').value;
+                        console.log(idx)
                         if (idx == 2) {       // 判断是否是最后一个输入框
-                            if (location==''||location==undefined||location==null){
+                            if (location==''){
                                 document.getElementById('inventoryInput').focus();
                                 return;
                             }
@@ -219,8 +221,10 @@
                         barcodes.push(inventoryMission.commodity.barcode);
                     });
                     if (!barcodes.includes(barcode)){
-                        tempTip.setDuration(2000);
-                        tempTip.show('输入的产品条码没有对应的产品!');
+                        if (barcode!=''){
+                            tempTip.setDuration(2000);
+                            tempTip.show('输入的产品条码没有对应的产品!');
+                        }
                     }else {
                         //根据该库存和产品条码查询该条盘点记录
                         let url='{{url('inventory/searchStockInventoryRecord')}}';
@@ -276,6 +280,24 @@
                         tempTip.show('盘点失败!'+'网络错误'+err);
                     })
                 },
+                //结束初盘任务
+                stockInventoryEnd(id){
+                    let _this=this;
+                    let url='{{url('inventory/stockInventoryEnd')}}';
+                    axios.post(url,{id:id}).then(function (response) {
+                        if (!response.data.success){
+                            tempTip.setDuration(2000);
+                            tempTip.show('结束初盘失败!'+'   '+response.data.data);
+                        }else {
+                            _this.inventory.status=response.data.data;
+                            tempTip.setDuration(2000);
+                            tempTip.showSuccess('结束初盘,进入复盘!');
+                        }
+                    }).catch(function (err) {
+                        tempTip.setDuration(2000);
+                        tempTip.show('结束初盘失败!'+'网络错误'+err);
+                    })
+                },
             }
         });
     </script>

+ 2 - 0
resources/views/inventory/stockInventory/mission.blade.php

@@ -34,6 +34,7 @@
                 </th>
                 <th>操作</th>
                 <th>序号</th>
+                <th>盘点状态</th>
                 <th>盘点单号</th>
                 <th>创建时间</th>
                 <th>货主</th>
@@ -56,6 +57,7 @@
                     <a :href="'{{url('inventory/stockInventory/enterStockInventory')}}/'+inventory.id+'?listMode=true'"><button class="btn btn-sm btn-outline-dark">查看</button></a>
                 </td>
                 <td >@{{ i+1 }}</td>
+                <td >@{{ inventory.status }}</td>
                 <td >@{{ inventory.id }}</td>
                 <td >@{{ inventory.created_at }}</td>
                 <td ><span v-if="inventory.owner">@{{ inventory.owner.name }}</span></td>

+ 1 - 1
resources/views/order/issue/index.blade.php

@@ -65,7 +65,7 @@
                             <th class=" align-middle" rowspan="2" style=" min-width: 75px;">置顶</th>
                         @endcan
                         <th class=" align-middle" rowspan="2" style=" min-width: 100px;">退单状态</th>
-                        <th class="  align-middle" rowspan="2" style="min-width: 120px">最终状态</th>
+                        <th class=" align-middle" rowspan="2" style="min-width: 120px">最终状态</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 165px;">登记日期</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 165px;">订单日期</th>
                         <th class=" align-middle td-yellow" rowspan="2" style="min-width: 100px;">客户</th>

+ 4 - 2
routes/web.php

@@ -304,6 +304,8 @@ Route::group(['prefix'=>'inventory'],function (){
     Route::get('stockInventory/mission','InventoryAccountController@mission');
     //创建盘点任务
     Route::post('stockInventory/createStockInventoryMission','InventoryAccountController@createStockInventoryMission');
+    //结束初盘任务
+    Route::post('stockInventoryEnd','InventoryAccountController@stockInventoryEnd');
     //删除盘点任务
     Route::any('deleteStockInventoryMission/{id}','InventoryAccountController@deleteStockInventoryMission');
     //进入盘点或者复盘页面
@@ -320,9 +322,9 @@ Route::group(['prefix'=>'inventory'],function (){
     Route::post('searchStockInventoryRecord','InventoryAccountController@searchStockInventoryRecord');
 
     //库存对比
-    Route::get('statement/inventoryCompare','InventoryController@inventoryCompare');
+    Route::get('statement/inventoryCompare','InventoryCompareController@inventoryCompare');
     //库存对比批量导入
-    Route::post('inventoryCompare/import/excel','InventoryController@importExcel');
+    Route::post('inventoryCompare/import/excel','InventoryCompareController@importExcel');
 
     Route::post('statement/dailyLog/addLoggingOwner','InventoryController@addLoggingOwner');
 });

Некоторые файлы не были показаны из-за большого количества измененных файлов