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. + +
+ + +