From bc5793bee1ae598fa5cf4eeee3674f0784feefc4 Mon Sep 17 00:00:00 2001 From: Andrew Zeneski Date: Tue, 16 Jan 2007 17:20:28 +0000 Subject: [PATCH] new helper method to check if bin is complete git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@496779 13f79535-47bb-0310-9956-ffa450edef68 --- .../shipment/picklist/PickListServices.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java b/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java index 111fd0800f..f5e55d183a 100644 --- a/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java +++ b/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java @@ -29,8 +29,10 @@ import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; public class PickListServices { @@ -82,4 +84,28 @@ public class PickListServices { result.put("orderHeaderList", orderHeaderList); return result; } + + public static boolean isBinComplete(GenericDelegator delegator, String picklistBinId) throws GeneralException { + // lookup the items in the bin + List items; + try { + items = delegator.findByAnd("PicklistItem", UtilMisc.toMap("picklistBinId", picklistBinId)); + } catch (GenericEntityException e) { + Debug.logError(e, module); + throw e; + } + + if (items != null) { + Iterator i = items.iterator(); + GenericValue v = (GenericValue) i.next(); + String itemStatus = v.getString("itemStatusId"); + if (itemStatus != null) { + if (!"PICKITEM_COMPLETED".equals(itemStatus)) { + return false; + } + } + } + + return true; + } }