172 lines
3.8 KiB
TypeScript
172 lines
3.8 KiB
TypeScript
export interface PopulationDataPoint {
|
|
date: string;
|
|
population: number;
|
|
}
|
|
|
|
export interface LiveCount {
|
|
cameraId: string;
|
|
cameraName: string;
|
|
locationName: string;
|
|
count: number;
|
|
status: 'online' | 'offline' | 'processing';
|
|
imageUrl: string;
|
|
}
|
|
|
|
export interface FeedSackLogEntry {
|
|
id: string;
|
|
type: 'inbound' | 'usage' | 'outbound';
|
|
location: string;
|
|
cameraName: string;
|
|
count: number;
|
|
timestamp: Date;
|
|
}
|
|
|
|
export interface ManualFeedSackEntry {
|
|
id: string;
|
|
date: string; // ISO date string (YYYY-MM-DD)
|
|
cameraName: string;
|
|
count: number;
|
|
keterangan?: string; // Optional notes/remarks (max 200 chars)
|
|
createdBy?: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface CycleFeedInitialBalance {
|
|
id: number;
|
|
cycleId: string;
|
|
saldoAwal: number;
|
|
createdBy: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface FeedSackDailySummary {
|
|
day: number;
|
|
date: Date;
|
|
dateFormatted: string;
|
|
cameraCounts: {
|
|
[cameraName: string]: {
|
|
manual: number;
|
|
iot: number;
|
|
};
|
|
};
|
|
}
|
|
|
|
export interface AggregatedCountFloor {
|
|
floorId: string;
|
|
floorName: string;
|
|
count: number;
|
|
cameras: LiveCount[];
|
|
}
|
|
|
|
export interface AggregatedCountCoop {
|
|
coopId: string;
|
|
coopName: string;
|
|
totalCount: number;
|
|
floors: AggregatedCountFloor[];
|
|
}
|
|
|
|
export interface AggregatedCountLocation {
|
|
locationId: string;
|
|
locationName: string;
|
|
totalCount: number;
|
|
coops: AggregatedCountCoop[];
|
|
}
|
|
|
|
export type AggregatedCounts = AggregatedCountLocation[];
|
|
|
|
export interface FeedSackColumnConfig {
|
|
id: string;
|
|
label: string;
|
|
cameraName: string;
|
|
color: string;
|
|
type: 'inbound' | 'usage' | 'outbound';
|
|
kandangId?: number | null;
|
|
}
|
|
|
|
export const FEED_SACK_COLUMN_COLORS: string[] = [
|
|
'#22c55e', // green-500
|
|
'#eab308', // yellow-500
|
|
'#a855f7', // purple-500
|
|
'#ef4444', // red-500
|
|
'#3b82f6', // blue-500
|
|
'#f97316', // orange-500
|
|
'#fb923c', // orange-400
|
|
'#14b8a6', // teal-500
|
|
];
|
|
|
|
export const DEFAULT_FEED_SACK_COLUMNS: FeedSackColumnConfig[] = [
|
|
{
|
|
id: 'default-inbound-k1',
|
|
label: 'Karung Masuk',
|
|
cameraName: 'kandang_1_karung_masuk-check_pintu',
|
|
color: '#22c55e',
|
|
type: 'inbound',
|
|
kandangId: null,
|
|
},
|
|
{
|
|
id: 'default-usage-k1',
|
|
label: 'Karung Dituang',
|
|
cameraName: 'kandang_1_karung_pakan',
|
|
color: '#eab308',
|
|
type: 'usage',
|
|
kandangId: null,
|
|
},
|
|
{
|
|
id: 'default-usage-k2',
|
|
label: 'Karung Dituang',
|
|
cameraName: 'kandang_2_karung_pakan',
|
|
color: '#a855f7',
|
|
type: 'usage',
|
|
kandangId: null,
|
|
},
|
|
{
|
|
id: 'default-outbound-k1',
|
|
label: 'Karung Keluar',
|
|
cameraName: 'kandang_1_karung_keluar',
|
|
color: '#ef4444',
|
|
type: 'outbound',
|
|
kandangId: null,
|
|
},
|
|
];
|
|
|
|
export interface Kandang {
|
|
id: number;
|
|
name: string;
|
|
cageUuid?: string | null; // External cage UUID for scales API integration
|
|
docInCount?: number;
|
|
createdAt?: string;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
export interface MortalityRecord {
|
|
day: number;
|
|
date: string;
|
|
|
|
// Deplesi daily columns
|
|
stockAwal: number; // Calculated: prev day's stockAkhir or DOC In
|
|
mati: number; // Editable: mortality_count
|
|
afkir: number; // Editable: culled chickens
|
|
panen: number; // Editable: harvest count
|
|
beratPanen?: number; // Editable: harvest weight in kg (optional)
|
|
stockAkhir: number; // Calculated: stockAwal - mati - afkir - panen
|
|
|
|
// Chicken Counting (existing)
|
|
chickenCount?: number; // Editable: IoT count
|
|
|
|
// Persentase & Status
|
|
persentase: number; // Calculated: (chickenCount / stockAkhir) * 100
|
|
keterangan: string; // Editable: notes/remarks
|
|
|
|
// Legacy fields (keep for backward compatibility)
|
|
mortality: number; // Alias for mati
|
|
mortalityTotal: number; // Cumulative mortality
|
|
chickenLife: number; // Alias for stockAkhir
|
|
|
|
// Metadata
|
|
isEdited: boolean;
|
|
isToday?: boolean;
|
|
isFuture?: boolean;
|
|
}
|