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

+ 23 - 2
app/Http/Controllers/TestController.php

@@ -86,10 +86,31 @@ class TestController extends Controller
         return call_user_func([$this, $method], $request);
     }
 
+    public function test2(){
+/*        Station::query()
+            ->where("id",11)->update(["status"=>0]);
+        $a = new CacheShelfService();
+        $a->_stationCacheLightOff("HAIB1-01-01");
+        dd(1);*/
+        StationTaskMaterialBox::query()->get();
+        $task1 = StationTaskMaterialBox::query()->find(85010);
+        $foreignHaiRoboticsService = new ForeignHaiRoboticsService();
+        $toLocation = collect(["HAIB1-01-01"]);
+        $taskMaterialBoxes = collect([$task1]);
+        $foreignHaiRoboticsService->
+        fetchGroup_multiLocation($toLocation, $taskMaterialBoxes, '', '立架出至缓存架',20);
+        foreach ($toLocation as $value){
+            app("CacheShelfService")->lightUp($value,'3','0',["title"=>"机器人取箱中,禁止操作"]);
+            Cache::forever("CACHE_SHELF_OCCUPANCY_11",true);
+        }
+        app("StationService")->locationOccupyMulti($toLocation->toArray());
+        dd("OK");
+    }
+
     public function test()
     {
-        $code1 = "";
-        $code2 = "";
+        $code1 = "IDE0000224";
+        $code2 = "IDE0000176";
         Station::query()->where("station_type_id",5)->whereNotNull("parent_id")
             ->where("id","!=",11)->update(["status"=>1]);
         Cache::forget("CACHE_SHELF_AVAILABLE");

+ 5 - 4
app/Services/ForeignHaiRoboticsService.php

@@ -351,10 +351,6 @@ class ForeignHaiRoboticsService
         $binCode
     ):bool{
         $this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
-        if ($status==1){ //海柔失败
-            $this->push(__METHOD__."->".__LINE__,"海柔任务异常",json_encode(request()->input()));
-            return false;
-        }
         //获取下达任务
         /** @var StationTaskMaterialBox|\stdClass $stationTaskMaterialBox */
         $stationTaskMaterialBox = $stationTaskMaterialBox_id ? StationTaskMaterialBox::query()->with("materialBox:id,code")
@@ -363,6 +359,11 @@ class ForeignHaiRoboticsService
             $this->push(__METHOD__."->".__LINE__,"海柔任务不存在",json_encode(request()->input()));
             return false;
         }
+        if ($status==1){ //海柔失败
+            $this->push(__METHOD__."->".__LINE__,"海柔任务异常",json_encode(request()->input()));
+            $stationTaskMaterialBox->update(['status'=>"异常"]);
+            return false;
+        }
         if ($stationTaskMaterialBox->materialBox->code != $binCode){
             $this->push(__METHOD__."->".__LINE__,"海柔任务料箱号不匹配",json_encode(request()->input()));
             return false;