Zhouzhendong 4 лет назад
Родитель
Сommit
8d258fa51c
2 измененных файлов с 10 добавлено и 8 удалено
  1. 4 3
      app/Jobs/PackageCollectingAllocation.php
  2. 6 5
      app/Services/OrderPackageService.php

+ 4 - 3
app/Jobs/PackageCollectingAllocation.php

@@ -45,9 +45,10 @@ class PackageCollectingAllocation implements ShouldQueue
             Log::warning("自动揽收失败",["message"=>$result["message"],"param"=>$this->orderPackage->logistic_number]);
             return;
         }
-        if (OrderPackage::query()->where("id",$this->orderPackage->id)
-                ->where("collecting_status",'0')->update(["collecting_status"=>'1'])!=1)
-            Log::warning("自动揽收异常",["message"=>"未能成功修改揽收标记","param"=>$this->orderPackage->toArray()]);
+        $result = OrderPackage::query()->where("id",$this->orderPackage->id)
+            ->where("collecting_status",'0')->update(["collecting_status"=>'1']);
+        if ($result!=1)
+            Log::warning("自动揽收异常",["message"=>"未能成功修改揽收标记","param"=>$this->orderPackage->toArray(),"line"=>$result]);
         /*$result = app("OrderService")->allocation($this->orderPackage->order->code,$this->lineNo);
         if (mb_substr($result,0,3)=='000'){
             if (OrderPackage::query()->where("id",$this->orderPackage->id)

+ 6 - 5
app/Services/OrderPackageService.php

@@ -322,11 +322,12 @@ class OrderPackageService
             Log::warning("自动揽收跳出",["status"=>$package->order->wms_status]);
             return;
         }
-        /*if ($orderHeader->edisendflag!='Y' && !app("OrderService")->manualBack($orderHeader->orderno)){
-            Log::warning("揽收回传失败",["status"=>$orderHeader->orderno]);
-            return;
-        }*/
-        dispatch(new PackageCollectingAllocation($package,$lineNo));
+        $tag = Cache::get(self::CACHE_COLLECT_FLAG,[]);
+        if (isset($tag[$package->logistic_number])){
+            unset($tag[$package->logistic_number]);
+            Cache::put(self::CACHE_COLLECT_FLAG, $tag, self::CACHE_COLLECT_FLAG_TTL);
+            $package->update(["collecting_status"=>1]);
+        }else dispatch(new PackageCollectingAllocation($package,$lineNo));
     }
 
     /**