⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editproductquickadmin.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
📖 第 1 页 / 共 2 页
字号:
/* *  Copyright (c) 2004 The Open For Business Project - www.ofbiz.org * *  Permission is hereby granted, free of charge, to any person obtaining a  *  copy of this software and associated documentation files (the "Software"),  *  to deal in the Software without restriction, including without limitation  *  the rights to use, copy, modify, merge, publish, distribute, sublicense,  *  and/or sell copies of the Software, and to permit persons to whom the  *  Software is furnished to do so, subject to the following conditions: * *  The above copyright notice and this permission notice shall be included  *  in all copies or substantial portions of the Software. * *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT  *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  *  THE USE OR OTHER DEALINGS IN THE SOFTWARE. * *@author     Dustin Caldwell (dustin@dscv.org) *@author     David E. Jones (jonesde@ofbiz.org) *@version    $Rev: 5462 $ *@since      2.2 */import java.util.*;import java.util.Collection.*;import java.sql.*;import java.io.*;import org.ofbiz.entity.*;import org.ofbiz.entity.util.*;import org.ofbiz.base.util.*;import org.ofbiz.widget.html.*;import org.ofbiz.product.product.*;import org.ofbiz.entity.condition.*;nowDate = UtilDateTime.nowDate();context.put("nowDate", nowDate);String nowTimestampString = UtilDateTime.nowTimestamp().toString();context.put("nowTimestampString", nowTimestampString);Collection assocTypes = delegator.findAll("ProductAssocType");context.put("assocTypes", assocTypes);Collection featureTypes = delegator.findAll("ProductFeatureType");context.put("featureTypes", featureTypes);// add/remove feature typesHashMap addedFeatureTypes = (HashMap) session.getAttribute("addedFeatureTypes");if (addedFeatureTypes == null) {    addedFeatureTypes = new HashMap();    session.setAttribute("addedFeatureTypes", addedFeatureTypes);}HashMap featuresByType = new HashMap();String[] addFeatureTypeId = request.getParameterValues("addFeatureTypeId");List addFeatureTypeIdList = new ArrayList();if (addFeatureTypeId != null) {    addFeatureTypeIdList.addAll(Arrays.asList(addFeatureTypeId));}addFeatureTypeIdIter = addFeatureTypeIdList.iterator();while (addFeatureTypeIdIter.hasNext()) {    String curFeatureTypeId = addFeatureTypeIdIter.next();    GenericValue featureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", curFeatureTypeId));    if ((featureType != null) && !addedFeatureTypes.containsKey(curFeatureTypeId)) {        addedFeatureTypes.put(curFeatureTypeId, featureType);    }}String[] removeFeatureTypeId = request.getParameterValues("removeFeatureTypeId");if (removeFeatureTypeId != null) {    for (int i = 0; i < removeFeatureTypeId.length; i++) {        GenericValue featureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", addFeatureTypeId[i]));        if ((featureType != null) && addedFeatureTypes.containsKey(removeFeatureTypeId[i])) {            addedFeatureTypes.remove(removeFeatureTypeId[i]);            featuresByType.remove(removeFeatureTypeId[i]);        }    }}Iterator iter = addedFeatureTypes.values().iterator();while (iter.hasNext()) {    GenericValue featureType = (GenericValue)iter.next();    featuresByType.put(featureType.getString("productFeatureTypeId"), featureType.getRelated("ProductFeature", UtilMisc.toList("description")));}context.put("addedFeatureTypeIds", addedFeatureTypes.keySet());context.put("addedFeatureTypes", addedFeatureTypes);context.put("featuresByType", featuresByType);productId = request.getParameter("productId");if (productId == null) productId = request.getParameter("PRODUCT_ID");if (productId == null) productId = request.getAttribute("productId");if (productId != null) context.put("productId", productId);product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));List assocProducts = new ArrayList();HashMap featureFloz = new HashMap();HashMap featureMl = new HashMap();HashMap featureNtwt = new HashMap();HashMap featureGrams = new HashMap();HashMap featureHazmat = new HashMap();HashMap featureSalesThru = new HashMap();HashMap featureThruDate = new HashMap();HashMap selFeatureDesc = new HashMap();Double floz = null;Double ml = null;Double ntwt = null;Double grams = null;String hazmat = "nbsp;";String salesthru = null;String thrudate = null;String productFeatureTypeId = request.getParameter("productFeatureTypeId");context.put("productFeatureTypeId", productFeatureTypeId);if (product != null) {    context.put("product", product);    // get categories    List allCategories = delegator.findByCondition("ProductCategory",            new EntityExpr(new EntityExpr("showInSelect", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("showInSelect", EntityOperator.NOT_EQUAL, "N")),            null, UtilMisc.toList("description"));    List categoryMembers = product.getRelated("ProductCategoryMember");    categoryMembers = EntityUtil.filterByDate(categoryMembers);    context.put("allCategories", allCategories);    context.put("productCategoryMembers", categoryMembers);    List productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl");        // get standard features for this product    List standardFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, UtilMisc.toMap("productFeatureApplTypeId", "STANDARD_FEATURE"));    HashMap productFeatureTypeLookup = new HashMap();    HashMap standardFeatureLookup = new HashMap();    Iterator standardFeatureApplIter = standardFeatureAppls.iterator();    while (standardFeatureApplIter.hasNext()) {        GenericValue standardFeatureAndAppl = (GenericValue) standardFeatureApplIter.next();        GenericValue featureType = standardFeatureAndAppl.getRelatedOneCache("ProductFeatureType");        productFeatureTypeLookup.put(standardFeatureAndAppl.getString("productFeatureId"), featureType);        standardFeatureLookup.put(standardFeatureAndAppl.getString("productFeatureId"), standardFeatureAndAppl);    }    context.put("standardFeatureLookup", standardFeatureLookup);    context.put("standardFeatureAppls", standardFeatureAppls);    // get selectable features for this product    List selectableFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, UtilMisc.toMap("productFeatureApplTypeId", "SELECTABLE_FEATURE"));    HashMap selectableFeatureLookup = new HashMap();    // get feature types that are deleteable from selectable features section    Set selectableFeatureTypes = new HashSet();    Iterator selectableFeatureAndApplIter = selectableFeatureAppls.iterator();    while (selectableFeatureAndApplIter.hasNext()) {        GenericValue selectableFeatureAndAppl = (GenericValue) selectableFeatureAndApplIter.next();        GenericValue featureType = selectableFeatureAndAppl.getRelatedOneCache("ProductFeatureType");        productFeatureTypeLookup.put(selectableFeatureAndAppl.getString("productFeatureId"), featureType);        selectableFeatureLookup.put(selectableFeatureAndAppl.getString("productFeatureId"), selectableFeatureAndAppl);        selectableFeatureTypes.add(featureType);    }    context.put("selectableFeatureLookup", selectableFeatureLookup);    context.put("selectableFeatureAppls", selectableFeatureAppls);    context.put("selectableFeatureTypes", selectableFeatureTypes);    if ("Y".equalsIgnoreCase(product.getString("isVariant"))) {        Set distinguishingFeatures = ProductWorker.getVariantDistinguishingFeatures(product);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -