svn commit: r562755 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/inventory/ applications/product/servicedef/ specialpurpose/oagis/config/ specialpurpose/oagis/src/org/ofbiz/oagis/

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

svn commit: r562755 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/inventory/ applications/product/servicedef/ specialpurpose/oagis/config/ specialpurpose/oagis/src/org/ofbiz/oagis/

apatel-2
Author: apatel
Date: Sat Aug  4 11:59:41 2007
New Revision: 562755

URL: http://svn.apache.org/viewvc?view=rev&rev=562755
Log:
Support for possible different facility for serialized inventory. Also if the serialized Inventory shipped from partner warehouse does not exist in our system then create it instead of returning error.

Modified:
    ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
    ofbiz/trunk/specialpurpose/oagis/config/oagis.properties
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml?view=diff&rev=562755&r1=562754&r2=562755
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml Sat Aug  4 11:59:41 2007
@@ -275,16 +275,30 @@
         <!-- Lets find the inventory to reserve -->
         <entity-and entity-name="InventoryItem" list-name="inventoryItems">            
             <field-map field-name="productId" env-name="parameters.productId"/>
+            <field-map field-name="facilityId" env-name="parameters.shippingFacilityId"/>
             <field-map field-name="inventoryItemTypeId"  value="SERIALIZED_INV_ITEM"/>
             <field-map field-name="serialNumber" env-name="parameters.serialNumber"/>
         </entity-and>
         <clear-field field-name="inventoryItem"/>
         <first-from-list list-name="inventoryItems" entry-name="inventoryItem"/>
+        <!-- If no inventory item found for the serial number, than create it -->
+        <if-empty field-name="inventoryItem">
+            <set field="receiveCtx.productId" from-field="parameters.productId"/>
+            <set field="receiveCtx.facilityId" from-field="parameters.shippingFacilityId"/>
+            <set field="receiveCtx.quantityAccepted" from-field="parameters.quantity"/>
+            <set field="receiveCtx.quantityRejected" value="0" type="Double"/>
+            <set field="receiveCtx.inventoryItemTypeId" value="SERIALIZED_INV_ITEM"/>
+            <set field="receiveCtx.serialNumber" from-field="parameters.serialNumber"/>
+            <call-service service-name="receiveInventoryProduct" in-map-name="receiveCtx">
+                <result-to-field result-name="inventoryItemId" field-name="inventoryItemLookupPk.inventoryItemId"/>
+            </call-service>
+            <find-by-primary-key entity-name="InventoryItem" map-name="inventoryItemLookupPk" value-name="inventoryItem"/>    
+        </if-empty>
         <!--Step 2 Check if its reserved for other order -->
         <set field="inventoryReservationLookUp.inventoryItemId" from-field="inventoryItem.inventoryItemId"/>
         <find-by-and map-name="inventoryReservationLookUp" list-name="invReservations" entity-name="OrderItemShipGrpInvRes"/>
-        <first-from-list entry-name="inventoryItemReservation" list-name="invReservations"/>        
-        <if-not-empty field-name="inventoryItemReservation">                        
+        <first-from-list entry-name="inventoryItemReservation" list-name="invReservations"/>
+        <if-not-empty field-name="inventoryItemReservation">
             <set-service-fields map-name="inventoryItemReservation" to-map-name="cancelOrderItemShipGrpInvResMap" service-name="cancelOrderItemShipGrpInvRes"/>
             <call-service service-name="cancelOrderItemShipGrpInvRes" in-map-name="cancelOrderItemShipGrpInvResMap"/>
             <!-- Hold our inventoryItem -->
@@ -599,6 +613,7 @@
         </if-compare>
     </simple-method>
 </simple-methods>
+
 
 
 

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?view=diff&rev=562755&r1=562754&r2=562755
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Sat Aug  4 11:59:41 2007
@@ -686,9 +686,10 @@
         <attribute name="serialNumber" type="String" mode="IN" optional="true"/>
         <attribute name="trackingNum" type="String" mode="IN" optional="true"/>
         <attribute name="originFacilityId" type="String" mode="IN" optional="true"/>
-        <attribute name="quantityNotReserved" type="Double" mode="IN" optional="false"/>
+        <attribute name="quantityNotReserved" type="Double" mode="IN" optional="true"/>
         <attribute name="promisedDatetime" type="Timestamp" mode="IN" optional="false"/>
-        <attribute name="shipmentPackageSeqId" type="String" mode="IN" optional="true"/>        
+        <attribute name="shipmentPackageSeqId" type="String" mode="IN" optional="true"/>
+        <attribute name="shippingFacilityId" type="String" mode="IN" optional="true"/>                
     </service>    
     <service name="setShipmentStatusPackedAndShipped" engine="simple"
         location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="setShipmentStatusPackedAndShipped" auth="true">

Modified: ofbiz/trunk/specialpurpose/oagis/config/oagis.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/config/oagis.properties?view=diff&rev=562755&r1=562754&r2=562755
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/config/oagis.properties (original)
+++ ofbiz/trunk/specialpurpose/oagis/config/oagis.properties Sat Aug  4 11:59:41 2007
@@ -38,6 +38,8 @@
 
 Oagis.Warehouse.SyncInventoryFacilityId=WebStoreWarehouse
 Oagis.Warehouse.SyncInventoryProductStoreId=9001
+
+Oagis.Warehouse.ShippingFacilityId=WebStoreWarehouse
 # Client Cert, etc settings
 #auth.client.certificate.alias=testrpckey
 #auth.basic.username=foo

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java?view=diff&rev=562755&r1=562754&r2=562755
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Sat Aug  4 11:59:41 2007
@@ -185,7 +185,8 @@
 
         String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId");                
         String originFacilityId = shipment.getString("originFacilityId");                              
-          
+        String shippingFacilityId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.ShippingFacilityId");
+        
         List shipUnitElementList = UtilXml.childElementList(daShowShipmentElement, "ns:SHIPUNIT"); // n
         if(UtilValidate.isNotEmpty(shipUnitElementList)) {
             Iterator shipUnitElementItr = shipUnitElementList.iterator();
@@ -211,7 +212,7 @@
                                 requireInventory = "N";
                             }                    
                             GenericValue orderItemShipGrpInvReservation = EntityUtil.getFirst(delegator.findByAnd("OrderItemShipGrpInvRes", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId,"shipGroupSeqId",shipGroupSeqId)));              
-                            Map isitspastCtx = UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId, "orderItemSeqId", orderItemSeqId, "quantity", orderItemShipGrpInvReservation.get("quantity"));                
+                            Map isitspastCtx = UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId, "orderItemSeqId", orderItemSeqId);                
                             isitspastCtx.put("productId", productId);
                             isitspastCtx.put("reservedDatetime", orderItemShipGrpInvReservation.get("reservedDatetime"));
                             isitspastCtx.put("requireInventory", requireInventory);
@@ -223,14 +224,17 @@
                             isitspastCtx.put("inventoryItemId", orderItemShipGrpInvReservation.get("inventoryItemId"));                
                             isitspastCtx.put("shipmentId", shipmentId);      
                             isitspastCtx.put("shipmentPackageSeqId", shipmentPackageSeqId);
-                            isitspastCtx.put("promisedDatetime", orderItemShipGrpInvReservation.get("promisedDatetime"));                    
+                            isitspastCtx.put("promisedDatetime", orderItemShipGrpInvReservation.get("promisedDatetime"));
+                            isitspastCtx.put("shippingFacilityId", shippingFacilityId);
                             List invDetailElementList = UtilXml.childElementList(invItemElement, "ns:INVDETAIL"); //n                            
                             if(UtilValidate.isNotEmpty(invDetailElementList)) {
                                 Iterator invDetailElementItr = invDetailElementList.iterator();
                                 while(invDetailElementItr.hasNext()) {
                                     Element invDetailElement = (Element) invDetailElementItr.next();
                                     String serialNumber = UtilXml.childElementValue(invDetailElement, "of:SERIALNUM"); // os                                                                                  
-                                    isitspastCtx.put("serialNumber", serialNumber);                                        
+                                    isitspastCtx.put("serialNumber", serialNumber);
+                                    isitspastCtx.put("quantity", new Double (1));
+                                    isitspastCtx.put("inventoryItemId", orderItemShipGrpInvReservation.get("inventoryItemId"));
                                     isitspastCtx.remove("itemIssuanceId");                            
                                     try {
                                         Map resultMap = dispatcher.runSync("issueSerializedInvToShipmentPackageAndSetTracking", isitspastCtx);
@@ -246,7 +250,8 @@
                                     }
                                 }
                             } else {
-                                try {//TODO: I think this else part is for NON Serialized Inv item. So it will be different service that we need to call here.                    
+                                try {//TODO: I think this else part is for NON Serialized Inv item. So it will be different service that we need to call here.
+                                    isitspastCtx.put("quantity", orderItemShipGrpInvReservation.get("quantity"));
                                     Map resultMap = dispatcher.runSync("issueSerializedInvToShipmentPackageAndSetTracking", isitspastCtx);
                                     if (ServiceUtil.isError(resultMap)){
                                         String errMsg = ServiceUtil.getErrorMessage(resultMap);