svn commit: r644805 - in /ofbiz/trunk/applications: manufacturing/config/ manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ manufacturing/servicedef/ manufacturing/webapp/manufacturing/jobshopmgt/ product/data/ product/script/org/ofbiz/product/i...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r644805 - in /ofbiz/trunk/applications: manufacturing/config/ manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ manufacturing/servicedef/ manufacturing/webapp/manufacturing/jobshopmgt/ product/data/ product/script/org/ofbiz/product/i...

jacopoc
Author: jacopoc
Date: Fri Apr  4 11:10:10 2008
New Revision: 644805

URL: http://svn.apache.org/viewvc?rev=644805&view=rev
Log:
Enhanced the service that pulls materials for production runs out of inventory: some bug fixes plus the ability to specify if reservations can be overriden; useful for materials that are also sold.

Modified:
    ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml
    ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml
    ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
    ofbiz/trunk/applications/product/data/ProductTypeData.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml

Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml?rev=644805&r1=644804&r2=644805&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml (original)
+++ ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml Fri Apr  4 11:10:10 2008
@@ -1323,6 +1323,10 @@
         <value xml:lang="th">ส่วนประกอบของปัญหา</value>
         <value xml:lang="zh">交付部件</value>
     </property>
+    <property key="ManufacturingIssueAvailableProductionRunTask">
+        <value xml:lang="en">Issue Components (ATP)</value>
+        <value xml:lang="it">Preleva i Componenti (ATP)</value>
+    </property>
     <property key="ManufacturingIssuedQuantity">
         <value xml:lang="en">Issued</value>
         <value xml:lang="es">Publicado</value>

Modified: ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml?rev=644805&r1=644804&r2=644805&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml (original)
+++ ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml Fri Apr  4 11:10:10 2008
@@ -25,6 +25,12 @@
     <simple-method method-name="issueProductionRunTask" short-description="Issues the Inventory for a Production Run Task" login-required="false">
         <entity-one entity-name="WorkEffort" value-name="workEffort"/>
 
+        <if-empty field-name="parameters.failIfItemsAreNotAvailable">
+            <set field="parameters.failIfItemsAreNotAvailable" value="Y"/>
+        </if-empty>
+        <if-empty field-name="parameters.failIfItemsAreNotOnHand">
+            <set field="parameters.failIfItemsAreNotOnHand" value="Y"/>
+        </if-empty>
         <if-not-empty field-name="workEffort">
             <if-compare value="PRUN_CANCELLED" operator="not-equals" field-name="currentStatusId" map-name="workEffort">
                 <set from-field="parameters.workEffortId" field="lookupComponentsMap.workEffortId"/>
@@ -40,7 +46,8 @@
                         <set-service-fields to-map-name="callSvcMap" service-name="issueProductionRunTaskComponent" map-name="component"/>
                         <set from-field="reserveOrderEnumId" field="callSvcMap.reserveOrderEnumId"/>
                         <set field="callSvcMap.description" value="BOM Part"/>
-                        <set field="callSvcMap.failIfItemsAreNotAvailable" value="Y"/>
+                        <set field="callSvcMap.failIfItemsAreNotAvailable" from-field="parameters.failIfItemsAreNotAvailable"/>
+                        <set field="callSvcMap.failIfItemsAreNotOnHand" from-field="parameters.failIfItemsAreNotOnHand"/>
                         <call-service service-name="issueProductionRunTaskComponent" in-map-name="callSvcMap"/>
                     </if-not-empty>
                 </iterate>
@@ -63,7 +70,6 @@
             <set from-field="workEffortGoodStandard.estimatedQuantity" field="estimatedQuantity"/>
         </else>
         </if-empty>
-
         
         <!-- kind of like the inventory reservation routine, find InventoryItems to issue from, but instead of doing the reservation just create an issuance and an inventory item detail for the change -->
         <if-not-empty field-name="productId">
@@ -99,29 +105,57 @@
                 <set from-field="parameters.locationSeqId" field="lookupFieldMap.locationSeqId"/>
             </if-not-empty>
             <find-by-and entity-name="InventoryItem" map-name="lookupFieldMap" list-name="primaryInventoryItemList" order-by-list-name="orderByList"/>
+            <set from-field="primaryInventoryItemList" field="inventoryItemList"/>
             <!-- if secondaryLocationSeqId is also passed, then also the inventory items in the secondary location are considered, after the ones in the main location -->
             <if-not-empty field-name="parameters.locationSeqId">
                 <if-not-empty field-name="parameters.secondaryLocationSeqId">
                     <set from-field="parameters.secondaryLocationSeqId" field="lookupFieldMap.locationSeqId"/>
+                    <find-by-and entity-name="InventoryItem" map-name="lookupFieldMap" list-name="secondaryInventoryItemList" order-by-list-name="orderByList"/>
+                    <list-to-list list-name="secondaryInventoryItemList" to-list-name="inventoryItemList"/>
                 </if-not-empty>
             </if-not-empty>
-            <find-by-and entity-name="InventoryItem" map-name="lookupFieldMap" list-name="secondaryInventoryItemList" order-by-list-name="orderByList"/>
-            <set from-field="primaryInventoryItemList" field="inventoryItemList"/>
-            <list-to-list list-name="secondaryInventoryItemList" to-list-name="inventoryItemList"/>
-    
+
             <set from-field="estimatedQuantity" field="parameters.quantityNotIssued"/>
 
+            <set field="parameters.useReservedItems" value="N"/>
             <iterate entry-name="inventoryItem" list-name="inventoryItemList">
                 <!-- this is a little trick to get the InventoryItem value object without doing a query, possible since all fields on InventoryItem are also on InventoryItemAndLocation with the same names -->
                 <call-simple-method method-name="issueProductionRunTaskComponentInline"/>
             </iterate>
+
+            <if>
+                <condition>
+                    <and>
+                        <if-compare field-name="parameters.failIfItemsAreNotAvailable" operator="not-equals" value="Y" type="String"/>
+                        <if-compare field-name="parameters.quantityNotIssued" operator="greater" value="0" type="Double"/>
+                    </and>
+                </condition>
+                <then>
+                    <set field="parameters.useReservedItems" value="Y"/>
+                    <iterate entry-name="inventoryItem" list-name="inventoryItemList">
+                        <if-compare field-name="parameters.quantityNotIssued" operator="greater" value="0" type="Double">
+                            <refresh-value value-name="inventoryItem"/>
+                            <!-- this is a little trick to get the InventoryItem value object without doing a query, possible since all fields on InventoryItem are also on InventoryItemAndLocation with the same names -->
+                            <call-simple-method method-name="issueProductionRunTaskComponentInline"/>
+                        </if-compare>
+                    </iterate>
+                </then>
+            </if>
             
             <!-- if quantityNotIssued is not 0, then pull it from the last non-serialized inventory item found, in the quantityNotIssued field -->
             <if-compare field-name="parameters.quantityNotIssued" operator="not-equals" value="0" type="Double">
-                <if-compare field-name="parameters.failIfItemsAreNotAvailable" operator="equals" value="Y" type="String">
-                    <add-error><fail-property property="ManufacturingMaterialsNotAvailable" resource="ManufacturingUiLabels"/></add-error>
-                    <add-error><fail-message message=" ${productId}: ${parameters.quantityNotIssued}"/></add-error>
-                </if-compare>
+                <if>
+                    <condition>
+                        <or>
+                            <if-compare field-name="parameters.failIfItemsAreNotAvailable" operator="equals" value="Y" type="String"/>
+                            <if-compare field-name="parameters.failIfItemsAreNotOnHand" operator="equals" value="Y" type="String"/>
+                        </or>
+                    </condition>
+                    <then>
+                        <add-error><fail-property property="ManufacturingMaterialsNotAvailable" resource="ManufacturingUiLabels"/></add-error>
+                        <add-error><fail-message message=" ${productId}: ${parameters.quantityNotIssued}"/></add-error>
+                    </then>
+                </if>
                 <check-errors/>
                 <if-not-empty field-name="lastNonSerInventoryItem">
                     <!-- create ItemIssuance record -->
@@ -135,11 +169,9 @@
                     <!-- instead of updating InventoryItem, add an InventoryItemDetail -->
                     <set from-field="lastNonSerInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
                     <set from-field="parameters.workEffortId" field="createDetailMap.workEffortId"/>
-                    <!--
                     <calculate field-name="createDetailMap.availableToPromiseDiff" type="Double">
                         <calcop field-name="parameters.quantityNotIssued" operator="negative"/>
                     </calculate>
-                    -->
                     <calculate field-name="createDetailMap.quantityOnHandDiff" type="Double">
                         <calcop field-name="parameters.quantityNotIssued" operator="negative"/>
                     </calculate>
@@ -147,6 +179,8 @@
                     <set field="createDetailMap.description" from-field="parameters.description"/>
                     <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/>
                     <clear-field field-name="createDetailMap"/>
+                    <set field="balanceInventoryItemsInMap.inventoryItemId" from-field="lastNonSerInventoryItem.inventoryItemId"/>
+                    <call-service service-name="balanceInventoryItems" in-map-name="balanceInventoryItemsInMap"/>
                 <else>
                     <!-- no non-ser inv item, create a non-ser InventoryItem with availableToPromise = -quantityNotIssued -->
                     <clear-field field-name="createInvItemInMap"/>
@@ -168,11 +202,9 @@
                     <!-- also create a detail record with the quantities -->
                     <set field="createDetailMap.inventoryItemId" from-field="createInvItemOutMap.inventoryItemId"/>
                     <set field="createDetailMap.workEffortId" from-field="parameters.workEffortId"/>
-                    <!--
                     <calculate field-name="createDetailMap.availableToPromiseDiff" type="Double">
                         <calcop field-name="parameters.quantityNotIssued" operator="negative"/>
                     </calculate>
-                    -->
                     <calculate field-name="createDetailMap.quantityOnHandDiff" type="Double">
                         <calcop field-name="parameters.quantityNotIssued" operator="negative"/>
                     </calculate>
@@ -212,11 +244,18 @@
                 </if-compare>
             </if-compare>
             <if-compare field-name="inventoryItem.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM">
-                <if-not-empty field-name="inventoryItem.availableToPromiseTotal">
+                <if-compare field-name="parameters.useReservedItems" operator="equals" value="Y">
+                    <set field="inventoryItemQuantity" from-field="inventoryItem.quantityOnHandTotal"/>
+                <else>
+                    <set field="inventoryItemQuantity" from-field="inventoryItem.availableToPromiseTotal"/>
+                </else>
+                </if-compare>
+                
+                <if-not-empty field-name="inventoryItemQuantity">
                     <!-- reduce atp on inventoryItem if availableToPromise greater than 0, if not the code at the end of this method will handle it -->
-                    <if-compare field-name="inventoryItem.availableToPromiseTotal" operator="greater" value="0" type="Double">
-                        <if-compare-field field-name="parameters.quantityNotIssued" operator="greater" to-field-name="inventoryItem.availableToPromiseTotal" type="Double">
-                            <set from-field="inventoryItem.availableToPromiseTotal" field="parameters.deductAmount"/>
+                    <if-compare field-name="inventoryItemQuantity" operator="greater" value="0" type="Double">
+                        <if-compare-field field-name="parameters.quantityNotIssued" operator="greater" to-field-name="inventoryItemQuantity" type="Double">
+                            <set from-field="inventoryItemQuantity" field="parameters.deductAmount"/>
                         <else>
                             <set from-field="parameters.quantityNotIssued" field="parameters.deductAmount"/>
                         </else>
@@ -249,6 +288,8 @@
                                 <calcop operator="get" field-name="parameters.deductAmount"/>
                             </calcop>
                         </calculate>
+                        <set field="balanceInventoryItemsInMap.inventoryItemId" from-field="inventoryItem.inventoryItemId"/>
+                        <call-service service-name="balanceInventoryItems" in-map-name="balanceInventoryItemsInMap"/>
 
                         <clear-field field-name="issuanceCreateMap"/>
                     </if-compare>

Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml?rev=644805&r1=644804&r2=644805&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original)
+++ ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Fri Apr  4 11:10:10 2008
@@ -140,6 +140,8 @@
         </description>
         <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
         <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/>
+        <attribute name="failIfItemsAreNotAvailable" type="String" mode="IN" optional="true"/>
+        <attribute name="failIfItemsAreNotOnHand" type="String" mode="IN" optional="true"/>
     </service>
     <service name="issueProductionRunTaskComponent" engine="simple"
                 location="org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml" invoke="issueProductionRunTaskComponent" auth="false">
@@ -149,7 +151,9 @@
             with type PRUNT_PROD_NEEDED is retrieved and used to get the quantity; its status is also updated to COMPLETED after
             the issuance is done.
             If locationSeqIds are provided, then the items are only issued from the inventory items associated to the locations.
-            If failIfItemsAreNotAvailable is set to "Y" (the default is "N") then the service fails if there isn not enough inventory:
+            If failIfItemsAreNotAvailable is set to "Y" (the default is "N") then the service fails if there isn not enough inventory available:
+            no reservation will be stolen.
+            If failIfItemsAreNotOnHand is set to "Y" (the default is "N") then the service fails if there isn not enough inventory:
             no items with negative qoh will be created.
         </description>
         <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
@@ -157,6 +161,7 @@
         <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="quantity" type="Double" mode="IN" optional="true"/>
         <attribute name="failIfItemsAreNotAvailable" type="String" mode="IN" optional="true"/>
+        <attribute name="failIfItemsAreNotOnHand" type="String" mode="IN" optional="true"/>
         <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/>
         <attribute name="locationSeqId" type="String" mode="IN" optional="true"/>
         <attribute name="secondaryLocationSeqId" type="String" mode="IN" optional="true"/>

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml?rev=644805&r1=644804&r2=644805&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml Fri Apr  4 11:10:10 2008
@@ -271,8 +271,11 @@
         <field name="startLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit" use-when="&quot;${startTaskId}&quot;.equals(&quot;${workEffortId}&quot;)">
             <hyperlink target="changeProductionRunTaskStatus?workEffortId=${workEffortId}&amp;productionRunId=${workEffortParentId}" description="${uiLabelMap.ManufacturingStartProductionRunTask}" also-hidden="false"/>
         </field>
-        <field name="issueLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit" use-when="&quot;${issueTaskId}&quot;.equals(&quot;${workEffortId}&quot;)">
-            <hyperlink target="issueProductionRunRoutingTask?workEffortId=${workEffortId}&amp;productionRunId=${workEffortParentId}" description="${uiLabelMap.ManufacturingIssueProductionRunTask}" also-hidden="false"/>
+        <field name="issueLinkAtp" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit" use-when="&quot;${issueTaskId}&quot;.equals(&quot;${workEffortId}&quot;)">
+            <hyperlink target="issueProductionRunRoutingTask?workEffortId=${workEffortId}&amp;productionRunId=${workEffortParentId}&amp;failIfItemsAreNotAvailable=Y" description="${uiLabelMap.ManufacturingIssueAvailableProductionRunTask}" also-hidden="false"/>
+        </field>
+        <field name="issueLinkQoh" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit" use-when="&quot;${issueTaskId}&quot;.equals(&quot;${workEffortId}&quot;)">
+            <hyperlink target="issueProductionRunRoutingTask?workEffortId=${workEffortId}&amp;productionRunId=${workEffortParentId}&amp;failIfItemsAreNotAvailable=N" description="${uiLabelMap.ManufacturingIssueProductionRunTask}" also-hidden="false"/>
         </field>
         <field name="declareLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit" use-when="&quot;PRUN_RUNNING&quot;.equals(&quot;${currentStatusId}&quot;)">
             <hyperlink target="ProductionRunDeclaration?actionForm=EditRoutingTask&amp;routingTaskId=${workEffortId}&amp;productionRunId=${workEffortParentId}" description="${uiLabelMap.ManufacturingDeclareProductionRunTask}" also-hidden="false"/>
@@ -287,7 +290,12 @@
         <field name="productionRunId"><hidden/></field>
         <field name="workEffortId"><hidden/></field>
         <field name="fromDate"><hidden/></field>
-        <field name="failIfItemsAreNotAvailable"><hidden value="Y"/></field>
+        <field name="failIfItemsAreNotAvailable">
+            <drop-down allow-empty="false">
+                <option key="Y" description="${uiLabelMap.CommonYes}"/>
+                <option key="N" description="${uiLabelMap.CommonNo}"/>
+            </drop-down>
+        </field>
         <field name="task" entry-name="workEffortId" title="${uiLabelMap.ManufacturingRoutingTaskId}">
             <display description="${workEffortName} [${workEffortId}]"/>
         </field>

Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=644805&r1=644804&r2=644805&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original)
+++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Fri Apr  4 11:10:10 2008
@@ -79,6 +79,7 @@
     <Enumeration description="Found" enumCode="VAR_FOUND" enumId="VAR_FOUND" sequenceId="03" enumTypeId="IID_REASON"/>
     <Enumeration description="Damaged" enumCode="VAR_DAMAGED" enumId="VAR_DAMAGED" sequenceId="04" enumTypeId="IID_REASON"/>
     <Enumeration description="Sample (Giveaway)" enumCode="VAR_SAMPLE" enumId="VAR_SAMPLE" sequenceId="05" enumTypeId="IID_REASON"/>
+    <Enumeration description="Integration" enumCode="VAR_INTEGR" enumId="VAR_INTEGR" sequenceId="06" enumTypeId="IID_REASON"/>
 
     <EnumerationType description="Product Store Payment Service Type" enumTypeId="PRDS_PAYSVC" hasTable="N" parentTypeId=""/>
     <Enumeration description="Payment Authorization Service" enumCode="PAY_AUTH" enumId="PRDS_PAY_AUTH" sequenceId="01" enumTypeId="PRDS_PAYSVC"/>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml?rev=644805&r1=644804&r2=644805&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml Fri Apr  4 11:10:10 2008
@@ -838,7 +838,7 @@
                 <condition-expr field-name="facilityId" operator="equals" env-name="parameters.facilityId"/>
                 <condition-expr field-name="inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"/>
                 <condition-list combine="or">
-                    <condition-expr field-name="currentPromisedDate" operator="greater" env-name="parameters.fromDate"/>
+                    <condition-expr field-name="currentPromisedDate" operator="greater" env-name="parameters.fromDate" ignore-if-null="true"/>
                     <condition-list combine="or">
                         <condition-expr field-name="quantityNotAvailable" operator="greater" value="0"/>
                         <condition-expr field-name="availableToPromiseTotal" operator="equals" env-name="nullField"/>