feat: Equipment DTO 호환성 수정 전 백업 커밋
- Equipment DTO 필드명 변경 (name → equipment_number 등) 완료 - Phase 1-7 파생 수정사항 체계적 진행 예정 - 통합 모델 정리, Controller 동기화, UI 업데이트 예정 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
32
CLAUDE.md
32
CLAUDE.md
@@ -563,6 +563,38 @@ Row(
|
||||
|
||||
## 📅 Recent Updates
|
||||
|
||||
### 2025-08-21 - Equipment 입고 폼 구매 가격 통화 포맷팅 구현 완료
|
||||
**Agent**: frontend-developer
|
||||
**Task**: Equipment 입고/수정 폼 구매 가격 필드에 KRW 통화 포맷팅 기능 추가
|
||||
**Status**: 완료 (1/1 작업)
|
||||
**Result**: 구매 가격 입력 시 ₩2,000,000 형식으로 실시간 포맷팅 완료
|
||||
|
||||
**Implementation Details**:
|
||||
- 🔧 **CurrencyFormatter 유틸리티**: KRW 통화 포맷팅 및 파싱 기능 구현
|
||||
- 🔧 **KRWTextInputFormatter**: 실시간 입력 포맷팅 기능 구현
|
||||
- 🔧 **Equipment 입고 폼**: 구매 가격 필드에 통화 포맷팅 적용
|
||||
- ✅ **테스트 완료**: CurrencyFormatter 단위 테스트 2개 모두 통과
|
||||
|
||||
**Features Added**:
|
||||
- 📝 **실시간 포맷팅**: 사용자 입력 시 즉시 ₩ 기호와 3자리 쉼표 적용
|
||||
- 📝 **힌트 텍스트**: "₩2,000,000" 예시로 사용자 가이드 제공
|
||||
- 📝 **데이터 변환**: 화면 표시용 포맷팅과 저장용 숫자 자동 변환
|
||||
- 📝 **사용자 경험**: 숫자 입력 키보드, 부드러운 커서 위치 처리
|
||||
|
||||
**System Impact**:
|
||||
- ✅ **UI/UX 개선**: 구매 가격 입력의 직관성 대폭 향상
|
||||
- ✅ **데이터 품질**: 통화 단위 명확화로 입력 오류 방지
|
||||
- ✅ **Flutter 웹 빌드**: 26.0초 정상 빌드 성공
|
||||
- ✅ **코드 품질**: 재사용 가능한 유틸리티 패턴 구현
|
||||
|
||||
**Technical Architecture**:
|
||||
- 🏗️ **Utils Layer**: CurrencyFormatter 클래스 추가
|
||||
- 🏗️ **Presentation Layer**: KRWTextInputFormatter 적용
|
||||
- 🏗️ **Test Coverage**: 단위 테스트 100% 통과
|
||||
- 🏗️ **Clean Code**: 포맷팅 로직 분리, SRP 원칙 준수
|
||||
|
||||
**Next Steps**: 다른 금액 필드들(라이선스 구매가격 등)에도 동일한 패턴 적용 검토
|
||||
|
||||
### 2025-08-20 - DropdownButton assertion 오류 해결 완료
|
||||
**Agent**: frontend-developer
|
||||
**Task**: Equipment 입고 폼에서 DropdownButton assertion 오류 해결 (equipmentStatus "P" 값 문제)
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:superport/core/errors/failures.dart';
|
||||
import 'package:superport/core/utils/debug_logger.dart';
|
||||
import 'package:superport/data/datasources/remote/lookup_remote_datasource.dart';
|
||||
import 'package:superport/data/models/lookups/lookup_data.dart';
|
||||
import 'dart:async' show unawaited;
|
||||
|
||||
/// 전역 Lookups 캐싱 서비스 (Singleton 패턴)
|
||||
@LazySingleton()
|
||||
@@ -133,14 +134,30 @@ class LookupsService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 장비 카테고리 목록 조회
|
||||
Either<Failure, List<CategoryItem>> getEquipmentCategories() {
|
||||
/// 장비 카테고리 조합 목록 조회
|
||||
Either<Failure, List<CategoryCombinationItem>> getEquipmentCategories() {
|
||||
return getAllLookups().fold(
|
||||
(failure) => Left(failure),
|
||||
(data) => Right(data.equipmentCategories),
|
||||
);
|
||||
}
|
||||
|
||||
/// 회사 목록 조회
|
||||
Either<Failure, List<LookupItem>> getCompanies() {
|
||||
return getAllLookups().fold(
|
||||
(failure) => Left(failure),
|
||||
(data) => Right(data.companies),
|
||||
);
|
||||
}
|
||||
|
||||
/// 창고 목록 조회
|
||||
Either<Failure, List<LookupItem>> getWarehouses() {
|
||||
return getAllLookups().fold(
|
||||
(failure) => Left(failure),
|
||||
(data) => Right(data.warehouses),
|
||||
);
|
||||
}
|
||||
|
||||
/// 장비 상태 목록 조회
|
||||
Either<Failure, List<StatusItem>> getEquipmentStatuses() {
|
||||
return getAllLookups().fold(
|
||||
@@ -179,6 +196,62 @@ class LookupsService {
|
||||
);
|
||||
}
|
||||
|
||||
/// Equipment 폼용 매번 API 호출 메서드 (캐싱 없이)
|
||||
Future<Either<Failure, LookupData>> getLookupDataForEquipmentForm() async {
|
||||
DebugLogger.log('Equipment 폼용 Lookups 데이터 API 호출', tag: 'LOOKUPS');
|
||||
return await _dataSource.getAllLookups();
|
||||
}
|
||||
|
||||
/// 대분류 목록 추출 (Equipment 폼용)
|
||||
Future<Either<Failure, List<String>>> getCategory1List() async {
|
||||
final result = await getLookupDataForEquipmentForm();
|
||||
return result.fold(
|
||||
(failure) => Left(failure),
|
||||
(data) {
|
||||
final category1List = data.equipmentCategories
|
||||
.map((item) => item.category1)
|
||||
.toSet()
|
||||
.toList()
|
||||
..sort();
|
||||
return Right(category1List);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 중분류 목록 추출 (Equipment 폼용)
|
||||
Future<Either<Failure, List<String>>> getCategory2List(String category1) async {
|
||||
final result = await getLookupDataForEquipmentForm();
|
||||
return result.fold(
|
||||
(failure) => Left(failure),
|
||||
(data) {
|
||||
final category2List = data.equipmentCategories
|
||||
.where((item) => item.category1 == category1)
|
||||
.map((item) => item.category2)
|
||||
.toSet()
|
||||
.toList()
|
||||
..sort();
|
||||
return Right(category2List);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 소분류 목록 추출 (Equipment 폼용)
|
||||
Future<Either<Failure, List<String>>> getCategory3List(String category1, String category2) async {
|
||||
final result = await getLookupDataForEquipmentForm();
|
||||
return result.fold(
|
||||
(failure) => Left(failure),
|
||||
(data) {
|
||||
final category3List = data.equipmentCategories
|
||||
.where((item) => item.category1 == category1 && item.category2 == category2)
|
||||
.map((item) => item.category3)
|
||||
.toSet()
|
||||
.toList()
|
||||
..sort();
|
||||
return Right(category3List);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 캐시 통계 정보
|
||||
Map<String, dynamic> getCacheStats() {
|
||||
return {
|
||||
@@ -191,6 +264,8 @@ class LookupsService {
|
||||
'equipment_names_count': _cachedData?.equipmentNames.length ?? 0,
|
||||
'equipment_categories_count': _cachedData?.equipmentCategories.length ?? 0,
|
||||
'equipment_statuses_count': _cachedData?.equipmentStatuses.length ?? 0,
|
||||
'companies_count': _cachedData?.companies.length ?? 0,
|
||||
'warehouses_count': _cachedData?.warehouses.length ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -212,8 +287,10 @@ extension LookupsServiceExtensions on LookupsService {
|
||||
(failure) => Left(failure),
|
||||
(manufacturers) {
|
||||
final Map<int, String> items = {};
|
||||
for (final manufacturer in manufacturers) {
|
||||
items[manufacturer.id] = manufacturer.name;
|
||||
for (int i = 0; i < manufacturers.length; i++) {
|
||||
final manufacturer = manufacturers[i];
|
||||
final id = manufacturer.id ?? (i + 1); // id가 null이면 인덱스 기반 ID 사용
|
||||
items[id] = manufacturer.name;
|
||||
}
|
||||
return Right(items);
|
||||
},
|
||||
@@ -233,4 +310,51 @@ extension LookupsServiceExtensions on LookupsService {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Equipment 폼용 드롭다운 리스트 생성 (매번 API 호출)
|
||||
Future<Either<Failure, Map<String, dynamic>>> getEquipmentFormDropdownData() async {
|
||||
final result = await getLookupDataForEquipmentForm();
|
||||
return result.fold(
|
||||
(failure) => Left(failure),
|
||||
(data) {
|
||||
// 제조사 리스트 (드롭다운 + 직접입력용)
|
||||
final List<String> manufacturers = data.manufacturers.map((item) => item.name).toList();
|
||||
|
||||
// 장비명 리스트 (드롭다운 + 직접입력용)
|
||||
final List<String> equipmentNames = data.equipmentNames.map((item) => item.name).toList();
|
||||
|
||||
// 회사 리스트 (드롭다운 전용)
|
||||
final Map<int, String> companies = {};
|
||||
for (final company in data.companies) {
|
||||
if (company.id != null) {
|
||||
companies[company.id!] = company.name;
|
||||
}
|
||||
}
|
||||
|
||||
// 창고 리스트 (드롭다운 전용)
|
||||
final Map<int, String> warehouses = {};
|
||||
for (final warehouse in data.warehouses) {
|
||||
if (warehouse.id != null) {
|
||||
warehouses[warehouse.id!] = warehouse.name;
|
||||
}
|
||||
}
|
||||
|
||||
// 대분류 리스트 (드롭다운 + 직접입력용)
|
||||
final List<String> category1List = data.equipmentCategories
|
||||
.map((item) => item.category1)
|
||||
.toSet()
|
||||
.toList()
|
||||
..sort();
|
||||
|
||||
return Right({
|
||||
'manufacturers': manufacturers,
|
||||
'equipment_names': equipmentNames,
|
||||
'companies': companies,
|
||||
'warehouses': warehouses,
|
||||
'category1_list': category1List,
|
||||
'category_combinations': data.equipmentCategories,
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
385
lib/core/widgets/category_cascade_form_field.dart
Normal file
385
lib/core/widgets/category_cascade_form_field.dart
Normal file
@@ -0,0 +1,385 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:superport/core/services/lookups_service.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/core/utils/debug_logger.dart';
|
||||
|
||||
/// 3단계 카테고리 연동 선택 위젯
|
||||
///
|
||||
/// 대분류 → 중분류 → 소분류 순서로 연동 선택
|
||||
/// - 상위 선택 시 하위 자동 로딩
|
||||
/// - 직접입력과 드롭다운 선택 모두 지원
|
||||
/// - 백엔드 API 조합 데이터 기반
|
||||
class CategoryCascadeFormField extends StatefulWidget {
|
||||
final String? category1;
|
||||
final String? category2;
|
||||
final String? category3;
|
||||
final void Function(String?, String?, String?) onChanged;
|
||||
final bool enabled;
|
||||
final String? Function(String?)? category1Validator;
|
||||
final String? Function(String?)? category2Validator;
|
||||
final String? Function(String?)? category3Validator;
|
||||
|
||||
const CategoryCascadeFormField({
|
||||
super.key,
|
||||
this.category1,
|
||||
this.category2,
|
||||
this.category3,
|
||||
required this.onChanged,
|
||||
this.enabled = true,
|
||||
this.category1Validator,
|
||||
this.category2Validator,
|
||||
this.category3Validator,
|
||||
});
|
||||
|
||||
@override
|
||||
State<CategoryCascadeFormField> createState() => _CategoryCascadeFormFieldState();
|
||||
}
|
||||
|
||||
class _CategoryCascadeFormFieldState extends State<CategoryCascadeFormField> {
|
||||
final LookupsService _lookupsService = GetIt.instance<LookupsService>();
|
||||
|
||||
late TextEditingController _category1Controller;
|
||||
late TextEditingController _category2Controller;
|
||||
late TextEditingController _category3Controller;
|
||||
|
||||
List<String> _category1Options = [];
|
||||
List<String> _category2Options = [];
|
||||
List<String> _category3Options = [];
|
||||
|
||||
bool _isLoadingCategory2 = false;
|
||||
bool _isLoadingCategory3 = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_category1Controller = TextEditingController(text: widget.category1 ?? '');
|
||||
_category2Controller = TextEditingController(text: widget.category2 ?? '');
|
||||
_category3Controller = TextEditingController(text: widget.category3 ?? '');
|
||||
|
||||
_loadCategory1Options();
|
||||
|
||||
// 초기값이 있는 경우 하위 카테고리 로딩
|
||||
if (widget.category1 != null && widget.category1!.isNotEmpty) {
|
||||
_loadCategory2Options(widget.category1!);
|
||||
|
||||
if (widget.category2 != null && widget.category2!.isNotEmpty) {
|
||||
_loadCategory3Options(widget.category1!, widget.category2!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(CategoryCascadeFormField oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
// 외부에서 값이 변경된 경우 컨트롤러 업데이트
|
||||
if (widget.category1 != oldWidget.category1) {
|
||||
_category1Controller.text = widget.category1 ?? '';
|
||||
}
|
||||
if (widget.category2 != oldWidget.category2) {
|
||||
_category2Controller.text = widget.category2 ?? '';
|
||||
}
|
||||
if (widget.category3 != oldWidget.category3) {
|
||||
_category3Controller.text = widget.category3 ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_category1Controller.dispose();
|
||||
_category2Controller.dispose();
|
||||
_category3Controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _loadCategory1Options() async {
|
||||
try {
|
||||
final result = await _lookupsService.getCategory1List();
|
||||
result.fold(
|
||||
(failure) {
|
||||
DebugLogger.logError('대분류 로딩 실패', error: failure.message);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category1Options = [];
|
||||
});
|
||||
}
|
||||
},
|
||||
(categories) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category1Options = categories;
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
DebugLogger.logError('대분류 로딩 예외', error: e);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category1Options = [];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadCategory2Options(String category1) async {
|
||||
if (category1.isEmpty) {
|
||||
setState(() {
|
||||
_category2Options = [];
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_isLoadingCategory2 = true;
|
||||
});
|
||||
|
||||
try {
|
||||
final result = await _lookupsService.getCategory2List(category1);
|
||||
result.fold(
|
||||
(failure) {
|
||||
DebugLogger.logError('중분류 로딩 실패', error: failure.message);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category2Options = [];
|
||||
_isLoadingCategory2 = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
(categories) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category2Options = categories;
|
||||
_isLoadingCategory2 = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
DebugLogger.logError('중분류 로딩 예외', error: e);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category2Options = [];
|
||||
_isLoadingCategory2 = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadCategory3Options(String category1, String category2) async {
|
||||
if (category1.isEmpty || category2.isEmpty) {
|
||||
setState(() {
|
||||
_category3Options = [];
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_isLoadingCategory3 = true;
|
||||
});
|
||||
|
||||
try {
|
||||
final result = await _lookupsService.getCategory3List(category1, category2);
|
||||
result.fold(
|
||||
(failure) {
|
||||
DebugLogger.logError('소분류 로딩 실패', error: failure.message);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category3Options = [];
|
||||
_isLoadingCategory3 = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
(categories) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category3Options = categories;
|
||||
_isLoadingCategory3 = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
DebugLogger.logError('소분류 로딩 예외', error: e);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_category3Options = [];
|
||||
_isLoadingCategory3 = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _onCategory1Changed(String? value) {
|
||||
// 대분류 변경 시 중분류, 소분류 초기화
|
||||
_category2Controller.clear();
|
||||
_category3Controller.clear();
|
||||
_category2Options.clear();
|
||||
_category3Options.clear();
|
||||
|
||||
// 새로운 대분류에 대한 중분류 로딩
|
||||
if (value != null && value.isNotEmpty) {
|
||||
_loadCategory2Options(value);
|
||||
}
|
||||
|
||||
// 변경 알림
|
||||
widget.onChanged(value, null, null);
|
||||
}
|
||||
|
||||
void _onCategory2Changed(String? value) {
|
||||
// 중분류 변경 시 소분류 초기화
|
||||
_category3Controller.clear();
|
||||
_category3Options.clear();
|
||||
|
||||
// 새로운 중분류에 대한 소분류 로딩
|
||||
final category1 = _category1Controller.text;
|
||||
if (category1.isNotEmpty && value != null && value.isNotEmpty) {
|
||||
_loadCategory3Options(category1, value);
|
||||
}
|
||||
|
||||
// 변경 알림
|
||||
widget.onChanged(_category1Controller.text, value, null);
|
||||
}
|
||||
|
||||
void _onCategory3Changed(String? value) {
|
||||
// 변경 알림
|
||||
widget.onChanged(
|
||||
_category1Controller.text,
|
||||
_category2Controller.text,
|
||||
value,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildComboBox({
|
||||
required String labelText,
|
||||
required TextEditingController controller,
|
||||
required List<String> options,
|
||||
required void Function(String?) onChanged,
|
||||
String? Function(String?)? validator,
|
||||
bool isLoading = false,
|
||||
}) {
|
||||
// 드롭다운 선택 가능한 값 (현재 텍스트가 옵션에 있으면 선택)
|
||||
String? selectedValue;
|
||||
if (controller.text.isNotEmpty && options.contains(controller.text)) {
|
||||
selectedValue = controller.text;
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 드롭다운 선택
|
||||
if (options.isNotEmpty && !isLoading)
|
||||
DropdownButtonFormField<String>(
|
||||
value: selectedValue,
|
||||
items: options.map((option) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: option,
|
||||
child: Text(option),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: widget.enabled ? (value) {
|
||||
if (value != null) {
|
||||
controller.text = value;
|
||||
onChanged(value);
|
||||
}
|
||||
} : null,
|
||||
decoration: InputDecoration(
|
||||
labelText: '$labelText (선택)',
|
||||
hintText: '$labelText를 선택하세요',
|
||||
border: const OutlineInputBorder(),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade400),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
),
|
||||
validator: validator,
|
||||
),
|
||||
|
||||
// 로딩 표시
|
||||
if (isLoading)
|
||||
Container(
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey.shade400),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text('로딩 중...'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 옵션이 없을 때
|
||||
if (options.isEmpty && !isLoading)
|
||||
TextFormField(
|
||||
controller: controller,
|
||||
enabled: widget.enabled,
|
||||
validator: validator,
|
||||
onChanged: onChanged,
|
||||
decoration: InputDecoration(
|
||||
labelText: '$labelText (직접입력)',
|
||||
hintText: '$labelText를 직접 입력하세요',
|
||||
border: const OutlineInputBorder(),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade400),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
// 대분류
|
||||
_buildComboBox(
|
||||
labelText: '대분류',
|
||||
controller: _category1Controller,
|
||||
options: _category1Options,
|
||||
onChanged: _onCategory1Changed,
|
||||
validator: widget.category1Validator,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 중분류
|
||||
_buildComboBox(
|
||||
labelText: '중분류',
|
||||
controller: _category2Controller,
|
||||
options: _category2Options,
|
||||
onChanged: _onCategory2Changed,
|
||||
validator: widget.category2Validator,
|
||||
isLoading: _isLoadingCategory2,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 소분류
|
||||
_buildComboBox(
|
||||
labelText: '소분류',
|
||||
controller: _category3Controller,
|
||||
options: _category3Options,
|
||||
onChanged: _onCategory3Changed,
|
||||
validator: widget.category3Validator,
|
||||
isLoading: _isLoadingCategory3,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,24 +7,22 @@ part 'equipment_dto.g.dart';
|
||||
class EquipmentDto with _$EquipmentDto {
|
||||
const factory EquipmentDto({
|
||||
required int id,
|
||||
@JsonKey(name: 'serial_number') required String serialNumber,
|
||||
required String name,
|
||||
String? category,
|
||||
String? manufacturer,
|
||||
String? model,
|
||||
@JsonKey(name: 'equipment_number') required String equipmentNumber,
|
||||
@JsonKey(name: 'serial_number') String? serialNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
required String manufacturer,
|
||||
@JsonKey(name: 'model_name') String? modelName,
|
||||
String? barcode,
|
||||
required String status,
|
||||
@JsonKey(name: 'company_id') required int companyId,
|
||||
@JsonKey(name: 'company_name') String? companyName,
|
||||
@JsonKey(name: 'company_id') int? companyId,
|
||||
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
|
||||
@JsonKey(name: 'warehouse_name') String? warehouseName,
|
||||
@JsonKey(name: 'purchase_date') String? purchaseDate,
|
||||
@JsonKey(name: 'purchase_price') double? purchasePrice,
|
||||
@JsonKey(name: 'current_value') double? currentValue,
|
||||
@JsonKey(name: 'warranty_expiry') String? warrantyExpiry,
|
||||
@JsonKey(name: 'last_maintenance_date') String? lastMaintenanceDate,
|
||||
@JsonKey(name: 'next_maintenance_date') String? nextMaintenanceDate,
|
||||
Map<String, dynamic>? specifications,
|
||||
String? notes,
|
||||
@JsonKey(name: 'last_inspection_date') String? lastInspectionDate,
|
||||
@JsonKey(name: 'next_inspection_date') String? nextInspectionDate,
|
||||
String? remark,
|
||||
@JsonKey(name: 'created_at') DateTime? createdAt,
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||
}) = _EquipmentDto;
|
||||
|
||||
@@ -21,36 +21,31 @@ EquipmentDto _$EquipmentDtoFromJson(Map<String, dynamic> json) {
|
||||
/// @nodoc
|
||||
mixin _$EquipmentDto {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'equipment_number')
|
||||
String get equipmentNumber => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'serial_number')
|
||||
String get serialNumber => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String? get category => throw _privateConstructorUsedError;
|
||||
String? get manufacturer => throw _privateConstructorUsedError;
|
||||
String? get model => throw _privateConstructorUsedError;
|
||||
String? get serialNumber => throw _privateConstructorUsedError;
|
||||
String? get category1 => throw _privateConstructorUsedError;
|
||||
String? get category2 => throw _privateConstructorUsedError;
|
||||
String? get category3 => throw _privateConstructorUsedError;
|
||||
String get manufacturer => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'model_name')
|
||||
String? get modelName => throw _privateConstructorUsedError;
|
||||
String? get barcode => throw _privateConstructorUsedError;
|
||||
String get status => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'company_id')
|
||||
int get companyId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'company_name')
|
||||
String? get companyName => throw _privateConstructorUsedError;
|
||||
int? get companyId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warehouse_location_id')
|
||||
int? get warehouseLocationId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warehouse_name')
|
||||
String? get warehouseName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'purchase_date')
|
||||
String? get purchaseDate => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'purchase_price')
|
||||
double? get purchasePrice => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'current_value')
|
||||
double? get currentValue => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warranty_expiry')
|
||||
String? get warrantyExpiry => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'last_maintenance_date')
|
||||
String? get lastMaintenanceDate => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'next_maintenance_date')
|
||||
String? get nextMaintenanceDate => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic>? get specifications =>
|
||||
throw _privateConstructorUsedError;
|
||||
String? get notes => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'last_inspection_date')
|
||||
String? get lastInspectionDate => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'next_inspection_date')
|
||||
String? get nextInspectionDate => throw _privateConstructorUsedError;
|
||||
String? get remark => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'created_at')
|
||||
DateTime? get createdAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'updated_at')
|
||||
@@ -74,24 +69,22 @@ abstract class $EquipmentDtoCopyWith<$Res> {
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'serial_number') String serialNumber,
|
||||
String name,
|
||||
String? category,
|
||||
String? manufacturer,
|
||||
String? model,
|
||||
@JsonKey(name: 'equipment_number') String equipmentNumber,
|
||||
@JsonKey(name: 'serial_number') String? serialNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String manufacturer,
|
||||
@JsonKey(name: 'model_name') String? modelName,
|
||||
String? barcode,
|
||||
String status,
|
||||
@JsonKey(name: 'company_id') int companyId,
|
||||
@JsonKey(name: 'company_name') String? companyName,
|
||||
@JsonKey(name: 'company_id') int? companyId,
|
||||
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
|
||||
@JsonKey(name: 'warehouse_name') String? warehouseName,
|
||||
@JsonKey(name: 'purchase_date') String? purchaseDate,
|
||||
@JsonKey(name: 'purchase_price') double? purchasePrice,
|
||||
@JsonKey(name: 'current_value') double? currentValue,
|
||||
@JsonKey(name: 'warranty_expiry') String? warrantyExpiry,
|
||||
@JsonKey(name: 'last_maintenance_date') String? lastMaintenanceDate,
|
||||
@JsonKey(name: 'next_maintenance_date') String? nextMaintenanceDate,
|
||||
Map<String, dynamic>? specifications,
|
||||
String? notes,
|
||||
@JsonKey(name: 'last_inspection_date') String? lastInspectionDate,
|
||||
@JsonKey(name: 'next_inspection_date') String? nextInspectionDate,
|
||||
String? remark,
|
||||
@JsonKey(name: 'created_at') DateTime? createdAt,
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt});
|
||||
}
|
||||
@@ -112,24 +105,22 @@ class _$EquipmentDtoCopyWithImpl<$Res, $Val extends EquipmentDto>
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? serialNumber = null,
|
||||
Object? name = null,
|
||||
Object? category = freezed,
|
||||
Object? manufacturer = freezed,
|
||||
Object? model = freezed,
|
||||
Object? equipmentNumber = null,
|
||||
Object? serialNumber = freezed,
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? barcode = freezed,
|
||||
Object? status = null,
|
||||
Object? companyId = null,
|
||||
Object? companyName = freezed,
|
||||
Object? companyId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? warehouseName = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? currentValue = freezed,
|
||||
Object? warrantyExpiry = freezed,
|
||||
Object? lastMaintenanceDate = freezed,
|
||||
Object? nextMaintenanceDate = freezed,
|
||||
Object? specifications = freezed,
|
||||
Object? notes = freezed,
|
||||
Object? lastInspectionDate = freezed,
|
||||
Object? nextInspectionDate = freezed,
|
||||
Object? remark = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
@@ -138,46 +129,50 @@ class _$EquipmentDtoCopyWithImpl<$Res, $Val extends EquipmentDto>
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
serialNumber: null == serialNumber
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
category: freezed == category
|
||||
? _value.category
|
||||
: category // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
manufacturer: freezed == manufacturer
|
||||
category1: freezed == category1
|
||||
? _value.category1
|
||||
: category1 // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
category2: freezed == category2
|
||||
? _value.category2
|
||||
: category2 // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
category3: freezed == category3
|
||||
? _value.category3
|
||||
: category3 // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
manufacturer: null == manufacturer
|
||||
? _value.manufacturer
|
||||
: manufacturer // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
modelName: freezed == modelName
|
||||
? _value.modelName
|
||||
: modelName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
model: freezed == model
|
||||
? _value.model
|
||||
: model // ignore: cast_nullable_to_non_nullable
|
||||
barcode: freezed == barcode
|
||||
? _value.barcode
|
||||
: barcode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
companyId: null == companyId
|
||||
companyId: freezed == companyId
|
||||
? _value.companyId
|
||||
: companyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseName: freezed == warehouseName
|
||||
? _value.warehouseName
|
||||
: warehouseName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
@@ -186,29 +181,17 @@ class _$EquipmentDtoCopyWithImpl<$Res, $Val extends EquipmentDto>
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
currentValue: freezed == currentValue
|
||||
? _value.currentValue
|
||||
: currentValue // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
warrantyExpiry: freezed == warrantyExpiry
|
||||
? _value.warrantyExpiry
|
||||
: warrantyExpiry // ignore: cast_nullable_to_non_nullable
|
||||
lastInspectionDate: freezed == lastInspectionDate
|
||||
? _value.lastInspectionDate
|
||||
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
lastMaintenanceDate: freezed == lastMaintenanceDate
|
||||
? _value.lastMaintenanceDate
|
||||
: lastMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
nextInspectionDate: freezed == nextInspectionDate
|
||||
? _value.nextInspectionDate
|
||||
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
nextMaintenanceDate: freezed == nextMaintenanceDate
|
||||
? _value.nextMaintenanceDate
|
||||
: nextMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
specifications: freezed == specifications
|
||||
? _value.specifications
|
||||
: specifications // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
@@ -232,24 +215,22 @@ abstract class _$$EquipmentDtoImplCopyWith<$Res>
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
@JsonKey(name: 'serial_number') String serialNumber,
|
||||
String name,
|
||||
String? category,
|
||||
String? manufacturer,
|
||||
String? model,
|
||||
@JsonKey(name: 'equipment_number') String equipmentNumber,
|
||||
@JsonKey(name: 'serial_number') String? serialNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String manufacturer,
|
||||
@JsonKey(name: 'model_name') String? modelName,
|
||||
String? barcode,
|
||||
String status,
|
||||
@JsonKey(name: 'company_id') int companyId,
|
||||
@JsonKey(name: 'company_name') String? companyName,
|
||||
@JsonKey(name: 'company_id') int? companyId,
|
||||
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
|
||||
@JsonKey(name: 'warehouse_name') String? warehouseName,
|
||||
@JsonKey(name: 'purchase_date') String? purchaseDate,
|
||||
@JsonKey(name: 'purchase_price') double? purchasePrice,
|
||||
@JsonKey(name: 'current_value') double? currentValue,
|
||||
@JsonKey(name: 'warranty_expiry') String? warrantyExpiry,
|
||||
@JsonKey(name: 'last_maintenance_date') String? lastMaintenanceDate,
|
||||
@JsonKey(name: 'next_maintenance_date') String? nextMaintenanceDate,
|
||||
Map<String, dynamic>? specifications,
|
||||
String? notes,
|
||||
@JsonKey(name: 'last_inspection_date') String? lastInspectionDate,
|
||||
@JsonKey(name: 'next_inspection_date') String? nextInspectionDate,
|
||||
String? remark,
|
||||
@JsonKey(name: 'created_at') DateTime? createdAt,
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt});
|
||||
}
|
||||
@@ -268,24 +249,22 @@ class __$$EquipmentDtoImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? serialNumber = null,
|
||||
Object? name = null,
|
||||
Object? category = freezed,
|
||||
Object? manufacturer = freezed,
|
||||
Object? model = freezed,
|
||||
Object? equipmentNumber = null,
|
||||
Object? serialNumber = freezed,
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? barcode = freezed,
|
||||
Object? status = null,
|
||||
Object? companyId = null,
|
||||
Object? companyName = freezed,
|
||||
Object? companyId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? warehouseName = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? currentValue = freezed,
|
||||
Object? warrantyExpiry = freezed,
|
||||
Object? lastMaintenanceDate = freezed,
|
||||
Object? nextMaintenanceDate = freezed,
|
||||
Object? specifications = freezed,
|
||||
Object? notes = freezed,
|
||||
Object? lastInspectionDate = freezed,
|
||||
Object? nextInspectionDate = freezed,
|
||||
Object? remark = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
@@ -294,46 +273,50 @@ class __$$EquipmentDtoImplCopyWithImpl<$Res>
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
serialNumber: null == serialNumber
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
category: freezed == category
|
||||
? _value.category
|
||||
: category // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
manufacturer: freezed == manufacturer
|
||||
category1: freezed == category1
|
||||
? _value.category1
|
||||
: category1 // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
category2: freezed == category2
|
||||
? _value.category2
|
||||
: category2 // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
category3: freezed == category3
|
||||
? _value.category3
|
||||
: category3 // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
manufacturer: null == manufacturer
|
||||
? _value.manufacturer
|
||||
: manufacturer // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
modelName: freezed == modelName
|
||||
? _value.modelName
|
||||
: modelName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
model: freezed == model
|
||||
? _value.model
|
||||
: model // ignore: cast_nullable_to_non_nullable
|
||||
barcode: freezed == barcode
|
||||
? _value.barcode
|
||||
: barcode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
companyId: null == companyId
|
||||
companyId: freezed == companyId
|
||||
? _value.companyId
|
||||
: companyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseName: freezed == warehouseName
|
||||
? _value.warehouseName
|
||||
: warehouseName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
@@ -342,29 +325,17 @@ class __$$EquipmentDtoImplCopyWithImpl<$Res>
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
currentValue: freezed == currentValue
|
||||
? _value.currentValue
|
||||
: currentValue // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
warrantyExpiry: freezed == warrantyExpiry
|
||||
? _value.warrantyExpiry
|
||||
: warrantyExpiry // ignore: cast_nullable_to_non_nullable
|
||||
lastInspectionDate: freezed == lastInspectionDate
|
||||
? _value.lastInspectionDate
|
||||
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
lastMaintenanceDate: freezed == lastMaintenanceDate
|
||||
? _value.lastMaintenanceDate
|
||||
: lastMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
nextInspectionDate: freezed == nextInspectionDate
|
||||
? _value.nextInspectionDate
|
||||
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
nextMaintenanceDate: freezed == nextMaintenanceDate
|
||||
? _value.nextMaintenanceDate
|
||||
: nextMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
specifications: freezed == specifications
|
||||
? _value._specifications
|
||||
: specifications // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
@@ -383,27 +354,24 @@ class __$$EquipmentDtoImplCopyWithImpl<$Res>
|
||||
class _$EquipmentDtoImpl implements _EquipmentDto {
|
||||
const _$EquipmentDtoImpl(
|
||||
{required this.id,
|
||||
@JsonKey(name: 'serial_number') required this.serialNumber,
|
||||
required this.name,
|
||||
this.category,
|
||||
this.manufacturer,
|
||||
this.model,
|
||||
@JsonKey(name: 'equipment_number') required this.equipmentNumber,
|
||||
@JsonKey(name: 'serial_number') this.serialNumber,
|
||||
this.category1,
|
||||
this.category2,
|
||||
this.category3,
|
||||
required this.manufacturer,
|
||||
@JsonKey(name: 'model_name') this.modelName,
|
||||
this.barcode,
|
||||
required this.status,
|
||||
@JsonKey(name: 'company_id') required this.companyId,
|
||||
@JsonKey(name: 'company_name') this.companyName,
|
||||
@JsonKey(name: 'company_id') this.companyId,
|
||||
@JsonKey(name: 'warehouse_location_id') this.warehouseLocationId,
|
||||
@JsonKey(name: 'warehouse_name') this.warehouseName,
|
||||
@JsonKey(name: 'purchase_date') this.purchaseDate,
|
||||
@JsonKey(name: 'purchase_price') this.purchasePrice,
|
||||
@JsonKey(name: 'current_value') this.currentValue,
|
||||
@JsonKey(name: 'warranty_expiry') this.warrantyExpiry,
|
||||
@JsonKey(name: 'last_maintenance_date') this.lastMaintenanceDate,
|
||||
@JsonKey(name: 'next_maintenance_date') this.nextMaintenanceDate,
|
||||
final Map<String, dynamic>? specifications,
|
||||
this.notes,
|
||||
@JsonKey(name: 'last_inspection_date') this.lastInspectionDate,
|
||||
@JsonKey(name: 'next_inspection_date') this.nextInspectionDate,
|
||||
this.remark,
|
||||
@JsonKey(name: 'created_at') this.createdAt,
|
||||
@JsonKey(name: 'updated_at') this.updatedAt})
|
||||
: _specifications = specifications;
|
||||
@JsonKey(name: 'updated_at') this.updatedAt});
|
||||
|
||||
factory _$EquipmentDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentDtoImplFromJson(json);
|
||||
@@ -411,60 +379,46 @@ class _$EquipmentDtoImpl implements _EquipmentDto {
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
@JsonKey(name: 'equipment_number')
|
||||
final String equipmentNumber;
|
||||
@override
|
||||
@JsonKey(name: 'serial_number')
|
||||
final String serialNumber;
|
||||
final String? serialNumber;
|
||||
@override
|
||||
final String name;
|
||||
final String? category1;
|
||||
@override
|
||||
final String? category;
|
||||
final String? category2;
|
||||
@override
|
||||
final String? manufacturer;
|
||||
final String? category3;
|
||||
@override
|
||||
final String? model;
|
||||
final String manufacturer;
|
||||
@override
|
||||
@JsonKey(name: 'model_name')
|
||||
final String? modelName;
|
||||
@override
|
||||
final String? barcode;
|
||||
@override
|
||||
final String status;
|
||||
@override
|
||||
@JsonKey(name: 'company_id')
|
||||
final int companyId;
|
||||
@override
|
||||
@JsonKey(name: 'company_name')
|
||||
final String? companyName;
|
||||
final int? companyId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouse_location_id')
|
||||
final int? warehouseLocationId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouse_name')
|
||||
final String? warehouseName;
|
||||
@override
|
||||
@JsonKey(name: 'purchase_date')
|
||||
final String? purchaseDate;
|
||||
@override
|
||||
@JsonKey(name: 'purchase_price')
|
||||
final double? purchasePrice;
|
||||
@override
|
||||
@JsonKey(name: 'current_value')
|
||||
final double? currentValue;
|
||||
@JsonKey(name: 'last_inspection_date')
|
||||
final String? lastInspectionDate;
|
||||
@override
|
||||
@JsonKey(name: 'warranty_expiry')
|
||||
final String? warrantyExpiry;
|
||||
@JsonKey(name: 'next_inspection_date')
|
||||
final String? nextInspectionDate;
|
||||
@override
|
||||
@JsonKey(name: 'last_maintenance_date')
|
||||
final String? lastMaintenanceDate;
|
||||
@override
|
||||
@JsonKey(name: 'next_maintenance_date')
|
||||
final String? nextMaintenanceDate;
|
||||
final Map<String, dynamic>? _specifications;
|
||||
@override
|
||||
Map<String, dynamic>? get specifications {
|
||||
final value = _specifications;
|
||||
if (value == null) return null;
|
||||
if (_specifications is EqualUnmodifiableMapView) return _specifications;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
final String? notes;
|
||||
final String? remark;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
final DateTime? createdAt;
|
||||
@@ -474,7 +428,7 @@ class _$EquipmentDtoImpl implements _EquipmentDto {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentDto(id: $id, serialNumber: $serialNumber, name: $name, category: $category, manufacturer: $manufacturer, model: $model, status: $status, companyId: $companyId, companyName: $companyName, warehouseLocationId: $warehouseLocationId, warehouseName: $warehouseName, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, currentValue: $currentValue, warrantyExpiry: $warrantyExpiry, lastMaintenanceDate: $lastMaintenanceDate, nextMaintenanceDate: $nextMaintenanceDate, specifications: $specifications, notes: $notes, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
return 'EquipmentDto(id: $id, equipmentNumber: $equipmentNumber, serialNumber: $serialNumber, category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, barcode: $barcode, status: $status, companyId: $companyId, warehouseLocationId: $warehouseLocationId, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -483,38 +437,35 @@ class _$EquipmentDtoImpl implements _EquipmentDto {
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentDtoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.equipmentNumber, equipmentNumber) ||
|
||||
other.equipmentNumber == equipmentNumber) &&
|
||||
(identical(other.serialNumber, serialNumber) ||
|
||||
other.serialNumber == serialNumber) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.category, category) ||
|
||||
other.category == category) &&
|
||||
(identical(other.category1, category1) ||
|
||||
other.category1 == category1) &&
|
||||
(identical(other.category2, category2) ||
|
||||
other.category2 == category2) &&
|
||||
(identical(other.category3, category3) ||
|
||||
other.category3 == category3) &&
|
||||
(identical(other.manufacturer, manufacturer) ||
|
||||
other.manufacturer == manufacturer) &&
|
||||
(identical(other.model, model) || other.model == model) &&
|
||||
(identical(other.modelName, modelName) ||
|
||||
other.modelName == modelName) &&
|
||||
(identical(other.barcode, barcode) || other.barcode == barcode) &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.companyId, companyId) ||
|
||||
other.companyId == companyId) &&
|
||||
(identical(other.companyName, companyName) ||
|
||||
other.companyName == companyName) &&
|
||||
(identical(other.warehouseLocationId, warehouseLocationId) ||
|
||||
other.warehouseLocationId == warehouseLocationId) &&
|
||||
(identical(other.warehouseName, warehouseName) ||
|
||||
other.warehouseName == warehouseName) &&
|
||||
(identical(other.purchaseDate, purchaseDate) ||
|
||||
other.purchaseDate == purchaseDate) &&
|
||||
(identical(other.purchasePrice, purchasePrice) ||
|
||||
other.purchasePrice == purchasePrice) &&
|
||||
(identical(other.currentValue, currentValue) ||
|
||||
other.currentValue == currentValue) &&
|
||||
(identical(other.warrantyExpiry, warrantyExpiry) ||
|
||||
other.warrantyExpiry == warrantyExpiry) &&
|
||||
(identical(other.lastMaintenanceDate, lastMaintenanceDate) ||
|
||||
other.lastMaintenanceDate == lastMaintenanceDate) &&
|
||||
(identical(other.nextMaintenanceDate, nextMaintenanceDate) ||
|
||||
other.nextMaintenanceDate == nextMaintenanceDate) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._specifications, _specifications) &&
|
||||
(identical(other.notes, notes) || other.notes == notes) &&
|
||||
(identical(other.lastInspectionDate, lastInspectionDate) ||
|
||||
other.lastInspectionDate == lastInspectionDate) &&
|
||||
(identical(other.nextInspectionDate, nextInspectionDate) ||
|
||||
other.nextInspectionDate == nextInspectionDate) &&
|
||||
(identical(other.remark, remark) || other.remark == remark) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
@@ -526,24 +477,22 @@ class _$EquipmentDtoImpl implements _EquipmentDto {
|
||||
int get hashCode => Object.hashAll([
|
||||
runtimeType,
|
||||
id,
|
||||
equipmentNumber,
|
||||
serialNumber,
|
||||
name,
|
||||
category,
|
||||
category1,
|
||||
category2,
|
||||
category3,
|
||||
manufacturer,
|
||||
model,
|
||||
modelName,
|
||||
barcode,
|
||||
status,
|
||||
companyId,
|
||||
companyName,
|
||||
warehouseLocationId,
|
||||
warehouseName,
|
||||
purchaseDate,
|
||||
purchasePrice,
|
||||
currentValue,
|
||||
warrantyExpiry,
|
||||
lastMaintenanceDate,
|
||||
nextMaintenanceDate,
|
||||
const DeepCollectionEquality().hash(_specifications),
|
||||
notes,
|
||||
lastInspectionDate,
|
||||
nextInspectionDate,
|
||||
remark,
|
||||
createdAt,
|
||||
updatedAt
|
||||
]);
|
||||
@@ -567,24 +516,22 @@ class _$EquipmentDtoImpl implements _EquipmentDto {
|
||||
abstract class _EquipmentDto implements EquipmentDto {
|
||||
const factory _EquipmentDto(
|
||||
{required final int id,
|
||||
@JsonKey(name: 'serial_number') required final String serialNumber,
|
||||
required final String name,
|
||||
final String? category,
|
||||
final String? manufacturer,
|
||||
final String? model,
|
||||
@JsonKey(name: 'equipment_number') required final String equipmentNumber,
|
||||
@JsonKey(name: 'serial_number') final String? serialNumber,
|
||||
final String? category1,
|
||||
final String? category2,
|
||||
final String? category3,
|
||||
required final String manufacturer,
|
||||
@JsonKey(name: 'model_name') final String? modelName,
|
||||
final String? barcode,
|
||||
required final String status,
|
||||
@JsonKey(name: 'company_id') required final int companyId,
|
||||
@JsonKey(name: 'company_name') final String? companyName,
|
||||
@JsonKey(name: 'company_id') final int? companyId,
|
||||
@JsonKey(name: 'warehouse_location_id') final int? warehouseLocationId,
|
||||
@JsonKey(name: 'warehouse_name') final String? warehouseName,
|
||||
@JsonKey(name: 'purchase_date') final String? purchaseDate,
|
||||
@JsonKey(name: 'purchase_price') final double? purchasePrice,
|
||||
@JsonKey(name: 'current_value') final double? currentValue,
|
||||
@JsonKey(name: 'warranty_expiry') final String? warrantyExpiry,
|
||||
@JsonKey(name: 'last_maintenance_date') final String? lastMaintenanceDate,
|
||||
@JsonKey(name: 'next_maintenance_date') final String? nextMaintenanceDate,
|
||||
final Map<String, dynamic>? specifications,
|
||||
final String? notes,
|
||||
@JsonKey(name: 'last_inspection_date') final String? lastInspectionDate,
|
||||
@JsonKey(name: 'next_inspection_date') final String? nextInspectionDate,
|
||||
final String? remark,
|
||||
@JsonKey(name: 'created_at') final DateTime? createdAt,
|
||||
@JsonKey(name: 'updated_at')
|
||||
final DateTime? updatedAt}) = _$EquipmentDtoImpl;
|
||||
@@ -595,52 +542,46 @@ abstract class _EquipmentDto implements EquipmentDto {
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
@JsonKey(name: 'equipment_number')
|
||||
String get equipmentNumber;
|
||||
@override
|
||||
@JsonKey(name: 'serial_number')
|
||||
String get serialNumber;
|
||||
String? get serialNumber;
|
||||
@override
|
||||
String get name;
|
||||
String? get category1;
|
||||
@override
|
||||
String? get category;
|
||||
String? get category2;
|
||||
@override
|
||||
String? get manufacturer;
|
||||
String? get category3;
|
||||
@override
|
||||
String? get model;
|
||||
String get manufacturer;
|
||||
@override
|
||||
@JsonKey(name: 'model_name')
|
||||
String? get modelName;
|
||||
@override
|
||||
String? get barcode;
|
||||
@override
|
||||
String get status;
|
||||
@override
|
||||
@JsonKey(name: 'company_id')
|
||||
int get companyId;
|
||||
@override
|
||||
@JsonKey(name: 'company_name')
|
||||
String? get companyName;
|
||||
int? get companyId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouse_location_id')
|
||||
int? get warehouseLocationId;
|
||||
@override
|
||||
@JsonKey(name: 'warehouse_name')
|
||||
String? get warehouseName;
|
||||
@override
|
||||
@JsonKey(name: 'purchase_date')
|
||||
String? get purchaseDate;
|
||||
@override
|
||||
@JsonKey(name: 'purchase_price')
|
||||
double? get purchasePrice;
|
||||
@override
|
||||
@JsonKey(name: 'current_value')
|
||||
double? get currentValue;
|
||||
@JsonKey(name: 'last_inspection_date')
|
||||
String? get lastInspectionDate;
|
||||
@override
|
||||
@JsonKey(name: 'warranty_expiry')
|
||||
String? get warrantyExpiry;
|
||||
@JsonKey(name: 'next_inspection_date')
|
||||
String? get nextInspectionDate;
|
||||
@override
|
||||
@JsonKey(name: 'last_maintenance_date')
|
||||
String? get lastMaintenanceDate;
|
||||
@override
|
||||
@JsonKey(name: 'next_maintenance_date')
|
||||
String? get nextMaintenanceDate;
|
||||
@override
|
||||
Map<String, dynamic>? get specifications;
|
||||
@override
|
||||
String? get notes;
|
||||
String? get remark;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
DateTime? get createdAt;
|
||||
|
||||
@@ -9,24 +9,22 @@ part of 'equipment_dto.dart';
|
||||
_$EquipmentDtoImpl _$$EquipmentDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentDtoImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
serialNumber: json['serial_number'] as String,
|
||||
name: json['name'] as String,
|
||||
category: json['category'] as String?,
|
||||
manufacturer: json['manufacturer'] as String?,
|
||||
model: json['model'] as String?,
|
||||
equipmentNumber: json['equipment_number'] as String,
|
||||
serialNumber: json['serial_number'] as String?,
|
||||
category1: json['category1'] as String?,
|
||||
category2: json['category2'] as String?,
|
||||
category3: json['category3'] as String?,
|
||||
manufacturer: json['manufacturer'] as String,
|
||||
modelName: json['model_name'] as String?,
|
||||
barcode: json['barcode'] as String?,
|
||||
status: json['status'] as String,
|
||||
companyId: (json['company_id'] as num).toInt(),
|
||||
companyName: json['company_name'] as String?,
|
||||
companyId: (json['company_id'] as num?)?.toInt(),
|
||||
warehouseLocationId: (json['warehouse_location_id'] as num?)?.toInt(),
|
||||
warehouseName: json['warehouse_name'] as String?,
|
||||
purchaseDate: json['purchase_date'] as String?,
|
||||
purchasePrice: (json['purchase_price'] as num?)?.toDouble(),
|
||||
currentValue: (json['current_value'] as num?)?.toDouble(),
|
||||
warrantyExpiry: json['warranty_expiry'] as String?,
|
||||
lastMaintenanceDate: json['last_maintenance_date'] as String?,
|
||||
nextMaintenanceDate: json['next_maintenance_date'] as String?,
|
||||
specifications: json['specifications'] as Map<String, dynamic>?,
|
||||
notes: json['notes'] as String?,
|
||||
lastInspectionDate: json['last_inspection_date'] as String?,
|
||||
nextInspectionDate: json['next_inspection_date'] as String?,
|
||||
remark: json['remark'] as String?,
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
@@ -38,24 +36,22 @@ _$EquipmentDtoImpl _$$EquipmentDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
Map<String, dynamic> _$$EquipmentDtoImplToJson(_$EquipmentDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'equipment_number': instance.equipmentNumber,
|
||||
'serial_number': instance.serialNumber,
|
||||
'name': instance.name,
|
||||
'category': instance.category,
|
||||
'category1': instance.category1,
|
||||
'category2': instance.category2,
|
||||
'category3': instance.category3,
|
||||
'manufacturer': instance.manufacturer,
|
||||
'model': instance.model,
|
||||
'model_name': instance.modelName,
|
||||
'barcode': instance.barcode,
|
||||
'status': instance.status,
|
||||
'company_id': instance.companyId,
|
||||
'company_name': instance.companyName,
|
||||
'warehouse_location_id': instance.warehouseLocationId,
|
||||
'warehouse_name': instance.warehouseName,
|
||||
'purchase_date': instance.purchaseDate,
|
||||
'purchase_price': instance.purchasePrice,
|
||||
'current_value': instance.currentValue,
|
||||
'warranty_expiry': instance.warrantyExpiry,
|
||||
'last_maintenance_date': instance.lastMaintenanceDate,
|
||||
'next_maintenance_date': instance.nextMaintenanceDate,
|
||||
'specifications': instance.specifications,
|
||||
'notes': instance.notes,
|
||||
'last_inspection_date': instance.lastInspectionDate,
|
||||
'next_inspection_date': instance.nextInspectionDate,
|
||||
'remark': instance.remark,
|
||||
'created_at': instance.createdAt?.toIso8601String(),
|
||||
'updated_at': instance.updatedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
@@ -9,8 +9,10 @@ class LookupData with _$LookupData {
|
||||
const factory LookupData({
|
||||
@JsonKey(name: 'manufacturers', defaultValue: []) required List<LookupItem> manufacturers,
|
||||
@JsonKey(name: 'equipment_names', defaultValue: []) required List<EquipmentNameItem> equipmentNames,
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: []) required List<CategoryItem> equipmentCategories,
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: []) required List<CategoryCombinationItem> equipmentCategories,
|
||||
@JsonKey(name: 'equipment_statuses', defaultValue: []) required List<StatusItem> equipmentStatuses,
|
||||
@JsonKey(name: 'companies', defaultValue: []) required List<LookupItem> companies,
|
||||
@JsonKey(name: 'warehouses', defaultValue: []) required List<LookupItem> warehouses,
|
||||
}) = _LookupData;
|
||||
|
||||
factory LookupData.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -21,7 +23,7 @@ class LookupData with _$LookupData {
|
||||
@freezed
|
||||
class LookupItem with _$LookupItem {
|
||||
const factory LookupItem({
|
||||
required int id,
|
||||
int? id,
|
||||
required String name,
|
||||
}) = _LookupItem;
|
||||
|
||||
@@ -33,7 +35,7 @@ class LookupItem with _$LookupItem {
|
||||
@freezed
|
||||
class EquipmentNameItem with _$EquipmentNameItem {
|
||||
const factory EquipmentNameItem({
|
||||
required int id,
|
||||
int? id,
|
||||
required String name,
|
||||
@JsonKey(name: 'model_number') String? modelNumber,
|
||||
}) = _EquipmentNameItem;
|
||||
@@ -42,7 +44,20 @@ class EquipmentNameItem with _$EquipmentNameItem {
|
||||
_$EquipmentNameItemFromJson(json);
|
||||
}
|
||||
|
||||
/// 카테고리 Lookup 아이템
|
||||
/// 카테고리 조합 Lookup 아이템 (백엔드 API 실제 구조)
|
||||
@freezed
|
||||
class CategoryCombinationItem with _$CategoryCombinationItem {
|
||||
const factory CategoryCombinationItem({
|
||||
required String category1,
|
||||
required String category2,
|
||||
required String category3,
|
||||
}) = _CategoryCombinationItem;
|
||||
|
||||
factory CategoryCombinationItem.fromJson(Map<String, dynamic> json) =>
|
||||
_$CategoryCombinationItemFromJson(json);
|
||||
}
|
||||
|
||||
/// 개별 카테고리 아이템 (UI용)
|
||||
@freezed
|
||||
class CategoryItem with _$CategoryItem {
|
||||
const factory CategoryItem({
|
||||
|
||||
@@ -26,10 +26,14 @@ mixin _$LookupData {
|
||||
List<EquipmentNameItem> get equipmentNames =>
|
||||
throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: [])
|
||||
List<CategoryItem> get equipmentCategories =>
|
||||
List<CategoryCombinationItem> get equipmentCategories =>
|
||||
throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'equipment_statuses', defaultValue: [])
|
||||
List<StatusItem> get equipmentStatuses => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'companies', defaultValue: [])
|
||||
List<LookupItem> get companies => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'warehouses', defaultValue: [])
|
||||
List<LookupItem> get warehouses => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LookupData to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@@ -53,9 +57,12 @@ abstract class $LookupDataCopyWith<$Res> {
|
||||
@JsonKey(name: 'equipment_names', defaultValue: [])
|
||||
List<EquipmentNameItem> equipmentNames,
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: [])
|
||||
List<CategoryItem> equipmentCategories,
|
||||
List<CategoryCombinationItem> equipmentCategories,
|
||||
@JsonKey(name: 'equipment_statuses', defaultValue: [])
|
||||
List<StatusItem> equipmentStatuses});
|
||||
List<StatusItem> equipmentStatuses,
|
||||
@JsonKey(name: 'companies', defaultValue: []) List<LookupItem> companies,
|
||||
@JsonKey(name: 'warehouses', defaultValue: [])
|
||||
List<LookupItem> warehouses});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -77,6 +84,8 @@ class _$LookupDataCopyWithImpl<$Res, $Val extends LookupData>
|
||||
Object? equipmentNames = null,
|
||||
Object? equipmentCategories = null,
|
||||
Object? equipmentStatuses = null,
|
||||
Object? companies = null,
|
||||
Object? warehouses = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
manufacturers: null == manufacturers
|
||||
@@ -90,11 +99,19 @@ class _$LookupDataCopyWithImpl<$Res, $Val extends LookupData>
|
||||
equipmentCategories: null == equipmentCategories
|
||||
? _value.equipmentCategories
|
||||
: equipmentCategories // ignore: cast_nullable_to_non_nullable
|
||||
as List<CategoryItem>,
|
||||
as List<CategoryCombinationItem>,
|
||||
equipmentStatuses: null == equipmentStatuses
|
||||
? _value.equipmentStatuses
|
||||
: equipmentStatuses // ignore: cast_nullable_to_non_nullable
|
||||
as List<StatusItem>,
|
||||
companies: null == companies
|
||||
? _value.companies
|
||||
: companies // ignore: cast_nullable_to_non_nullable
|
||||
as List<LookupItem>,
|
||||
warehouses: null == warehouses
|
||||
? _value.warehouses
|
||||
: warehouses // ignore: cast_nullable_to_non_nullable
|
||||
as List<LookupItem>,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
@@ -113,9 +130,12 @@ abstract class _$$LookupDataImplCopyWith<$Res>
|
||||
@JsonKey(name: 'equipment_names', defaultValue: [])
|
||||
List<EquipmentNameItem> equipmentNames,
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: [])
|
||||
List<CategoryItem> equipmentCategories,
|
||||
List<CategoryCombinationItem> equipmentCategories,
|
||||
@JsonKey(name: 'equipment_statuses', defaultValue: [])
|
||||
List<StatusItem> equipmentStatuses});
|
||||
List<StatusItem> equipmentStatuses,
|
||||
@JsonKey(name: 'companies', defaultValue: []) List<LookupItem> companies,
|
||||
@JsonKey(name: 'warehouses', defaultValue: [])
|
||||
List<LookupItem> warehouses});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -135,6 +155,8 @@ class __$$LookupDataImplCopyWithImpl<$Res>
|
||||
Object? equipmentNames = null,
|
||||
Object? equipmentCategories = null,
|
||||
Object? equipmentStatuses = null,
|
||||
Object? companies = null,
|
||||
Object? warehouses = null,
|
||||
}) {
|
||||
return _then(_$LookupDataImpl(
|
||||
manufacturers: null == manufacturers
|
||||
@@ -148,11 +170,19 @@ class __$$LookupDataImplCopyWithImpl<$Res>
|
||||
equipmentCategories: null == equipmentCategories
|
||||
? _value._equipmentCategories
|
||||
: equipmentCategories // ignore: cast_nullable_to_non_nullable
|
||||
as List<CategoryItem>,
|
||||
as List<CategoryCombinationItem>,
|
||||
equipmentStatuses: null == equipmentStatuses
|
||||
? _value._equipmentStatuses
|
||||
: equipmentStatuses // ignore: cast_nullable_to_non_nullable
|
||||
as List<StatusItem>,
|
||||
companies: null == companies
|
||||
? _value._companies
|
||||
: companies // ignore: cast_nullable_to_non_nullable
|
||||
as List<LookupItem>,
|
||||
warehouses: null == warehouses
|
||||
? _value._warehouses
|
||||
: warehouses // ignore: cast_nullable_to_non_nullable
|
||||
as List<LookupItem>,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -166,13 +196,19 @@ class _$LookupDataImpl implements _LookupData {
|
||||
@JsonKey(name: 'equipment_names', defaultValue: [])
|
||||
required final List<EquipmentNameItem> equipmentNames,
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: [])
|
||||
required final List<CategoryItem> equipmentCategories,
|
||||
required final List<CategoryCombinationItem> equipmentCategories,
|
||||
@JsonKey(name: 'equipment_statuses', defaultValue: [])
|
||||
required final List<StatusItem> equipmentStatuses})
|
||||
required final List<StatusItem> equipmentStatuses,
|
||||
@JsonKey(name: 'companies', defaultValue: [])
|
||||
required final List<LookupItem> companies,
|
||||
@JsonKey(name: 'warehouses', defaultValue: [])
|
||||
required final List<LookupItem> warehouses})
|
||||
: _manufacturers = manufacturers,
|
||||
_equipmentNames = equipmentNames,
|
||||
_equipmentCategories = equipmentCategories,
|
||||
_equipmentStatuses = equipmentStatuses;
|
||||
_equipmentStatuses = equipmentStatuses,
|
||||
_companies = companies,
|
||||
_warehouses = warehouses;
|
||||
|
||||
factory _$LookupDataImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LookupDataImplFromJson(json);
|
||||
@@ -195,10 +231,10 @@ class _$LookupDataImpl implements _LookupData {
|
||||
return EqualUnmodifiableListView(_equipmentNames);
|
||||
}
|
||||
|
||||
final List<CategoryItem> _equipmentCategories;
|
||||
final List<CategoryCombinationItem> _equipmentCategories;
|
||||
@override
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: [])
|
||||
List<CategoryItem> get equipmentCategories {
|
||||
List<CategoryCombinationItem> get equipmentCategories {
|
||||
if (_equipmentCategories is EqualUnmodifiableListView)
|
||||
return _equipmentCategories;
|
||||
// ignore: implicit_dynamic_type
|
||||
@@ -215,9 +251,27 @@ class _$LookupDataImpl implements _LookupData {
|
||||
return EqualUnmodifiableListView(_equipmentStatuses);
|
||||
}
|
||||
|
||||
final List<LookupItem> _companies;
|
||||
@override
|
||||
@JsonKey(name: 'companies', defaultValue: [])
|
||||
List<LookupItem> get companies {
|
||||
if (_companies is EqualUnmodifiableListView) return _companies;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_companies);
|
||||
}
|
||||
|
||||
final List<LookupItem> _warehouses;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses', defaultValue: [])
|
||||
List<LookupItem> get warehouses {
|
||||
if (_warehouses is EqualUnmodifiableListView) return _warehouses;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_warehouses);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LookupData(manufacturers: $manufacturers, equipmentNames: $equipmentNames, equipmentCategories: $equipmentCategories, equipmentStatuses: $equipmentStatuses)';
|
||||
return 'LookupData(manufacturers: $manufacturers, equipmentNames: $equipmentNames, equipmentCategories: $equipmentCategories, equipmentStatuses: $equipmentStatuses, companies: $companies, warehouses: $warehouses)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -232,7 +286,11 @@ class _$LookupDataImpl implements _LookupData {
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._equipmentCategories, _equipmentCategories) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._equipmentStatuses, _equipmentStatuses));
|
||||
.equals(other._equipmentStatuses, _equipmentStatuses) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._companies, _companies) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._warehouses, _warehouses));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -242,7 +300,9 @@ class _$LookupDataImpl implements _LookupData {
|
||||
const DeepCollectionEquality().hash(_manufacturers),
|
||||
const DeepCollectionEquality().hash(_equipmentNames),
|
||||
const DeepCollectionEquality().hash(_equipmentCategories),
|
||||
const DeepCollectionEquality().hash(_equipmentStatuses));
|
||||
const DeepCollectionEquality().hash(_equipmentStatuses),
|
||||
const DeepCollectionEquality().hash(_companies),
|
||||
const DeepCollectionEquality().hash(_warehouses));
|
||||
|
||||
/// Create a copy of LookupData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -267,9 +327,13 @@ abstract class _LookupData implements LookupData {
|
||||
@JsonKey(name: 'equipment_names', defaultValue: [])
|
||||
required final List<EquipmentNameItem> equipmentNames,
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: [])
|
||||
required final List<CategoryItem> equipmentCategories,
|
||||
required final List<CategoryCombinationItem> equipmentCategories,
|
||||
@JsonKey(name: 'equipment_statuses', defaultValue: [])
|
||||
required final List<StatusItem> equipmentStatuses}) = _$LookupDataImpl;
|
||||
required final List<StatusItem> equipmentStatuses,
|
||||
@JsonKey(name: 'companies', defaultValue: [])
|
||||
required final List<LookupItem> companies,
|
||||
@JsonKey(name: 'warehouses', defaultValue: [])
|
||||
required final List<LookupItem> warehouses}) = _$LookupDataImpl;
|
||||
|
||||
factory _LookupData.fromJson(Map<String, dynamic> json) =
|
||||
_$LookupDataImpl.fromJson;
|
||||
@@ -282,10 +346,16 @@ abstract class _LookupData implements LookupData {
|
||||
List<EquipmentNameItem> get equipmentNames;
|
||||
@override
|
||||
@JsonKey(name: 'equipment_categories', defaultValue: [])
|
||||
List<CategoryItem> get equipmentCategories;
|
||||
List<CategoryCombinationItem> get equipmentCategories;
|
||||
@override
|
||||
@JsonKey(name: 'equipment_statuses', defaultValue: [])
|
||||
List<StatusItem> get equipmentStatuses;
|
||||
@override
|
||||
@JsonKey(name: 'companies', defaultValue: [])
|
||||
List<LookupItem> get companies;
|
||||
@override
|
||||
@JsonKey(name: 'warehouses', defaultValue: [])
|
||||
List<LookupItem> get warehouses;
|
||||
|
||||
/// Create a copy of LookupData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -301,7 +371,7 @@ LookupItem _$LookupItemFromJson(Map<String, dynamic> json) {
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LookupItem {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
int? get id => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LookupItem to a JSON map.
|
||||
@@ -320,7 +390,7 @@ abstract class $LookupItemCopyWith<$Res> {
|
||||
LookupItem value, $Res Function(LookupItem) then) =
|
||||
_$LookupItemCopyWithImpl<$Res, LookupItem>;
|
||||
@useResult
|
||||
$Res call({int id, String name});
|
||||
$Res call({int? id, String name});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -338,14 +408,14 @@ class _$LookupItemCopyWithImpl<$Res, $Val extends LookupItem>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? id = freezed,
|
||||
Object? name = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int?,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
@@ -362,7 +432,7 @@ abstract class _$$LookupItemImplCopyWith<$Res>
|
||||
__$$LookupItemImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({int id, String name});
|
||||
$Res call({int? id, String name});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -378,14 +448,14 @@ class __$$LookupItemImplCopyWithImpl<$Res>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? id = freezed,
|
||||
Object? name = null,
|
||||
}) {
|
||||
return _then(_$LookupItemImpl(
|
||||
id: null == id
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int?,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
@@ -397,13 +467,13 @@ class __$$LookupItemImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LookupItemImpl implements _LookupItem {
|
||||
const _$LookupItemImpl({required this.id, required this.name});
|
||||
const _$LookupItemImpl({this.id, required this.name});
|
||||
|
||||
factory _$LookupItemImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LookupItemImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
final int? id;
|
||||
@override
|
||||
final String name;
|
||||
|
||||
@@ -442,14 +512,14 @@ class _$LookupItemImpl implements _LookupItem {
|
||||
}
|
||||
|
||||
abstract class _LookupItem implements LookupItem {
|
||||
const factory _LookupItem(
|
||||
{required final int id, required final String name}) = _$LookupItemImpl;
|
||||
const factory _LookupItem({final int? id, required final String name}) =
|
||||
_$LookupItemImpl;
|
||||
|
||||
factory _LookupItem.fromJson(Map<String, dynamic> json) =
|
||||
_$LookupItemImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
int? get id;
|
||||
@override
|
||||
String get name;
|
||||
|
||||
@@ -467,7 +537,7 @@ EquipmentNameItem _$EquipmentNameItemFromJson(Map<String, dynamic> json) {
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentNameItem {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
int? get id => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'model_number')
|
||||
String? get modelNumber => throw _privateConstructorUsedError;
|
||||
@@ -489,7 +559,7 @@ abstract class $EquipmentNameItemCopyWith<$Res> {
|
||||
_$EquipmentNameItemCopyWithImpl<$Res, EquipmentNameItem>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
{int? id,
|
||||
String name,
|
||||
@JsonKey(name: 'model_number') String? modelNumber});
|
||||
}
|
||||
@@ -509,15 +579,15 @@ class _$EquipmentNameItemCopyWithImpl<$Res, $Val extends EquipmentNameItem>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? id = freezed,
|
||||
Object? name = null,
|
||||
Object? modelNumber = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int?,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
@@ -539,7 +609,7 @@ abstract class _$$EquipmentNameItemImplCopyWith<$Res>
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
{int? id,
|
||||
String name,
|
||||
@JsonKey(name: 'model_number') String? modelNumber});
|
||||
}
|
||||
@@ -557,15 +627,15 @@ class __$$EquipmentNameItemImplCopyWithImpl<$Res>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? id = freezed,
|
||||
Object? name = null,
|
||||
Object? modelNumber = freezed,
|
||||
}) {
|
||||
return _then(_$EquipmentNameItemImpl(
|
||||
id: null == id
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
as int?,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
@@ -582,7 +652,7 @@ class __$$EquipmentNameItemImplCopyWithImpl<$Res>
|
||||
@JsonSerializable()
|
||||
class _$EquipmentNameItemImpl implements _EquipmentNameItem {
|
||||
const _$EquipmentNameItemImpl(
|
||||
{required this.id,
|
||||
{this.id,
|
||||
required this.name,
|
||||
@JsonKey(name: 'model_number') this.modelNumber});
|
||||
|
||||
@@ -590,7 +660,7 @@ class _$EquipmentNameItemImpl implements _EquipmentNameItem {
|
||||
_$$EquipmentNameItemImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
final int? id;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
@@ -636,7 +706,7 @@ class _$EquipmentNameItemImpl implements _EquipmentNameItem {
|
||||
|
||||
abstract class _EquipmentNameItem implements EquipmentNameItem {
|
||||
const factory _EquipmentNameItem(
|
||||
{required final int id,
|
||||
{final int? id,
|
||||
required final String name,
|
||||
@JsonKey(name: 'model_number') final String? modelNumber}) =
|
||||
_$EquipmentNameItemImpl;
|
||||
@@ -645,7 +715,7 @@ abstract class _EquipmentNameItem implements EquipmentNameItem {
|
||||
_$EquipmentNameItemImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
int? get id;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
@@ -660,6 +730,202 @@ abstract class _EquipmentNameItem implements EquipmentNameItem {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
CategoryCombinationItem _$CategoryCombinationItemFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _CategoryCombinationItem.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CategoryCombinationItem {
|
||||
String get category1 => throw _privateConstructorUsedError;
|
||||
String get category2 => throw _privateConstructorUsedError;
|
||||
String get category3 => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this CategoryCombinationItem to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CategoryCombinationItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CategoryCombinationItemCopyWith<CategoryCombinationItem> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CategoryCombinationItemCopyWith<$Res> {
|
||||
factory $CategoryCombinationItemCopyWith(CategoryCombinationItem value,
|
||||
$Res Function(CategoryCombinationItem) then) =
|
||||
_$CategoryCombinationItemCopyWithImpl<$Res, CategoryCombinationItem>;
|
||||
@useResult
|
||||
$Res call({String category1, String category2, String category3});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CategoryCombinationItemCopyWithImpl<$Res,
|
||||
$Val extends CategoryCombinationItem>
|
||||
implements $CategoryCombinationItemCopyWith<$Res> {
|
||||
_$CategoryCombinationItemCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CategoryCombinationItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? category1 = null,
|
||||
Object? category2 = null,
|
||||
Object? category3 = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
category1: null == category1
|
||||
? _value.category1
|
||||
: category1 // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
category2: null == category2
|
||||
? _value.category2
|
||||
: category2 // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
category3: null == category3
|
||||
? _value.category3
|
||||
: category3 // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CategoryCombinationItemImplCopyWith<$Res>
|
||||
implements $CategoryCombinationItemCopyWith<$Res> {
|
||||
factory _$$CategoryCombinationItemImplCopyWith(
|
||||
_$CategoryCombinationItemImpl value,
|
||||
$Res Function(_$CategoryCombinationItemImpl) then) =
|
||||
__$$CategoryCombinationItemImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String category1, String category2, String category3});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CategoryCombinationItemImplCopyWithImpl<$Res>
|
||||
extends _$CategoryCombinationItemCopyWithImpl<$Res,
|
||||
_$CategoryCombinationItemImpl>
|
||||
implements _$$CategoryCombinationItemImplCopyWith<$Res> {
|
||||
__$$CategoryCombinationItemImplCopyWithImpl(
|
||||
_$CategoryCombinationItemImpl _value,
|
||||
$Res Function(_$CategoryCombinationItemImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CategoryCombinationItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? category1 = null,
|
||||
Object? category2 = null,
|
||||
Object? category3 = null,
|
||||
}) {
|
||||
return _then(_$CategoryCombinationItemImpl(
|
||||
category1: null == category1
|
||||
? _value.category1
|
||||
: category1 // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
category2: null == category2
|
||||
? _value.category2
|
||||
: category2 // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
category3: null == category3
|
||||
? _value.category3
|
||||
: category3 // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$CategoryCombinationItemImpl implements _CategoryCombinationItem {
|
||||
const _$CategoryCombinationItemImpl(
|
||||
{required this.category1,
|
||||
required this.category2,
|
||||
required this.category3});
|
||||
|
||||
factory _$CategoryCombinationItemImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$CategoryCombinationItemImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String category1;
|
||||
@override
|
||||
final String category2;
|
||||
@override
|
||||
final String category3;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CategoryCombinationItem(category1: $category1, category2: $category2, category3: $category3)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CategoryCombinationItemImpl &&
|
||||
(identical(other.category1, category1) ||
|
||||
other.category1 == category1) &&
|
||||
(identical(other.category2, category2) ||
|
||||
other.category2 == category2) &&
|
||||
(identical(other.category3, category3) ||
|
||||
other.category3 == category3));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, category1, category2, category3);
|
||||
|
||||
/// Create a copy of CategoryCombinationItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CategoryCombinationItemImplCopyWith<_$CategoryCombinationItemImpl>
|
||||
get copyWith => __$$CategoryCombinationItemImplCopyWithImpl<
|
||||
_$CategoryCombinationItemImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$CategoryCombinationItemImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CategoryCombinationItem implements CategoryCombinationItem {
|
||||
const factory _CategoryCombinationItem(
|
||||
{required final String category1,
|
||||
required final String category2,
|
||||
required final String category3}) = _$CategoryCombinationItemImpl;
|
||||
|
||||
factory _CategoryCombinationItem.fromJson(Map<String, dynamic> json) =
|
||||
_$CategoryCombinationItemImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get category1;
|
||||
@override
|
||||
String get category2;
|
||||
@override
|
||||
String get category3;
|
||||
|
||||
/// Create a copy of CategoryCombinationItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CategoryCombinationItemImplCopyWith<_$CategoryCombinationItemImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
CategoryItem _$CategoryItemFromJson(Map<String, dynamic> json) {
|
||||
return _CategoryItem.fromJson(json);
|
||||
}
|
||||
|
||||
@@ -18,13 +18,22 @@ _$LookupDataImpl _$$LookupDataImplFromJson(Map<String, dynamic> json) =>
|
||||
.toList() ??
|
||||
[],
|
||||
equipmentCategories: (json['equipment_categories'] as List<dynamic>?)
|
||||
?.map((e) => CategoryItem.fromJson(e as Map<String, dynamic>))
|
||||
?.map((e) =>
|
||||
CategoryCombinationItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
equipmentStatuses: (json['equipment_statuses'] as List<dynamic>?)
|
||||
?.map((e) => StatusItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
companies: (json['companies'] as List<dynamic>?)
|
||||
?.map((e) => LookupItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
warehouses: (json['warehouses'] as List<dynamic>?)
|
||||
?.map((e) => LookupItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LookupDataImplToJson(_$LookupDataImpl instance) =>
|
||||
@@ -33,11 +42,13 @@ Map<String, dynamic> _$$LookupDataImplToJson(_$LookupDataImpl instance) =>
|
||||
'equipment_names': instance.equipmentNames,
|
||||
'equipment_categories': instance.equipmentCategories,
|
||||
'equipment_statuses': instance.equipmentStatuses,
|
||||
'companies': instance.companies,
|
||||
'warehouses': instance.warehouses,
|
||||
};
|
||||
|
||||
_$LookupItemImpl _$$LookupItemImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LookupItemImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
name: json['name'] as String,
|
||||
);
|
||||
|
||||
@@ -50,7 +61,7 @@ Map<String, dynamic> _$$LookupItemImplToJson(_$LookupItemImpl instance) =>
|
||||
_$EquipmentNameItemImpl _$$EquipmentNameItemImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentNameItemImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
name: json['name'] as String,
|
||||
modelNumber: json['model_number'] as String?,
|
||||
);
|
||||
@@ -63,6 +74,22 @@ Map<String, dynamic> _$$EquipmentNameItemImplToJson(
|
||||
'model_number': instance.modelNumber,
|
||||
};
|
||||
|
||||
_$CategoryCombinationItemImpl _$$CategoryCombinationItemImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$CategoryCombinationItemImpl(
|
||||
category1: json['category1'] as String,
|
||||
category2: json['category2'] as String,
|
||||
category3: json['category3'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$CategoryCombinationItemImplToJson(
|
||||
_$CategoryCombinationItemImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'category1': instance.category1,
|
||||
'category2': instance.category2,
|
||||
'category3': instance.category3,
|
||||
};
|
||||
|
||||
_$CategoryItemImpl _$$CategoryItemImplFromJson(Map<String, dynamic> json) =>
|
||||
_$CategoryItemImpl(
|
||||
id: json['id'] as String,
|
||||
|
||||
@@ -104,7 +104,7 @@ class SuperportApp extends StatelessWidget {
|
||||
|
||||
// 기존 라우팅 처리 (폼 화면들)
|
||||
switch (settings.name) {
|
||||
// 장비 입고 관련 라우트
|
||||
// 장비 입고 관련 라우트 (새로운 Lookup API 기반)
|
||||
case Routes.equipmentInAdd:
|
||||
return MaterialPageRoute(
|
||||
builder: (context) => const EquipmentInFormScreen(),
|
||||
|
||||
@@ -26,6 +26,15 @@ class Equipment {
|
||||
final DateTime? nextInspectionDate; // 다음 점검일
|
||||
final String? equipmentStatus; // 장비 상태
|
||||
|
||||
// 새로운 백엔드 API 필드들 (컨트롤러 호환성용)
|
||||
final String? equipmentNumber; // 장비 번호
|
||||
final String? modelName; // 모델명 (name과 동일하지만 명확성을 위해)
|
||||
final String? category1; // 대분류 (category와 매핑)
|
||||
final String? category2; // 중분류 (subCategory와 매핑)
|
||||
final String? category3; // 소분류 (subSubCategory와 매핑)
|
||||
final int? companyId; // 구매처 회사 ID
|
||||
final DateTime? purchaseDate; // 구매일
|
||||
|
||||
Equipment({
|
||||
this.id,
|
||||
required this.manufacturer,
|
||||
@@ -49,6 +58,14 @@ class Equipment {
|
||||
this.lastInspectionDate,
|
||||
this.nextInspectionDate,
|
||||
this.equipmentStatus,
|
||||
// 백엔드 API 호환성 필드들
|
||||
this.equipmentNumber,
|
||||
this.modelName,
|
||||
this.category1,
|
||||
this.category2,
|
||||
this.category3,
|
||||
this.companyId,
|
||||
this.purchaseDate,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -75,6 +92,14 @@ class Equipment {
|
||||
'lastInspectionDate': lastInspectionDate?.toIso8601String(),
|
||||
'nextInspectionDate': nextInspectionDate?.toIso8601String(),
|
||||
'equipmentStatus': equipmentStatus,
|
||||
// 백엔드 API 호환성 필드들
|
||||
'equipmentNumber': equipmentNumber,
|
||||
'modelName': modelName,
|
||||
'category1': category1,
|
||||
'category2': category2,
|
||||
'category3': category3,
|
||||
'companyId': companyId,
|
||||
'purchaseDate': purchaseDate?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -112,6 +137,16 @@ class Equipment {
|
||||
? DateTime.parse(json['nextInspectionDate'])
|
||||
: null,
|
||||
equipmentStatus: json['equipmentStatus'],
|
||||
// 백엔드 API 호환성 필드들
|
||||
equipmentNumber: json['equipmentNumber'],
|
||||
modelName: json['modelName'],
|
||||
category1: json['category1'],
|
||||
category2: json['category2'],
|
||||
category3: json['category3'],
|
||||
companyId: json['companyId'],
|
||||
purchaseDate: json['purchaseDate'] != null
|
||||
? DateTime.parse(json['purchaseDate'])
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:superport/utils/constants.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
import 'package:superport/core/utils/debug_logger.dart';
|
||||
import 'package:superport/core/utils/equipment_status_converter.dart';
|
||||
import 'package:superport/core/services/lookups_service.dart';
|
||||
|
||||
/// 장비 입고 폼 컨트롤러
|
||||
///
|
||||
@@ -16,6 +17,7 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
final EquipmentService _equipmentService = GetIt.instance<EquipmentService>();
|
||||
final WarehouseService _warehouseService = GetIt.instance<WarehouseService>();
|
||||
final CompanyService _companyService = GetIt.instance<CompanyService>();
|
||||
final LookupsService _lookupsService = GetIt.instance<LookupsService>();
|
||||
final int? equipmentInId; // 실제로는 장비 ID (입고 ID가 아님)
|
||||
int? actualEquipmentId; // API 호출용 실제 장비 ID
|
||||
|
||||
@@ -29,36 +31,113 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
String? get error => _error;
|
||||
bool get isSaving => _isSaving;
|
||||
|
||||
// 저장 가능 상태를 별도 변수로 관리 (성능 개선 및 UI 동기화)
|
||||
bool _canSave = false;
|
||||
bool get canSave => _canSave;
|
||||
|
||||
/// canSave 상태 업데이트 (UI 렌더링 문제 해결)
|
||||
void _updateCanSave() {
|
||||
final hasEquipmentNumber = _equipmentNumber.trim().isNotEmpty;
|
||||
final hasManufacturer = _manufacturer.trim().isNotEmpty;
|
||||
final isNotSaving = !_isSaving;
|
||||
|
||||
final newCanSave = isNotSaving && hasEquipmentNumber && hasManufacturer;
|
||||
|
||||
if (_canSave != newCanSave) {
|
||||
_canSave = newCanSave;
|
||||
print('🚀 [canSave 상태 변경] $_canSave → equipmentNumber: "$_equipmentNumber", manufacturer: "$_manufacturer"');
|
||||
notifyListeners(); // 명시적 UI 업데이트
|
||||
}
|
||||
}
|
||||
|
||||
// 폼 키
|
||||
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
|
||||
// 입력 상태 변수
|
||||
String manufacturer = '';
|
||||
String name = '';
|
||||
String category = '';
|
||||
String subCategory = '';
|
||||
String subSubCategory = '';
|
||||
String serialNumber = '';
|
||||
String barcode = '';
|
||||
int quantity = 1;
|
||||
DateTime inDate = DateTime.now();
|
||||
String equipmentType = EquipmentType.new_;
|
||||
bool hasSerialNumber = true;
|
||||
// 입력 상태 변수 (백엔드 API 구조에 맞게 수정)
|
||||
String _equipmentNumber = ''; // 장비번호 (필수) - private으로 변경
|
||||
String _manufacturer = ''; // 제조사 (필수) - private으로 변경
|
||||
String _modelName = ''; // 모델명 - private으로 변경
|
||||
String _serialNumber = ''; // 시리얼번호 - private으로 변경
|
||||
String _category1 = ''; // 대분류 - private으로 변경
|
||||
String _category2 = ''; // 중분류 - private으로 변경
|
||||
String _category3 = ''; // 소분류 - private으로 변경
|
||||
|
||||
// 워런티 관련 상태
|
||||
String? warrantyLicense;
|
||||
String? warrantyCode; // 워런티 코드(텍스트 입력)
|
||||
DateTime warrantyStartDate = DateTime.now();
|
||||
DateTime warrantyEndDate = DateTime.now().add(const Duration(days: 365));
|
||||
List<String> warrantyLicenses = [];
|
||||
// Getters and Setters for reactive fields
|
||||
String get equipmentNumber => _equipmentNumber;
|
||||
set equipmentNumber(String value) {
|
||||
if (_equipmentNumber != value) {
|
||||
_equipmentNumber = value;
|
||||
_updateCanSave(); // canSave 상태 업데이트
|
||||
print('DEBUG [Controller] equipmentNumber updated: "$_equipmentNumber"');
|
||||
}
|
||||
}
|
||||
|
||||
// 자동완성 데이터
|
||||
String get serialNumber => _serialNumber;
|
||||
set serialNumber(String value) {
|
||||
if (_serialNumber != value) {
|
||||
_serialNumber = value;
|
||||
_updateCanSave(); // canSave 상태 업데이트
|
||||
print('DEBUG [Controller] serialNumber updated: "$_serialNumber"');
|
||||
}
|
||||
}
|
||||
|
||||
String get manufacturer => _manufacturer;
|
||||
set manufacturer(String value) {
|
||||
if (_manufacturer != value) {
|
||||
_manufacturer = value;
|
||||
_updateCanSave(); // canSave 상태 업데이트
|
||||
print('DEBUG [Controller] manufacturer updated: "$_manufacturer"');
|
||||
}
|
||||
}
|
||||
|
||||
String get modelName => _modelName;
|
||||
set modelName(String value) {
|
||||
if (_modelName != value) {
|
||||
_modelName = value;
|
||||
_updateCanSave(); // canSave 상태 업데이트
|
||||
print('DEBUG [Controller] modelName updated: "$_modelName"');
|
||||
}
|
||||
}
|
||||
|
||||
String get category1 => _category1;
|
||||
set category1(String value) {
|
||||
if (_category1 != value) {
|
||||
_category1 = value;
|
||||
_updateCanSave(); // canSave 상태 업데이트
|
||||
}
|
||||
}
|
||||
|
||||
String get category2 => _category2;
|
||||
set category2(String value) {
|
||||
if (_category2 != value) {
|
||||
_category2 = value;
|
||||
_updateCanSave(); // canSave 상태 업데이트
|
||||
}
|
||||
}
|
||||
|
||||
String get category3 => _category3;
|
||||
set category3(String value) {
|
||||
if (_category3 != value) {
|
||||
_category3 = value;
|
||||
_updateCanSave(); // canSave 상태 업데이트
|
||||
}
|
||||
}
|
||||
DateTime? purchaseDate; // 구매일
|
||||
double? purchasePrice; // 구매가격
|
||||
|
||||
// 삭제된 필드들 (백엔드 미지원)
|
||||
// barcode, quantity, inDate, equipmentType, hasSerialNumber
|
||||
// warranty 관련 모든 필드들
|
||||
|
||||
// Lookups API 데이터 (매번 API 호출)
|
||||
List<String> manufacturers = [];
|
||||
List<String> equipmentNames = [];
|
||||
// 카테고리 자동완성 데이터
|
||||
List<String> categories = [];
|
||||
List<String> subCategories = [];
|
||||
List<String> subSubCategories = [];
|
||||
Map<int, String> companies = {};
|
||||
Map<int, String> warehouses = {};
|
||||
|
||||
// 선택된 ID 값들
|
||||
int? selectedCompanyId; // 구매처 ID
|
||||
int? selectedWarehouseId; // 입고지 ID
|
||||
|
||||
// 창고 위치 전체 데이터 (이름-ID 매핑용)
|
||||
Map<String, int> warehouseLocationMap = {};
|
||||
@@ -66,33 +145,41 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
// 편집 모드 여부
|
||||
bool isEditMode = false;
|
||||
|
||||
// 수정불가 필드 목록 (수정 모드에서만 적용)
|
||||
static const List<String> _readOnlyFields = [
|
||||
'equipmentNumber', // 장비번호
|
||||
'manufacturer', // 제조사
|
||||
'modelName', // 모델명
|
||||
'serialNumber', // 시리얼번호
|
||||
'purchaseDate', // 구매일
|
||||
'purchasePrice', // 구매가격
|
||||
];
|
||||
|
||||
/// 특정 필드가 수정불가인지 확인
|
||||
bool isFieldReadOnly(String fieldName) {
|
||||
return isEditMode && _readOnlyFields.contains(fieldName);
|
||||
}
|
||||
|
||||
// 입고지, 파트너사 관련 상태
|
||||
String? warehouseLocation;
|
||||
String? partnerCompany;
|
||||
List<String> warehouseLocations = [];
|
||||
List<String> partnerCompanies = [];
|
||||
|
||||
// 새로운 필드들 (백엔드 API 구조 변경 대응)
|
||||
double? purchasePrice; // 구매 가격
|
||||
int? currentCompanyId; // 현재 회사 ID
|
||||
int? warehouseLocationId; // 창고 위치 ID
|
||||
int? currentBranchId; // 현재 지점 ID (Deprecated)
|
||||
DateTime? lastInspectionDate; // 최근 점검일
|
||||
DateTime? nextInspectionDate; // 다음 점검일
|
||||
String? equipmentStatus; // 장비 상태
|
||||
// 기존 필드들은 위로 이동, 삭제된 필드들
|
||||
// currentCompanyId, currentBranchId, lastInspectionDate, nextInspectionDate, equipmentStatus는 입고 시 불필요
|
||||
|
||||
// 워런티 관련 필드들 (필요 시 사용)
|
||||
String? warrantyLicense;
|
||||
DateTime warrantyStartDate = DateTime.now();
|
||||
DateTime warrantyEndDate = DateTime.now().add(const Duration(days: 365));
|
||||
|
||||
final TextEditingController remarkController = TextEditingController();
|
||||
|
||||
EquipmentInFormController({this.equipmentInId}) {
|
||||
isEditMode = equipmentInId != null;
|
||||
_loadManufacturers();
|
||||
_loadEquipmentNames();
|
||||
_loadCategories();
|
||||
_loadSubCategories();
|
||||
_loadSubSubCategories();
|
||||
_loadWarehouseLocations();
|
||||
_loadPartnerCompanies();
|
||||
_loadWarrantyLicenses();
|
||||
_loadDropdownData();
|
||||
_updateCanSave(); // 초기 canSave 상태 설정
|
||||
// 수정 모드일 때 초기 데이터 로드는 initializeForEdit() 메서드로 이동
|
||||
}
|
||||
|
||||
@@ -102,79 +189,50 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
await _loadEquipmentIn();
|
||||
}
|
||||
|
||||
// 자동완성 데이터는 API를 통해 로드해야 하지만, 현재는 빈 목록으로 설정
|
||||
void _loadManufacturers() {
|
||||
// TODO: API를 통해 제조사 목록 로드
|
||||
// 드롭다운 데이터 로드 (매번 API 호출)
|
||||
void _loadDropdownData() async {
|
||||
try {
|
||||
DebugLogger.log('Equipment 폼 드롭다운 데이터 로드 시작', tag: 'EQUIPMENT_IN');
|
||||
final result = await _lookupsService.getEquipmentFormDropdownData();
|
||||
|
||||
result.fold(
|
||||
(failure) {
|
||||
DebugLogger.logError('드롭다운 데이터 로드 실패', error: failure.message);
|
||||
// API 실패 시 빈 데이터
|
||||
manufacturers = [];
|
||||
}
|
||||
|
||||
void _loadEquipmentNames() {
|
||||
// TODO: API를 통해 장비명 목록 로드
|
||||
equipmentNames = [];
|
||||
}
|
||||
companies = {};
|
||||
warehouses = {};
|
||||
notifyListeners();
|
||||
},
|
||||
(data) {
|
||||
manufacturers = data['manufacturers'] as List<String>;
|
||||
equipmentNames = data['equipment_names'] as List<String>;
|
||||
companies = data['companies'] as Map<int, String>;
|
||||
warehouses = data['warehouses'] as Map<int, String>;
|
||||
|
||||
void _loadCategories() {
|
||||
// TODO: API를 통해 카테고리 목록 로드
|
||||
categories = [];
|
||||
}
|
||||
|
||||
void _loadSubCategories() {
|
||||
// TODO: API를 통해 서브카테고리 목록 로드
|
||||
subCategories = [];
|
||||
}
|
||||
|
||||
void _loadSubSubCategories() {
|
||||
// TODO: API를 통해 서브서브카테고리 목록 로드
|
||||
subSubCategories = [];
|
||||
}
|
||||
|
||||
// 입고지 목록 로드
|
||||
void _loadWarehouseLocations() async {
|
||||
try {
|
||||
DebugLogger.log('입고지 목록 API 로드 시작', tag: 'EQUIPMENT_IN');
|
||||
final response = await _warehouseService.getWarehouseLocations();
|
||||
warehouseLocations = response.items.map((e) => e.name).toList();
|
||||
// 이름-ID 매핑 저장
|
||||
warehouseLocationMap = {for (var loc in response.items) loc.name: loc.id};
|
||||
DebugLogger.log('입고지 목록 로드 성공', tag: 'EQUIPMENT_IN', data: {
|
||||
'count': warehouseLocations.length,
|
||||
'locations': warehouseLocations,
|
||||
'locationMap': warehouseLocationMap,
|
||||
DebugLogger.log('드롭다운 데이터 로드 성공', tag: 'EQUIPMENT_IN', data: {
|
||||
'manufacturers_count': manufacturers.length,
|
||||
'equipment_names_count': equipmentNames.length,
|
||||
'companies_count': companies.length,
|
||||
'warehouses_count': warehouses.length,
|
||||
});
|
||||
|
||||
notifyListeners();
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
DebugLogger.logError('입고지 목록 로드 실패', error: e);
|
||||
// API 실패 시 빈 목록
|
||||
warehouseLocations = [];
|
||||
warehouseLocationMap = {};
|
||||
DebugLogger.logError('드롭다운 데이터 로드 예외', error: e);
|
||||
manufacturers = [];
|
||||
equipmentNames = [];
|
||||
companies = {};
|
||||
warehouses = {};
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
// 파트너사 목록 로드
|
||||
void _loadPartnerCompanies() async {
|
||||
try {
|
||||
DebugLogger.log('파트너사 목록 API 로드 시작', tag: 'EQUIPMENT_IN');
|
||||
final response = await _companyService.getCompanies();
|
||||
partnerCompanies = response.items.map((c) => c.name).toList();
|
||||
DebugLogger.log('파트너사 목록 로드 성공', tag: 'EQUIPMENT_IN', data: {
|
||||
'count': partnerCompanies.length,
|
||||
'companies': partnerCompanies,
|
||||
});
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
DebugLogger.logError('파트너사 목록 로드 실패', error: e);
|
||||
// API 실패 시 빈 목록
|
||||
partnerCompanies = [];
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
// 워런티 라이센스 목록 로드
|
||||
void _loadWarrantyLicenses() {
|
||||
// 실제로는 API나 서비스에서 불러와야 하지만, 파트너사와 동일한 데이터 사용
|
||||
warrantyLicenses = List.from(partnerCompanies);
|
||||
}
|
||||
// 기존의 개별 로드 메서드들은 _loadDropdownData()로 통합됨
|
||||
// warehouseLocations, partnerCompanies 리스트 변수들도 제거됨
|
||||
|
||||
// 기존 데이터 로드(수정 모드)
|
||||
Future<void> _loadEquipmentIn() async {
|
||||
@@ -205,60 +263,43 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
'name': equipment.name,
|
||||
});
|
||||
|
||||
// 장비 정보 설정
|
||||
// 장비 정보 설정 (새로운 필드 구조)
|
||||
print('DEBUG [_loadEquipmentIn] Setting equipment data...');
|
||||
print('DEBUG [_loadEquipmentIn] equipment.manufacturer="${equipment.manufacturer}"');
|
||||
print('DEBUG [_loadEquipmentIn] equipment.name="${equipment.name}"');
|
||||
print('DEBUG [_loadEquipmentIn] equipment.equipmentNumber="${equipment.equipmentNumber}"');
|
||||
|
||||
manufacturer = equipment.manufacturer;
|
||||
name = equipment.name;
|
||||
category = equipment.category;
|
||||
subCategory = equipment.subCategory;
|
||||
subSubCategory = equipment.subSubCategory;
|
||||
serialNumber = equipment.serialNumber ?? '';
|
||||
barcode = equipment.barcode ?? '';
|
||||
quantity = equipment.quantity;
|
||||
// 새로운 필드 구조로 매핑 (setter 사용하여 notifyListeners 자동 호출)
|
||||
_equipmentNumber = equipment.equipmentNumber ?? '';
|
||||
manufacturer = equipment.manufacturer ?? '';
|
||||
modelName = equipment.modelName ?? equipment.name ?? '';
|
||||
_serialNumber = equipment.serialNumber ?? '';
|
||||
category1 = equipment.category1 ?? equipment.category ?? '';
|
||||
category2 = equipment.category2 ?? equipment.subCategory ?? '';
|
||||
category3 = equipment.category3 ?? equipment.subSubCategory ?? '';
|
||||
purchaseDate = equipment.purchaseDate;
|
||||
purchasePrice = equipment.purchasePrice;
|
||||
selectedCompanyId = equipment.companyId;
|
||||
selectedWarehouseId = equipment.warehouseLocationId;
|
||||
remarkController.text = equipment.remark ?? '';
|
||||
hasSerialNumber = serialNumber.isNotEmpty;
|
||||
|
||||
print('DEBUG [_loadEquipmentIn] After setting - manufacturer="$manufacturer", name="$name"');
|
||||
print('DEBUG [_loadEquipmentIn] After setting - equipmentNumber="$_equipmentNumber", manufacturer="$_manufacturer", modelName="$_modelName"');
|
||||
// 🔧 [DEBUG] UI 업데이트를 위한 중요 필드들 로깅
|
||||
print('DEBUG [_loadEquipmentIn] purchaseDate: $purchaseDate, purchasePrice: $purchasePrice');
|
||||
print('DEBUG [_loadEquipmentIn] selectedCompanyId: $selectedCompanyId, selectedWarehouseId: $selectedWarehouseId');
|
||||
|
||||
DebugLogger.log('장비 데이터 설정 완료', tag: 'EQUIPMENT_IN', data: {
|
||||
'manufacturer': manufacturer,
|
||||
'name': name,
|
||||
'category': category,
|
||||
'subCategory': subCategory,
|
||||
'subSubCategory': subSubCategory,
|
||||
'serialNumber': serialNumber,
|
||||
'quantity': quantity,
|
||||
'equipmentNumber': _equipmentNumber,
|
||||
'manufacturer': _manufacturer,
|
||||
'modelName': _modelName,
|
||||
'category1': _category1,
|
||||
'category2': _category2,
|
||||
'category3': _category3,
|
||||
'serialNumber': _serialNumber,
|
||||
});
|
||||
|
||||
print('DEBUG [EQUIPMENT_IN]: Equipment loaded - manufacturer: "$manufacturer", name: "$name", category: "$category"');
|
||||
print('DEBUG [EQUIPMENT_IN]: Equipment loaded - equipmentNumber: "$_equipmentNumber", manufacturer: "$_manufacturer", modelName: "$_modelName"');
|
||||
|
||||
// 워런티 정보
|
||||
warrantyLicense = equipment.warrantyLicense;
|
||||
warrantyStartDate = equipment.warrantyStartDate ?? DateTime.now();
|
||||
warrantyEndDate = equipment.warrantyEndDate ?? DateTime.now().add(const Duration(days: 365));
|
||||
|
||||
// 새로운 필드들 설정 (백엔드 API에서 제공되면 사용, 아니면 기본값)
|
||||
currentCompanyId = equipment.currentCompanyId;
|
||||
currentBranchId = equipment.currentBranchId;
|
||||
lastInspectionDate = equipment.lastInspectionDate;
|
||||
nextInspectionDate = equipment.nextInspectionDate;
|
||||
// 유효한 장비 상태 목록 (클라이언트 형식으로 변환)
|
||||
const validServerStatuses = ['available', 'inuse', 'maintenance', 'disposed'];
|
||||
if (equipment.equipmentStatus != null && validServerStatuses.contains(equipment.equipmentStatus)) {
|
||||
// 서버 상태를 클라이언트 상태로 변환하여 저장
|
||||
equipmentStatus = EquipmentStatusConverter.serverToClient(equipment.equipmentStatus);
|
||||
} else {
|
||||
// 기본값: 입고 상태 (클라이언트 형식)
|
||||
equipmentStatus = 'I'; // 입고
|
||||
}
|
||||
|
||||
// 입고 관련 정보는 현재 API에서 제공하지 않으므로 기본값 사용
|
||||
inDate = equipment.inDate ?? DateTime.now();
|
||||
equipmentType = EquipmentType.new_;
|
||||
// 창고 위치와 파트너사는 사용자가 수정 시 입력
|
||||
// 추가 필드들은 입고 시에는 필요하지 않으므로 생략
|
||||
|
||||
} catch (e, stackTrace) {
|
||||
print('DEBUG [_loadEquipmentIn] Error loading equipment: $e');
|
||||
@@ -271,6 +312,7 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
DebugLogger.logError('장비 로드 실패', error: e);
|
||||
} finally {
|
||||
_isLoading = false;
|
||||
_updateCanSave(); // 데이터 로드 완료 시 canSave 상태 업데이트
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
@@ -308,66 +350,43 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
|
||||
_isSaving = true;
|
||||
_error = null;
|
||||
_updateCanSave(); // 저장 시작 시 canSave 상태 업데이트
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
|
||||
// 입력값이 리스트에 없으면 추가
|
||||
if (partnerCompany != null &&
|
||||
partnerCompany!.isNotEmpty &&
|
||||
!partnerCompanies.contains(partnerCompany)) {
|
||||
partnerCompanies.add(partnerCompany!);
|
||||
// 새로운 입력값을 로컬 리스트에 추가 (사용자 경험 향상용)
|
||||
if (_manufacturer.isNotEmpty && !manufacturers.contains(_manufacturer)) {
|
||||
manufacturers.add(_manufacturer);
|
||||
}
|
||||
if (warehouseLocation != null &&
|
||||
warehouseLocation!.isNotEmpty &&
|
||||
!warehouseLocations.contains(warehouseLocation)) {
|
||||
warehouseLocations.add(warehouseLocation!);
|
||||
}
|
||||
if (manufacturer.isNotEmpty && !manufacturers.contains(manufacturer)) {
|
||||
manufacturers.add(manufacturer);
|
||||
}
|
||||
if (name.isNotEmpty && !equipmentNames.contains(name)) {
|
||||
equipmentNames.add(name);
|
||||
}
|
||||
if (category.isNotEmpty && !categories.contains(category)) {
|
||||
categories.add(category);
|
||||
}
|
||||
if (subCategory.isNotEmpty && !subCategories.contains(subCategory)) {
|
||||
subCategories.add(subCategory);
|
||||
}
|
||||
if (subSubCategory.isNotEmpty &&
|
||||
!subSubCategories.contains(subSubCategory)) {
|
||||
subSubCategories.add(subSubCategory);
|
||||
}
|
||||
if (warrantyLicense != null &&
|
||||
warrantyLicense!.isNotEmpty &&
|
||||
!warrantyLicenses.contains(warrantyLicense)) {
|
||||
warrantyLicenses.add(warrantyLicense!);
|
||||
if (_modelName.isNotEmpty && !equipmentNames.contains(_modelName)) {
|
||||
equipmentNames.add(_modelName);
|
||||
}
|
||||
|
||||
// 백엔드 API 구조에 맞는 Equipment 객체 생성
|
||||
final equipment = Equipment(
|
||||
manufacturer: manufacturer,
|
||||
name: name,
|
||||
category: category,
|
||||
subCategory: subCategory,
|
||||
subSubCategory: subSubCategory,
|
||||
serialNumber: hasSerialNumber ? serialNumber : null,
|
||||
barcode: barcode.isNotEmpty ? barcode : null,
|
||||
quantity: quantity,
|
||||
inDate: inDate, // 구매일 매핑
|
||||
remark: remarkController.text.trim().isEmpty ? null : remarkController.text.trim(),
|
||||
warrantyLicense: warrantyLicense,
|
||||
// 백엔드 API 새로운 필드들 매핑
|
||||
// 새로운 필드들 (백엔드 API 기준)
|
||||
equipmentNumber: _equipmentNumber.trim(),
|
||||
manufacturer: _manufacturer.trim(),
|
||||
modelName: _modelName.trim().isEmpty ? null : _modelName.trim(),
|
||||
serialNumber: _serialNumber.trim().isEmpty ? null : _serialNumber.trim(),
|
||||
category1: _category1.trim().isEmpty ? null : _category1.trim(),
|
||||
category2: _category2.trim().isEmpty ? null : _category2.trim(),
|
||||
category3: _category3.trim().isEmpty ? null : _category3.trim(),
|
||||
purchaseDate: purchaseDate,
|
||||
purchasePrice: purchasePrice,
|
||||
currentCompanyId: currentCompanyId,
|
||||
warehouseLocationId: warehouseLocationId,
|
||||
currentBranchId: currentBranchId, // Deprecated but kept for compatibility
|
||||
lastInspectionDate: lastInspectionDate,
|
||||
nextInspectionDate: nextInspectionDate,
|
||||
equipmentStatus: equipmentStatus, // 클라이언트 형식 ('I', 'O' 등)
|
||||
warrantyStartDate: warrantyStartDate,
|
||||
warrantyEndDate: warrantyEndDate,
|
||||
// 워런티 코드 저장 필요시 여기에 추가
|
||||
remark: remarkController.text.trim().isEmpty ? null : remarkController.text.trim(),
|
||||
companyId: selectedCompanyId, // 구매처 ID
|
||||
warehouseLocationId: selectedWarehouseId, // 입고지 ID
|
||||
|
||||
// 기존 Equipment 모델과의 호환성을 위한 매핑
|
||||
name: _modelName.trim().isEmpty ? _equipmentNumber.trim() : _modelName.trim(),
|
||||
category: _category1.trim(),
|
||||
subCategory: _category2.trim(),
|
||||
subSubCategory: _category3.trim(),
|
||||
barcode: '', // 사용하지 않음
|
||||
quantity: 1, // 기본값
|
||||
inDate: purchaseDate ?? DateTime.now(),
|
||||
);
|
||||
|
||||
// API 호출
|
||||
@@ -379,8 +398,9 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
|
||||
DebugLogger.log('장비 정보 업데이트 시작', tag: 'EQUIPMENT_IN', data: {
|
||||
'equipmentId': actualEquipmentId,
|
||||
'equipmentNumber': equipment.equipmentNumber,
|
||||
'manufacturer': equipment.manufacturer,
|
||||
'name': equipment.name,
|
||||
'modelName': equipment.modelName,
|
||||
'serialNumber': equipment.serialNumber,
|
||||
});
|
||||
|
||||
@@ -391,10 +411,11 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
// 생성 모드
|
||||
try {
|
||||
// 1. 먼저 장비 생성
|
||||
DebugLogger.log('장비 생성 시작', tag: 'EQUIPMENT_IN', data: {
|
||||
'manufacturer': manufacturer,
|
||||
'name': name,
|
||||
'serialNumber': serialNumber,
|
||||
DebugLogger.log('장비 입고 시작', tag: 'EQUIPMENT_IN', data: {
|
||||
'equipmentNumber': _equipmentNumber,
|
||||
'manufacturer': _manufacturer,
|
||||
'modelName': _modelName,
|
||||
'serialNumber': _serialNumber,
|
||||
});
|
||||
|
||||
final createdEquipment = await _equipmentService.createEquipment(equipment);
|
||||
@@ -403,29 +424,7 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
'equipmentId': createdEquipment.id,
|
||||
});
|
||||
|
||||
// 2. 입고 처리 (warehouse location ID 필요)
|
||||
int? warehouseLocationId;
|
||||
if (warehouseLocation != null) {
|
||||
// 저장된 매핑에서 ID 가져오기
|
||||
warehouseLocationId = warehouseLocationMap[warehouseLocation];
|
||||
|
||||
if (warehouseLocationId == null) {
|
||||
DebugLogger.logError('창고 위치 ID를 찾을 수 없음', error: 'Warehouse: $warehouseLocation');
|
||||
}
|
||||
}
|
||||
|
||||
DebugLogger.log('입고 처리 시작', tag: 'EQUIPMENT_IN', data: {
|
||||
'equipmentId': createdEquipment.id,
|
||||
'quantity': quantity,
|
||||
'warehouseLocationId': warehouseLocationId,
|
||||
});
|
||||
|
||||
await _equipmentService.equipmentIn(
|
||||
equipmentId: createdEquipment.id!,
|
||||
quantity: quantity,
|
||||
warehouseLocationId: warehouseLocationId,
|
||||
notes: remarkController.text.trim(),
|
||||
);
|
||||
// 새로운 API에서는 장비 생성 시 입고 처리까지 한 번에 처리됨
|
||||
|
||||
DebugLogger.log('입고 처리 성공', tag: 'EQUIPMENT_IN');
|
||||
|
||||
@@ -435,15 +434,8 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
// 저장 후 리스트 재로딩 (중복 방지 및 최신화)
|
||||
_loadManufacturers();
|
||||
_loadEquipmentNames();
|
||||
_loadCategories();
|
||||
_loadSubCategories();
|
||||
_loadSubSubCategories();
|
||||
_loadWarehouseLocations();
|
||||
_loadPartnerCompanies();
|
||||
_loadWarrantyLicenses();
|
||||
// 저장 후 드롭다운 데이터 새로고침 (백엔드 데이터 업데이트를 위해)
|
||||
_loadDropdownData();
|
||||
|
||||
return true;
|
||||
} on Failure catch (e) {
|
||||
@@ -456,6 +448,7 @@ class EquipmentInFormController extends ChangeNotifier {
|
||||
return false;
|
||||
} finally {
|
||||
_isSaving = false;
|
||||
_updateCanSave(); // 저장 완료 시 canSave 상태 업데이트
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
|
||||
} else {
|
||||
throw Exception('LookupsService not registered in GetIt');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -67,11 +68,11 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
|
||||
required PaginationParams params,
|
||||
Map<String, dynamic>? additionalFilters,
|
||||
}) async {
|
||||
// API 호출
|
||||
// API 호출 (페이지 크기를 명시적으로 10개로 고정)
|
||||
final apiEquipmentDtos = await ErrorHandler.handleApiCall(
|
||||
() => _equipmentService.getEquipmentsWithStatus(
|
||||
page: params.page,
|
||||
perPage: params.perPage,
|
||||
perPage: 10, // 🎯 장비 리스트는 항상 10개로 고정
|
||||
status: _statusFilter != null ?
|
||||
EquipmentStatusConverter.clientToServer(_statusFilter) : null,
|
||||
search: params.search,
|
||||
@@ -98,7 +99,10 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
|
||||
}
|
||||
|
||||
// DTO를 UnifiedEquipment로 변환
|
||||
print('DEBUG [EquipmentListController] Converting ${apiEquipmentDtos.items.length} DTOs to UnifiedEquipment');
|
||||
final items = apiEquipmentDtos.items.map((dto) {
|
||||
// 🔧 [DEBUG] JOIN된 데이터 로깅
|
||||
print('DEBUG [EquipmentListController] DTO ID: ${dto.id}, companyName: "${dto.companyName}", warehouseName: "${dto.warehouseName}"');
|
||||
final equipment = Equipment(
|
||||
id: dto.id,
|
||||
manufacturer: dto.manufacturer ?? 'Unknown',
|
||||
@@ -113,13 +117,24 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
|
||||
// 간단한 Company 정보 생성 (사용하지 않으므로 제거)
|
||||
// final company = dto.companyName != null ? ... : null;
|
||||
|
||||
return UnifiedEquipment(
|
||||
final unifiedEquipment = UnifiedEquipment(
|
||||
id: dto.id,
|
||||
equipment: equipment,
|
||||
date: dto.createdAt ?? DateTime.now(),
|
||||
status: EquipmentStatusConverter.serverToClient(dto.status),
|
||||
notes: null, // EquipmentListDto에 remark 필드 없음
|
||||
// 🔧 [BUG FIX] 누락된 위치 정보 필드들 추가
|
||||
// 문제: 장비 리스트에서 위치 정보(현재 위치, 창고 위치)가 표시되지 않음
|
||||
// 원인: UnifiedEquipment 생성 시 JOIN된 데이터(companyName, warehouseName) 누락
|
||||
// 해결: EquipmentListDto의 JOIN된 데이터를 UnifiedEquipment 필드로 매핑
|
||||
currentCompany: dto.companyName, // API company_name → currentCompany
|
||||
warehouseLocation: dto.warehouseName, // API warehouse_name → warehouseLocation
|
||||
// currentBranch는 EquipmentListDto에 없으므로 null (백엔드 API 구조 변경으로 지점 개념 제거)
|
||||
currentBranch: null,
|
||||
);
|
||||
// 🔧 [DEBUG] 변환된 UnifiedEquipment 로깅 (필요 시 활성화)
|
||||
// print('DEBUG [EquipmentListController] UnifiedEquipment ID: ${unifiedEquipment.id}, currentCompany: "${unifiedEquipment.currentCompany}", warehouseLocation: "${unifiedEquipment.warehouseLocation}"');
|
||||
return unifiedEquipment;
|
||||
}).toList();
|
||||
|
||||
// API에서 반환한 실제 메타데이터 사용
|
||||
@@ -400,8 +415,8 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 캐시된 장비 카테고리 목록 조회
|
||||
List<CategoryItem> getCachedEquipmentCategories() {
|
||||
/// 캐시된 장비 카테고리 조합 목록 조회
|
||||
List<CategoryCombinationItem> getCachedEquipmentCategories() {
|
||||
final result = _lookupsService.getEquipmentCategories();
|
||||
return result.fold(
|
||||
(failure) => [],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -618,10 +618,8 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
Routes.equipmentInAdd,
|
||||
);
|
||||
if (result == true) {
|
||||
setState(() {
|
||||
_controller.loadData();
|
||||
_controller.goToPage(1);
|
||||
});
|
||||
// 입고 완료 후 데이터 새로고침 (중복 방지)
|
||||
_controller.refresh();
|
||||
}
|
||||
},
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
@@ -693,10 +691,8 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
Routes.equipmentInAdd,
|
||||
);
|
||||
if (result == true) {
|
||||
setState(() {
|
||||
_controller.loadData();
|
||||
_controller.goToPage(1);
|
||||
});
|
||||
// 입고 완료 후 데이터 새로고침 (중복 방지)
|
||||
_controller.refresh();
|
||||
}
|
||||
},
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
@@ -743,7 +739,11 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
totalWidth += 100; // 카테고리
|
||||
totalWidth += 50; // 수량
|
||||
totalWidth += 70; // 상태
|
||||
totalWidth += 80; // 날짜
|
||||
totalWidth += 80; // 입출고일
|
||||
totalWidth += 120; // 입고지
|
||||
totalWidth += 120; // 구매처
|
||||
totalWidth += 100; // 구매일
|
||||
totalWidth += 100; // 구매가격
|
||||
totalWidth += 90; // 관리
|
||||
|
||||
// 상세 컬럼들 (조건부)
|
||||
@@ -751,10 +751,8 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
totalWidth += 120; // 시리얼번호
|
||||
totalWidth += 120; // 바코드
|
||||
totalWidth += 120; // 현재 위치
|
||||
totalWidth += 100; // 창고 위치
|
||||
totalWidth += 100; // 창고 위치 (중복 - 입고지와 다름)
|
||||
totalWidth += 100; // 점검일
|
||||
totalWidth += 100; // 구매일
|
||||
totalWidth += 100; // 구매가격
|
||||
}
|
||||
|
||||
// padding 추가 (좌우 각 16px)
|
||||
@@ -853,15 +851,21 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
_buildHeaderCell('수량', flex: 1, useExpanded: useExpanded, minWidth: 50),
|
||||
// 상태
|
||||
_buildHeaderCell('상태', flex: 2, useExpanded: useExpanded, minWidth: 70),
|
||||
// 날짜
|
||||
_buildHeaderCell('날짜', flex: 2, useExpanded: useExpanded, minWidth: 80),
|
||||
// 입출고일
|
||||
_buildHeaderCell('입출고일', flex: 2, useExpanded: useExpanded, minWidth: 80),
|
||||
// 입고지
|
||||
_buildHeaderCell('입고지', flex: 3, useExpanded: useExpanded, minWidth: 120),
|
||||
// 구매처
|
||||
_buildHeaderCell('구매처', flex: 3, useExpanded: useExpanded, minWidth: 120),
|
||||
// 구매일
|
||||
_buildHeaderCell('구매일', flex: 2, useExpanded: useExpanded, minWidth: 100),
|
||||
// 구매가격
|
||||
_buildHeaderCell('구매가격', flex: 2, useExpanded: useExpanded, minWidth: 100),
|
||||
// 상세 정보 (조건부)
|
||||
if (_showDetailedColumns) ...[
|
||||
_buildHeaderCell('현재 위치', flex: 3, useExpanded: useExpanded, minWidth: 120),
|
||||
_buildHeaderCell('창고 위치', flex: 2, useExpanded: useExpanded, minWidth: 100),
|
||||
_buildHeaderCell('점검일', flex: 2, useExpanded: useExpanded, minWidth: 100),
|
||||
_buildHeaderCell('구매일', flex: 2, useExpanded: useExpanded, minWidth: 100),
|
||||
_buildHeaderCell('구매가격', flex: 2, useExpanded: useExpanded, minWidth: 100),
|
||||
],
|
||||
// 관리
|
||||
_buildHeaderCell('관리', flex: 2, useExpanded: useExpanded, minWidth: 90),
|
||||
@@ -975,13 +979,57 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 70,
|
||||
),
|
||||
// 날짜
|
||||
// 입출고일
|
||||
_buildDataCell(
|
||||
_buildDateWidget(equipment),
|
||||
_buildCreatedDateWidget(equipment),
|
||||
flex: 2,
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 80,
|
||||
),
|
||||
// 입고지
|
||||
_buildDataCell(
|
||||
Text(
|
||||
equipment.warehouseLocation ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 3,
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 120,
|
||||
),
|
||||
// 구매처 (회사명)
|
||||
_buildDataCell(
|
||||
Text(
|
||||
equipment.currentCompany ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 3,
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 120,
|
||||
),
|
||||
// 구매일
|
||||
_buildDataCell(
|
||||
Text(
|
||||
equipment.equipment.purchaseDate != null
|
||||
? '${equipment.equipment.purchaseDate!.year}/${equipment.equipment.purchaseDate!.month.toString().padLeft(2, '0')}/${equipment.equipment.purchaseDate!.day.toString().padLeft(2, '0')}'
|
||||
: '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 100,
|
||||
),
|
||||
// 구매가격
|
||||
_buildDataCell(
|
||||
Text(
|
||||
equipment.equipment.purchasePrice != null
|
||||
? '₩${equipment.equipment.purchasePrice!.toStringAsFixed(0).replaceAllMapped(RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'), (Match m) => '${m[1]},')}'
|
||||
: '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 100,
|
||||
),
|
||||
// 상세 정보 (조건부)
|
||||
if (_showDetailedColumns) ...[
|
||||
// 현재 위치 (회사 + 지점)
|
||||
@@ -1011,30 +1059,6 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 100,
|
||||
),
|
||||
// 구매일
|
||||
_buildDataCell(
|
||||
Text(
|
||||
equipment.equipment.inDate != null
|
||||
? '${equipment.equipment.inDate!.year}/${equipment.equipment.inDate!.month.toString().padLeft(2, '0')}/${equipment.equipment.inDate!.day.toString().padLeft(2, '0')}'
|
||||
: '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 100,
|
||||
),
|
||||
// 구매가격
|
||||
_buildDataCell(
|
||||
Text(
|
||||
equipment.equipment.purchasePrice != null
|
||||
? '₩${equipment.equipment.purchasePrice!.toStringAsFixed(0).replaceAllMapped(RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'), (Match m) => '${m[1]},')}'
|
||||
: '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: useExpanded,
|
||||
minWidth: 100,
|
||||
),
|
||||
],
|
||||
// 관리
|
||||
_buildDataCell(
|
||||
@@ -1159,8 +1183,8 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 날짜 위젯 빌더
|
||||
Widget _buildDateWidget(UnifiedEquipment equipment) {
|
||||
/// 입출고일 위젯 빌더
|
||||
Widget _buildCreatedDateWidget(UnifiedEquipment equipment) {
|
||||
String dateStr = equipment.date.toString().substring(0, 10);
|
||||
return Text(
|
||||
dateStr,
|
||||
@@ -1288,23 +1312,63 @@ class _EquipmentListState extends State<EquipmentList> {
|
||||
return '${category.substring(0, 2)}...';
|
||||
}
|
||||
|
||||
/// 카테고리 툴팁 위젯
|
||||
/// 영어 카테고리를 한국어로 변환
|
||||
String _translateCategory(String category) {
|
||||
const Map<String, String> categoryMap = {
|
||||
// 대분류
|
||||
'Network': '네트워크',
|
||||
'Server': '서버',
|
||||
'Storage': '스토리지',
|
||||
'Security': '보안',
|
||||
'Computer': '컴퓨터',
|
||||
'Mobile': '모바일',
|
||||
'Printer': '프린터',
|
||||
'Monitor': '모니터',
|
||||
'Peripheral': '주변기기',
|
||||
// 중분류
|
||||
'Router': '라우터',
|
||||
'Switch': '스위치',
|
||||
'Firewall': '방화벽',
|
||||
'Laptop': '노트북',
|
||||
'Desktop': '데스크톱',
|
||||
'Tablet': '태블릿',
|
||||
'Smartphone': '스마트폰',
|
||||
'Scanner': '스캐너',
|
||||
'Keyboard': '키보드',
|
||||
'Mouse': '마우스',
|
||||
// 소분류 예시
|
||||
'Wireless': '무선',
|
||||
'Wired': '유선',
|
||||
'Gaming': '게이밍',
|
||||
'Office': '사무용',
|
||||
};
|
||||
|
||||
return categoryMap[category] ?? category;
|
||||
}
|
||||
|
||||
/// 카테고리 툴팁 위젯 (한국어 변환 적용)
|
||||
Widget _buildCategoryWithTooltip(UnifiedEquipment equipment) {
|
||||
// 영어→한국어 변환 적용
|
||||
final translatedCategory = _translateCategory(equipment.equipment.category);
|
||||
final translatedSubCategory = _translateCategory(equipment.equipment.subCategory);
|
||||
final translatedSubSubCategory = _translateCategory(equipment.equipment.subSubCategory);
|
||||
|
||||
final fullCategory = EquipmentDisplayHelper.formatCategory(
|
||||
equipment.equipment.category,
|
||||
equipment.equipment.subCategory,
|
||||
equipment.equipment.subSubCategory,
|
||||
translatedCategory,
|
||||
translatedSubCategory,
|
||||
translatedSubSubCategory,
|
||||
);
|
||||
|
||||
// 축약 표기 적용 - 비어있지 않은 카테고리만 표시
|
||||
final List<String> parts = [];
|
||||
if (equipment.equipment.category.isNotEmpty) {
|
||||
parts.add(_shortenCategory(equipment.equipment.category));
|
||||
if (translatedCategory.isNotEmpty) {
|
||||
parts.add(_shortenCategory(translatedCategory));
|
||||
}
|
||||
if (equipment.equipment.subCategory.isNotEmpty) {
|
||||
parts.add(_shortenCategory(equipment.equipment.subCategory));
|
||||
if (translatedSubCategory.isNotEmpty) {
|
||||
parts.add(_shortenCategory(translatedSubCategory));
|
||||
}
|
||||
if (equipment.equipment.subSubCategory.isNotEmpty) {
|
||||
parts.add(_shortenCategory(equipment.equipment.subSubCategory));
|
||||
if (translatedSubSubCategory.isNotEmpty) {
|
||||
parts.add(_shortenCategory(translatedSubSubCategory));
|
||||
}
|
||||
final shortCategory = parts.join(' > ');
|
||||
|
||||
|
||||
@@ -130,7 +130,12 @@ class EquipmentService {
|
||||
Future<Equipment> createEquipment(Equipment equipment) async {
|
||||
try {
|
||||
final request = CreateEquipmentRequest(
|
||||
equipmentNumber: 'EQ-${DateTime.now().millisecondsSinceEpoch}', // 자동 생성 번호
|
||||
// 🔧 [BUG FIX] 사용자가 입력한 장비 번호를 우선 사용, 없으면 자동 생성
|
||||
// 기존: 항상 타임스탬프 기반 자동 생성으로 사용자 입력 무시
|
||||
// 수정: equipment.equipmentNumber가 있으면 우선 사용, null/empty면 자동 생성
|
||||
equipmentNumber: equipment.equipmentNumber?.isNotEmpty == true
|
||||
? equipment.equipmentNumber! // 사용자 입력값 사용
|
||||
: 'EQ-${DateTime.now().millisecondsSinceEpoch}', // 자동 생성 fallback
|
||||
category1: equipment.category,
|
||||
category2: equipment.subCategory,
|
||||
category3: equipment.subSubCategory,
|
||||
@@ -140,7 +145,11 @@ class EquipmentService {
|
||||
barcode: equipment.barcode,
|
||||
purchaseDate: equipment.inDate,
|
||||
purchasePrice: equipment.purchasePrice,
|
||||
companyId: equipment.currentCompanyId,
|
||||
// 🔧 [BUG FIX] currentCompanyId → companyId 필드 수정
|
||||
// 문제: Controller에서 selectedCompanyId를 equipment.companyId로 설정하는데
|
||||
// EquipmentService에서 equipment.currentCompanyId를 참조해서 null 전송
|
||||
// 해결: equipment.companyId 참조로 변경하여 실제 선택값 전송
|
||||
companyId: equipment.companyId,
|
||||
warehouseLocationId: equipment.warehouseLocationId,
|
||||
lastInspectionDate: equipment.lastInspectionDate,
|
||||
nextInspectionDate: equipment.nextInspectionDate,
|
||||
@@ -196,14 +205,14 @@ class EquipmentService {
|
||||
modelName: equipment.name.isNotEmpty ? equipment.name : null, // 실제 장비명
|
||||
serialNumber: equipment.serialNumber?.isNotEmpty == true ? equipment.serialNumber : null,
|
||||
barcode: equipment.barcode?.isNotEmpty == true ? equipment.barcode : null,
|
||||
purchaseDate: equipment.inDate,
|
||||
purchaseDate: equipment.purchaseDate,
|
||||
purchasePrice: equipment.purchasePrice,
|
||||
status: (equipment.equipmentStatus != null &&
|
||||
equipment.equipmentStatus != 'null' &&
|
||||
equipment.equipmentStatus!.isNotEmpty)
|
||||
? EquipmentStatusConverter.clientToServer(equipment.equipmentStatus)
|
||||
: null,
|
||||
companyId: equipment.currentCompanyId,
|
||||
companyId: equipment.companyId,
|
||||
warehouseLocationId: equipment.warehouseLocationId,
|
||||
lastInspectionDate: equipment.lastInspectionDate,
|
||||
nextInspectionDate: equipment.nextInspectionDate,
|
||||
@@ -369,12 +378,7 @@ class EquipmentService {
|
||||
}
|
||||
|
||||
Equipment _convertResponseToEquipment(EquipmentResponse response) {
|
||||
print('DEBUG [_convertResponseToEquipment] Converting response to Equipment');
|
||||
print('DEBUG [_convertResponseToEquipment] response.manufacturer="${response.manufacturer}"');
|
||||
print('DEBUG [_convertResponseToEquipment] response.modelName="${response.modelName}"');
|
||||
print('DEBUG [_convertResponseToEquipment] response.category1="${response.category1}"');
|
||||
|
||||
final equipment = Equipment(
|
||||
return Equipment(
|
||||
id: response.id,
|
||||
manufacturer: response.manufacturer,
|
||||
name: response.modelName ?? '', // modelName이 실제 장비명
|
||||
@@ -386,21 +390,22 @@ class EquipmentService {
|
||||
quantity: 1, // Default quantity, actual quantity should be tracked in history
|
||||
inDate: response.purchaseDate,
|
||||
remark: response.remark,
|
||||
// 백엔드 API 새로운 필드들 매핑
|
||||
// 백엔드 API 새로운 필드들 매핑 - 백엔드 완전 호환
|
||||
purchasePrice: response.purchasePrice != null ? double.tryParse(response.purchasePrice!) : null,
|
||||
currentCompanyId: response.companyId,
|
||||
warehouseLocationId: response.warehouseLocationId,
|
||||
companyId: response.companyId,
|
||||
lastInspectionDate: response.lastInspectionDate,
|
||||
nextInspectionDate: response.nextInspectionDate,
|
||||
equipmentStatus: response.status,
|
||||
// Warranty information would need to be fetched from license API if available
|
||||
// 백엔드 API 완전 호환 필드들
|
||||
equipmentNumber: response.equipmentNumber,
|
||||
modelName: response.modelName,
|
||||
category1: response.category1,
|
||||
category2: response.category2,
|
||||
category3: response.category3,
|
||||
purchaseDate: response.purchaseDate,
|
||||
);
|
||||
|
||||
print('DEBUG [_convertResponseToEquipment] Equipment created');
|
||||
print('DEBUG [_convertResponseToEquipment] equipment.manufacturer="${equipment.manufacturer}"');
|
||||
print('DEBUG [_convertResponseToEquipment] equipment.name="${equipment.name}"');
|
||||
|
||||
return equipment;
|
||||
}
|
||||
|
||||
// 장비 상태 상수
|
||||
|
||||
64
lib/utils/currency_formatter.dart
Normal file
64
lib/utils/currency_formatter.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// KRW 통화 포맷팅 관련 유틸리티
|
||||
class CurrencyFormatter {
|
||||
static final NumberFormat _formatter = NumberFormat('#,###', 'ko_KR');
|
||||
|
||||
/// 숫자를 KRW 통화 형식으로 포맷팅 (₩2,000,000)
|
||||
static String formatKRW(double? value) {
|
||||
if (value == null || value == 0) return '';
|
||||
return '₩${_formatter.format(value.toInt())}';
|
||||
}
|
||||
|
||||
/// 통화 포맷팅된 문자열에서 숫자만 추출
|
||||
static double? parseKRW(String? text) {
|
||||
if (text == null || text.isEmpty) return null;
|
||||
|
||||
// ₩, 쉼표 제거하고 숫자만 추출
|
||||
final cleanText = text.replaceAll(RegExp(r'[₩,]'), '');
|
||||
return double.tryParse(cleanText);
|
||||
}
|
||||
}
|
||||
|
||||
/// KRW 통화 입력을 위한 TextInputFormatter
|
||||
class KRWTextInputFormatter extends TextInputFormatter {
|
||||
@override
|
||||
TextEditingValue formatEditUpdate(
|
||||
TextEditingValue oldValue,
|
||||
TextEditingValue newValue,
|
||||
) {
|
||||
// 빈 문자열인 경우 그대로 반환
|
||||
if (newValue.text.isEmpty) {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
// 숫자만 추출
|
||||
final numericText = newValue.text.replaceAll(RegExp(r'[^\d]'), '');
|
||||
|
||||
// 숫자가 없으면 빈 문자열
|
||||
if (numericText.isEmpty) {
|
||||
return const TextEditingValue(
|
||||
text: '',
|
||||
selection: TextSelection.collapsed(offset: 0),
|
||||
);
|
||||
}
|
||||
|
||||
// 숫자 파싱 및 포맷팅
|
||||
final numericValue = double.tryParse(numericText);
|
||||
if (numericValue == null) {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
// KRW 포맷팅 적용
|
||||
final formattedText = CurrencyFormatter.formatKRW(numericValue);
|
||||
|
||||
// 커서 위치 계산 (맨 끝으로)
|
||||
final selectionOffset = formattedText.length;
|
||||
|
||||
return TextEditingValue(
|
||||
text: formattedText,
|
||||
selection: TextSelection.collapsed(offset: selectionOffset),
|
||||
);
|
||||
}
|
||||
}
|
||||
23
test/utils/currency_formatter_test.dart
Normal file
23
test/utils/currency_formatter_test.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:superport/utils/currency_formatter.dart';
|
||||
|
||||
void main() {
|
||||
group('CurrencyFormatter Tests', () {
|
||||
test('formatKRW should format number with Korean won symbol and commas', () {
|
||||
expect(CurrencyFormatter.formatKRW(2000000), '₩2,000,000');
|
||||
expect(CurrencyFormatter.formatKRW(1000), '₩1,000');
|
||||
expect(CurrencyFormatter.formatKRW(100), '₩100');
|
||||
expect(CurrencyFormatter.formatKRW(0), '');
|
||||
expect(CurrencyFormatter.formatKRW(null), '');
|
||||
});
|
||||
|
||||
test('parseKRW should extract numeric value from formatted string', () {
|
||||
expect(CurrencyFormatter.parseKRW('₩2,000,000'), 2000000);
|
||||
expect(CurrencyFormatter.parseKRW('₩1,000'), 1000);
|
||||
expect(CurrencyFormatter.parseKRW('₩100'), 100);
|
||||
expect(CurrencyFormatter.parseKRW('2000000'), 2000000);
|
||||
expect(CurrencyFormatter.parseKRW(''), null);
|
||||
expect(CurrencyFormatter.parseKRW(null), null);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user