Author: jacopoc
Date: Tue Aug 1 05:00:15 2006 New Revision: 427547 URL: http://svn.apache.org/viewvc?rev=427547&view=rev Log: Improved the bom simulation screen: it is now possible to get information about qoh and costs of the bom's component. Modified: incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomForms.xml incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomSimulation.ftl incubator/ofbiz/trunk/applications/manufacturing/widget/manufacturing/BomScreens.xml Modified: incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh?rev=427547&r1=427546&r2=427547&view=diff ============================================================================== --- incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh (original) +++ incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh Tue Aug 1 05:00:15 2006 @@ -17,16 +17,58 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; + +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.manufacturing.bom.BOMNode; tree = request.getAttribute("tree"); +String currencyUomId = request.getParameter("currencyUomId"); +String facilityId = request.getParameter("facilityId"); if (tree != null) { - treeArray = new ArrayList(); - treeQty = new HashMap(); + List treeArray = new ArrayList(); + Map treeQty = new HashMap(); tree.print(treeArray); tree.sumQuantities(treeQty); context.put("tree", treeArray); - context.put("treeQty", treeQty.values()); + Iterator treeQtyIt = treeQty.values().iterator(); + List productsData = new ArrayList(); + Double grandTotalCost = null; + while (treeQtyIt.hasNext()) { + BOMNode node = (BOMNode)treeQtyIt.next(); + Double unitCost = null; + Double totalCost = null; + Double qoh = null; + // The standard cost is retrieved + try { + Map outMap = null; + if (UtilValidate.isNotEmpty(currencyUomId)) { + outMap = dispatcher.runSync("getProductCost", UtilMisc.toMap("productId", node.getProduct().getString("productId"), + "currencyUomId", currencyUomId, + "costComponentTypePrefix", "EST_STD", + "userLogin", userLogin)); + unitCost = (Double)outMap.get("productCost"); + totalCost = unitCost * node.getQuantity(); + if (grandTotalCost == null) { + grandTotalCost = 0; + } + grandTotalCost = grandTotalCost + totalCost; + } + if (UtilValidate.isNotEmpty(facilityId)) { + outMap = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", node.getProduct().getString("productId"), + "facilityId", facilityId, + "userLogin", userLogin)); + qoh = (Double)outMap.get("quantityOnHandTotal"); + } + } catch(GenericServiceException gse) { + System.out.println("ERRORE: " + gse.getMessage()); + } + productsData.add(UtilMisc.toMap("node", node, "unitCost", unitCost, "totalCost", totalCost, "qoh", qoh)); + } + context.put("productsData", productsData); + context.put("grandTotalCost", grandTotalCost); } Modified: incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomForms.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomForms.xml?rev=427547&r1=427546&r2=427547&view=diff ============================================================================== --- incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomForms.xml (original) +++ incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomForms.xml Tue Aug 1 05:00:15 2006 @@ -49,6 +49,21 @@ <option key="3" description="${uiLabelMap.ManufacturingImplosion}"/> </drop-down> </field> + <field name="facilityId" title="${uiLabelMap.ProductFacilityId}"> + <drop-down allow-empty="true"> + <entity-options entity-name="Facility" key-field-name="facilityId" description="${facilityName} [${facilityId}]"> + <entity-constraint name="facilityTypeId" value="WAREHOUSE"/> + </entity-options> + </drop-down> + </field> + <field name="currencyUomId" title="${uiLabelMap.ProductCurrencyUomId}" widget-style="selectBox"> + <drop-down allow-empty="true" no-current-selected-key="${defaultCurrencyUomId}"> + <entity-options entity-name="Uom" key-field-name="uomId" description="${description} [${uomId}]"> + <entity-constraint name="uomTypeId" value="CURRENCY_MEASURE"/> + <entity-order-by field-name="description"/> + </entity-options> + </drop-down> + </field> <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"> <submit button-type="button"/> </field> Modified: incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomSimulation.ftl URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomSimulation.ftl?rev=427547&r1=427546&r2=427547&view=diff ============================================================================== --- incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomSimulation.ftl (original) +++ incubator/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/bom/BomSimulation.ftl Tue Aug 1 05:00:15 2006 @@ -29,19 +29,20 @@ <tr> <td width="10%" align="left"><div class="tableheadtext">${uiLabelMap.ManufacturingProductLevel}</div></td> <td width="20%" align="left"><div class="tableheadtext">${uiLabelMap.ProductProductId}</div></td> - <td width="10%" align="left"><div class="tableheadtext">---</div></td> + <td width="10%" align="left"><div class="tableheadtext"> </div></td> <td width="40%" align="left"><div class="tableheadtext">${uiLabelMap.ProductProductName}</div></td> - <td width="20%" align="right"><div class="tableheadtext">${uiLabelMap.CommonQuantity}</div></td> + <td width="10%" align="right"><div class="tableheadtext">${uiLabelMap.CommonQuantity}</div></td> + <td width="10%" align="right"><div class="tableheadtext"> </div></td> </tr> <tr> - <td colspan='5'><hr class='sepbar'></td> + <td colspan="6"><hr class="sepbar"></td> </tr> <#if tree?has_content> <#assign rowClass = "viewManyTR2"> <#list tree as node> - <tr class='${rowClass}'> + <tr class="${rowClass}"> <td><img src='/manufacturing/images/depth${node.depth}.gif' height='16' border='0' alt='Depth'></td> - <td><a href="<@ofbizUrl>EditProductBom?productId=${(node.product.productId)?if_exists}&productAssocTypeId=${(node.bomTypeId)?if_exists}</@ofbizUrl>" class="buttontext">${node.product.productId}</a></td> + <td>${node.product.productId}</td> <td> <#if node.product.isVirtual?default("N") == "Y"> Virtual @@ -50,6 +51,7 @@ </td> <td>${node.product.internalName?default(" ")}</td> <td align="right">${node.quantity}</td> + <td align="right"><a href="<@ofbizUrl>EditProductBom?productId=${(node.product.productId)?if_exists}&productAssocTypeId=${(node.bomTypeId)?if_exists}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonEdit}</a></td> </tr> <#-- toggle the row color --> <#if rowClass == "viewManyTR2"> @@ -68,20 +70,31 @@ <hr> <table border='0' cellspacing='0' cellpadding='2' class='boxbottom'> <tr> - <td width="20%" align="left"><div class="tableheadtext">${uiLabelMap.ProductProductId}</div></td> - <td width="40%" align="left"><div class="tableheadtext">${uiLabelMap.ProductProductName}</div></td> - <td width="40%" align="right"><div class="tableheadtext">${uiLabelMap.CommonQuantity}</div></td> + <td width="18%" align="left"><div class="tableheadtext">${uiLabelMap.ProductProductId}</div></td> + <td width="50%" align="left"><div class="tableheadtext">${uiLabelMap.ProductProductName}</div></td> + <td width="8%" align="right"><div class="tableheadtext">${uiLabelMap.CommonQuantity}</div></td> + <td width="8%" align="right"><div class="tableheadtext">${uiLabelMap.ProductQoh}</div></td> + <td width="8%" align="right"><div class="tableheadtext">${uiLabelMap.FormFieldTitle_cost}</div></td> + <td width="8%" align="right"><div class="tableheadtext">${uiLabelMap.CommonTotalCost}</div></td> </tr> <tr> - <td colspan='3'><hr class='sepbar'></td> + <td colspan="6"><hr class="sepbar"></td> </tr> - <#if treeQty?has_content> + <#if productsData?has_content> <#assign rowClass = "viewManyTR2"> - <#list treeQty as nodeQty> + <#list productsData as productData> + <#assign node = productData.node> <tr class='${rowClass}'> - <td>${nodeQty.product.productId}</td> - <td>${nodeQty.product.internalName?default(" ")}</td> - <td align="right">${nodeQty.quantity}</td> + <td><a href="/catalog/control/EditProduct?productId=${node.product.productId}" class="buttontext">${node.product.productId}</a></td> + <td>${node.product.internalName?default(" ")}</td> + <td align="right">${node.quantity}</td> + <td align="right">${productData.qoh?if_exists}</td> + <#if productData.unitCost?exists && (productData.unitCost > 0)> + <td align="right">${productData.unitCost?if_exists}</td> + <#else> + <td align="center"><a href="/catalog/control/EditProductCosts?productId=${node.product.productId}" class="buttontext">NA</a></td> + </#if> + <td align="right">${productData.totalCost?if_exists}</td> </tr> <#-- toggle the row color --> <#if rowClass == "viewManyTR2"> @@ -89,11 +102,16 @@ <#else> <#assign rowClass = "viewManyTR2"> </#if> - </#list> + </#list> + <#if grandTotalCost?exists> + <tr> + <td colspan="6" align="right"><div class="tableheadtext">${grandTotalCost}</div></td> + </tr> + </#if> <#else> <tr> - <td colspan='4'><div class='head3'>${uiLabelMap.CommonNoElementFound}.</div></td> - </tr> + <td colspan="6"><div class="head3">${uiLabelMap.CommonNoElementFound}.</div></td> + </tr> </#if> </table> </#if> Modified: incubator/ofbiz/trunk/applications/manufacturing/widget/manufacturing/BomScreens.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/widget/manufacturing/BomScreens.xml?rev=427547&r1=427546&r2=427547&view=diff ============================================================================== --- incubator/ofbiz/trunk/applications/manufacturing/widget/manufacturing/BomScreens.xml (original) +++ incubator/ofbiz/trunk/applications/manufacturing/widget/manufacturing/BomScreens.xml Tue Aug 1 05:00:15 2006 @@ -110,9 +110,10 @@ <set field="type" from-field="parameters.type"/> <set field="quantity" from-field="parameters.quantity"/> <set field="amount" from-field="parameters.amount"/> - + <set field="productFeatureApplTypeId" value="STANDARD_FEATURE"/> - + <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/> + <entity-and entity-name="ProductFeatureAndAppl" list-name="selectedFeatures"> <field-map env-name="productId" field-name="productId"/> <field-map env-name="productFeatureApplTypeId" field-name="productFeatureApplTypeId"/> |
Free forum by Nabble | Edit this page |