Author: jwickers
Date: 2008-08-27 05:17:28 -0700 (Wed, 27 Aug 2008)
New Revision: 9433
Added:
versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryItem.java
Modified:
versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryRepositoryInterface.java
versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryRepository.java
versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryService.java
Log:
#413
Add InventoryItem domain object.
Refactor to use the new methods:
isSerialized
isQuantityOnHand
isAvailableToPromise
Added: versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryItem.java
===================================================================
--- versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryItem.java (rev 0)
+++ versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryItem.java 2008-08-27 12:17:28 UTC (rev 9433)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2006 - 2007 Open Source Strategies, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the Honest Public License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Honest Public License for more details.
+ *
+ * You should have received a copy of the Honest Public License
+ * along with this program; if not, write to Funambol,
+ * 643 Bair Island Road, Suite 305 - Redwood City, CA 94063, USA
+ */
+package org.opentaps.domain.inventory;
+
+import org.opentaps.foundation.repository.RepositoryException;
+
+
+public class InventoryItem extends org.opentaps.domain.base.entities.InventoryItem {
+
+ public InventoryItem() {
+ super();
+ }
+
+ public Boolean isSerialized() {
+ return "SERIALIZED_INV_ITEM".equals(this.getInventoryItemTypeId());
+ }
+
+ public Boolean isQuantityOnHand() {
+ String statusId = this.getStatusId();
+ return "INV_AVAILABLE".equals(statusId) || "INV_PROMISED".equals(statusId) || "INV_BEING_TRANSFERED".equals(statusId);
+ }
+
+ public Boolean isAvailableToPromise() {
+ return "INV_AVAILABLE".equals(this.getStatusId());
+ }
+}
Modified: versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryRepositoryInterface.java
===================================================================
--- versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryRepositoryInterface.java 2008-08-27 07:29:12 UTC (rev 9432)
+++ versions/1.0/trunk/hot-deploy/opentaps-common/src/org/opentaps/domain/inventory/InventoryRepositoryInterface.java 2008-08-27 12:17:28 UTC (rev 9433)
@@ -3,7 +3,7 @@
import org.opentaps.foundation.entity.EntityNotFoundException;
import org.opentaps.foundation.repository.RepositoryException;
import org.opentaps.foundation.repository.RepositoryInterface;
-import org.opentaps.domain.base.entities.InventoryItem;
+import org.opentaps.domain.inventory.InventoryItem;
import java.sql.Timestamp;
import java.util.List;
Modified: versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryRepository.java
===================================================================
--- versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryRepository.java 2008-08-27 07:29:12 UTC (rev 9432)
+++ versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryRepository.java 2008-08-27 12:17:28 UTC (rev 9433)
@@ -22,7 +22,7 @@
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
-import org.opentaps.domain.base.entities.InventoryItem;
+import org.opentaps.domain.inventory.InventoryItem;
import org.opentaps.domain.inventory.InventoryRepositoryInterface;
import org.opentaps.foundation.entity.EntityNotFoundException;
import org.opentaps.foundation.infrastructure.Infrastructure;
Modified: versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryService.java
===================================================================
--- versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryService.java 2008-08-27 07:29:12 UTC (rev 9432)
+++ versions/1.0/trunk/hot-deploy/warehouse/src/org/opentaps/warehouse/domain/inventory/InventoryService.java 2008-08-27 12:17:28 UTC (rev 9433)
@@ -19,7 +19,7 @@
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.service.ServiceUtil;
-import org.opentaps.domain.base.entities.InventoryItem;
+import org.opentaps.domain.inventory.InventoryItem;
import org.opentaps.domain.inventory.InventoryServiceInterface;
import org.opentaps.domain.inventory.InventoryDomainInterface;
import org.opentaps.domain.inventory.InventoryRepositoryInterface;
@@ -81,16 +81,14 @@
quantityOnHandTotal = 0.0;
for (InventoryItem item : items) {
- String type = item.getInventoryItemTypeId();
- String statusId = item.getStatusId();
- if ("SERIALIZED_INV_ITEM".equals(type)) {
- if ("INV_AVAILABLE".equals(statusId) || "INV_PROMISED".equals(statusId) || "INV_BEING_TRANSFERED".equals(statusId)) {
+ if (item.isSerialized()) {
+ if (item.isQuantityOnHand()) {
quantityOnHandTotal++;
}
- if ("INV_AVAILABLE".equals(statusId)) {
+ if (item.isAvailableToPromise()) {
availableToPromiseTotal++;
}
- } else if ("NON_SERIAL_INV_ITEM".equals(type)) {
+ } else {
if (item.getQuantityOnHandTotal() != null) {
quantityOnHandTotal += item.getQuantityOnHandTotal().doubleValue();
}
|