From d48eee698633ac4e25a229c8bea862c2ba7c8136 Mon Sep 17 00:00:00 2001 From: Ashish Vijaywargiya Date: Tue, 10 Nov 2009 14:32:53 +0000 Subject: [PATCH] Applied patch from jira issue OFBIZ-3173 - Better supportability for products of type MARKETING_PKG_AUTO in order processing and fulfillment process. Following points are covered in this patch: 1) Show associated products for product of type "MARKETING_PKG_AUTO" on order items section of show cart page in order manager application. 2) Marketing packages should only shown backordered when ATP of product which compose Marketing packages product are less than quantity added in cart. 3) Pick sheets should show Products of type Marketing Packages along with the products which compose Marketing Packages. 4) Show link of production run created on order items section of Order detail page while placing order for product of type MARKETING_PKG_AUTO. 5) Product of type Marketing Packages should be shown on Verify Pick Screen along with Products they are composed of. Thanks Divesh for the contribution - this is very nice addition to the trunk. I would be more then happy to see comments / concern from - Jacopo? Scott? Anil? or others? git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@834479 13f79535-47bb-0310-9956-ffa450edef68 --- .../jobshopmgt/ProductionRunServices.java | 6 ++ applications/order/config/OrderUiLabels.xml | 6 ++ .../lookup/LookupAssociatedProducts.groovy | 46 ++++++++++ .../webapp/ordermgr/WEB-INF/controller.xml | 3 + .../ordermgr/entry/cart/showcartitems.ftl | 40 ++++++++- .../widget/ordermgr/OrderEntryCartScreens.xml | 18 ++++ .../order/widget/ordermgr/OrderEntryForms.xml | 20 +++++ .../product/inventory/InventoryServices.java | 4 +- .../facility/facility/PrintPickSheets.fo.ftl | 83 +++++++++++++++++-- .../webapp/facility/shipment/VerifyPick.ftl | 33 ++++++++ .../widget/facility/ShipmentScreens.xml | 1 + specialpurpose/ecommerce/data/DemoProduct.xml | 16 +++- 12 files changed, 260 insertions(+), 16 deletions(-) create mode 100644 applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy diff --git a/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java index e8f1888638..ce49b717ff 100644 --- a/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java +++ b/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java @@ -2392,6 +2392,12 @@ public class ProductionRunServices { String productionRunId = (String)resultService.get("productionRunId"); result.put("productionRunId", productionRunId); + + try { + delegator.create("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId, "orderId", orderId, "orderItemSeqId", orderItemSeqId)); + } catch (GenericEntityException e) { + return ServiceUtil.returnError("Error creating a production run for marketing package for order [" + orderId + " " + orderItemSeqId + "]: " + e.getMessage()); + } try { serviceContext.clear(); diff --git a/applications/order/config/OrderUiLabels.xml b/applications/order/config/OrderUiLabels.xml index 823a066716..9479d148ce 100644 --- a/applications/order/config/OrderUiLabels.xml +++ b/applications/order/config/OrderUiLabels.xml @@ -1513,6 +1513,9 @@ ปรับปรุงคำร้องสินค้า 已批准的产品需求 + + Associated Products + Auth Service Servicio de autentificación @@ -3946,6 +3949,9 @@ Mark Viewed Marca come visionato + + Marketing Package Composed by: + Způsob Methode diff --git a/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy b/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy new file mode 100644 index 0000000000..fd6dfe0377 --- /dev/null +++ b/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javolution.util.FastList; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityUtil; + +productId = request.getParameter("productId"); + +if (productId != null) { + product = delegator.findOne("Product", [productId : productId], false); + prodAssocs = product.getRelated("MainProductAssoc"); + if (UtilValidate.isNotEmpty(prodAssocs)) { + products = EntityUtil.filterByAnd(prodAssocs, [EntityCondition.makeCondition("productAssocTypeId", EntityOperator.NOT_EQUAL, "PRODUCT_VARIANT")]); + + if (UtilValidate.isNotEmpty(products)) { + productList = FastList.newInstance(); + products.each { product -> + if (product != null) { + String productIdTo = product.getString("productIdTo"); + prodAssocRecord = delegator.findByAnd("Product", [productId : productIdTo]); + productList.add(EntityUtil.getFirst(prodAssocRecord)); + } + } + context.put("productList",productList); + } + } +} diff --git a/applications/order/webapp/ordermgr/WEB-INF/controller.xml b/applications/order/webapp/ordermgr/WEB-INF/controller.xml index ec1c084b27..6fda324c60 100644 --- a/applications/order/webapp/ordermgr/WEB-INF/controller.xml +++ b/applications/order/webapp/ordermgr/WEB-INF/controller.xml @@ -1637,6 +1637,8 @@ under the License. + + @@ -1840,6 +1842,7 @@ under the License. + diff --git a/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl b/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl index 983372e20e..e1206042c0 100644 --- a/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl +++ b/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl @@ -18,7 +18,14 @@ under the License. --> <#-- Continuation of showcart.ftl: List of order items and forms to modify them. --> - +<#macro showAssoc productAssoc> + <#assign productAssocType = (delegator.findOne("ProductAssocType", {"productAssocTypeId" : productAssoc.productAssocTypeId}, false))/> + <#assign assocProduct = (delegator.findOne("Product", {"productId" : productAssoc.productIdTo}, false))/> + <#if assocProduct?has_content> + ${productAssoc.productIdTo} + - ${(assocProduct.productName)?if_exists}(${(productAssocType.description)?default("Unknown")}) + +
${uiLabelMap.OrderOrderItems}
@@ -144,12 +151,16 @@ under the License. ${uiLabelMap.ProductAtp} = ${availableToPromiseMap.get(productId)}, ${uiLabelMap.ProductQoh} = ${quantityOnHandMap.get(productId)} <#if Static["org.ofbiz.common.CommonWorkers"].hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG")> ${uiLabelMap.ProductMarketingPackageATP} = ${mktgPkgATPMap.get(productId)}, ${uiLabelMap.ProductMarketingPackageQOH} = ${mktgPkgQOHMap.get(productId)} + <#if ( mktgPkgATPMap.get(cartLine.getProductId()) < cartLine.getQuantity()) && (shoppingCart.getOrderType() == 'SALES_ORDER')> + <#assign backOrdered = cartLine.getQuantity() - mktgPkgATPMap.get(cartLine.getProductId())/> + [${backOrdered?if_exists} ${uiLabelMap.OrderBackOrdered}] - <#if (availableToPromiseMap.get(cartLine.getProductId()) <= 0) && (shoppingCart.getOrderType() == "SALES_ORDER" && product.productTypeId != "DIGITAL_GOOD")> + + <#if (availableToPromiseMap.get(cartLine.getProductId()) <= 0) && (shoppingCart.getOrderType() == 'SALES_ORDER') && product.productTypeId != "DIGITAL_GOOD" && product.productTypeId != "MARKETING_PKG_AUTO" && product.productTypeId != "MARKETING_PKG_PICK"> [${cartLine.getQuantity()} ${uiLabelMap.OrderBackOrdered}] <#else> - <#if (availableToPromiseMap.get(cartLine.getProductId()) < cartLine.getQuantity()) && (shoppingCart.getOrderType() == "SALES_ORDER" && product.productTypeId != "DIGITAL_GOOD")> - <#assign backOrdered = cartLine.getQuantity() - availableToPromiseMap.get(cartLine.getProductId())> + <#if (availableToPromiseMap.get(cartLine.getProductId()) < cartLine.getQuantity()) && (shoppingCart.getOrderType() == 'SALES_ORDER') && product.productTypeId != "DIGITAL_GOOD" && product.productTypeId != "MARKETING_PKG_AUTO" && product.productTypeId != "MARKETING_PKG_PICK"> + <#assign backOrdered = cartLine.getQuantity() - availableToPromiseMap.get(cartLine.getProductId())/> [${backOrdered?if_exists} ${uiLabelMap.OrderBackOrdered}] @@ -202,6 +213,27 @@ under the License. + + <#-- Show Associated Products (not for Variants) --> + <#assign itemProductAssocList = cartLine.getProduct().getRelated("MainProductAssoc", + Static["org.ofbiz.base.util.UtilMisc"].toList("productAssocTypeId", "sequenceNum"))?if_exists/> + <#if itemProductAssocList?exists && itemProductAssocList?has_content> +
+ + ${uiLabelMap.AssociatedProducts} + ${uiLabelMap.OrderQuickLookup} + + <#assign relatedProdCount = 0/> + <#list itemProductAssocList?if_exists as itemProductAssoc> + + <#if "PRODUCT_VARIANT" != itemProductAssoc.productAssocTypeId> + <#assign relatedProdCount = relatedProdCount + 1/> + <#if (relatedProdCount > 3)><#break> + <@showAssoc productAssoc=itemProductAssoc /> + + + + <#if (cartLine.getIsPromo() && cartLine.getAlternativeOptionProductIds()?has_content)> diff --git a/applications/order/widget/ordermgr/OrderEntryCartScreens.xml b/applications/order/widget/ordermgr/OrderEntryCartScreens.xml index 76af8bdd83..558130ce64 100644 --- a/applications/order/widget/ordermgr/OrderEntryCartScreens.xml +++ b/applications/order/widget/ordermgr/OrderEntryCartScreens.xml @@ -214,4 +214,22 @@ under the License. + +
+ + +