问题
I am running Manufacture Schedule (Using PHP Code), but currently its static (means I cannot add holidays OR I cannot change manufacture capacity - Current Manufacturing capacity is static 1700 SQFT per day)
Please see below code
$max = 1700;
$dailyLeft = $max;
$current = reset($priorityArraySum);
$output = [];
//$day = date('Y-m-d');
$day = date('Y-m-d');
while (true) {
// echo $current."/".$dailyLeft."=".$day.PHP_EOL;
if ( $current >= $dailyLeft ) {
//$day=date('Y-m-d', strtotime($day. ' + 1 days'));
$output[] = ["priority" => key($priorityArraySum),
"amount" => $dailyLeft,
"day" => $day
];
$day=date('Y-m-d', strtotime($day. ' + 1 days'));
$current -= $dailyLeft;
$dailyLeft = $max;
}
else {
$output[] = ["priority" => key($priorityArraySum),
"amount" => $current,
"day" => $day
];
$dailyLeft -= $current;
if ( ($current = next($priorityArraySum)) === false ) {
break;
}
}
}
echo '<pre/>';
print_r($output);
echo '<pre/>';
exit;
using above code, I am able to schedule my manufacturing plan, see below image
image of currently working code
Issue with current code is, we have static 1700 per day capacity, we want to have dynamic capacity, like 1700 for day 1, 1900 for day 2, 0 for holidays.
how can we alter this code to make it dynamic?
来源:https://stackoverflow.com/questions/63297519/convert-static-manufacturing-schedule-to-dynamic