Skip to content

Commit

Permalink
Merge pull request #53 from hotwax/#52
Browse files Browse the repository at this point in the history
Improved: Added a flag computeQOH to control QOH computation in GET inventory count import items API (#52).
  • Loading branch information
dixitdeepak authored Jan 21, 2025
2 parents cab8173 + 453f8a3 commit 167baa9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions service/co/hotwax/cycleCount/InventoryCountServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<parameter name="importItemSeqId"/>
<parameter name="statusId"/>
<parameter name="facilityId" type="List"/>
<parameter name="computeQOH" default-value="Y"/>
<parameter name="orderBy" default-value="-inventoryCountImportId, importItemSeqId"/>
<parameter name="pageIndex" type="Integer" default-value="0">
<description>The current page index to get the inventory count import items.</description>
Expand Down Expand Up @@ -51,34 +52,39 @@
<if condition="countImportVariance">
<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">
<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>
</else>
</if>
<set field="itemDetail.qoh" from="qtyOnHand" default-value="0"/>

<!--Last count sync date-->
<entity-find entity-name="co.hotwax.warehouse.InventoryCountImportItemView" list="lastCountedItems">
<entity-find entity-name="co.hotwax.warehouse.InventoryCountImportItemView" list="lastCountedItems" limit="1">
<econdition field-name="productId" from="invCountImpItem.productId"/>
<econdition field-name="facilityId" from="invCountImpItem.facilityId"/>
<econdition field-name="statusId" value="INV_COUNT_COMPLETED"/>
<econdition field-name="inventoryCountImportId" operator="not-equals" from="inventoryCountImportId"/>
<select-field field-name="createdDate"/>
<order-by field-name="-createdDate"/>
</entity-find>
<if condition="lastCountedItems &amp;&amp; lastCountedItems.size() > 0">
<set field="itemDetail.lastCountedDate" from="lastCountedItems?.get(0).get('createdDate')"/>
</if>

<!--Get the accepted by user detail for the inventory count import item-->
<entity-find entity-name="co.hotwax.warehouse.InvCountImportStatus" list="itemStatusHistory">
<entity-find entity-name="co.hotwax.warehouse.InvCountImportStatus" list="itemStatusHistory" limit="1">
<econdition field-name="inventoryCountImportId" from="invCountImpItem.inventoryCountImportId"/>
<econdition field-name="importItemSeqId" from="invCountImpItem.importItemSeqId"/>
<econdition field-name="statusId" value="INV_COUNT_COMPLETED" />
<select-field field-name="changeByUserLoginId"/>
</entity-find>
<set field="itemDetail.acceptedByUserLoginId" from="itemStatusHistory?.first?.changeByUserLoginId"/>

Expand All @@ -87,6 +93,7 @@
<econdition field-name="productIdTo" from="invCountImpItem.productId"/>
<econdition field-name="productAssocTypeId" value="PRODUCT_VARIANT"/>
<date-filter/>
<select-field field-name="productId,productName"/>
</entity-find>
<set field="itemDetail.parentProductId" from="parentProductDetails?.first?.productId"/>
<set field="itemDetail.parentProductName" from="parentProductDetails?.first?.productName"/>
Expand Down

0 comments on commit 167baa9

Please sign in to comment.