Hi Hans,
you can get similar results by setting configItemTypeId to "STANDARD" Jacopo On Jul 12, 2009, at 10:09 AM, [hidden email] wrote: > Author: hansbak > Date: Sun Jul 12 08:09:54 2009 > New Revision: 793286 > > URL: http://svn.apache.org/viewvc?rev=793286&view=rev > Log: > added the possbility that in a configurable product a subassembly is > included with a BOM definition which need to be assembled fist, demo > data to demonstrate this is included for the famous PC001 > > Modified: > ofbiz/trunk/applications/manufacturing/src/org/ofbiz/ > manufacturing/jobshopmgt/ProductionRunServices.java > ofbiz/trunk/specialpurpose/ecommerce/data/DemoConfigurator.xml > > Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/ > manufacturing/jobshopmgt/ProductionRunServices.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=793286&r1=793285&r2=793286&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/ > manufacturing/jobshopmgt/ProductionRunServices.java (original) > +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/ > manufacturing/jobshopmgt/ProductionRunServices.java Sun Jul 12 > 08:09:54 2009 > @@ -48,6 +48,7 @@ > import org.ofbiz.entity.condition.EntityOperator; > import org.ofbiz.entity.util.EntityUtil; > import org.ofbiz.manufacturing.bom.BOMTree; > +import org.ofbiz.manufacturing.bom.BOMNode; > import org.ofbiz.manufacturing.techdata.TechDataServices; > import org.ofbiz.product.config.ProductConfigWrapper; > import org.ofbiz.product.config.ProductConfigWrapper.ConfigOption; > @@ -231,7 +232,6 @@ > } catch (GenericServiceException gse) { > Debug.logWarning(gse.getMessage(), module); > } > - // ================================= > if (routing == null) { > return > ServiceUtil.returnError(UtilProperties.getMessage(resource, > "ManufacturingProductRoutingNotExist", locale)); > } > @@ -391,7 +391,7 @@ > while (pb.hasNext()) { > // The components variable contains a list of > BOMNodes: > // each node represents a product (component). > - org.ofbiz.manufacturing.bom.BOMNode node = > (org.ofbiz.manufacturing.bom.BOMNode) pb.next(); > + BOMNode node = > (org.ofbiz.manufacturing.bom.BOMNode) pb.next(); > GenericValue productBom = node.getProductAssoc(); > if ((productBom.getString("routingWorkEffortId") > == null && first) || (productBom.getString("routingWorkEffortId") != > null && > productBom > .getString > ("routingWorkEffortId > ").equals(routingTask.getString("workEffortId")))) { > serviceContext.clear(); > @@ -2217,7 +2217,39 @@ > BigDecimal totalQuantity = > (BigDecimal)components.get(componentProductId); > componentQuantity = > totalQuantity.add(componentQuantity); > } > - components.put(componentProductId, > componentQuantity); > + > + // check if a bom exists > + List bomList = null; > + try { > + bomList = delegator.findByAnd("ProductAssoc", > UtilMisc.toMap("productId", componentProductId, > "productAssocTypeId", "MANUF_COMPONENT")); > + bomList = EntityUtil.filterByDate(bomList, > UtilDateTime.nowTimestamp()); > + } catch (GenericEntityException e) { > + return ServiceUtil.returnError("try to get BOM > list from productAssoc"); > + } > + // if so create a mandatory predecessor to this > production run > + if(UtilValidate.isNotEmpty(bomList)) { > + serviceContext.clear(); > + serviceContext.put("productId", componentProductId); > + serviceContext.put("quantity", componentQuantity); > + serviceContext.put("startDate", > UtilDateTime.nowTimestamp()); > + serviceContext.put("facilityId", facilityId); > + serviceContext.put("userLogin", userLogin); > + resultService = null; > + try { > + resultService = > dispatcher.runSync("createProductionRunsForProductBom", > serviceContext); > + GenericValue workEffortPreDecessor = > delegator.makeValue("WorkEffortAssoc", UtilMisc.toMap( > + "workEffortIdTo", productionRunId, > "workEffortIdFrom", resultService.get("productionRunId"), > + "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY", > "fromDate", UtilDateTime.nowTimestamp())); > + workEffortPreDecessor.create(); > + } catch (GenericServiceException e) { > + return > ServiceUtil.returnError(UtilProperties.getMessage(resource, > "ManufacturingProductionRunNotCreated", locale)); > + } catch (GenericEntityException e) { > + return ServiceUtil.returnError("try to create > workeffort assoc"); > + } > + > + } else { > + components.put(componentProductId, > componentQuantity); > + } > > // create production run notes from comments > String comments = co.getComments(); > > Modified: ofbiz/trunk/specialpurpose/ecommerce/data/ > DemoConfigurator.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoConfigurator.xml?rev=793286&r1=793285&r2=793286&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/specialpurpose/ecommerce/data/DemoConfigurator.xml > (original) > +++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoConfigurator.xml > Sun Jul 12 08:09:54 2009 > @@ -25,7 +25,10 @@ > <Product productId="HD500GB_BRAND" productTypeId="FINISHED_GOOD" > productName="HD500GB" internalName="HD 450 GB" description="500 GB > Hard Drive" isVirtual="N" isVariant="N" billOfMaterialLevel="0" > createdDate="2004-08-20 12:50:54.794" createdByUserLogin="admin"/> > <Product productId="ETH_BRAND" productTypeId="FINISHED_GOOD" > productName="Ethernet100" internalName="Ethernet Card 10/100" > description="Ethernet Card 10/100" isVirtual="N" isVariant="N" > billOfMaterialLevel="0" createdDate="2004-08-20 12:50:54.794" > createdByUserLogin="admin"/> > <Product productId="MOD_BRAND" productTypeId="FINISHED_GOOD" > productName="Modem56k" internalName="Modem Card 56k" > description="Modem Card 56k" isVirtual="N" isVariant="N" > billOfMaterialLevel="0" createdDate="2004-08-20 12:50:54.794" > createdByUserLogin="admin"/> > - > + <Product productId="MOTHER_BOARD_ASS" > productTypeId="MARKETING_PKG_AUTO" productName="MotherBoard > Assembly" internalName="Motherboard assembly" > description="Motherboard Assembly" isVirtual="N" isVariant="N"/> > + <Product productId="MOTHER_BOARD" productTypeId="FINISHED_GOOD" > productName="MotherBoard" internalName="Motherboard" > description="Motherboard" isVirtual="N" isVariant="N" > billOfMaterialLevel="0"/> > + <Product productId="CPU-586" productTypeId="FINISHED_GOOD" > productName="CPU 586" internalName="CPU intel 586" description="CPU > intel 586" isVirtual="N" isVariant="N" billOfMaterialLevel="0"/> > + > <ProductPrice productId="PC001" productPricePurposeId="PURCHASE" > productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" > productStoreGroupId="_NA_" fromDate="2004-08-20 12:55:53.223" > price="50" createdDate="2004-08-20 12:55:53.223" > createdByUserLogin="admin"/> > <ProductPrice productId="RAM1GB_BRAND" > productPricePurposeId="COMPONENT_PRICE" > productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" > productStoreGroupId="_NA_" fromDate="2004-08-20 12:55:53.223" > price="115" createdDate="2004-08-20 12:55:53.223" > createdByUserLogin="admin"/> > <ProductPrice productId="RAM1GB_BRAND" > productPricePurposeId="PURCHASE" productPriceTypeId="DEFAULT_PRICE" > currencyUomId="USD" productStoreGroupId="_NA_" fromDate="2004-08-20 > 12:55:36.479" price="120" createdDate="2004-08-20 12:55:36.479" > createdByUserLogin="admin"/> > @@ -33,30 +36,41 @@ > <ProductPrice productId="HD500GB_BRAND" > productPricePurposeId="COMPONENT_PRICE" > productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" > productStoreGroupId="_NA_" fromDate="2004-08-20 12:55:36.479" > price="420" createdDate="2004-08-20 12:55:36.479" > createdByUserLogin="admin"/> > <ProductPrice productId="ETH_BRAND" > productPricePurposeId="COMPONENT_PRICE" > productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" > productStoreGroupId="_NA_" fromDate="2004-08-20 12:55:36.479" > price="18" createdDate="2004-08-20 12:55:36.479" > createdByUserLogin="admin"/> > <ProductPrice productId="MOD_BRAND" > productPricePurposeId="COMPONENT_PRICE" > productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" > productStoreGroupId="_NA_" fromDate="2004-08-20 12:55:36.479" > price="15" createdDate="2004-08-20 12:55:36.479" > createdByUserLogin="admin"/> > + <ProductPrice productId="MOTHER_BOARD" > productPricePurposeId="COMPONENT_PRICE" > productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" > productStoreGroupId="_NA_" fromDate="2004-08-20 12:55:36.479" > price="150" createdDate="2004-08-20 12:55:36.479" > createdByUserLogin="admin"/> > + <ProductPrice productId="CPU-586" > productPricePurposeId="COMPONENT_PRICE" > productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" > productStoreGroupId="_NA_" fromDate="2004-08-20 12:55:36.479" > price="250" createdDate="2004-08-20 12:55:36.479" > createdByUserLogin="admin"/> > + > + <!-- BOM --> > + <ProductAssoc productId="MOTHER_BOARD_ASS" > productIdTo="MOTHER_BOARD" productAssocTypeId="MANUF_COMPONENT" > fromDate="2007-01-01 12:00:00.0" quantity="1.000000"/> > + <ProductAssoc productId="MOTHER_BOARD_ASS" > productIdTo="CPU-586" productAssocTypeId="MANUF_COMPONENT" > fromDate="2007-01-01 12:00:00.0" quantity="1.000000"/> > + > > <ProductConfigItem configItemId="IT0000" > configItemTypeId="SINGLE" configItemName="RAM (brand)" > description="Select the memory configuration:"/> > <ProductConfigItem configItemId="IT0001" > configItemTypeId="SINGLE" configItemName="HD (brand)" > description="Select the Hard Disk:"/> > <ProductConfigItem configItemId="IT0002" > configItemTypeId="MULTIPLE" configItemName="PCI slot" > description="Select the PCI cards:"/> > - > + <ProductConfigItem configItemId="IT0003" > configItemTypeId="SINGLE" configItemName="Standard Items" > description="Standard Items"/> > + > <ProductConfigOption configItemId="IT0000" > configOptionId="OP000" configOptionName="OPT001" description="1GB > Dual Channel DDR2 SDRAM at 667MHz" sequenceNum="10"/> > <ProductConfigOption configItemId="IT0000" > configOptionId="OP001" configOptionName="OPT002" description="2GB > Dual Channel DDR2 SDRAM at 667MHz" sequenceNum="20"/> > <ProductConfigOption configItemId="IT0001" > configOptionId="OP002" configOptionName="OPT001" description="HD 250 > GB" sequenceNum="10"/> > <ProductConfigOption configItemId="IT0001" > configOptionId="OP003" configOptionName="OPT002" description="HD 500 > GB" sequenceNum="20"/> > <ProductConfigOption configItemId="IT0002" > configOptionId="OP004" configOptionName="OPT001" > description="Ethernet Card" sequenceNum="10"/> > <ProductConfigOption configItemId="IT0002" > configOptionId="OP005" configOptionName="OPT002" description="Modem > 56k" sequenceNum="20"/> > - > + <ProductConfigOption configItemId="IT0003" > configOptionId="OP006" configOptionName="OPT001" > description="Motherboard with BOM" sequenceNum="10"/> > + > <ProductConfigProduct configItemId="IT0000" > configOptionId="OP000" productId="RAM1GB_BRAND" quantity="1"/> > <ProductConfigProduct configItemId="IT0000" > configOptionId="OP001" productId="RAM1GB_BRAND" quantity="2"/> > <ProductConfigProduct configItemId="IT0001" > configOptionId="OP002" productId="HD250GB_BRAND" quantity="1"/> > <ProductConfigProduct configItemId="IT0001" > configOptionId="OP003" productId="HD500GB_BRAND" quantity="1"/> > <ProductConfigProduct configItemId="IT0002" > configOptionId="OP004" productId="ETH_BRAND" quantity="1"/> > <ProductConfigProduct configItemId="IT0002" > configOptionId="OP005" productId="MOD_BRAND" quantity="1"/> > - > + <ProductConfigProduct configItemId="IT0003" > configOptionId="OP006" productId="MOTHER_BOARD_ASS" quantity="1"/> > + > <ProductConfig productId="PC001" configItemId="IT0000" > sequenceNum="10" fromDate="2004-08-20 12:59:26.209" > configTypeId="QUESTION" defaultConfigOptionId="OP001" > isMandatory="Y"/> > <ProductConfig productId="PC001" configItemId="IT0001" > sequenceNum="20" fromDate="2004-08-20 12:59:26.209" description="1st > Hard Disk drive" defaultConfigOptionId="OP003" > configTypeId="QUESTION" isMandatory="Y"/> > <ProductConfig productId="PC001" configItemId="IT0001" > sequenceNum="30" fromDate="2004-08-20 12:59:26.209" description="2nd > Hard Disk drive" configTypeId="QUESTION" isMandatory="N"/> > <ProductConfig productId="PC001" configItemId="IT0002" > sequenceNum="40" fromDate="2004-08-20 12:59:26.209" > configTypeId="QUESTION" isMandatory="N"/> > - > + <ProductConfig productId="PC001" configItemId="IT0003" > sequenceNum="00" fromDate="2004-08-20 12:59:26.209" > configTypeId="STANDARD" isMandatory="Y"/> > + > <WorkEffort workEffortId="TASK01" workEffortTypeId="ROU_TASK" > workEffortPurposeTypeId="ROU_ASSEMBLING" > currentStatusId="ROU_ACTIVE" workEffortName="Stock out" > description="Components" revisionNumber="1" > fixedAssetId="DEMO_MACHINE_GROUP" estimatedMilliSeconds="600000" > estimatedSetupMillis="0"/> > <WorkEffort workEffortId="TASK02" workEffortTypeId="ROU_TASK" > workEffortPurposeTypeId="ROU_ASSEMBLING" > currentStatusId="ROU_ACTIVE" workEffortName="Assembly" > description="Assembly" revisionNumber="1" > fixedAssetId="DEMO_MACHINE_GROUP" estimatedMilliSeconds="900000" > estimatedSetupMillis="0"/> > <WorkEffort workEffortId="TASK03" workEffortTypeId="ROU_TASK" > workEffortPurposeTypeId="ROU_ASSEMBLING" > currentStatusId="ROU_ACTIVE" workEffortName="Test" > description="Test" revisionNumber="1" > fixedAssetId="DEMO_MACHINE_GROUP" estimatedMilliSeconds="450000" > estimatedSetupMillis="20000"/> > > |
Free forum by Nabble | Edit this page |