style(studio.resource): 整理和抽象了历史记录中任务的目录结构

Signed-off-by: 李东云 <dongyun.li@luxcreo.ai>
This commit is contained in:
李东云
2022-07-26 14:16:53 +08:00
parent 6594a6aaa4
commit 7ef2c52758
11 changed files with 321 additions and 24 deletions

View File

@@ -0,0 +1,29 @@
<?php
/**
* Frame.php@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*/
declare(strict_types=1);
namespace Singularity\HDK\Studio\Resource\Workspace\Tasks\Detail;
use Singularity\HDK\Studio\Resource\Workspace\Tasks\OrderDetail;
/**
* 晶格模型生成任务的 source 格式
* Singularity\HDK\Studio\Resource\Workspace\Tasks\Detail\Frame@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*
* @inheritDoc
*/
class Frame extends OrderDetail
{
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Lattice.php@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*/
declare(strict_types=1);
namespace Singularity\HDK\Studio\Resource\Workspace\Tasks\Detail;
use Singularity\HDK\Studio\Resource\Workspace\Tasks\OrderDetail;
/**
* 用于历史记录详情的晶格模型生成任务格式
* Singularity\HDK\Studio\Resource\Workspace\Tasks\Detail\Lattice@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*
* @inheritDoc
*/
class Lattice extends OrderDetail
{
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Frame.php@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*/
declare(strict_types=1);
namespace Singularity\HDK\Studio\Resource\Workspace\Tasks\Item;
use Singularity\HDK\Studio\Resource\Workspace\Tasks\OrderItem;
/**
* 线框模型生成任务的 source 格式
* Singularity\HDK\Studio\Resource\Workspace\Tasks\Item\Frame@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*
* @inheritDoc
*/
class Frame extends OrderItem
{
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Lattice.php@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*/
declare(strict_types=1);
namespace Singularity\HDK\Studio\Resource\Workspace\Tasks\Item;
use Singularity\HDK\Studio\Resource\Workspace\Tasks\OrderItem;
/**
* 用于历史记录列表的晶格任务
* 使用 $this->when() 引用的字段将来确定无用后,都会移除
*
* Singularity\HDK\Studio\Resource\Workspace\Tasks\Item\Lattice@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*
* @inheritDoc
*/
class Lattice extends OrderItem
{
}

View File

@@ -0,0 +1,68 @@
<?php
/**
* OrderDetail.php@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*/
declare(strict_types=1);
namespace Singularity\HDK\Studio\Resource\Workspace\Tasks;
use Hyperf\Resource\Json\JsonResource;
use Singularity\HDK\Studio\Enums\TaskLatticeAction;
use Singularity\HDK\Studio\Resource\Field;
use Singularity\HDK\Studio\Resource\File;
use Singularity\HDK\Studio\Resource\Lattice as LatticeResource;
use Singularity\HDK\Utils\Resource\ClassicResponse;
/**
* 订单详情抽象模型
* Singularity\HDK\Studio\Resource\Workspace\Tasks\OrderDetail@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*
* @property string $fileId 要处理的模型文件 ID
* @property string $fileUrl 要处理的模型文件完整路径
* @property TaskLatticeAction $action 模型精度
* @property string $latticeId 晶格
* @property float $scalingRatio 密度比,两位小数
* @property float $size 晶格尺寸
* @property float $wide 杆径粗细
* @property int $surfaceNum 面数
* @property int $field
* @property LatticeResource $lattice
* @property-read File $source
* @property-read File $output
* @property-read File $outputSmall
* @property int $hardness
*
* @version 2
*/
abstract class OrderDetail extends JsonResource
{
use ClassicResponse;
public function toArray(): array
{
$action = $this->action ?? null;
return [
'modelName' => $this->modelName ?? $this?->source?->name,
'field' => Field::make($this->field),
'source' => File::make($this?->source),
'action' => is_null($action) ? null : $action,
'lattice' => LatticeResource::make($this->lattice),
'hardness' => $this->hardness ?? null,
'scalingRatio' => $this->scalingRatio,
'size' => $this->size,
'wide' => $this->wide,
'surfaceNum' => $this->surfaceNum,
'output' => $this->when(isset($this->output), File::make($this?->output)),
'outputPreview' => $this->when(isset($this->outputSmall), File::make($this?->outputSmall)),
];
}
}

View File

@@ -0,0 +1,90 @@
<?php
/**
* Order.php@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*/
declare(strict_types=1);
namespace Singularity\HDK\Studio\Resource\Workspace\Tasks;
use Hyperf\Resource\Json\JsonResource;
use Singularity\HDK\Studio\Enums\TaskLatticeAction;
use Singularity\HDK\Studio\Resource\Field;
use Singularity\HDK\Studio\Resource\File;
use Singularity\HDK\Studio\Resource\FileCollection;
use Singularity\HDK\Studio\Resource\Lattice as LatticeResource;
use Singularity\HDK\Utils\Resource\ClassicResponse;
/**
* 订单列表中的元素类型
* Singularity\HDK\Studio\Resource\Workspace\Tasks\OrderItem@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/26
*
* @property string $fileId 要处理的模型文件 ID
* @property string $fileUrl 要处理的模型文件完整路径
* @property TaskLatticeAction $action 模型精度
* @property string $latticeId 晶格
* @property float $scalingRatio 密度比,两位小数
* @property float $size 晶格尺寸
* @property float $wide 杆径粗细
* @property int $surfaceNum 面数
* @property string|null $modelName
* @property int $fieldId
* @property Field $field
* @property LatticeResource $lattice
* @property File $source
* @property File $output
* @property File $outputSmall
* @property \Hyperf\Database\Model\Collection $showPicIds
* @property string $technology
* @property string $material
* @property string $completeFileId
* @property string $completeFileUrl
* @property string $frameFileId
* @property string $frameFileUrl
* @property int $hardness
*
* @version 2
*/
abstract class OrderItem extends JsonResource
{
use ClassicResponse;
public function toArray(): array
{
$action = $this->action ?? null;
return [
'modelName' => $this->modelName ?? $this->source?->name,
'viewShots' => $this->when(
isset($this->viewShotFirst),
isset($this->viewShotFirst) ? FileCollection::make([$this->viewShotFirst]) : null
),
'fieldZh' => $this->when(isset($this->field?->nameZh), $this->field?->nameZh),
'fieldEn' => $this->when(isset($this->field?->nameEn), $this->field?->nameEn),
'action' => $this->when(isset($action), $action),
'lattice' => $this->when(!empty($this->lattice), $this->lattice?->title),
'hardness' => $this->when(isset($this->hardness), $this->hardness),
'scalingRatio' => $this->when(isset($this->scalingRatio), $this->scalingRatio),
'size' => $this->when(isset($this->size), $this->size),
'wide' => $this->when(isset($this->wide), $this->wide),
'surfaceNum' => $this->when(isset($this->surfaceNum), $this->surfaceNum),
'technology' => $this->when(isset($this->technology), $this->technology),
'material' => $this->when(isset($this->material), $this->material),
$this->mergeWhen(!empty($this->frameFileId), [
'frameFileId' => $this->frameFileId,
'frameFileUrl' => $this->frameFileUrl,
]),
$this->mergeWhen(!empty($this->completeFileId), [
'completeFileId' => $this->completeFileId,
'completeFileUrl' => $this->completeFileUrl,
]),
];
}
}

View File

@@ -36,8 +36,8 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
* @property float $wide 杆径粗细
* @property int $surfaceNum 面数
* @property string|null $modelName
* @property int $fieldId
* @property Field $field
* @property int $fieldId 领域 id
* @property Field $field 领域名称
* @property LatticeResource $lattice
* @property File $source
* @property File $output
@@ -47,6 +47,10 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
* @property string $material
* @property string $completeFileId
* @property string $completeFileUrl
* @property integer|null $hardness 预计硬度
*
* @deprecated
* @see \Singularity\HDK\Studio\Resource\Workspace\Tasks\Item\Frame
*/
final class Frame extends JsonResource
{
@@ -56,26 +60,26 @@ final class Frame extends JsonResource
{
$action = $this->action ?? null;
return [
'fieldZh' => $this->field?->nameZh,
'fieldEn' => $this->field?->nameEn,
'modelName' => $this->modelName ?? $this->source?->name,
'action' => is_null($action) ? null : $action,
'lattice' => $this->when(!empty($this->lattice), $this->lattice?->title),
'scalingRatio' => $this->scalingRatio,
'size' => $this->size,
'wide' => $this->wide,
'surfaceNum' => $this->surfaceNum,
'viewShots' => $this->when(
isset($this->viewShotFirst),
isset($this->viewShotFirst) ? FileCollection::make([$this->viewShotFirst]) : null
),
'fieldZh' => $this->when(isset($this->field?->nameZh), $this->field?->nameZh),
'fieldEn' => $this->when(isset($this->field?->nameEn), $this->field?->nameEn),
'action' => $this->when(isset($action), $action),
'lattice' => $this->when(!empty($this->lattice), $this->lattice?->title),
'hardness' => $this->when(isset($this->hardness), $this->hardness),
'scalingRatio' => $this->when(isset($this->scalingRatio), $this->scalingRatio),
'size' => $this->when(isset($this->size), $this->size),
'wide' => $this->when(isset($this->wide), $this->wide),
'surfaceNum' => $this->when(isset($this->surfaceNum), $this->surfaceNum),
'technology' => $this->when(isset($this->technology), $this->technology),
'material' => $this->when(isset($this->material), $this->material),
$this->mergeWhen(!empty($this->completeFileId), [
'completeFileId' => $this->completeFileId,
'completeFileUrl' => $this->completeFileUrl,
]),
];
}
}

View File

@@ -34,8 +34,15 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
* @property float $size 晶格尺寸
* @property float $wide 杆径粗细
* @property int $surfaceNum 面数
* @property int $fieldId
* @property int $field
* @property LatticeResource $lattice
* @property-read File $source
* @property-read File $output
* @property-read File $outputSmall
* @property int $hardness
*
* @deprecated
* @see \Singularity\HDK\Studio\Resource\Workspace\Tasks\Detail\Frame
*/
final class FrameDetail extends JsonResource
{
@@ -50,6 +57,7 @@ final class FrameDetail extends JsonResource
'source' => File::make($this?->source),
'action' => !isset($action) ? null : $action,
'lattice' => LatticeResource::make($this->lattice),
'hardness' => $this->hardness,
'scalingRatio' => $this->scalingRatio,
'size' => $this->size,
'wide' => $this->wide,

View File

@@ -24,9 +24,11 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
/**
* 用于历史记录列表的晶格任务
* 使用 $this->when() 引用的字段将来确定无用后,都会移除
*
* Singularity\HDK\Studio\Resource\Workspace\Tasks\Source\Lattice@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/5/13
*
@@ -53,6 +55,9 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
* @property string $frameFileId
* @property string $frameFileUrl
* @property int $hardness
*
* @deprecated since version 1.0, to be removed in
* @see \Singularity\HDK\Studio\Resource\Workspace\Tasks\Item\Lattice
*/
final class Lattice extends JsonResource
{
@@ -74,20 +79,20 @@ final class Lattice extends JsonResource
{
$action = $this->action ?? null;
return [
'fieldZh' => $this->field?->nameZh,
'fieldEn' => $this->field?->nameEn,
'modelName' => $this->modelName ?? $this->source?->name,
'action' => is_null($action) ? null : $action,
'lattice' => $this->when(!empty($this->lattice), $this->lattice?->title),
'hardness' => $this->hardness ?? null,
'scalingRatio' => $this->scalingRatio,
'size' => $this->size,
'wide' => $this->wide,
'surfaceNum' => $this->surfaceNum,
'viewShots' => $this->when(
isset($this->viewShotFirst),
isset($this->viewShotFirst) ? FileCollection::make([$this->viewShotFirst]) : null
),
'fieldZh' => $this->when(isset($this->field?->nameZh), $this->field?->nameZh),
'fieldEn' => $this->when(isset($this->field?->nameEn), $this->field?->nameEn),
'action' => $this->when(isset($action), $action),
'lattice' => $this->when(!empty($this->lattice), $this->lattice?->title),
'hardness' => $this->when(isset($this->hardness), $this->hardness),
'scalingRatio' => $this->when(isset($this->scalingRatio), $this->scalingRatio),
'size' => $this->when(isset($this->size), $this->size),
'wide' => $this->when(isset($this->wide), $this->wide),
'surfaceNum' => $this->when(isset($this->surfaceNum), $this->surfaceNum),
'technology' => $this->when(isset($this->technology), $this->technology),
'material' => $this->when(isset($this->material), $this->material),
$this->mergeWhen(!empty($this->frameFileId), [
@@ -98,7 +103,6 @@ final class Lattice extends JsonResource
'completeFileId' => $this->completeFileId,
'completeFileUrl' => $this->completeFileUrl,
]),
];
}
}

View File

@@ -40,6 +40,9 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
* @property-read File $output
* @property-read File $outputSmall
* @property int $hardness
*
* @deprecated
* @see \Singularity\HDK\Studio\Resource\Workspace\Tasks\Detail\Lattice
*/
final class LatticeDetail extends JsonResource
{

View File

@@ -17,12 +17,14 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
/**
* Singularity\HDK\Studio\Resource\Workspace\Tasks\Source\Preflight@HDK
*
* @author 李东云<dongyun.li@luxcreo.cn>
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/5/13
*
* @property string $modelId 要检修的模型 id
* @property string $modelUrl 要检修的模型 url
*
* @deprecated 未使用
*/
final class Preflight extends JsonResource
{