Exemplo n.º 1
0
        public virtual void testUsageCounter()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFSignal s = jmf.appendSignal();

            jmf.setSenderID("DeviceSenderID");

            s.setType(EnumType.Resource);
            JDFResourceQuParams rqp = s.appendResourceQuParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.USAGECOUNTER);

            JDFResourceInfo ri = s.appendResourceInfo();

            ri.setActualAmount(42);
            JDFUsageCounter uc = (JDFUsageCounter)ri.appendElement(ElementName.USAGECOUNTER);

            uc.setID("UsageCounterID");
            uc.setScope(EnumScope.Job);
            uc.setCounterID("DeviceCounterID");
            uc.setResStatus(EnumResStatus.Available, true);
            uc.setCounterTypes(new VString("NormalSize", " "));
            doc.write2File(sm_dirTestDataTemp + "JMFResourceSignal.jmf", 2, false);
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete));
        }
Exemplo n.º 2
0
        public virtual void testAmount()
        {
            rlComp.setAmount(20, null);
            rlComp.setDescriptiveName("The link points to 20 planned and 20 good + 2 Waste brochures");

            JDFMiscConsumable mc = (JDFMiscConsumable)n.appendMatchingResource(ElementName.MISCCONSUMABLE, EnumProcessUsage.AnyInput, null);

            mc.setResStatus(EnumResStatus.Available, false);
            mc.setConsumableType("FooBar");
            mc.setUnit("Fnarfs");
            mc.setDescriptiveName("FooBars are always measured in Fnarfs");
            JDFResourceLink rlmc = n.getLink(mc, null);

            rlmc.setAmount(42, null);
            rlmc.setDescriptiveName("The link points to 42 actual FooBars");

            JDFUsageCounter uc = (JDFUsageCounter)n.appendMatchingResource(ElementName.USAGECOUNTER, EnumProcessUsage.AnyInput, null);

            uc.setResStatus(EnumResStatus.Available, false);
            uc.setCounterTypes(new VString("Click", " "));
            JDFResourceLink rlu = n.getLink(uc, null);

            rlu.setAmount(200, null);
            rlu.setDescriptiveName("The link points to 200 actual clicks");

            rlMedia.setAmount(100, null);
            rlMedia.setDescriptiveName("The link points to 100 actual sheets");

            Thread.Sleep(1000);
            comp.setResStatus(EnumResStatus.Available, true);

            VElement vRL = new VElement();

            vRL.Add(rlComp);
            vRL.Add(rlu);
            vRL.Add(rlMedia);
            vRL.Add(rlmc);
            StatusUtil stUtil = new StatusUtil(n, null, vRL);

            stUtil.setDeviceID("MyDevice");
            stUtil.setTrackWaste(rlMedia, true);
            stUtil.setTrackWaste(rlComp, true);
            stUtil.setCopyResInResInfo(rlu, true);

            doc.write2File(sm_dirTestDataTemp + "DigiPrintAmount_initial.jdf", 2, false);

            AmountBag[] bags = new AmountBag[vRL.Count];
            bags[0] = new AmountBag(rlComp.getrRef());
            bags[1] = new AmountBag(rlu.getrRef());
            bags[2] = new AmountBag(rlMedia.getrRef());
            bags[3] = new AmountBag(rlmc.getrRef());
            stUtil.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null, bags);
            JDFDoc docStatusJMF = stUtil.getDocJMFPhaseTime();

            docStatusJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountStatus0.jmf", 2, false);
            JDFDoc docResJMF = stUtil.getDocJMFResource();

            docResJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountResource0.jmf", 2, false);

            bags[0].addPhase(0, 2, true);
            bags[1].addPhase(0, 20, true);
            bags[2].addPhase(0, 10, true);
            bags[3].addPhase(0, 0, true);
            stUtil.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null, bags);
            docStatusJMF = stUtil.getDocJMFPhaseTime();
            docStatusJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountStatus1.jmf", 2, false);
            docResJMF = stUtil.getDocJMFResource();
            docResJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountResource1.jmf", 2, false);

            bags[0].addPhase(15, 0, true);
            bags[1].addPhase(150, 0, true);
            bags[2].addPhase(75, 0, true);
            bags[3].addPhase(32, 0, true);
            stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null, bags);
            docStatusJMF = stUtil.getDocJMFPhaseTime();
            docStatusJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountStatus2.jmf", 2, false);
            docResJMF = stUtil.getDocJMFResource();
            docResJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountResource2.jmf", 2, false);

            bags[0].addPhase(5, 0, false);
            bags[1].addPhase(50, 0, false);
            bags[2].addPhase(25, 0, false);
            bags[3].addPhase(11, 0, false);
            stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null, bags);
            docStatusJMF = stUtil.getDocJMFPhaseTime();
            docStatusJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountStatus3.jmf", 2, false);
            docResJMF = stUtil.getDocJMFResource();
            docResJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountResource3.jmf", 2, false);

            bags[0].addPhase(0, 0, true);
            bags[1].addPhase(0, 0, true);
            bags[2].addPhase(0, 0, true);
            bags[3].addPhase(0, 0, true);
            stUtil.setPhase(EnumNodeStatus.Completed, "Idle", EnumDeviceStatus.Idle, null, bags);
            docStatusJMF = stUtil.getDocJMFPhaseTime();
            docStatusJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountStatus4.jmf", 2, false);
            docResJMF = stUtil.getDocJMFResource();
            docResJMF.write2File(sm_dirTestDataTemp + "DigiPrintAmountResource4.jmf", 2, false);

            doc.write2File(sm_dirTestDataTemp + "DigiPrintAmount_final.jdf", 2, false);
        }