Exemple #1
0
        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);
        }
Exemple #2
0
        public virtual void testAddPhase()
        {
            bool bChanged = sc.setPhase(EnumNodeStatus.InProgress, "i", EnumDeviceStatus.Running, "r");

            Assert.IsTrue(bChanged);
            JDFDoc      docJMF = sc.getDocJMFPhaseTime();
            JDFResponse sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
            JDFJobPhase jp     = sig.getDeviceInfo(0).getJobPhase(0);

            Assert.AreEqual(200, jp.getAmount(), 0);
            sc.addPhase(resID, 0, 100, true);
            sc.setTrackWaste(resID, true);
            JDFResourceLink rlXM = n.getLink(xpMedia, null);

            for (int loop = 1; loop < 4; loop++)
            {
                bChanged = sc.setPhase(EnumNodeStatus.InProgress, "i", EnumDeviceStatus.Running, "r");
                Assert.IsFalse(bChanged);
                docJMF = sc.getDocJMFPhaseTime();
                sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
                jp     = sig.getDeviceInfo(0).getJobPhase(0);
                Assert.AreEqual(200, jp.getAmount(), 0, "multiple setPhase calls do not modify");
                Assert.AreEqual(200, rlXM.getActualAmount(new JDFAttributeMap("Condition", "Good")), 0, "multiple setPhase calls do not modify: " + loop);
                Assert.AreEqual(200.0, jp.getPercentCompleted(), 0, "% " + loop);
                sc.addPhase(resID, 0, 100, true);
                Assert.AreEqual(loop * 100, jp.getWaste(), 0, "" + loop);
                Assert.AreEqual(100 * loop, rlXM.getActualAmount(new JDFAttributeMap("Condition", "Waste")), 0, "multiple setPhase calls do Stack: " + loop);
            }
            sc.setWorkType(EnumWorkType.Alteration);
            bChanged = sc.setPhase(EnumNodeStatus.InProgress, "ii", EnumDeviceStatus.Running, "r");
            Assert.IsTrue(bChanged);
            docJMF = sc.getDocJMFPhaseTime();
            sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
            jp     = sig.getDeviceInfo(0).getJobPhase(0);
            Assert.AreEqual(200, jp.getAmount(), 0);
            Assert.AreEqual(400, jp.getWaste(), 0);
            Assert.IsTrue(jp.hasAttribute(AttributeName.PHASEAMOUNT));
            sig = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 1);
            jp  = sig.getDeviceInfo(0).getJobPhase(0);
            Assert.AreEqual(0.0, jp.getPhaseAmount(), 0.0);
            Assert.AreEqual(EnumWorkType.Alteration, jp.getMISDetails().getWorkType());

            sc.setFirstRefID("dummy");
            sc.addPhase(resID, 0, 100, true);
            sc.setTrackWaste(resID, true);
            sc.setPhase(EnumNodeStatus.InProgress, "i", EnumDeviceStatus.Running, "r");
            docJMF = sc.getDocJMFPhaseTime();
            sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
            jp     = sig.getDeviceInfo(0).getJobPhase(0);
            Assert.IsFalse(jp.hasAttribute(AttributeName.AMOUNT));
            Assert.AreEqual(EnumWorkType.Alteration, jp.getMISDetails().getWorkType());
        }
Exemple #3
0
        public virtual void testMultiModule()
        {
            StatusCounter scRIP = new StatusCounter(n,null,null);

            scRIP.addModule("ID_RIP","RIP");
            StatusCounter scSetter = new StatusCounter(n,null,null);

            scSetter.addModule("ID_Setter","Platesetter");

            MultiModuleStatusCounter msc = new MultiModuleStatusCounter();

            msc.addModule(scRIP);
            msc.addModule(scSetter);

            JDFExposedMedia m = (JDFExposedMedia)n.getMatchingResource("ExposedMedia",null,null,0);

            resID = m.getID();
            scRIP.setFirstRefID(resID);
            scRIP.addPhase(resID,200,0,true);
            bool bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");

            Assert.IsTrue(bChanged);
            JDFDoc        docJMF     = scRIP.getDocJMFPhaseTime();
            JDFResponse   sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            JDFDeviceInfo deviceInfo = sig.getDeviceInfo(0);
            JDFJobPhase   jp         = deviceInfo.getJobPhase(0);

            Assert.AreEqual(200,jp.getAmount(),0);
            scRIP.addPhase(resID,0,100,true);
            scRIP.setTrackWaste(m.getID(),true);
            bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");
            Assert.IsFalse(bChanged);
            JDFDoc dJMFAll = msc.getStatusResponse();

            Assert.AreEqual(dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,1);
            scSetter.setPhase(EnumNodeStatus.InProgress,"seti",EnumDeviceStatus.Running,"run");
            scSetter.setFirstRefID(resID);
            scSetter.addPhase(resID,400,0,true);
            dJMFAll = msc.getStatusResponse();
            Assert.AreEqual(2,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,"1 RIP, 1 setter");

            scRIP.setActiveNode(null,null,null);
            bChanged = scRIP.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(1,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);

            scSetter.setActiveNode(null,null,null);
            bChanged = scSetter.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(0,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);
        }