Exemple #1
0
        //private static Queue<CacheUpdateInfo> _localChangeDemands = new Queue<CacheUpdateInfo>();
        //private static object _syncObj_localChangeDemands = new object();
        /// <summary>
        /// 增加一个Cache变更请求
        /// </summary>
        /// <param name="item"></param>
        public static void AddChangeDemand(CacheUpdateInfo item)
        {
            #region OLD
            ////lock (_syncObj_localChangeDemands)
            ////{
            ////    _localChangeDemands.Enqueue(item);   
            ////}
            //string err = "Bad Cache Subscribing IP List In Config File!";
            //// 2010-02-10 Liu Dong(eB1-4)         Modify ITC-1122-0084 
            //string IPAppslst = System.Configuration.ConfigurationManager.AppSettings["CSIPL"];
            //if (!string.IsNullOrEmpty(IPAppslst))
            //{
            //    string[] IPAppses = IPAppslst.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            //    if (IPAppses != null && IPAppses.Length > 0)
            //    {
            //        foreach (string IPApps in IPAppses)
            //        {
            //            string[] strs = IPApps.Split(new string[] { "[", "]" }, StringSplitOptions.RemoveEmptyEntries);
            //            if (strs != null && strs.Length > 1)
            //            {
            //                item.CacheServerIP = strs[0].Trim();
            //                string[] strs_i = strs[1].Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
            //                if (strs_i != null && strs_i.Length > 0)
            //                {
            //                    foreach (string appName in strs_i)
            //                    {
            //                        item.AppName = appName.Trim();
            //                        AddCacheUpdate(item);
            //                    }
            //                }
            //                else
            //                    throw new Exception(err);
            //            }
            //            else
            //                throw new Exception(err);
            //        }
            //    }
            //    else
            //        throw new Exception(err);
            //}
            //else
            //    throw new Exception(err);
            #endregion

            IList<string[]> ipps = GetCSIPLFromCacheUpdateServer();
            if (ipps != null && ipps.Count > 0)
            {
                foreach(string[] entry in ipps)
                {
                    item.CacheServerIP = entry[0].Trim();
                    item.AppName = entry[1].Trim();
                    AddCacheUpdate(item);
                }
            }
        }
Exemple #2
0
        private static bool ProcessItem(CacheUpdateInfo item)
        {
            ICache worker = null;
            switch (item.Type)
            {
                case CacheType.Part:
                    worker = GetRAsCache(CacheConstName.IPartRepository);
                    break;

                case CacheType.Family:
                case CacheType.QCRatio:
                    worker = GetRAsCache(CacheConstName.IFamilyRepository);
                    break;

                case CacheType.Model:
                    worker = GetRAsCache(CacheConstName.IModelRepository);
                    break;

                case CacheType.BOM:
                    worker = GetRAsCache(CacheConstName.IBOMRepository);
                    break;

                case CacheType.DefectCode:
                    worker = GetRAsCache(CacheConstName.IDefectRepository);
                    break;

                case CacheType.DefectInfo:
                    worker = GetRAsCache(CacheConstName.IDefectInfoRepository);
                    break;

                case CacheType.Process:
                    worker = GetRAsCache(CacheConstName.IProcessRepository);
                    break;

                case CacheType.Station:
                    worker = GetRAsCache(CacheConstName.IStationRepository);
                    break;

                case CacheType.Line:
                    worker = GetRAsCache(CacheConstName.ILineRepository);
                    break;

                case CacheType.ModelWeight:
                    worker = GetRAsCache(CacheConstName.IModelWeightRepository);
                    break;

                case CacheType.ModelTolerance:
                    worker = GetRAsCache(CacheConstName.IModelToleranceRepository);
                    break;
            }
            //item.CacheServerIP = GetIPAddress();// 2010-02-10 Liu Dong(eB1-4)         Modify ITC-1122-0084 
            item.Updated = true;

            if (worker != null)
            {
                if (worker.IsCached())
                {
                    worker.ProcessItem(item);
                    return true;
                }
                else
                    return false;
            }
            else
                return false;
        }
Exemple #3
0
 private static void AddCacheUpdate(CacheUpdateInfo cacheUpdateInfo)
 {
     if (null == _miscRepository)
     {
         Type miscRTp = GetImplementedMiscRepository();
         _miscRepository = EmbodyAnInstance(miscRTp);
     }
     if (null == _mthInfo_addCacheUpdate)
     {
         Type miscRTp = GetImplementedMiscRepository();
         _mthInfo_addCacheUpdate = miscRTp.GetMethod(CacheConstName.AddCacheUpdate);
     }
     try
     {
         _mthInfo_addCacheUpdate.Invoke(_miscRepository, new object[] { cacheUpdateInfo });
     }
     catch (Exception ex)
     {
         throw ex.InnerException;
     }
 }
Exemple #4
0
 private static int DeleteCacheUpdateForSoloTypes(CacheUpdateInfo cacheUpdateInfo, string[] types)
 {
     if (null == _miscRepository)
     {
         Type miscRTp = GetImplementedMiscRepository();
         _miscRepository = EmbodyAnInstance(miscRTp);
     }
     if (null == _mthInfo_deleteCacheUpdateForSoloTypes)
     {
         Type miscRTp = GetImplementedMiscRepository();
         _mthInfo_deleteCacheUpdateForSoloTypes = miscRTp.GetMethod(CacheConstName.DeleteCacheUpdateForSoloTypes);
     }
     try
     {
         return (int)_mthInfo_deleteCacheUpdateForSoloTypes.Invoke(_miscRepository, new object[] { cacheUpdateInfo, types });
     }
     catch (Exception ex)
     {
         throw ex.InnerException;
     }
 }
Exemple #5
0
 private IMES.DataModel.CacheUpdateInfo GetACacheSignal(string pk, string type)
 {
     IMES.DataModel.CacheUpdateInfo ret = new IMES.DataModel.CacheUpdateInfo();
     ret.Cdt = ret.Udt = _Schema.SqlHelper.GetDateTime();
     ret.Updated = false;
     ret.Type = type;
     ret.Item = pk;
     return ret;
 }
Exemple #6
0
 public void ProcessItem(CacheUpdateInfo item)
 {
     if (item.Type == IMES.DataModel.CacheType.BOM)
         LoadOneCache(item.Item);
 }