Author: jacopoc
Date: Wed Mar 28 09:53:54 2007
New Revision: 523409
URL:
http://svn.apache.org/viewvc?view=rev&rev=523409Log:
Marketing packages and production runs: added missing output parameter under certain conditions.
Modified:
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?view=diff&rev=523409&r1=523408&r2=523409==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Wed Mar 28 09:53:54 2007
@@ -1294,6 +1294,7 @@
}
List inventoryItemIds = new ArrayList();
+ result.put("inventoryItemIds", inventoryItemIds);
// The production run is loaded
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
// The last task is loaded
@@ -1305,17 +1306,20 @@
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductIsWIP", locale));
}
Double quantityProduced = productionRun.getGenericValue().getDouble("quantityProduced");
+
if (quantityProduced == null) {
quantityProduced = new Double(0);
}
Double quantityDeclared = lastTask.getDouble("quantityProduced");
+
if (quantityDeclared == null) {
quantityDeclared = new Double(0);
}
// If the quantity already produced is not lower than the quantity declared, no inventory is created.
double maxQuantity = quantityDeclared.doubleValue() - quantityProduced.doubleValue();
+
if (maxQuantity <= 0) {
- return ServiceUtil.returnSuccess();
+ return result;
}
// If quantity was not passed, the max quantity is used
@@ -1461,7 +1465,6 @@
}
}
result.put("quantity", quantity);
- result.put("inventoryItemIds", inventoryItemIds);
return result;
}