コード例 #1
0
        public void AddNewPack(onepack o)
        {
            if (!bSimulate)
            {
                total_packs++;
                total_weights += o.weight;
            }
            else
            {
                total_sim_weights += o.weight;
                total_sim_packs++;
            }
            last_one_pack = o;

            packhist.Enqueue(o);
            if (packhist.Count > 500)
            {
                packhist.Dequeue();
            }
            //update the speed
            long     count   = 0;
            DateTime lastmin = DateTime.Now;

            lastmin = lastmin.Subtract(new TimeSpan(0, 1, 0));
            foreach (onepack op in packhist)
            {
                if (op.time < lastmin)
                {
                    count = count + 1;
                }
                else
                {
                    count = packhist.Count - count;
                    break;
                }
            }
            speed = (UInt32)count;
            if (bSimulate)
            {
                return;
            }
            if (total_packs % 100 == 1) //update record for every 100 packs
            {
                ProdHistory.UpdateRecord(this);
                EngConfigWnd.DecreasePacker(100);
            }
        }
コード例 #2
0
        public void StopRun()
        {
            nc.Stop(300);
            agent.Stop(100);

            agent.Action((byte)(0x80 + _pack_id), "stop");
            agent.Action(vib_addr, "stop");
            Thread.Sleep(300);
            status = PackerStatus.IDLE;
            agent.Resume();
            nc.Resume();

            if (!bSimulate)
            {
                ProdHistory.UpdateRecord(this);
                ResetHistory();
            }
            else
            {
                total_sim_packs   = 0;
                total_sim_weights = 0;
            }
        }