|
|
@@ -20,8 +20,6 @@ class CacheShelfService
|
|
|
protected $modelClass = Station::class;
|
|
|
/** @var StationTaskMaterialBoxService $stationTaskMaterialBoxService */
|
|
|
private $stationTaskMaterialBoxService;
|
|
|
- /** @var StationCacheShelfGridService $stationCacheShelfGridService */
|
|
|
- private $stationCacheShelfGridService;
|
|
|
/** @var ForeignHaiRoboticsService $foreignHaiRoboticsService */
|
|
|
private $foreignHaiRoboticsService;
|
|
|
/** @var StationTaskService $stationTaskService */
|
|
|
@@ -48,14 +46,13 @@ class CacheShelfService
|
|
|
*/
|
|
|
public function lightOffTask($locCode, $PTLAction): array
|
|
|
{
|
|
|
- $this->instant($this->stationCacheShelfGridService, 'StationCacheShelfGridService');
|
|
|
|
|
|
- $station = Station::query()->where('code', $locCode)->with('parent','currentStationTask.stationTaskMaterialBoxes.materialBox')->first();
|
|
|
+ $station = Station::query()->where('code', $locCode)->first();
|
|
|
try {
|
|
|
- $bool = $this->putBinToStore($station); // 推送任务
|
|
|
+ $bool = $this->putBinToStore($station); // 推送任务
|
|
|
if($bool){
|
|
|
- $this->_stationCacheBroadCast($locCode,$PTLAction); // 灭灯广播
|
|
|
- $this->_stationCacheLightOff($locCode);
|
|
|
+ $this->_stationCacheLightOff($locCode); // 格口灭灯
|
|
|
+ $this->_stationCacheBroadCast($locCode,$PTLAction); // 灭灯广播
|
|
|
return ['success' => true];
|
|
|
}else{
|
|
|
return ['success' => false,'errMsg' => '机器人推送失败'];
|
|
|
@@ -75,11 +72,10 @@ class CacheShelfService
|
|
|
public function putBinToStore($station): bool
|
|
|
{
|
|
|
$this->instant($this->stationTaskMaterialBoxService, 'StationTaskMaterialBoxService');
|
|
|
- $this->instant($this->stationCacheShelfGridService, 'StationCacheShelfGridService');
|
|
|
$this->instant($this->foreignHaiRoboticsService, 'ForeignHaiRoboticsService');
|
|
|
|
|
|
/** @var StationTaskMaterialBox $stationTaskMaterialBox */
|
|
|
- $stationTaskMaterialBox = $station['currentStationTask']['stationTaskMaterialBoxes'];
|
|
|
+ $stationTaskMaterialBox = $station['pendingStationTask']['stationTaskMaterialBoxes']->first();
|
|
|
return $this->foreignHaiRoboticsService->putBinToStore_fromCacheShelf($stationTaskMaterialBox);
|
|
|
}
|
|
|
|
|
|
@@ -105,13 +101,18 @@ class CacheShelfService
|
|
|
$station = Station::query()->firstOrCreate(['code' => $stationCode,'parent_id'=>$parentStation['id']],['name'=>$stationCode,'station_type_id' => $stationType['id']]);
|
|
|
}
|
|
|
$materialBox = MaterialBox::query()->firstOrCreate(['code' => $materialBoxCode]);
|
|
|
- if($station['currentStationTask']['stationTaskMaterialBoxes']['materialBox'] ?? false){
|
|
|
+ if($station['pendingStationTask'] ?? false){
|
|
|
return ['success' => false,'message' => '当前已有未完成的站任务'];
|
|
|
}
|
|
|
$stationTask = $this->stationTaskService->create(1); // 生成站任务
|
|
|
- $this->stationTaskMaterialBoxService->createByStationMaterialBox($station,$materialBox); // 创建料箱任务
|
|
|
+ $stationTaskMaterialBox = $this->stationTaskMaterialBoxService->createByStationMaterialBox($station,$materialBox); // 创建料箱任务
|
|
|
$this->stationTaskService->registerStations($stationTask,[$station['id']]); // 注册站任务站
|
|
|
-// $this->stationTaskChildService->insert([]);
|
|
|
+ $params = [[
|
|
|
+ 'station_task_id'=>$stationTask->first()['id'],
|
|
|
+ 'station_taskable_type'=>StationTaskMaterialBox::class,
|
|
|
+ 'station_taskable_id'=>$stationTaskMaterialBox['id']
|
|
|
+ ]];
|
|
|
+ $this->stationTaskChildService->insert($params); // 任务注册
|
|
|
return['success'=>true];
|
|
|
}
|
|
|
|