- PT-CASE-3600 (3600mm, 180,000원) 품목 추가 - PT-CASE-6000 (6000mm, 280,000원) 품목 추가 - CASE_AUTO_SELECT 범위에 3600, 6000 구간 추가 - 5130 레거시 데이터 기반 가격 적용
346 lines
14 KiB
PHP
346 lines
14 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class QuoteFormulaItemSeeder extends Seeder
|
|
{
|
|
/**
|
|
* 견적수식 품목 시드 데이터
|
|
* 견적서에 들어갈 품목 마스터
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// 수식 ID 맵 조회
|
|
$formulas = DB::table('quote_formulas')
|
|
->whereIn('variable', [
|
|
'GR_AUTO_SELECT',
|
|
'CASE_AUTO_SELECT',
|
|
'MOTOR_AUTO_SELECT',
|
|
'CTRL_AUTO_SELECT',
|
|
'EDGE_QTY',
|
|
'INSP_FEE',
|
|
])
|
|
->pluck('id', 'variable')
|
|
->toArray();
|
|
|
|
$items = [];
|
|
|
|
// ==============================
|
|
// 1. 가이드레일 품목
|
|
// ==============================
|
|
if (isset($formulas['GR_AUTO_SELECT'])) {
|
|
$items = array_merge($items, [
|
|
[
|
|
'formula_id' => $formulas['GR_AUTO_SELECT'],
|
|
'item_code' => 'PT-GR-1219',
|
|
'item_name' => '가이드레일 1219',
|
|
'specification' => '1219mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '2',
|
|
'unit_price_formula' => '28000',
|
|
'sort_order' => 1,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['GR_AUTO_SELECT'],
|
|
'item_code' => 'PT-GR-2438',
|
|
'item_name' => '가이드레일 2438',
|
|
'specification' => '2438mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '2',
|
|
'unit_price_formula' => '35000',
|
|
'sort_order' => 2,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['GR_AUTO_SELECT'],
|
|
'item_code' => 'PT-GR-3000',
|
|
'item_name' => '가이드레일 3000',
|
|
'specification' => '3000mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '2',
|
|
'unit_price_formula' => '42000',
|
|
'sort_order' => 3,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['GR_AUTO_SELECT'],
|
|
'item_code' => 'PT-GR-3600',
|
|
'item_name' => '가이드레일 3600',
|
|
'specification' => '3600mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '2',
|
|
'unit_price_formula' => '50000',
|
|
'sort_order' => 4,
|
|
],
|
|
]);
|
|
}
|
|
|
|
// ==============================
|
|
// 2. 케이스(셔터박스) 품목
|
|
// ==============================
|
|
if (isset($formulas['CASE_AUTO_SELECT'])) {
|
|
$items = array_merge($items, [
|
|
[
|
|
'formula_id' => $formulas['CASE_AUTO_SELECT'],
|
|
'item_code' => 'PT-CASE-1219',
|
|
'item_name' => '케이스 1219',
|
|
'specification' => '1219mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '85000',
|
|
'sort_order' => 1,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CASE_AUTO_SELECT'],
|
|
'item_code' => 'PT-CASE-2438',
|
|
'item_name' => '케이스 2438',
|
|
'specification' => '2438mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '120000',
|
|
'sort_order' => 2,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CASE_AUTO_SELECT'],
|
|
'item_code' => 'PT-CASE-3000',
|
|
'item_name' => '케이스 3000',
|
|
'specification' => '3000mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '150000',
|
|
'sort_order' => 3,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CASE_AUTO_SELECT'],
|
|
'item_code' => 'PT-CASE-3600',
|
|
'item_name' => '케이스 3600',
|
|
'specification' => '3600mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '180000',
|
|
'sort_order' => 4,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CASE_AUTO_SELECT'],
|
|
'item_code' => 'PT-CASE-6000',
|
|
'item_name' => '케이스 6000',
|
|
'specification' => '6000mm',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '280000',
|
|
'sort_order' => 5,
|
|
],
|
|
]);
|
|
}
|
|
|
|
// ==============================
|
|
// 3. 모터(개폐전동기) 품목 - 5130 실제 가격 기준
|
|
// ==============================
|
|
if (isset($formulas['MOTOR_AUTO_SELECT'])) {
|
|
$items = array_merge($items, [
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-150',
|
|
'item_name' => '개폐전동기 150kg',
|
|
'specification' => '150K(S)',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '285000', // 5130: 285,000원
|
|
'sort_order' => 1,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-300',
|
|
'item_name' => '개폐전동기 300kg',
|
|
'specification' => '300K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '300000', // 5130: 300,000원
|
|
'sort_order' => 2,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-400',
|
|
'item_name' => '개폐전동기 400kg',
|
|
'specification' => '400K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '330000', // 5130: 330,000원
|
|
'sort_order' => 3,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-500',
|
|
'item_name' => '개폐전동기 500kg',
|
|
'specification' => '500K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '370000', // 5130: 370,000원
|
|
'sort_order' => 4,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-600',
|
|
'item_name' => '개폐전동기 600kg',
|
|
'specification' => '600K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '380000', // 5130: 380,000원
|
|
'sort_order' => 5,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-800',
|
|
'item_name' => '개폐전동기 800kg',
|
|
'specification' => '800K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '550000', // 5130: 550,000원
|
|
'sort_order' => 6,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-1000',
|
|
'item_name' => '개폐전동기 1000kg',
|
|
'specification' => '1000K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '600000', // 5130: 600,000원
|
|
'sort_order' => 7,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-1500',
|
|
'item_name' => '개폐전동기 1500kg',
|
|
'specification' => '1500K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '1300000', // 5130: 1,300,000원
|
|
'sort_order' => 8,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['MOTOR_AUTO_SELECT'],
|
|
'item_code' => 'PT-MOTOR-2000',
|
|
'item_name' => '개폐전동기 2000kg',
|
|
'specification' => '2000K',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '1600000', // 5130: 1,600,000원
|
|
'sort_order' => 9,
|
|
],
|
|
]);
|
|
}
|
|
|
|
// ==============================
|
|
// 4. 제어기 품목 - 5130 실제 가격 기준
|
|
// ==============================
|
|
if (isset($formulas['CTRL_AUTO_SELECT'])) {
|
|
$items = array_merge($items, [
|
|
[
|
|
'formula_id' => $formulas['CTRL_AUTO_SELECT'],
|
|
'item_code' => 'PT-CTRL-EMB',
|
|
'item_name' => '매립형 제어기',
|
|
'specification' => '매립형',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '130000', // 5130: 130,000원
|
|
'sort_order' => 1,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CTRL_AUTO_SELECT'],
|
|
'item_code' => 'PT-CTRL-EXP',
|
|
'item_name' => '노출형 제어기',
|
|
'specification' => '노출형',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '130000', // 5130: 130,000원
|
|
'sort_order' => 2,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CTRL_AUTO_SELECT'],
|
|
'item_code' => 'PT-CTRL-BOX-1P',
|
|
'item_name' => '콘트롤박스 단상',
|
|
'specification' => '단상',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '100000', // 5130: 100,000원
|
|
'sort_order' => 3,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CTRL_AUTO_SELECT'],
|
|
'item_code' => 'PT-CTRL-BOX-3P',
|
|
'item_name' => '콘트롤박스 삼상',
|
|
'specification' => '삼상',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '100000', // 5130: 100,000원
|
|
'sort_order' => 4,
|
|
],
|
|
[
|
|
'formula_id' => $formulas['CTRL_AUTO_SELECT'],
|
|
'item_code' => 'PT-CTRL-BOX-1500K',
|
|
'item_name' => '콘트롤박스 1500K',
|
|
'specification' => '1500K용',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => '150000', // 5130: 150,000원
|
|
'sort_order' => 5,
|
|
],
|
|
]);
|
|
}
|
|
|
|
// ==============================
|
|
// 5. 마구리 품목
|
|
// ==============================
|
|
if (isset($formulas['EDGE_QTY'])) {
|
|
$items = array_merge($items, [
|
|
[
|
|
'formula_id' => $formulas['EDGE_QTY'],
|
|
'item_code' => 'PT-EDGE-STD',
|
|
'item_name' => '마구리 날개',
|
|
'specification' => '표준형',
|
|
'unit' => 'EA',
|
|
'quantity_formula' => 'EDGE_QTY',
|
|
'unit_price_formula' => '12000',
|
|
'sort_order' => 1,
|
|
],
|
|
]);
|
|
}
|
|
|
|
// ==============================
|
|
// 6. 검사비 품목
|
|
// ==============================
|
|
if (isset($formulas['INSP_FEE'])) {
|
|
$items = array_merge($items, [
|
|
[
|
|
'formula_id' => $formulas['INSP_FEE'],
|
|
'item_code' => 'SV-INSP-STD',
|
|
'item_name' => '제품 검사비',
|
|
'specification' => '표준 검사',
|
|
'unit' => '식',
|
|
'quantity_formula' => '1',
|
|
'unit_price_formula' => 'INSP_FEE',
|
|
'sort_order' => 1,
|
|
],
|
|
]);
|
|
}
|
|
|
|
// 데이터 삽입
|
|
foreach ($items as $item) {
|
|
DB::table('quote_formula_items')->updateOrInsert(
|
|
[
|
|
'formula_id' => $item['formula_id'],
|
|
'item_code' => $item['item_code'],
|
|
],
|
|
array_merge($item, [
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
])
|
|
);
|
|
}
|
|
|
|
$this->command->info('QuoteFormulaItemSeeder: '.count($items).'개 품목 생성 완료');
|
|
}
|
|
}
|