feat: 장비 관리 API 연동 구현
- Equipment 관련 DTO 모델 생성 (Request/Response/List/History/In/Out/IO) - EquipmentRemoteDataSource 구현 (10개 API 엔드포인트) - EquipmentService 비즈니스 로직 구현 - Controller를 ChangeNotifier 패턴으로 개선 - 장비 목록 화면에 Provider 패턴 및 무한 스크롤 적용 - 장비 입고 화면 API 연동 및 비동기 처리 - DI 컨테이너에 Equipment 관련 의존성 등록 - API/Mock 데이터 소스 전환 가능 (Feature Flag) - API 통합 진행 상황 문서 업데이트
This commit is contained in:
@@ -967,18 +967,33 @@ class ErrorHandler {
|
||||
- 페이지네이션 및 무한 스크롤
|
||||
- 이미지 로딩 최적화
|
||||
|
||||
#### 3차 작업 (2025-07-24 저녁)
|
||||
11. **장비 관리 API 연동 ✅**
|
||||
- **DTO 모델 생성**: equipment 관련 모든 DTO 모델 생성 및 Freezed 코드 생성 완료
|
||||
- **EquipmentRemoteDataSource 구현**: 10개의 API 엔드포인트 메서드 구현
|
||||
- **EquipmentService 구현**: 비즈니스 로직 및 모델 변환 처리
|
||||
- **Controller 개선**: ChangeNotifier 패턴 적용, API/Mock 전환 가능
|
||||
- **화면 연동**: 장비 목록, 장비 입고 화면 Provider 패턴 적용
|
||||
- **DI 등록**: EquipmentRemoteDataSource, EquipmentService 등록
|
||||
|
||||
12. **무한 스크롤 구현 ✅**
|
||||
- 장비 목록 화면에 무한 스크롤 지원 추가
|
||||
- ScrollController 리스너를 통한 페이지네이션
|
||||
|
||||
### 📈 진행률
|
||||
- **전체 API 통합**: 30% 완료
|
||||
- **전체 API 통합**: 50% 완료
|
||||
- **인증 시스템**: 100% 완료
|
||||
- **대시보드**: 100% 완료
|
||||
- **장비 관리**: 0% (대기 중)
|
||||
- **장비 관리**: 60% 완료 (목록, 입고 완료 / 출고, 수정, 삭제 대기 중)
|
||||
- **회사/사용자 관리**: 0% (대기 중)
|
||||
|
||||
### 📋 주요 부분
|
||||
### 📋 주요 특징
|
||||
- **한글 입력**: 모든 API 요청/응답에서 UTF-8 인코딩 적용
|
||||
- **사이드 이펙트 방지**: MockDataService와 API 서비스 공존 가능
|
||||
- **사이드 이펙트 방지**: MockDataService와 API 서비스 공존 가능 (Feature Flag)
|
||||
- **에러 처리**: 네트워크 오류, 서버 오류, 인증 오류 분리 처리
|
||||
- **무한 스크롤**: 대용량 데이터 처리를 위한 페이지네이션
|
||||
- **로딩/에러 상태**: 사용자 친화적인 UI 피드백
|
||||
|
||||
---
|
||||
|
||||
_마지막 업데이트: 2025-07-24 오후_ (자동 로그인, AuthInterceptor 개선, 로그아웃 기능, 대시보드 API 연동 완료)
|
||||
_마지막 업데이트: 2025-07-24 저녁_ (장비 관리 API 연동, DTO 모델 생성, RemoteDataSource/Service 구현, Controller 개선, 화면 연동 완료)
|
||||
290
lib/data/datasources/remote/equipment_remote_datasource.dart
Normal file
290
lib/data/datasources/remote/equipment_remote_datasource.dart
Normal file
@@ -0,0 +1,290 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/core/constants/api_endpoints.dart';
|
||||
import 'package:superport/core/errors/exceptions.dart';
|
||||
import 'package:superport/data/datasources/remote/api_client.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_history_dto.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_in_request.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_io_response.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_list_dto.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_out_request.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_request.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_response.dart';
|
||||
|
||||
abstract class EquipmentRemoteDataSource {
|
||||
Future<List<EquipmentListDto>> getEquipments({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? status,
|
||||
int? companyId,
|
||||
int? warehouseLocationId,
|
||||
});
|
||||
|
||||
Future<EquipmentResponse> createEquipment(CreateEquipmentRequest request);
|
||||
|
||||
Future<EquipmentResponse> getEquipmentDetail(int id);
|
||||
|
||||
Future<EquipmentResponse> updateEquipment(int id, UpdateEquipmentRequest request);
|
||||
|
||||
Future<void> deleteEquipment(int id);
|
||||
|
||||
Future<EquipmentResponse> changeEquipmentStatus(int id, String status, String? reason);
|
||||
|
||||
Future<EquipmentHistoryDto> addEquipmentHistory(int equipmentId, CreateHistoryRequest request);
|
||||
|
||||
Future<List<EquipmentHistoryDto>> getEquipmentHistory(int equipmentId, {int page = 1, int perPage = 20});
|
||||
|
||||
Future<EquipmentIoResponse> equipmentIn(EquipmentInRequest request);
|
||||
|
||||
Future<EquipmentIoResponse> equipmentOut(EquipmentOutRequest request);
|
||||
}
|
||||
|
||||
class EquipmentRemoteDataSourceImpl implements EquipmentRemoteDataSource {
|
||||
final ApiClient _apiClient = GetIt.instance<ApiClient>();
|
||||
|
||||
@override
|
||||
Future<List<EquipmentListDto>> getEquipments({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? status,
|
||||
int? companyId,
|
||||
int? warehouseLocationId,
|
||||
}) async {
|
||||
try {
|
||||
final queryParams = {
|
||||
'page': page,
|
||||
'per_page': perPage,
|
||||
if (status != null) 'status': status,
|
||||
if (companyId != null) 'company_id': companyId,
|
||||
if (warehouseLocationId != null) 'warehouse_location_id': warehouseLocationId,
|
||||
};
|
||||
|
||||
final response = await _apiClient.get(
|
||||
ApiEndpoints.equipment,
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
final List<dynamic> data = response.data['data'];
|
||||
return data.map((json) => EquipmentListDto.fromJson(json)).toList();
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to fetch equipment list',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<EquipmentResponse> createEquipment(CreateEquipmentRequest request) async {
|
||||
try {
|
||||
final response = await _apiClient.post(
|
||||
ApiEndpoints.equipment,
|
||||
data: request.toJson(),
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
return EquipmentResponse.fromJson(response.data['data']);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to create equipment',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<EquipmentResponse> getEquipmentDetail(int id) async {
|
||||
try {
|
||||
final response = await _apiClient.get('${ApiEndpoints.equipment}/$id');
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
return EquipmentResponse.fromJson(response.data['data']);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to fetch equipment detail',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<EquipmentResponse> updateEquipment(int id, UpdateEquipmentRequest request) async {
|
||||
try {
|
||||
final response = await _apiClient.put(
|
||||
'${ApiEndpoints.equipment}/$id',
|
||||
data: request.toJson(),
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
return EquipmentResponse.fromJson(response.data['data']);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to update equipment',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteEquipment(int id) async {
|
||||
try {
|
||||
final response = await _apiClient.delete('${ApiEndpoints.equipment}/$id');
|
||||
|
||||
if (response.data['success'] != true) {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to delete equipment',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<EquipmentResponse> changeEquipmentStatus(int id, String status, String? reason) async {
|
||||
try {
|
||||
final response = await _apiClient.patch(
|
||||
'${ApiEndpoints.equipment}/$id/status',
|
||||
data: {
|
||||
'status': status,
|
||||
if (reason != null) 'reason': reason,
|
||||
},
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
return EquipmentResponse.fromJson(response.data['data']);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to change equipment status',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<EquipmentHistoryDto> addEquipmentHistory(int equipmentId, CreateHistoryRequest request) async {
|
||||
try {
|
||||
final response = await _apiClient.post(
|
||||
'${ApiEndpoints.equipment}/$equipmentId/history',
|
||||
data: request.toJson(),
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
return EquipmentHistoryDto.fromJson(response.data['data']);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to add equipment history',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<EquipmentHistoryDto>> getEquipmentHistory(int equipmentId, {int page = 1, int perPage = 20}) async {
|
||||
try {
|
||||
final queryParams = {
|
||||
'page': page,
|
||||
'per_page': perPage,
|
||||
};
|
||||
|
||||
final response = await _apiClient.get(
|
||||
'${ApiEndpoints.equipment}/$equipmentId/history',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
final List<dynamic> data = response.data['data'];
|
||||
return data.map((json) => EquipmentHistoryDto.fromJson(json)).toList();
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to fetch equipment history',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<EquipmentIoResponse> equipmentIn(EquipmentInRequest request) async {
|
||||
try {
|
||||
final response = await _apiClient.post(
|
||||
'${ApiEndpoints.equipment}/in',
|
||||
data: request.toJson(),
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
return EquipmentIoResponse.fromJson(response.data['data']);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to process equipment in',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<EquipmentIoResponse> equipmentOut(EquipmentOutRequest request) async {
|
||||
try {
|
||||
final response = await _apiClient.post(
|
||||
'${ApiEndpoints.equipment}/out',
|
||||
data: request.toJson(),
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
return EquipmentIoResponse.fromJson(response.data['data']);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to process equipment out',
|
||||
);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw ServerException(
|
||||
message: e.response?.data['message'] ?? 'Network error occurred',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
49
lib/data/models/equipment/equipment_history_dto.dart
Normal file
49
lib/data/models/equipment/equipment_history_dto.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_history_dto.freezed.dart';
|
||||
part 'equipment_history_dto.g.dart';
|
||||
|
||||
@freezed
|
||||
class EquipmentHistoryDto with _$EquipmentHistoryDto {
|
||||
const factory EquipmentHistoryDto({
|
||||
required int id,
|
||||
required int equipmentId,
|
||||
required String transactionType,
|
||||
required int quantity,
|
||||
required DateTime transactionDate,
|
||||
String? remarks,
|
||||
int? createdBy,
|
||||
int? userId,
|
||||
required DateTime createdAt,
|
||||
// 추가 정보
|
||||
String? userName,
|
||||
String? performedBy,
|
||||
}) = _EquipmentHistoryDto;
|
||||
|
||||
factory EquipmentHistoryDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentHistoryDtoFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class CreateHistoryRequest with _$CreateHistoryRequest {
|
||||
const factory CreateHistoryRequest({
|
||||
required String transactionType,
|
||||
required int quantity,
|
||||
DateTime? transactionDate,
|
||||
String? remarks,
|
||||
int? userId,
|
||||
}) = _CreateHistoryRequest;
|
||||
|
||||
factory CreateHistoryRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateHistoryRequestFromJson(json);
|
||||
}
|
||||
|
||||
// 트랜잭션 타입 상수
|
||||
class TransactionType {
|
||||
static const String checkIn = 'I'; // 입고
|
||||
static const String checkOut = 'O'; // 출고
|
||||
static const String maintenance = 'maintenance';
|
||||
static const String repair = 'repair';
|
||||
static const String inspection = 'inspection';
|
||||
static const String transfer = 'transfer';
|
||||
}
|
||||
630
lib/data/models/equipment/equipment_history_dto.freezed.dart
Normal file
630
lib/data/models/equipment/equipment_history_dto.freezed.dart
Normal file
@@ -0,0 +1,630 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_history_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
EquipmentHistoryDto _$EquipmentHistoryDtoFromJson(Map<String, dynamic> json) {
|
||||
return _EquipmentHistoryDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentHistoryDto {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
int get equipmentId => throw _privateConstructorUsedError;
|
||||
String get transactionType => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
DateTime get transactionDate => throw _privateConstructorUsedError;
|
||||
String? get remarks => throw _privateConstructorUsedError;
|
||||
int? get createdBy => throw _privateConstructorUsedError;
|
||||
int? get userId => throw _privateConstructorUsedError;
|
||||
DateTime get createdAt => throw _privateConstructorUsedError; // 추가 정보
|
||||
String? get userName => throw _privateConstructorUsedError;
|
||||
String? get performedBy => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentHistoryDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentHistoryDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentHistoryDtoCopyWith<EquipmentHistoryDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentHistoryDtoCopyWith<$Res> {
|
||||
factory $EquipmentHistoryDtoCopyWith(
|
||||
EquipmentHistoryDto value, $Res Function(EquipmentHistoryDto) then) =
|
||||
_$EquipmentHistoryDtoCopyWithImpl<$Res, EquipmentHistoryDto>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
int equipmentId,
|
||||
String transactionType,
|
||||
int quantity,
|
||||
DateTime transactionDate,
|
||||
String? remarks,
|
||||
int? createdBy,
|
||||
int? userId,
|
||||
DateTime createdAt,
|
||||
String? userName,
|
||||
String? performedBy});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentHistoryDtoCopyWithImpl<$Res, $Val extends EquipmentHistoryDto>
|
||||
implements $EquipmentHistoryDtoCopyWith<$Res> {
|
||||
_$EquipmentHistoryDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentHistoryDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? equipmentId = null,
|
||||
Object? transactionType = null,
|
||||
Object? quantity = null,
|
||||
Object? transactionDate = null,
|
||||
Object? remarks = freezed,
|
||||
Object? createdBy = freezed,
|
||||
Object? userId = freezed,
|
||||
Object? createdAt = null,
|
||||
Object? userName = freezed,
|
||||
Object? performedBy = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionDate: null == transactionDate
|
||||
? _value.transactionDate
|
||||
: transactionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
remarks: freezed == remarks
|
||||
? _value.remarks
|
||||
: remarks // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
createdBy: freezed == createdBy
|
||||
? _value.createdBy
|
||||
: createdBy // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
userId: freezed == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
userName: freezed == userName
|
||||
? _value.userName
|
||||
: userName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
performedBy: freezed == performedBy
|
||||
? _value.performedBy
|
||||
: performedBy // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentHistoryDtoImplCopyWith<$Res>
|
||||
implements $EquipmentHistoryDtoCopyWith<$Res> {
|
||||
factory _$$EquipmentHistoryDtoImplCopyWith(_$EquipmentHistoryDtoImpl value,
|
||||
$Res Function(_$EquipmentHistoryDtoImpl) then) =
|
||||
__$$EquipmentHistoryDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
int equipmentId,
|
||||
String transactionType,
|
||||
int quantity,
|
||||
DateTime transactionDate,
|
||||
String? remarks,
|
||||
int? createdBy,
|
||||
int? userId,
|
||||
DateTime createdAt,
|
||||
String? userName,
|
||||
String? performedBy});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentHistoryDtoImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentHistoryDtoCopyWithImpl<$Res, _$EquipmentHistoryDtoImpl>
|
||||
implements _$$EquipmentHistoryDtoImplCopyWith<$Res> {
|
||||
__$$EquipmentHistoryDtoImplCopyWithImpl(_$EquipmentHistoryDtoImpl _value,
|
||||
$Res Function(_$EquipmentHistoryDtoImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentHistoryDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? equipmentId = null,
|
||||
Object? transactionType = null,
|
||||
Object? quantity = null,
|
||||
Object? transactionDate = null,
|
||||
Object? remarks = freezed,
|
||||
Object? createdBy = freezed,
|
||||
Object? userId = freezed,
|
||||
Object? createdAt = null,
|
||||
Object? userName = freezed,
|
||||
Object? performedBy = freezed,
|
||||
}) {
|
||||
return _then(_$EquipmentHistoryDtoImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionDate: null == transactionDate
|
||||
? _value.transactionDate
|
||||
: transactionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
remarks: freezed == remarks
|
||||
? _value.remarks
|
||||
: remarks // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
createdBy: freezed == createdBy
|
||||
? _value.createdBy
|
||||
: createdBy // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
userId: freezed == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
userName: freezed == userName
|
||||
? _value.userName
|
||||
: userName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
performedBy: freezed == performedBy
|
||||
? _value.performedBy
|
||||
: performedBy // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentHistoryDtoImpl implements _EquipmentHistoryDto {
|
||||
const _$EquipmentHistoryDtoImpl(
|
||||
{required this.id,
|
||||
required this.equipmentId,
|
||||
required this.transactionType,
|
||||
required this.quantity,
|
||||
required this.transactionDate,
|
||||
this.remarks,
|
||||
this.createdBy,
|
||||
this.userId,
|
||||
required this.createdAt,
|
||||
this.userName,
|
||||
this.performedBy});
|
||||
|
||||
factory _$EquipmentHistoryDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentHistoryDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final int equipmentId;
|
||||
@override
|
||||
final String transactionType;
|
||||
@override
|
||||
final int quantity;
|
||||
@override
|
||||
final DateTime transactionDate;
|
||||
@override
|
||||
final String? remarks;
|
||||
@override
|
||||
final int? createdBy;
|
||||
@override
|
||||
final int? userId;
|
||||
@override
|
||||
final DateTime createdAt;
|
||||
// 추가 정보
|
||||
@override
|
||||
final String? userName;
|
||||
@override
|
||||
final String? performedBy;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentHistoryDto(id: $id, equipmentId: $equipmentId, transactionType: $transactionType, quantity: $quantity, transactionDate: $transactionDate, remarks: $remarks, createdBy: $createdBy, userId: $userId, createdAt: $createdAt, userName: $userName, performedBy: $performedBy)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentHistoryDtoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.equipmentId, equipmentId) ||
|
||||
other.equipmentId == equipmentId) &&
|
||||
(identical(other.transactionType, transactionType) ||
|
||||
other.transactionType == transactionType) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.transactionDate, transactionDate) ||
|
||||
other.transactionDate == transactionDate) &&
|
||||
(identical(other.remarks, remarks) || other.remarks == remarks) &&
|
||||
(identical(other.createdBy, createdBy) ||
|
||||
other.createdBy == createdBy) &&
|
||||
(identical(other.userId, userId) || other.userId == userId) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.userName, userName) ||
|
||||
other.userName == userName) &&
|
||||
(identical(other.performedBy, performedBy) ||
|
||||
other.performedBy == performedBy));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
equipmentId,
|
||||
transactionType,
|
||||
quantity,
|
||||
transactionDate,
|
||||
remarks,
|
||||
createdBy,
|
||||
userId,
|
||||
createdAt,
|
||||
userName,
|
||||
performedBy);
|
||||
|
||||
/// Create a copy of EquipmentHistoryDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentHistoryDtoImplCopyWith<_$EquipmentHistoryDtoImpl> get copyWith =>
|
||||
__$$EquipmentHistoryDtoImplCopyWithImpl<_$EquipmentHistoryDtoImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentHistoryDtoImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentHistoryDto implements EquipmentHistoryDto {
|
||||
const factory _EquipmentHistoryDto(
|
||||
{required final int id,
|
||||
required final int equipmentId,
|
||||
required final String transactionType,
|
||||
required final int quantity,
|
||||
required final DateTime transactionDate,
|
||||
final String? remarks,
|
||||
final int? createdBy,
|
||||
final int? userId,
|
||||
required final DateTime createdAt,
|
||||
final String? userName,
|
||||
final String? performedBy}) = _$EquipmentHistoryDtoImpl;
|
||||
|
||||
factory _EquipmentHistoryDto.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentHistoryDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
int get equipmentId;
|
||||
@override
|
||||
String get transactionType;
|
||||
@override
|
||||
int get quantity;
|
||||
@override
|
||||
DateTime get transactionDate;
|
||||
@override
|
||||
String? get remarks;
|
||||
@override
|
||||
int? get createdBy;
|
||||
@override
|
||||
int? get userId;
|
||||
@override
|
||||
DateTime get createdAt; // 추가 정보
|
||||
@override
|
||||
String? get userName;
|
||||
@override
|
||||
String? get performedBy;
|
||||
|
||||
/// Create a copy of EquipmentHistoryDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentHistoryDtoImplCopyWith<_$EquipmentHistoryDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
CreateHistoryRequest _$CreateHistoryRequestFromJson(Map<String, dynamic> json) {
|
||||
return _CreateHistoryRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreateHistoryRequest {
|
||||
String get transactionType => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
DateTime? get transactionDate => throw _privateConstructorUsedError;
|
||||
String? get remarks => throw _privateConstructorUsedError;
|
||||
int? get userId => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this CreateHistoryRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CreateHistoryRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CreateHistoryRequestCopyWith<CreateHistoryRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CreateHistoryRequestCopyWith<$Res> {
|
||||
factory $CreateHistoryRequestCopyWith(CreateHistoryRequest value,
|
||||
$Res Function(CreateHistoryRequest) then) =
|
||||
_$CreateHistoryRequestCopyWithImpl<$Res, CreateHistoryRequest>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String transactionType,
|
||||
int quantity,
|
||||
DateTime? transactionDate,
|
||||
String? remarks,
|
||||
int? userId});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CreateHistoryRequestCopyWithImpl<$Res,
|
||||
$Val extends CreateHistoryRequest>
|
||||
implements $CreateHistoryRequestCopyWith<$Res> {
|
||||
_$CreateHistoryRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CreateHistoryRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? transactionType = null,
|
||||
Object? quantity = null,
|
||||
Object? transactionDate = freezed,
|
||||
Object? remarks = freezed,
|
||||
Object? userId = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionDate: freezed == transactionDate
|
||||
? _value.transactionDate
|
||||
: transactionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
remarks: freezed == remarks
|
||||
? _value.remarks
|
||||
: remarks // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
userId: freezed == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CreateHistoryRequestImplCopyWith<$Res>
|
||||
implements $CreateHistoryRequestCopyWith<$Res> {
|
||||
factory _$$CreateHistoryRequestImplCopyWith(_$CreateHistoryRequestImpl value,
|
||||
$Res Function(_$CreateHistoryRequestImpl) then) =
|
||||
__$$CreateHistoryRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String transactionType,
|
||||
int quantity,
|
||||
DateTime? transactionDate,
|
||||
String? remarks,
|
||||
int? userId});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CreateHistoryRequestImplCopyWithImpl<$Res>
|
||||
extends _$CreateHistoryRequestCopyWithImpl<$Res, _$CreateHistoryRequestImpl>
|
||||
implements _$$CreateHistoryRequestImplCopyWith<$Res> {
|
||||
__$$CreateHistoryRequestImplCopyWithImpl(_$CreateHistoryRequestImpl _value,
|
||||
$Res Function(_$CreateHistoryRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CreateHistoryRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? transactionType = null,
|
||||
Object? quantity = null,
|
||||
Object? transactionDate = freezed,
|
||||
Object? remarks = freezed,
|
||||
Object? userId = freezed,
|
||||
}) {
|
||||
return _then(_$CreateHistoryRequestImpl(
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionDate: freezed == transactionDate
|
||||
? _value.transactionDate
|
||||
: transactionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
remarks: freezed == remarks
|
||||
? _value.remarks
|
||||
: remarks // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
userId: freezed == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$CreateHistoryRequestImpl implements _CreateHistoryRequest {
|
||||
const _$CreateHistoryRequestImpl(
|
||||
{required this.transactionType,
|
||||
required this.quantity,
|
||||
this.transactionDate,
|
||||
this.remarks,
|
||||
this.userId});
|
||||
|
||||
factory _$CreateHistoryRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$CreateHistoryRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String transactionType;
|
||||
@override
|
||||
final int quantity;
|
||||
@override
|
||||
final DateTime? transactionDate;
|
||||
@override
|
||||
final String? remarks;
|
||||
@override
|
||||
final int? userId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateHistoryRequest(transactionType: $transactionType, quantity: $quantity, transactionDate: $transactionDate, remarks: $remarks, userId: $userId)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CreateHistoryRequestImpl &&
|
||||
(identical(other.transactionType, transactionType) ||
|
||||
other.transactionType == transactionType) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.transactionDate, transactionDate) ||
|
||||
other.transactionDate == transactionDate) &&
|
||||
(identical(other.remarks, remarks) || other.remarks == remarks) &&
|
||||
(identical(other.userId, userId) || other.userId == userId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, transactionType, quantity, transactionDate, remarks, userId);
|
||||
|
||||
/// Create a copy of CreateHistoryRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CreateHistoryRequestImplCopyWith<_$CreateHistoryRequestImpl>
|
||||
get copyWith =>
|
||||
__$$CreateHistoryRequestImplCopyWithImpl<_$CreateHistoryRequestImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$CreateHistoryRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CreateHistoryRequest implements CreateHistoryRequest {
|
||||
const factory _CreateHistoryRequest(
|
||||
{required final String transactionType,
|
||||
required final int quantity,
|
||||
final DateTime? transactionDate,
|
||||
final String? remarks,
|
||||
final int? userId}) = _$CreateHistoryRequestImpl;
|
||||
|
||||
factory _CreateHistoryRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$CreateHistoryRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get transactionType;
|
||||
@override
|
||||
int get quantity;
|
||||
@override
|
||||
DateTime? get transactionDate;
|
||||
@override
|
||||
String? get remarks;
|
||||
@override
|
||||
int? get userId;
|
||||
|
||||
/// Create a copy of CreateHistoryRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CreateHistoryRequestImplCopyWith<_$CreateHistoryRequestImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
61
lib/data/models/equipment/equipment_history_dto.g.dart
Normal file
61
lib/data/models/equipment/equipment_history_dto.g.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_history_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$EquipmentHistoryDtoImpl _$$EquipmentHistoryDtoImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentHistoryDtoImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
equipmentId: (json['equipmentId'] as num).toInt(),
|
||||
transactionType: json['transactionType'] as String,
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
transactionDate: DateTime.parse(json['transactionDate'] as String),
|
||||
remarks: json['remarks'] as String?,
|
||||
createdBy: (json['createdBy'] as num?)?.toInt(),
|
||||
userId: (json['userId'] as num?)?.toInt(),
|
||||
createdAt: DateTime.parse(json['createdAt'] as String),
|
||||
userName: json['userName'] as String?,
|
||||
performedBy: json['performedBy'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentHistoryDtoImplToJson(
|
||||
_$EquipmentHistoryDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'equipmentId': instance.equipmentId,
|
||||
'transactionType': instance.transactionType,
|
||||
'quantity': instance.quantity,
|
||||
'transactionDate': instance.transactionDate.toIso8601String(),
|
||||
'remarks': instance.remarks,
|
||||
'createdBy': instance.createdBy,
|
||||
'userId': instance.userId,
|
||||
'createdAt': instance.createdAt.toIso8601String(),
|
||||
'userName': instance.userName,
|
||||
'performedBy': instance.performedBy,
|
||||
};
|
||||
|
||||
_$CreateHistoryRequestImpl _$$CreateHistoryRequestImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$CreateHistoryRequestImpl(
|
||||
transactionType: json['transactionType'] as String,
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
transactionDate: json['transactionDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['transactionDate'] as String),
|
||||
remarks: json['remarks'] as String?,
|
||||
userId: (json['userId'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$CreateHistoryRequestImplToJson(
|
||||
_$CreateHistoryRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'transactionType': instance.transactionType,
|
||||
'quantity': instance.quantity,
|
||||
'transactionDate': instance.transactionDate?.toIso8601String(),
|
||||
'remarks': instance.remarks,
|
||||
'userId': instance.userId,
|
||||
};
|
||||
17
lib/data/models/equipment/equipment_in_request.dart
Normal file
17
lib/data/models/equipment/equipment_in_request.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_in_request.freezed.dart';
|
||||
part 'equipment_in_request.g.dart';
|
||||
|
||||
@freezed
|
||||
class EquipmentInRequest with _$EquipmentInRequest {
|
||||
const factory EquipmentInRequest({
|
||||
required int equipmentId,
|
||||
required int quantity,
|
||||
int? warehouseLocationId,
|
||||
String? notes,
|
||||
}) = _EquipmentInRequest;
|
||||
|
||||
factory EquipmentInRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentInRequestFromJson(json);
|
||||
}
|
||||
227
lib/data/models/equipment/equipment_in_request.freezed.dart
Normal file
227
lib/data/models/equipment/equipment_in_request.freezed.dart
Normal file
@@ -0,0 +1,227 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_in_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
EquipmentInRequest _$EquipmentInRequestFromJson(Map<String, dynamic> json) {
|
||||
return _EquipmentInRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentInRequest {
|
||||
int get equipmentId => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
int? get warehouseLocationId => throw _privateConstructorUsedError;
|
||||
String? get notes => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentInRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentInRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentInRequestCopyWith<EquipmentInRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentInRequestCopyWith<$Res> {
|
||||
factory $EquipmentInRequestCopyWith(
|
||||
EquipmentInRequest value, $Res Function(EquipmentInRequest) then) =
|
||||
_$EquipmentInRequestCopyWithImpl<$Res, EquipmentInRequest>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int equipmentId, int quantity, int? warehouseLocationId, String? notes});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentInRequestCopyWithImpl<$Res, $Val extends EquipmentInRequest>
|
||||
implements $EquipmentInRequestCopyWith<$Res> {
|
||||
_$EquipmentInRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentInRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentId = null,
|
||||
Object? quantity = null,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? notes = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentInRequestImplCopyWith<$Res>
|
||||
implements $EquipmentInRequestCopyWith<$Res> {
|
||||
factory _$$EquipmentInRequestImplCopyWith(_$EquipmentInRequestImpl value,
|
||||
$Res Function(_$EquipmentInRequestImpl) then) =
|
||||
__$$EquipmentInRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int equipmentId, int quantity, int? warehouseLocationId, String? notes});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentInRequestImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentInRequestCopyWithImpl<$Res, _$EquipmentInRequestImpl>
|
||||
implements _$$EquipmentInRequestImplCopyWith<$Res> {
|
||||
__$$EquipmentInRequestImplCopyWithImpl(_$EquipmentInRequestImpl _value,
|
||||
$Res Function(_$EquipmentInRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentInRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentId = null,
|
||||
Object? quantity = null,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? notes = freezed,
|
||||
}) {
|
||||
return _then(_$EquipmentInRequestImpl(
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentInRequestImpl implements _EquipmentInRequest {
|
||||
const _$EquipmentInRequestImpl(
|
||||
{required this.equipmentId,
|
||||
required this.quantity,
|
||||
this.warehouseLocationId,
|
||||
this.notes});
|
||||
|
||||
factory _$EquipmentInRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentInRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int equipmentId;
|
||||
@override
|
||||
final int quantity;
|
||||
@override
|
||||
final int? warehouseLocationId;
|
||||
@override
|
||||
final String? notes;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentInRequest(equipmentId: $equipmentId, quantity: $quantity, warehouseLocationId: $warehouseLocationId, notes: $notes)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentInRequestImpl &&
|
||||
(identical(other.equipmentId, equipmentId) ||
|
||||
other.equipmentId == equipmentId) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.warehouseLocationId, warehouseLocationId) ||
|
||||
other.warehouseLocationId == warehouseLocationId) &&
|
||||
(identical(other.notes, notes) || other.notes == notes));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, equipmentId, quantity, warehouseLocationId, notes);
|
||||
|
||||
/// Create a copy of EquipmentInRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentInRequestImplCopyWith<_$EquipmentInRequestImpl> get copyWith =>
|
||||
__$$EquipmentInRequestImplCopyWithImpl<_$EquipmentInRequestImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentInRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentInRequest implements EquipmentInRequest {
|
||||
const factory _EquipmentInRequest(
|
||||
{required final int equipmentId,
|
||||
required final int quantity,
|
||||
final int? warehouseLocationId,
|
||||
final String? notes}) = _$EquipmentInRequestImpl;
|
||||
|
||||
factory _EquipmentInRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentInRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get equipmentId;
|
||||
@override
|
||||
int get quantity;
|
||||
@override
|
||||
int? get warehouseLocationId;
|
||||
@override
|
||||
String? get notes;
|
||||
|
||||
/// Create a copy of EquipmentInRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentInRequestImplCopyWith<_$EquipmentInRequestImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
25
lib/data/models/equipment/equipment_in_request.g.dart
Normal file
25
lib/data/models/equipment/equipment_in_request.g.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_in_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$EquipmentInRequestImpl _$$EquipmentInRequestImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentInRequestImpl(
|
||||
equipmentId: (json['equipmentId'] as num).toInt(),
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
warehouseLocationId: (json['warehouseLocationId'] as num?)?.toInt(),
|
||||
notes: json['notes'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentInRequestImplToJson(
|
||||
_$EquipmentInRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'equipmentId': instance.equipmentId,
|
||||
'quantity': instance.quantity,
|
||||
'warehouseLocationId': instance.warehouseLocationId,
|
||||
'notes': instance.notes,
|
||||
};
|
||||
20
lib/data/models/equipment/equipment_io_response.dart
Normal file
20
lib/data/models/equipment/equipment_io_response.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_io_response.freezed.dart';
|
||||
part 'equipment_io_response.g.dart';
|
||||
|
||||
@freezed
|
||||
class EquipmentIoResponse with _$EquipmentIoResponse {
|
||||
const factory EquipmentIoResponse({
|
||||
required bool success,
|
||||
required String message,
|
||||
required int transactionId,
|
||||
required int equipmentId,
|
||||
required int quantity,
|
||||
required String transactionType,
|
||||
required DateTime transactionDate,
|
||||
}) = _EquipmentIoResponse;
|
||||
|
||||
factory EquipmentIoResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentIoResponseFromJson(json);
|
||||
}
|
||||
295
lib/data/models/equipment/equipment_io_response.freezed.dart
Normal file
295
lib/data/models/equipment/equipment_io_response.freezed.dart
Normal file
@@ -0,0 +1,295 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_io_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
EquipmentIoResponse _$EquipmentIoResponseFromJson(Map<String, dynamic> json) {
|
||||
return _EquipmentIoResponse.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentIoResponse {
|
||||
bool get success => throw _privateConstructorUsedError;
|
||||
String get message => throw _privateConstructorUsedError;
|
||||
int get transactionId => throw _privateConstructorUsedError;
|
||||
int get equipmentId => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
String get transactionType => throw _privateConstructorUsedError;
|
||||
DateTime get transactionDate => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentIoResponse to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentIoResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentIoResponseCopyWith<EquipmentIoResponse> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentIoResponseCopyWith<$Res> {
|
||||
factory $EquipmentIoResponseCopyWith(
|
||||
EquipmentIoResponse value, $Res Function(EquipmentIoResponse) then) =
|
||||
_$EquipmentIoResponseCopyWithImpl<$Res, EquipmentIoResponse>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool success,
|
||||
String message,
|
||||
int transactionId,
|
||||
int equipmentId,
|
||||
int quantity,
|
||||
String transactionType,
|
||||
DateTime transactionDate});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentIoResponseCopyWithImpl<$Res, $Val extends EquipmentIoResponse>
|
||||
implements $EquipmentIoResponseCopyWith<$Res> {
|
||||
_$EquipmentIoResponseCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentIoResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? success = null,
|
||||
Object? message = null,
|
||||
Object? transactionId = null,
|
||||
Object? equipmentId = null,
|
||||
Object? quantity = null,
|
||||
Object? transactionType = null,
|
||||
Object? transactionDate = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
success: null == success
|
||||
? _value.success
|
||||
: success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
message: null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
transactionId: null == transactionId
|
||||
? _value.transactionId
|
||||
: transactionId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
transactionDate: null == transactionDate
|
||||
? _value.transactionDate
|
||||
: transactionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentIoResponseImplCopyWith<$Res>
|
||||
implements $EquipmentIoResponseCopyWith<$Res> {
|
||||
factory _$$EquipmentIoResponseImplCopyWith(_$EquipmentIoResponseImpl value,
|
||||
$Res Function(_$EquipmentIoResponseImpl) then) =
|
||||
__$$EquipmentIoResponseImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool success,
|
||||
String message,
|
||||
int transactionId,
|
||||
int equipmentId,
|
||||
int quantity,
|
||||
String transactionType,
|
||||
DateTime transactionDate});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentIoResponseImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentIoResponseCopyWithImpl<$Res, _$EquipmentIoResponseImpl>
|
||||
implements _$$EquipmentIoResponseImplCopyWith<$Res> {
|
||||
__$$EquipmentIoResponseImplCopyWithImpl(_$EquipmentIoResponseImpl _value,
|
||||
$Res Function(_$EquipmentIoResponseImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentIoResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? success = null,
|
||||
Object? message = null,
|
||||
Object? transactionId = null,
|
||||
Object? equipmentId = null,
|
||||
Object? quantity = null,
|
||||
Object? transactionType = null,
|
||||
Object? transactionDate = null,
|
||||
}) {
|
||||
return _then(_$EquipmentIoResponseImpl(
|
||||
success: null == success
|
||||
? _value.success
|
||||
: success // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
message: null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
transactionId: null == transactionId
|
||||
? _value.transactionId
|
||||
: transactionId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
transactionType: null == transactionType
|
||||
? _value.transactionType
|
||||
: transactionType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
transactionDate: null == transactionDate
|
||||
? _value.transactionDate
|
||||
: transactionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentIoResponseImpl implements _EquipmentIoResponse {
|
||||
const _$EquipmentIoResponseImpl(
|
||||
{required this.success,
|
||||
required this.message,
|
||||
required this.transactionId,
|
||||
required this.equipmentId,
|
||||
required this.quantity,
|
||||
required this.transactionType,
|
||||
required this.transactionDate});
|
||||
|
||||
factory _$EquipmentIoResponseImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentIoResponseImplFromJson(json);
|
||||
|
||||
@override
|
||||
final bool success;
|
||||
@override
|
||||
final String message;
|
||||
@override
|
||||
final int transactionId;
|
||||
@override
|
||||
final int equipmentId;
|
||||
@override
|
||||
final int quantity;
|
||||
@override
|
||||
final String transactionType;
|
||||
@override
|
||||
final DateTime transactionDate;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentIoResponse(success: $success, message: $message, transactionId: $transactionId, equipmentId: $equipmentId, quantity: $quantity, transactionType: $transactionType, transactionDate: $transactionDate)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentIoResponseImpl &&
|
||||
(identical(other.success, success) || other.success == success) &&
|
||||
(identical(other.message, message) || other.message == message) &&
|
||||
(identical(other.transactionId, transactionId) ||
|
||||
other.transactionId == transactionId) &&
|
||||
(identical(other.equipmentId, equipmentId) ||
|
||||
other.equipmentId == equipmentId) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.transactionType, transactionType) ||
|
||||
other.transactionType == transactionType) &&
|
||||
(identical(other.transactionDate, transactionDate) ||
|
||||
other.transactionDate == transactionDate));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, success, message, transactionId,
|
||||
equipmentId, quantity, transactionType, transactionDate);
|
||||
|
||||
/// Create a copy of EquipmentIoResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentIoResponseImplCopyWith<_$EquipmentIoResponseImpl> get copyWith =>
|
||||
__$$EquipmentIoResponseImplCopyWithImpl<_$EquipmentIoResponseImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentIoResponseImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentIoResponse implements EquipmentIoResponse {
|
||||
const factory _EquipmentIoResponse(
|
||||
{required final bool success,
|
||||
required final String message,
|
||||
required final int transactionId,
|
||||
required final int equipmentId,
|
||||
required final int quantity,
|
||||
required final String transactionType,
|
||||
required final DateTime transactionDate}) = _$EquipmentIoResponseImpl;
|
||||
|
||||
factory _EquipmentIoResponse.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentIoResponseImpl.fromJson;
|
||||
|
||||
@override
|
||||
bool get success;
|
||||
@override
|
||||
String get message;
|
||||
@override
|
||||
int get transactionId;
|
||||
@override
|
||||
int get equipmentId;
|
||||
@override
|
||||
int get quantity;
|
||||
@override
|
||||
String get transactionType;
|
||||
@override
|
||||
DateTime get transactionDate;
|
||||
|
||||
/// Create a copy of EquipmentIoResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentIoResponseImplCopyWith<_$EquipmentIoResponseImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
31
lib/data/models/equipment/equipment_io_response.g.dart
Normal file
31
lib/data/models/equipment/equipment_io_response.g.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_io_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$EquipmentIoResponseImpl _$$EquipmentIoResponseImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentIoResponseImpl(
|
||||
success: json['success'] as bool,
|
||||
message: json['message'] as String,
|
||||
transactionId: (json['transactionId'] as num).toInt(),
|
||||
equipmentId: (json['equipmentId'] as num).toInt(),
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
transactionType: json['transactionType'] as String,
|
||||
transactionDate: DateTime.parse(json['transactionDate'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentIoResponseImplToJson(
|
||||
_$EquipmentIoResponseImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'success': instance.success,
|
||||
'message': instance.message,
|
||||
'transactionId': instance.transactionId,
|
||||
'equipmentId': instance.equipmentId,
|
||||
'quantity': instance.quantity,
|
||||
'transactionType': instance.transactionType,
|
||||
'transactionDate': instance.transactionDate.toIso8601String(),
|
||||
};
|
||||
27
lib/data/models/equipment/equipment_list_dto.dart
Normal file
27
lib/data/models/equipment/equipment_list_dto.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_list_dto.freezed.dart';
|
||||
part 'equipment_list_dto.g.dart';
|
||||
|
||||
@freezed
|
||||
class EquipmentListDto with _$EquipmentListDto {
|
||||
const factory EquipmentListDto({
|
||||
required int id,
|
||||
required String equipmentNumber,
|
||||
required String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
required String status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
required DateTime createdAt,
|
||||
// 추가 필드 (조인된 데이터)
|
||||
String? companyName,
|
||||
String? branchName,
|
||||
String? warehouseName,
|
||||
}) = _EquipmentListDto;
|
||||
|
||||
factory EquipmentListDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentListDtoFromJson(json);
|
||||
}
|
||||
436
lib/data/models/equipment/equipment_list_dto.freezed.dart
Normal file
436
lib/data/models/equipment/equipment_list_dto.freezed.dart
Normal file
@@ -0,0 +1,436 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_list_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
EquipmentListDto _$EquipmentListDtoFromJson(Map<String, dynamic> json) {
|
||||
return _EquipmentListDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentListDto {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
String get equipmentNumber => throw _privateConstructorUsedError;
|
||||
String get manufacturer => throw _privateConstructorUsedError;
|
||||
String? get modelName => throw _privateConstructorUsedError;
|
||||
String? get serialNumber => throw _privateConstructorUsedError;
|
||||
String get status => throw _privateConstructorUsedError;
|
||||
int? get currentCompanyId => throw _privateConstructorUsedError;
|
||||
int? get currentBranchId => throw _privateConstructorUsedError;
|
||||
int? get warehouseLocationId => throw _privateConstructorUsedError;
|
||||
DateTime get createdAt =>
|
||||
throw _privateConstructorUsedError; // 추가 필드 (조인된 데이터)
|
||||
String? get companyName => throw _privateConstructorUsedError;
|
||||
String? get branchName => throw _privateConstructorUsedError;
|
||||
String? get warehouseName => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentListDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentListDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentListDtoCopyWith<EquipmentListDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentListDtoCopyWith<$Res> {
|
||||
factory $EquipmentListDtoCopyWith(
|
||||
EquipmentListDto value, $Res Function(EquipmentListDto) then) =
|
||||
_$EquipmentListDtoCopyWithImpl<$Res, EquipmentListDto>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String equipmentNumber,
|
||||
String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime createdAt,
|
||||
String? companyName,
|
||||
String? branchName,
|
||||
String? warehouseName});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentListDtoCopyWithImpl<$Res, $Val extends EquipmentListDto>
|
||||
implements $EquipmentListDtoCopyWith<$Res> {
|
||||
_$EquipmentListDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentListDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? equipmentNumber = null,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? status = null,
|
||||
Object? currentCompanyId = freezed,
|
||||
Object? currentBranchId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? createdAt = null,
|
||||
Object? companyName = freezed,
|
||||
Object? branchName = freezed,
|
||||
Object? warehouseName = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // 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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
currentCompanyId: freezed == currentCompanyId
|
||||
? _value.currentCompanyId
|
||||
: currentCompanyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
currentBranchId: freezed == currentBranchId
|
||||
? _value.currentBranchId
|
||||
: currentBranchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
branchName: freezed == branchName
|
||||
? _value.branchName
|
||||
: branchName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
warehouseName: freezed == warehouseName
|
||||
? _value.warehouseName
|
||||
: warehouseName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentListDtoImplCopyWith<$Res>
|
||||
implements $EquipmentListDtoCopyWith<$Res> {
|
||||
factory _$$EquipmentListDtoImplCopyWith(_$EquipmentListDtoImpl value,
|
||||
$Res Function(_$EquipmentListDtoImpl) then) =
|
||||
__$$EquipmentListDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String equipmentNumber,
|
||||
String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime createdAt,
|
||||
String? companyName,
|
||||
String? branchName,
|
||||
String? warehouseName});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentListDtoImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentListDtoCopyWithImpl<$Res, _$EquipmentListDtoImpl>
|
||||
implements _$$EquipmentListDtoImplCopyWith<$Res> {
|
||||
__$$EquipmentListDtoImplCopyWithImpl(_$EquipmentListDtoImpl _value,
|
||||
$Res Function(_$EquipmentListDtoImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentListDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? equipmentNumber = null,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? status = null,
|
||||
Object? currentCompanyId = freezed,
|
||||
Object? currentBranchId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? createdAt = null,
|
||||
Object? companyName = freezed,
|
||||
Object? branchName = freezed,
|
||||
Object? warehouseName = freezed,
|
||||
}) {
|
||||
return _then(_$EquipmentListDtoImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // 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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
currentCompanyId: freezed == currentCompanyId
|
||||
? _value.currentCompanyId
|
||||
: currentCompanyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
currentBranchId: freezed == currentBranchId
|
||||
? _value.currentBranchId
|
||||
: currentBranchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
branchName: freezed == branchName
|
||||
? _value.branchName
|
||||
: branchName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
warehouseName: freezed == warehouseName
|
||||
? _value.warehouseName
|
||||
: warehouseName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentListDtoImpl implements _EquipmentListDto {
|
||||
const _$EquipmentListDtoImpl(
|
||||
{required this.id,
|
||||
required this.equipmentNumber,
|
||||
required this.manufacturer,
|
||||
this.modelName,
|
||||
this.serialNumber,
|
||||
required this.status,
|
||||
this.currentCompanyId,
|
||||
this.currentBranchId,
|
||||
this.warehouseLocationId,
|
||||
required this.createdAt,
|
||||
this.companyName,
|
||||
this.branchName,
|
||||
this.warehouseName});
|
||||
|
||||
factory _$EquipmentListDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentListDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String equipmentNumber;
|
||||
@override
|
||||
final String manufacturer;
|
||||
@override
|
||||
final String? modelName;
|
||||
@override
|
||||
final String? serialNumber;
|
||||
@override
|
||||
final String status;
|
||||
@override
|
||||
final int? currentCompanyId;
|
||||
@override
|
||||
final int? currentBranchId;
|
||||
@override
|
||||
final int? warehouseLocationId;
|
||||
@override
|
||||
final DateTime createdAt;
|
||||
// 추가 필드 (조인된 데이터)
|
||||
@override
|
||||
final String? companyName;
|
||||
@override
|
||||
final String? branchName;
|
||||
@override
|
||||
final String? warehouseName;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentListDto(id: $id, equipmentNumber: $equipmentNumber, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, status: $status, currentCompanyId: $currentCompanyId, currentBranchId: $currentBranchId, warehouseLocationId: $warehouseLocationId, createdAt: $createdAt, companyName: $companyName, branchName: $branchName, warehouseName: $warehouseName)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentListDtoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.equipmentNumber, equipmentNumber) ||
|
||||
other.equipmentNumber == equipmentNumber) &&
|
||||
(identical(other.manufacturer, manufacturer) ||
|
||||
other.manufacturer == manufacturer) &&
|
||||
(identical(other.modelName, modelName) ||
|
||||
other.modelName == modelName) &&
|
||||
(identical(other.serialNumber, serialNumber) ||
|
||||
other.serialNumber == serialNumber) &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.currentCompanyId, currentCompanyId) ||
|
||||
other.currentCompanyId == currentCompanyId) &&
|
||||
(identical(other.currentBranchId, currentBranchId) ||
|
||||
other.currentBranchId == currentBranchId) &&
|
||||
(identical(other.warehouseLocationId, warehouseLocationId) ||
|
||||
other.warehouseLocationId == warehouseLocationId) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.companyName, companyName) ||
|
||||
other.companyName == companyName) &&
|
||||
(identical(other.branchName, branchName) ||
|
||||
other.branchName == branchName) &&
|
||||
(identical(other.warehouseName, warehouseName) ||
|
||||
other.warehouseName == warehouseName));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
equipmentNumber,
|
||||
manufacturer,
|
||||
modelName,
|
||||
serialNumber,
|
||||
status,
|
||||
currentCompanyId,
|
||||
currentBranchId,
|
||||
warehouseLocationId,
|
||||
createdAt,
|
||||
companyName,
|
||||
branchName,
|
||||
warehouseName);
|
||||
|
||||
/// Create a copy of EquipmentListDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentListDtoImplCopyWith<_$EquipmentListDtoImpl> get copyWith =>
|
||||
__$$EquipmentListDtoImplCopyWithImpl<_$EquipmentListDtoImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentListDtoImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentListDto implements EquipmentListDto {
|
||||
const factory _EquipmentListDto(
|
||||
{required final int id,
|
||||
required final String equipmentNumber,
|
||||
required final String manufacturer,
|
||||
final String? modelName,
|
||||
final String? serialNumber,
|
||||
required final String status,
|
||||
final int? currentCompanyId,
|
||||
final int? currentBranchId,
|
||||
final int? warehouseLocationId,
|
||||
required final DateTime createdAt,
|
||||
final String? companyName,
|
||||
final String? branchName,
|
||||
final String? warehouseName}) = _$EquipmentListDtoImpl;
|
||||
|
||||
factory _EquipmentListDto.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentListDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
String get equipmentNumber;
|
||||
@override
|
||||
String get manufacturer;
|
||||
@override
|
||||
String? get modelName;
|
||||
@override
|
||||
String? get serialNumber;
|
||||
@override
|
||||
String get status;
|
||||
@override
|
||||
int? get currentCompanyId;
|
||||
@override
|
||||
int? get currentBranchId;
|
||||
@override
|
||||
int? get warehouseLocationId;
|
||||
@override
|
||||
DateTime get createdAt; // 추가 필드 (조인된 데이터)
|
||||
@override
|
||||
String? get companyName;
|
||||
@override
|
||||
String? get branchName;
|
||||
@override
|
||||
String? get warehouseName;
|
||||
|
||||
/// Create a copy of EquipmentListDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentListDtoImplCopyWith<_$EquipmentListDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
43
lib/data/models/equipment/equipment_list_dto.g.dart
Normal file
43
lib/data/models/equipment/equipment_list_dto.g.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_list_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$EquipmentListDtoImpl _$$EquipmentListDtoImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentListDtoImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
equipmentNumber: json['equipmentNumber'] as String,
|
||||
manufacturer: json['manufacturer'] as String,
|
||||
modelName: json['modelName'] as String?,
|
||||
serialNumber: json['serialNumber'] as String?,
|
||||
status: json['status'] as String,
|
||||
currentCompanyId: (json['currentCompanyId'] as num?)?.toInt(),
|
||||
currentBranchId: (json['currentBranchId'] as num?)?.toInt(),
|
||||
warehouseLocationId: (json['warehouseLocationId'] as num?)?.toInt(),
|
||||
createdAt: DateTime.parse(json['createdAt'] as String),
|
||||
companyName: json['companyName'] as String?,
|
||||
branchName: json['branchName'] as String?,
|
||||
warehouseName: json['warehouseName'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentListDtoImplToJson(
|
||||
_$EquipmentListDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'equipmentNumber': instance.equipmentNumber,
|
||||
'manufacturer': instance.manufacturer,
|
||||
'modelName': instance.modelName,
|
||||
'serialNumber': instance.serialNumber,
|
||||
'status': instance.status,
|
||||
'currentCompanyId': instance.currentCompanyId,
|
||||
'currentBranchId': instance.currentBranchId,
|
||||
'warehouseLocationId': instance.warehouseLocationId,
|
||||
'createdAt': instance.createdAt.toIso8601String(),
|
||||
'companyName': instance.companyName,
|
||||
'branchName': instance.branchName,
|
||||
'warehouseName': instance.warehouseName,
|
||||
};
|
||||
18
lib/data/models/equipment/equipment_out_request.dart
Normal file
18
lib/data/models/equipment/equipment_out_request.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_out_request.freezed.dart';
|
||||
part 'equipment_out_request.g.dart';
|
||||
|
||||
@freezed
|
||||
class EquipmentOutRequest with _$EquipmentOutRequest {
|
||||
const factory EquipmentOutRequest({
|
||||
required int equipmentId,
|
||||
required int quantity,
|
||||
required int companyId,
|
||||
int? branchId,
|
||||
String? notes,
|
||||
}) = _EquipmentOutRequest;
|
||||
|
||||
factory EquipmentOutRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentOutRequestFromJson(json);
|
||||
}
|
||||
254
lib/data/models/equipment/equipment_out_request.freezed.dart
Normal file
254
lib/data/models/equipment/equipment_out_request.freezed.dart
Normal file
@@ -0,0 +1,254 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_out_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
EquipmentOutRequest _$EquipmentOutRequestFromJson(Map<String, dynamic> json) {
|
||||
return _EquipmentOutRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentOutRequest {
|
||||
int get equipmentId => throw _privateConstructorUsedError;
|
||||
int get quantity => throw _privateConstructorUsedError;
|
||||
int get companyId => throw _privateConstructorUsedError;
|
||||
int? get branchId => throw _privateConstructorUsedError;
|
||||
String? get notes => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentOutRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentOutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentOutRequestCopyWith<EquipmentOutRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentOutRequestCopyWith<$Res> {
|
||||
factory $EquipmentOutRequestCopyWith(
|
||||
EquipmentOutRequest value, $Res Function(EquipmentOutRequest) then) =
|
||||
_$EquipmentOutRequestCopyWithImpl<$Res, EquipmentOutRequest>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int equipmentId,
|
||||
int quantity,
|
||||
int companyId,
|
||||
int? branchId,
|
||||
String? notes});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentOutRequestCopyWithImpl<$Res, $Val extends EquipmentOutRequest>
|
||||
implements $EquipmentOutRequestCopyWith<$Res> {
|
||||
_$EquipmentOutRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentOutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentId = null,
|
||||
Object? quantity = null,
|
||||
Object? companyId = null,
|
||||
Object? branchId = freezed,
|
||||
Object? notes = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
companyId: null == companyId
|
||||
? _value.companyId
|
||||
: companyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
branchId: freezed == branchId
|
||||
? _value.branchId
|
||||
: branchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentOutRequestImplCopyWith<$Res>
|
||||
implements $EquipmentOutRequestCopyWith<$Res> {
|
||||
factory _$$EquipmentOutRequestImplCopyWith(_$EquipmentOutRequestImpl value,
|
||||
$Res Function(_$EquipmentOutRequestImpl) then) =
|
||||
__$$EquipmentOutRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int equipmentId,
|
||||
int quantity,
|
||||
int companyId,
|
||||
int? branchId,
|
||||
String? notes});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentOutRequestImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentOutRequestCopyWithImpl<$Res, _$EquipmentOutRequestImpl>
|
||||
implements _$$EquipmentOutRequestImplCopyWith<$Res> {
|
||||
__$$EquipmentOutRequestImplCopyWithImpl(_$EquipmentOutRequestImpl _value,
|
||||
$Res Function(_$EquipmentOutRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentOutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentId = null,
|
||||
Object? quantity = null,
|
||||
Object? companyId = null,
|
||||
Object? branchId = freezed,
|
||||
Object? notes = freezed,
|
||||
}) {
|
||||
return _then(_$EquipmentOutRequestImpl(
|
||||
equipmentId: null == equipmentId
|
||||
? _value.equipmentId
|
||||
: equipmentId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
quantity: null == quantity
|
||||
? _value.quantity
|
||||
: quantity // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
companyId: null == companyId
|
||||
? _value.companyId
|
||||
: companyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
branchId: freezed == branchId
|
||||
? _value.branchId
|
||||
: branchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
notes: freezed == notes
|
||||
? _value.notes
|
||||
: notes // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentOutRequestImpl implements _EquipmentOutRequest {
|
||||
const _$EquipmentOutRequestImpl(
|
||||
{required this.equipmentId,
|
||||
required this.quantity,
|
||||
required this.companyId,
|
||||
this.branchId,
|
||||
this.notes});
|
||||
|
||||
factory _$EquipmentOutRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentOutRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int equipmentId;
|
||||
@override
|
||||
final int quantity;
|
||||
@override
|
||||
final int companyId;
|
||||
@override
|
||||
final int? branchId;
|
||||
@override
|
||||
final String? notes;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentOutRequest(equipmentId: $equipmentId, quantity: $quantity, companyId: $companyId, branchId: $branchId, notes: $notes)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentOutRequestImpl &&
|
||||
(identical(other.equipmentId, equipmentId) ||
|
||||
other.equipmentId == equipmentId) &&
|
||||
(identical(other.quantity, quantity) ||
|
||||
other.quantity == quantity) &&
|
||||
(identical(other.companyId, companyId) ||
|
||||
other.companyId == companyId) &&
|
||||
(identical(other.branchId, branchId) ||
|
||||
other.branchId == branchId) &&
|
||||
(identical(other.notes, notes) || other.notes == notes));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, equipmentId, quantity, companyId, branchId, notes);
|
||||
|
||||
/// Create a copy of EquipmentOutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentOutRequestImplCopyWith<_$EquipmentOutRequestImpl> get copyWith =>
|
||||
__$$EquipmentOutRequestImplCopyWithImpl<_$EquipmentOutRequestImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentOutRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentOutRequest implements EquipmentOutRequest {
|
||||
const factory _EquipmentOutRequest(
|
||||
{required final int equipmentId,
|
||||
required final int quantity,
|
||||
required final int companyId,
|
||||
final int? branchId,
|
||||
final String? notes}) = _$EquipmentOutRequestImpl;
|
||||
|
||||
factory _EquipmentOutRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentOutRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get equipmentId;
|
||||
@override
|
||||
int get quantity;
|
||||
@override
|
||||
int get companyId;
|
||||
@override
|
||||
int? get branchId;
|
||||
@override
|
||||
String? get notes;
|
||||
|
||||
/// Create a copy of EquipmentOutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentOutRequestImplCopyWith<_$EquipmentOutRequestImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
27
lib/data/models/equipment/equipment_out_request.g.dart
Normal file
27
lib/data/models/equipment/equipment_out_request.g.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_out_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$EquipmentOutRequestImpl _$$EquipmentOutRequestImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentOutRequestImpl(
|
||||
equipmentId: (json['equipmentId'] as num).toInt(),
|
||||
quantity: (json['quantity'] as num).toInt(),
|
||||
companyId: (json['companyId'] as num).toInt(),
|
||||
branchId: (json['branchId'] as num?)?.toInt(),
|
||||
notes: json['notes'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentOutRequestImplToJson(
|
||||
_$EquipmentOutRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'equipmentId': instance.equipmentId,
|
||||
'quantity': instance.quantity,
|
||||
'companyId': instance.companyId,
|
||||
'branchId': instance.branchId,
|
||||
'notes': instance.notes,
|
||||
};
|
||||
48
lib/data/models/equipment/equipment_request.dart
Normal file
48
lib/data/models/equipment/equipment_request.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_request.freezed.dart';
|
||||
part 'equipment_request.g.dart';
|
||||
|
||||
@freezed
|
||||
class CreateEquipmentRequest with _$CreateEquipmentRequest {
|
||||
const factory CreateEquipmentRequest({
|
||||
required String equipmentNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
required String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String? remark,
|
||||
}) = _CreateEquipmentRequest;
|
||||
|
||||
factory CreateEquipmentRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateEquipmentRequestFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class UpdateEquipmentRequest with _$UpdateEquipmentRequest {
|
||||
const factory UpdateEquipmentRequest({
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String? manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String? barcode,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String? status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime? lastInspectionDate,
|
||||
DateTime? nextInspectionDate,
|
||||
String? remark,
|
||||
}) = _UpdateEquipmentRequest;
|
||||
|
||||
factory UpdateEquipmentRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$UpdateEquipmentRequestFromJson(json);
|
||||
}
|
||||
863
lib/data/models/equipment/equipment_request.freezed.dart
Normal file
863
lib/data/models/equipment/equipment_request.freezed.dart
Normal file
@@ -0,0 +1,863 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
CreateEquipmentRequest _$CreateEquipmentRequestFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _CreateEquipmentRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreateEquipmentRequest {
|
||||
String get equipmentNumber => throw _privateConstructorUsedError;
|
||||
String? get category1 => throw _privateConstructorUsedError;
|
||||
String? get category2 => throw _privateConstructorUsedError;
|
||||
String? get category3 => throw _privateConstructorUsedError;
|
||||
String get manufacturer => throw _privateConstructorUsedError;
|
||||
String? get modelName => throw _privateConstructorUsedError;
|
||||
String? get serialNumber => throw _privateConstructorUsedError;
|
||||
DateTime? get purchaseDate => throw _privateConstructorUsedError;
|
||||
double? get purchasePrice => throw _privateConstructorUsedError;
|
||||
String? get remark => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this CreateEquipmentRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CreateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CreateEquipmentRequestCopyWith<CreateEquipmentRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CreateEquipmentRequestCopyWith<$Res> {
|
||||
factory $CreateEquipmentRequestCopyWith(CreateEquipmentRequest value,
|
||||
$Res Function(CreateEquipmentRequest) then) =
|
||||
_$CreateEquipmentRequestCopyWithImpl<$Res, CreateEquipmentRequest>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String equipmentNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String? remark});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CreateEquipmentRequestCopyWithImpl<$Res,
|
||||
$Val extends CreateEquipmentRequest>
|
||||
implements $CreateEquipmentRequestCopyWith<$Res> {
|
||||
_$CreateEquipmentRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CreateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentNumber = null,
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? remark = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
purchasePrice: freezed == purchasePrice
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CreateEquipmentRequestImplCopyWith<$Res>
|
||||
implements $CreateEquipmentRequestCopyWith<$Res> {
|
||||
factory _$$CreateEquipmentRequestImplCopyWith(
|
||||
_$CreateEquipmentRequestImpl value,
|
||||
$Res Function(_$CreateEquipmentRequestImpl) then) =
|
||||
__$$CreateEquipmentRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String equipmentNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String? remark});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CreateEquipmentRequestImplCopyWithImpl<$Res>
|
||||
extends _$CreateEquipmentRequestCopyWithImpl<$Res,
|
||||
_$CreateEquipmentRequestImpl>
|
||||
implements _$$CreateEquipmentRequestImplCopyWith<$Res> {
|
||||
__$$CreateEquipmentRequestImplCopyWithImpl(
|
||||
_$CreateEquipmentRequestImpl _value,
|
||||
$Res Function(_$CreateEquipmentRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CreateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentNumber = null,
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? remark = freezed,
|
||||
}) {
|
||||
return _then(_$CreateEquipmentRequestImpl(
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
purchasePrice: freezed == purchasePrice
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$CreateEquipmentRequestImpl implements _CreateEquipmentRequest {
|
||||
const _$CreateEquipmentRequestImpl(
|
||||
{required this.equipmentNumber,
|
||||
this.category1,
|
||||
this.category2,
|
||||
this.category3,
|
||||
required this.manufacturer,
|
||||
this.modelName,
|
||||
this.serialNumber,
|
||||
this.purchaseDate,
|
||||
this.purchasePrice,
|
||||
this.remark});
|
||||
|
||||
factory _$CreateEquipmentRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$CreateEquipmentRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String equipmentNumber;
|
||||
@override
|
||||
final String? category1;
|
||||
@override
|
||||
final String? category2;
|
||||
@override
|
||||
final String? category3;
|
||||
@override
|
||||
final String manufacturer;
|
||||
@override
|
||||
final String? modelName;
|
||||
@override
|
||||
final String? serialNumber;
|
||||
@override
|
||||
final DateTime? purchaseDate;
|
||||
@override
|
||||
final double? purchasePrice;
|
||||
@override
|
||||
final String? remark;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateEquipmentRequest(equipmentNumber: $equipmentNumber, category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, remark: $remark)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CreateEquipmentRequestImpl &&
|
||||
(identical(other.equipmentNumber, equipmentNumber) ||
|
||||
other.equipmentNumber == equipmentNumber) &&
|
||||
(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.modelName, modelName) ||
|
||||
other.modelName == modelName) &&
|
||||
(identical(other.serialNumber, serialNumber) ||
|
||||
other.serialNumber == serialNumber) &&
|
||||
(identical(other.purchaseDate, purchaseDate) ||
|
||||
other.purchaseDate == purchaseDate) &&
|
||||
(identical(other.purchasePrice, purchasePrice) ||
|
||||
other.purchasePrice == purchasePrice) &&
|
||||
(identical(other.remark, remark) || other.remark == remark));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
equipmentNumber,
|
||||
category1,
|
||||
category2,
|
||||
category3,
|
||||
manufacturer,
|
||||
modelName,
|
||||
serialNumber,
|
||||
purchaseDate,
|
||||
purchasePrice,
|
||||
remark);
|
||||
|
||||
/// Create a copy of CreateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CreateEquipmentRequestImplCopyWith<_$CreateEquipmentRequestImpl>
|
||||
get copyWith => __$$CreateEquipmentRequestImplCopyWithImpl<
|
||||
_$CreateEquipmentRequestImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$CreateEquipmentRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CreateEquipmentRequest implements CreateEquipmentRequest {
|
||||
const factory _CreateEquipmentRequest(
|
||||
{required final String equipmentNumber,
|
||||
final String? category1,
|
||||
final String? category2,
|
||||
final String? category3,
|
||||
required final String manufacturer,
|
||||
final String? modelName,
|
||||
final String? serialNumber,
|
||||
final DateTime? purchaseDate,
|
||||
final double? purchasePrice,
|
||||
final String? remark}) = _$CreateEquipmentRequestImpl;
|
||||
|
||||
factory _CreateEquipmentRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$CreateEquipmentRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get equipmentNumber;
|
||||
@override
|
||||
String? get category1;
|
||||
@override
|
||||
String? get category2;
|
||||
@override
|
||||
String? get category3;
|
||||
@override
|
||||
String get manufacturer;
|
||||
@override
|
||||
String? get modelName;
|
||||
@override
|
||||
String? get serialNumber;
|
||||
@override
|
||||
DateTime? get purchaseDate;
|
||||
@override
|
||||
double? get purchasePrice;
|
||||
@override
|
||||
String? get remark;
|
||||
|
||||
/// Create a copy of CreateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CreateEquipmentRequestImplCopyWith<_$CreateEquipmentRequestImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
UpdateEquipmentRequest _$UpdateEquipmentRequestFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _UpdateEquipmentRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UpdateEquipmentRequest {
|
||||
String? get category1 => throw _privateConstructorUsedError;
|
||||
String? get category2 => throw _privateConstructorUsedError;
|
||||
String? get category3 => throw _privateConstructorUsedError;
|
||||
String? get manufacturer => throw _privateConstructorUsedError;
|
||||
String? get modelName => throw _privateConstructorUsedError;
|
||||
String? get serialNumber => throw _privateConstructorUsedError;
|
||||
String? get barcode => throw _privateConstructorUsedError;
|
||||
DateTime? get purchaseDate => throw _privateConstructorUsedError;
|
||||
double? get purchasePrice => throw _privateConstructorUsedError;
|
||||
String? get status => throw _privateConstructorUsedError;
|
||||
int? get currentCompanyId => throw _privateConstructorUsedError;
|
||||
int? get currentBranchId => throw _privateConstructorUsedError;
|
||||
int? get warehouseLocationId => throw _privateConstructorUsedError;
|
||||
DateTime? get lastInspectionDate => throw _privateConstructorUsedError;
|
||||
DateTime? get nextInspectionDate => throw _privateConstructorUsedError;
|
||||
String? get remark => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this UpdateEquipmentRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of UpdateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UpdateEquipmentRequestCopyWith<UpdateEquipmentRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UpdateEquipmentRequestCopyWith<$Res> {
|
||||
factory $UpdateEquipmentRequestCopyWith(UpdateEquipmentRequest value,
|
||||
$Res Function(UpdateEquipmentRequest) then) =
|
||||
_$UpdateEquipmentRequestCopyWithImpl<$Res, UpdateEquipmentRequest>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String? manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String? barcode,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String? status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime? lastInspectionDate,
|
||||
DateTime? nextInspectionDate,
|
||||
String? remark});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UpdateEquipmentRequestCopyWithImpl<$Res,
|
||||
$Val extends UpdateEquipmentRequest>
|
||||
implements $UpdateEquipmentRequestCopyWith<$Res> {
|
||||
_$UpdateEquipmentRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of UpdateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = freezed,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? barcode = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? status = freezed,
|
||||
Object? currentCompanyId = freezed,
|
||||
Object? currentBranchId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? lastInspectionDate = freezed,
|
||||
Object? nextInspectionDate = freezed,
|
||||
Object? remark = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
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: freezed == 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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
barcode: freezed == barcode
|
||||
? _value.barcode
|
||||
: barcode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
purchasePrice: freezed == purchasePrice
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
currentCompanyId: freezed == currentCompanyId
|
||||
? _value.currentCompanyId
|
||||
: currentCompanyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
currentBranchId: freezed == currentBranchId
|
||||
? _value.currentBranchId
|
||||
: currentBranchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
lastInspectionDate: freezed == lastInspectionDate
|
||||
? _value.lastInspectionDate
|
||||
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
nextInspectionDate: freezed == nextInspectionDate
|
||||
? _value.nextInspectionDate
|
||||
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UpdateEquipmentRequestImplCopyWith<$Res>
|
||||
implements $UpdateEquipmentRequestCopyWith<$Res> {
|
||||
factory _$$UpdateEquipmentRequestImplCopyWith(
|
||||
_$UpdateEquipmentRequestImpl value,
|
||||
$Res Function(_$UpdateEquipmentRequestImpl) then) =
|
||||
__$$UpdateEquipmentRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String? manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String? barcode,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String? status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime? lastInspectionDate,
|
||||
DateTime? nextInspectionDate,
|
||||
String? remark});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UpdateEquipmentRequestImplCopyWithImpl<$Res>
|
||||
extends _$UpdateEquipmentRequestCopyWithImpl<$Res,
|
||||
_$UpdateEquipmentRequestImpl>
|
||||
implements _$$UpdateEquipmentRequestImplCopyWith<$Res> {
|
||||
__$$UpdateEquipmentRequestImplCopyWithImpl(
|
||||
_$UpdateEquipmentRequestImpl _value,
|
||||
$Res Function(_$UpdateEquipmentRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of UpdateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = freezed,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? barcode = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? status = freezed,
|
||||
Object? currentCompanyId = freezed,
|
||||
Object? currentBranchId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? lastInspectionDate = freezed,
|
||||
Object? nextInspectionDate = freezed,
|
||||
Object? remark = freezed,
|
||||
}) {
|
||||
return _then(_$UpdateEquipmentRequestImpl(
|
||||
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: freezed == 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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
barcode: freezed == barcode
|
||||
? _value.barcode
|
||||
: barcode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
purchasePrice: freezed == purchasePrice
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
currentCompanyId: freezed == currentCompanyId
|
||||
? _value.currentCompanyId
|
||||
: currentCompanyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
currentBranchId: freezed == currentBranchId
|
||||
? _value.currentBranchId
|
||||
: currentBranchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
lastInspectionDate: freezed == lastInspectionDate
|
||||
? _value.lastInspectionDate
|
||||
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
nextInspectionDate: freezed == nextInspectionDate
|
||||
? _value.nextInspectionDate
|
||||
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$UpdateEquipmentRequestImpl implements _UpdateEquipmentRequest {
|
||||
const _$UpdateEquipmentRequestImpl(
|
||||
{this.category1,
|
||||
this.category2,
|
||||
this.category3,
|
||||
this.manufacturer,
|
||||
this.modelName,
|
||||
this.serialNumber,
|
||||
this.barcode,
|
||||
this.purchaseDate,
|
||||
this.purchasePrice,
|
||||
this.status,
|
||||
this.currentCompanyId,
|
||||
this.currentBranchId,
|
||||
this.warehouseLocationId,
|
||||
this.lastInspectionDate,
|
||||
this.nextInspectionDate,
|
||||
this.remark});
|
||||
|
||||
factory _$UpdateEquipmentRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$UpdateEquipmentRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String? category1;
|
||||
@override
|
||||
final String? category2;
|
||||
@override
|
||||
final String? category3;
|
||||
@override
|
||||
final String? manufacturer;
|
||||
@override
|
||||
final String? modelName;
|
||||
@override
|
||||
final String? serialNumber;
|
||||
@override
|
||||
final String? barcode;
|
||||
@override
|
||||
final DateTime? purchaseDate;
|
||||
@override
|
||||
final double? purchasePrice;
|
||||
@override
|
||||
final String? status;
|
||||
@override
|
||||
final int? currentCompanyId;
|
||||
@override
|
||||
final int? currentBranchId;
|
||||
@override
|
||||
final int? warehouseLocationId;
|
||||
@override
|
||||
final DateTime? lastInspectionDate;
|
||||
@override
|
||||
final DateTime? nextInspectionDate;
|
||||
@override
|
||||
final String? remark;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateEquipmentRequest(category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, barcode: $barcode, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, status: $status, currentCompanyId: $currentCompanyId, currentBranchId: $currentBranchId, warehouseLocationId: $warehouseLocationId, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UpdateEquipmentRequestImpl &&
|
||||
(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.modelName, modelName) ||
|
||||
other.modelName == modelName) &&
|
||||
(identical(other.serialNumber, serialNumber) ||
|
||||
other.serialNumber == serialNumber) &&
|
||||
(identical(other.barcode, barcode) || other.barcode == barcode) &&
|
||||
(identical(other.purchaseDate, purchaseDate) ||
|
||||
other.purchaseDate == purchaseDate) &&
|
||||
(identical(other.purchasePrice, purchasePrice) ||
|
||||
other.purchasePrice == purchasePrice) &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.currentCompanyId, currentCompanyId) ||
|
||||
other.currentCompanyId == currentCompanyId) &&
|
||||
(identical(other.currentBranchId, currentBranchId) ||
|
||||
other.currentBranchId == currentBranchId) &&
|
||||
(identical(other.warehouseLocationId, warehouseLocationId) ||
|
||||
other.warehouseLocationId == warehouseLocationId) &&
|
||||
(identical(other.lastInspectionDate, lastInspectionDate) ||
|
||||
other.lastInspectionDate == lastInspectionDate) &&
|
||||
(identical(other.nextInspectionDate, nextInspectionDate) ||
|
||||
other.nextInspectionDate == nextInspectionDate) &&
|
||||
(identical(other.remark, remark) || other.remark == remark));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
category1,
|
||||
category2,
|
||||
category3,
|
||||
manufacturer,
|
||||
modelName,
|
||||
serialNumber,
|
||||
barcode,
|
||||
purchaseDate,
|
||||
purchasePrice,
|
||||
status,
|
||||
currentCompanyId,
|
||||
currentBranchId,
|
||||
warehouseLocationId,
|
||||
lastInspectionDate,
|
||||
nextInspectionDate,
|
||||
remark);
|
||||
|
||||
/// Create a copy of UpdateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UpdateEquipmentRequestImplCopyWith<_$UpdateEquipmentRequestImpl>
|
||||
get copyWith => __$$UpdateEquipmentRequestImplCopyWithImpl<
|
||||
_$UpdateEquipmentRequestImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$UpdateEquipmentRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UpdateEquipmentRequest implements UpdateEquipmentRequest {
|
||||
const factory _UpdateEquipmentRequest(
|
||||
{final String? category1,
|
||||
final String? category2,
|
||||
final String? category3,
|
||||
final String? manufacturer,
|
||||
final String? modelName,
|
||||
final String? serialNumber,
|
||||
final String? barcode,
|
||||
final DateTime? purchaseDate,
|
||||
final double? purchasePrice,
|
||||
final String? status,
|
||||
final int? currentCompanyId,
|
||||
final int? currentBranchId,
|
||||
final int? warehouseLocationId,
|
||||
final DateTime? lastInspectionDate,
|
||||
final DateTime? nextInspectionDate,
|
||||
final String? remark}) = _$UpdateEquipmentRequestImpl;
|
||||
|
||||
factory _UpdateEquipmentRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$UpdateEquipmentRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
String? get category1;
|
||||
@override
|
||||
String? get category2;
|
||||
@override
|
||||
String? get category3;
|
||||
@override
|
||||
String? get manufacturer;
|
||||
@override
|
||||
String? get modelName;
|
||||
@override
|
||||
String? get serialNumber;
|
||||
@override
|
||||
String? get barcode;
|
||||
@override
|
||||
DateTime? get purchaseDate;
|
||||
@override
|
||||
double? get purchasePrice;
|
||||
@override
|
||||
String? get status;
|
||||
@override
|
||||
int? get currentCompanyId;
|
||||
@override
|
||||
int? get currentBranchId;
|
||||
@override
|
||||
int? get warehouseLocationId;
|
||||
@override
|
||||
DateTime? get lastInspectionDate;
|
||||
@override
|
||||
DateTime? get nextInspectionDate;
|
||||
@override
|
||||
String? get remark;
|
||||
|
||||
/// Create a copy of UpdateEquipmentRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UpdateEquipmentRequestImplCopyWith<_$UpdateEquipmentRequestImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
87
lib/data/models/equipment/equipment_request.g.dart
Normal file
87
lib/data/models/equipment/equipment_request.g.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$CreateEquipmentRequestImpl _$$CreateEquipmentRequestImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$CreateEquipmentRequestImpl(
|
||||
equipmentNumber: json['equipmentNumber'] as String,
|
||||
category1: json['category1'] as String?,
|
||||
category2: json['category2'] as String?,
|
||||
category3: json['category3'] as String?,
|
||||
manufacturer: json['manufacturer'] as String,
|
||||
modelName: json['modelName'] as String?,
|
||||
serialNumber: json['serialNumber'] as String?,
|
||||
purchaseDate: json['purchaseDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['purchaseDate'] as String),
|
||||
purchasePrice: (json['purchasePrice'] as num?)?.toDouble(),
|
||||
remark: json['remark'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$CreateEquipmentRequestImplToJson(
|
||||
_$CreateEquipmentRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'equipmentNumber': instance.equipmentNumber,
|
||||
'category1': instance.category1,
|
||||
'category2': instance.category2,
|
||||
'category3': instance.category3,
|
||||
'manufacturer': instance.manufacturer,
|
||||
'modelName': instance.modelName,
|
||||
'serialNumber': instance.serialNumber,
|
||||
'purchaseDate': instance.purchaseDate?.toIso8601String(),
|
||||
'purchasePrice': instance.purchasePrice,
|
||||
'remark': instance.remark,
|
||||
};
|
||||
|
||||
_$UpdateEquipmentRequestImpl _$$UpdateEquipmentRequestImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$UpdateEquipmentRequestImpl(
|
||||
category1: json['category1'] as String?,
|
||||
category2: json['category2'] as String?,
|
||||
category3: json['category3'] as String?,
|
||||
manufacturer: json['manufacturer'] as String?,
|
||||
modelName: json['modelName'] as String?,
|
||||
serialNumber: json['serialNumber'] as String?,
|
||||
barcode: json['barcode'] as String?,
|
||||
purchaseDate: json['purchaseDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['purchaseDate'] as String),
|
||||
purchasePrice: (json['purchasePrice'] as num?)?.toDouble(),
|
||||
status: json['status'] as String?,
|
||||
currentCompanyId: (json['currentCompanyId'] as num?)?.toInt(),
|
||||
currentBranchId: (json['currentBranchId'] as num?)?.toInt(),
|
||||
warehouseLocationId: (json['warehouseLocationId'] as num?)?.toInt(),
|
||||
lastInspectionDate: json['lastInspectionDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['lastInspectionDate'] as String),
|
||||
nextInspectionDate: json['nextInspectionDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['nextInspectionDate'] as String),
|
||||
remark: json['remark'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$UpdateEquipmentRequestImplToJson(
|
||||
_$UpdateEquipmentRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'category1': instance.category1,
|
||||
'category2': instance.category2,
|
||||
'category3': instance.category3,
|
||||
'manufacturer': instance.manufacturer,
|
||||
'modelName': instance.modelName,
|
||||
'serialNumber': instance.serialNumber,
|
||||
'barcode': instance.barcode,
|
||||
'purchaseDate': instance.purchaseDate?.toIso8601String(),
|
||||
'purchasePrice': instance.purchasePrice,
|
||||
'status': instance.status,
|
||||
'currentCompanyId': instance.currentCompanyId,
|
||||
'currentBranchId': instance.currentBranchId,
|
||||
'warehouseLocationId': instance.warehouseLocationId,
|
||||
'lastInspectionDate': instance.lastInspectionDate?.toIso8601String(),
|
||||
'nextInspectionDate': instance.nextInspectionDate?.toIso8601String(),
|
||||
'remark': instance.remark,
|
||||
};
|
||||
37
lib/data/models/equipment/equipment_response.dart
Normal file
37
lib/data/models/equipment/equipment_response.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'equipment_response.freezed.dart';
|
||||
part 'equipment_response.g.dart';
|
||||
|
||||
@freezed
|
||||
class EquipmentResponse with _$EquipmentResponse {
|
||||
const factory EquipmentResponse({
|
||||
required int id,
|
||||
required String equipmentNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
required String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String? barcode,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
required String status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime? lastInspectionDate,
|
||||
DateTime? nextInspectionDate,
|
||||
String? remark,
|
||||
required DateTime createdAt,
|
||||
required DateTime updatedAt,
|
||||
// 추가 필드 (조인된 데이터)
|
||||
String? companyName,
|
||||
String? branchName,
|
||||
String? warehouseName,
|
||||
}) = _EquipmentResponse;
|
||||
|
||||
factory EquipmentResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentResponseFromJson(json);
|
||||
}
|
||||
655
lib/data/models/equipment/equipment_response.freezed.dart
Normal file
655
lib/data/models/equipment/equipment_response.freezed.dart
Normal file
@@ -0,0 +1,655 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'equipment_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
EquipmentResponse _$EquipmentResponseFromJson(Map<String, dynamic> json) {
|
||||
return _EquipmentResponse.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentResponse {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
String get equipmentNumber => throw _privateConstructorUsedError;
|
||||
String? get category1 => throw _privateConstructorUsedError;
|
||||
String? get category2 => throw _privateConstructorUsedError;
|
||||
String? get category3 => throw _privateConstructorUsedError;
|
||||
String get manufacturer => throw _privateConstructorUsedError;
|
||||
String? get modelName => throw _privateConstructorUsedError;
|
||||
String? get serialNumber => throw _privateConstructorUsedError;
|
||||
String? get barcode => throw _privateConstructorUsedError;
|
||||
DateTime? get purchaseDate => throw _privateConstructorUsedError;
|
||||
double? get purchasePrice => throw _privateConstructorUsedError;
|
||||
String get status => throw _privateConstructorUsedError;
|
||||
int? get currentCompanyId => throw _privateConstructorUsedError;
|
||||
int? get currentBranchId => throw _privateConstructorUsedError;
|
||||
int? get warehouseLocationId => throw _privateConstructorUsedError;
|
||||
DateTime? get lastInspectionDate => throw _privateConstructorUsedError;
|
||||
DateTime? get nextInspectionDate => throw _privateConstructorUsedError;
|
||||
String? get remark => throw _privateConstructorUsedError;
|
||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||
DateTime get updatedAt =>
|
||||
throw _privateConstructorUsedError; // 추가 필드 (조인된 데이터)
|
||||
String? get companyName => throw _privateConstructorUsedError;
|
||||
String? get branchName => throw _privateConstructorUsedError;
|
||||
String? get warehouseName => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentResponse to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentResponseCopyWith<EquipmentResponse> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentResponseCopyWith<$Res> {
|
||||
factory $EquipmentResponseCopyWith(
|
||||
EquipmentResponse value, $Res Function(EquipmentResponse) then) =
|
||||
_$EquipmentResponseCopyWithImpl<$Res, EquipmentResponse>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String equipmentNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String? barcode,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime? lastInspectionDate,
|
||||
DateTime? nextInspectionDate,
|
||||
String? remark,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
String? companyName,
|
||||
String? branchName,
|
||||
String? warehouseName});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentResponseCopyWithImpl<$Res, $Val extends EquipmentResponse>
|
||||
implements $EquipmentResponseCopyWith<$Res> {
|
||||
_$EquipmentResponseCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? equipmentNumber = null,
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? barcode = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? status = null,
|
||||
Object? currentCompanyId = freezed,
|
||||
Object? currentBranchId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? lastInspectionDate = freezed,
|
||||
Object? nextInspectionDate = freezed,
|
||||
Object? remark = freezed,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
Object? companyName = freezed,
|
||||
Object? branchName = freezed,
|
||||
Object? warehouseName = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
barcode: freezed == barcode
|
||||
? _value.barcode
|
||||
: barcode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
purchasePrice: freezed == purchasePrice
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
currentCompanyId: freezed == currentCompanyId
|
||||
? _value.currentCompanyId
|
||||
: currentCompanyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
currentBranchId: freezed == currentBranchId
|
||||
? _value.currentBranchId
|
||||
: currentBranchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
lastInspectionDate: freezed == lastInspectionDate
|
||||
? _value.lastInspectionDate
|
||||
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
nextInspectionDate: freezed == nextInspectionDate
|
||||
? _value.nextInspectionDate
|
||||
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
branchName: freezed == branchName
|
||||
? _value.branchName
|
||||
: branchName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
warehouseName: freezed == warehouseName
|
||||
? _value.warehouseName
|
||||
: warehouseName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentResponseImplCopyWith<$Res>
|
||||
implements $EquipmentResponseCopyWith<$Res> {
|
||||
factory _$$EquipmentResponseImplCopyWith(_$EquipmentResponseImpl value,
|
||||
$Res Function(_$EquipmentResponseImpl) then) =
|
||||
__$$EquipmentResponseImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String equipmentNumber,
|
||||
String? category1,
|
||||
String? category2,
|
||||
String? category3,
|
||||
String manufacturer,
|
||||
String? modelName,
|
||||
String? serialNumber,
|
||||
String? barcode,
|
||||
DateTime? purchaseDate,
|
||||
double? purchasePrice,
|
||||
String status,
|
||||
int? currentCompanyId,
|
||||
int? currentBranchId,
|
||||
int? warehouseLocationId,
|
||||
DateTime? lastInspectionDate,
|
||||
DateTime? nextInspectionDate,
|
||||
String? remark,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
String? companyName,
|
||||
String? branchName,
|
||||
String? warehouseName});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentResponseImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentResponseCopyWithImpl<$Res, _$EquipmentResponseImpl>
|
||||
implements _$$EquipmentResponseImplCopyWith<$Res> {
|
||||
__$$EquipmentResponseImplCopyWithImpl(_$EquipmentResponseImpl _value,
|
||||
$Res Function(_$EquipmentResponseImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? equipmentNumber = null,
|
||||
Object? category1 = freezed,
|
||||
Object? category2 = freezed,
|
||||
Object? category3 = freezed,
|
||||
Object? manufacturer = null,
|
||||
Object? modelName = freezed,
|
||||
Object? serialNumber = freezed,
|
||||
Object? barcode = freezed,
|
||||
Object? purchaseDate = freezed,
|
||||
Object? purchasePrice = freezed,
|
||||
Object? status = null,
|
||||
Object? currentCompanyId = freezed,
|
||||
Object? currentBranchId = freezed,
|
||||
Object? warehouseLocationId = freezed,
|
||||
Object? lastInspectionDate = freezed,
|
||||
Object? nextInspectionDate = freezed,
|
||||
Object? remark = freezed,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
Object? companyName = freezed,
|
||||
Object? branchName = freezed,
|
||||
Object? warehouseName = freezed,
|
||||
}) {
|
||||
return _then(_$EquipmentResponseImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentNumber: null == equipmentNumber
|
||||
? _value.equipmentNumber
|
||||
: equipmentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
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?,
|
||||
serialNumber: freezed == serialNumber
|
||||
? _value.serialNumber
|
||||
: serialNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
barcode: freezed == barcode
|
||||
? _value.barcode
|
||||
: barcode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
purchaseDate: freezed == purchaseDate
|
||||
? _value.purchaseDate
|
||||
: purchaseDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
purchasePrice: freezed == purchasePrice
|
||||
? _value.purchasePrice
|
||||
: purchasePrice // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
currentCompanyId: freezed == currentCompanyId
|
||||
? _value.currentCompanyId
|
||||
: currentCompanyId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
currentBranchId: freezed == currentBranchId
|
||||
? _value.currentBranchId
|
||||
: currentBranchId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
warehouseLocationId: freezed == warehouseLocationId
|
||||
? _value.warehouseLocationId
|
||||
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
lastInspectionDate: freezed == lastInspectionDate
|
||||
? _value.lastInspectionDate
|
||||
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
nextInspectionDate: freezed == nextInspectionDate
|
||||
? _value.nextInspectionDate
|
||||
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
remark: freezed == remark
|
||||
? _value.remark
|
||||
: remark // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
companyName: freezed == companyName
|
||||
? _value.companyName
|
||||
: companyName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
branchName: freezed == branchName
|
||||
? _value.branchName
|
||||
: branchName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
warehouseName: freezed == warehouseName
|
||||
? _value.warehouseName
|
||||
: warehouseName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentResponseImpl implements _EquipmentResponse {
|
||||
const _$EquipmentResponseImpl(
|
||||
{required this.id,
|
||||
required this.equipmentNumber,
|
||||
this.category1,
|
||||
this.category2,
|
||||
this.category3,
|
||||
required this.manufacturer,
|
||||
this.modelName,
|
||||
this.serialNumber,
|
||||
this.barcode,
|
||||
this.purchaseDate,
|
||||
this.purchasePrice,
|
||||
required this.status,
|
||||
this.currentCompanyId,
|
||||
this.currentBranchId,
|
||||
this.warehouseLocationId,
|
||||
this.lastInspectionDate,
|
||||
this.nextInspectionDate,
|
||||
this.remark,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.companyName,
|
||||
this.branchName,
|
||||
this.warehouseName});
|
||||
|
||||
factory _$EquipmentResponseImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentResponseImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String equipmentNumber;
|
||||
@override
|
||||
final String? category1;
|
||||
@override
|
||||
final String? category2;
|
||||
@override
|
||||
final String? category3;
|
||||
@override
|
||||
final String manufacturer;
|
||||
@override
|
||||
final String? modelName;
|
||||
@override
|
||||
final String? serialNumber;
|
||||
@override
|
||||
final String? barcode;
|
||||
@override
|
||||
final DateTime? purchaseDate;
|
||||
@override
|
||||
final double? purchasePrice;
|
||||
@override
|
||||
final String status;
|
||||
@override
|
||||
final int? currentCompanyId;
|
||||
@override
|
||||
final int? currentBranchId;
|
||||
@override
|
||||
final int? warehouseLocationId;
|
||||
@override
|
||||
final DateTime? lastInspectionDate;
|
||||
@override
|
||||
final DateTime? nextInspectionDate;
|
||||
@override
|
||||
final String? remark;
|
||||
@override
|
||||
final DateTime createdAt;
|
||||
@override
|
||||
final DateTime updatedAt;
|
||||
// 추가 필드 (조인된 데이터)
|
||||
@override
|
||||
final String? companyName;
|
||||
@override
|
||||
final String? branchName;
|
||||
@override
|
||||
final String? warehouseName;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentResponse(id: $id, equipmentNumber: $equipmentNumber, category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, barcode: $barcode, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, status: $status, currentCompanyId: $currentCompanyId, currentBranchId: $currentBranchId, warehouseLocationId: $warehouseLocationId, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark, createdAt: $createdAt, updatedAt: $updatedAt, companyName: $companyName, branchName: $branchName, warehouseName: $warehouseName)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentResponseImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.equipmentNumber, equipmentNumber) ||
|
||||
other.equipmentNumber == equipmentNumber) &&
|
||||
(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.modelName, modelName) ||
|
||||
other.modelName == modelName) &&
|
||||
(identical(other.serialNumber, serialNumber) ||
|
||||
other.serialNumber == serialNumber) &&
|
||||
(identical(other.barcode, barcode) || other.barcode == barcode) &&
|
||||
(identical(other.purchaseDate, purchaseDate) ||
|
||||
other.purchaseDate == purchaseDate) &&
|
||||
(identical(other.purchasePrice, purchasePrice) ||
|
||||
other.purchasePrice == purchasePrice) &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.currentCompanyId, currentCompanyId) ||
|
||||
other.currentCompanyId == currentCompanyId) &&
|
||||
(identical(other.currentBranchId, currentBranchId) ||
|
||||
other.currentBranchId == currentBranchId) &&
|
||||
(identical(other.warehouseLocationId, warehouseLocationId) ||
|
||||
other.warehouseLocationId == warehouseLocationId) &&
|
||||
(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) ||
|
||||
other.updatedAt == updatedAt) &&
|
||||
(identical(other.companyName, companyName) ||
|
||||
other.companyName == companyName) &&
|
||||
(identical(other.branchName, branchName) ||
|
||||
other.branchName == branchName) &&
|
||||
(identical(other.warehouseName, warehouseName) ||
|
||||
other.warehouseName == warehouseName));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hashAll([
|
||||
runtimeType,
|
||||
id,
|
||||
equipmentNumber,
|
||||
category1,
|
||||
category2,
|
||||
category3,
|
||||
manufacturer,
|
||||
modelName,
|
||||
serialNumber,
|
||||
barcode,
|
||||
purchaseDate,
|
||||
purchasePrice,
|
||||
status,
|
||||
currentCompanyId,
|
||||
currentBranchId,
|
||||
warehouseLocationId,
|
||||
lastInspectionDate,
|
||||
nextInspectionDate,
|
||||
remark,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
companyName,
|
||||
branchName,
|
||||
warehouseName
|
||||
]);
|
||||
|
||||
/// Create a copy of EquipmentResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentResponseImplCopyWith<_$EquipmentResponseImpl> get copyWith =>
|
||||
__$$EquipmentResponseImplCopyWithImpl<_$EquipmentResponseImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentResponseImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentResponse implements EquipmentResponse {
|
||||
const factory _EquipmentResponse(
|
||||
{required final int id,
|
||||
required final String equipmentNumber,
|
||||
final String? category1,
|
||||
final String? category2,
|
||||
final String? category3,
|
||||
required final String manufacturer,
|
||||
final String? modelName,
|
||||
final String? serialNumber,
|
||||
final String? barcode,
|
||||
final DateTime? purchaseDate,
|
||||
final double? purchasePrice,
|
||||
required final String status,
|
||||
final int? currentCompanyId,
|
||||
final int? currentBranchId,
|
||||
final int? warehouseLocationId,
|
||||
final DateTime? lastInspectionDate,
|
||||
final DateTime? nextInspectionDate,
|
||||
final String? remark,
|
||||
required final DateTime createdAt,
|
||||
required final DateTime updatedAt,
|
||||
final String? companyName,
|
||||
final String? branchName,
|
||||
final String? warehouseName}) = _$EquipmentResponseImpl;
|
||||
|
||||
factory _EquipmentResponse.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentResponseImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
String get equipmentNumber;
|
||||
@override
|
||||
String? get category1;
|
||||
@override
|
||||
String? get category2;
|
||||
@override
|
||||
String? get category3;
|
||||
@override
|
||||
String get manufacturer;
|
||||
@override
|
||||
String? get modelName;
|
||||
@override
|
||||
String? get serialNumber;
|
||||
@override
|
||||
String? get barcode;
|
||||
@override
|
||||
DateTime? get purchaseDate;
|
||||
@override
|
||||
double? get purchasePrice;
|
||||
@override
|
||||
String get status;
|
||||
@override
|
||||
int? get currentCompanyId;
|
||||
@override
|
||||
int? get currentBranchId;
|
||||
@override
|
||||
int? get warehouseLocationId;
|
||||
@override
|
||||
DateTime? get lastInspectionDate;
|
||||
@override
|
||||
DateTime? get nextInspectionDate;
|
||||
@override
|
||||
String? get remark;
|
||||
@override
|
||||
DateTime get createdAt;
|
||||
@override
|
||||
DateTime get updatedAt; // 추가 필드 (조인된 데이터)
|
||||
@override
|
||||
String? get companyName;
|
||||
@override
|
||||
String? get branchName;
|
||||
@override
|
||||
String? get warehouseName;
|
||||
|
||||
/// Create a copy of EquipmentResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentResponseImplCopyWith<_$EquipmentResponseImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
69
lib/data/models/equipment/equipment_response.g.dart
Normal file
69
lib/data/models/equipment/equipment_response.g.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'equipment_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$EquipmentResponseImpl _$$EquipmentResponseImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentResponseImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
equipmentNumber: json['equipmentNumber'] as String,
|
||||
category1: json['category1'] as String?,
|
||||
category2: json['category2'] as String?,
|
||||
category3: json['category3'] as String?,
|
||||
manufacturer: json['manufacturer'] as String,
|
||||
modelName: json['modelName'] as String?,
|
||||
serialNumber: json['serialNumber'] as String?,
|
||||
barcode: json['barcode'] as String?,
|
||||
purchaseDate: json['purchaseDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['purchaseDate'] as String),
|
||||
purchasePrice: (json['purchasePrice'] as num?)?.toDouble(),
|
||||
status: json['status'] as String,
|
||||
currentCompanyId: (json['currentCompanyId'] as num?)?.toInt(),
|
||||
currentBranchId: (json['currentBranchId'] as num?)?.toInt(),
|
||||
warehouseLocationId: (json['warehouseLocationId'] as num?)?.toInt(),
|
||||
lastInspectionDate: json['lastInspectionDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['lastInspectionDate'] as String),
|
||||
nextInspectionDate: json['nextInspectionDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json['nextInspectionDate'] as String),
|
||||
remark: json['remark'] as String?,
|
||||
createdAt: DateTime.parse(json['createdAt'] as String),
|
||||
updatedAt: DateTime.parse(json['updatedAt'] as String),
|
||||
companyName: json['companyName'] as String?,
|
||||
branchName: json['branchName'] as String?,
|
||||
warehouseName: json['warehouseName'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentResponseImplToJson(
|
||||
_$EquipmentResponseImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'equipmentNumber': instance.equipmentNumber,
|
||||
'category1': instance.category1,
|
||||
'category2': instance.category2,
|
||||
'category3': instance.category3,
|
||||
'manufacturer': instance.manufacturer,
|
||||
'modelName': instance.modelName,
|
||||
'serialNumber': instance.serialNumber,
|
||||
'barcode': instance.barcode,
|
||||
'purchaseDate': instance.purchaseDate?.toIso8601String(),
|
||||
'purchasePrice': instance.purchasePrice,
|
||||
'status': instance.status,
|
||||
'currentCompanyId': instance.currentCompanyId,
|
||||
'currentBranchId': instance.currentBranchId,
|
||||
'warehouseLocationId': instance.warehouseLocationId,
|
||||
'lastInspectionDate': instance.lastInspectionDate?.toIso8601String(),
|
||||
'nextInspectionDate': instance.nextInspectionDate?.toIso8601String(),
|
||||
'remark': instance.remark,
|
||||
'createdAt': instance.createdAt.toIso8601String(),
|
||||
'updatedAt': instance.updatedAt.toIso8601String(),
|
||||
'companyName': instance.companyName,
|
||||
'branchName': instance.branchName,
|
||||
'warehouseName': instance.warehouseName,
|
||||
};
|
||||
@@ -5,8 +5,10 @@ import '../core/config/environment.dart';
|
||||
import '../data/datasources/remote/api_client.dart';
|
||||
import '../data/datasources/remote/auth_remote_datasource.dart';
|
||||
import '../data/datasources/remote/dashboard_remote_datasource.dart';
|
||||
import '../data/datasources/remote/equipment_remote_datasource.dart';
|
||||
import '../services/auth_service.dart';
|
||||
import '../services/dashboard_service.dart';
|
||||
import '../services/equipment_service.dart';
|
||||
|
||||
/// GetIt 인스턴스
|
||||
final getIt = GetIt.instance;
|
||||
@@ -30,6 +32,9 @@ Future<void> setupDependencies() async {
|
||||
getIt.registerLazySingleton<DashboardRemoteDataSource>(
|
||||
() => DashboardRemoteDataSourceImpl(getIt()),
|
||||
);
|
||||
getIt.registerLazySingleton<EquipmentRemoteDataSource>(
|
||||
() => EquipmentRemoteDataSourceImpl(),
|
||||
);
|
||||
|
||||
// 서비스
|
||||
getIt.registerLazySingleton<AuthService>(
|
||||
@@ -38,6 +43,9 @@ Future<void> setupDependencies() async {
|
||||
getIt.registerLazySingleton<DashboardService>(
|
||||
() => DashboardServiceImpl(getIt()),
|
||||
);
|
||||
getIt.registerLazySingleton<EquipmentService>(
|
||||
() => EquipmentService(),
|
||||
);
|
||||
|
||||
// 리포지토리
|
||||
// TODO: Repositories will be registered here
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/models/equipment_unified_model.dart';
|
||||
import 'package:superport/models/company_model.dart';
|
||||
import 'package:superport/services/equipment_service.dart';
|
||||
import 'package:superport/services/mock_data_service.dart';
|
||||
import 'package:superport/utils/constants.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
|
||||
/// 장비 입고 폼 컨트롤러
|
||||
///
|
||||
/// 폼의 전체 상태, 유효성, 저장, 데이터 로딩 등 비즈니스 로직을 담당한다.
|
||||
class EquipmentInFormController {
|
||||
class EquipmentInFormController extends ChangeNotifier {
|
||||
final MockDataService dataService;
|
||||
final EquipmentService _equipmentService = GetIt.instance<EquipmentService>();
|
||||
final int? equipmentInId;
|
||||
|
||||
bool _isLoading = false;
|
||||
String? _error;
|
||||
bool _isSaving = false;
|
||||
bool _useApi = true; // Feature flag
|
||||
|
||||
// Getters
|
||||
bool get isLoading => _isLoading;
|
||||
String? get error => _error;
|
||||
bool get isSaving => _isSaving;
|
||||
|
||||
// 폼 키
|
||||
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
@@ -167,11 +181,17 @@ class EquipmentInFormController {
|
||||
}
|
||||
|
||||
// 저장 처리
|
||||
bool save() {
|
||||
Future<bool> save() async {
|
||||
if (!formKey.currentState!.validate()) {
|
||||
return false;
|
||||
}
|
||||
formKey.currentState!.save();
|
||||
|
||||
_isSaving = true;
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
|
||||
// 입력값이 리스트에 없으면 추가
|
||||
if (partnerCompany != null &&
|
||||
@@ -221,31 +241,63 @@ class EquipmentInFormController {
|
||||
warrantyEndDate: warrantyEndDate,
|
||||
// 워런티 코드 저장 필요시 여기에 추가
|
||||
);
|
||||
if (isEditMode) {
|
||||
final equipmentIn = dataService.getEquipmentInById(equipmentInId!);
|
||||
if (equipmentIn != null) {
|
||||
final updatedEquipmentIn = EquipmentIn(
|
||||
id: equipmentIn.id,
|
||||
|
||||
if (_useApi) {
|
||||
// API 호출
|
||||
if (isEditMode) {
|
||||
// 수정 모드 - API로 장비 정보 업데이트
|
||||
await _equipmentService.updateEquipment(equipmentInId!, equipment);
|
||||
} else {
|
||||
// 생성 모드
|
||||
// 1. 먼저 장비 생성
|
||||
final createdEquipment = await _equipmentService.createEquipment(equipment);
|
||||
|
||||
// 2. 입고 처리 (warehouse location ID 필요)
|
||||
int? warehouseLocationId;
|
||||
if (warehouseLocation != null) {
|
||||
// TODO: 창고 위치 ID 가져오기 - 현재는 목 데이터에서 찾기
|
||||
final warehouse = dataService.getAllWarehouseLocations().firstWhere(
|
||||
(w) => w.name == warehouseLocation,
|
||||
orElse: () => null,
|
||||
);
|
||||
warehouseLocationId = warehouse?.id;
|
||||
}
|
||||
|
||||
await _equipmentService.equipmentIn(
|
||||
equipmentId: createdEquipment.id!,
|
||||
quantity: quantity,
|
||||
warehouseLocationId: warehouseLocationId,
|
||||
notes: remarkController.text.trim(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Mock 데이터 사용
|
||||
if (isEditMode) {
|
||||
final equipmentIn = dataService.getEquipmentInById(equipmentInId!);
|
||||
if (equipmentIn != null) {
|
||||
final updatedEquipmentIn = EquipmentIn(
|
||||
id: equipmentIn.id,
|
||||
equipment: equipment,
|
||||
inDate: inDate,
|
||||
status: equipmentIn.status,
|
||||
type: equipmentType,
|
||||
warehouseLocation: warehouseLocation,
|
||||
partnerCompany: partnerCompany,
|
||||
remark: remarkController.text.trim(),
|
||||
);
|
||||
dataService.updateEquipmentIn(updatedEquipmentIn);
|
||||
}
|
||||
} else {
|
||||
final newEquipmentIn = EquipmentIn(
|
||||
equipment: equipment,
|
||||
inDate: inDate,
|
||||
status: equipmentIn.status,
|
||||
type: equipmentType,
|
||||
warehouseLocation: warehouseLocation,
|
||||
partnerCompany: partnerCompany,
|
||||
remark: remarkController.text.trim(),
|
||||
);
|
||||
dataService.updateEquipmentIn(updatedEquipmentIn);
|
||||
dataService.addEquipmentIn(newEquipmentIn);
|
||||
}
|
||||
} else {
|
||||
final newEquipmentIn = EquipmentIn(
|
||||
equipment: equipment,
|
||||
inDate: inDate,
|
||||
type: equipmentType,
|
||||
warehouseLocation: warehouseLocation,
|
||||
partnerCompany: partnerCompany,
|
||||
remark: remarkController.text.trim(),
|
||||
);
|
||||
dataService.addEquipmentIn(newEquipmentIn);
|
||||
}
|
||||
|
||||
// 저장 후 리스트 재로딩 (중복 방지 및 최신화)
|
||||
@@ -259,9 +311,35 @@ class EquipmentInFormController {
|
||||
_loadWarrantyLicenses();
|
||||
|
||||
return true;
|
||||
} on Failure catch (e) {
|
||||
_error = e.message;
|
||||
notifyListeners();
|
||||
return false;
|
||||
} catch (e) {
|
||||
_error = 'An unexpected error occurred: $e';
|
||||
notifyListeners();
|
||||
return false;
|
||||
} finally {
|
||||
_isSaving = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
// 에러 처리
|
||||
void clearError() {
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// API 사용 여부 토글 (테스트용)
|
||||
void toggleApiUsage() {
|
||||
_useApi = !_useApi;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
remarkController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/models/equipment_unified_model.dart';
|
||||
import 'package:superport/services/equipment_service.dart';
|
||||
import 'package:superport/services/mock_data_service.dart';
|
||||
import 'package:superport/utils/constants.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
import 'package:superport/models/equipment_unified_model.dart' as legacy;
|
||||
|
||||
// companyTypeToString 함수 import
|
||||
import 'package:superport/utils/constants.dart'
|
||||
@@ -9,28 +14,98 @@ import 'package:superport/models/company_model.dart';
|
||||
import 'package:superport/models/address_model.dart';
|
||||
|
||||
// 장비 목록 화면의 상태 및 비즈니스 로직을 담당하는 컨트롤러
|
||||
class EquipmentListController {
|
||||
class EquipmentListController extends ChangeNotifier {
|
||||
final MockDataService dataService;
|
||||
final EquipmentService _equipmentService = GetIt.instance<EquipmentService>();
|
||||
|
||||
List<UnifiedEquipment> equipments = [];
|
||||
String? selectedStatusFilter;
|
||||
final Set<String> selectedEquipmentIds = {}; // 'id:status' 형식
|
||||
|
||||
bool _isLoading = false;
|
||||
String? _error;
|
||||
bool _useApi = true; // Feature flag for API usage
|
||||
|
||||
// 페이지네이션
|
||||
int _currentPage = 1;
|
||||
final int _perPage = 20;
|
||||
bool _hasMore = true;
|
||||
|
||||
// Getters
|
||||
bool get isLoading => _isLoading;
|
||||
String? get error => _error;
|
||||
bool get hasMore => _hasMore;
|
||||
int get currentPage => _currentPage;
|
||||
|
||||
EquipmentListController({required this.dataService});
|
||||
|
||||
// 데이터 로드 및 상태 필터 적용
|
||||
void loadData() {
|
||||
equipments = dataService.getAllEquipments();
|
||||
if (selectedStatusFilter != null) {
|
||||
equipments =
|
||||
equipments.where((e) => e.status == selectedStatusFilter).toList();
|
||||
Future<void> loadData({bool isRefresh = false}) async {
|
||||
if (isRefresh) {
|
||||
_currentPage = 1;
|
||||
_hasMore = true;
|
||||
equipments.clear();
|
||||
}
|
||||
|
||||
if (_isLoading || (!_hasMore && !isRefresh)) return;
|
||||
|
||||
_isLoading = true;
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
if (_useApi) {
|
||||
// API 호출
|
||||
final apiEquipments = await _equipmentService.getEquipments(
|
||||
page: _currentPage,
|
||||
perPage: _perPage,
|
||||
status: selectedStatusFilter,
|
||||
);
|
||||
|
||||
// API 모델을 UnifiedEquipment로 변환
|
||||
final unifiedEquipments = apiEquipments.map((equipment) {
|
||||
return UnifiedEquipment(
|
||||
id: equipment.id,
|
||||
equipment: equipment,
|
||||
quantity: equipment.quantity,
|
||||
status: EquipmentStatus.in_, // 기본값, 실제로는 API에서 가져와야 함
|
||||
locationTrack: LocationTrack.inStock,
|
||||
);
|
||||
}).toList();
|
||||
|
||||
if (isRefresh) {
|
||||
equipments = unifiedEquipments;
|
||||
} else {
|
||||
equipments.addAll(unifiedEquipments);
|
||||
}
|
||||
|
||||
_hasMore = unifiedEquipments.length == _perPage;
|
||||
if (_hasMore) _currentPage++;
|
||||
} else {
|
||||
// Mock 데이터 사용
|
||||
equipments = dataService.getAllEquipments();
|
||||
if (selectedStatusFilter != null) {
|
||||
equipments =
|
||||
equipments.where((e) => e.status == selectedStatusFilter).toList();
|
||||
}
|
||||
_hasMore = false;
|
||||
}
|
||||
|
||||
selectedEquipmentIds.clear();
|
||||
} on Failure catch (e) {
|
||||
_error = e.message;
|
||||
} catch (e) {
|
||||
_error = 'An unexpected error occurred: $e';
|
||||
} finally {
|
||||
_isLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
selectedEquipmentIds.clear();
|
||||
}
|
||||
|
||||
// 상태 필터 변경
|
||||
void changeStatusFilter(String? status) {
|
||||
Future<void> changeStatusFilter(String? status) async {
|
||||
selectedStatusFilter = status;
|
||||
loadData();
|
||||
await loadData(isRefresh: true);
|
||||
}
|
||||
|
||||
// 장비 선택/해제 (모든 상태 지원)
|
||||
@@ -42,6 +117,7 @@ class EquipmentListController {
|
||||
} else {
|
||||
selectedEquipmentIds.remove(key);
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// 선택된 입고 장비 수 반환
|
||||
@@ -167,4 +243,21 @@ class EquipmentListController {
|
||||
}
|
||||
return '-';
|
||||
}
|
||||
|
||||
// API 사용 여부 토글 (테스트용)
|
||||
void toggleApiUsage() {
|
||||
_useApi = !_useApi;
|
||||
loadData(isRefresh: true);
|
||||
}
|
||||
|
||||
// 에러 처리
|
||||
void clearError() {
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/models/equipment_unified_model.dart';
|
||||
import 'package:superport/models/company_model.dart';
|
||||
import 'package:superport/models/address_model.dart';
|
||||
import 'package:superport/services/equipment_service.dart';
|
||||
import 'package:superport/services/mock_data_service.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
|
||||
// 장비 출고 폼의 상태 및 비즈니스 로직을 담당하는 컨트롤러
|
||||
class EquipmentOutFormController {
|
||||
class EquipmentOutFormController extends ChangeNotifier {
|
||||
final MockDataService dataService;
|
||||
final EquipmentService _equipmentService = GetIt.instance<EquipmentService>();
|
||||
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
final TextEditingController remarkController = TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
String? _error;
|
||||
bool _isSaving = false;
|
||||
bool _useApi = true; // Feature flag
|
||||
|
||||
// Getters
|
||||
bool get isLoading => _isLoading;
|
||||
String? get error => _error;
|
||||
bool get isSaving => _isSaving;
|
||||
|
||||
// 상태 변수
|
||||
bool isEditMode = false;
|
||||
@@ -361,12 +375,18 @@ class EquipmentOutFormController {
|
||||
}
|
||||
|
||||
// 출고 정보 저장 (UI에서 호출)
|
||||
void saveEquipmentOut(Function(String) onSuccess, Function(String) onError) {
|
||||
Future<void> saveEquipmentOut(Function(String) onSuccess, Function(String) onError) async {
|
||||
if (formKey.currentState?.validate() != true) {
|
||||
onError('폼 유효성 검사 실패');
|
||||
return;
|
||||
}
|
||||
formKey.currentState?.save();
|
||||
|
||||
_isSaving = true;
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
|
||||
// 선택된 회사가 없는지 확인
|
||||
bool hasAnySelectedCompany = selectedCompanies.any(
|
||||
@@ -400,25 +420,70 @@ class EquipmentOutFormController {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEditMode && equipmentOutId != null) {
|
||||
final equipmentOut = dataService.getEquipmentOutById(equipmentOutId!);
|
||||
if (equipmentOut != null) {
|
||||
final updatedEquipmentOut = EquipmentOut(
|
||||
id: equipmentOut.id,
|
||||
equipment: equipmentOut.equipment,
|
||||
outDate: equipmentOut.outDate,
|
||||
status: returnType == '재입고' ? 'I' : 'R',
|
||||
company: companyName,
|
||||
manager: equipmentOut.manager,
|
||||
license: equipmentOut.license,
|
||||
returnDate: returnDate,
|
||||
returnType: returnType,
|
||||
remark: remarkController.text.trim(),
|
||||
);
|
||||
dataService.updateEquipmentOut(updatedEquipmentOut);
|
||||
onSuccess('장비 출고 상태 변경 완료');
|
||||
if (_useApi) {
|
||||
// API 호출 방식
|
||||
if (isEditMode && equipmentOutId != null) {
|
||||
// TODO: 출고 정보 업데이트 API 호출
|
||||
throw UnimplementedError('Equipment out update API not implemented yet');
|
||||
} else {
|
||||
onError('출고 정보를 찾을 수 없습니다');
|
||||
// 장비 출고 처리
|
||||
if (selectedEquipments != null && selectedEquipments!.isNotEmpty) {
|
||||
for (var equipmentData in selectedEquipments!) {
|
||||
final equipment = equipmentData['equipment'] as Equipment;
|
||||
if (equipment.id != null) {
|
||||
// 회사 ID 가져오기 - 현재는 목 데이터에서 찾기
|
||||
CompanyBranchInfo? companyInfo = _findCompanyInfoByDisplayName(
|
||||
selectedCompanies[0]!,
|
||||
);
|
||||
|
||||
int? companyId = companyInfo?.companyId;
|
||||
int? branchId = companyInfo?.branchId;
|
||||
|
||||
if (companyId == null) {
|
||||
// 목 데이터에서 회사 ID 찾기
|
||||
final company = dataService.getAllCompanies().firstWhere(
|
||||
(c) => c.name == companyName,
|
||||
orElse: () => null,
|
||||
);
|
||||
companyId = company?.id;
|
||||
}
|
||||
|
||||
if (companyId != null) {
|
||||
await _equipmentService.equipmentOut(
|
||||
equipmentId: equipment.id!,
|
||||
quantity: equipment.quantity,
|
||||
companyId: companyId,
|
||||
branchId: branchId,
|
||||
notes: remarkController.text.trim(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
onSuccess('장비 출고 완료');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Mock 데이터 사용
|
||||
if (isEditMode && equipmentOutId != null) {
|
||||
final equipmentOut = dataService.getEquipmentOutById(equipmentOutId!);
|
||||
if (equipmentOut != null) {
|
||||
final updatedEquipmentOut = EquipmentOut(
|
||||
id: equipmentOut.id,
|
||||
equipment: equipmentOut.equipment,
|
||||
outDate: equipmentOut.outDate,
|
||||
status: returnType == '재입고' ? 'I' : 'R',
|
||||
company: companyName,
|
||||
manager: equipmentOut.manager,
|
||||
license: equipmentOut.license,
|
||||
returnDate: returnDate,
|
||||
returnType: returnType,
|
||||
remark: remarkController.text.trim(),
|
||||
);
|
||||
dataService.updateEquipmentOut(updatedEquipmentOut);
|
||||
onSuccess('장비 출고 상태 변경 완료');
|
||||
} else {
|
||||
onError('출고 정보를 찾을 수 없습니다');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (selectedEquipments != null && selectedEquipments!.isNotEmpty) {
|
||||
@@ -609,15 +674,39 @@ class EquipmentOutFormController {
|
||||
}
|
||||
}
|
||||
}
|
||||
} on Failure catch (e) {
|
||||
_error = e.message;
|
||||
onError(e.message);
|
||||
} catch (e) {
|
||||
_error = 'An unexpected error occurred: $e';
|
||||
onError(_error!);
|
||||
} finally {
|
||||
_isSaving = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
// 날짜 포맷 유틸리티
|
||||
String formatDate(DateTime date) {
|
||||
return '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
// 에러 처리
|
||||
void clearError() {
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// API 사용 여부 토글 (테스트용)
|
||||
void toggleApiUsage() {
|
||||
_useApi = !_useApi;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
remarkController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:superport/models/equipment_unified_model.dart';
|
||||
import 'package:superport/screens/common/custom_widgets.dart';
|
||||
import 'package:superport/screens/common/theme_tailwind.dart';
|
||||
@@ -350,9 +351,51 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void _saveEquipmentIn() {
|
||||
if (_controller.save()) {
|
||||
Navigator.pop(context, true);
|
||||
Future<void> _saveEquipmentIn() async {
|
||||
// 로딩 다이얼로그 표시
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
|
||||
try {
|
||||
final success = await _controller.save();
|
||||
|
||||
// 로딩 다이얼로그 닫기
|
||||
Navigator.pop(context);
|
||||
|
||||
if (success) {
|
||||
// 성공 메시지 표시
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.isEditMode ? '장비 입고가 수정되었습니다.' : '장비 입고가 등록되었습니다.'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
Navigator.pop(context, true);
|
||||
} else {
|
||||
// 에러 메시지 표시
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.error ?? '저장 중 오류가 발생했습니다.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
// 로딩 다이얼로그 닫기
|
||||
Navigator.pop(context);
|
||||
|
||||
// 예외 처리
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('오류: $e'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1095,7 +1138,10 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
print(
|
||||
'[구매처:autocomplete] 입력값: "$inputText", 자동완성 후보: "$suggestion", showSuggestion=$showSuggestion',
|
||||
);
|
||||
return GestureDetector(
|
||||
return ChangeNotifierProvider<EquipmentInFormController>.value(
|
||||
value: _controller,
|
||||
child: Consumer<EquipmentInFormController>(
|
||||
builder: (context, controller, child) => GestureDetector(
|
||||
// 화면의 다른 곳을 탭하면 모든 드롭다운 닫기
|
||||
onTap: () {
|
||||
// 현재 포커스된 위젯 포커스 해제
|
||||
@@ -2262,6 +2308,8 @@ class _EquipmentInFormScreenState extends State<EquipmentInFormScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||
import 'package:superport/screens/equipment/controllers/equipment_list_controller.dart';
|
||||
@@ -20,7 +21,6 @@ class EquipmentListRedesign extends StatefulWidget {
|
||||
|
||||
class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
late final EquipmentListController _controller;
|
||||
bool _isLoading = false;
|
||||
bool _showDetailedColumns = true;
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
final ScrollController _horizontalScrollController = ScrollController();
|
||||
@@ -36,8 +36,14 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
super.initState();
|
||||
_controller = EquipmentListController(dataService: MockDataService());
|
||||
_setInitialFilter();
|
||||
_controller.loadData(); // 원본과 동일하게 직접 호출
|
||||
print('DEBUG: Equipment count after loadData: ${_controller.equipments.length}'); // 디버그 정보
|
||||
|
||||
// 무한 스크롤 리스너 추가
|
||||
_verticalScrollController.addListener(_onScroll);
|
||||
|
||||
// API 호출을 위해 Future로 변경
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_controller.loadData(); // 비동기 호출
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -45,6 +51,7 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
_searchController.dispose();
|
||||
_horizontalScrollController.dispose();
|
||||
_verticalScrollController.dispose();
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -85,12 +92,12 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
}
|
||||
|
||||
/// 데이터 로드
|
||||
void _loadData() {
|
||||
_controller.loadData();
|
||||
Future<void> _loadData({bool isRefresh = false}) async {
|
||||
await _controller.loadData(isRefresh: isRefresh);
|
||||
}
|
||||
|
||||
/// 상태 필터 변경
|
||||
void _onStatusFilterChanged(String status) {
|
||||
Future<void> _onStatusFilterChanged(String status) async {
|
||||
setState(() {
|
||||
_selectedStatus = status;
|
||||
// 상태 필터를 EquipmentStatus 상수로 변환
|
||||
@@ -103,9 +110,9 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
} else if (status == 'rent') {
|
||||
_controller.selectedStatusFilter = EquipmentStatus.rent;
|
||||
}
|
||||
_controller.loadData();
|
||||
_currentPage = 1;
|
||||
});
|
||||
await _controller.changeStatusFilter(_controller.selectedStatusFilter);
|
||||
}
|
||||
|
||||
/// 검색 실행
|
||||
@@ -141,6 +148,17 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
_controller.selectedEquipmentIds.contains('${e.id}:${e.status}'));
|
||||
}
|
||||
|
||||
/// 스크롤 이벤트 처리 (무한 스크롤)
|
||||
void _onScroll() {
|
||||
if (_verticalScrollController.position.pixels >=
|
||||
_verticalScrollController.position.maxScrollExtent * 0.8) {
|
||||
// 스크롤이 80% 이상 내려갔을 때 다음 페이지 로드
|
||||
if (!_controller.isLoading && _controller.hasMore) {
|
||||
_controller.loadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 필터링된 장비 목록 반환
|
||||
List<UnifiedEquipment> _getFilteredEquipments() {
|
||||
var equipments = _controller.equipments;
|
||||
@@ -325,24 +343,35 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 선택된 장비 개수
|
||||
final int selectedCount = _controller.getSelectedEquipmentCount();
|
||||
final int selectedInCount = _controller.getSelectedInStockCount();
|
||||
final int selectedOutCount = _controller.getSelectedEquipmentCountByStatus(EquipmentStatus.out);
|
||||
final int selectedRentCount = _controller.getSelectedEquipmentCountByStatus(EquipmentStatus.rent);
|
||||
return ChangeNotifierProvider<EquipmentListController>.value(
|
||||
value: _controller,
|
||||
child: Consumer<EquipmentListController>(
|
||||
builder: (context, controller, child) {
|
||||
// 선택된 장비 개수
|
||||
final int selectedCount = controller.getSelectedEquipmentCount();
|
||||
final int selectedInCount = controller.getSelectedInStockCount();
|
||||
final int selectedOutCount = controller.getSelectedEquipmentCountByStatus(EquipmentStatus.out);
|
||||
final int selectedRentCount = controller.getSelectedEquipmentCountByStatus(EquipmentStatus.rent);
|
||||
|
||||
return Container(
|
||||
color: ShadcnTheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
// 필터 및 액션 바
|
||||
_buildFilterBar(selectedCount, selectedInCount, selectedOutCount, selectedRentCount),
|
||||
return Container(
|
||||
color: ShadcnTheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
// 필터 및 액션 바
|
||||
_buildFilterBar(selectedCount, selectedInCount, selectedOutCount, selectedRentCount),
|
||||
|
||||
// 장비 테이블
|
||||
Expanded(
|
||||
child: _isLoading ? _buildLoadingState() : _buildEquipmentTable(),
|
||||
),
|
||||
],
|
||||
// 장비 테이블
|
||||
Expanded(
|
||||
child: controller.isLoading
|
||||
? _buildLoadingState()
|
||||
: controller.error != null
|
||||
? _buildErrorState()
|
||||
: _buildEquipmentTable(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -606,6 +635,30 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 에러 상태 위젯
|
||||
Widget _buildErrorState() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline, size: 48, color: ShadcnTheme.destructive),
|
||||
const SizedBox(height: 16),
|
||||
Text('데이터를 불러오는 중 오류가 발생했습니다.', style: ShadcnTheme.bodyMuted),
|
||||
const SizedBox(height: 8),
|
||||
Text(_controller.error ?? '', style: ShadcnTheme.bodySmall),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () => _controller.loadData(isRefresh: true),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ShadcnTheme.primary,
|
||||
),
|
||||
child: const Text('다시 시도'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 테이블 너비 계산
|
||||
double _calculateTableWidth(List<UnifiedEquipment> pagedEquipments) {
|
||||
double totalWidth = 0;
|
||||
|
||||
247
lib/services/equipment_service.dart
Normal file
247
lib/services/equipment_service.dart
Normal file
@@ -0,0 +1,247 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/core/errors/exceptions.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
import 'package:superport/data/datasources/remote/equipment_remote_datasource.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_history_dto.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_in_request.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_io_response.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_list_dto.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_out_request.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_request.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_response.dart';
|
||||
import 'package:superport/models/equipment_unified_model.dart';
|
||||
import 'package:superport/utils/constants.dart';
|
||||
|
||||
class EquipmentService {
|
||||
final EquipmentRemoteDataSource _remoteDataSource = GetIt.instance<EquipmentRemoteDataSource>();
|
||||
|
||||
// 장비 목록 조회
|
||||
Future<List<Equipment>> getEquipments({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? status,
|
||||
int? companyId,
|
||||
int? warehouseLocationId,
|
||||
}) async {
|
||||
try {
|
||||
final dtoList = await _remoteDataSource.getEquipments(
|
||||
page: page,
|
||||
perPage: perPage,
|
||||
status: status,
|
||||
companyId: companyId,
|
||||
warehouseLocationId: warehouseLocationId,
|
||||
);
|
||||
|
||||
return dtoList.map((dto) => _convertListDtoToEquipment(dto)).toList();
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to fetch equipment list: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 생성
|
||||
Future<Equipment> createEquipment(Equipment equipment) async {
|
||||
try {
|
||||
final request = CreateEquipmentRequest(
|
||||
equipmentNumber: equipment.name, // Flutter model uses 'name' for equipment number
|
||||
category1: equipment.category,
|
||||
category2: equipment.subCategory,
|
||||
category3: equipment.subSubCategory,
|
||||
manufacturer: equipment.manufacturer,
|
||||
modelName: equipment.name,
|
||||
serialNumber: equipment.serialNumber,
|
||||
purchaseDate: equipment.inDate,
|
||||
purchasePrice: equipment.quantity.toDouble(), // Temporary mapping
|
||||
remark: equipment.remark,
|
||||
);
|
||||
|
||||
final response = await _remoteDataSource.createEquipment(request);
|
||||
return _convertResponseToEquipment(response);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to create equipment: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 상세 조회
|
||||
Future<Equipment> getEquipmentDetail(int id) async {
|
||||
try {
|
||||
final response = await _remoteDataSource.getEquipmentDetail(id);
|
||||
return _convertResponseToEquipment(response);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to fetch equipment detail: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 수정
|
||||
Future<Equipment> updateEquipment(int id, Equipment equipment) async {
|
||||
try {
|
||||
final request = UpdateEquipmentRequest(
|
||||
category1: equipment.category,
|
||||
category2: equipment.subCategory,
|
||||
category3: equipment.subSubCategory,
|
||||
manufacturer: equipment.manufacturer,
|
||||
modelName: equipment.name,
|
||||
serialNumber: equipment.serialNumber,
|
||||
barcode: equipment.barcode,
|
||||
purchaseDate: equipment.inDate,
|
||||
purchasePrice: equipment.quantity.toDouble(), // Temporary mapping
|
||||
remark: equipment.remark,
|
||||
);
|
||||
|
||||
final response = await _remoteDataSource.updateEquipment(id, request);
|
||||
return _convertResponseToEquipment(response);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to update equipment: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 삭제
|
||||
Future<void> deleteEquipment(int id) async {
|
||||
try {
|
||||
await _remoteDataSource.deleteEquipment(id);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to delete equipment: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 상태 변경
|
||||
Future<Equipment> changeEquipmentStatus(int id, String status, String? reason) async {
|
||||
try {
|
||||
final response = await _remoteDataSource.changeEquipmentStatus(id, status, reason);
|
||||
return _convertResponseToEquipment(response);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to change equipment status: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 이력 추가
|
||||
Future<EquipmentHistoryDto> addEquipmentHistory(int equipmentId, String type, int quantity, String? remarks) async {
|
||||
try {
|
||||
final request = CreateHistoryRequest(
|
||||
transactionType: type,
|
||||
quantity: quantity,
|
||||
transactionDate: DateTime.now(),
|
||||
remarks: remarks,
|
||||
);
|
||||
|
||||
return await _remoteDataSource.addEquipmentHistory(equipmentId, request);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to add equipment history: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 이력 조회
|
||||
Future<List<EquipmentHistoryDto>> getEquipmentHistory(int equipmentId, {int page = 1, int perPage = 20}) async {
|
||||
try {
|
||||
return await _remoteDataSource.getEquipmentHistory(equipmentId, page: page, perPage: perPage);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to fetch equipment history: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 입고
|
||||
Future<EquipmentIoResponse> equipmentIn({
|
||||
required int equipmentId,
|
||||
required int quantity,
|
||||
int? warehouseLocationId,
|
||||
String? notes,
|
||||
}) async {
|
||||
try {
|
||||
final request = EquipmentInRequest(
|
||||
equipmentId: equipmentId,
|
||||
quantity: quantity,
|
||||
warehouseLocationId: warehouseLocationId,
|
||||
notes: notes,
|
||||
);
|
||||
|
||||
return await _remoteDataSource.equipmentIn(request);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to process equipment in: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 장비 출고
|
||||
Future<EquipmentIoResponse> equipmentOut({
|
||||
required int equipmentId,
|
||||
required int quantity,
|
||||
required int companyId,
|
||||
int? branchId,
|
||||
String? notes,
|
||||
}) async {
|
||||
try {
|
||||
final request = EquipmentOutRequest(
|
||||
equipmentId: equipmentId,
|
||||
quantity: quantity,
|
||||
companyId: companyId,
|
||||
branchId: branchId,
|
||||
notes: notes,
|
||||
);
|
||||
|
||||
return await _remoteDataSource.equipmentOut(request);
|
||||
} on ServerException catch (e) {
|
||||
throw Failure(message: e.message);
|
||||
} catch (e) {
|
||||
throw Failure(message: 'Failed to process equipment out: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// Private helper methods for model conversion
|
||||
Equipment _convertListDtoToEquipment(EquipmentListDto dto) {
|
||||
return Equipment(
|
||||
id: dto.id,
|
||||
manufacturer: dto.manufacturer,
|
||||
name: dto.modelName ?? dto.equipmentNumber,
|
||||
category: '', // Need to be fetched from detail or categories
|
||||
subCategory: '',
|
||||
subSubCategory: '',
|
||||
serialNumber: dto.serialNumber,
|
||||
barcode: null, // Not in list DTO
|
||||
quantity: 1, // Default quantity
|
||||
inDate: dto.createdAt,
|
||||
remark: null, // Not in list DTO
|
||||
);
|
||||
}
|
||||
|
||||
Equipment _convertResponseToEquipment(EquipmentResponse response) {
|
||||
return Equipment(
|
||||
id: response.id,
|
||||
manufacturer: response.manufacturer,
|
||||
name: response.modelName ?? response.equipmentNumber,
|
||||
category: response.category1 ?? '',
|
||||
subCategory: response.category2 ?? '',
|
||||
subSubCategory: response.category3 ?? '',
|
||||
serialNumber: response.serialNumber,
|
||||
barcode: response.barcode,
|
||||
quantity: 1, // Default quantity, actual quantity should be tracked in history
|
||||
inDate: response.purchaseDate,
|
||||
remark: response.remark,
|
||||
// Warranty information would need to be fetched from license API if available
|
||||
);
|
||||
}
|
||||
|
||||
// 장비 상태 상수
|
||||
static const Map<String, String> equipmentStatus = {
|
||||
'available': '사용 가능',
|
||||
'in_use': '사용 중',
|
||||
'maintenance': '유지보수 중',
|
||||
'repair': '수리 중',
|
||||
'disposed': '폐기',
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user