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/08/15 01:55:08 UTC
svn commit: r565978 -
/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
Author: apatel
Date: Tue Aug 14 16:55:08 2007
New Revision: 565978
URL: http://svn.apache.org/viewvc?view=rev&rev=565978
Log:
If returned non serial inventory is not selable then createPhysicalInventoryAndVariance.
Modified:
ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.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=565978&r1=565977&r2=565978
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Tue Aug 14 16:55:08 2007
@@ -650,6 +650,7 @@
}
String statusId = null;
+ //String inventoryItemId = null;
List invItemIds = FastList.newInstance();
// get RECEIPTLN elements from message
List acknowledgeElementList = UtilXml.childElementList(acknowledgeDeliveryElement, "ns:RECEIPTLN");
@@ -791,7 +792,7 @@
updateInvItmMap.put( "productId",productId);
}
try {
- Map test = dispatcher.runSync("updateInventoryItem", updateInvItmMap);
+ dispatcher.runSync("updateInventoryItem", updateInvItmMap);
} catch (GenericServiceException e) {
String errMsg = "Error running service updateInventoryItem: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "GenericServiceException", "description", errMsg));
@@ -809,7 +810,7 @@
localRipCtx.put("serialNumber", serialNum);
localRipCtx.put("productId", productId);
localRipCtx.put("returnItemSeqId", returnItemSeqId);
- runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher, invItemIds);
+ invItemIds.add(UtilMisc.toMap("inventoryItemId", runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher)));
}
}
} else {
@@ -822,7 +823,29 @@
localRipCtx.put("quantityRejected", new Double(0.0));
localRipCtx.put("productId", productId);
localRipCtx.put("returnItemSeqId", returnItemSeqId);
- runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher, invItemIds);
+ String inventoryItemId = runReceiveInventoryProduct( localRipCtx , errorMapList , dispatcher);
+ invItemIds.add(UtilMisc.toMap("inventoryItemId", inventoryItemId));
+ if (("INV_ON_HOLD").equals(invItemStatusId)) {
+ Map createPhysicalInvAndVarCtx = FastMap.newInstance();
+ createPhysicalInvAndVarCtx.put("inventoryItemId", inventoryItemId);
+ createPhysicalInvAndVarCtx.put("physicalInventoryDate", UtilDateTime.nowTimestamp());
+ createPhysicalInvAndVarCtx.put("generalComments", "Damaged, in repair");
+ createPhysicalInvAndVarCtx.put("varianceReasonId", "VAR_DAMAGED");
+ createPhysicalInvAndVarCtx.put("availableToPromiseVar", new Double(-quantityAccepted));
+ createPhysicalInvAndVarCtx.put("quantityOnHandVar", new Double(0.0));
+ createPhysicalInvAndVarCtx.put("userLogin", userLogin);
+ try {
+ Map cpivResult = dispatcher.runSync("createPhysicalInventoryAndVariance", createPhysicalInvAndVarCtx);
+ if (ServiceUtil.isError(cpivResult)) {
+ String errMsg = ServiceUtil.getErrorMessage(cpivResult);
+ errorMapList.add(UtilMisc.toMap("reasonCode", "CreatePhysicalInventoryAndVarianceServiceError", "description", errMsg));
+ }
+ } catch (GenericServiceException e) {
+ String errMsg = "Error running service createPhysicalInventoryAndVariance: " + e.toString();
+ errorMapList.add(UtilMisc.toMap("reasonCode", "GenericServiceException", "description", errMsg));
+ Debug.logError(e, errMsg, module);
+ }
+ }
}
} else {
// TODOLATER: need to run service receiveInventoryProduct and updateInventoryItem when quantityRejected > 0
@@ -902,20 +925,23 @@
return result;
}
- public static void runReceiveInventoryProduct(Map localRipCtx, List errorMapList, LocalDispatcher dispatcher, List invItemIds) {
+ public static String runReceiveInventoryProduct(Map localRipCtx, List errorMapList, LocalDispatcher dispatcher) {
+ Map ripResult = FastMap.newInstance();
try {
- Map ripResult = dispatcher.runSync("receiveInventoryProduct", localRipCtx);
+ ripResult = dispatcher.runSync("receiveInventoryProduct", localRipCtx);
if (ServiceUtil.isError(ripResult)) {
String errMsg = ServiceUtil.getErrorMessage(ripResult);
errorMapList.add(UtilMisc.toMap("reasonCode", "ReceiveInventoryServiceError", "description", errMsg));
- } else {
- invItemIds.add(UtilMisc.toMap("inventoryItemId", (String) ripResult.get("inventoryItemId")));
+ return null;
}
} catch (GenericServiceException e) {
String errMsg = "Error running service receiveInventoryProduct: "
+ e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "GenericServiceException", "description", errMsg));
Debug.logError(e, errMsg, module);
+ return null;
}
+
+ return (String) ripResult.get("inventoryItemId");
}
}