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>
This commit is contained in:
2026-02-07 03:27:07 +09:00
parent 6b3e5c3e87
commit 487e651845
22 changed files with 1422 additions and 72 deletions

View File

@@ -33,6 +33,7 @@ class Receiving extends Model
'receiving_manager',
'status',
'remark',
'options',
'created_by',
'updated_by',
'deleted_by',
@@ -45,8 +46,33 @@ class Receiving extends Model
'order_qty' => 'decimal:2',
'receiving_qty' => 'decimal:2',
'item_id' => 'integer',
'options' => 'array',
];
/**
* JSON 직렬화 시 자동 포함되는 접근자
*/
protected $appends = [
'manufacturer',
'material_no',
'inspection_status',
'inspection_date',
'inspection_result',
];
/**
* Options 키 상수 (확장 필드)
*/
public const OPTION_MANUFACTURER = 'manufacturer'; // 제조사
public const OPTION_MATERIAL_NO = 'material_no'; // 거래처 자재번호
public const OPTION_INSPECTION_STATUS = 'inspection_status'; // 수입검사 (적/부적/-)
public const OPTION_INSPECTION_DATE = 'inspection_date'; // 검사일
public const OPTION_INSPECTION_RESULT = 'inspection_result'; // 검사결과 (합격/불합격)
/**
* 상태 목록
*/
@@ -82,12 +108,72 @@ public function getStatusLabelAttribute(): string
return self::STATUSES[$this->status] ?? $this->status;
}
/**
* Options에서 값 가져오기
*/
public function getOption(string $key, mixed $default = null): mixed
{
return $this->options[$key] ?? $default;
}
/**
* Options에 값 설정
*/
public function setOption(string $key, mixed $value): self
{
$options = $this->options ?? [];
$options[$key] = $value;
$this->options = $options;
return $this;
}
/**
* 제조사 접근자
*/
public function getManufacturerAttribute(): ?string
{
return $this->getOption(self::OPTION_MANUFACTURER);
}
/**
* 거래처 자재번호 접근자
*/
public function getMaterialNoAttribute(): ?string
{
return $this->getOption(self::OPTION_MATERIAL_NO);
}
/**
* 수입검사 상태 접근자
*/
public function getInspectionStatusAttribute(): ?string
{
return $this->getOption(self::OPTION_INSPECTION_STATUS);
}
/**
* 검사일 접근자
*/
public function getInspectionDateAttribute(): ?string
{
return $this->getOption(self::OPTION_INSPECTION_DATE);
}
/**
* 검사결과 접근자
*/
public function getInspectionResultAttribute(): ?string
{
return $this->getOption(self::OPTION_INSPECTION_RESULT);
}
/**
* 수정 가능 여부
*/
public function canEdit(): bool
{
return $this->status !== 'completed';
return true;
}
/**