Author: jacopoc
Date: Tue Apr 10 06:35:38 2007 New Revision: 527134 URL: http://svn.apache.org/viewvc?view=rev&rev=527134 Log: Added optional parameter to the mrp for the default number of years offset for orders without dates. Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpForms.xml Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml?view=diff&rev=527134&r1=527133&r2=527134 ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml Tue Apr 10 06:35:38 2007 @@ -32,12 +32,14 @@ <attribute name="facilityGroupId" type="String" mode="IN" optional="true"/> <attribute name="facilityId" type="String" mode="IN" optional="true"/> <attribute name="mrpName" type="String" mode="IN" optional="true"/> + <attribute name="defaultYearsOffset" type="Integer" mode="IN" optional="true"/> <attribute name="msgResult" type="List" mode="OUT" optional="false"/> </service> <service name="initInventoryEventPlanned" engine="java" location="org.ofbiz.manufacturing.mrp.MrpServices" invoke="initInventoryEventPlanned" auth="true" use-transaction="false"> <description>Initialize the table "InventoryEventPlanned"</description> <attribute name="reInitialize" type="Boolean" mode="IN" optional="false"/> + <attribute name="defaultYearsOffset" type="Integer" mode="IN" optional="true"/> </service> <service name="listProductForMrp" engine="java" location="org.ofbiz.manufacturing.mrp.MrpServices" invoke="listProductForMrp" auth="true"> Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java?view=diff&rev=527134&r1=527133&r2=527134 ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java Tue Apr 10 06:35:38 2007 @@ -77,6 +77,8 @@ GenericDelegator delegator = ctx.getDelegator(); Timestamp now = UtilDateTime.nowTimestamp(); + Integer defaultYearsOffset = (Integer)context.get("defaultYearsOffset"); + //Erases the old table for the moment and initializes it with the new orders, //Does not modify the old one now. Debug.logInfo("initInventoryEventPlanned called", module); @@ -143,7 +145,12 @@ // ---------------------------------------- // This is the default required date for orders without dates spesified: // by convention it is a date far in the future of 100 years. - Timestamp notAssignedDate = UtilDateTime.getYearStart(now, 0, 0, 100); + Timestamp notAssignedDate = null; + if (UtilValidate.isEmpty(defaultYearsOffset)) { + notAssignedDate = now; + } else { + notAssignedDate = UtilDateTime.getYearStart(now, 0, 0, defaultYearsOffset.intValue()); + } resultList = null; iteratorResult = null; parameters = UtilMisc.toMap("orderTypeId", "SALES_ORDER", "oiStatusId", "ITEM_APPROVED"); @@ -519,6 +526,7 @@ Timestamp now = UtilDateTime.nowTimestamp(); String mrpName = (String)context.get("mrpName"); + Integer defaultYearsOffset = (Integer)context.get("defaultYearsOffset"); String facilityGroupId = (String)context.get("facilityGroupId"); String facilityId = (String)context.get("facilityId"); String manufacturingFacilityId = null; @@ -581,7 +589,7 @@ GenericValue inventoryEventForMRP = null; // Initialisation of the InventoryEventPlanned table, This table will contain the products we want to buy or build. - parameters = UtilMisc.toMap("reInitialize",Boolean.TRUE,"userLogin", userLogin); + parameters = UtilMisc.toMap("reInitialize", Boolean.TRUE, "defaultYearsOffset", defaultYearsOffset, "userLogin", userLogin); try { result = dispatcher.runSync("initInventoryEventPlanned", parameters); } catch (GenericServiceException e) { Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpForms.xml?view=diff&rev=527134&r1=527133&r2=527134 ============================================================================== --- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpForms.xml (original) +++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpForms.xml Tue Apr 10 06:35:38 2007 @@ -22,7 +22,7 @@ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd"> <form name="RunMrp" type="single" target="runMrpGo" title=""> - <field name="mrpName" title="${uiLabelMap.ManufacturingMrpName}"><text size="20"/></field> + <field name="mrpName" title="${uiLabelMap.ManufacturingMrpName}"><text size="20"/></field> <field name="facilityGroupId" title="${uiLabelMap.ProductFacilityGroup}"> <drop-down allow-empty="true"> <entity-options entity-name="FacilityGroup" description="${facilityGroupName} [${facilityGroupId}]"/> @@ -33,6 +33,7 @@ <entity-options entity-name="Facility" description="${facilityName} [${facilityId}]"/> </drop-down> </field> + <field name="defaultYearsOffset"><text size="5" default-value="1"/></field> <field name="submitButton" title="${uiLabelMap.CommonSubmit}"> <submit button-type="button"/> </field> |
Free forum by Nabble | Edit this page |