Added logic for particualr plan for line 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 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Failing after 38s
Laravel Larastan / larastan (pull_request) Failing after 4m29s

This commit is contained in:
dhanabalan
2026-11-16 11:35:40 +05:30
parent f8a6dd4cda
commit 1ffa2d439b

View File

@@ -174,6 +174,7 @@ class SendProductionReport extends Command
foreach ($lines as $line) { foreach ($lines as $line) {
$hasProduction = false;
$dayproductionQuantity = 0; $dayproductionQuantity = 0;
$nightproductionQuantity = 0; $nightproductionQuantity = 0;
$productionQuantity = 0; $productionQuantity = 0;
@@ -265,16 +266,16 @@ class SendProductionReport extends Command
// $capacityQuan = $totalHourlyQuantity * 22.5; // $capacityQuan = $totalHourlyQuantity * 22.5;
$leaveDates = ProductionCalendar::where('plant_id', $plant->id) // $leaveDates = ProductionCalendar::where('plant_id', $plant->id)
->whereMonth('created_at', $month) // ->whereMonth('created_at', $month)
->whereYear('created_at', $year) // ->whereYear('created_at', $year)
->value('leave_dates'); // ->value('leave_dates');
$leaveDates = $leaveDates ? array_map('trim', explode(',', $leaveDates)) : []; // $leaveDates = $leaveDates ? array_map('trim', explode(',', $leaveDates)) : [];
if (in_array($startDate->format('Y-m-d'), $leaveDates)) { // if (in_array($startDate->format('Y-m-d'), $leaveDates)) {
$totalTargetQuantity = 0; // $totalTargetQuantity = 0;
} // }
if (strtolower($line->type) == 'fg line') { if (strtolower($line->type) == 'fg line') {
@@ -333,6 +334,26 @@ class SendProductionReport extends Command
->count(); ->count();
} }
if ($productionQuantity > 0) {
$hasProduction = true;
}
$leaveDates = ProductionCalendar::where('plant_id', $plant->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->value('leave_dates');
$leaveDates = $leaveDates
? array_map('trim', explode(',', $leaveDates))
: [];
if (
in_array($startDate->format('Y-m-d'), $leaveDates)
&& !$hasProduction
) {
$totalTargetQuantity = 0;
}
if ($totalTargetQuantity > 0) { if ($totalTargetQuantity > 0) {
$efficiency = ($productionQuantity / $totalTargetQuantity) * 100; $efficiency = ($productionQuantity / $totalTargetQuantity) * 100;
} else { } else {