Commit Graph

29 Commits

Author SHA1 Message Date
4dd38ab14d feat: [생산지시] 전용 API + 자재투입/공정 개선
- ProductionOrder 전용 엔드포인트 (목록/통계/상세)
- 재고생산 보조공정 일반 워크플로우에서 분리
- 자재투입 replace 모드 + bom_group_key 개별 저장
- 공정단계 options 컬럼 추가 (검사 설정/범위)
- 셔터박스 prefix isStandard 파라미터 제거

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 02:57:59 +09:00
16b8dbcc6f fix: 절곡 자재투입 dynamic_bom 수량 보정 및 개소당 수량 산출
- getMaterialsForItem(): dynamic_bom 우선 체크 추가 (정적 BOM만 확인하던 문제)
- dynamic_bom.qty를 woItem.quantity로 나눠 개소당 수량 산출 (작업일지 bendingInfo와 일치)
- getMaterials(): 동일하게 개소당 수량으로 변환
- 응답에 lot_prefix, part_type, category 필드 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 04:19:48 +09:00
5a3d6c2243 feat(WEB): 절곡 자재투입 LOT 매핑 파이프라인 구현
- PrefixResolver: 제품코드×마감재질→LOT prefix 결정 + BD-XX-NN 코드 생성
- DynamicBomEntry DTO: dynamic_bom JSON 항목 타입 안전 관리
- BendingInfoBuilder 확장: build() 리턴 변경 + buildDynamicBomForItem() 추가
- OrderService: 작업지시 생성 시 per-item dynamic_bom 자동 저장
- WorkOrderService.getMaterials(): dynamic_bom 우선 체크 + N+1 배치 최적화
- WorkOrderService.registerMaterialInput(): work_order_item_id 분기 라우팅 통일
- 단위 테스트 58개 + 통합 테스트 6개 (64 tests / 293 assertions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 04:19:47 +09:00
8be54c3b8b feat(WEB): 절곡품 선생산→재고적재 Phase 1 - 생산입고 기반 구축
- StockTransaction: REASON_PRODUCTION_OUTPUT 상수 및 '생산입고' 라벨 추가
- StockLot: work_order_id FK 컬럼 마이그레이션 + 모델 fillable/casts/relation 추가
- StockService: increaseFromProduction() 메서드 구현 (increaseFromReceiving 기반)
- WorkOrderService: 완료 시 sales_order_id 유무에 따라 출하/재고입고 분기
  - stockInFromProduction(): 품목별 양품 재고 입고 처리
  - shouldStockIn(): items.options 기반 입고 대상 판단

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 04:19:47 +09:00
400adb7c58 fix(WEB): 방화유리 수량 폴백 제거 및 수주→작업지시 파이프라인 개선
- OrderService: glass_qty에서 quantity 폴백 제거 (투시창 선택 시에만 유효)
- OrderService: createProductionOrder()에서 절곡 공정 bending_info 자동 생성
- OrderService: formula_source 없는 레거시 데이터의 sort_order 기반 개소 분배
- OrderService: note 파싱에서 '-' 단독값 무시 처리
- FormulaEvaluatorService: 철재 W1 계산 (W0+160 → W0+110) 레거시 일치
- WorkOrderService: store()에서 order_node_id null 품목용 rootNodes fallback 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 01:02:23 +09:00
6ae82b7057 fix: 작업지시 단건조회(show)에 materialInputs eager loading 추가
- show() 메서드에 items.materialInputs, items.materialInputs.stockLot 누락
- 목록조회에만 있고 단건조회에 빠져서 프론트 입고 LOT NO 표시 안됨

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:50:23 +09:00
74a83e6711 fix: 슬랫 작업일지 데이터 파이프라인 구축
- OrderService.createFromQuote: BOM 결과에서 slat_info(조인트바/방화유리 수량) 추출하여 OrderNode.options에 저장
- OrderService.createWorkOrders: nodeOptions에 slat_info 없을 때 bom_result에서 fallback 추출
- OrderService.syncFromQuote: 동일하게 slat_info 추출 추가
- WorkOrderService: salesOrder eager loading에 client_contact, options 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:50:23 +09:00
55270198d4 fix: 견적→수주 변환 시 담당자 정보 누락 수정
- Order::createFromQuote() 잘못된 필드명 수정 (contact_person→contact, delivery_date→completion_date)
- 견적 담당자(manager)를 orders.options.manager_name에 저장
- StoreOrderRequest/UpdateOrderRequest에 options.manager_name 유효성 검증 추가
- WorkOrderService show()에서 salesOrder.options 컬럼 포함하여 담당자 표시

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:50:13 +09:00
e4c53c7b17 feat:개소별 자재 투입 관리 API 추가
- work_order_material_inputs 테이블 신규 생성 (개소별 자재 투입 추적)
- 개소별 자재 조회/투입/이력/삭제/수정 API 5개 추가
- StockService.increaseToLot: LOT 수량 복원 메서드 추가
- WorkOrderService에 개소별 자재 투입 비즈니스 로직 구현
- WorkOrder, WorkOrderItem 모델에 materialInputs 관계 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 03:41:35 +09:00
45dd18dbab feat(API): 작업일지 생성/조회 API 추가
- WorkOrderService: getWorkLogTemplate, getWorkLog, createWorkLog 메서드 추가
- WorkOrderController: 작업일지 3개 엔드포인트 추가
- 라우트: GET work-log-template, GET/POST work-log
- WorkOrder 모델: documents() MorphMany 관계 추가
- i18n: work_log_saved, no_work_log_template 메시지 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:39:48 +09:00
376348a491 feat(API):자재 투입 LOT 조회 API 및 중간검사 데이터 정규화
- materialInputLots: stock_transactions 기반 투입 LOT 조회 엔드포인트 추가
- createInspectionDocument: 정규화 형식(section_id/column_id/field_key) 지원
- 레거시 형식(section_X_item_Y) 자동 변환 로직 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 00:01:25 +09:00
51aad4e522 feat(API): 검사 문서/성적서 연동 개선
- DocumentService: formatTemplateForReact 필드명 정합성 수정 (column_type, sub_labels, section title/image_path)
- WorkOrderService: process.options 로딩, 검사데이터 document_data 변환 로직 추가
- StoreItemInspectionRequest: templateValues 유효성 규칙 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 15:58:39 +09:00
1d7ef66d19 feat: 작업일지/중간검사 설정을 ProcessStep → Process 레벨로 이동
- Process 모델에 document_template_id, needs_work_log, work_log_template_id 추가
- ProcessStep에서 해당 필드 제거
- WorkOrderService의 검사 관련 3개 메서드(getInspectionTemplate, resolveInspectionDocument, createInspectionDocument) 공정 레벨 참조로 변경
- ProcessService eager loading에 documentTemplate, workLogTemplateRelation 추가
- FormRequest 검증 규칙 이동 (ProcessStep → Process)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 09:51:35 +09:00
6733a431bb feat:중간검사 API 다중단계/resolve/upsert 지원 (Phase 5.1.3)
- getInspectionTemplate: 전체 검사 단계 templates[] 반환 (기존 첫번째만→다중)
- resolveInspectionDocument 신규: step_id 기반 기존 문서 조회 또는 템플릿 반환
- createInspectionDocument 개선: step_id 파라미터, 기존 DRAFT/REJECTED 문서 update 지원
- GET inspection-resolve 라우트 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:55:29 +09:00
e885b1ca45 feat(API): 중간검사 문서 템플릿 동적 연동 - process_steps ↔ document_templates 연결
- process_steps 테이블에 document_template_id FK 추가 (migration)
- ProcessStep 모델에 documentTemplate BelongsTo 관계 추가
- ProcessStepService에서 documentTemplate eager loading
- StoreProcessStepRequest/UpdateProcessStepRequest에 document_template_id 유효성 검증
- WorkOrderService에 getInspectionTemplate(), createInspectionDocument() 메서드 추가
- WorkOrderController에 inspection-template/inspection-document 엔드포인트 추가
- DocumentService.formatTemplateForReact() 접근자 public으로 변경
- i18n 메시지 키 추가 (inspection_document_created, no_inspection_template)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 08:35:57 +09:00
5eaa5f036b fix(API): 자재투입 모달 중복 로트 버그 수정
동일 자재가 여러 작업지시 품목에 걸쳐 있을 때 StockLot이 중복 표시되던 문제 수정.
Phase 1(유니크 자재 수집) → Phase 2(로트 조회) 구조로 변경하여 중복 제거 및 필요수량 합산.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 16:47:50 +09:00
ee6794be1a feat: [생산관리] 중간검사 데이터 저장/조회 API 구현
- POST /work-orders/{id}/items/{itemId}/inspection: 품목별 검사 데이터 저장
- GET /work-orders/{id}/inspection-data: 전체 품목 검사 데이터 조회
- GET /work-orders/{id}/inspection-report: 검사 성적서용 데이터 조회
- WorkOrderItem 모델에 getInspectionData/setInspectionData 헬퍼 추가
- StoreItemInspectionRequest FormRequest 생성
- work_order_items.options['inspection_data']에 검사 결과 저장

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:00:57 +09:00
6318474b6f fix: [자재투입] 입고 로트번호 기반으로 자재 목록 변경
- getMaterials(): 품목당 1행 → StockLot(입고 로트)당 1행으로 변경
- ITEM-{id} 가짜 로트번호 → Receiving에서 생성된 실제 lot_no 반환
- registerMaterialInput(): material_ids → stock_lot_id+qty 로트별 수량 차감
- StockService::decreaseFromLot() 신규 추가 (특정 로트 지정 차감)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 05:06:28 +09:00
487e651845 feat: 견적확정 밸리데이션, 작업지시 통계 공정별 카운트, 입고/재고 개선
- 견적확정 시 업체명/현장명/담당자/연락처 필수 검증 추가 (QuoteService)
- 작업지시 stats API에 by_process 공정별 카운트 반환 추가
- 작업지시 목록/상세 쿼리에 수주 개소(rootNodes) 연관 로딩
- 작업지시 품목에 sourceOrderItem.node 관계 추가
- 입고관리 완료건 수정 허용 및 재고 차이 조정
- work_order_step_progress 테이블 마이그레이션
- receivings 테이블 options 컬럼 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 03:27:07 +09:00
6bc766411b feat: 생산지시 생성 시 공정 자동 분류 및 아이템 연결
- OrderService: 생산지시 생성 로직 개선
  - order_items.item_id → process_items 테이블에서 공정 자동 조회
  - 공정별로 아이템 그룹화 (미지정 아이템은 별도 그룹)
  - 각 공정별 작업지시 생성
  - work_order_items에 해당 공정의 아이템들 자동 추가

- WorkOrderService: 목록 조회 시 관계 추가
  - items 관계 추가 (틀수 계산용)
  - process.department 필드 추가 (부서 표시용)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-06 10:28:30 +09:00
6d05ab815f feat:테넌트설정 API 및 다수 서비스 개선
- TenantSetting CRUD API 추가
- Calendar, Entertainment, VAT 서비스 개선
- 5130 BOM 계산 로직 수정
- quote_items에 item_type 컬럼 추가
- tenant_settings 테이블 마이그레이션
- Swagger 문서 업데이트
2026-01-26 20:29:22 +09:00
7246ac003f fix(WEB): 수주 페이지 필드 매핑 및 제품-부품 트리 구조 개선
- ApiClient 인터페이스: representative → manager_name, contact_person 변경
- transformApiToFrontend: client.representative → client.manager_name 수정
- ApiOrderItem에 floor_code, symbol_code 필드 추가 (제품-부품 매핑)
- ApiOrder에 options 타입 정의 추가
- ApiQuote에 calculation_inputs 타입 정의 추가
- 수주 상세 페이지 제품-부품 트리 구조 UI 개선
2026-01-20 16:14:46 +09:00
8bac207274 fix(WEB): 작업지시 품목 수주 연동 및 발주처 표시 수정
- 작업지시 생성 시 수주 품목 자동 복사 기능 추가
- 품목 추적용 source_order_item_id 컬럼 추가
- 발주처 표시를 위해 salesOrder 로딩에 client_id 추가
- 담당자 수정 시 assignee_ids 배열 처리 추가

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-16 15:30:50 +09:00
a1edd8dcf4 feat(API): 작업지시 목록 process_code 필터 추가
- WorkOrderService.php에 process_code 파라미터 필터 추가
- whereHas('process') 쿼리로 공정 코드 기반 필터링 지원
- 생산 현황판 동적 탭 필터링 API 지원

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 20:35:20 +09:00
92d39d7294 feat: 작업지시 목록에 assigned_to_me 필터 추가
- 작업자 화면에서 나에게 배정된 작업만 조회하도록 지원
- 주 담당자(assignee_id) 또는 공동 담당자(assignees) 모두 포함
- 프론트엔드 WorkerScreen의 assigned_to_me=1 파라미터 처리

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-14 19:15:25 +09:00
85542293df fix(API): 작업지시 상태 자동 동기화 - pending 상태도 포함
- syncWorkOrderStatusFromItems()에서 pending 상태도 자동 전환 허용
- 품목 상태가 in_progress로 변경 시 작업지시 상태도 자동 변경
- 미배정(unassigned) 상태만 제외하도록 변경
- 기존: waiting, in_progress, completed만 동기화 대상
- 변경: unassigned만 제외, pending도 동기화 가능

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-14 15:37:28 +09:00
38d56aa564 feat(work-order): 품목 상태 변경 및 작업지시 상태 자동 연동
- WorkOrderItem 모델에 status 컬럼 및 상수 추가 (waiting/in_progress/completed)
- 품목 상태 변경 API 엔드포인트 추가 (PATCH /work-orders/{id}/items/{itemId}/status)
- syncWorkOrderStatusFromItems() 메서드로 품목→작업지시 상태 자동 동기화
  - 품목 중 하나라도 in_progress → 작업지시 in_progress
  - 모든 품목 completed → 작업지시 completed
  - 모든 품목 waiting → 작업지시 waiting
- 감사 로그: item_status_changed, status_synced_from_items 액션 추가

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-13 16:00:47 +09:00
349917f019 refactor(work-orders): 코드 리뷰 기반 전면 개선
## Critical 수정
- Multi-tenancy: WorkOrderItem, BendingDetail, Issue에 BelongsToTenant 적용
- 감사 로그: 상태변경, 품목수정, 이슈 등록/해결 시 로깅 추가
- 상태 전이 규칙: STATUS_TRANSITIONS + canTransitionTo() 구현

## High 수정
- 다중 담당자: work_order_assignees 피벗 테이블 및 관계 추가
- 부분 수정: 품목 ID 기반 upsert/delete 로직 구현

## 변경 파일
- Models: WorkOrder, WorkOrderAssignee(신규), 하위 모델들
- Services: WorkOrderService (assign, update 메서드 개선)
- Migrations: tenant_id 추가, assignees 테이블 생성

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 08:32:44 +09:00
05a53cdc8e feat: G-1 작업지시 관리 API 구현
- 작업지시 테이블 마이그레이션 (work_orders, work_order_items, work_order_bending_details, work_order_issues)
- 작업지시 모델 4개 (WorkOrder, WorkOrderItem, WorkOrderBendingDetail, WorkOrderIssue)
- WorkOrderService 비즈니스 로직 구현
- WorkOrderController REST API 엔드포인트 11개
- FormRequest 검증 클래스 5개
- Swagger API 문서화 완료

API Endpoints:
- GET /work-orders (목록)
- GET /work-orders/stats (통계)
- POST /work-orders (등록)
- GET /work-orders/{id} (상세)
- PUT /work-orders/{id} (수정)
- DELETE /work-orders/{id} (삭제)
- PATCH /work-orders/{id}/status (상태변경)
- PATCH /work-orders/{id}/assign (담당자배정)
- PATCH /work-orders/{id}/bending/toggle (벤딩토글)
- POST /work-orders/{id}/issues (이슈등록)
- PATCH /work-orders/{id}/issues/{issueId}/resolve (이슈해결)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-26 13:57:42 +09:00