예제 #1
0
        public static CountClassification operator +(CountClassification c1, CountClassification c2)
        {
            CountClassification count = new CountClassification();

            count.TotalPCS         = c1.TotalPCS + c2.TotalPCS;
            count.TotalPCB         = c1.TotalPCB + c2.TotalPCB;
            count.TotalDrop        = c1.TotalDrop + c2.TotalDrop;
            count.AlarmPcsCount    = c1.AlarmPcsCount + c2.AlarmPcsCount;
            count.AlaramPanelCount = c1.AlaramPanelCount + c2.AlaramPanelCount;
            for (uint i = 0; i < Variable.NOZZLE_NUM; ++i)
            {
                count.ZDrop[i] = c1.ZDrop[i] + c2.ZDrop[i];
            }

            foreach (var name in c1.PCBCount.Keys)
            {
                if (!count.PCBCount.ContainsKey(name))
                {
                    count.PCBCount.Add(name, 0);
                }
                count.PCBCount[name] += c1.PCBCount[name];
            }

            foreach (var name in c2.PCBCount.Keys)
            {
                if (!count.PCBCount.ContainsKey(name))
                {
                    count.PCBCount.Add(name, 0);
                }
                count.PCBCount[name] += c2.PCBCount[name];
            }

            foreach (var name in c1.PCSCount.Keys)
            {
                if (!count.PCSCount.ContainsKey(name))
                {
                    count.PCSCount.Add(name, 0);
                }
                count.PCBCount[name] += c1.PCSCount[name];
            }

            foreach (var name in c2.PCSCount.Keys)
            {
                if (!count.PCSCount.ContainsKey(name))
                {
                    count.PCSCount.Add(name, 0);
                }
                count.PCSCount[name] += c2.PCSCount[name];
            }

            return(count);
        }
예제 #2
0
        private CountClassification GetCount(string path, int startHour, int endHour)
        {
            CountClassification h1 = null;
            CountClassification h2 = null;
            int tStart             = startHour == 0? 0: startHour - 1;
            int tEnd = endHour - 1;

            while (tStart <= tEnd)
            {
                if (h1 == null)
                {
                    h1 = this.LoadTotal(path, tStart);
                    if (h1 == null)
                    {
                        tStart++;
                    }
                }

                if (h2 == null)
                {
                    h2 = this.LoadTotal(path, tEnd);
                    if (h2 == null)
                    {
                        tEnd--;
                    }
                }

                if (h1 != null && h2 != null)
                {
                    break;
                }
            }

            if (h1 == null || h2 == null)
            {
                return(new CountClassification());
            }
            else
            {
                if (tStart > (startHour - 1) || startHour == 0 || tStart == tEnd)
                {
                    return(h2);
                }
                else
                {
                    return(h2 - h1);
                }
            }
        }
예제 #3
0
        private void SaveTotal(CountClassification count, string path, int hour)
        {
            SerializableHelper <CountClassification> helper = new SerializableHelper <CountClassification>(count);

            helper.JsonSerialize($"{path}//{hour}.json");
        }