Ejemplo n.º 1
0
 /// <summary>
 /// Removes a key value pair from the list mapping
 /// </summary>
 /// <param name="key">Key to remove</param>
 /// <param name="values">The values to remove.</param>
 /// <returns>True if it is removed, false otherwise</returns>
 public bool Remove(TKey key, params TValue[] values)
 {
     values ??= Array.Empty <TValue>();
     if (values.Length == 0)
     {
         return(false);
     }
     lock (LockObject)
     {
         if (!Items.TryGetValue(key, out var TempItems))
         {
             return(false);
         }
         var ReturnValue = false;
         for (var x = 0; x < values.Length; ++x)
         {
             ReturnValue |= TempItems.Remove(values[x]);
         }
         if (TempItems.Count == 0)
         {
             Items.Remove(key);
         }
         return(ReturnValue);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 绑定临时任务和最终任务信息
        /// </summary>
        /// <param name="item"></param>
        private void MatchTempInfo(NDCItem item)
        {
            try
            {
                if (item._mTask.TASKID == 0 && item._mTask.NDCINDEX != -1)
                {
                    NDCItem tempItem = TempItems.Find(c =>
                    {
                        return(c._mTask.IKEY == item._mTask.IKEY &&
                               c._mTask.NDCLOADSITE == item._mTask.NDCLOADSITE &&
                               c._mTask.NDCUNLOADSITE == item._mTask.NDCUNLOADSITE);
                    });
                    if (tempItem != null)
                    {
                        NDCItem i = Items.Find(c => c._mTask.IKEY == tempItem._mTask.IKEY);
                        if (i != null)
                        {
                            i._mTask.NDCINDEX = tempItem._mTask.NDCINDEX;
                            i.CARRIERID       = tempItem.CARRIERID;
                            i.DirectStatus    = tempItem.DirectStatus;
                            i.Magic           = tempItem.Magic;
                            i.Status          = tempItem.Status;
                            TempItems.Remove(tempItem);
                            item = i;
                        }
                    }
                }

                if (item._mTask.TASKID != 0 && item._mTask.NDCINDEX != 0)
                {
                    try
                    {
                        if (item.PLCStatus != NDCPlcStatus.Unloaded && item._mTask.PAUSE &&
                            item.Magic == 11)
                        {
                            //不做操作,挂起的任务异常结束就不通知WCS了
                        }
                        else
                        {
                            _NoticeWcsMagic(item._mTask.TASKID, item.CARRIERID + "", item.Magic);
                        }
                        _sqlControl.UpdateNdcItem(item);
                        return;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
                _sqlControl.UpdateNdcItem(item);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Removes a key value pair from the list mapping
 /// </summary>
 /// <param name="key">Key to remove</param>
 /// <param name="value">Value to remove</param>
 /// <returns>True if it is removed, false otherwise</returns>
 public bool Remove(T1 key, T2 value)
 {
     _ToString = null;
     lock (LockObject)
     {
         if (!Items.TryGetValue(key, out var TempItems))
         {
             return(false);
         }
         var ReturnValue = TempItems.Remove(value);
         if (TempItems.Count == 0)
         {
             Items.Remove(key);
         }
         return(ReturnValue);
     }
 }