Ver Fonte

导入多工作表问题

Zhouzhendong há 5 anos atrás
pai
commit
32694e2b2c

+ 2 - 3
app/Http/Controllers/StoreCheckingReceiveController.php

@@ -2,7 +2,7 @@
 
 namespace App\Http\Controllers;
 
-use App\Imports\StoreCheckingReceiveImport;
+use App\Imports\StoreCheckingReceiveSheets;
 use App\Services\CommodityService;
 use App\Services\LogService;
 use App\Services\OracleDocAsnDetailService;
@@ -33,11 +33,10 @@ class StoreCheckingReceiveController extends Controller
         $fileSuffix=$request->file('file')->getClientOriginalExtension();
         if ($fileSuffix != 'xlsx' && $fileSuffix != 'xls' && $fileSuffix != 'csv')
             return ['success'=>false,'data'=>'不支持该文件类型'];
-        $isCovering = $request->input('isCovering');
         ini_set('max_execution_time',2500);
         ini_set('memory_limit','1526M');
         $fileSuffix = ucwords($fileSuffix);
-        Excel::import(new StoreCheckingReceiveImport($isCovering),$request->file('file')->path(),null,$fileSuffix);
+        Excel::import(new StoreCheckingReceiveSheets(),$request->file('file')->path(),null,$fileSuffix);
         if (Cache::has('storeCheckingReceive')){
             return Cache::pull('storeCheckingReceive');
         }

+ 0 - 13
app/Imports/StoreCheckingReceiveImport.php

@@ -14,17 +14,6 @@ use Maatwebsite\Excel\Imports\HeadingRowFormatter;
 HeadingRowFormatter::default('none');
 class StoreCheckingReceiveImport implements ToCollection,WithHeadingRow
 {
-    /** @var bool $isOverride
-     *  是否覆盖
-     */
-    protected $isOverride;
-    protected $count;
-    protected $targetCount;
-    public function __construct($isOverride, int $targetCount = 1)
-    {
-        $this->targetCount = $targetCount;
-        $this->isOverride=$isOverride ? true : false;
-    }
 
     /**
      * @param Collection $collection
@@ -33,8 +22,6 @@ class StoreCheckingReceiveImport implements ToCollection,WithHeadingRow
     */
     public function collection(Collection $collection)
     {
-        if ($this->count == $this->targetCount)return false;
-        else $this->count++;
         $row = $collection->first();
         $header = [
             "货主","SKU","商品名称","条码","数量","生产日期","失效日期","批号","唯一码"

+ 17 - 0
app/Imports/StoreCheckingReceiveSheets.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Imports;
+
+use Maatwebsite\Excel\Concerns\WithMultipleSheets;
+
+class StoreCheckingReceiveSheets implements WithMultipleSheets
+{
+    public function sheets(): array
+    {
+        // TODO: Implement sheets() method.
+        return [
+          0 => new StoreCheckingReceiveImport(),
+        ];
+    }
+
+}

+ 6 - 14
resources/js/utilities/tempTip.js

@@ -13,32 +13,24 @@ const tempTip={
         this.inputType=type;
     },
     showSuccess:function(text){
-        let parWidth = document.body.offsetWidth;
-        let parHeight = document.body.offsetHeight;
-        let parentDom = $("<div style='top: 0;left: 0;width: "+parWidth+"px;height: "+parHeight+"px;position:fixed'></div>");
-        let tiper=$("<div class='row' style='color:white;opacity:0.9;position: relative;top:40%;transform:translateY(-50%);z-index:"+this.index+";width:100%;'>" +
+        let tiper=$("<div class='row' style='color:white;opacity:0.9;position: fixed;top:40%;transform:translateY(-50%);z-index:"+this.index+";width:100%;'>" +
             "<div class='col-8 offset-2'><div class='card'><div class='card-body h4 bg-success text-center'>" +
             text +
             "</div></div></div></div>");
         tiper.animate({opacity:'0'},this.fadingDuration,'swing',function () {
-            parentDom.remove();
+            tiper.remove();
         });
-        parentDom.append(tiper);
-        $('body').append(parentDom);
+        $('body').append(tiper);
     },
     show:function(text){
-        let parWidth = document.body.offsetWidth;
-        let parHeight = document.body.offsetHeight;
-        let parentDom = $("<div style='top: 0;left: 0;width: "+parWidth+"px;height: "+parHeight+"px;position:fixed'></div>");
-        let tiper=$("<div class='row' style='color:white;opacity:0.9;top:40%;position: relative;transform:translateY(-50%);width:100%;z-index:"+this.index+";'>" +
+        let tiper=$("<div class='row' style='color:white;opacity:0.9;top:40%;position: fixed;transform:translateY(-50%);width:100%;z-index:"+this.index+";'>" +
             "<div class='col-8 offset-2'><div class='card'><div class='card-body h2 bg-danger text-center'>" +
             text +
             "</div></div></div></div>");
         tiper.animate({opacity:'0'},this.fadingDuration,'swing',function () {
-            parentDom.remove();
+            tiper.remove();
         });
-        parentDom.append(tiper);
-        $('body').append(parentDom);
+        $('body').append(tiper);
     },
     okWindow:function(text,okText){
         let bg=$("<div style='opacity:0.4;position:fixed;top:0;width:100%;height:100%;z-index:"+this.index+";background-color:#000;'></div>" );

+ 31 - 24
resources/views/store/checkingReceive/show.blade.php

@@ -87,34 +87,41 @@
             @can('入库管理-盘收一体-盘收-编辑')<button type="button" v-if="storeCheckingReceive.status != '已收货'" class="btn btn-sm btn-outline-success" data-toggle="modal" data-target="#asnWindow">匹配ASN单据</button>@endcan
         </div>
         <div class="row text-primary ml-1 mr-2 mt-1 mb-1 w-100" style="background-color: #c3e3b5">
-            <span class="ml-1">任务ID: <b class="text-dark">@{{ storeCheckingReceive.id }}</b></span>
-            <span class="ml-3">货主: <b class="text-dark">@{{ storeCheckingReceive.owner_name }}</b></span>
-            <span class="ml-3">创建时间: <b class="text-dark">@{{ storeCheckingReceive.created_at }}</b></span>
-            <span class="ml-3">ASN号: <b class="text-dark">@{{ storeCheckingReceive.asn }}</b></span>
+            <span class="ml-md-1">任务ID: <b class="text-dark">@{{ storeCheckingReceive.id }}</b></span>
+            <span class="ml-md-3">货主: <b class="text-dark">@{{ storeCheckingReceive.owner_name }}</b></span>
+            <span class="ml-md-3">创建时间: <b class="text-dark">@{{ storeCheckingReceive.created_at }}</b></span>
+            <span class="ml-md-3">ASN号: <b class="text-dark">@{{ storeCheckingReceive.asn }}</b></span>
         </div>
-        <table class="table table-sm text-nowrap table-bordered d-none" id="headerRoll"></table>
-        <table class="table table-striped table-sm text-nowrap table-hover mt-1" id="headerParent">
-            <tr id="header"></tr>
-            <tr v-for="(storeCheckingReceiveItem,i) in storeCheckingReceiveItems">
-                <td>@{{ i+1 }}</td>
-                <td>@{{ storeCheckingReceiveItem.bin_number }}</td>
-                <td>@{{ storeCheckingReceiveItem.commodity_name }}</td>
-                <td>
+        <!-- pc -->
+        <div class="d-none d-sm-block">
+            <table class="table table-sm text-nowrap table-bordered d-none" id="headerRoll"></table>
+            <table class="table table-striped table-sm text-nowrap table-hover mt-1" id="headerParent">
+                <tr id="header"></tr>
+                <tr v-for="(storeCheckingReceiveItem,i) in storeCheckingReceiveItems">
+                    <td>@{{ i+1 }}</td>
+                    <td>@{{ storeCheckingReceiveItem.bin_number }}</td>
+                    <td>@{{ storeCheckingReceiveItem.commodity_name }}</td>
+                    <td>
                     <span v-for="commodity_barcode in storeCheckingReceiveItem.commodity_barcodes">
                         <small>@{{ commodity_barcode.code }}</small><br>
                     </span>
-                </td>
-                <td>@{{ storeCheckingReceiveItem.imported_amount }}</td>
-                <td>@{{ storeCheckingReceiveItem.counted_amount }}</td>
-                <td>@{{ storeCheckingReceiveItem.asn_amount }}</td>
-                <td>@{{ storeCheckingReceiveItem.imported_diff_amount }}</td>
-                <td>@{{ storeCheckingReceiveItem.asn_diff_amount }}</td>
-                <td>@{{ storeCheckingReceiveItem.produced_at }}</td>
-                <td>@{{ storeCheckingReceiveItem.invalid_at }}</td>
-                <td>@{{ storeCheckingReceiveItem.batch_code }}</td>
-                <td>@{{ storeCheckingReceiveItem.unique_code }}</td>
-            </tr>
-        </table>
+                    </td>
+                    <td>@{{ storeCheckingReceiveItem.imported_amount }}</td>
+                    <td>@{{ storeCheckingReceiveItem.counted_amount }}</td>
+                    <td>@{{ storeCheckingReceiveItem.asn_amount }}</td>
+                    <td>@{{ storeCheckingReceiveItem.imported_diff_amount }}</td>
+                    <td>@{{ storeCheckingReceiveItem.asn_diff_amount }}</td>
+                    <td>@{{ storeCheckingReceiveItem.produced_at }}</td>
+                    <td>@{{ storeCheckingReceiveItem.invalid_at }}</td>
+                    <td>@{{ storeCheckingReceiveItem.batch_code }}</td>
+                    <td>@{{ storeCheckingReceiveItem.unique_code }}</td>
+                </tr>
+            </table>
+        </div>
+        <div class="d-xl-none">
+            123
+        </div>
+        <!-- phone -->
     </div>
 @stop