Commit Graph

626 Commits

Author SHA1 Message Date
1c3cb48c7c feat(API): FCM 채널명 동기화 및 config 일원화 (7채널)
- push_urgent → push_vendor_register (거래처등록)
- push_payment → push_approval_request (결재요청)
- push_income 신규 추가 (입금)
- config/fcm.php에 전체 7개 채널 등록 (기존 2개→7개)
- 서비스 파일 하드코딩을 config() 참조로 전환

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:07:44 +09:00
c111b2b55d fix(API): CommonCode 라벨 조회 시 테넌트 스코프 적용
- getLabel(), getCodeMap()에서 withoutGlobalScopes() → query()로 변경
- BelongsToTenant 스코프가 적용되어 테넌트별 공통코드 정상 조회

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:35:36 +09:00
591197f29c fix(API): fix_unique_key 마이그레이션에 테이블 존재 체크 추가
- 테이블 미존재 시 스킵하여 순서 무관하게 안전 실행

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:32:29 +09:00
5b553ea13c fix(API): 마이그레이션 순서 수정 - fix_unique_key를 테이블 생성 이후로 이동
- 090000 → 100500으로 변경 (100200 create, 100400 add_columns 이후 실행되도록)
- 로컬 fresh 환경에서 테이블 미존재 상태로 unique key 추가 시 에러 방지

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:31:01 +09:00
pro
d412ae45b7 fix:Laravel 12 호환 - Doctrine DBAL 대신 DB::select 사용
- getDoctrineSchemaManager() 제거 (Laravel 12에서 미지원)
- 인덱스 존재 여부 확인을 SHOW INDEX 쿼리로 변경

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:17:16 +09:00
pro
73dd6595d0 fix:sales_scenario_checklists 생성 마이그레이션 테이블 존재 체크 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:16:20 +09:00
pro
f30fbadc90 fix:sales_consultations 마이그레이션 테이블 존재 체크 추가
- 테이블이 없으면 건너뛰도록 수정
- 컬럼이 이미 존재하면 건너뛰도록 수정

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:15:53 +09:00
pro
e407c40228 fix:마이그레이션 인덱스 존재 여부 체크 추가
- sales_scenario_unique 인덱스 삭제 전 존재 여부 확인
- sales_scenario_checkpoint_unique 생성 전 존재 여부 확인
- 서버 환경에서 이미 수동으로 인덱스가 변경된 경우 대응

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:15:09 +09:00
pro
60a1d753fd feat:sales_scenario_checklists 테이블 누락 컬럼 마이그레이션 추가
- scenario_type (ENUM: sales/manager)
- checkpoint_id (VARCHAR 50)
- checked_at (TIMESTAMP)
- checked_by (BIGINT UNSIGNED)
- memo (TEXT)
- UNIQUE KEY, INDEX 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:12:25 +09:00
a5576a0e00 Merge remote-tracking branch 'origin/develop' into develop 2026-01-30 13:51:49 +09:00
c9e37f4338 fix(API): Schedule 모델 Builder import 누락으로 캘린더/현황판 500 에러 수정
- scopeForTenant 등 스코프 메서드에서 Builder 타입힌트 사용하나 import 누락
- CalendarService, StatusBoardService에서 forTenant() 호출 시 500 발생

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 12:00:13 +09:00
pro
69fa80d36e merge: origin/develop 병합
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 11:55:50 +09:00
63afa4fc9b feat(API): 경동 견적 계산 개선 및 stock_transactions 관계 문서 갱신
- FormulaEvaluatorService: 완제품 미등록 상태에서도 경동 전용 계산 진행, product_model/finishing_type/installation_type 변수 추가
- LOGICAL_RELATIONSHIPS.md: stock_transactions 모델 관계 반영

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 11:23:35 +09:00
66887c9c69 fix(API): 입고 수정 시 completed 상태 변경 지원
- UpdateReceivingRequest: status 허용값에 completed 추가, receiving_qty/receiving_date/lot_no 필드 추가
- ReceivingService::update(): status가 completed로 변경 시 LOT번호 자동생성, 입고수량/입고일 설정, 재고 연동(StockService) 처리

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 11:22:28 +09:00
0fbd080875 docs: sam_stat Swagger API 문서 추가 (Phase 6)
- StatApi.php: Stats 태그, 4개 엔드포인트 Swagger 정의
  - GET /stats/summary - 대시보드 통계 요약
  - GET /stats/daily - 도메인별 일간 통계
  - GET /stats/monthly - 도메인별 월간 통계
  - GET /stats/alerts - 통계 알림 목록
- 스키마: StatSalesDaily, StatFinanceDaily, StatDashboardSummary, StatAlert

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 09:23:51 +09:00
ca2dd44567 fix: 환봉·각파이프 5130 자동계산 공식 적용
- 환봉: W0 기준 자동계산 (≤3000→1, ≤6000→2, ≤9000→3, ≤12000→4 × 수량)
- 각파이프: col67(케이스길이+3000×연결수) 기준 3000mm/6000mm 수량 자동계산
- 기존 하드코딩(각파이프 1개, 환봉 0개) 제거

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 22:55:40 +09:00
e300062f32 fix: 견적 계산 마구리 수량·각파이프 구조 5130 일치 보정
- 케이스 마구리: 수량 2 고정 → quantity 기반 (5130: maguriPrices × $su)
- 각파이프: 하드코딩 1개 → pipe_3000_qty/pipe_6000_qty 2종 분리 (5130: col68+col69)
- 기본값 fallback: 파이프 수량 미입력 시 W0 기준 자동 결정 유지

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 22:28:27 +09:00
ca51867cc2 feat: sam_stat 최적화 및 안정화 (Phase 5)
- StatBackfillCommand: 과거 데이터 일괄 백필 (일간+월간, 프로그레스바, 에러 리포트)
- StatVerifyCommand: 원본 DB vs sam_stat 정합성 교차 검증 (--fix 자동 재집계)
- 파티셔닝 준비: 7개 일간 테이블 RANGE COLUMNS(stat_date) 마이그레이션
- Redis 캐싱: StatQueryService Cache::remember TTL 5분 + invalidateCache()
- StatMonitorService: 집계 실패/누락/불일치 시 stat_alerts 알림 기록
- StatAggregatorService: 모니터링 알림 + 캐시 무효화 연동

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 22:17:11 +09:00
3793e95662 fix: 견적 단가 chandj 원본 소스 전환 및 5130 계산 일치 보정
- MigrateBDModelsPrices: chandj 원본 테이블(price_motor, price_angle 등)에서 직접 마이그레이션
- EstimatePriceService: 모터 LIKE 매칭, 제어기 카테고리 분리, 앵글 bracket/main 분리, 샤프트 포맷 정규화
- KyungdongFormulaHandler:
  - 검사비 항목 추가 (기본 50,000원)
  - 뒷박스 항목 추가 (제어기 섹션)
  - 부자재 앵글3T 항목 추가 (calculatePartItems)
  - 면적 소수점 2자리 반올림 후 곱셈 (5130 동일)
  - model_name에 product_model fallback 추가 (KSS02 단가 정확 조회)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 22:00:15 +09:00
4d8dac1091 feat: sam_stat P2 도메인 + 통계 API + 대시보드 전환 (Phase 4)
- 4.1: stat_project_monthly + ProjectStatService (건설/프로젝트 월간)
- 4.2: stat_system_daily + SystemStatService (API/감사/FCM/파일/결재)
- 4.3: stat_events, stat_snapshots + StatEventService + StatEventObserver
- 4.4: StatController (summary/daily/monthly/alerts) + StatQueryService + FormRequest 3개 + routes/stats.php
- 4.5: DashboardService sam_stat 우선 조회 + 원본 DB 폴백 패턴

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 21:56:53 +09:00
595e3d59b4 feat: sam_stat P1 도메인 확장 (Phase 3)
- 차원 테이블: dim_client, dim_product 마이그레이션 + SCD Type 2 동기화 (DimensionSyncService)
- 재고 통계: stat_inventory_daily + InventoryStatService (stocks, stock_transactions, inspections)
- 견적/영업 통계: stat_quote_pipeline_daily + QuoteStatService (quotes, biddings, sales_prospects)
- 인사/근태 통계: stat_hr_attendance_daily + HrStatService (attendances, leaves, user_tenants)
- KPI/알림: stat_kpi_targets, stat_alerts + KpiAlertService + StatCheckKpiAlertsCommand
- StatAggregatorService에 inventory, quote, hr 도메인 추가 (총 6개 도메인)
- 스케줄러: stat:check-kpi-alerts 매일 09:00 등록

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 20:19:50 +09:00
6c9735581d feat: 견적 단가를 items+item_details+prices 통합 구조로 전환
- EstimatePriceService 생성: items+item_details+prices JOIN 기반 단가 조회
  - item_details.product_category/part_type/specification 컬럼 매핑
  - items.attributes JSON으로 model_name/finishing_type 추가 차원 처리
  - 세션 내 캐시로 중복 조회 방지
- MigrateBDModelsPrices 커맨드: 레거시 BDmodels + kd_price_tables → 85건 마이그레이션
- KyungdongFormulaHandler: KdPriceTable 의존 제거 → EstimatePriceService 사용
- FormulaEvaluatorService: W1 마진 140→160, 면적 공식 W1×(H1+550) 수정
  - 가이드레일 H0+250, 케이스/L바/평철 W0+220 (레거시 일치)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 19:30:46 +09:00
e882d33de1 feat: sam_stat P0 도메인 집계 구현 (Phase 2)
- 영업(Sales), 재무(Finance), 생산(Production) 3개 도메인 구현
- 일간/월간 통계 테이블 6개 마이그레이션 생성
- 도메인별 StatService (SalesStatService, FinanceStatService, ProductionStatService)
- Daily/Monthly 6개 Eloquent 모델 생성
- StatAggregatorService에 도메인 서비스 매핑 활성화
- StatJobLog duration_ms abs() 처리
- 스케줄러 등록 (일간 02:00, 월간 1일 03:00)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 19:30:30 +09:00
pro
68ffbdfa08 feat:영업수수료 정산 마이그레이션 추가
- sales_commissions 테이블 생성 (영업수수료 정산)
- sales_commission_details 테이블 생성 (상품별 수당 내역)
- sales_tenant_managements 테이블에 입금 정보 컬럼 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 18:13:59 +09:00
c88048db67 feat: sam_stat 통계 DB 인프라 구축 (Phase 1)
- sam_stat DB 연결 설정 (config/database.php, .env)
- 메타 테이블 마이그레이션 (stat_definitions, stat_job_logs)
- dim_date 차원 테이블 + DimDateSeeder (2020~2030, 4018건)
- 기반 모델: BaseStatModel, StatDefinition, StatJobLog, DimDate
- 집계 커맨드: stat:aggregate-daily, stat:aggregate-monthly
- StatAggregatorService + StatDomainServiceInterface 골격

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 17:13:36 +09:00
4f2a329e4e fix: 출금 오늘의 이슈 path 분기 (1건: 상세, 2건+: 목록)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:42:41 +09:00
pro
f8d37f0b5e refactor:sales_contract_products 테이블 development_fee → registration_fee 변경 2026-01-29 16:38:34 +09:00
pro
ff829ad184 feat:가입비(registration_fee) 컬럼 추가 및 시더 업데이트 2026-01-29 16:31:50 +09:00
ef4a894cbc fix: TenantUserProfile 모델 Eloquent Model import 누락 수정
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:28:57 +09:00
pro
8327568a77 fix:상품 가격 데이터 현실화 (개발비 8천만원, 구독료 50만원 등) 2026-01-29 16:25:30 +09:00
pro
e7054b6633 feat:영업파트너/매니저 수당율 분리 (commission_rate → partner/manager) 2026-01-29 16:18:22 +09:00
e1aa1d1577 fix: TenantSettingController namespace 대소문자 수정 (v1 → V1)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:38:09 +09:00
45a15fe64f fix: BiddingController namespace 대소문자 수정 (v1 → V1)
- Linux 대소문자 구분으로 Swagger 문서 생성 실패 해결

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:36:11 +09:00
189b38c936 feat: Auditable 트레이트 구현 및 97개 모델 적용
- Auditable 트레이트 신규 생성 (bootAuditable 패턴)
  - creating: created_by/updated_by 자동 채우기
  - updating: updated_by 자동 채우기
  - deleting: deleted_by 채우기 + saveQuietly()
  - created/updated/deleted: audit_logs 자동 기록
- 기존 AuditLogger 패턴과 동일한 try/catch 조용한 실패
- 변경된 필드만 before/after 기록 (updated 이벤트)
- auditExclude 프로퍼티로 모델별 제외 필드 설정 가능
- 제외 대상: Attendance, StockTransaction, TodayIssue 등 고빈도/시스템 모델

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:33:54 +09:00
00a1257c63 fix: ApprovalStep 모델 Eloquent Model import 누락 수정
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:29:01 +09:00
99a6c89d41 feat: 견적 할인금액(discount_amount) 직접 입력 지원
- QuoteStoreRequest/UpdateRequest에 discount_amount 필드 추가
- QuoteService: 프론트엔드에서 계산한 할인금액 우선 사용, 없으면 비율로 계산

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:05:14 +09:00
f7ad9ae36e feat(재고): stock_transactions 입출고 거래 이력 테이블 추가
- stock_transactions 마이그레이션 생성 (type, qty, balance_qty, reference)
- StockTransaction 모델 (IN/OUT/RESERVE/RELEASE 타입, 사유 상수)
- StockService 5개 메서드에 거래 이력 기록 추가
  - increaseFromReceiving → IN
  - decreaseFIFO → OUT (LOT별)
  - reserve → RESERVE (LOT별)
  - releaseReservation → RELEASE (LOT별)
  - decreaseForShipment → OUT (LOT별)
- Stock 모델에 transactions() 관계 추가
- 기존 audit_logs 기록은 유지 (감사 로그와 거래 이력 목적 분리)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:05:03 +09:00
847717e631 feat(거래처): client_type 필터 추가
- ClientService.index()에 client_type 파라미터 필터 추가
- 쉼표 구분 복수 값 지원 (예: PURCHASE,BOTH)
- 매입 가능 거래처만 조회하는 용도

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:04:55 +09:00
pro
e439bfffda feat:영업 상품관리 DB 스키마 및 시더 추가
- sales_product_categories: 상품 카테고리 테이블
- sales_products: 영업 상품 테이블
- sales_contract_products: 계약별 선택 상품 테이블
- SalesProductSeeder: 제조업체 8개, 공사업체 3개 상품 초기 데이터

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:02:07 +09:00
e8fc42c14d fix: 입고 목록 날짜 필터 기준을 created_at으로 변경
- receiving_date 기준 → created_at(작성일) 기준으로 변경
- 입고처리 전(receiving_date=NULL) 데이터가 필터에서 누락되는 문제 해결
- creator 관계 eager loading 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:40:32 +09:00
a25d267550 fix: 입고 등록 order_qty 필수 검증 제거
- StoreReceivingRequest에서 order_qty를 required → nullable로 변경
- 입고 등록 시 발주수량 없이도 등록 가능하도록 수정

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 13:48:03 +09:00
pro
c7339ac7db feat:본사 진행 상태 및 수당 지급 상태 컬럼 추가
sales_tenant_managements 테이블:
- hq_status: 본사 진행 상태 (pending, review, planning, coding, dev_test, dev_done, int_test, handover)
- incentive_status: 수당 지급 상태 (pending, eligible, paid)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:39:20 +09:00
7acaac8340 feat: 출금 오늘의 이슈를 일일 누계 방식으로 변경
- 출금 건별 개별 이슈 → 해당일 누계 1건으로 upsert
- 첫 건: "거래처명 출금 금액원"
- 2건+: "첫거래처명 외 N건 출금 합계 금액원"
- 삭제 시 남은 건수/금액으로 자동 갱신
- FCM 푸시 미발송 (알림 설정 미구현)
- 기존 개별 source_id 레거시 이슈 자동 정리

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:03:19 +09:00
aa7678c358 feat: 수동 품목 단가 조회 API 추가 및 디버그 로그 정리
- QuoteController에 getItemPrices 엔드포인트 추가
- QuoteCalculationService에 품목 코드 배열로 단가 조회 기능 추가
- 불필요한 디버그 로그 제거

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:29:19 +09:00
pro
27a558dafb feat:sales_consultations에 gcs_uri 컬럼 추가
- 음성 녹음 파일의 Google Cloud Storage URI 저장용

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:15:22 +09:00
946e008b02 fix: API 라우트 분리 시 누락된 라우트 복구
분리 전 원본 라우트와 비교하여 누락된 17개 라우트 복구:

[design.php]
- BomCalculationController: calculateBom, getCompanyFormulas, getEstimateParameters, saveCompanyFormula, testFormula
- DesignBomTemplateController: cloneTemplate, diff, listByVersion, replaceItems, upsertTemplate
- DesignModelVersionController: createDraft (store → createDraft 메서드명 수정)
- ModelSetController: calculateBom, getBomTemplates, getCategoryFields, getEstimateParameters

[inventory.php]
- ItemsFileController: upload, delete (store/destroy → upload/delete 메서드명 수정)
- ItemsBomController: listAll, listCategories, tree, replace
- ItemsController: showByCode, batchDestroy
- LaborController: stats, bulkDestroy

[sales.php]
- ClientController: bulkDestroy
- ClientGroupController: toggle
- BiddingController: updateStatus
- PricingController: stats, cost, byItems, bulkDestroy, finalize, revisions
- QuoteController: convertToBidding, convertToOrder, sendHistory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:10:13 +09:00
pro
4c7cf85ef9 fix:시나리오 체크리스트 유니크 키 수정
- 기존 유니크 키 (tenant_id, user_id, step_id, checkpoint_index) 삭제
- 새 유니크 키 (tenant_id, scenario_type, step_id, checkpoint_id) 생성
- checkpoint_index를 nullable로 변경

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:00:07 +09:00
87e20e965a feat: BOM 계산 debug_steps에 수식 정보 추가
- calculateKyungdongBom 메서드에 formulas 배열 추가
- Step 1: 입력값 (변수, 설명, 값, 단위)
- Step 3: 변수계산 (수식, 대입, 결과)
- Step 6-7: 품목별 수량/금액 계산 과정
- Step 9: 카테고리별 소계 계산
- Step 10: 최종합계 수식
- 프론트엔드에서 실제 계산 수식 확인 가능

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 08:17:34 +09:00
a0ffeb954b fix: 견적 확정/취소 API 라우트 추가
- POST /quotes/{id}/finalize 라우트 추가
- POST /quotes/{id}/cancel-finalize 라우트 추가
- 라우트 누락으로 인한 404 오류 수정

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 07:44:04 +09:00
pro
6208d90244 feat:영업관리 테이블 마이그레이션 추가
- sales_partners: 영업 파트너 정보
- sales_tenant_managements: 테넌트별 영업 관리 (tenant_id FK)
- sales_scenario_checklists: 시나리오 체크리스트
- sales_consultations: 상담 기록 (텍스트/음성/파일)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 06:42:25 +09:00