Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
prolem with WO and leadtime of purchased components
05-20-2012, 09:58 AM
Post: #11
RE: prolem with WO and leadtime of purchased components
Hi, Klaus:

How do you know some levels have no leadtime, other levels have leadtime?

Would you like to explain how to reproduce this?

Best regards!

Exson

(05-18-2012 06:11 PM)opto Wrote:  Hi Exson,

I spent quite some time to try to understand it.

Independent from understanding, it is not correct that some levels where a part occurs have no leadtime, other levels have leadtime.

If I add my code change, all levels have leadtime.

best regards,

Klaus
Find all posts by this user
Quote this message in a reply
05-20-2012, 10:31 AM
Post: #12
RE: prolem with WO and leadtime of purchased components
Hi, Klaus:

If you don't use master plan to create a demand such as Forecast or Build to plan or any name's you like, you'll find the WO you created is showing in MRP suggested reschedule.

I believe this problem is caused by your operation procedure instead of a bug as you said.

Best regards!

Exson
Find all posts by this user
Quote this message in a reply
08-22-2012, 02:27 AM
Post: #13
RE: prolem with WO and leadtime of purchased components
It seems that Opto has done his homework here, and his patch would make the program more consistent. If the patch does not break any other functions, what is the benefit of keeping code that gives inconsistent results when using master plan to create a demand such as Forecast or Build?

The strength of open source software comes from community involvement.

Best regards,
Paul
Find all posts by this user
Quote this message in a reply
08-22-2012, 11:53 AM
Post: #14
RE: prolem with WO and leadtime of purchased components
I will dig into this one and have a look.

Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Visit this user's website Find all posts by this user
Quote this message in a reply
08-27-2012, 04:34 PM
Post: #15
RE: prolem with WO and leadtime of purchased components
We must have dealt with this already - here is the diff from the latest svn....

No new stuff here only tidy ups as I see it:

Code:
--- MRP.php    2012-08-27 18:29:16.000000000 +1200
+++ /root/Web-Server/webERP/MRP.php    2012-07-24 19:58:55.000000000 +1200
@@ -1,6 +1,6 @@
<?php

-/* $Id: MRP.php 4839 2012-01-25 23:03:03Z vvs2012 $*/
+/* $Id: MRP.php 5525 2012-07-21 23:37:38Z daintree $*/

include('includes/session.inc');
$title = _('Run MRP Calculation');
@@ -542,7 +542,7 @@
        }
        echo '<table class="selection">
                <tr>
-                    <th colspan="3"><font color="blue" size="3">'._('Last Run Details').'</font></th>
+                    <th colspan="3"><h3>'._('Last Run Details').'</h3></th>
                </tr>
                <tr>
                    <td>' . _('Last Run Time') . ':</td><td>' . $myrow['runtime'] . '</td>
@@ -573,15 +573,16 @@
                </tr>
                </table>';
    }
-    echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'])  . '">';
+    echo '<br /><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8')  . '">';
+    echo '<div>';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    echo '<table class="selection">
            <tr>
-                <th colspan="3"><font color="blue" size="3">'._('This Run Details').'</font></th>
+                <th colspan="3"><h3>'._('This Run Details').'</h3></th>
            </tr>
            <tr>
                <td>' . _('Location') . '</td>
-                <td><select name="location[]" multiple>
+                <td><select name="location[]" multiple="multiple">
                    <option value="All" selected="selected">' . _('All') . '</option>';
     $sql = "SELECT loccode,
                locationname
@@ -598,23 +599,23 @@

    echo '<tr>
            <td>' . _('Days Leeway') . ':</td>
-            <td><input type="text" name="Leeway" class="number" size="4" value="' . $leeway . '" />
+            <td><input type="text" name="Leeway" class="number" size="4" value="' . $leeway . '" /></td>
        </tr>
        <tr>
            <td>' ._('Use MRP Demands?') . ':</td>
-            <td><input type="checkbox" name="usemrpdemands" value="y" checked /></td>
+            <td><input type="checkbox" name="usemrpdemands" value="y" checked="checked" /></td>
        </tr>
        <tr>
            <td>' ._('Use EOQ?') . ':</td>
-            <td><input type="checkbox" name="eoqflag" value="y" checked /></td>
+            <td><input type="checkbox" name="eoqflag" value="y" checked="checked" /></td>
        </tr>
        <tr>
            <td>' ._('Use Pan Size?') . ':</td>
-            <td><input type="checkbox" name="pansizeflag" value="y" checked /></td>
+            <td><input type="checkbox" name="pansizeflag" value="y" checked="checked" /></td>
        </tr>
        <tr>
            <td>' ._('Use Shrinkage?') . ':</td>
-            <td><input type="checkbox" name="shrinkageflag" value="y" checked /></td>
+            <td><input type="checkbox" name="shrinkageflag" value="y" checked="checked" /></td>
        </tr>
        </table>
        <div class="centre">
@@ -622,6 +623,7 @@
            <br />
            <input type="submit" name="submit" value="' . _('Run MRP') . '" />
        </div>
+        </div>
        </form>';
}  // End of Main program logic -------------------------------------------------------

@@ -750,19 +752,10 @@
                $PlannedQty = ceil($PlannedQty / $PanSize) * $PanSize;
            }

-
-        
// Calculate required date by subtracting leadtime from top part's required date
-                        //added by opto 2012-5-18, see comment in CreATElOWERlEVELrEQUIREMENTS
-                      
-
-                
                  $PartRequiredDate=$Requirement['daterequired'];
+            if ((int)$LeadTime>0) {
                
-                
-                
-  if ((int)$LeadTime>0)              
-  {                
$CalendarSQL = "SELECT COUNT(*),cal2.calendardate
                          FROM mrpcalendar
                            LEFT JOIN mrpcalendar as cal2
@@ -774,8 +767,7 @@
        $myrowdate=DB_fetch_array($ResultDate);
        $NewDate = $myrowdate[1];
        // If can't find date based on manufacturing calendar, use $PartRequiredDate
-  }
-  else {
+            }  else {
           // Convert $PartRequiredDate from mysql format to system date format, use that to subtract leadtime
           // from it using DateAdd, convert that date back to mysql format
           $ConvertDate = ConvertSQLDate($PartRequiredDate);
@@ -783,33 +775,6 @@
           $NewDate = FormatDateForSQL($DateAdd);
        }
                
-                
-                
-                
-                
-                
-                
-                
-                
-                 // Old sql
-                /*
-                        $sql = "INSERT INTO mrpplannedorders (id,
-                                part,
-                                duedate,
-                                supplyquantity,
-                                ordertype,
-                                orderno,
-                                mrpdate,
-                                updateflag)
-                            VALUES (NULL,
-                                '" . $Requirement['part'] . "',
-                                '" . $Requirement['daterequired']  . "',
-                                '" . $PlannedQty  . "',
-                                '" . $Requirement['mrpdemandtype']  . "',
-                                '" . $Requirement['orderno']  . "',
-                                '" . $Requirement['daterequired'] . "',
-                                '0')";
-        */
                         $sql = "INSERT INTO mrpplannedorders (id,
                                part,
                                duedate,
@@ -828,7 +793,6 @@
                                '0')";
  
                
-                
                 $result = DB_query($sql,$db);
            // If part has lower level components, create requirements for them
            $sql = "SELECT COUNT(*) FROM bom
@@ -861,7 +825,7 @@
function CreateLowerLevelRequirement(&$db,
                                    $TopPart,
                                    $TopDate,
-                                    $topquantity,
+                                    $TopQuantity,
                                    $TopMRPDemandType,
                                    $TopOrderNo,
                                    $WhereRequired) {
@@ -880,48 +844,14 @@
    while ($myrow=DB_fetch_array($ResultBOM)) {
        // Calculate required date by subtracting leadtime from top part's required date
        $LeadTime = $myrow['leadtime'];
-
-        // Following sql finds daynumber for the top part's required date, subtracts leadtime, and finds
-        // a valid manufacturing date for the daynumber. There is only one valid manufacturing date
-        // for each daynumber, but there could be several non-manufacturing dates for the
-        // same daynumber. MRPCalendar.php maintains the manufacturing calendar.
-                
-//// This is no longer in use, see sql which updates the mrprequirements table.
-                // Reason: top level parts were added by main code into mrprequirements without leadtime,
-                //lower level parts were added to same table with leadtime, leading to an inconsistent table
-                //of planned orders. Now, all leadtimes are only used in levelnetting
-                //changed by opto 2012-5-18
-/*        $CalendarSQL = "SELECT COUNT(*),cal2.calendardate
-                          FROM mrpcalendar
-                            LEFT JOIN mrpcalendar as cal2
-                              ON (mrpcalendar.daynumber - '".$LeadTime."') = cal2.daynumber
-                          WHERE mrpcalendar.calendardate = '".$TopDate."'
-                            AND cal2.manufacturingflag='1'
-                            GROUP BY cal2.calendardate";
-        $ResultDate = DB_query($CalendarSQL,$db);
-        $myrowdate=DB_fetch_array($ResultDate);
-        $NewDate = $myrowdate[1];
-        // If can't find date based on manufacturing calendar, use $TopDate
-        if ($myrowdate[0] == 0){
-           // Convert $TopDate from mysql format to system date format, use that to subtract leadtime
-           // from it using DateAdd, convert that date back to mysql format
-           $ConvertDate = ConvertSQLDate($TopDate);
-           $DateAdd = DateAdd($ConvertDate,'d',($LeadTime * -1));
-           $NewDate = FormatDateForSQL($DateAdd);
-        }
-*/
-//end of change by opto                
        $Component = $myrow['component'];
-        $ExtendedQuantity = $myrow['quantity'] * $topquantity;
+        $ExtendedQuantity = $myrow['quantity'] * $TopQuantity;
// Commented out the following lines 8/15/09 because the eoq should be considered in the
// LevelNetting() function where $ExcessQty is calculated
//         if ($myrow['eoq'] > $ExtendedQuantity) {
//             $ExtendedQuantity = $myrow['eoq'];
//         }
-
-//opto: in this sql, $TopDate is used instead of $NewDate                
-                $sql = "INSERT INTO mrprequirements
-                        (part,
+        $sql = "INSERT INTO mrprequirements (part,
                         daterequired,
                         quantity,
                         mrpdemandtype,

Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)