|
|
@@ -5,6 +5,7 @@ namespace App\Services;
|
|
|
|
|
|
|
|
|
use App\Exceptions\ErrorException;
|
|
|
+use App\Exceptions\Exception;
|
|
|
use App\MaterialBox;
|
|
|
use App\Station;
|
|
|
use App\StationCacheShelfGrid;
|
|
|
@@ -63,16 +64,7 @@ class ForeignHaiRoboticsService
|
|
|
): array
|
|
|
{
|
|
|
$timestampSuffix = microtime(true);
|
|
|
- $taskMode=(function()use($modeName){
|
|
|
- switch ($modeName){
|
|
|
- case '输送线入立架': return 1;
|
|
|
- case '立架出至输送线': return 2;
|
|
|
- case '立架出至缓存架':
|
|
|
- case '移动立架内位置': return 3;
|
|
|
- case '缓存架入立架':return 6;
|
|
|
- default: throw new \Exception('发至海柔的移料箱请求,模式不存在');
|
|
|
- }
|
|
|
- })();
|
|
|
+ $taskMode=$this->getTaskMode($modeName);
|
|
|
$bins=$taskMaterialBoxes->map(function (StationTaskMaterialBox $taskMaterialBox)use($timestampSuffix,$fromLocation,$toLocation){
|
|
|
return [
|
|
|
"taskCode" =>$taskMaterialBox['id'].'_'.$timestampSuffix,
|
|
|
@@ -90,29 +82,19 @@ class ForeignHaiRoboticsService
|
|
|
]];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private function makeJson_move_multi(
|
|
|
Collection $taskMaterialBoxes,
|
|
|
string $modeName,
|
|
|
string $fromLocation='',
|
|
|
- string $toLocations=null,
|
|
|
+ Collection $toLocations=null,
|
|
|
$groupId=''
|
|
|
, $priority=10
|
|
|
, $isSequenced=1
|
|
|
): array
|
|
|
{
|
|
|
+ if(!$toLocations||($toLocations->count()!=$taskMaterialBoxes->count()))throw new Exception('toLocation中的元素数量必须和料箱任务一致');
|
|
|
$timestampSuffix = microtime(true);
|
|
|
- $taskMode=(function()use($modeName){
|
|
|
- switch ($modeName){
|
|
|
- case '输送线入立架': return 1;
|
|
|
- case '立架出至输送线': return 2;
|
|
|
- case '立架出至缓存架':
|
|
|
- case '移动立架内位置': return 3;
|
|
|
- case '缓存架入立架':return 6;
|
|
|
- default: throw new \Exception('发至海柔的移料箱请求,模式不存在');
|
|
|
- }
|
|
|
- })();
|
|
|
+ $taskMode=$this->getTaskMode($modeName);
|
|
|
$bins=$taskMaterialBoxes->map(function (StationTaskMaterialBox $taskMaterialBox,$i)use($timestampSuffix,$fromLocation,$toLocations){
|
|
|
return [
|
|
|
"taskCode" =>$taskMaterialBox['id'].'_'.$timestampSuffix,
|
|
|
@@ -130,6 +112,18 @@ class ForeignHaiRoboticsService
|
|
|
]];
|
|
|
}
|
|
|
|
|
|
+ private function getTaskMode($modeName){
|
|
|
+ switch ($modeName){
|
|
|
+ case '输送线入立架': return 1;
|
|
|
+ case '立架出至输送线': return 2;
|
|
|
+ case '立架出至缓存架':
|
|
|
+ case '移动立架内位置': return 3;
|
|
|
+ case '缓存架入立架':return 6;
|
|
|
+ default: throw new \Exception('发至海柔的移料箱请求,模式不存在');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function fetchGroup($toLocation, Collection $taskMaterialBoxes, $groupIdPrefix='',$mode='立架出至输送线'): bool
|
|
|
{
|
|
|
$dataToPost=$this->makeJson_move(
|