Эх сурвалжийг харах

海柔完成任务后状态变化,取箱失误

LD 5 жил өмнө
parent
commit
0c5fe1a6ae

+ 3 - 3
app/Http/Controllers/TestController.php

@@ -351,9 +351,9 @@ class TestController extends Controller
 
     function packageT(Request $request)
     {
-        $taskBox=StationTaskMaterialBox::query()->with('stationTaskBatch')->find(270);
-//        $taskBox->loadMissing('stationTaskBatch');
-        dd($taskBox['stationTaskBatch'],$taskBox);
+
+        $stationTaskBatch=app('StationTaskBatchService')->get(['batch_id'=>93037])->first();
+        dd($stationTaskBatch['id']??null);
     }
 
     function injectJS(Request $request)

+ 2 - 2
app/Services/StationTaskMaterialBoxService.php

@@ -74,14 +74,14 @@ class StationTaskMaterialBoxService
         $orderCommodities=OrderCommodity::query()->with('orderBin')->whereIn('order_id',$order_ids)->get();
         if($orderCommodities->isEmpty())return $stationMaterialBoxes_toCreate;
         $stationType=$this->stationTypeService->getForMaterialBox_onBatchProcess();
-        $stationTaskBatch=$this->stationTaskBatchService->get(['batch_id',$batch['id']]);
+        $stationTaskBatch=$this->stationTaskBatchService->get(['batch_id'=>$batch['id']])->first();
         foreach ($orderCommodities as $orderCommodity){
             $station=$this->stationService->getStation_byType($stationType['name']);
             $materialBox=$this->materialBoxService->firstOrCreate(['code' => $orderCommodity['location']]);
             $stationMaterialBoxes_toCreate->push([
                 'station_id'=>$station['id'],
                 'material_box_id'=>$materialBox['id'],
-                'station_task_batch_id'=>$stationTaskBatch['id'],
+                'station_task_batch_id'=>$stationTaskBatch['id']??null,
                 'status'=>'待处理'
             ]);
         }