|
|
@@ -67,7 +67,7 @@ class ForeignHaiRoboticsService
|
|
|
})();
|
|
|
$bins=$taskMaterialBoxes->map(function (StationTaskMaterialBox $taskMaterialBox)use($timestampSuffix,$fromLocation,$toLocation){
|
|
|
return [
|
|
|
- "taskCode" =>$taskMaterialBox['id'],
|
|
|
+ "taskCode" =>$taskMaterialBox['id'].'_'.$timestampSuffix,
|
|
|
"binCode" => $taskMaterialBox['materialBox']['code'],
|
|
|
"fromLocCode" => $fromLocation??'',
|
|
|
"toLocCode" => $toLocation??'',
|
|
|
@@ -76,7 +76,7 @@ class ForeignHaiRoboticsService
|
|
|
return [[
|
|
|
"taskMode" =>$taskMode,
|
|
|
"bins"=>$bins,
|
|
|
- "groupCode"=>$groupId.$timestampSuffix,
|
|
|
+ "groupCode"=>$groupId.'_'.$timestampSuffix,
|
|
|
"priority"=>$priority,
|
|
|
"sequenceFlag"=>$isSequenced,
|
|
|
]];
|
|
|
@@ -110,20 +110,31 @@ class ForeignHaiRoboticsService
|
|
|
$is_in_plan
|
|
|
): bool
|
|
|
{
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.1',
|
|
|
+ '');
|
|
|
$this->instant($this->stationService,'StationService');
|
|
|
$this->instant($this->materialBoxService,'MaterialBoxService');
|
|
|
$this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
|
|
|
$this->instant($this->stationTaskCommoditiesService,'StationTaskCommodityService');
|
|
|
try{
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.2',
|
|
|
+ json_encode([$binCode,$success,$exception,$is_in_plan]));
|
|
|
if($failed
|
|
|
=!$success)
|
|
|
throw new ErrorException('海柔任务失败:'.$exception);
|
|
|
- if($NotInPlan
|
|
|
- =!$is_in_plan)
|
|
|
- throw new ErrorException('海柔认为是计划外的料箱:'.$exception);
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.3',
|
|
|
+ $failed);
|
|
|
+// if($NotInPlan
|
|
|
+// =!$is_in_plan)
|
|
|
+// throw new ErrorException('海柔认为是计划外的料箱:'.$exception);
|
|
|
+
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.4',
|
|
|
+ '$NotInPlan');
|
|
|
|
|
|
$materialBox=
|
|
|
$this->materialBoxService->get(['code'=>$binCode])->first();
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.5',
|
|
|
+ json_encode($materialBox));
|
|
|
$stationTaskMaterialBox
|
|
|
=(function()use($materialBox){
|
|
|
return $stationTaskMaterialBox=
|
|
|
@@ -135,6 +146,8 @@ class ForeignHaiRoboticsService
|
|
|
]
|
|
|
)->first();
|
|
|
})();
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.6',
|
|
|
+ json_encode($stationTaskMaterialBox));
|
|
|
if(!$stationTaskMaterialBox){
|
|
|
throw new ErrorException('该料箱没有安排在处理队列中');
|
|
|
}
|
|
|
@@ -143,11 +156,15 @@ class ForeignHaiRoboticsService
|
|
|
:(function(){throw new ErrorException('呼叫机器人回收U型线料箱失败');})();
|
|
|
$this->stationTaskMaterialBoxService
|
|
|
->markProcessed($stationTaskMaterialBox);
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.7',
|
|
|
+ json_encode($stationTaskMaterialBox));
|
|
|
$stationTaskMaterialBox_next=
|
|
|
$this->stationTaskMaterialBoxService
|
|
|
->processNextQueued($stationTaskMaterialBox); //找到队列中下一个料箱,并标记为处理中
|
|
|
$this->stationTaskCommoditiesService
|
|
|
->markProcessed($stationTaskMaterialBox['stationTaskCommodities']);
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.8',
|
|
|
+ json_encode($stationTaskMaterialBox));
|
|
|
if($stationTaskMaterialBox_next)
|
|
|
$this->stationTaskCommoditiesService
|
|
|
->markProcessing($stationTaskMaterialBox_next['stationTaskCommodities']);//因为上边商品任务被标记完成了,所以这里要将队列中找出正在处理的料箱对应的标记为“处理中”
|
|
|
@@ -155,7 +172,11 @@ class ForeignHaiRoboticsService
|
|
|
$this->instant($this->stationTaskService,'StationTaskService');
|
|
|
$this->stationTaskService->markProcessed($stationTaskMaterialBox['stationTask']);
|
|
|
}
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.9',
|
|
|
+ json_encode($stationTaskMaterialBox_next));
|
|
|
$this->stationService->broadcastBinMonitor($stationTaskMaterialBox['station_id'],$stationTaskMaterialBox['stationTask']);
|
|
|
+ LogService::log('海柔请求','markBinProcessed1.99',
|
|
|
+ json_encode($stationTaskMaterialBox_next));
|
|
|
return true;
|
|
|
}catch (\Exception $e){
|
|
|
$stationTaskMaterialBox = $stationTaskMaterialBox??$materialBox??null;
|
|
|
@@ -175,14 +196,20 @@ class ForeignHaiRoboticsService
|
|
|
|
|
|
public function putBinToStore(?StationTaskMaterialBox $stationTaskMaterialBox): bool
|
|
|
{
|
|
|
+ LogService::log('海柔请求','putBinToStore1',
|
|
|
+ '');
|
|
|
+ LogService::log('海柔请求','putBinToStore2',
|
|
|
+ json_encode($stationTaskMaterialBox));
|
|
|
$this->instant($this->stationService,'StationService');
|
|
|
$dataToPost=$this->makeJson_move(
|
|
|
collect([$stationTaskMaterialBox]),
|
|
|
- '缓存架入立架',
|
|
|
+ '输送线入立架',
|
|
|
'BIN-IN1',//TODO:这里应该是动态取得,参考出立架getULineExit()方法,不然不能从站获得对应的出口,而且要改Station的child为children
|
|
|
'',
|
|
|
$stationTaskMaterialBox['stationTaskBatch']['id']
|
|
|
);
|
|
|
+ LogService::log('海柔请求','putBinToStore3',
|
|
|
+ json_encode($dataToPost));
|
|
|
return $this->controlHaiRobot($dataToPost);
|
|
|
}
|
|
|
|
|
|
@@ -193,7 +220,7 @@ class ForeignHaiRoboticsService
|
|
|
$status, //0:任务成功1:任务失败
|
|
|
$binCode
|
|
|
):bool{
|
|
|
- LogService::log('海柔请求','taskUpdateIn1',
|
|
|
+ LogService::log('海柔请求','taskUpdateIn',
|
|
|
json_encode([
|
|
|
$stationTaskMaterialBox_id,
|
|
|
$updateEventType,
|
|
|
@@ -206,8 +233,6 @@ class ForeignHaiRoboticsService
|
|
|
=$status)==1){
|
|
|
throw new ErrorException('海柔任务失败');
|
|
|
}
|
|
|
- LogService::log('海柔请求','taskUpdateIn2',
|
|
|
- $failed);
|
|
|
if($料箱不匹配=
|
|
|
!$stationTaskMaterialBox
|
|
|
=(function()use($stationTaskMaterialBox_id,$binCode){
|
|
|
@@ -222,29 +247,21 @@ class ForeignHaiRoboticsService
|
|
|
->get()
|
|
|
->toJson());
|
|
|
}
|
|
|
- LogService::log('海柔请求','taskUpdateIn2',
|
|
|
- $料箱不匹配);
|
|
|
($标记已放置在库外=
|
|
|
function()use($updateEventType,$stationTaskMaterialBox){
|
|
|
if(($isPut
|
|
|
- =$updateEventType)==0){
|
|
|
+ =$updateEventType)==1){
|
|
|
$this->stationTaskMaterialBoxService->markHasTaken($stationTaskMaterialBox);
|
|
|
}
|
|
|
})();
|
|
|
- LogService::log('海柔请求','taskUpdateIn3',
|
|
|
- $标记已放置在库外);
|
|
|
($标记已入立架=
|
|
|
function()use($updateEventType,$stationTaskMaterialBox){
|
|
|
if(($isGet
|
|
|
- =$updateEventType)==1){
|
|
|
+ =$updateEventType)==0){
|
|
|
$this->stationTaskMaterialBoxService->markPutStored($stationTaskMaterialBox);
|
|
|
}
|
|
|
})();
|
|
|
- LogService::log('海柔请求','taskUpdateIn4',
|
|
|
- $标记已入立架);
|
|
|
}catch (\Exception $e){
|
|
|
- LogService::log('海柔请求','taskUpdateIn555',
|
|
|
- $e->getMessage());
|
|
|
$this->excepted($stationTaskMaterialBox_id, $binCode, $e->getMessage());
|
|
|
return false;
|
|
|
}
|
|
|
@@ -281,21 +298,21 @@ class ForeignHaiRoboticsService
|
|
|
*/
|
|
|
public function controlHaiRobot(array $dataToPost): bool
|
|
|
{
|
|
|
- LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1:'.json_encode($dataToPost));
|
|
|
+ LogService::log('海柔请求','runMany','波次任务分配6.r5f2c1:'.json_encode($dataToPost));
|
|
|
try{
|
|
|
- LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.51:');
|
|
|
+ LogService::log('海柔请求','runMany','波次任务分配6.r5f2c1.51:');
|
|
|
$a = json_encode($dataToPost);
|
|
|
$response = Http::post(config('api.haiq.storage.moveBin'), $dataToPost);
|
|
|
if(isset($response->json()['code'])&&$response->json()['code']==500)
|
|
|
throw new ErrorException('机器人500错误:'.json_encode($response->json()));
|
|
|
$b=json_encode($response->json());
|
|
|
- LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.52:');
|
|
|
+ LogService::log('海柔请求','runMany','波次任务分配6.r5f2c1.52:');
|
|
|
LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.53:'.json_encode($response->json()));
|
|
|
}catch (\Exception $e){
|
|
|
- LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.54:');
|
|
|
+ LogService::log('海柔请求','runMany','波次任务分配6.r5f2c1.54:'.json_encode($dataToPost).$e->getMessage());
|
|
|
throw new ErrorException('海柔机器人任务执行失败:'.json_encode($dataToPost).$e->getMessage());
|
|
|
}
|
|
|
- LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c2:'.json_encode($dataToPost));
|
|
|
+ LogService::log('海柔请求','runMany','波次任务分配6.r5f2c2:'.json_encode($dataToPost));
|
|
|
$errMsg = (function () use ($response) {
|
|
|
if ($response->ok()) return '';
|
|
|
$errMsg = '错误: ';
|
|
|
@@ -318,7 +335,7 @@ class ForeignHaiRoboticsService
|
|
|
. ' response:' . json_encode($response->headers());
|
|
|
return $errMsg . $responseDetails;
|
|
|
})();
|
|
|
- LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c3:'.json_encode($errMsg));
|
|
|
+ LogService::log('海柔请求','runMany','波次任务分配6.r5f2c3:'.json_encode($errMsg));
|
|
|
|
|
|
LogService::log(__METHOD__, __FUNCTION__,
|
|
|
$errMsg ?? ''
|