Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0018053Openbravo ERP06. Material requirement planning (MRP)public2011-07-21 12:442015-05-13 13:41
andreaferaco 
mirurita 
normalmajoralways
closedduplicate 
30Professional Appliance
 
 
Mozilla Firefox
Core
No
0018053: Suggested Work Requirement not generated by MRP
When MRP is processed for a product configured with a minimum stock, the application does not suggest any work requirement to re-establish minimum stock.
1) Create a product P flagged as "production" and linked to a process plan.
2) Set minimum stock for this product P to 25 units
3) From manufacturing plan window run the process "Process Manufacturing Plan"
4) When the process is completed just two records are inserted in the table MRP_RUN_PRODUCTIONLINE:
|A|Minimum Stock|-25
|A|Stock|0
No suggested work requirement records have been created. Actually it was expected at least a third record:
|A|Suggested Work Requirement|25
5) We have noticed that if the "Process Manufacturing Plan" is executed a second time without deleting existing records in MRP_RUN_PRODUCTIONLINE, the application correctly creates the records for the suggested work requirements.

The application behaviour after the second execution is consistent with the expected behaviour, however this behaviour was expected immediately after the first execution.

We analysed the code and realised that the stored procedure "mrp_run_initialize" inserts in MRP_RUN_PRODUCTIONLINE just the lines of stock (ST) and minimum stock (MS) having the flag "isexploded" = 'Y'.
Because of this condition, the stored procedure "mrp_run_explode", invoked after "mrp_run_initialize", excludes those records, and therefore it does not generate any Suggested Work Requirement because of the Minimum Stock.

When the procedure is run the second time, the stored procedure "mrp_production_run" executes this SQL statement before invoking the other procedures:

UPDATE MRP_RUN_PRODUCTIONLINE SET isexploded = 'N' WHERE MRP_RUN_PRODUCTION_ID = v_Record_ID AND qty <0 AND INOUTTRXTYPE <> 'WR';

You can see that it sets to N the flag isexploded, therefore even if "mrp_run_initialize" skips the product P because already created in the table MRP_RUN_PRODUCTIONLINE, however the "mrp_run_explode" takes it into account and correctly generates the Suggested Work Requirement.

We tried to modify the "mrp_run_initialize" so to take the record related to minimum stock (MS) at the first execution, but the procedure raises an exception (it tries to fill a null value in the planneddate field).
VMA-Reviewed
duplicate of defect 0019435 closed VictorVillar To specify that Manufacturing planning does not take into account safety stock as minimum requirement unless there is demand. 
Issue History
2011-07-21 12:44andreaferacoNew Issue
2011-07-21 12:44andreaferacoAssigned To => jonalegriaesarte
2011-07-21 12:44andreaferacoWeb browser => Mozilla Firefox
2011-07-21 12:44andreaferacoModules => Core
2011-07-21 12:53riccardogervasiIssue Monitored: riccardogervasi
2011-07-21 12:53riccardogervasiIssue End Monitor: riccardogervasi
2011-07-21 12:54riccardogervasiIssue Monitored: riccardogervasi
2011-09-27 16:38gorkaionStatusnew => scheduled
2011-09-27 16:38gorkaionNote Added: 0041323
2011-09-27 16:38gorkaionfix_in_branch => pi
2012-04-03 12:20jonalegriaesarteAssigned Tojonalegriaesarte => vmromanos
2012-04-10 16:13vmromanosTag Attached: VMA-Reviewed
2012-05-10 12:12gorka_gilAssigned Tovmromanos => mirurita
2015-05-13 13:41plujanRelationship addedduplicate of 0019435
2015-05-13 13:41plujanNote Added: 0077380
2015-05-13 13:41plujanStatusscheduled => closed
2015-05-13 13:41plujanResolutionopen => duplicate

Notes
(0041323)
gorkaion   
2011-09-27 16:38   
It is intended to consider the safety stock only in case there is some demand.

On the second run it shouldn't propose any production. The update clause should be fixed to filter out stock and safety stock transaction types.
(0077380)
plujan   
2015-05-13 13:41   
A similar issue was reported later and it was fixed without noticing this previous report, so I am closing it as duplicated.