예제 #1
0
 public static void PushCreateDatasFBI(DTSEquip equip, FiberBreakInfo fiberbreakinfo)
 {
     if (EquipCreateDatasFBI.Keys.Contains(equip))
     {
         lock (obj1)
             EquipCreateDatasFBI[equip].Add(fiberbreakinfo);
     }
     else
     {
         List <FiberBreakInfo> temp = new List <FiberBreakInfo>();
         temp.Add(fiberbreakinfo);
         EquipCreateDatasFBI.Add(equip, temp);
     }
 }
예제 #2
0
 public static void PushRegistDatas(DTSEquip equip, RegistData rd)
 {
     if (RegistDatas.Keys.Contains(equip))
     {
         lock (obj2)
         {
             RegistDatas[equip].Add(rd);
         }
     }
     else
     {
         List <RegistData> listregistdatas = new List <RegistData>();
         listregistdatas.Add(rd);
         RegistDatas.Add(equip, listregistdatas);
     }
 }
예제 #3
0
        /*
         * public void CreateData()
         * {
         *  EquipCreateDatasCI.Clear();
         *  EquipCreateDatasFBI.Clear();
         *  RegistDatas.Clear();
         *  foreach (KeyValuePair<string, DTSEquip> kvp in Equip)
         *  {
         *      kvp.Value.tcpServer.Start();
         *      List<ChannelInfos> channels = kvp.Value.channelInfo;
         *      if (channels.Count > 0)
         *      {
         *          for (int i = 0; i < channels.Count; i++)
         *          {
         *              CreateDatas cd = new CreateDatas(kvp.Value,channels[i]);
         *              int index = -1;
         *              if (EquipCreateDatas.Keys.Contains(kvp.Key))
         *              {
         *                  EquipCreateDatas[kvp.Key].Add(cd);
         *                  index = EquipCreateDatas[kvp.Key].Count - 1;
         *              }
         *              else
         *              {
         *                  List<CreateDatas> list = new List<CreateDatas>();
         *                  list.Add(cd);
         *                  EquipCreateDatas.Add(kvp.Key, list);
         *                  index = 0;
         *              }
         *              EquipCreateDatas[kvp.Key][index].timer.Start();
         *              _isRunning = true;
         *          }
         *      }
         *  }
         *
         *  //    t.Start();
         *  //     t1.Start();
         * }
         */

        public static void PushCreateDatasCI(DTSEquip equip, ChannelInfos ci)
        {
            if (ci != null)
            {
                if (EquipCreateDatasCI.Keys.Contains(equip))
                {
                    lock (obj)
                        EquipCreateDatasCI[equip].Add(ci);
                }
                else
                {
                    List <ChannelInfos> temp = new List <ChannelInfos>();
                    temp.Add(ci);
                    EquipCreateDatasCI.Add(equip, temp);
                }

                //   Trace.WriteLine("CreateInputRegistData:" + waitSend["1"].Count);
            }
        }
예제 #4
0
        private void DoJob()
        {
            while (_isRunning)
            {
                if (EquipCreateDatasCI.Count > 0)
                {
                    lock (obj)
                    {
                        DTSEquip[] keys = EquipCreateDatasCI.Keys.ToArray();
                        for (int i = 0; i < keys.Length; i++)
                        {
                            DTSEquip key = keys[i];
                            if (EquipCreateDatasCI[key].Count > 0)
                            {
                                ChannelInfos channelinfos = CloneChanelInfo(EquipCreateDatasCI[key][0]);
                                if (channelinfos.FiberBreakStatus == 1)
                                {
                                    List <FiberBreakInfo> fiberBreakInfo;
                                    if (EquipCreateDatasFBI.TryGetValue(key, out fiberBreakInfo))
                                    {
                                        if (fiberBreakInfo.Count > 0)
                                        {
                                            channelinfos.FiberBreak = CloneFiberBreakInfo(fiberBreakInfo[0]);
                                            lock (obj1)
                                                EquipCreateDatasFBI[key].RemoveAt(0);
                                        }
                                    }
                                }
                                //     InputRigisDatas.Create().PushChannelInfos(channelinfos);
                                RegistData rd = DTS.CreateData.RegistDatas.SerialChanenlInfo(channelinfos);
                                PushRegistDatas(key, rd);

                                EquipCreateDatasCI[key].RemoveAt(0);
                            }
                        }
                    }
                    Thread.Sleep(10);
                }
            }
        }