fix: CRUD 작업 후 화면 갱신 문제 해결 및 장비 출고 기능 구현
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled

주요 변경사항:
- 장비 출고 API 연동 구현 (equipment_out_form_controller.dart)
- 모든 리스트 화면에서 CRUD 후 자동 갱신 확인
- CLAUDE.md 프로젝트 문서 실제 정보로 업데이트
  - 실제 테스트 계정 정보 반영 (admin@superport.kr)
  - API 소스코드 경로 추가 (/Users/maximilian.j.sul/Documents/flutter/superport_api)
- 테스트 도구 추가
  - test_api_integration.sh: API 통합 테스트 스크립트
  - test_crud_operations.md: CRUD 테스트 체크리스트

기술적 개선:
- Mock 서비스 의존도 제거
- Real API 전용 모드로 전환
- GetIt을 통한 서비스 주입 활용
This commit is contained in:
JiWoong Sul
2025-08-08 01:09:21 +09:00
parent c8dd1ff815
commit 6a25b2c56c
4 changed files with 318 additions and 351 deletions

View File

@@ -1,10 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:intl/intl.dart';
import 'package:superport/models/equipment_unified_model.dart';
import 'package:superport/models/company_model.dart';
import 'package:superport/models/company_branch_info.dart';
import 'package:superport/models/address_model.dart';
import 'package:superport/services/mock_data_service.dart';
import 'package:superport/services/equipment_service.dart';
import 'package:superport/services/company_service.dart';
import 'package:superport/utils/constants.dart';
/// 장비 출고 폼 컨트롤러
@@ -195,22 +198,55 @@ class EquipmentOutFormController extends ChangeNotifier {
}
try {
// TODO: 실제 저장 로직 구현
// 현재는 Mock 데이터 서비스에 저장
// API를 통한 출고 처리
final equipmentService = GetIt.instance<EquipmentService>();
final companyService = GetIt.instance<CompanyService>();
// 회사 ID 가져오기
int? companyId;
int? branchId;
// 선택된 회사 정보에서 ID 추출
if (selectedCompanies[0] != null) {
final companies = await companyService.getCompanies(search: selectedCompanies[0]);
if (companies.isNotEmpty) {
companyId = companies.first.id;
// TODO: 지점 ID 처리 로직 추가
}
}
if (companyId == null) {
throw Exception('출고처 정보를 찾을 수 없습니다.');
}
if (isEditMode) {
// 수정 모드
// dataService.updateEquipmentOut(...)
// 수정 모드 - 현재 미구현
throw UnimplementedError('출고 수정 기능은 아직 구현되지 않았습니다.');
} else {
// 생성 모드
if (selectedEquipments != null && selectedEquipments!.isNotEmpty) {
// 다중 장비 출고
for (var equipmentData in selectedEquipments!) {
// dataService.addEquipmentOut(...)
final equipment = equipmentData['equipment'] as Equipment;
if (equipment.id != null) {
await equipmentService.equipmentOut(
equipmentId: equipment.id!,
quantity: equipment.quantity,
companyId: companyId,
branchId: branchId,
notes: note ?? remarkController.text,
);
}
}
} else if (selectedEquipment != null) {
} else if (selectedEquipment != null && selectedEquipment!.id != null) {
// 단일 장비 출고
// dataService.addEquipmentOut(...)
await equipmentService.equipmentOut(
equipmentId: selectedEquipment!.id!,
quantity: selectedEquipment!.quantity,
companyId: companyId,
branchId: branchId,
notes: note ?? remarkController.text,
);
}
}