فهرست منبع

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

 Conflicts:
	app/Services/StoreService.php
LD 5 سال پیش
والد
کامیت
4402ea09d2

+ 5 - 5
app/Http/Controllers/TestController.php

@@ -176,16 +176,16 @@ class TestController extends Controller
     public function restoreResetInstantBill()
     {
         ini_set('max_execution_time', 2500);
-        foreach (OwnerFeeDetail::query()->whereBetween("worked_at",["2021-04-01 00:00:00","2021-04-26 00:00:00"])->cursor() as $detail){
+        foreach (OwnerFeeDetail::query()->whereBetween("worked_at",["2021-04-01 00:00:00","2021-04-27 00:00:00"])->cursor() as $detail){
             dispatch(new ResetInstantBill($detail));
         }
     }
     public function restoreResetInstantBillOrder()
     {
         ini_set('max_execution_time', 2500);
-        $orders = Order::query()->where("wms_status","订单完成")->whereBetween("updated_at",["2021-04-01 00:00:00","2021-04-26 00:00:00"])
+        $orders = Order::query()->where("wms_status","订单完成")->whereBetween("updated_at",["2021-04-01 00:00:00","2021-04-27 00:00:00"])
             ->whereNotIn("id",OwnerFeeDetail::query()->select("outer_id")->where("outer_table_name","orders")
-                ->whereBetween("worked_at",["2021-04-01 00:00:00","2021-04-26 00:00:00"]))->get();
+                ->whereBetween("worked_at",["2021-04-01 00:00:00","2021-04-27 00:00:00"]))->get();
         foreach ($orders->chunk(50) as $or){
             dispatch(new OrderCreateInstantBill($or));
         }
@@ -193,9 +193,9 @@ class TestController extends Controller
     public function restoreResetInstantBillStore()
     {
         ini_set('max_execution_time', 2500);
-        $stores = Store::query()->where("status","已入库")->whereBetween("updated_at",["2021-04-01 00:00:00","2021-04-26 00:00:00"])
+        $stores = Store::query()->where("status","已入库")->whereBetween("updated_at",["2021-04-01 00:00:00","2021-04-27 00:00:00"])
             ->whereNotIn("id",OwnerFeeDetail::query()->select("outer_id")->where("outer_table_name","stores")
-                ->whereBetween("worked_at",["2021-04-01 00:00:00","2021-04-26 00:00:00"]))->get();
+                ->whereBetween("worked_at",["2021-04-01 00:00:00","2021-04-27 00:00:00"]))->get();
         foreach ($stores->chunk(50) as $st){
             dispatch(new OrderCreateInstantBill($st));
         }

+ 2 - 3
app/Jobs/OrderCreateInstantBill.php

@@ -7,7 +7,6 @@ use App\Services\OrderService;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Database\Eloquent\Collection;
-use Illuminate\Database\Eloquent\Model;
 use Illuminate\Foundation\Bus\Dispatchable;
 use Illuminate\Queue\InteractsWithQueue;
 
@@ -42,8 +41,8 @@ class OrderCreateInstantBill implements ShouldQueue
                 try{
                     if (!$service->createInstantBill($order))
                         LogService::log(__METHOD__,"ERROR-订单生成即时账单",$order->toJson());
-                }catch (\Error|\Exception $e){
-                    LogService::log(__METHOD__,"ERROR-订单生成即时账单",(is_subclass_of($order,Model::class) ? $order->toJson() : json_encode($order))." | ".$e->getMessage());
+                }catch (\Exception $e){
+                    LogService::log(__METHOD__,"ERROR-订单生成即时账单",$order->toJson()." | ".$e->getMessage());
                     $errors = ["order_".$order->id.":".$e->getMessage()];
                 }
             }

+ 2 - 3
app/Jobs/StoreCreateInstantBill.php

@@ -7,7 +7,6 @@ use App\Services\StoreService;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Database\Eloquent\Collection;
-use Illuminate\Database\Eloquent\Model;
 use Illuminate\Foundation\Bus\Dispatchable;
 use Illuminate\Queue\InteractsWithQueue;
 
@@ -42,8 +41,8 @@ class StoreCreateInstantBill implements ShouldQueue
         foreach ($this->stores as $store){
             try{
                 $service->createInstantBill($store);
-            }catch (\Error|\Exception $e){
-                LogService::log(__METHOD__,"ERROR-入库生成即时账单",(is_subclass_of($store,Model::class) ? $store->toJson() : json_encode($this->stores))." | ".$e->getMessage());
+            }catch (\Exception $e){
+                LogService::log(__METHOD__,"ERROR-入库生成即时账单",$store->toJson()." | ".$e->getMessage());
                 $errors = ["store_".$store->id.":".$e->getMessage()];
             }
         }

+ 1 - 4
app/Services/StoreService.php

@@ -244,10 +244,7 @@ class StoreService
     }
 
     public function pushJob($asnHerders){
-        $stores = Store::query()->with(["storeItems"])->where('status','已入库')->whereIn('asn_code',data_get($asnHerders,'*.asnno'))->get();
-        $stores->each(function($store){
-            dispatch(new StoreCreateInstantBill($store));
-        });
+        dispatch(new StoreCreateInstantBill(Store::query()->with(["storeItems"])->where('status','已入库')->whereIn('asn_code', data_get($asnHerders,'*.asnno'))->get()));
     }
 
     public function insert($params)