backup: 사용하지 않는 파일 삭제 전 복구 지점
- 전체 371개 파일 중 82개 미사용 파일 식별 - Phase 1: 33개 파일 삭제 예정 (100% 안전) - Phase 2: 30개 파일 삭제 검토 예정 - Phase 3: 19개 파일 수동 검토 예정 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,9 @@ import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import '../../screens/equipment/controllers/equipment_history_controller.dart';
|
||||
import '../../screens/equipment/controllers/equipment_list_controller.dart';
|
||||
import '../../data/models/equipment_history_dto.dart';
|
||||
import '../../data/models/warehouse/warehouse_dto.dart';
|
||||
import '../../services/warehouse_service.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
|
||||
class StockInForm extends StatefulWidget {
|
||||
const StockInForm({super.key});
|
||||
@@ -14,6 +17,7 @@ class StockInForm extends StatefulWidget {
|
||||
|
||||
class _StockInFormState extends State<StockInForm> {
|
||||
final _formKey = GlobalKey<ShadFormState>();
|
||||
final _warehouseService = GetIt.instance<WarehouseService>();
|
||||
|
||||
int? _selectedEquipmentId;
|
||||
int? _selectedWarehouseId;
|
||||
@@ -21,15 +25,53 @@ class _StockInFormState extends State<StockInForm> {
|
||||
DateTime _transactionDate = DateTime.now();
|
||||
String? _notes;
|
||||
|
||||
// 창고 관련 상태
|
||||
List<WarehouseDto> _warehouses = [];
|
||||
bool _isLoadingWarehouses = false;
|
||||
String? _warehouseError;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 장비 목록 로드
|
||||
context.read<EquipmentListController>().refresh();
|
||||
// 창고 목록 로드
|
||||
_loadWarehouses();
|
||||
});
|
||||
}
|
||||
|
||||
/// 사용 중인 창고 목록 로드
|
||||
Future<void> _loadWarehouses() async {
|
||||
setState(() {
|
||||
_isLoadingWarehouses = true;
|
||||
_warehouseError = null;
|
||||
});
|
||||
|
||||
try {
|
||||
final warehouses = await _warehouseService.getInUseWarehouseLocations();
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
// WarehouseLocation을 WarehouseDto로 변환 (임시 - 추후 DTO 직접 사용 메서드 추가 예정)
|
||||
_warehouses = warehouses.map((location) => WarehouseDto(
|
||||
id: location.id,
|
||||
name: location.name,
|
||||
remark: location.remark,
|
||||
isDeleted: !location.isActive,
|
||||
)).toList();
|
||||
_isLoadingWarehouses = false;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_warehouseError = '창고 목록을 불러오는데 실패했습니다: ${e.toString()}';
|
||||
_isLoadingWarehouses = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleSubmit() async {
|
||||
if (_formKey.currentState?.saveAndValidate() ?? false) {
|
||||
final controller = context.read<EquipmentHistoryController>();
|
||||
@@ -130,31 +172,80 @@ class _StockInFormState extends State<StockInForm> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 창고 선택
|
||||
ShadSelect<int>(
|
||||
placeholder: const Text('창고 선택'),
|
||||
options: [
|
||||
const ShadOption(value: 1, child: Text('본사 창고')),
|
||||
const ShadOption(value: 2, child: Text('지사 창고')),
|
||||
const ShadOption(value: 3, child: Text('외부 창고')),
|
||||
// 창고 선택 (백엔드 API 연동)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('창고', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
|
||||
const SizedBox(height: 8),
|
||||
if (_isLoadingWarehouses)
|
||||
Container(
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text('창고 목록 로딩 중...', style: TextStyle(fontSize: 14)),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (_warehouseError != null)
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.red.shade300),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
_warehouseError!,
|
||||
style: TextStyle(color: Colors.red.shade600, fontSize: 14),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ShadButton.outline(
|
||||
onPressed: _loadWarehouses,
|
||||
child: const Text('재시도'),
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
ShadSelect<int>(
|
||||
placeholder: const Text('창고 선택'),
|
||||
options: _warehouses.map((warehouse) {
|
||||
return ShadOption(
|
||||
value: warehouse.id!,
|
||||
child: Text(warehouse.name),
|
||||
);
|
||||
}).toList(),
|
||||
selectedOptionBuilder: (context, value) {
|
||||
final warehouse = _warehouses.firstWhere(
|
||||
(w) => w.id == value,
|
||||
orElse: () => WarehouseDto(name: 'Unknown'),
|
||||
);
|
||||
return Text(warehouse.name);
|
||||
},
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedWarehouseId = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
selectedOptionBuilder: (context, value) {
|
||||
switch (value) {
|
||||
case 1:
|
||||
return const Text('본사 창고');
|
||||
case 2:
|
||||
return const Text('지사 창고');
|
||||
case 3:
|
||||
return const Text('외부 창고');
|
||||
default:
|
||||
return const Text('');
|
||||
}
|
||||
},
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_selectedWarehouseId = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
@@ -201,43 +292,6 @@ class _StockInFormState extends State<StockInForm> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 상태
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('상태', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
|
||||
const SizedBox(height: 8),
|
||||
ShadSelect<String>(
|
||||
placeholder: const Text('상태 선택'),
|
||||
initialValue: 'available',
|
||||
options: const [
|
||||
ShadOption(value: 'available', child: Text('사용 가능')),
|
||||
ShadOption(value: 'in_use', child: Text('사용 중')),
|
||||
ShadOption(value: 'maintenance', child: Text('정비 중')),
|
||||
ShadOption(value: 'reserved', child: Text('예약됨')),
|
||||
],
|
||||
selectedOptionBuilder: (context, value) {
|
||||
switch (value) {
|
||||
case 'available':
|
||||
return const Text('사용 가능');
|
||||
case 'in_use':
|
||||
return const Text('사용 중');
|
||||
case 'maintenance':
|
||||
return const Text('정비 중');
|
||||
case 'reserved':
|
||||
return const Text('예약됨');
|
||||
default:
|
||||
return const Text('');
|
||||
}
|
||||
},
|
||||
onChanged: (value) {
|
||||
// 상태 변경 시 필요한 로직이 있다면 여기에 추가
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 비고
|
||||
ShadInputFormField(
|
||||
label: const Text('비고'),
|
||||
|
||||
Reference in New Issue
Block a user