LD 5 лет назад
Родитель
Сommit
b1b0b1c3a5

+ 104 - 29
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -37,65 +37,134 @@ class StorageController
             "bins" => [$bin],//可执行货箱任务
         ]];*/
         $this->post = [[
-            "taskMode"      => 2,
+            "taskMode"      => 1,
             "bins"=>[[
-                "taskCode"  =>"TESTINO-BS20111600246",
-                "binCode"   => "IDE0000006",
-                "fromLocCode" => "",
+                "taskCode"  =>"TESTx1za3X14",
+                "binCode"   => "IDE0000130",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ],[
-                "taskCode"  =>"TESTINO-BS20111600236",
-                "binCode"   => "IDE0000098",
-                "fromLocCode" => "",
+                "taskCode"  =>"TESTx2za3X43",
+                "binCode"   => "IDE0000131",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ]],
-            "groupCode"     => 'WM13',
+            "groupCode"     => 'WMxz3acX14',
             "priority"      => 20,
             "sequenceFlag"  => 1,
         ]];
         $this->post2 = [[
             "taskMode"      => 2,
             "bins"=>[[
-                "taskCode"  =>"TESTINO-BS20111600226",
-                "binCode"   => "IDE0005325",
-                "fromLocCode" => "",
+                "taskCode"  =>"TESTxx2zbaa1",
+                "binCode"   => "IDE0000034",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "BIN-OUT1",
+            ],[
+                "taskCode"  =>"TESTxx3zbaa1",
+                "binCode"   => "IDE0000093",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "BIN-OUT1",
+            ],[
+                "taskCode"  =>"TESTxx4zbaa1",
+                "binCode"   => "IDE0000128",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "BIN-OUT1",
+            ],[
+                "taskCode"  =>"TESTxx5zbaa1",
+                "binCode"   => "IDE0000129",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "BIN-OUT1",
+            ],[
+                "taskCode"  =>"TESTxx6zbaa1",
+                "binCode"   => "IDE0000127",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ]],
-            "groupCode"     => 'WM14',
+            "groupCode"     => 'WMxz64b2a1',
             "priority"      => 20,
             "sequenceFlag"  => 1,
         ]];;
         $this->backIn = [[
+            "taskMode"      => 1,
+            "bins"=>[[
+                "taskCode"  =>"testIn1ax",
+                "binCode"   => "IDE0000007",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],[
+                "taskCode"  =>"testIn2ax",
+                "binCode"   => "IDE0000129",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],],
+            "groupCode"     => 'WMx135ax',
+            "priority"      => 20,
+            "sequenceFlag"  => 1,
+        ]];
+        $this->backIn2 = [[
             "taskMode"      => 6,
             "bins"=>[[
-                "taskCode"  =>"TESTIN-BS20111600244",
-                "binCode"   => "IDE0000006",
-                "fromLocCode" => "HAIB2-01-01",
+                "taskCode"  =>"testIn123",
+                "binCode"   => "IDE0000130",
+                "fromLocCode" => "HAIB2-01-03",
                 "toLocCode" => "",
             ],[
-                "taskCode"  =>"TESTIN-BS20111600234",
-                "binCode"   => "IDE0000098",
-                "fromLocCode" => "HAIB2-02-01",
+                "taskCode"  =>"testIn223",
+                "binCode"   => "IDE0000034",
+                "fromLocCode" => "HAIB2-02-03",
                 "toLocCode" => "",
             ],[
-                "taskCode"  =>"TESTIN-BS20111600224",
-                "binCode"   => "IDE0005325",
-                "fromLocCode" => "HAIB2-03-01",
+                "taskCode"  =>"testIn323",
+                "binCode"   => "IDE0000093",
+                "fromLocCode" => "HAIB2-03-03",
                 "toLocCode" => "",
             ]],
-            "groupCode"     => 'WM41',
+            "groupCode"     => 'WMx14',
             "priority"      => 20,
             "sequenceFlag"  => 1,
         ]];
         $this->move = [[
-            "taskMode"      => 3,
+            "taskMode"      => 1,
             "bins"=>[[
-                "taskCode"  =>"TESTINM-BS20111600244",
-                "binCode"   => "IDE0000006",
-                "fromLocCode" => "HAIB2-01-03",
-                "toLocCode" => "BIN-OUT1",
-            ]],
-            "groupCode"     => 'WM5',
+                "taskCode"  =>"testm1z6",
+                "binCode"   => "IDE0000034",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],[
+                "taskCode"  =>"testm2z6",
+                "binCode"   => "IDE0000093",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],[
+                "taskCode"  =>"testm3z6",
+                "binCode"   => "IDE0000130",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],],
+            "groupCode"     => 'WMm1z6',
+            "priority"      => 20,
+            "sequenceFlag"  => 1,
+        ]];//128,129.127
+        $this->move2 = [[
+            "taskMode"      => 6,
+            "bins"=>[[
+                "taskCode"  =>"testm11",
+                "binCode"   => "IDE0000128",
+                "fromLocCode" => "HAIB2-01-01",
+                "toLocCode" => "",
+            ],[
+                "taskCode"  =>"testm21",
+                "binCode"   => "IDE000129",
+                "fromLocCode" => "HAIB2-02-01",
+                "toLocCode" => "",
+            ],[
+                "taskCode"  =>"testm31",
+                "binCode"   => "IDE0000127",
+                "fromLocCode" => "HAIB2-03-01",
+                "toLocCode" => "",
+            ],],
+            "groupCode"     => 'WMm2',
             "priority"      => 20,
             "sequenceFlag"  => 1,
         ]];
@@ -156,9 +225,15 @@ class StorageController
     public function moveBinIn(Request $request){
         return $this->relocate($request,$this->backIn);
     }
+    public function moveBinIn2(Request $request){
+        return $this->relocate($request,$this->backIn2);
+    }
     public function moveBinM(Request $request){
         return $this->relocate($request,$this->move);
     }
+    public function moveBinM2(Request $request){
+        return $this->relocate($request,$this->move2);
+    }
     public function lightOn(Request $request){
         return $this->light($request,$this->lightOn);
     }

+ 2 - 0
app/Providers/AppServiceProvider.php

@@ -67,6 +67,7 @@ use App\Services\StoreCheckingReceiveService;
 use App\Services\StoreItemService;
 use App\Services\StoreService;
 use App\Services\CheckActiveMenuService;
+use App\Services\TestService;
 use App\Services\UnitService;
 use App\Services\UserOwnerGroupService;
 use App\Services\UserService;
@@ -126,6 +127,7 @@ class AppServiceProvider extends ServiceProvider
     }
 
     private function loadingService(){
+        app()->singleton('TestService',TestService::class);
         app()->singleton('AllInventoryService',AllInventoryService::class);
         app()->singleton('AuthorityService',AuthorityService::class);
         app()->singleton('BatchService',BatchService::class);

+ 34 - 1
app/Services/ForeignHaiRoboticsService.php

@@ -7,6 +7,8 @@ namespace App\Services;
 use App\MaterialBox;
 use App\StationTaskMaterialBox;
 use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Illuminate\Support\Facades\Http;
 use Ramsey\Collection\Collection;
 
 class ForeignHaiRoboticsService
@@ -57,7 +59,38 @@ class ForeignHaiRoboticsService
             "sequenceFlag"=>$isSequenced,
         ];
     }
-    public function fetchGroupToLocation($toLocation,StationTaskMaterialBox $taskMaterialBoxes, $groupIdPrefix=''){
+
+    public function fetchGroupToProcessor($toLocation, Collection $taskMaterialBoxes, $groupIdPrefix=''){
+        $dataToPost=$this->makeJson_move(
+            $taskMaterialBoxes,
+            '立架出至输送线',
+            '',
+            $toLocation,
+            $groupIdPrefix
+        );
+        $response = Http::post(config('api.haiq.storage.moveBin'),$dataToPost);
+        $errMsg=(function()use($response){
+            if($response->ok())return '';
+            $errMsg = '错误: ';
+            if (!$response){
+                return $errMsg.'没有返回内容,检查连接或目标服务器';
+            }
+            switch (((string)$response["code"])[0]){
+                case 5: $errMsg.='目标服务器代码错误,请联系对方';break;
+                case 4: $errMsg.='权限不足以请求资源,请检查对方服务器规范';break;
+                default: $errMsg.='出现未知请求错误';break;
+            }
+            $responseDetails=' code:'.$response["code"]
+                .' header:'.$response->body()
+                .' response:'.json_encode($response->headers());
+            return $errMsg.$responseDetails;
+        })();
+
+        LogService::log(__METHOD__,__FUNCTION__,
+            $errMsg??''
+            .'请求:'.json_encode($dataToPost)
+            .'调用堆栈:'.json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),0,3))
+        );
 
     }
 

+ 1 - 1
app/Services/StationTaskBatchService.php

@@ -98,6 +98,6 @@ class StationTaskBatchService
         $groupPrefix = $stationTaskBatch['id'];
         $taskMaterialBoxes = $stationTaskBatch['parentTask']['taskMaterialBoxes']??
             function()use($stationTaskBatch){throw new Exception('找不到料箱:'.json_encode($stationTaskBatch));};
-        $this->foreignHaiRoboticsService->fetchGroupToLocation($toLocation,$taskMaterialBoxes,$groupPrefix);
+        $this->foreignHaiRoboticsService->fetchGroupToProcessor($toLocation,$taskMaterialBoxes,$groupPrefix);
     }
 }

+ 13 - 0
app/Services/TestService.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace App\Services;
+
+
+class TestService
+{
+    public function __construct()
+    {
+        dd(323333);
+    }
+}

+ 2 - 1
public/t.php

@@ -1,3 +1,4 @@
 <?php
 
-var_dump((bool)[]);
+$a['a'] = 321;
+echo $a['a'][1];

+ 2 - 0
routes/api/thirdPart/haiq.php

@@ -11,7 +11,9 @@ Route::group(['prefix'=>'storage'],function(){
     Route::post('moveBinOut', "StorageController@moveBinOut");//出库
     Route::post('moveBin2', "StorageController@moveBin2");//出库
     Route::post('moveBinIn', "StorageController@moveBinIn");//移库
+    Route::post('moveBinIn2', "StorageController@moveBinIn2");//移库
     Route::post('moveBinM', "StorageController@moveBinM");//移库
+    Route::post('moveBinM2', "StorageController@moveBinM2");//移库
     Route::post('lightOn', "StorageController@lightOn");//移库
     Route::post('lightOff', "StorageController@lightOff");//移库
     Route::post('taskUpdate', "StorageController@taskUpdate");//移库

+ 6 - 0
tests/webApi/thirdPart/haiq/storage.http

@@ -13,9 +13,15 @@ POST http://bswas/api/thirdPart/haiq/storage/moveBin2
 ###
 POST http://bswas/api/thirdPart/haiq/storage/moveBinM
 
+###
+POST http://bswas/api/thirdPart/haiq/storage/moveBinM2
+
 ###
 POST http://bswas/api/thirdPart/haiq/storage/moveBinIn
 
+###
+POST http://bswas/api/thirdPart/haiq/storage/moveBinIn2
+
 ###
 POST http://bswas/api/thirdPart/haiq/storage/lightOn