public void ShowTreeView(object sender) { string flowCode = ((object[])sender)[0].ToString(); string itemCode = ((object[])sender)[1].ToString(); if (TheFlowMgr.LoadFlow(flowCode) == null) { ShowErrorMessage("Common.Business.Warn.FlowInvalid"); return; } if (TheItemMgr.LoadItem(itemCode) == null) { ShowErrorMessage("Common.Business.Warn.ItemInvalid"); return; } supplyChain = TheSupplyChainMgr.GenerateSupplyChain(flowCode, itemCode)[0]; supplyChainDetailList = supplyChain.SupplyChainDetails; if (supplyChainDetailList != null && supplyChainDetailList.Count > 0) { MyOrgNode RootNode = new MyOrgNode(); GenChildOrgNode(RootNode); OrgChartTreeView.Node = RootNode; } }
private void GenChildOrgNode(MyOrgNode RootNode) { decimal BaseQty = 1; RootNode.Code = bom.Code; RootNode.Name = bom.Description; RootNode.Memo1 = BaseQty.ToString() + " " + bom.Uom.Code; createChildNode(RootNode, bom.Code, BaseQty); }
private void GenChildOrgNode(MyOrgNode RootNode) { SupplyChainDetail supplyChainDetail = supplyChainDetailList[0]; RootNode.Code = supplyChainDetail.Flow.PartyTo.Name; RootNode.Name = supplyChainDetail.LocationTo == null ? string.Empty : supplyChainDetail.LocationTo.Name; RootNode.Memo1 = supplyChainDetail.FlowDetail.Item.Code; RootNode.Memo1Tooltip = supplyChainDetail.FlowDetail.Item.Description; RootNode.Memo2 = supplyChainDetail.Flow.Description; RootNode.Memo2Tooltip = supplyChainDetail.Flow.Code; createChildNode(RootNode, supplyChainDetail.Id); }
private void createChildNode(MyOrgNode parentnode, string compCode, decimal BaseQty) { foreach (BomDetail bomDetail in bomDetailList) { if (bomDetail.Bom.Code.ToLower() == compCode.ToLower()) { bomDetail.CalculatedQty = bomDetail.CalculatedQty * BaseQty; MyOrgNode subOrgNode = new MyOrgNode(); subOrgNode.Code = bomDetail.Item.Code; subOrgNode.Name = bomDetail.Item.Description; subOrgNode.Memo1 = bomDetail.CalculatedQty.ToString("0.########") + " " + bomDetail.Uom.Code; subOrgNode.Memo2 = bomDetail.Item.Type; parentnode.Nodes.Add(subOrgNode); createChildNode(subOrgNode, bomDetail.Item.Code, bomDetail.CalculatedQty); } } }
public void ShowTreeView(object sender) { string itemCode = ((object[])sender)[0].ToString(); string date = ((object[])sender)[1].ToString(); string viewType = ((object[])sender)[2].ToString(); DateTime effDate = DateTime.Now; item = TheItemMgr.LoadItem(itemCode); if (item == null || item.Bom == null) { bom = TheBomMgr.LoadBom(itemCode); } else { bom = item.Bom; } if (bom == null) { ShowErrorMessage("MasterData.BomDetail.ErrorMessage.BomNotExist"); this.fld.Visible = false; return; } else { this.fld.Visible = true; } try { effDate = Convert.ToDateTime(date); } catch (Exception) { ShowWarningMessage("MasterData.BomView.WarningMessage.DateInvalid"); return; } bomDetailList = TheBomDetailMgr.GetTreeBomDetail(bom.Code, effDate); if (bomDetailList != null && bomDetailList.Count > 0) { MyOrgNode RootNode = new MyOrgNode(); GenChildOrgNode(RootNode); OrgChartBomTreeView.Node = RootNode; } }
private void createChildNode(MyOrgNode parentnode, int Id) { foreach (SupplyChainDetail supplyChainDetail in supplyChainDetailList) { if (supplyChainDetail.ParentId == Id) { MyOrgNode subOrgNode = new MyOrgNode(); subOrgNode.Code = supplyChainDetail.Flow.PartyTo.Name; subOrgNode.Name = supplyChainDetail.LocationTo == null ? string.Empty : supplyChainDetail.LocationTo.Name; subOrgNode.Memo1 = supplyChainDetail.FlowDetail.Item.Code; subOrgNode.Memo1Tooltip = supplyChainDetail.FlowDetail.Item.Description; subOrgNode.Memo2 = supplyChainDetail.Flow.Description; subOrgNode.Memo2Tooltip = supplyChainDetail.Flow.Code; parentnode.Nodes.Add(subOrgNode); createChildNode(subOrgNode, supplyChainDetail.Id); } } }