/// <summary>
 /// 移除评分计划
 /// </summary>
 /// <param name="plan"></param>
 public static void CompletePlan(StructGradingPlan plan)
 {
     lock (lockObj)
     {
         Plans.Remove(plan);
     }
     Log.DebugFormat("org-struct:{0} grade completed!", plan.OrgStcId);
 }
        /// <summary>
        /// 更新评分计划
        /// </summary>
        /// <param name="item">评分项</param>
        public static void UpdatePlan(GradingItem item)
        {
            DataTable orgStc;

            try
            {
                orgStc = DbAccessor.GetOrgStcByStruct(item.StructId);
            }
            catch (Exception e)
            {
                Log.Error("query org-struct by grading item failed", e);
                return;
            }

            foreach (var dataRow in orgStc.AsEnumerable())
            {
                var orgStcId = Convert.ToInt32(dataRow["OrgStcId"]);
                lock (lockObj)
                {
                    if (Plans.Any(p => p.OrgStcId == orgStcId))
                    {
                        try
                        {
                            Plans.First(p => p.OrgStcId == orgStcId).AddGradingItem(item);
                            Log.DebugFormat(
                                "org-struct:{0} update score success, item:sen-{1},stc:{2},fac={3},score={4}",
                                orgStcId,
                                item.SensorId,
                                item.StructId,
                                item.FactorId,
                                item.Score);
                        }
                        catch (Exception e)
                        {
                            Log.ErrorFormat(
                                "org-struct:{0} update score error, item:sen-{1},stc:{2},fac={3},score={4}",
                                orgStcId,
                                item.SensorId,
                                item.StructId,
                                item.FactorId,
                                item.Score);
                        }
                    }
                    else
                    {
                        try
                        {
                            var plan = new StructGradingPlan(orgStcId);
                            plan.AddGradingItem(item);
                            Plans.Add(plan);
                            Log.DebugFormat(
                                "org-struct:{0} build plan success, create time:{1}",
                                plan.OrgStcId,
                                plan.CreateTime);
                        }
                        catch (Exception e)
                        {
                            Log.ErrorFormat("org-struct:{0} build plan error", e, orgStcId);
                        }
                    }
                }
            }
        }