| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App\Http\Controllers\api\thirdPart\haiq;
- use App\Services\StationTaskBatchService;
- use App\StationTaskBatch;
- use Illuminate\Http\Request;
- use App\Traits\TestableInstant;
- class HaiRoboticsController
- {
- use TestableInstant;
- /** @var StationTaskBatchService $stationTaskBatchService */
- private $stationTaskBatchService=null;
- function runTaskBatch(Request $request){
- $this->instant($this->stationTaskBatchService,'StationTaskBatchService');
- $request->validate(
- ['station_task_batch_id'=>'required|exists:station_task_batches,id']
- );
- if(!$request['station_task_batch_id'])return [
- 'success'=>false,
- 'errorMsg'=>'波次任务不能为空'
- ];
- $batchTask=StationTaskBatch::query()->find($request['station_task_batch_id']);
- $batchesFailed=$this->stationTaskBatchService->runMany(collect([$batchTask]),
- $request->input("isCacheShelf") ? 'OUTBIN-CACHE-SHELF' : 'OUTBIN-U-SHAPE-LINE');//执行波次任务
- if($batchesFailed && $batchesFailed->isNotEmpty()){
- return [
- 'success'=>false,
- 'errorMsg'=>'有部分失败波次:'.$batchesFailed->toJson()
- ];
- }
- return ['success'=>true];
- }
- }
|