Enhanced view facility inventory by product to search by internalName and ATP - min stock quantities.

git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@441594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Si Chen
2006-09-08 17:52:29 +00:00
parent 5670c0481a
commit 8cf8eaec2c
4 changed files with 51 additions and 16 deletions
@@ -994,8 +994,10 @@ ProductPurposeTypeNotFoundWithId=Purpose Type not found with ID
ProductQoh=QOH
ProductQtyReceived=Qty Received
ProductQtyRejected=Qty Rejected
ProductQtyOffset=QOH minus Min Stock
ProductQtyOffsetBelow=QOH minus Min Stock <=
ProductQtyOffsetATP=ATP minus Min Stock
ProductQtyOffsetQOH=QOH minus Min Stock
ProductQtyOffsetATPBelow=ATP minus Min Stock <=
ProductQtyOffsetQOHBelow=QOH minus Min Stock <=
ProductQuantity=Quantity
ProductQuantityAccepted=Quantity Accepted
ProductQuantityIncluded=Quantity Included
@@ -34,7 +34,11 @@ action = request.getParameter("action");
String searchParameterString = "";
searchParameterString = "action=Y&facilityId=" + facilityId;
qty = -1;
offsetQOH = -1;
offsetATP = -1;
boolean hasOffsetQOH = false;
boolean hasOffsetATP = false;
List rows = new ArrayList();
@@ -43,12 +47,18 @@ if (action != null) {
DynamicViewEntity prodView = new DynamicViewEntity();
Map conditionMap = UtilMisc.toMap("facilityId", facilityId);
if (offsetQty != null && offsetQty.length() > 0) {
if (offsetQOHQty != null && offsetQOHQty.length() > 0) {
try {
qty = Integer.parseInt(offsetQty);
searchParameterString = searchParameterString + "&offsetQty=" + offsetQty;
offsetQOH = Integer.parseInt(offsetQOHQty);
hasOffsetQOH = true;
} catch(NumberFormatException nfe) {
}
}
if (offsetATPQty != null && offsetATPQty.length() > 0) {
try {
offsetATP = Integer.parseInt(offsetATPQty);
hasOffsetATP = true;
} catch(NumberFormatException nfe) {
qty = -1;
}
}
@@ -57,6 +67,7 @@ if (action != null) {
prodView.addMemberEntity("PROD", "Product");
prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
prodView.addAlias("PROD", "internalName");
prodView.addAlias("PROD", "isVirtual");
prodView.addAlias("PROD", "salesDiscontinuationDate");
if (productTypeId != null && productTypeId.length() > 0) {
@@ -96,6 +107,11 @@ if (action != null) {
EntityOperator.OR);
whereConditionsList.add(discontinuationDateCondition);
}
// add search on internal name
if (UtilValidate.isNotEmpty(internalName)) {
whereConditionsList.add(new EntityExpr("internalName", true, EntityOperator.LIKE, "%" + internalName + "%", true));
}
EntityCondition whereCondition = new EntityConditionList(whereConditionsList, EntityOperator.AND);
@@ -133,17 +149,26 @@ if (action != null) {
} else {
resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", contextInput);
}
// qty
// filter for quantities
minimumStockInt = 0;
if (oneProd.get("minimumStock") != null) {
minimumStockInt = (oneProd.getDouble("minimumStock")).intValue();
}
quantityOnHandTotalInt = 0;
if (resultOutput.get("quantityOnHandTotal") != null) {
quantityOnHandTotalInt = ((Double)resultOutput.get("quantityOnHandTotal")).intValue();
}
offsetQtyAvailable = quantityOnHandTotalInt - minimumStockInt;
if (qty >= 0 && offsetQtyAvailable > qty) continue;
offsetQOHQtyAvailable = quantityOnHandTotalInt - minimumStockInt;
if (hasOffsetQOH && offsetQOHQtyAvailable > offsetQOH) continue;
availableToPromiseTotalInt = 0;
if (resultOutput.get("availableToPromiseTotal") != null) {
availableToPromiseTotalInt = ((Double)resultOutput.get("availableToPromiseTotal")).intValue();
}
offsetATPQtyAvailable = availableToPromiseTotalInt - minimumStockInt;
if (hasOffsetATP && offsetATPQtyAvailable > offsetATP) continue;
oneInventory = new HashMap();
oneInventory.put("productId", oneProd.getString("productId"));
@@ -152,7 +177,8 @@ if (action != null) {
oneInventory.put("daysToShip", oneProd.getString("daysToShip"));
oneInventory.put("totalQuantityOnHand", resultOutput.get("quantityOnHandTotal"));
oneInventory.put("totalAvailableToPromise", resultOutput.get("availableToPromiseTotal"));
oneInventory.put("offsetQtyAvailable", offsetQtyAvailable);
oneInventory.put("offsetQOHQtyAvailable", offsetQOHQtyAvailable);
oneInventory.put("offsetATPQtyAvailable", offsetATPQtyAvailable);
rows.add(oneInventory);
}
@@ -23,6 +23,9 @@ under the License.
default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext">
<field name="facilityId"><hidden/></field>
<field name="action"><hidden value="SEARCH"/></field>
<field name="internalName" title="${uiLabelMap.ProductInternalName}" widget-style="inputBox">
<text/>
</field>
<field name="productTypeId" title="${uiLabelMap.ProductProductType}" widget-style="selectBox">
<drop-down allow-empty="true">
<entity-options entity-name="ProductType" description="${description}"> <!-- [${productTypeId}] -->
@@ -48,11 +51,12 @@ under the License.
</entity-options>
</drop-down>
</field>
<field name="offsetQty" title="${uiLabelMap.ProductQtyOffsetBelow}"><text/></field>
<field name="productsSoldThruTimestamp" title="${uiLabelMap.ProductShowProductsSoldThruTimestamp}">
<field name="offsetQOHQty" title="${uiLabelMap.ProductQtyOffsetQOHBelow}" widget-style="inputBox"><text/></field>
<field name="offsetATPQty" title="${uiLabelMap.ProductQtyOffsetATPBelow}" widget-style="inputBox"><text/></field>
<field name="productsSoldThruTimestamp" title="${uiLabelMap.ProductShowProductsSoldThruTimestamp}" widget-style="inputBox">
<date-time/>
</field>
<field name="VIEW_SIZE" title="${uiLabelMap.ProductShowProductsPerPage}"><text default-value="50"/></field>
<field name="VIEW_SIZE" title="${uiLabelMap.ProductShowProductsPerPage}" widget-style="inputBox"><text default-value="50"/></field>
<field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit">
<submit button-type="button"/>
</field>
@@ -71,7 +75,8 @@ under the License.
<field name="daysToShip" title="${uiLabelMap.ProductDaysToShip}" widget-area-style="tabletextright"><display/></field>
<field name="totalAvailableToPromise" title="${uiLabelMap.CommonTotal} ${uiLabelMap.ProductAtp}" widget-area-style="tabletextright"><display/></field>
<field name="totalQuantityOnHand" title="${uiLabelMap.CommonTotal} ${uiLabelMap.ProductQoh}" widget-area-style="tabletextright"><display/></field>
<field name="offsetQtyAvailable" title="${uiLabelMap.ProductQtyOffset}" widget-area-style="tabletextright"><display/></field>
<field name="offsetQOHQtyAvailable" title="${uiLabelMap.ProductQtyOffsetQOH}" widget-area-style="tabletextright"><display/></field>
<field name="offsetATPQtyAvailable" title="${uiLabelMap.ProductQtyOffsetATP}" widget-area-style="tabletextright"><display/></field>
</form>
<form name="SearchInventoryItemsParams" type="single" target="SearchInventoryItems"
@@ -211,8 +211,10 @@ under the License.
<set field="productTypeId" from-field="parameters.productTypeId"/>
<set field="searchInProductCategoryId" from-field="parameters.searchInProductCategoryId"/>
<set field="productSupplierId" from-field="parameters.productSupplierId"/>
<set field="offsetQty" from-field="parameters.offsetQty"/>
<set field="offsetQOHQty" from-field="parameters.offsetQOHQty"/>
<set field="offsetATPQty" from-field="parameters.offsetATPQty"/>
<set field="productsSoldThruTimestamp" from-field="parameters.productsSoldThruTimestamp"/>
<set field="internalName" from-field="parameters.internalName"/>
<script location="component://product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh"/>
</actions>