feat(WEB): 작업지시/출근부 기능 개선 및 마이그레이션 추가

- 작업지시 우선순위 필드 추가 (priority 마이그레이션)
- 수주-작업지시 품목 연동 source_order_item_id 컬럼 추가
- 수주 테이블에 account_code 필드 추가
- 작업지시 StoreRequest/UpdateRequest 우선순위 검증 추가
- WorkOrder 모델 priority fillable 추가
- 출근부 StoreRequest/UpdateRequest 검증 규칙 개선
- Employee Request 검증 규칙 수정
- SaleService/ItemService 수정
- WorkResultService 결과 처리 개선
- BankTransactionService 수정
- routes/api.php 엔드포인트 업데이트
- error.php 에러 메시지 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-16 15:38:52 +09:00
parent 49d632b16b
commit 7543fd2256
19 changed files with 207 additions and 14 deletions

View File

@@ -19,7 +19,20 @@ public function rules(): array
'status' => 'nullable|in:onTime,late,absent,vacation,businessTrip,fieldWork,overtime,remote',
'remarks' => 'nullable|string|max:500',
// json_details 필드
// json_details 객체로 전달되는 경우 (프론트엔드 기본 형식)
'json_details' => 'nullable|array',
'json_details.check_in' => 'nullable|date_format:H:i:s',
'json_details.check_out' => 'nullable|date_format:H:i:s',
'json_details.gps_data' => 'nullable|array',
'json_details.work_minutes' => 'nullable|integer|min:0',
'json_details.overtime_minutes' => 'nullable|integer|min:0',
'json_details.late_minutes' => 'nullable|integer|min:0',
'json_details.early_leave_minutes' => 'nullable|integer|min:0',
'json_details.vacation_type' => 'nullable|string|max:50',
'json_details.reason' => 'nullable|string|max:500',
'json_details.break_time' => 'nullable|string|max:50',
// 최상위 레벨 필드 (호환성 유지)
'check_in' => 'nullable|date_format:H:i:s',
'check_out' => 'nullable|date_format:H:i:s',
'gps_data' => 'nullable|array',

View File

@@ -17,7 +17,20 @@ public function rules(): array
'status' => 'nullable|in:onTime,late,absent,vacation,businessTrip,fieldWork,overtime,remote',
'remarks' => 'nullable|string|max:500',
// json_details 필드
// json_details 객체로 전달되는 경우 (프론트엔드 기본 형식)
'json_details' => 'nullable|array',
'json_details.check_in' => 'nullable|date_format:H:i:s',
'json_details.check_out' => 'nullable|date_format:H:i:s',
'json_details.gps_data' => 'nullable|array',
'json_details.work_minutes' => 'nullable|integer|min:0',
'json_details.overtime_minutes' => 'nullable|integer|min:0',
'json_details.late_minutes' => 'nullable|integer|min:0',
'json_details.early_leave_minutes' => 'nullable|integer|min:0',
'json_details.vacation_type' => 'nullable|string|max:50',
'json_details.reason' => 'nullable|string|max:500',
'json_details.break_time' => 'nullable|string|max:50',
// 최상위 레벨 필드 (호환성 유지)
'check_in' => 'nullable|date_format:H:i:s',
'check_out' => 'nullable|date_format:H:i:s',
'gps_data' => 'nullable|array',

View File

@@ -38,21 +38,27 @@ public function rules(): array
'resident_number' => 'nullable|string|max:255',
'gender' => 'nullable|in:male,female',
'address' => 'nullable|array',
'address.zipCode' => 'nullable|string|max:10',
'address.zip_code' => 'nullable|string|max:10',
'address.address1' => 'nullable|string|max:255',
'address.address2' => 'nullable|string|max:255',
'salary' => 'nullable|numeric|min:0',
'hire_date' => 'nullable|date',
'rank' => 'nullable|string|max:50',
'bank_account' => 'nullable|array',
'bank_account.bankName' => 'nullable|string|max:50',
'bank_account.accountNumber' => 'nullable|string|max:50',
'bank_account.accountHolder' => 'nullable|string|max:50',
'bank_account.bank_name' => 'nullable|string|max:50',
'bank_account.account_number' => 'nullable|string|max:50',
'bank_account.account_holder' => 'nullable|string|max:50',
'work_type' => 'nullable|in:regular,contract,parttime,intern',
'contract_info' => 'nullable|array',
'contract_info.start_date' => 'nullable|date',
'contract_info.end_date' => 'nullable|date',
'contract_info.external_company' => 'nullable|string|max:100',
// 추가 json_extra 필드 (프론트엔드에서 전송)
'resignation_date' => 'nullable|date',
'resignation_reason' => 'nullable|string|max:500',
'clock_in_location' => 'nullable|string|max:255',
'clock_out_location' => 'nullable|string|max:255',
];
}

View File

@@ -44,21 +44,27 @@ public function rules(): array
'resident_number' => 'nullable|string|max:255',
'gender' => 'nullable|in:male,female',
'address' => 'nullable|array',
'address.zipCode' => 'nullable|string|max:10',
'address.zip_code' => 'nullable|string|max:10',
'address.address1' => 'nullable|string|max:255',
'address.address2' => 'nullable|string|max:255',
'salary' => 'nullable|numeric|min:0',
'hire_date' => 'nullable|date',
'rank' => 'nullable|string|max:50',
'bank_account' => 'nullable|array',
'bank_account.bankName' => 'nullable|string|max:50',
'bank_account.accountNumber' => 'nullable|string|max:50',
'bank_account.accountHolder' => 'nullable|string|max:50',
'bank_account.bank_name' => 'nullable|string|max:50',
'bank_account.account_number' => 'nullable|string|max:50',
'bank_account.account_holder' => 'nullable|string|max:50',
'work_type' => 'nullable|in:regular,contract,parttime,intern',
'contract_info' => 'nullable|array',
'contract_info.start_date' => 'nullable|date',
'contract_info.end_date' => 'nullable|date',
'contract_info.external_company' => 'nullable|string|max:100',
// 추가 json_extra 필드 (프론트엔드에서 전송)
'resignation_date' => 'nullable|date',
'resignation_reason' => 'nullable|string|max:500',
'clock_in_location' => 'nullable|string|max:255',
'clock_out_location' => 'nullable|string|max:255',
];
}

View File

@@ -14,6 +14,9 @@ public function authorize(): bool
public function rules(): array
{
// 수주 연동 등록 시 담당자 필수
$assigneeRequired = $this->filled('sales_order_id') ? 'required' : 'nullable';
return [
// 기본 정보
'sales_order_id' => 'nullable|integer|exists:orders,id',
@@ -21,6 +24,8 @@ public function rules(): array
'process_id' => 'required|integer|exists:processes,id',
'status' => ['nullable', 'in:'.implode(',', WorkOrder::STATUSES)],
'assignee_id' => 'nullable|integer|exists:users,id',
'assignee_ids' => [$assigneeRequired, 'array'],
'assignee_ids.*' => 'integer|exists:users,id',
'team_id' => 'nullable|integer|exists:departments,id',
'scheduled_date' => 'nullable|date',
'memo' => 'nullable|string',
@@ -53,6 +58,7 @@ public function messages(): array
return [
'process_id.required' => __('validation.required', ['attribute' => '공정']),
'process_id.exists' => __('validation.exists', ['attribute' => '공정']),
'assignee_ids.required' => __('error.work_order.assignee_required_for_linked'),
'items.*.item_name.required' => __('validation.required', ['attribute' => '품목명']),
];
}

View File

@@ -21,8 +21,11 @@ public function rules(): array
'process_id' => 'nullable|integer|exists:processes,id',
'status' => ['nullable', 'in:'.implode(',', WorkOrder::STATUSES)],
'assignee_id' => 'nullable|integer|exists:users,id',
'assignee_ids' => 'nullable|array',
'assignee_ids.*' => 'integer|exists:users,id',
'team_id' => 'nullable|integer|exists:departments,id',
'scheduled_date' => 'nullable|date',
'priority' => 'nullable|integer|min:1|max:9',
'memo' => 'nullable|string',
'is_active' => 'nullable|boolean',