public virtual void testMISCPProductGrayBoxBrochure() { VJDFAttributeMap vMap = new VJDFAttributeMap(); for (int i = 0; i < 5; i++) { string sheetName = i == 0 ? "Cover" : "Body" + i; JDFAttributeMap map = new JDFAttributeMap(); map.put(EnumPartIDKey.SignatureName, "Sig1"); map.put(EnumPartIDKey.SheetName, sheetName); map.put(EnumPartIDKey.Side, "Front"); vMap.Add(new JDFAttributeMap(map)); map.put(EnumPartIDKey.Side, "Back"); vMap.Add(new JDFAttributeMap(map)); } MISCPGoldenTicket cpGoldenTicket = new MISCPGoldenTicket(1, null, 2, 2, true, vMap); cpGoldenTicket.nCols[0] = cpGoldenTicket.nCols[1] = 6; cpGoldenTicket.workStyle = EnumWorkStyle.WorkAndTurn; ProductGoldenTicket pgt = new ProductGoldenTicket(0, EnumVersion.Version_1_3, 0, 0); pgt.assign(null); pgt.createHDCity(); JDFNode node = pgt.getNode(); JDFNode nodeCP = node.addJDFNode(EnumType.ProcessGroup); cpGoldenTicket.assign(nodeCP); cpGoldenTicket.good = 1000; cpGoldenTicket.waste = 90; cpGoldenTicket.partsAtOnce = 2; BaseGoldenTicketTest.write3GTFiles(this, cpGoldenTicket, "MISCPS_ProductGrayBox"); }
public virtual void testGetAmountMap() { JDFAttributeMap map = new JDFAttributeMap("Separation", "Black"); JDFAttributeMap map2 = new JDFAttributeMap("Separation", "Cyan"); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(new JDFAttributeMap(map)); vMap.Add(new JDFAttributeMap(map2)); for (int i = 0; i < 10; i++) { vMap.put("SignatureName", "Sig" + i); for (int j = 0; j < 100; j++) { vMap.put("SheetName", "Sheet" + j); ap.appendPartAmount(vMap).setAmount(j, null); } } AmountMap am = ap.getAmountMap(new VString("Separation", null)); Assert.AreEqual(2, am.Count); Assert.AreEqual(50 * 99 * 10.0, am.getAmountDouble(map, "Amount"), 0.0); am = ap.getAmountMap(new VString("SheetName Separation", null)); Assert.AreEqual(200, am.Count); Assert.AreEqual(-1.0, am.getAmountDouble(map, "Amount"), 0.0); map.put("SheetName", "Sheet12"); Assert.AreEqual(10 * 12.0, am.getAmountDouble(map, "Amount"), 0.0, "10 signatures * 12"); }
public virtual void testFrontBackIdentical() { JDFElement.setLongID(false); setup(null, 2); JDFAttributeMap mapS1F = new JDFAttributeMap(); mapS1F.put("SheetName", "Sheet2"); mapS1F.put("Side", "Front"); JDFAttributeMap mapS0F = new JDFAttributeMap(); mapS0F.put("SheetName", "Sheet1"); mapS0F.put("Side", "Front"); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(mapS0F); vMap.Add(mapS1F); node.getNodeInfo().setIdentical(vMap); node.getResource("ExposedMedia", null, 0).setIdentical(vMap); bgt.write2File(sm_dirTestDataTemp + "FrontBackIdentSetup.jdf", 2); run2Seps("Sheet1", EnumSide.Front, null, null, 550, 100, "press0", EnumNodeStatus.Stopped, false); bgt.write2File(sm_dirTestDataTemp + "FrontBackIdent_Front0.jdf", 2); run2Seps("Sheet2", EnumSide.Back, null, null, 550, 100, "press1", EnumNodeStatus.Completed, false); bgt.write2File(sm_dirTestDataTemp + "FrontBackIdent_Back1.jdf", 2); run2Seps("Sheet2", EnumSide.Front, null, null, 1000, 150, "press0", EnumNodeStatus.Completed, false); bgt.write2File(sm_dirTestDataTemp + "FrontBackIdent_Front1.jdf", 2); run2Seps("Sheet1", EnumSide.Back, null, null, 1000, 150, "press1", EnumNodeStatus.Completed, false); bgt.write2File(sm_dirTestDataTemp + "FrontBackIdent_Back0.jdf", 2); }
public virtual void testGetAmountPoolSumDouble() { JDFNode d = new JDFDoc("JDF").getJDFRoot(); JDFResource m = d.addResource("Media", EnumUsage.Input); m.addPartition(EnumPartIDKey.SignatureName, "1"); JDFResourceLink rl = d.getLink(m, EnumUsage.Input); JDFAttributeMap map = new JDFAttributeMap("SignatureName", "1"); map.put("Condition", "Good"); rl.setActualAmount(12, map); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(new JDFAttributeMap("SignatureName", "1")); JDFAttributeMap sig1 = new JDFAttributeMap("SignatureName", "2"); vMap.Add(sig1); rl.getAmountPool().getPartAmount(map).setPartMapVector(vMap); map.put("Condition", "Waste"); rl.setActualAmount(14, map); Assert.AreEqual(26.0, rl.getAmountPoolSumDouble(AttributeName.ACTUALAMOUNT, null), 0.1); Assert.AreEqual(26.0, rl.getAmountPoolSumDouble(AttributeName.ACTUALAMOUNT, vMap), 0.1); sig1.put("SheetName", "S1"); Assert.AreEqual(26.0, rl.getAmountPoolSumDouble(AttributeName.ACTUALAMOUNT, vMap), 0.1, " also when more granular"); sig1 = new JDFAttributeMap(sig1); sig1.put("SheetName", "S2"); vMap.Add(sig1); Assert.AreEqual(26.0, rl.getAmountPoolSumDouble(AttributeName.ACTUALAMOUNT, vMap), 0.1, " also when more granular"); }
public virtual void testGetPartAmountMulti() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.ConventionalPrinting); JDFComponent comp = (JDFComponent)n.addResource("Component", null, EnumUsage.Output, null, null, null, null); JDFAttributeMap map = new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"); JDFAttributeMap mapSig = new JDFAttributeMap(map); JDFAttributeMap map2 = new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"); JDFResourceLink rl = n.getLink(comp, null); map.put(EnumPartIDKey.SheetName, "Sheet"); comp.getCreatePartition(map, new VString("SignatureName SheetName", " ")); map.put(EnumPartIDKey.Side, "Front"); map2.put(EnumPartIDKey.Side, "Back"); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(map); vMap.Add(map2); JDFAmountPool aplocal = rl.appendAmountPool(); JDFPartAmount pa = aplocal.appendPartAmount(vMap); Assert.AreEqual(pa.numChildElements_JDFElement(ElementName.PART, null), 2); rl.setActualAmount(42, map); rl.setActualAmount(21, map2); Assert.AreEqual(2, pa.numChildElements_JDFElement(ElementName.PART, null)); Assert.AreEqual(42.0, rl.getActualAmount(map), 0.0); Assert.AreEqual(42.0 + 21.0, rl.getActualAmount(mapSig), 0.0); Assert.AreEqual(aplocal.getPartAmount(vMap), pa); }
public virtual void testLayerRunListComplex() { JDFElement.setLongID(false); setUpDoc(); setupRunList(1); setupLayout(true); n.setPartStatus(new JDFAttributeMap(EnumPartIDKey.PartVersion, "De"), EnumNodeStatus.Completed, null); JDFResourceLink rl = n.getLink(rlIn, null); rl.setPartition(EnumPartIDKey.PartVersion, "De Euro"); d.write2File(sm_dirTestDataTemp + "LayerListDeEuro.jdf", 2, false); VJDFAttributeMap vMap = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap(); map.put(EnumPartIDKey.PartVersion, "De"); map.put(EnumPartIDKey.LayerIDs, "1"); vMap.Add(map); map = new JDFAttributeMap(); map.put(EnumPartIDKey.PartVersion, "Euro"); map.put(EnumPartIDKey.LayerIDs, "2"); vMap.Add(map); rl.setPartMapVector(vMap); rl.setDescriptiveName("Only DE + Euro, no bkg partversion is selected"); d.write2File(sm_dirTestDataTemp + "LayerListDeEuro_BKG.jdf", 2, false); }
public virtual void testMISCPGrayBox41Poster() { VJDFAttributeMap vMap = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap(); map.put(EnumPartIDKey.SignatureName, "Sig1"); map.put(EnumPartIDKey.SheetName, "Sheet1"); map.put(EnumPartIDKey.Side, "Front"); vMap.Add(new JDFAttributeMap(map)); map.put(EnumPartIDKey.Side, "Back"); vMap.Add(new JDFAttributeMap(map)); MISCPGoldenTicket cpGoldenTicket = new MISCPGoldenTicket(1, null, 2, 2, true, vMap); cpGoldenTicket.nCols[0] = 4; cpGoldenTicket.nCols[1] = 1; cpGoldenTicket.workStyle = EnumWorkStyle.WorkAndTurn; cpGoldenTicket.assign(null); cpGoldenTicket.good = 1000; cpGoldenTicket.waste = 90; cpGoldenTicket.partsAtOnce = 1; cpGoldenTicket.partsForAvailable = 2; JDFNode n = cpGoldenTicket.getNode(); JDFDevice dev = (JDFDevice)n.getResource("Device", EnumUsage.Input, 0); dev.removeAttribute(AttributeName.DEVICEID); dev.getCreatePartition(map, null).setAttribute("DeviceID", "BackSidePress"); map.put(EnumPartIDKey.Side, "Front"); dev.getCreatePartition(map, null).setAttribute("DeviceID", "FrontSidePress"); write3GTFiles(this, cpGoldenTicket, "MISCPS_4_1Poster"); }
public virtual void testMISCPGrayBoxFrontBack() { VJDFAttributeMap vMap = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap(); map.put(EnumPartIDKey.SignatureName, "Sig1"); map.put(EnumPartIDKey.SheetName, "Sheet1"); map.put(EnumPartIDKey.Side, "Front"); vMap.Add(new JDFAttributeMap(map)); map.put(EnumPartIDKey.Side, "Back"); vMap.Add(new JDFAttributeMap(map)); MISCPGoldenTicket cpGoldenTicket = new MISCPGoldenTicket(1, null, 2, 2, true, vMap); cpGoldenTicket.nCols[0] = cpGoldenTicket.nCols[1] = 4; cpGoldenTicket.assign(null); JDFNode node = cpGoldenTicket.getNode(); cpGoldenTicket.write2File(sm_dirTestDataTemp + "GoldenTicket_Manager_MISCPS_1_GB.jdf", 2); Assert.IsTrue(node.getICSVersions(false).Contains("Base_L2-1.3")); Assert.IsTrue(node.getICSVersions(false).Contains("JMF_L2-1.3")); Assert.IsTrue(node.getICSVersions(false).Contains("MIS_L2-1.3")); Assert.IsTrue(node.getICSVersions(false).Contains("MISCPS_L1-1.3")); Assert.IsTrue(node.isValid(EnumValidationLevel.Complete)); cpGoldenTicket.good = 1000; cpGoldenTicket.waste = 90; cpGoldenTicket.execute(null, true, true); cpGoldenTicket.makeReadyAll(); node = cpGoldenTicket.getNode(); cpGoldenTicket.write2File(sm_dirTestDataTemp + "GoldenTicket_Worker_MISCPS_1_GB.jdf", 2); Assert.IsTrue(node.getICSVersions(false).Contains("Base_L2-1.3")); Assert.IsTrue(node.getICSVersions(false).Contains("JMF_L2-1.3")); Assert.IsTrue(node.getICSVersions(false).Contains("MIS_L2-1.3")); Assert.IsTrue(node.getICSVersions(false).Contains("MISCPS_L1-1.3")); Assert.IsTrue(node.isValid(EnumValidationLevel.Complete)); cpGoldenTicket.assign(null); VJDFAttributeMap mapSingle = new VJDFAttributeMap(); map.put(EnumPartIDKey.Side, "Front"); mapSingle.Add(map); cpGoldenTicket.schedule(mapSingle, 6, 2); map.put(EnumPartIDKey.Side, "Back"); cpGoldenTicket.schedule(mapSingle, 8, 2); cpGoldenTicket.write2File(sm_dirTestDataTemp + "GoldenTicket_Manager_MISCPS_1_GB_FrontBack.jdf", 2); map.put(EnumPartIDKey.Side, "Front"); cpGoldenTicket.execute(mapSingle, false, true); cpGoldenTicket.write2File(sm_dirTestDataTemp + "GoldenTicket_Worker_MISCPS_1_GB_FrontBack_xB.jdf", 2); map.put(EnumPartIDKey.Side, "Back"); cpGoldenTicket.good = 900; cpGoldenTicket.waste = 30; cpGoldenTicket.execute(mapSingle, true, false); cpGoldenTicket.write2File(sm_dirTestDataTemp + "GoldenTicket_Worker_MISCPS_1_GB_FrontBack_xBF.jdf", 2); }
public virtual void testGetAmountPoolVector() { JDFDoc d = new JDFDoc("TestLink"); JDFResourceLink rl = (JDFResourceLink)d.getRoot(); VJDFAttributeMap vM = new VJDFAttributeMap(); vM.Add(new JDFAttributeMap("SignatureName", "1")); vM.Add(new JDFAttributeMap("SignatureName", "2")); rl.setAmountPoolAttribute("Amount", "42", null, vM); Assert.AreEqual("42", rl.getAmountPoolAttribute("Amount", null, vM)); vM.Add(new JDFAttributeMap("SignatureName", "3")); Assert.IsNull(rl.getAmountPoolAttribute("Amount", null, vM)); }
public virtual void testReducePartAmounts() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.ConventionalPrinting); JDFComponent comp = (JDFComponent)n.addResource("Component", null, EnumUsage.Output, null, null, null, null); JDFAttributeMap map = new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"); JDFResourceLink rl = n.getLink(comp, null); for (int i = 0; i < 5; i++) { map.put(EnumPartIDKey.SheetName, "Sheet" + i); comp.getCreatePartition(map, new VString("SignatureName SheetName", " ")); rl.setAmount(500 + i, map); JDFAttributeMap map2 = new JDFAttributeMap(map); map2.put("Condition", "Good"); rl.setActualAmount(500 + i, map2); map2.put("Condition", "Waste"); rl.setActualAmount(50 + i, map2); } VJDFAttributeMap v = new VJDFAttributeMap(); JDFAttributeMap testMap = new JDFAttributeMap(EnumPartIDKey.Condition, "Good"); v.Add(testMap); JDFAmountPool aplocal = rl.getAmountPool(); Assert.AreEqual(15, aplocal.numChildElements(ElementName.PARTAMOUNT, null), "15 pa entries"); aplocal.reducePartAmounts(v); Assert.AreEqual(5, aplocal.numChildElements(ElementName.PARTAMOUNT, null), "5 pa entries"); testMap.put("SheetName", "Sheet3"); aplocal.reducePartAmounts(v); Assert.AreEqual(1, aplocal.numChildElements(ElementName.PARTAMOUNT, null), "1 pa entries"); }
public virtual void testWasteAmount() { VJDFAttributeMap singleMap = new VJDFAttributeMap(); singleMap.Add(xpMedia.getPartMapVector(false)[0]); MISCPGoldenTicket gt = new MISCPGoldenTicket(2, EnumVersion.Version_1_3, 2, 2, false, singleMap); gt.good = 1000; gt.waste = 100; gt.assign(null); n = gt.getNode(); JDFComponent c = (JDFComponent)n.getResource(ElementName.COMPONENT, null, 0); JDFMedia m = (JDFMedia)n.getResource(ElementName.MEDIA, null, 0); JDFResourceLink rl = n.getLink(c, null); JDFResourceLink rlMedia = n.getLink(m, null); VElement vRL = new VElement(); vRL.Add(rl); vRL.Add(rlMedia); sc = new StatusCounter(null, null, null); sc.setTrackWaste(rl.getrRef(), true); sc.setTrackWaste(rlMedia.getrRef(), true); sc.setActiveNode(n, c.getPartMapVector(false), vRL); Assert.AreEqual(100, sc.getPlannedWaste(rlMedia.getrRef()), 0); Assert.AreEqual(1000, sc.getPlannedAmount(rl.getrRef()), 0); }
public virtual void testIdenticalInk() { VString v = new VString("Cyan,Magenta,Yellow,Black,Text", ","); VString vAct = new VString("Cyan,Magenta,Yellow,Black,Text", ","); VString vInk = new VString("Cyan,Magenta,Yellow,Black,Black", ","); VString vInkProd = new VString("MIS-Ink-4711,MIS-Ink-4712,MIS-Ink-4713,MIS-Ink-4714,MIS-Ink-4714", ","); VJDFAttributeMap vMap = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap(); map.put(EnumPartIDKey.SignatureName, "Sig1"); map.put(EnumPartIDKey.SheetName, "Sheet1"); map.put(EnumPartIDKey.Side, "Front"); vMap.Add(new JDFAttributeMap(map)); JDFNode n = new JDFDoc("JDF").getJDFRoot(); MISCPGoldenTicket cpGoldenTicket = new MISCPGoldenTicket(1, null, 2, 1, true, vMap); cpGoldenTicket.cols = v; cpGoldenTicket.colsActual = vAct; cpGoldenTicket.inks = vInk; cpGoldenTicket.inkProductIDs = vInkProd; // n.setType(JDFNode.EnumType.ConventionalPrinting); cpGoldenTicket.assign(n); cpGoldenTicket.good = 3000; cpGoldenTicket.waste = 200; write3GTFiles(this, cpGoldenTicket, "sameInk"); }
public virtual void testGetLastPhase() { JDFPhaseTime p1 = myAuditPool.setPhase(EnumNodeStatus.Setup, null, null, null); Assert.IsNotNull(p1); Assert.AreEqual(p1, myAuditPool.getLastPhase(null, null)); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(new JDFAttributeMap("SheetName", "s1")); VJDFAttributeMap vMap2 = new VJDFAttributeMap(); vMap2.Add(new JDFAttributeMap("SheetName", "s1")); JDFPhaseTime p2 = myAuditPool.setPhase(EnumNodeStatus.Setup, null, vMap, null); Assert.AreEqual(p2, myAuditPool.getLastPhase(vMap, null)); Assert.AreEqual(p2, myAuditPool.getLastPhase(null, null)); JDFPhaseTime p3 = myAuditPool.setPhase(EnumNodeStatus.Setup, null, vMap2, null); myAuditPool.addModified(null, jdfRoot); Assert.AreEqual(p2, myAuditPool.getLastPhase(vMap, null)); Assert.AreEqual(p3, myAuditPool.getLastPhase(null, null)); Assert.AreEqual(p3, myAuditPool.getLastPhase(vMap2, null)); p1.setModules(new VString("m1", null), new VString("RIP", null)); Assert.IsNull(myAuditPool.getLastPhase(null, "m2")); Assert.AreEqual(p1, myAuditPool.getLastPhase(null, "m1")); }
public virtual void testSetTarget() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setVersion(JDFElement.EnumVersion.Version_1_3); n.setType("ConventionalPrinting", true); JDFExposedMedia xm = (JDFExposedMedia)n.addResource(ElementName.EXPOSEDMEDIA, null, EnumUsage.Input, null, null, null, null); JDFExposedMedia xm1 = (JDFExposedMedia)xm.addPartition(JDFResource.EnumPartIDKey.SignatureName, "Sig1"); VJDFAttributeMap vSig1 = new VJDFAttributeMap(); vSig1.Add(xm1.getPartMap()); // want a lower leaf partition xm1.addPartition(JDFResource.EnumPartIDKey.SheetName, "Sheet1"); JDFMedia m = xm.appendMedia(); JDFResourceLink rl = n.linkResource(xm, EnumUsage.Input, null); try { rl.setTarget(m); Assert.Fail("no link to subelem"); } catch (JDFException) { // nop } rl.setTarget(xm1); Assert.AreEqual(vSig1, rl.getPartMapVector()); }
/// /// * <param name="bag"> /// * @return </param> /// public virtual JDFResourceLink updateNodeLink(AmountBag bag) { JDFResourceLink nodeLink = enclosingInstance.m_Node.getLink(0, null, new JDFAttributeMap(AttributeName.RREF, rl.getrRef()), null); if (bag != null) { VJDFAttributeMap vMap = new VJDFAttributeMap(enclosingInstance.m_vPartMap); if (vMap.Count == 0) { vMap.Add(new JDFAttributeMap()); } if (nodeLink != null) { if (bTrackWaste) { vMap.put(EnumPartIDKey.Condition, "Good"); nodeLink.setAmountPoolAttribute(AttributeName.ACTUALAMOUNT, StringUtil.formatDouble(bag.totalAmount), null, vMap); vMap.put(EnumPartIDKey.Condition, "Waste"); nodeLink.setAmountPoolAttribute(AttributeName.ACTUALAMOUNT, StringUtil.formatDouble(bag.totalWaste), null, vMap); } else { nodeLink.setAmountPoolAttribute(AttributeName.ACTUALAMOUNT, StringUtil.formatDouble(bag.totalAmount + bag.totalWaste), null, vMap); } } } return(nodeLink); }
public override void setUp() { agentName = JDFAudit.getStaticAgentName(); JDFElement.setLongID(false); JDFAudit.setStaticAgentName("JDF MISPre golden ticket generator"); base.setUp(); vMap = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap(); for (int i = 0; i < 4; i++) { map.put(EnumPartIDKey.SignatureName, "Sig1"); map.put(EnumPartIDKey.SheetName, i == 0 ? "Cover" : "Sheet" + i); map.put(EnumPartIDKey.Side, "Front"); vMap.Add(new JDFAttributeMap(map)); map.put(EnumPartIDKey.Side, "Back"); vMap.Add(new JDFAttributeMap(map)); } }
public virtual void testSetPartMap() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setVersion(JDFElement.EnumVersion.Version_1_3); n.setType("ConventionalPrinting", true); JDFExposedMedia xm = (JDFExposedMedia)n.addResource(ElementName.EXPOSEDMEDIA, null, EnumUsage.Input, null, null, null, null); xm.addPartition(JDFResource.EnumPartIDKey.SheetName, "Sheet1"); xm.addPartition(JDFResource.EnumPartIDKey.SheetName, "Sheet2"); JDFAttributeMap map1 = new JDFAttributeMap(JDFResource.EnumPartIDKey.SheetName.getName(), "Sheet1"); JDFAttributeMap map2 = new JDFAttributeMap(JDFResource.EnumPartIDKey.SheetName.getName(), "Sheet2"); JDFResourceLink rl = n.getLink(xm, null); VJDFAttributeMap v = new VJDFAttributeMap(); v.Add(map1); v.Add(map2); rl.setPartMapVector(v); }
public virtual void testGetCreatePartAmount() { JDFAttributeMap map = new JDFAttributeMap("Separation", "Black"); JDFAttributeMap map2 = new JDFAttributeMap("Separation", "Cyan"); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(map); vMap.Add(map2); JDFPartAmount pa1 = ap.getCreatePartAmount(map); Assert.AreEqual(map, pa1.getPartMap()); JDFPartAmount pa3 = ap.getCreatePartAmount(vMap); Assert.AreEqual(vMap, pa3.getPartMapVector()); JDFPartAmount pa4 = ap.getCreatePartAmount(vMap); Assert.AreEqual(pa3, pa4); JDFPartAmount pa2 = ap.getCreatePartAmount(map2); Assert.AreEqual(map2, pa2.getPartMap()); }
/// /// <summary> * create 2 sheets with 2 surfaces of 4 seps each </summary> /// private void setup(EnumPartIDKey scheduleDepth, int nSheet) { VJDFAttributeMap vMap = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap(); map.put(EnumPartIDKey.SignatureName, "Sig1"); for (int i = 1; i <= nSheet; i++) { map.put(EnumPartIDKey.SheetName, "Sheet" + i); map.put(EnumPartIDKey.Side, "Front"); vMap.Add(new JDFAttributeMap(map)); map.put(EnumPartIDKey.Side, "Back"); vMap.Add(new JDFAttributeMap(map)); } bgt = new MISCPGoldenTicket(1, null, 2, 1, true, vMap); if (scheduleDepth != null) { // TODO lower } bgt.nCols[0] = bgt.nCols[1] = 4; bgt.assign(null); node = bgt.getNode(); }
public virtual void testReprintJMF() { testAuditsImageSetting(); statCounter.setActiveNode(null, null, null); string sheet = vsSheet.stringAt(1); VJDFAttributeMap vmP = new VJDFAttributeMap(); JDFAttributeMap attributeMap = new JDFAttributeMap(EnumPartIDKey.SheetName, sheet); attributeMap.put("SignatureName", "Sig1"); attributeMap.put("Separation", vsCMYK.stringAt(3)); attributeMap.put("Side", "Front"); vmP.Add(attributeMap); statCounter.setActiveNode(n, vmP, vRL); string refXM = rlXMOut.getrRef(); string refMedia = rlMediaIn.getrRef(); statCounter.setTrackWaste(refXM, true); statCounter.setTrackWaste(refMedia, false); statCounter.setActiveNode(n, vmP, vRL); statCounter.setWorkType(EnumWorkType.Rework); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); statCounter.addPhase(refMedia, 1, 0, true); statCounter.addPhase(refXM, 1, 0, true); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); JDFDoc d2 = statCounter.getDocJMFResource(); JDFJMF jmf = d2.getJMFRoot(); jmf.convertResponses(null); VElement vSigs = jmf.getMessageVector(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Resource); d2.write2File(sm_dirTestDataTemp + "ImageSetResourceReprint_.jmf", 2, false); JDFDoc dStatusJMF = statCounter.getDocJMFPhaseTime(); jmf = dStatusJMF.getJMFRoot(); jmf.convertResponses(null); for (int i = 0; i < vSigs.Count; i++) { jmf.copyElement(vSigs.item(i), null); } dStatusJMF.write2File(sm_dirTestDataTemp + "ImageSetReprint_.jmf", 2, false); // JDFResourceAudit ra= statCounter.setResourceAudit(refMedia, EnumReason.ProcessResult); // JDFProcessRun pr= statCounter.setProcessResult(EnumNodeStatus.Completed); d.write2File(sm_dirTestDataTemp + "ImageSetAmount_Reprint.jdf", 2, false); }
/// /// <summary> * apply the parameters in this to all appropriate resources in parentNode or one of parentNode's children /// * </summary> /// * <param name="parentNode"> the node to search in TODO implement resource handling </param> /// public virtual void applyPipeToNode(JDFNode parentNode) { if (parentNode == null) { return; } VElement vNodes = parentNode.getvJDFNode(null, null, false); int size = vNodes.Count; for (int i = 0; i < size; i++) { JDFNode node = (JDFNode)vNodes[i]; if (!matchesNode(node)) { continue; } JDFElement.EnumNodeStatus status = getStatus(); // TODO: set // Status node.setStatus(status); // final boolean isIncremental = (getUpdateMethod () == // EnumUpdateMethod.Incremental); double dAmount = -1.0; JDFResourceLink rl = getResourceLink(); if (rl != null) { JDFResourceLink rlNode = node.getLink(0, rl.Name, new JDFAttributeMap(AttributeName.RREF, rl.getrRef()), null); if (rlNode == null) { throw new JDFException("Applying pipeparams to inconsistent node: missing resourcelink: " + rl.Name); } VJDFAttributeMap vMap = rl.getPartMapVector(); if (vMap == null) { vMap = new VJDFAttributeMap(); vMap.Add(null); } for (int j = 0; j < vMap.Count; j++) { JDFAttributeMap map = vMap[j]; dAmount = rl.getActualAmount(map); rlNode.setActualAmount(dAmount, map); } } } }
public virtual void testAuditsImageSetting() { for (int i = 0; i < vsSheet.Count; i++) { string sheet = vsSheet.stringAt(i); VJDFAttributeMap vmP = new VJDFAttributeMap(); JDFAttributeMap attributeMap = new JDFAttributeMap(EnumPartIDKey.SheetName, sheet); attributeMap.put("SignatureName", "Sig1"); vmP.Add(attributeMap); statCounter.setActiveNode(n, vmP, vRL); string refXM = rlXMOut.getrRef(); string refMedia = rlMediaIn.getrRef(); statCounter.setTrackWaste(refXM, true); statCounter.setTrackWaste(refMedia, false); statCounter.setPhase(EnumNodeStatus.Stopped, "PowerOn", EnumDeviceStatus.Stopped, "PowerOn"); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); statCounter.addPhase(refMedia, 5, 0, true); statCounter.addPhase(refXM, 5, 0, true); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); // JDFResourceAudit ra= statCounter.setResourceAudit(refMedia, EnumReason.ProcessResult); JDFProcessRun pr = statCounter.setProcessResult(EnumNodeStatus.Completed); pr.setDescriptiveName("we even have the utterly useless ProcessRun"); } d.write2File(sm_dirTestDataTemp + "ImageSetAmount_.jdf", 2, false); JDFDoc d2 = statCounter.getDocJMFResource(); JDFJMF jmf = d2.getJMFRoot(); jmf.convertResponses(null); JDFSignal sig = jmf.appendSignal(org.cip4.jdflib.jmf.JDFMessage.EnumType.Notification); JDFNotification not = sig.appendNotification(); not.setXPathAttribute("MileStone/@MileStoneType", "PrepressCompleted"); not.setXPathAttribute("MileStone/@Amount", "5"); d2.write2File(sm_dirTestDataTemp + "ImageSetAmount_.jmf", 2, false); JDFDoc dStatusJMF = statCounter.getDocJMFPhaseTime(); jmf = dStatusJMF.getJMFRoot(); jmf.convertResponses(null); dStatusJMF.write2File(sm_dirTestDataTemp + "ImageSetPhaseTime_.jmf", 2, false); }
public virtual void testAddMerged() { // Test AddCreated with one parameter JDFDoc doc2 = new JDFDoc("JDF"); JDFNode node2 = doc2.getJDFRoot(); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(new JDFAttributeMap("SheetName", "s1")); JDFMerged m1 = myAuditPool.addMerged(node2, null, null, null); JDFMerged m2 = myAuditPool.addMerged(node2, null, null, vMap); Assert.IsNotNull(m2); Assert.AreEqual(vMap, m2.getPartMapVector()); Assert.IsNull(myAuditPool.getElement(ElementName.PART)); Assert.IsNotNull(m1); }
/// /// <summary> * sets the attribute occurence in the appropriate PartAmount when called for a resourceLink and creates the /// * AmountPool and/or PartAmount if it is not yet there /// * </summary> /// * <param name="attrib"> the attribute name </param> /// * <param name="value"> value to set in string form. </param> /// * <param name="nameSpaceURI"> the XML-namespace </param> /// * <param name="mPart"> defines which part of this ResourceLink the Amount belongs to, if empty set the ResourceLink /// * root attribute </param> /// * <exception cref="JDFException"> when called directly on a PartAmount /// * @since 071103 </exception> /// public static void setAmountPoolAttribute(IAmountPoolContainer poolParent, string attrib, string @value, string nameSpaceURI, JDFAttributeMap mPart) { // ideally the method would be hidden in PartAmount if ((mPart == null) || (mPart.IsEmpty())) { poolParent.setAttribute(attrib, @value, nameSpaceURI); return; } if (poolParent is JDFPartAmount) { throw new JDFException("JDFResourceLink.setAmountPoolAttribute: calling method on PartAmount object"); } VJDFAttributeMap v = new VJDFAttributeMap(); v.Add(mPart); setAmountPoolAttribute(poolParent, attrib, @value, nameSpaceURI, v); }
/// /// <summary> * @return </summary> /// public virtual JDFResourceLink getResourceInfoLink(AmountBag bag) { cleanAmounts(); if (bag != null) { VJDFAttributeMap vMap = new VJDFAttributeMap(enclosingInstance.m_vPartMap); if (vMap.Count == 0) { vMap.Add(new JDFAttributeMap()); } if (bTrackWaste) { vMap.put(EnumPartIDKey.Condition, "Good"); if (bag.totalAmount != 0) { rl.setAmountPoolAttribute(AttributeName.ACTUALAMOUNT, StringUtil.formatDouble(bag.totalAmount), null, vMap); } if (startAmount != 0) { rl.setAmountPoolAttribute(AttributeName.AMOUNT, StringUtil.formatDouble(startAmount), null, vMap); } vMap.put(EnumPartIDKey.Condition, "Waste"); if (bag.totalWaste != 0) { rl.setAmountPoolAttribute(AttributeName.ACTUALAMOUNT, StringUtil.formatDouble(bag.totalWaste), null, vMap); } if (startWaste != 0) { rl.setAmountPoolAttribute(AttributeName.AMOUNT, StringUtil.formatDouble(startWaste), null, vMap); } } else { if (bag.totalAmount + bag.totalWaste != 0) { rl.setAmountPoolAttribute(AttributeName.ACTUALAMOUNT, StringUtil.formatDouble(bag.totalAmount + bag.totalWaste), null, vMap); } if (startAmount + startWaste != 0) { rl.setAmountPoolAttribute(AttributeName.AMOUNT, StringUtil.formatDouble(startAmount + startWaste), null, vMap); } } } return(rl); }
public virtual void testSetAmountPoolAttribute() { JDFDoc d = new JDFDoc("ResourceLinkPool"); JDFResourceLinkPool rlp = (JDFResourceLinkPool)d.getRoot(); JDFResourceLink foo = (JDFResourceLink)rlp.appendElement("FooLink"); VJDFAttributeMap vPart = new VJDFAttributeMap(); vPart.Add(new JDFAttributeMap()); foo.setAmountPoolAttribute("blub", "123", null, vPart); Assert.AreEqual("123", foo.getAttribute("blub")); vPart = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap("SheetName", "b"); vPart.Add(map); foo.setAmountPoolAttribute("blub", "123", null, vPart); Assert.IsNull(foo.getAttribute("blub", null, null)); Assert.AreEqual("123", foo.getAmountPoolAttribute("blub", null, map, 0)); }
public virtual void testMISCPGrayBoxSimplexPoster() { VJDFAttributeMap vMap = new VJDFAttributeMap(); JDFAttributeMap map = new JDFAttributeMap(); map.put(EnumPartIDKey.SignatureName, "Sig1"); map.put(EnumPartIDKey.SheetName, "Sheet1"); map.put(EnumPartIDKey.Side, "Front"); vMap.Add(new JDFAttributeMap(map)); MISCPGoldenTicket cpGoldenTicket = new MISCPGoldenTicket(1, null, 2, 2, true, vMap); cpGoldenTicket.nCols[0] = cpGoldenTicket.nCols[1] = 6; cpGoldenTicket.workStyle = EnumWorkStyle.Simplex; cpGoldenTicket.assign(null); cpGoldenTicket.good = 1000; cpGoldenTicket.waste = 90; BaseGoldenTicketTest.write3GTFiles(this, cpGoldenTicket, "MISCPS_SimplexPoster"); }
public virtual void testGetPartAmountNull() { JDFAttributeMap map = new JDFAttributeMap("Separation", "Black"); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(map); JDFResourceLink rl = (JDFResourceLink) new JDFDoc("MediaLink").getRoot(); ap = rl.appendAmountPool(); Assert.IsNull(ap.getPartAmount(vMap)); Assert.IsNull(ap.getPartAmount(map)); Assert.IsNull(ap.getPartAmount(2)); Assert.IsNull(ap.getPartAmount(0)); JDFPartAmount pa = ap.appendPartAmount(); Assert.IsNull(ap.getPartAmount(vMap)); Assert.IsNull(ap.getPartAmount(map)); Assert.IsNull(ap.getPartAmount(2)); Assert.AreEqual(pa, ap.getPartAmount(0)); }
/// /// <summary> * schedule this node the nodeinfo will be modified </summary> /// public virtual void schedule(VJDFAttributeMap nodesToCombine, int starthours, int durationhours) { VJDFAttributeMap nodesToCombineLocal = nodesToCombine; theNode.setPartStatus(nodesToCombineLocal, EnumNodeStatus.Waiting, null); JDFNodeInfo ni = theNode.getNodeInfo(); if (nodesToCombineLocal == null) { nodesToCombineLocal = new VJDFAttributeMap(); nodesToCombineLocal.Add(null); } for (int i = 0; i < nodesToCombineLocal.Count; i++) { JDFNodeInfo nip = (JDFNodeInfo)ni.getCreatePartition(nodesToCombineLocal[i], null); JDFDate d = new JDFDate(); d.addOffset(0, 0, starthours, 0); nip.setStart(d); d.addOffset(0, 0, durationhours, 0); nip.setEnd(d); } }
public virtual void testLinkResourcePartition() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); JDFResource r = n.addResource("Component", null, null, null, null, null, null); Assert.IsTrue(r is JDFComponent); r = r.addPartition(EnumPartIDKey.SignatureName, "Sig1"); r.addPartition(EnumPartIDKey.SheetName, "S1"); Assert.IsFalse(n.hasChildElement("ResourceLinkPool", null)); JDFResourceLinkPool rlp = n.getCreateResourceLinkPool(); JDFResourceLink rl = rlp.linkResource(r, EnumUsage.Input, EnumProcessUsage.BookBlock); Assert.IsNotNull(rl); Assert.AreEqual(EnumProcessUsage.BookBlock, rl.getEnumProcessUsage()); Assert.AreEqual(EnumUsage.Input, rl.getUsage()); VJDFAttributeMap v = new VJDFAttributeMap(); v.Add(new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1")); Assert.AreEqual(v, rl.getPartMapVector()); }