瀏覽代碼

海柔拍灯自动下任务

LD 5 年之前
父節點
當前提交
5623f9beda

+ 8 - 12
app/Http/Controllers/TestController.php

@@ -404,18 +404,14 @@ class TestController extends Controller
     public function tj2(Request $request)
     {
 
-        $batches=Batch::query()->whereIn('id',[1220])->get();
-        $a=StationTaskMaterialBox::query()
-            ->where('status','<>','完成')
-            ->whereHas('materialBox',function ($query)use($batches){
-                $locations=OrderCommodity::query()
-                    ->whereHas('order',function ($queryO)use($batches){
-                        $queryO->whereIn('batch_id',data_get($batches,'*.id')??[]);
-                    })->get('location');
-                $query->whereIn('code',data_get($locations,'*.location')??[]);
-            })
-            ->get('id');
-        dd(data_get($a,'*.id')??[]);
+        dd((function (){
+            try{
+                throw new Exception();
+                return 1;
+            }catch (\Exception $e){
+                return 2;
+            }
+        })());
     }
 
     public function mergerPackageData()

+ 20 - 17
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -43,8 +43,8 @@ class StorageController
             "taskMode"      => 1,
             "bins"=>[
                 [
-                    "binCode"   => "IDE0000159",
-                    "taskCode"  =>'t1'.microtime(true),
+                    "binCode"   => "IDE0005713",
+                    "taskCode"  =>UUID::uuid4().'|'.microtime(true),
                     "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "",
             ],
@@ -72,8 +72,8 @@ class StorageController
             "taskMode"      => 6,
             "bins"=>[[
                 "taskCode"  =>'t1'.microtime(true),
-                "binCode"   => "IDE0005682",
-                "fromLocCode" => "HAIB1-01-03", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
+                "binCode"   => "IDE0005173",
+                "fromLocCode" => "HAIB1-02-03", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
                 "toLocCode" => "",
             ]
 //                ,[
@@ -95,22 +95,25 @@ class StorageController
         ]];
         $this->moveBinIn2 = [[
             "taskMode"      => 3,
-            "bins"=>[[
+            "bins"=>[
+                [
                 "taskCode"  =>'t1'.microtime(true),
-                "binCode"   => "IDE0000036",
+                "binCode"   => "IDE0005716",
                 "fromLocCode" => "", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
-                "toLocCode" => "HAIB1-01-03",
-            ],[
-                "taskCode"  =>'t2'.microtime(true),
-                "binCode"   => "IDE0004973",
-                "fromLocCode" =>  "", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
                 "toLocCode" => "HAIB1-02-03",
-            ],[
-                "taskCode"  =>'t3'.microtime(true),
-                "binCode"   => "IDE0005716",
-                "fromLocCode" =>  "", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
-                "toLocCode" => "HAIB1-03-02",
-            ],],
+            ],
+//                [
+//                "taskCode"  =>'t2'.microtime(true),
+//                "binCode"   => "IDE0004973",
+//                "fromLocCode" =>  "", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
+//                "toLocCode" => "HAIB1-02-03",
+//            ],[
+//                "taskCode"  =>'t3'.microtime(true),
+//                "binCode"   => "IDE0005716",
+//                "fromLocCode" =>  "", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
+//                "toLocCode" => "HAIB1-03-02",
+//            ],
+                ],
             "groupCode"     => 'g'.microtime(true),
             "priority"      => 20,
             "sequenceFlag"  => 1,

+ 1 - 1
app/Http/Requests/ForeignHaiRobotic_processedRequest.php

@@ -29,7 +29,7 @@ class ForeignHaiRobotic_processedRequest extends FormRequest
             'success'=>'required|bool',
             'created_at'=>'nullable',
             'exception'=>'nullable',
-            'is_in_plan'=>'required|bool',
+            'is_in_plan'=>'nullable|bool',
         ];
     }
 }

+ 3 - 1
app/Services/ForeignHaiRoboticsService.php

@@ -198,10 +198,12 @@ class ForeignHaiRoboticsService
         }catch (\Exception $e){
 
             $this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
+            $this->instant($this->materialBoxService,'MaterialBoxService');
+            $box=$this->materialBoxService->firstOrCreate(['code'=>$binCode]);
             $stationTaskMaterialBox_toStore=
                 $this->stationTaskMaterialBoxService->create([
                     'station_id' => $this->stationService->getStation_byType('立库')['id'],
-                    'material_box_id' => $stationTaskMaterialBox['materialBox']['id'],
+                    'material_box_id' => $box['id'],
                     'status' => '处理中'
                 ] );
 

+ 1 - 1
app/Services/StationTaskMaterialBoxService.php

@@ -212,7 +212,7 @@ class StationTaskMaterialBoxService
     }
 
     function markProcessed(StationTaskMaterialBox $stationTaskMaterialBox){
-        $stationTaskMaterialBox['status'] = '处理完';
+        $stationTaskMaterialBox['status'] = '完';
         $stationTaskMaterialBox->update();
     }
     function getNotProcessedSiblings($stationTaskMaterialBox){