Skip to content

Commit

Permalink
Improved: Added a view entity to get the qoh aggregated and used the …
Browse files Browse the repository at this point in the history
…same in Get Inventory Count Items API (#52).
  • Loading branch information
ravilodhi committed Jan 21, 2025
1 parent f6392cd commit fca929c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 6 additions & 0 deletions entity/InventoryCountViewEntities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@ under the License.
<alias name="countedByLastName" field="lastName" entity-alias="PER"/>
<alias name="countedByGroupName" field="groupName" entity-alias="PG"/>
</view-entity>
<view-entity entity-name="InventoryItemSummary" package="co.hotwax.warehouse">
<member-entity entity-alias="II" entity-name="org.apache.ofbiz.product.inventory.InventoryItem"/>
<alias name="productId" entity-alias="II"/>
<alias name="facilityId" entity-alias="II"/>
<alias name="qoh" field="quantityOnHandTotal" entity-alias="II" function="sum"/>
</view-entity>
</entities>
11 changes: 5 additions & 6 deletions service/co/hotwax/cycleCount/InventoryCountServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,17 @@
<set field="qtyOnHand" from="countImportVariance.systemQuantityOnHand" default-value="0"/>
<else>
<if condition="computeQOH == 'Y'">
<entity-find entity-name="org.apache.ofbiz.product.inventory.InventoryItem" list="inventoryItems">
<entity-find entity-name="co.hotwax.warehouse.InventoryItemSummary" list="itemSummary">
<econdition field-name="productId" from="invCountImpItem.productId"/>
<econdition field-name="facilityId" from="invCountImpItem.facilityId"/>
<use-iterator/>
</entity-find>
<iterate list="inventoryItems" entry="inventoryItem">
<set field="qtyOnHand" from="qtyOnHand + (inventoryItem.quantityOnHandTotal ?:0)" type="BigDecimal"/>
</iterate>
<if condition="itemSummary">
<set field="qtyOnHand" from="itemSummary?.first?.qoh"/>
</if>
</if>
</else>
</if>
<set field="itemDetail.qoh" from="qtyOnHand" default-value="0"/>
<set field="itemDetail.qoh" from="qtyOnHand"/>

<!--Last count sync date-->
<entity-find entity-name="co.hotwax.warehouse.InventoryCountImportItemView" list="lastCountedItems" limit="1">
Expand Down

0 comments on commit fca929c

Please sign in to comment.