|
|
@@ -15,6 +15,13 @@ use Ramsey\Collection\Collection;
|
|
|
|
|
|
class ForeignHaiRoboticsService
|
|
|
{
|
|
|
+ /** @var StationTaskMaterialBoxService $stationTaskMaterialBoxService */
|
|
|
+ private $stationTaskMaterialBoxService;
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $stationTaskMaterialBoxService=null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param string $modeName '输送线入立架'|'立架出至输送线'|'移动立架内位置'|'缓存架入立架'|'立架出至缓存架'
|
|
|
* @param string $fromLocation
|
|
|
@@ -23,6 +30,7 @@ class ForeignHaiRoboticsService
|
|
|
* @param string $groupId
|
|
|
* @param int $priority
|
|
|
* @param int $isSequenced
|
|
|
+ * @return array
|
|
|
*/
|
|
|
private function makeJson_move(
|
|
|
Collection $taskMaterialBoxes,
|
|
|
@@ -44,25 +52,24 @@ class ForeignHaiRoboticsService
|
|
|
default: throw new \Exception('发至海柔的移料箱请求,模式不存在');
|
|
|
}
|
|
|
})();
|
|
|
- $bins=$taskMaterialBoxes->map(function (StationTaskMaterialBox $taskMaterialBox)use($timestampSuffix){
|
|
|
+ $bins=$taskMaterialBoxes->map(function (StationTaskMaterialBox $taskMaterialBox)use($timestampSuffix,$fromLocation,$toLocation){
|
|
|
return [
|
|
|
- "taskCode" =>"{$taskMaterialBox['id']}_{$taskMaterialBox['material_box_id']}_{$timestampSuffix}",
|
|
|
+ "taskCode" =>$taskMaterialBox['id'],
|
|
|
"binCode" => $taskMaterialBox['materialBox']['code'],
|
|
|
"fromLocCode" => $fromLocation??'',
|
|
|
"toLocCode" => $toLocation??'',
|
|
|
];
|
|
|
});
|
|
|
- $groupId .= $timestampSuffix;
|
|
|
return [
|
|
|
"taskMode" =>$taskMode,
|
|
|
"bins"=>$bins,
|
|
|
- "groupCode"=>$groupId,
|
|
|
+ "groupCode"=>$groupId.$timestampSuffix,
|
|
|
"priority"=>$priority,
|
|
|
"sequenceFlag"=>$isSequenced,
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- public function fetchGroupToProcessor($toLocation, Collection $taskMaterialBoxes, $groupIdPrefix=''): bool
|
|
|
+ public function fetchGroup($toLocation, Collection $taskMaterialBoxes, $groupIdPrefix=''): bool
|
|
|
{
|
|
|
$dataToPost=$this->makeJson_move(
|
|
|
$taskMaterialBoxes,
|
|
|
@@ -104,50 +111,49 @@ class ForeignHaiRoboticsService
|
|
|
public function markBinProcessed(){
|
|
|
|
|
|
}
|
|
|
+
|
|
|
public function taskUpdate(
|
|
|
- $groupCode,
|
|
|
+// $groupCode,
|
|
|
$taskCode,
|
|
|
$updateEventType, //0:task_begin(取货)1:task_end(放货)
|
|
|
$status, //0:任务成功1:任务失败
|
|
|
- $binCode,
|
|
|
- $robotId,
|
|
|
- $description
|
|
|
+ $binCode
|
|
|
):bool{
|
|
|
- if(($failed
|
|
|
- =$status)==1){
|
|
|
- return $this->excepted();
|
|
|
- }
|
|
|
- if(($isPut
|
|
|
- =$updateEventType)==0){
|
|
|
- return $this->markHasPut();
|
|
|
- }
|
|
|
- if(($isGet
|
|
|
- =$updateEventType)==1){
|
|
|
- return $this->markHasGot();
|
|
|
+ try{
|
|
|
+ if(($failed
|
|
|
+ =$status)==1){
|
|
|
+ throw new ErrorException('海柔任务失败');
|
|
|
+ }
|
|
|
+ if(($isPut
|
|
|
+ =$updateEventType)==0){
|
|
|
+ $this->stationTaskMaterialBoxService->markHasPut($taskCode,$binCode);
|
|
|
+ }
|
|
|
+ if(($isGet
|
|
|
+ =$updateEventType)==1){
|
|
|
+ $this->stationTaskMaterialBoxService->markHasTaken($taskCode,$binCode);
|
|
|
+ }
|
|
|
+ }catch (\Exception $e){
|
|
|
+ $this->excepted($taskCode,$binCode);
|
|
|
+ return false;
|
|
|
}
|
|
|
-
|
|
|
+ return true;
|
|
|
}
|
|
|
- public function markHasPut(
|
|
|
- $groupCode,
|
|
|
- $taskCode,
|
|
|
- $binCode,
|
|
|
- $description
|
|
|
- ):bool{
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- public function markHasGot(
|
|
|
- $groupCode,
|
|
|
- $taskCode,
|
|
|
- $binCode,
|
|
|
- $description
|
|
|
- ):bool{
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- public function excepted():bool{
|
|
|
+// public function markHasPut($taskCode,$binCode):bool{
|
|
|
+// try{
|
|
|
+// //标记料箱进入位置
|
|
|
+//// $taskMaterialBoxesService->markDone();//
|
|
|
+// }catch (\Exception $e){
|
|
|
+// switch ($e->getCode()){
|
|
|
+// case 'taskBinNotMatch';
|
|
|
+// case 'taskGetFailed';
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ public function excepted($taskCode,$binCode):bool{
|
|
|
|
|
|
}
|
|
|
|