Exemple #1
0
 public void AddData(List <List <Int32> > data)
 {
     lock (_SampleDic)
     {
         for (int i = 0; i < data.Count; i++)
         {
             ComponentSample sample = _SampleDic[i];
             sample.SampleData.AddRange(data[i]);
         }
     }
 }
Exemple #2
0
        private SampleCode CreateCode(JobSection sec)
        {
            SampleCode code = new SampleCode();

            code.JobId = sec.JobID;
            //code.JobId = "";
            if (String.IsNullOrEmpty(sec.JobID))
            {
                _SecID     = -1;
                code.SecId = _SecID;
            }
            else
            {
                code.SecId = ++_SecID;
            }
            code.GCodeFile = GetGCodeFileName();
            //code.GCodeFile = "";
            long tickes = CurrentTime();

            code.SampleDate = tickes.ToString();
            //code.SampleDate = "";
            foreach (Int32 key in sec.SampleDic.Keys)
            {
                ComponentSample com = sec.SampleDic[key];
                if (com.Configure.Channel == _PGROPChannel.Configure.Channel)
                {
                    code.ProId = this.GetGCodeFileName(com.SampleData[0]);
                    continue;
                }
                else if (com.Configure.Channel == _LINEChannel.Configure.Channel)
                {
                    code.LineId = com.SampleData[0];
                    continue;
                }
                if (code.Data.Keys.Contains(com.Configure.Component) == false)
                {
                    Dictionary <SampleType, List <Int32> > list = new Dictionary <SampleType, List <int> >();
                    code.Data.Add(com.Configure.Component, list);
                }
                code.Data[com.Configure.Component].Add(com.Configure.SampleType, com.SampleData);
            }
            return(code);
        }
Exemple #3
0
 public Machine(Int16 ClientNo, String ip, UInt16 port, SampleSet set, bool needSample)
 {
     _MacSize++;
     if (_MacSize > 18)
     {
         int ik = 0;
         int j  = ik + 1;
     }
     _NeedSample      = needSample;
     _StopLocker      = new Object();
     _ClientNo        = ClientNo;
     _MachineIp       = ip;
     _MachinePort     = port;
     _SampleDic       = new Dictionary <int, Queue <SampleData> >();
     _SampleSet       = set;
     _Job             = new Job(this);
     _ProgPath        = "";
     LocalDB          = -1;
     CloudDB          = -1;
     _ProgramIdToName = new Dictionary <int, string>();
     _ScanProgramName = true;
     if (needSample)
     {
         for (Int32 i = 56; i <= 66; i++)
         {
             _ProgramIdToName.Add(i, "");
         }
         _conf = set.GetSampleConfig();
         for (int i = 0; i < _conf.Count; i++)
         {
             ComponentSample sample = new ComponentSample(_conf[i]);
             _Job.SampleDic.Add(_conf[i].Channel, sample);
         }
         set.SetSamplConfig(_ClientNo);
         HncApi.HNC_SamplSubscibeData(_ClientNo);
         InitHandler  handler = new InitHandler(Init);
         IAsyncResult result  = handler.BeginInvoke(new AsyncCallback(InitFinished), "Init finished!");
     }
 }
Exemple #4
0
 private void SetSpecialChannel()
 {
     if (_PGROPChannel == null)
     {
         for (int i = 0; i < _SampleDic.Count; i++)
         {
             ComponentSample sample = _SampleDic[i];
             if (sample.Configure.SampleType == SampleType.PROGID)
             {
                 _PGROPChannel = sample;
             }
             else if (sample.Configure.SampleType == SampleType.RUNLINE)
             {
                 _LINEChannel = sample;
             }
             else if (sample.Configure.SampleType == SampleType.CH_STATUS)
             {
                 _ChannelStatus = sample;
             }
         }
     }
 }
Exemple #5
0
        public ComponentSample CloneEmpty()
        {
            ComponentSample cp = new ComponentSample(_Configure);

            return(cp);
        }