Inheritance: LeanEngine.Entity.EntityBase
Example #1
0
        /// <summary>
        /// Build supply chain by finished good itemcode
        /// </summary>
        /// <param name="itemCode"></param>
        /// <param name="ItemFlows"></param>
        /// <returns></returns>
        public List<SupplyChain> BuildSupplyChain(string itemCode, List<ItemFlow> ItemFlows)
        {
            if (itemCode == null || ItemFlows == null || ItemFlows.Count == 0)
                return null;

            List<SupplyChain> supplyChains = new List<SupplyChain>();

            int bomLevel = 0;
            var query = ItemFlows.Where(i => Utilities.StringEq(i.Item, itemCode)).ToList();

            List<string> locList = this.LocSort(query);

            foreach (var loc in locList)
            {
                var q2 = query.Where(i => Utilities.StringEq(i.LocTo, loc)).ToList();
                foreach (var itemFlow in q2)
                {
                    SupplyChain supplyChain = new SupplyChain();
                    supplyChain.BomLevel = bomLevel;
                    supplyChain.ItemFlow = itemFlow;
                    supplyChain.Item = itemFlow.Item;
                    supplyChain.Loc = itemFlow.LocFrom;

                    supplyChains.Add(supplyChain);
                }
            }

            return supplyChains;
        }
        private List<SupplyChain> SupplyChainBuilder(string itemCode, List<ItemFlow> ItemFlows, int bomLevel, List<SupplyChain> supplyChains)
        {
            var qItemFlow = ItemFlows.Where(i => Utilities.StringEq(i.Item.ItemCode, itemCode)).ToList();

            List<string> locList = this.LocSort(qItemFlow);
            foreach (var loc in locList)
            {
                if (loc == null)
                    continue;

                var q2 = qItemFlow.Where(i => Utilities.StringEq(i.LocFrom, loc)).ToList<ItemFlow>();
                foreach (var itemFlow in q2)
                {
                    SupplyChain supplyChain = new SupplyChain();
                    supplyChain.BomLevel = bomLevel;
                    supplyChain.ItemFlow = itemFlow;
                    supplyChain.Item = itemFlow.Item;
                    supplyChain.Loc = itemFlow.LocFrom;

                    supplyChains.Add(supplyChain);
                }
            }

            return supplyChains;
        }
Example #3
0
        public override bool Equals(object obj)
        {
            SupplyChain another = obj as SupplyChain;

            if (another == null)
            {
                return(false);
            }
            else
            {
                return(this.ID == another.ID);
            }
        }