You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ap...@apache.org on 2007/07/27 01:07:38 UTC

svn commit: r560029 - in /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis: OagisInventoryServices.java OagisServices.java

Author: apatel
Date: Thu Jul 26 16:07:37 2007
New Revision: 560029

URL: http://svn.apache.org/viewvc?view=rev&rev=560029
Log:
Now try to parse datatime with or without time zone info.

Modified:
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java?view=diff&rev=560029&r1=560028&r2=560029
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Thu Jul 26 16:07:37 2007
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.sql.Timestamp;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -395,17 +396,26 @@
                 }
                 
                 String datetimeReceived = UtilXml.childElementValue(receiptLnElement, "os:DATETIMEISO");
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'");
-                Timestamp timestamp = null;
-                try {
-                    timestamp = new Timestamp( sdf.parse(datetimeReceived ).getTime() );
-                    ripCtx.put("datetimeReceived", timestamp);
-                } catch (ParseException e) {
-                    String errMsg = "Error parsing Date: " + e.toString();
-                    errorMapList.add(UtilMisc.toMap("reasonCode", "ParseException", "description", errMsg));
-                    Debug.logError(e, errMsg, module);
+                Date dateTimeInvReceived = null;
+                Timestamp timestampItemReceived = null;
+                try{
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'Z");
+                    dateTimeInvReceived = sdf.parse(datetimeReceived);
+                }catch(ParseException e){
+                    Debug.logInfo("Message does not have timezone information in date field", module);
+                    try{
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'");
+                        dateTimeInvReceived = sdf.parse(datetimeReceived);
+                    }catch(ParseException e1){
+                        String errMsg = "Error parsing Date: " + e1.toString();
+                        errorMapList.add(UtilMisc.toMap("reasonCode", "ParseException", "description", errMsg));
+                        Debug.logError(e, errMsg, module);
+                    }
+                }
+                if(dateTimeInvReceived !=null){
+                    timestampItemReceived = new Timestamp( dateTimeInvReceived.getTime() );
+                    ripCtx.put("datetimeReceived", timestampItemReceived);
                 }
-
                 // Check reference to PO number, if exists
                 GenericValue orderHeader = null;
                 if(orderId != null) {
@@ -423,7 +433,7 @@
                         } else { 
                             // Case : New record entry when PO not exists in the Database
                             orderHeader =  delegator.makeValue("OrderHeader", UtilMisc.toMap("orderId", orderId, "orderTypeId",orderTypeId , 
-                                    "orderDate", timestamp, "statusId", "ORDER_CREATED", "entryDate", UtilDateTime.nowTimestamp(),
+                                    "orderDate", timestampItemReceived, "statusId", "ORDER_CREATED", "entryDate", UtilDateTime.nowTimestamp(),
                                     "productStoreId", UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.SyncInventoryProductStoreId","9001")));
                             toStore.add(orderHeader);
                             GenericValue orderItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderId", orderId , 

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java?view=diff&rev=560029&r1=560028&r2=560029
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Thu Jul 26 16:07:37 2007
@@ -414,7 +414,7 @@
                     Debug.logError(e, errMsg, module);
                 }
             } else {
-                return ServiceUtil.returnError("For Acknowledge Delivery message could not determine if it is for a PO or RMA");
+                return ServiceUtil.returnError("For Acknowledge Delivery message could not determine if it is for a PO or RMA. DOCTYPE from message is " + docType);
             }
         } else {
             String errMsg = "Unknown Message Received";