Files
sam-design/src/temp_guiderail_function.tsx
정재웅 060b9ce2ef 프로젝트 초기 설정 및 구조 추가
- Vite + React 프로젝트 구조 설정
- 불필요한 PDF 파일 삭제

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 13:01:43 +09:00

121 lines
8.1 KiB
TypeScript

// 가이드레일 산정 기준 재생성 함수
const handleRecreateGuideRailRules = () => {
try {
// 새로운 가이드레일 산정 기준 생성 (첨부 이미지 기준 적용)
// 제작길이(G) = H0 + 250
// 설치 유형별로 4개 규칙 생성: 벽면형/측면형
const timestamp = Date.now();
const newGuideRailRules: FormulaRule[] = [
// 벽면형 가이드레일 기준
{
id: `rule-gr-wall-${timestamp}`,
ruleCode: 'GUIDE-RAIL-WALL',
ruleName: '가이드레일 품목 선택 (벽면형)',
category: 'guide-rail',
subcategory: '벽면형',
ruleType: 'range',
description: '벽면형 설치: 가이드레일 제작길이(G=H0+250) 구간별 품목 선택',
inputVariable: 'G',
status: 'active',
ranges: [
{ id: `range-${timestamp}-w1`, minValue: 1219, maxValue: 2438, result: '2438 x2개', itemCode: 'GR-2438', itemName: '가이드레일 2438mm', quantity: 2, description: '1219~2438mm: 2438 x2개' },
{ id: `range-${timestamp}-w2`, minValue: 2439, maxValue: 3000, result: '3000 x2개', itemCode: 'GR-3000', itemName: '가이드레일 3000mm', quantity: 2, description: '2439~3000mm: 3000 x2개' },
{ id: `range-${timestamp}-w3`, minValue: 3001, maxValue: 3500, result: '3500 x2개', itemCode: 'GR-3500', itemName: '가이드레일 3500mm', quantity: 2, description: '3001~3500mm: 3500 x2개' },
{ id: `range-${timestamp}-w4`, minValue: 3501, maxValue: 4000, result: '4000 x2개', itemCode: 'GR-4000', itemName: '가이드레일 4000mm', quantity: 2, description: '3501~4000mm: 4000 x2개' },
{ id: `range-${timestamp}-w5`, minValue: 4001, maxValue: 4300, result: '4300 x2개', itemCode: 'GR-4300', itemName: '가이드레일 4300mm', quantity: 2, description: '4001~4300mm: 4300 x2개' },
{ id: `range-${timestamp}-w6`, minValue: 4301, maxValue: 5438, result: '3000 x2 + 3500 x2', itemCode: 'GR-COMBO-3000-3500', itemName: '가이드레일 조합 (3000+3500)', quantity: 1, description: '4301~5438mm: 3000 x2 + 3500 x2' },
{ id: `range-${timestamp}-w7`, minValue: 5439, maxValue: 6000, result: '3000 x4개', itemCode: 'GR-3000', itemName: '가이드레일 3000mm', quantity: 4, description: '5439~6000mm: 3000 x4개' },
{ id: `range-${timestamp}-w8`, minValue: 6001, maxValue: 6500, result: '4000 x2개', itemCode: 'GR-4000', itemName: '가이드레일 4000mm', quantity: 2, description: '6001~6500mm: 4000 x2개' },
{ id: `range-${timestamp}-w9`, minValue: 6501, maxValue: 7000, result: '4300 x2개', itemCode: 'GR-4300', itemName: '가이드레일 4300mm', quantity: 2, description: '6501~7000mm: 4300 x2개' },
{ id: `range-${timestamp}-w10`, minValue: 7001, maxValue: 7300, result: '4300 x2개', itemCode: 'GR-4300', itemName: '가이드레일 4300mm', quantity: 2, description: '7001~7300mm: 4300 x2개' }
],
currentRevision: 0,
isFinal: false,
createdAt: new Date().toISOString().split('T')[0],
createdBy: '시스템',
updatedAt: new Date().toISOString().split('T')[0]
},
// 측면형 가이드레일 기준
{
id: `rule-gr-side-${timestamp}`,
ruleCode: 'GUIDE-RAIL-SIDE',
ruleName: '가이드레일 품목 선택 (측면형)',
category: 'guide-rail',
subcategory: '측면형',
ruleType: 'range',
description: '측면형 설치: 가이드레일 제작길이(G=H0+250) 구간별 품목 선택',
inputVariable: 'G',
status: 'active',
ranges: [
{ id: `range-${timestamp}-s1`, minValue: 1219, maxValue: 2438, result: '2438 x2개', itemCode: 'GR-2438', itemName: '가이드레일 2438mm', quantity: 2, description: '1219~2438mm: 2438 x2개' },
{ id: `range-${timestamp}-s2`, minValue: 2439, maxValue: 3000, result: '3000 x2개', itemCode: 'GR-3000', itemName: '가이드레일 3000mm', quantity: 2, description: '2439~3000mm: 3000 x2개' },
{ id: `range-${timestamp}-s3`, minValue: 3001, maxValue: 3500, result: '3500 x2개', itemCode: 'GR-3500', itemName: '가이드레일 3500mm', quantity: 2, description: '3001~3500mm: 3500 x2개' },
{ id: `range-${timestamp}-s4`, minValue: 3501, maxValue: 4000, result: '4000 x2개', itemCode: 'GR-4000', itemName: '가이드레일 4000mm', quantity: 2, description: '3501~4000mm: 4000 x2개' },
{ id: `range-${timestamp}-s5`, minValue: 4001, maxValue: 4300, result: '4300 x2개', itemCode: 'GR-4300', itemName: '가이드레일 4300mm', quantity: 2, description: '4001~4300mm: 4300 x2개' },
{ id: `range-${timestamp}-s6`, minValue: 4301, maxValue: 5438, result: '3000 x2 + 3500 x2', itemCode: 'GR-COMBO-3000-3500', itemName: '가이드레일 조합 (3000+3500)', quantity: 1, description: '4301~5438mm: 3000 x2 + 3500 x2' },
{ id: `range-${timestamp}-s7`, minValue: 5439, maxValue: 6000, result: '3000 x4개', itemCode: 'GR-3000', itemName: '가이드레일 3000mm', quantity: 4, description: '5439~6000mm: 3000 x4개' },
{ id: `range-${timestamp}-s8`, minValue: 6001, maxValue: 6500, result: '4000 x2개', itemCode: 'GR-4000', itemName: '가이드레일 4000mm', quantity: 2, description: '6001~6500mm: 4000 x2개' },
{ id: `range-${timestamp}-s9`, minValue: 6501, maxValue: 7000, result: '4300 x2개', itemCode: 'GR-4300', itemName: '가이드레일 4300mm', quantity: 2, description: '6501~7000mm: 4300 x2개' },
{ id: `range-${timestamp}-s10`, minValue: 7001, maxValue: 7300, result: '4300 x2개', itemCode: 'GR-4300', itemName: '가이드레일 4300mm', quantity: 2, description: '7001~7300mm: 4300 x2개' }
],
currentRevision: 0,
isFinal: false,
createdAt: new Date().toISOString().split('T')[0],
createdBy: '시스템',
updatedAt: new Date().toISOString().split('T')[0]
},
// 하부 Base 기준 (벽면형)
{
id: `rule-base-wall-${timestamp}`,
ruleCode: 'BASE-WALL',
ruleName: '하부 Base (벽면형)',
category: 'guide-rail',
subcategory: '하부Base-벽면형',
ruleType: 'fixed',
description: '벽면형 설치 시 하부 Base 수량',
fixedValue: 2,
unit: 'EA',
itemCode: 'BASE-WALL',
itemName: '하부 Base (벽면형)',
status: 'active',
currentRevision: 0,
isFinal: false,
createdAt: new Date().toISOString().split('T')[0],
createdBy: '시스템',
updatedAt: new Date().toISOString().split('T')[0]
},
// 하부 Base 기준 (측면형)
{
id: `rule-base-side-${timestamp}`,
ruleCode: 'BASE-SIDE',
ruleName: '하부 Base (측면형)',
category: 'guide-rail',
subcategory: '하부Base-측면형',
ruleType: 'fixed',
description: '측면형 설치 시 하부 Base 수량',
fixedValue: 2,
unit: 'EA',
itemCode: 'BASE-SIDE',
itemName: '하부 Base (측면형)',
status: 'active',
currentRevision: 0,
isFinal: false,
createdAt: new Date().toISOString().split('T')[0],
createdBy: '시스템',
updatedAt: new Date().toISOString().split('T')[0]
}
];
// 기존 가이드레일 산정 기준 삭제 후 새로운 기준 추가
setFormulaRules((prev) => {
const filtered = prev.filter(rule => rule.category !== 'guide-rail');
return [...filtered, ...newGuideRailRules];
});
alert('가이드레일 산정 기준이 재생성되었습니다!\n\n- 벽면형 가이드레일 기준 (10개 구간)\n- 측면형 가이드레일 기준 (10개 구간)\n- 하부 Base (벽면형) 기준\n- 하부 Base (측면형) 기준\n\n총 4개 규칙 생성 완료');
} catch (error) {
console.error('가이드레일 산정 기준 재생성 오류:', error);
alert('가이드레일 산정 기준 재생성 중 오류가 발생했습니다.');
}
};