private void AddNode(TreeNode node, DrugBox drugBox)
 {
     node.Name = drugBox.Barcode;
     if (drugBox.Child != null)
         foreach (DrugBox child in drugBox.Child)
         {
             if (child.Layer == 0)
             {
                 node.Nodes.Add(child.Barcode);
             }
             else
             {
                 AddNode(node.Nodes.Add(child.Barcode), child);
             }
         }
 }
Exemple #2
0
        /// <summary>
        /// 添加一个新的包装
        /// </summary>
        /// <param name="layer">包装所在的层次(由0开始)</param>
        /// <param name="code">包装的条码</param>
        public void Add(int layer, DrugBox code)
        {
            if (packs.Keys.Contains(layer))
            {

                if (packs[layer].Count % PackRate[layer] == 0)
                {
                    if (packs.Keys.Contains(layer + 1))
                    {
                        Add(layer + 1, new DrugBox(layer + 1));
                    }
                }
                packs[layer].Add(code);
                if (packs.Keys.Contains(layer + 1))
                {
                    packs[layer].Last().Parent = packs[layer + 1].Last();
                    packs[layer].Last().Parent.Child.Add(packs[layer].Last());
                }
            }
        }