Просмотр исходного кода

缓存架入库 HaiR失败提示

Zhouzhendong 4 лет назад
Родитель
Сommit
3cf2423055

+ 3 - 1
app/Http/Controllers/StorageController.php

@@ -140,7 +140,9 @@ class StorageController extends Controller
             "station_id" => null,
         ]);
         //重新调取料箱
-        if (!app("ForeignHaiRoboticsService")->paddingCacheShelf(Station::query()->whereIn("code",$boxes)->get()))$this->error("已无可用料箱,部分库位填充失败");
+        $result = app("ForeignHaiRoboticsService")->paddingCacheShelf(Station::query()->whereIn("code",$boxes)->get());
+        if ($result===null)$this->error("任务下发错误,检查日志");
+        if ($result===false)$this->error("已无可用料箱,部分库位填充失败");
         $this->success(["data"=>$data,"boxes"=>$boxes]);
     }
 

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

@@ -139,21 +139,11 @@ class TestController extends Controller
 
     public function test1()
     {
-        ini_set('max_execution_time',-1);
-        DeliveryAppointment::query()->with("details")->whereNotNull("asn_number")->get()->each(function ($d){
-            $asn = preg_split('/[,, ]+/is', $d->asn_number);
-            if ($asn && strlen($d->asn_number)>=13){
-                Store::query()->whereIn("asn_code",$asn)->where("owner_id",$d->owner_id)
-                ->with("storeItems")->get()->each(function ($store)use($d){
-                    $store->storeItems->each(function ($item)use($d){
-                        $de = DeliveryAppointmentDetail::query()->where("delivery_appointment_id",$d->id)
-                            ->where("commodity_id",$item->commodity_id)->first();
-                        if ($de && $item->expected_amount && $de->amount!=$item->expected_amount)$de->update(["amount"=>$item->expected_amount]);
-                    });
-                });
-            }
-        });
-        dd("OK");
+        $stations = Station::query()->select("id")->where("parent_id",6);
+        $storages = \App\Storage::query()->with("station:id,code")->whereIn("station_id",$stations)->where(function (Builder $query){
+            $query->whereNotNull("material_box_id")->orWhere("status",1);
+        })->get();
+        dd(array_column($storages->toArray(),"id"));
     }
 
     public function test2()

+ 3 - 1
app/Services/ForeignHaiRoboticsService.php

@@ -514,7 +514,9 @@ class ForeignHaiRoboticsService
             $stationCollection->add($station->code);
             $blacklist[] = $box->id;
         }
-        $this->fetchGroup_multiLocation($stationCollection,$collection,'','立架出至缓存架');
+        if ($stationCollection->count()>0){
+            if (!$this->fetchGroup_multiLocation($stationCollection,$collection,'','立架出至缓存架')) return null;
+        }
         return $stations->count()==$stationCollection->count();
     }
 }