Jelajahi Sumber

js合并,id类型错误

LD 5 tahun lalu
induk
melakukan
9767508d5c

+ 6 - 0
app/Imports/InventoryCompareImport.php

@@ -3,6 +3,8 @@
 namespace App\Imports;
 
 use App\Commodity;
+use App\OracleBasSKU;
+use App\Owner;
 use App\Services\InventoryCompareService;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
@@ -75,6 +77,10 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
                     continue;
                 }
                 $hasSku=Commodity::where('owner_id',$this->owner_id)->where('sku',$row[$skuName])->first();
+                if(!$hasSku) {
+                    $owner=Owner::find($this->owner_id);
+                    $hasSku = OracleBasSKU::query()->where('sku', $row[$skuName])->where('customerid', $owner->code)->first();
+                }
                 if (!$hasSku){
                     array_push($exception, ['该货主下不存在产品编号:'.$row[$skuName]]);
                     $sum++;

+ 1 - 0
app/Services/InventoryCompareService.php

@@ -36,6 +36,7 @@ class InventoryCompareService
         return DB::connection('oracle')->select($sql);
     }
 
+
     public function createInventoryCompare($SKU,$LotAtt05,$amount,$ownerId){
         $ownerName=Owner::where('id',$ownerId)->value('name');
         $request=[