Author: mor
Date: Thu Aug 6 15:34:10 2009 New Revision: 801675 URL: http://svn.apache.org/viewvc?rev=801675&view=rev Log: Improvements in Verify Pick screen. If user specify product country of origin while verifying the order then this will be saved in Product.originGeoId field and next time if a different order comes for verification and does have the same product then the country of origin will automatically populate on verify order screen. Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml ofbiz/trunk/applications/product/servicedef/services_shipment.xml ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java ofbiz/trunk/applications/product/webapp/facility/shipment/VerifyPick.ftl Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=801675&r1=801674&r2=801675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original) +++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Thu Aug 6 15:34:10 2009 @@ -9139,6 +9139,9 @@ <value xml:lang="th">à¸à¸£à¸°à¹à¸à¸¨</value> <value xml:lang="zh">å½å®¶</value> </property> + <property key="ProductCountryOfOrigin"> + <value xml:lang="en">Country of Origin</value> + </property> <property key="ProductCreateAProductFeatureCategory"> <value xml:lang="de">Produktmerkmal Kategorie erstellen</value> <value xml:lang="en">Create a Product Feature Category</value> Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=801675&r1=801674&r2=801675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Thu Aug 6 15:34:10 2009 @@ -460,6 +460,7 @@ <attribute name="facilityId" type="String" mode="IN" optional="true"/> <attribute name="pickerPartyId" type="String" mode="IN" optional="true"/> <attribute name="productMap" type="Map" string-map-prefix="prd_" mode="IN" optional="true"/> + <attribute name="originGeoIdMap" type="Map" string-map-prefix="geo_" mode="IN" optional="true"/> <attribute name="quantityMap" type="Map" string-map-prefix="qty_" mode="IN" optional="true"/> <attribute name="selectedMap" type="Map" string-map-prefix="sel_" mode="IN" optional="true"/> <attribute name="itemMap" type="Map" string-map-prefix="ite_" mode="IN" optional="true"/> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickServices.java?rev=801675&r1=801674&r2=801675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickServices.java Thu Aug 6 15:34:10 2009 @@ -40,10 +40,11 @@ String orderId = (String) context.get("orderId"); String shipGroupSeqId = (String) context.get("shipGroupSeqId"); String productId = (String) context.get("productId"); + String originGeoId = (String) context.get("originGeoId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); if (quantity != null) { try { - pickSession.createRow(orderId, null, shipGroupSeqId, productId, quantity, locale); + pickSession.createRow(orderId, null, shipGroupSeqId, productId, originGeoId, quantity, locale); } catch (GeneralException e) { return ServiceUtil.returnError(e.getMessage()); } @@ -59,17 +60,19 @@ Map<String, ?> selectedMap = UtilGenerics.checkMap(context.get("selectedMap")); Map<String, String> itemMap = UtilGenerics.checkMap(context.get("itemMap")); Map<String, String> productMap = UtilGenerics.checkMap(context.get("productMap")); + Map<String, String> originGeoIdMap = UtilGenerics.checkMap(context.get("originGeoIdMap")); Map<String, String> quantityMap = UtilGenerics.checkMap(context.get("quantityMap")); if (selectedMap != null) { for (String rowKey : selectedMap.keySet()) { String orderItemSeqId = itemMap.get(rowKey); String productId = productMap.get(rowKey); + String originGeoId = originGeoIdMap.get(rowKey); String quantityStr = quantityMap.get(rowKey); if (UtilValidate.isNotEmpty(quantityStr)) { BigDecimal quantity = new BigDecimal(quantityStr); if (quantity.compareTo(ZERO) > 0) { try { - pickSession.createRow(orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, locale); + pickSession.createRow(orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, quantity, locale); } catch (Exception ex) { return ServiceUtil.returnError(ex.getMessage()); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=801675&r1=801674&r2=801675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java Thu Aug 6 15:34:10 2009 @@ -81,7 +81,7 @@ return _delegator; } - public void createRow(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, BigDecimal quantity, Locale locale) throws GeneralException { + public void createRow(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String originGeoId, BigDecimal quantity, Locale locale) throws GeneralException { if (orderItemSeqId == null && productId != null) { orderItemSeqId = this.findOrderItemSeqId(productId, orderId, shipGroupSeqId, quantity, locale); @@ -102,7 +102,7 @@ if (reservations.size() == 1) { GenericValue reservation = EntityUtil.getFirst(reservations); int checkCode = this.checkRowForAdd(reservation, orderId, orderItemSeqId, shipGroupSeqId, productId, quantity); - this.createVerifyPickRow(checkCode, reservation, orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, locale); + this.createVerifyPickRow(checkCode, reservation, orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, quantity, locale); } else { // more than one reservation found Map<GenericValue, BigDecimal> reserveQtyMap = FastMap.newInstance(); @@ -142,7 +142,7 @@ for (Map.Entry<GenericValue, BigDecimal> entry : reserveQtyMap.entrySet()) { GenericValue reservation = entry.getKey(); BigDecimal qty = entry.getValue(); - this.createVerifyPickRow(2, reservation, orderId, orderItemSeqId, shipGroupSeqId, productId, qty, locale); + this.createVerifyPickRow(2, reservation, orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, qty, locale); } } else { throw new GeneralException(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNotEnoughInventoryReservationAvailableCannotVerifyTheItem", locale)); @@ -209,7 +209,7 @@ } } - protected void createVerifyPickRow(int checkCode, GenericValue res, String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, BigDecimal quantity, Locale locale) throws GeneralException { + protected void createVerifyPickRow(int checkCode, GenericValue res, String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String originGeoId,BigDecimal quantity, Locale locale) throws GeneralException { // process the result; add new item if necessary switch (checkCode) { case 0: @@ -221,7 +221,7 @@ case 2: // need to create a new item String inventoryItemId = res.getString("inventoryItemId"); - pickRows.add(new VerifyPickSessionRow(orderId, orderItemSeqId, shipGroupSeqId, productId, inventoryItemId, quantity)); + pickRows.add(new VerifyPickSessionRow(orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, inventoryItemId, quantity)); break; } } @@ -305,6 +305,7 @@ String shipmentId = this.createShipment((this.getPickRows(orderId)).get(0)); this.issueItemsToShipment(shipmentId, locale); + this.updateProduct(); // Update the shipment status to Picked, this will trigger createInvoicesFromShipment and finally a invoice will be created Map updateShipmentCtx = FastMap.newInstance(); @@ -423,4 +424,19 @@ String shipmentId = (String) newShipResp.get("shipmentId"); return shipmentId; } + + protected void updateProduct() throws GeneralException { + for (VerifyPickSessionRow pickRow : this.getPickRows()) { + if (UtilValidate.isNotEmpty(pickRow.getOriginGeoId())) { + Map updateProductCtx = FastMap.newInstance(); + updateProductCtx.put("originGeoId", pickRow.getOriginGeoId()); + updateProductCtx.put("productId", pickRow.getProductId()); + updateProductCtx.put("userLogin", this.getUserLogin()); + Map<String, Object> result = this.getDispatcher().runSync("updateProduct", updateProductCtx); + if (ServiceUtil.isError(result)) { + throw new GeneralException(ServiceUtil.getErrorMessage(result)); + } + } + } + } } \ No newline at end of file Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java?rev=801675&r1=801674&r2=801675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java Thu Aug 6 15:34:10 2009 @@ -39,6 +39,7 @@ protected String orderItemSeqId = null; protected String shipGroupSeqId = null; protected String productId = null; + protected String originGeoId = null; protected String inventoryItemId = null; protected BigDecimal readyToVerifyQty = BigDecimal.ZERO; protected GenericValue orderItem = null; @@ -48,11 +49,12 @@ public VerifyPickSessionRow() { } - public VerifyPickSessionRow(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId, BigDecimal quantity) { + public VerifyPickSessionRow(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String originGeoId, String inventoryItemId, BigDecimal quantity) { this.orderId = orderId; this.orderItemSeqId = orderItemSeqId; this.shipGroupSeqId = shipGroupSeqId; this.productId = productId; + this.originGeoId = originGeoId; this.readyToVerifyQty = quantity; this.inventoryItemId = inventoryItemId; this.shipmentItemSeqId = null; @@ -75,6 +77,10 @@ return this.productId; } + public String getOriginGeoId() { + return this.originGeoId; + } + public String getInventoryItemId() { return this.inventoryItemId; } Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/VerifyPick.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/VerifyPick.ftl?rev=801675&r1=801674&r2=801675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/shipment/VerifyPick.ftl (original) +++ ofbiz/trunk/applications/product/webapp/facility/shipment/VerifyPick.ftl Thu Aug 6 15:34:10 2009 @@ -194,6 +194,7 @@ <td>${uiLabelMap.ProductItem} #</td> <td>${uiLabelMap.ProductProductId}</td> <td>${uiLabelMap.ProductInternalName}</td> + <td>${uiLabelMap.ProductCountryOfOrigin}</td> <td align="right">${uiLabelMap.ProductOrderedQuantity}</td> <td align="right">${uiLabelMap.ProductVerified} ${uiLabelMap.CommonQuantity}</td> <td align="center">${uiLabelMap.CommonQty} ${uiLabelMap.CommonTo} ${uiLabelMap.ProductVerify}</td> @@ -222,7 +223,7 @@ <#assign counter = counter +1> </#if> <#assign orderItemQuantity = orderItemQuantity.subtract(verifiedQuantity)> - <#assign orderProduct = orderItem.getRelatedOne("Product")?if_exists/> + <#assign product = orderItem.getRelatedOne("Product")?if_exists/> <tr> <#if (orderItemQuantity.compareTo(readyToVerify) > 0) > <td><input type="checkbox" name="sel_${rowKey}" value="Y" checked=""/></td> @@ -231,9 +232,21 @@ <td> </td> </#if> <td>${orderItemSeqId?if_exists}</td> - <td>${orderProduct.productId?default("N/A")}</td> + <td>${product.productId?default("N/A")}</td> <td> - <a href="/catalog/control/EditProduct?productId=${orderProduct.productId?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${(orderProduct.internalName)?if_exists}</a> + <a href="/catalog/control/EditProduct?productId=${product.productId?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${(product.internalName)?if_exists}</a> + </td> + <td> + <select name="geo_${rowKey}"> + <#if product.originGeoId?has_content> + <#assign originGeoId = product.originGeoId> + <#assign geo = delegator.findOne("Geo", Static["org.ofbiz.base.util.UtilMisc"].toMap("geoId", originGeoId), true)> + <option value="${originGeoId}">${geo.geoName?if_exists}</option> + <option value="${originGeoId}">---</option> + </#if> + <option value=""></option> + ${screens.render("component://common/widget/CommonScreens.xml#countries")} + </select> </td> <td align="right">${orderItemQuantity?if_exists}</td> <td align="right">${readyToVerify?if_exists}</td> |
Free forum by Nabble | Edit this page |