Added sfg part validation line type in production report
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 4m2s
Laravel Larastan / larastan (pull_request) Failing after 4m22s

This commit is contained in:
dhanabalan
2026-11-14 14:26:03 +05:30
parent 14e6906e6c
commit 44c70f473d

View File

@@ -154,6 +154,7 @@ class SendProductionReport extends Command
->whereIn('type', [
'Base FG Line',
'Base FG Leak Test Line',
'SFG Part Validation Line',
'FG Line',
'Process FG Line',
'SFG Line',
@@ -162,9 +163,10 @@ class SendProductionReport extends Command
CASE
WHEN LOWER(type) = 'fg line' THEN 0
WHEN LOWER(type) = 'base fg leak test line' THEN 1
WHEN LOWER(type) = 'base fg line' THEN 2
WHEN LOWER(type) = 'process fg line' THEN 3
WHEN LOWER(type) = 'sfg line' THEN 4
WHEN LOWER(type) = 'sfg part validation line' THEN 2
WHEN LOWER(type) = 'base fg line' THEN 3
WHEN LOWER(type) = 'process fg line' THEN 4
WHEN LOWER(type) = 'sfg line' THEN 5
ELSE 4
END
")
@@ -292,6 +294,25 @@ class SendProductionReport extends Command
->whereBetween('created_at', [$startDate, $endDate])
->count();
}
else if (strtolower($line->type) == 'sfg part validation line') {
$productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereIn('item_id', $itemIds);
})
->whereBetween('created_at', [$startDate, $endDate])
->count();
$nonPlannedproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereNotIn('item_id', $itemIds);
})
->whereBetween('created_at', [$startDate, $endDate])
->count();
}
else if(strtolower($line->type) == 'process fg line'){
$productionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id)
@@ -393,6 +414,32 @@ class SendProductionReport extends Command
->count();
}
if (strtolower($line->type) == 'sfg part validation line') {
$dayproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereIn('item_id', $itemIds);
})
->whereBetween('created_at', [
$startDate->copy()->setTime(8, 0, 0),
$startDate->copy()->setTime(19, 30, 0),
])
->count();
$nightproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereIn('item_id', $itemIds);
})
->whereBetween('created_at', [
$startDate->copy()->setTime(19, 30, 0),
$endDate->copy()->setTime(8, 0, 0),
])
->count();
}
$dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0;
$nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;