Exemple #1
0
        ///
        ///	 <summary> * sets all relevant parameters of this to the values specified in resourceLink or its linked resource or JDF node
        ///	 *  </summary>
        ///	 * <param name="resourceLink"> the resourceLink to extract the information from </param>
        ///	 * <param name="rqp"> parameters </param>
        ///
        public virtual void setLink(JDFResourceLink resourceLink, JDFResourceQuParams rqp)
        {
            if (resourceLink == null)
            {
                return;
            }
            JDFAmountPool ap = resourceLink.getAmountPool();

            if (ap != null)
            {
                copyElement(ap, null);
            }
            else
            {
                if (resourceLink.hasAttribute(AttributeName.ACTUALAMOUNT))
                {
                    setActualAmount(resourceLink.getActualAmount(null));
                }
                if (resourceLink.hasAttribute(AttributeName.AMOUNT))
                {
                    setAmount(resourceLink.getAmount(null));
                }
            }
            setProcessUsage(resourceLink.getEnumProcessUsage());

            JDFResource r = resourceLink.getTarget();

            if (r == null && rqp != null)
            {
                rqp.setExact(false);
            }

            bool bExact = rqp == null ? false : rqp.getExact();

            if (!bExact || r == null) // if we do not have a resource let's limp
            // along and provide as much as we have
            {
                setResourceName(resourceLink.getLinkedResourceName());
                setAttribute(AttributeName.RESOURCEID, resourceLink.getrRef());
                EnumUsage usage = resourceLink.getUsage();
                if (usage != null)
                {
                    setAttribute(AttributeName.USAGE, usage.getName());
                }
                if (r != null && r.hasAttribute(AttributeName.PRODUCTID))
                {
                    setProductID(r.getProductID());
                }
            }
            else
            {
                // create a copy of the resource in the original jdf
                JDFResource rr = (JDFResource)r.getParentNode_KElement().copyElement(r, null);
                rr.inlineRefElements(null, null, true);
                // move resource copy from the original node into this document
                moveElement(rr, null);
            }
        }
Exemple #2
0
        public virtual void testPlannedWasteICS()
        {
            JDFAmountPool ap   = rlOut.getCreateAmountPool();
            JDFAmountPool apIn = rlMediaIn.getCreateAmountPool();

            JDFComponent    cover = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Cover");
            JDFAttributeMap map   = cover.getPartMap();

            ap.appendXMLComment("Want 10000-10400 good cover sheets and allow for 500 waste cover sheets", null);
            map.put(EnumPartIDKey.Condition, "Good");
            rlOut.setAmount(10000, map);
            rlOut.setMaxAmount(10400, map);
            apIn.appendXMLComment("Amount[Good]: planned consumption for good production\n" + "MaxAmount[Good]: planned maximum consumption for good production\n" + "MaxAmount[Waste]: planned Media for waste", null);
            rlMediaIn.setAmount(10500, map);
            map.put(EnumPartIDKey.Condition, "Waste");
            rlMediaIn.setMaxAmount(500, map);

            ap.appendXMLComment("Want 20000 good first insert sheets and allow for 200 waste insert sheets", null);
            JDFComponent sheet1 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet1");

            map = sheet1.getPartMap();
            map.put(EnumPartIDKey.Condition, "Good");
            rlOut.setAmount(20000, map);
            rlOut.setMaxAmount(20800, map);
            rlMediaIn.setAmount(21000, map);
            map.put(EnumPartIDKey.Condition, "Waste");
            rlMediaIn.setMaxAmount(200, map);

            ap.appendXMLComment("Want 20000 good second insert sheets and allow for 100 waste insert sheets", null);
            JDFComponent sheet2 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet2");

            map = sheet2.getPartMap();
            map.put(EnumPartIDKey.Condition, "Good");
            rlOut.setAmount(20000, map);
            rlOut.setMaxAmount(20800, map);
            rlMediaIn.setAmount(20900, map);
            map.put(EnumPartIDKey.Condition, "Waste");
            rlMediaIn.setMaxAmount(100, map);

            d.write2File(sm_dirTestDataTemp + "plannedWasteICS.jdf", 2, true);

            //
            //		 * map=cover.getPartMap(); map.put(EnumPartIDKey.Condition, "Good");
            //		 * rl.getAmountPool().getPartAmount(map,0).appendXMLComment(
            //		 * "Actually produced covers: 10200\nWaste put on output stack:100");
            //		 * rlIn.getAmountPool().getPartAmount(map,0).appendXMLComment(
            //		 * "Total consumed sheets: 10400\nOf that: sheets wasted: 200");
            //		 * rl.setActualAmount(10200, map); rlIn.setActualAmount(10200, map);
            //		 * map.put(EnumPartIDKey.Condition, "Waste"); rl.setActualAmount(100,
            //		 * map); rlIn.setActualAmount(200, map);
            //		 *
            //		 * d.write2File(sm_dirTestDataTemp+"actualWasteICS.jdf", 2, true);
            //
        }
Exemple #3
0
        public virtual void testPlannedWaste()
        {
            JDFElement.setLongID(false);
            d = new JDFDoc("JDF");
            n = d.getJDFRoot();
            n.setType(EnumType.ConventionalPrinting);
            outComp = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Output, null, null, null, null);
            rlOut   = n.getLink(outComp, null);
            JDFAmountPool ap = rlOut.getCreateAmountPool();

            JDFComponent    cover = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Cover");
            JDFAttributeMap map   = cover.getPartMap();

            ap.appendXMLComment("Want 10000-10500 good cover sheets and allow for 500 waste cover sheets", null);
            map.put(EnumPartIDKey.Condition, "Good");
            rlOut.setAmount(10000, map);
            rlOut.setMaxAmount(10500, map);
            map.put(EnumPartIDKey.Condition, "Waste");
            rlOut.setMaxAmount(500, map);

            ap.appendXMLComment("Want 20000 good first insert sheets and allow for 200 waste insert sheets", null);
            JDFComponent sheet1 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet1");

            map = sheet1.getPartMap();
            map.put(EnumPartIDKey.Condition, "Good");
            rlOut.setAmount(20000, map);
            map.put(EnumPartIDKey.Condition, "Waste");
            rlOut.setMaxAmount(200, map);

            ap.appendXMLComment("Want 20000 good second insert sheets and allow for 200 waste insert sheets", null);
            JDFComponent sheet2 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet2");

            map = sheet2.getPartMap();
            map.put(EnumPartIDKey.Condition, "Good");
            rlOut.setAmount(20000, map);
            map.put(EnumPartIDKey.Condition, "Waste");
            rlOut.setMaxAmount(100, map);

            d.write2File(sm_dirTestDataTemp + "plannedWaste.jdf", 2, true);
        }
Exemple #4
0
        public virtual void testGetChildElementVector_or()
        {
            JDFDoc          d       = new JDFDoc("AmountPool");
            JDFAmountPool   ap      = (JDFAmountPool)d.getRoot();
            JDFAttributeMap partMap = new JDFAttributeMap("a", "a1");

            partMap.put("b", "b1");
            JDFPartAmount pa1 = ap.appendPartAmount();

            pa1.setAttributes(partMap);
            partMap.put("a", "a2");
            partMap.put("b", "b2");
            JDFPartAmount pa2 = ap.appendPartAmount();

            pa2.setAttributes(partMap);
            VElement v = ap.getChildElementVector(ElementName.PARTAMOUNT, null, partMap, false, 0, false);

            Assert.AreEqual(1, v.Count);
            partMap.put("b", "b1");
            v = ap.getChildElementVector(ElementName.PARTAMOUNT, null, partMap, false, 0, false);
            Assert.AreEqual(2, v.Count);
        }