- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env) - 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget) - 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget) - 리소스 한국어화: Product, Material 모델 레이블 추가 - 대시보드: 위젯 등록 및 캐시 최적화 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
167 lines
5.0 KiB
PHP
167 lines
5.0 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\BomConditionRule;
|
|
use App\Models\Model;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\BomConditionRule>
|
|
*/
|
|
class BomConditionRuleFactory extends Factory
|
|
{
|
|
protected $model = BomConditionRule::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'tenant_id' => 1,
|
|
'model_id' => Model::factory(),
|
|
'name' => $this->faker->words(3, true),
|
|
'description' => $this->faker->sentence(),
|
|
'condition_expression' => 'area > 5',
|
|
'component_code' => 'BRK-001',
|
|
'quantity_expression' => '2',
|
|
'priority' => $this->faker->numberBetween(1, 100),
|
|
'is_active' => true,
|
|
'created_by' => 1,
|
|
'updated_by' => 1,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Screen model condition rules.
|
|
*/
|
|
public function screenRules(): static
|
|
{
|
|
return $this->sequence(
|
|
[
|
|
'name' => '케이스 규칙',
|
|
'description' => '크기에 따른 케이스 선택',
|
|
'condition_expression' => 'area <= 3',
|
|
'component_code' => 'CASE-SMALL',
|
|
'quantity_expression' => '1',
|
|
'priority' => 10,
|
|
],
|
|
[
|
|
'name' => '케이스 규칙 (중형)',
|
|
'description' => '중형 크기 케이스',
|
|
'condition_expression' => 'area > 3 AND area <= 6',
|
|
'component_code' => 'CASE-MEDIUM',
|
|
'quantity_expression' => '1',
|
|
'priority' => 11,
|
|
],
|
|
[
|
|
'name' => '케이스 규칙 (대형)',
|
|
'description' => '대형 크기 케이스',
|
|
'condition_expression' => 'area > 6',
|
|
'component_code' => 'CASE-LARGE',
|
|
'quantity_expression' => '1',
|
|
'priority' => 12,
|
|
],
|
|
[
|
|
'name' => '바텀 규칙',
|
|
'description' => '바텀 개수',
|
|
'condition_expression' => 'TRUE',
|
|
'component_code' => 'BOTTOM-001',
|
|
'quantity_expression' => 'CEIL(W1 / 1000)',
|
|
'priority' => 20,
|
|
],
|
|
[
|
|
'name' => '샤프트 규칙',
|
|
'description' => '샤프트 길이',
|
|
'condition_expression' => 'TRUE',
|
|
'component_code' => 'SHAFT-001',
|
|
'quantity_expression' => 'W1 / 1000',
|
|
'priority' => 30,
|
|
],
|
|
[
|
|
'name' => '파이프 규칙',
|
|
'description' => '파이프 길이',
|
|
'condition_expression' => 'screen_type = "SCREEN"',
|
|
'component_code' => 'PIPE-SCREEN',
|
|
'quantity_expression' => 'W1 / 1000',
|
|
'priority' => 40,
|
|
],
|
|
[
|
|
'name' => '슬라트 파이프 규칙',
|
|
'description' => '슬라트용 파이프',
|
|
'condition_expression' => 'screen_type = "SLAT"',
|
|
'component_code' => 'PIPE-SLAT',
|
|
'quantity_expression' => 'W1 / 1000',
|
|
'priority' => 41,
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Steel model condition rules.
|
|
*/
|
|
public function steelRules(): static
|
|
{
|
|
return $this->sequence(
|
|
[
|
|
'name' => '프레임 규칙',
|
|
'description' => '프레임 길이',
|
|
'condition_expression' => 'TRUE',
|
|
'component_code' => 'FRAME-STEEL',
|
|
'quantity_expression' => '(W1 + H1) * 2 / 1000',
|
|
'priority' => 10,
|
|
],
|
|
[
|
|
'name' => '패널 규칙',
|
|
'description' => '패널 개수',
|
|
'condition_expression' => 'TRUE',
|
|
'component_code' => 'PANEL-STEEL',
|
|
'quantity_expression' => 'CEIL(area)',
|
|
'priority' => 20,
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* High priority rule.
|
|
*/
|
|
public function highPriority(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'priority' => $this->faker->numberBetween(1, 10),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Low priority rule.
|
|
*/
|
|
public function lowPriority(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'priority' => $this->faker->numberBetween(90, 100),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Active rule.
|
|
*/
|
|
public function active(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => true,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Inactive rule.
|
|
*/
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => false,
|
|
]);
|
|
}
|
|
} |