Added sfg part validation line type in production report #1419
@@ -154,6 +154,7 @@ class SendProductionReport extends Command
|
|||||||
->whereIn('type', [
|
->whereIn('type', [
|
||||||
'Base FG Line',
|
'Base FG Line',
|
||||||
'Base FG Leak Test Line',
|
'Base FG Leak Test Line',
|
||||||
|
'SFG Part Validation Line',
|
||||||
'FG Line',
|
'FG Line',
|
||||||
'Process FG Line',
|
'Process FG Line',
|
||||||
'SFG Line',
|
'SFG Line',
|
||||||
@@ -162,9 +163,10 @@ class SendProductionReport extends Command
|
|||||||
CASE
|
CASE
|
||||||
WHEN LOWER(type) = 'fg line' THEN 0
|
WHEN LOWER(type) = 'fg line' THEN 0
|
||||||
WHEN LOWER(type) = 'base fg leak test line' THEN 1
|
WHEN LOWER(type) = 'base fg leak test line' THEN 1
|
||||||
WHEN LOWER(type) = 'base fg line' THEN 2
|
WHEN LOWER(type) = 'sfg part validation line' THEN 2
|
||||||
WHEN LOWER(type) = 'process fg line' THEN 3
|
WHEN LOWER(type) = 'base fg line' THEN 3
|
||||||
WHEN LOWER(type) = 'sfg line' THEN 4
|
WHEN LOWER(type) = 'process fg line' THEN 4
|
||||||
|
WHEN LOWER(type) = 'sfg line' THEN 5
|
||||||
ELSE 4
|
ELSE 4
|
||||||
END
|
END
|
||||||
")
|
")
|
||||||
@@ -292,6 +294,25 @@ class SendProductionReport extends Command
|
|||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
->count();
|
->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'){
|
else if(strtolower($line->type) == 'process fg line'){
|
||||||
$productionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id)
|
$productionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id)
|
||||||
@@ -393,6 +414,32 @@ class SendProductionReport extends Command
|
|||||||
->count();
|
->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;
|
$dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0;
|
||||||
|
|
||||||
$nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;
|
$nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user