public void AddSupplyChainDetail(SupplyChainDetail supplyChainDetail) { if (this.SupplyChainDetails == null) { this.SupplyChainDetails = new List <SupplyChainDetail>(); } this.SupplyChainDetails.Add(supplyChainDetail); }
public void AddSupplyChainDetail(SupplyChainDetail supplyChainDetail) { if (this.SupplyChainDetails == null) { this.SupplyChainDetails = new List<SupplyChainDetail>(); } this.SupplyChainDetails.Add(supplyChainDetail); }
public SupplyChain GenerateSupplyChain(Flow flow, FlowDetail flowDetail) { SupplyChain supplyChain = new SupplyChain(); supplyChain.Flow = flow; supplyChain.FlowDetail = flowDetail; SupplyChainDetail supplyChainDetail = new SupplyChainDetail(); supplyChainDetail.SupplyChain = supplyChain; supplyChainDetail.Id = 1; supplyChainDetail.ParentId = 0; supplyChainDetail.Flow = flow; supplyChainDetail.FlowDetail = flowDetail; supplyChainDetail.LocationTo = flowDetail.DefaultLocationTo == null ? null : flowDetail.DefaultLocationTo; supplyChainDetail.QuantityPer = 1; IList<SupplyChainDetail> supplyChainDetailList = new List<SupplyChainDetail>(); supplyChainDetailList.Add(supplyChainDetail); this.GetSupplyChainDetail(supplyChainDetailList, supplyChainDetail); supplyChain.AddRangeSupplyChainDetail(supplyChainDetailList); return supplyChain; }
private bool CheckSupplyChainDetailEnd(SupplyChainDetail supplyChainDetail, IList<SupplyChainDetail> supplyChainDetailList) { if (supplyChainDetailList != null && supplyChainDetailList.Count > 0) { foreach (SupplyChainDetail scd in supplyChainDetailList) { if (scd.ParentId == supplyChainDetail.Id) { return true; } } } return false; }
private bool CheckSupplyChainDetailItemExist(SupplyChainDetail supplyChainDetail, IList<SupplyChainDetail> supplyChainDetailList) { if (supplyChainDetailList != null && supplyChainDetailList.Count > 0) { foreach (SupplyChainDetail scd in supplyChainDetailList) { if (scd.FlowDetail.Item.Code.ToLower() == supplyChainDetail.FlowDetail.Item.Code.ToLower()) { return true; } } } return false; }
private void GetSupplyChainDetail(IList<SupplyChainDetail> supplyChainDetailList, SupplyChainDetail parentSupplyChainDetail) { if (parentSupplyChainDetail.Flow.Type == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION) { string bomCode = this.GetBomCode(parentSupplyChainDetail.FlowDetail); IList<BomDetail> bomDetailList = BomDetailMgrE.GetFlatBomDetail(bomCode, DateTime.Now); if (bomDetailList != null && bomDetailList.Count > 0) { foreach (BomDetail bomDetail in bomDetailList) { string itemCode = bomDetail.Item.Code; string locFrom = string.Empty; if (bomDetail.Location != null) { locFrom = bomDetail.Location.Code; } else { if (parentSupplyChainDetail.FlowDetail.DefaultLocationFrom == null) { //end continue; } else { locFrom = parentSupplyChainDetail.FlowDetail.DefaultLocationFrom.Code; } } decimal QtyPer = bomDetail.RateQty * (1 + bomDetail.ScrapPercentage); IList<FlowDetail> flowDetailList = this.GetFlowDetailList(itemCode, locFrom); this.FillSupplyChainDetail(supplyChainDetailList, parentSupplyChainDetail, flowDetailList, QtyPer, locFrom); } } } else { string locFrom = this.GetLocFrom(parentSupplyChainDetail); if (locFrom != null) { decimal QtyPer = 1; IList<FlowDetail> flowDetailList = this.GetFlowDetailList(parentSupplyChainDetail.FlowDetail.Item.Code, locFrom); this.FillSupplyChainDetail(supplyChainDetailList, parentSupplyChainDetail, flowDetailList, QtyPer, locFrom); } } }
private string GetLocFrom(SupplyChainDetail supplyChainDetail) { string locFrom = null; if (supplyChainDetail.Flow.Code == supplyChainDetail.FlowDetail.Flow.Code) { locFrom = supplyChainDetail.FlowDetail.DefaultLocationFrom == null ? null : supplyChainDetail.FlowDetail.DefaultLocationFrom.Code; } else { //ReferenceFlow locFrom = supplyChainDetail.Flow.LocationFrom == null ? null : supplyChainDetail.Flow.LocationFrom.Code; } return locFrom; }
private void FillSupplyChainDetail(IList<SupplyChainDetail> supplyChainDetailList, SupplyChainDetail parentSupplyChainDetail, IList<FlowDetail> flowDetailList, decimal QtyPer, string locFrom) { SupplyChainDetail supplyChainDetail = new SupplyChainDetail(); if (flowDetailList != null && flowDetailList.Count > 0) { foreach (FlowDetail flowDetail in flowDetailList) { supplyChainDetail = new SupplyChainDetail(); supplyChainDetail.SupplyChain = parentSupplyChainDetail.SupplyChain; supplyChainDetail.Id = supplyChainDetailList.Count + 1; supplyChainDetail.ParentId = parentSupplyChainDetail.Id; supplyChainDetail.Flow = flowDetail.Flow; supplyChainDetail.FlowDetail = flowDetail; supplyChainDetail.LocationTo = flowDetail.DefaultLocationTo == null ? null : flowDetail.DefaultLocationTo; supplyChainDetail.QuantityPer = QtyPer; if (supplyChainDetailList.Contains(supplyChainDetail)) { return; } else { supplyChainDetailList.Add(supplyChainDetail); this.GetSupplyChainDetail(supplyChainDetailList, supplyChainDetail); } IList<Flow> flowList = this.GetReferenceFlow(flowDetail, locFrom); if (flowList != null && flowList.Count > 0) { //ReferenceFlow foreach (Flow flow in flowList) { if (flow.ReferenceFlow != null && flow.ReferenceFlow == flowDetail.Flow.Code) { supplyChainDetail = new SupplyChainDetail(); supplyChainDetail.SupplyChain = parentSupplyChainDetail.SupplyChain; supplyChainDetail.Id = supplyChainDetailList.Count + 1; supplyChainDetail.ParentId = parentSupplyChainDetail.Id; supplyChainDetail.Flow = flow; supplyChainDetail.FlowDetail = flowDetail; supplyChainDetail.LocationTo = flowDetail.DefaultLocationTo == null ? null : flowDetail.DefaultLocationTo; supplyChainDetail.QuantityPer = QtyPer; if (supplyChainDetailList.Contains(supplyChainDetail)) { return; } else { supplyChainDetailList.Add(supplyChainDetail); this.GetSupplyChainDetail(supplyChainDetailList, supplyChainDetail); } } } } } } }