Added logic for day and night production quantity in send production report #1437

Merged
jothi merged 1 commits from ranjith-dev into master 2026-11-17 04:13:59 +00:00
Showing only changes of commit a9f0cf7819 - Show all commits

View File

@@ -326,7 +326,7 @@ class SendProductionReport extends Command
->whereBetween('created_at', [$startDate, $endDate])
->count();
}
else {
else if(strtolower($line->type) == 'base fg line'){
$productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
->where('line_id', $line->id)
@@ -470,10 +470,28 @@ class SendProductionReport extends Command
if (strtolower($line->type) == 'base fg line') {
$productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
$dayproductionQuantity = ProductionQuantity::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereBetween('created_at', [$startDate, $endDate])
->whereIn('item_id', $itemIds)
->whereBetween('created_at', [
$startDate->copy()->setTime(8, 0, 0),
$startDate->copy()->setTime(19, 30, 0),
])
->count();
$nightproductionQuantity = ProductionQuantity::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereIn('item_id', $itemIds)
->whereBetween('created_at', [
$startDate->copy()->setTime(19, 30, 0),
$endDate->copy()->setTime(8, 0, 0),
])
->count();
// $productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
// ->where('line_id', $line->id)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->count();
}
$dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0;