Author: jacopoc
Date: Wed Nov 1 04:00:38 2006 New Revision: 469879 URL: http://svn.apache.org/viewvc?view=rev&rev=469879 Log: Refactored the "receivedInventoryProduct" service from "group" service to minilang. In this way the error handling is easier to maintain and implement and the success response messages are finally implemented (when one or more items are received, now the quantity received, the product id and inventory item id are shown). Also the service now handles correctly both serialized and non serialized inventory. This completes issue #318. Removed: incubator/ofbiz/trunk/applications/product/servicedef/groups_shipment.xml Modified: incubator/ofbiz/trunk/applications/product/ofbiz-component.xml incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml Modified: incubator/ofbiz/trunk/applications/product/ofbiz-component.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/ofbiz-component.xml?view=diff&rev=469879&r1=469878&r2=469879 ============================================================================== --- incubator/ofbiz/trunk/applications/product/ofbiz-component.xml (original) +++ incubator/ofbiz/trunk/applications/product/ofbiz-component.xml Wed Nov 1 04:00:38 2006 @@ -53,7 +53,6 @@ <service-resource type="model" loader="main" location="servicedef/services_uom.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas_shipment.xml"/> - <service-resource type="group" loader="main" location="servicedef/groups_shipment.xml"/> <webapp name="catalog" title="Catalog" server="default-server" location="webapp/catalog" base-permission="OFBTOOLS,CATALOG" mount-point="/catalog"/> Modified: incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?view=diff&rev=469879&r1=469878&r2=469879 ============================================================================== --- incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml (original) +++ incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml Wed Nov 1 04:00:38 2006 @@ -69,6 +69,47 @@ <remove-value value-name="lookedUpValue"/> </simple-method> + <simple-method method-name="receiveInventoryProduct" short-description="Receive Inventory in new Inventory Item(s)"> + <check-permission permission="FACILITY" action="_CREATE"><fail-message message="Security Error: to run receiveInventoryProduct you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/></check-permission> + <check-errors/> + <set field="loops" value="1" type="Double"/> + <if-compare value="SERIALIZED_INV_ITEM" operator="equals" field-name="parameters.inventoryItemTypeId"> + <set field="loops" from-field="parameters.quantityAccepted"/> + <set field="parameters.quantityAccepted" value="1" type="Double"/> + </if-compare> + <loop count="${loops}" field="currentLoop"> + <log level="info" message="Looping and creating inventory info - ${currentLoop}"/> + <clear-field field-name="serviceInMap"/> + <set-service-fields service-name="prepareInventoryReceipt" map-name="parameters" to-map-name="serviceInMap"/> + <call-service service-name="prepareInventoryReceipt" in-map-name="serviceInMap"> + <result-to-field result-name="quantityOnHandDiff" field-name="parameters.quantityOnHandDiff"/> + <result-to-field result-name="availableToPromiseDiff" field-name="parameters.availableToPromiseDiff"/> + </call-service> + <check-errors/> + <clear-field field-name="serviceInMap"/> + <set-service-fields service-name="createInventoryItem" map-name="parameters" to-map-name="serviceInMap"/> + <call-service service-name="createInventoryItem" in-map-name="serviceInMap"> + <result-to-field result-name="inventoryItemId" field-name="parameters.inventoryItemId"/> + </call-service> + <check-errors/> + <clear-field field-name="serviceInMap"/> + <set-service-fields service-name="createInventoryItemDetail" map-name="parameters" to-map-name="serviceInMap"/> + <call-service service-name="createInventoryItemDetail" in-map-name="serviceInMap"> + <result-to-field result-name="inventoryItemDetailSeqId" field-name="parameters.inventoryItemDetailSeqId"/> + </call-service> + <check-errors/> + <clear-field field-name="serviceInMap"/> + <set-service-fields service-name="createShipmentReceipt" map-name="parameters" to-map-name="serviceInMap"/> + <call-service service-name="createShipmentReceipt" in-map-name="serviceInMap"/> + <check-errors/> + <clear-field field-name="serviceInMap"/> + <set-service-fields service-name="balanceInventoryItems" map-name="parameters" to-map-name="serviceInMap"/> + <call-service service-name="balanceInventoryItems" in-map-name="serviceInMap"/> + <check-errors/> + <set value="Received ${parameters.quantityAccepted} of ${parameters.productId} in inventory item ${parameters.inventoryItemId}" field="successMessageList[]"/> + </loop> + </simple-method> + <simple-method method-name="prepareInventoryReceipt" short-description="Prepare Inventory Receipt"> <check-permission permission="FACILITY" action="_CREATE"><fail-message message="Security Error: to run prepareInventoryReceipt you must have the FACILITY_CREATE or FACILITY_ADMIN permission"/></check-permission> <check-errors/> @@ -152,39 +193,32 @@ <if-compare field-name="destinationFacility.defaultInventoryItemTypeId" value="NON_SERIAL_INV_ITEM" operator="equals"> <if-compare field-name="serializedItemCount" value="0" operator="equals"> <set field="parameters.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM"/> - <set field="loops" value="1"/> <set field="setNonSerial" value="true"/> </if-compare> </if-compare> <if-compare field-name="setNonSerial" value="false" operator="equals"> - <set field="parameters.inventoryItemTypeId" value="SERIALIZED_INV_ITEM"/> - <set field="loops" from-field="returnItem.returnQuantity"/> - <!-- this should be 1.0: each receive of a serialized inventory is for one unit --> + <set field="parameters.inventoryItemTypeId" value="SERIALIZED_INV_ITEM"/> <set field="returnItem.returnQuantity" value="1" type="Double"/> </if-compare> - <!-- loop through to create each serialized one at a time --> - <loop count="${loops}" field="currentLoop"> - <log level="info" message="Looping and creating inventory info - ${currentLoop}"/> - <set from-field="parameters.inventoryItemTypeId" field="receiveCtx.inventoryItemTypeId"/> - <set from-field="returnItem.expectedItemStatus" field="receiveCtx.statusId"/> - <set from-field="returnItem.productId" field="receiveCtx.productId"/> - <set from-field="returnItem.returnItemSeqId" field="receiveCtx.returnItemSeqId"/> - <set from-field="returnItem.returnId" field="receiveCtx.returnId"/> - <set from-field="returnItem.returnQuantity" field="receiveCtx.quantityAccepted"/> - <set from-field="returnHeader.destinationFacilityId" field="receiveCtx.facilityId"/> - <!-- important: associate ShipmentReceipt with return shipment created --> - <set from-field="shipmentId" field="receiveCtx.shipmentId"/> - - <set value="Returned Item RA# ${returnItem.returnId}" field="receiveCtx.comments"/> - <set from-field="nowTimestamp" field="receiveCtx.datetimeReceived"/> - - <calculate field-name="quantityRejected" map-name="receiveCtx" type="Double"> - <number value="0"/> - </calculate> + <set from-field="parameters.inventoryItemTypeId" field="receiveCtx.inventoryItemTypeId"/> + <set from-field="returnItem.expectedItemStatus" field="receiveCtx.statusId"/> + <set from-field="returnItem.productId" field="receiveCtx.productId"/> + <set from-field="returnItem.returnItemSeqId" field="receiveCtx.returnItemSeqId"/> + <set from-field="returnItem.returnId" field="receiveCtx.returnId"/> + <set from-field="returnItem.returnQuantity" field="receiveCtx.quantityAccepted"/> + <set from-field="returnHeader.destinationFacilityId" field="receiveCtx.facilityId"/> + <!-- important: associate ShipmentReceipt with return shipment created --> + <set from-field="shipmentId" field="receiveCtx.shipmentId"/> + + <set value="Returned Item RA# ${returnItem.returnId}" field="receiveCtx.comments"/> + <set from-field="nowTimestamp" field="receiveCtx.datetimeReceived"/> + + <calculate field-name="quantityRejected" map-name="receiveCtx" type="Double"> + <number value="0"/> + </calculate> - <call-service service-name="receiveInventoryProduct" in-map-name="receiveCtx"/> - </loop> + <call-service service-name="receiveInventoryProduct" in-map-name="receiveCtx"/> <else> <calculate field-name="nonProductItems" type="Long"> <calcop operator="add"> Modified: incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?view=diff&rev=469879&r1=469878&r2=469879 ============================================================================== --- incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) +++ incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml Wed Nov 1 04:00:38 2006 @@ -467,6 +467,25 @@ <attribute name="shipmentId" type="String" mode="IN" optional="false"/> </service> + <service name="receiveInventoryProduct" engine="simple" + location="org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="receiveInventoryProduct" auth="true"> + <description>Receive Inventory In Warehouse</description> + <auto-attributes entity-name="InventoryItem" include="nonpk" mode="IN" optional="true"> + <exclude field-name="availableToPromiseTotal"/> + <exclude field-name="quantityOnHandTotal"/> + </auto-attributes> + <auto-attributes entity-name="InventoryItemDetail" include="nonpk" mode="IN" optional="true"/> + <auto-attributes entity-name="ShipmentReceipt" include="nonpk" mode="IN" optional="true"/> + <attribute name="inventoryItemDetailSeqId" type="String" mode="IN" optional="true"/> + <attribute name="priorityOrderId" type="String" mode="IN" optional="true"/> + <attribute name="priorityOrderItemSeqId" type="String" mode="IN" optional="true"/> + <override name="quantityAccepted" optional="false"/> + <override name="quantityRejected" optional="false"/> + <override name="inventoryItemTypeId" optional="false"/> + <override name="productId" optional="false"/> + <override name="facilityId" optional="false"/> + </service> + <service name="prepareInventoryReceipt" engine="simple" location="org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="prepareInventoryReceipt" auth="true"> <description>Prepare Receipt Form for Inventory Item</description> @@ -474,13 +493,6 @@ <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="false"/> <attribute name="quantityOnHandDiff" type="Double" mode="OUT" optional="true"/> <attribute name="availableToPromiseDiff" type="Double" mode="OUT" optional="true"/> - </service> - <service name="receiveInventoryProduct" engine="group" location="receiveInventoryProduct" invoke="" auth="true"> - <attribute name="inventoryItemId" type="String" mode="INOUT" optional="true"/> - <attribute name="availableToPromiseDiff" type="Double" mode="INOUT" optional="true"/> - <attribute name="quantityOnHandDiff" type="Double" mode="INOUT" optional="true"/> - <attribute name="priorityOrderId" type="String" mode="IN" optional="true"/> - <attribute name="priorityOrderItemSeqId" type="String" mode="IN" optional="true"/> </service> <service name="quickReceiveReturn" engine="simple" location="org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="quickReceiveReturn" auth="true"> |
Free forum by Nabble | Edit this page |