| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | 
							- using Aitex.Common.Util;
 
- using Aitex.Core.Common;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.Utilities;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- namespace MECF.Framework.Common.ToolLayout
 
- {
 
-     public class CellItemRecipeTimeManager : Singleton<CellItemRecipeTimeManager>   
 
-     {
 
-         #region 内部变量
 
-         /// <summary>
 
-         /// Recipe时间字典(key-recipe ppid,value-时间总和)
 
-         /// </summary>
 
-         private Dictionary<string, int> _recipeTimeDictionary = new Dictionary<string, int>();
 
-         #endregion
 
-         /// <summary>
 
-         /// 初始化
 
-         /// </summary>
 
-         public void Initialize()
 
-         {
 
-             _recipeTimeDictionary = BinarySerializer<Dictionary<string,int>>.FromStream("RecipeTimeManager");
 
-         }
 
-         /// <summary>
 
-         /// 是否包含
 
-         /// </summary>
 
-         /// <param name="ppid"></param>
 
-         /// <returns></returns>
 
-         public bool ContainRecipe(string ppid)
 
-         {
 
-             return _recipeTimeDictionary.ContainsKey(ppid);
 
-         }
 
-         /// <summary>
 
-         /// 获取recipe时间总和
 
-         /// </summary>
 
-         /// <param name="ppid"></param>
 
-         /// <returns></returns>
 
-         public int GetRecipeTotalTime(string ppid)
 
-         {
 
-             return _recipeTimeDictionary.ContainsKey(ppid) ? _recipeTimeDictionary[ppid] : int.MaxValue;
 
-         }
 
-         /// <summary>
 
-         /// 更新Recipe时长
 
-         /// </summary>
 
-         /// <param name="ppid"></param>
 
-         /// <param name="time"></param>
 
-         public void UpdateRecipeTime(string ppid,int time)
 
-         {
 
-             _recipeTimeDictionary[ppid] = time;
 
-             Serialize();
 
-         }
 
-         /// <summary>
 
-         /// 序列化
 
-         /// </summary>
 
-         private async void Serialize()
 
-         {
 
-             await Task.Run(() =>
 
-             {
 
-                 try
 
-                 {
 
-                     BinarySerializer<Dictionary<string,int>>.ToStream(_recipeTimeDictionary, "RecipeTimeManager");
 
-                     
 
-                 }
 
-                 catch (Exception ex)
 
-                 {
 
-                     LOG.WriteExeption(ex);
 
-                 }
 
-             });
 
-         }
 
-     }
 
- }
 
 
  |