Convert static Manufacturing Schedule to Dynamic

為{幸葍}努か 提交于 2021-01-29 17:53:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!