Zhouzhendong 5 éve
szülő
commit
f3347312e8

+ 1 - 10
app/Http/Controllers/TestController.php

@@ -4,7 +4,6 @@ namespace App\Http\Controllers;
 
 
 use App\Authority;
-use App\Carrier;
 use App\Commodity;
 use App\CommodityBarcode;
 use App\Console\Commands\SyncWMSOrderTask;
@@ -33,11 +32,7 @@ use App\RejectedBillItem;
 use App\Services\CacheService;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
-use App\Services\DocWaveHeaderService;
-use App\Services\FeatureService;
 use App\Services\InventoryCompareService;
-use App\Services\LogisticService;
-use App\Services\LogService;
 use App\Services\OracleDocAsnHerderService;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageService;
@@ -47,11 +42,8 @@ use App\Services\OrderTrackingService;
 use App\Services\OwnerService;
 use App\Services\StoreService;
 use App\Services\WarehouseService;
-use App\StoreCheckingReceiveItem;
 use App\User;
 use App\Warehouse;
-use App\Waybill;
-use App\WaybillPriceModel;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Support\Facades\Auth;
@@ -99,8 +91,7 @@ class TestController extends Controller
     }
     public static function zzd()
     {
-        $r = new \ReflectionClass('App\Http\Controllers\UnitsController');
-        dd($r->getMethods(),$r->getConstants());
+        dd(phpinfo());
     }
 
     public function updateLaborRemark(){

+ 45 - 0
app/Jobs/WaybillCreateInstantBill.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Jobs;
+
+use App\Services\LogService;
+use App\Services\WaybillService;
+use App\Waybill;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+
+class WaybillCreateInstantBill implements ShouldQueue
+{
+    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+
+
+    protected $waybill;
+    /**
+     * Create a new job instance.
+     *
+     * @param Waybill $waybill
+     * @return void
+     */
+    public function __construct(Waybill $waybill)
+    {
+        $this->waybill = $waybill;
+    }
+
+    /**
+     * Execute the job.
+     *
+     * @param WaybillService $service
+     * @return void
+     */
+    public function handle(WaybillService $service)
+    {
+        try{
+            $service->createInstantBill($this->waybill);
+        }catch (\Exception $e){
+            LogService::log(__METHOD__,"ERROR-运输计算运费失败",$this->waybill->toJson()." | ".$e->getMessage());
+        }
+    }
+}

+ 1 - 2
app/Services/StoreService.php

@@ -187,8 +187,7 @@ Class StoreService
     public function createInstantBill(Store $store):bool
     {
         if (!$store || $store->status!="已入库")return false;
-        if (!$store->storeItems)$store->load("storeItems");
-
+        $store->loadMissing("storeItems");
 
         /** @var OwnerPriceOperationService $service */
         $service = app("OwnerPriceOperationService");