Esempio n. 1
0
 void DeleteChangeEx(ContractBoiChangeNode Node)
 {
     if (Node.ChangeDetailEx == null)
     {
         Node.ChangeDetailEx = HDAutoMapper.DynamicMap <ContractBoqChangeDetailEx>(Node);
         ChangeDetailExList.Add(Node.ChangeDetailEx);
     }
     Node.ChangeDetailEx.AfAmount     = 0;
     Node.ChangeDetailEx.AfPrice      = 0;
     Node.ChangeDetailEx.AfQty        = 0;
     Node.ChangeDetailEx.BefAmount    = Node.OriginalBoi.CtrctAmount;
     Node.ChangeDetailEx.BefPrjPrice  = Node.OriginalBoi.CtrctPrjPrice;
     Node.ChangeDetailEx.BefQty       = Node.OriginalBoi.CtrctQty;
     Node.ChangeDetailEx.ChangeQty    = 0 - Node.OriginalBoi.CtrctQty;
     Node.ChangeDetailEx.ChangePrice  = 0 - Node.OriginalBoi.CtrctPrjPrice;
     Node.ChangeDetailEx.ChangeAmount = 0 - Node.OriginalBoi.CtrctAmount;
     //if (Node.StatId == 0)
     //{
     //    Node.ChangeDetailEx.ChangeType = ChangeType.Disable;
     //}
     //else
     //{
     Node.ChangeDetailEx.ChangeType = ChangeType.Delete;
     //}
 }
Esempio n. 2
0
        private void InitChanged()
        {
            List <ContractBoqChangeDetailEx> lstDetail = ChangeDetailExList.ToList();
            List <ContractBoqChangeDetailEx> lstDelete = lstDetail.FindAll(m => m.ChangeType == ChangeType.Delete).OrderByDescending(m => m.ItemCode).ToList();
            List <ContractBoqChangeDetailEx> lstUpdate = lstDetail.FindAll(m => m.ChangeType == ChangeType.Update).OrderByDescending(m => m.ItemCode).ToList();
            List <ContractBoqChangeDetailEx> lstNew    = lstDetail.FindAll(m => m.ChangeType == ChangeType.Add).OrderBy(m => m.ItemCode).ToList();
            List <ContractBoqChangeDetailEx> lstDiable = lstDetail.FindAll(m => m.ChangeType == ChangeType.Disable).OrderByDescending(m => m.ItemCode).ToList();
            List <ContractBoqChangeDetailEx> lstEnable = lstDetail.FindAll(m => m.ChangeType == ChangeType.Enable).OrderByDescending(m => m.ItemCode).ToList();
            List <ContractBoiChangeNode>     lstNode   = NodeList.ToList();

            lstDelete.ForEach(m =>
            {
                ContractBoiChangeNode node = lstNode.FirstOrDefault(n => n.ItemNo == m.ItemNo);
                node.ChangeDetailEx        = m;
                ChangeNodeStat(node, false);
            });
            lstNew.ForEach(m =>
            {
                ContractBoiChangeNode nodeAdd = HDAutoMapper.DynamicMap <ContractBoiChangeNode>(m);
                nodeAdd.CtrctPrjPrice         = m.AfPrice;
                nodeAdd.CtrctQty                 = m.AfQty;
                nodeAdd.CtrctAmount              = m.AfAmount;
                nodeAdd.ChangeDetailEx           = m;
                ContractBoiChangeNode parentNode = lstNode.FirstOrDefault(n => n.ItemCode == nodeAdd.ParentCode);
                if (parentNode != null)
                {
                    parentNode.Children.Add(nodeAdd);
                }
                else
                {
                    RootList.Add(nodeAdd);
                }
                NodeList.Add(nodeAdd);
            });
            lstUpdate.ForEach(m =>
            {
                ContractBoiChangeNode node = lstNode.Find(n => n.ItemNo == m.ItemNo);
                node.CtrctAmount           = m.AfAmount;
                node.CtrctPrjPrice         = m.AfPrice;
                node.CtrctQty       = m.AfQty;
                node.IItemCoe       = m.IItemCoe;
                node.Uom            = m.Uom;
                node.ItemName       = m.ItemName;
                node.ChangeDetailEx = m;
            });
            lstDiable.ForEach(m =>
            {
                ContractBoiChangeNode node = lstNode.Find(n => n.ItemNo == m.ItemNo);
                node.ChangeDetailEx        = m;
                ChangeNodeStat(node, false);
            });
            lstEnable.ForEach(m =>
            {
                ContractBoiChangeNode node = lstNode.Find(n => n.ItemNo == m.ItemNo);
                node.ChangeDetailEx        = m;
                ChangeNodeStat(node, true);
            });
        }
Esempio n. 3
0
        /// <summary>
        /// 获取扩展对象
        /// </summary>
        /// <param name="ChangeNo">变更单No</param>
        /// <returns></returns>
        public ProjectBoqChangeEx GetChangeEx(String ChangeNo)
        {
            //查找Info对象
            ContractBoqChangeInfo chInfo = ChangedList.ToList().Find(m => m.ChangeNo == ChangeNo);
            //获取变更明细
            ContractBoqChange boqChange = projectBoqChangeService.Get(ChangeNo);
            //加工成扩展对象
            ProjectBoqChangeEx boqChangeEx = HDAutoMapper.DynamicMap <ProjectBoqChangeEx>(boqChange);

            boqChangeEx.ChangeInfo = chInfo;
            return(boqChangeEx);
        }
Esempio n. 4
0
        /// <summary>
        /// 变更数据加载
        /// </summary>
        public void Load(String ChangeNo)
        {
            ContractBoqChange changeData = projectBoqChangeService.Get(ChangeNo);

            BoqChangeEx            = HDAutoMapper.DynamicMap <ProjectBoqChangeEx>(changeData);
            BoqChangeEx.ChangeInfo = ChangedList.ToList().FirstOrDefault(m => m.ChangeNo == ChangeNo);
            List <ContractBoqChangeDetailEx> lstEx = HDAutoMapper.DynamicMap <List <ContractBoqChangeDetailEx> >(changeData.Details);

            lstEx.ForEach(m =>
            {
                BoqChangeEx.DetailExList.Add(m);
            });
        }
Esempio n. 5
0
        /// <summary>
        /// 将Boi列表转换为Node列表
        /// </summary>
        /// <param name="BoiList"></param>
        /// <returns></returns>
        private List <ContractBoiNode> Convert(List <ContractBoi> BoiList)
        {
            List <ContractBoiNode> lstBoiNode;
            List <ContractBoiNode> lstRoot;

            lstBoiNode = BoiList.ConvertAll <ContractBoiNode>(m =>
            {
                ContractBoiNode node = HDAutoMapper.DynamicMap <ContractBoiNode>(m);
                node.OriginalBoi     = m;
                return(node);
            });
            lstRoot = lstBoiNode.FindAll(m => String.IsNullOrEmpty(m.ParentCode));
            RootList.AddRange(lstRoot);
            lstRoot.ForEach(m =>
            {
                RecursionNode(lstBoiNode, m);
            });
            return(lstBoiNode);
        }
Esempio n. 6
0
        /// <summary>
        /// 将Boi列表转换为Node列表
        /// </summary>
        /// <param name="BoiList"></param>
        /// <returns></returns>
        private List <ContractBoiChangeNode> Convert(List <ContractBoi> BoiList)
        {
            List <ContractBoiChangeNode> lstBoiNode;
            List <ContractBoiChangeNode> lstRoot;

            lstBoiNode = BoiList.ConvertAll <ContractBoiChangeNode>(m =>
            {
                ContractBoiChangeNode node = HDAutoMapper.DynamicMap <ContractBoiChangeNode>(m);
                //生成变更的编辑界面使用合同字段作为最新的值,因此 将变更后的值赋值给合同字段
                node.CtrctAmount   = node.LatestAmount;
                node.CtrctPrjPrice = node.LatestPrice;
                node.CtrctQty      = node.LatestQty;
                node.OriginalBoi   = m;
                return(node);
            });
            lstRoot = lstBoiNode.FindAll(m => String.IsNullOrEmpty(m.ParentCode));
            RootList.AddRange(lstRoot);
            lstRoot.ForEach(m =>
            {
                RecursionNode(lstBoiNode, m);
            });
            return(lstBoiNode);
        }
Esempio n. 7
0
        /// <summary>
        /// 保存数据
        /// </summary>
        public void Save()
        {
            ContractBoqChange changeData = new ContractBoqChange();

            ObjectHelper.CopyOneToTwo(BoqChangeEx, changeData);
            changeData.Details = new List <ContractBoqChangeDetail>();
            changeData.Details.AddRange(BoqChangeEx.DetailExList.ToList().ConvertAll <ContractBoqChangeDetail>(m =>
            {
                ContractBoqChangeDetail detail = new ContractBoqChangeDetail();
                ObjectHelper.CopyOneToTwo(m, detail);
                return(detail);
            }));
            ContractBoqChange result = projectBoqChangeService.Save(changeData);

            if (String.IsNullOrEmpty(changeData.ChangeNo))
            {
                ContractBoqChangeInfo info = HDAutoMapper.DynamicMap <ContractBoqChangeInfo>(result);
                BoqChangeEx.ChangeNo   = result.ChangeNo;
                BoqChangeEx.ChangeInfo = info;
                ChangedList.Add(info);
            }
            ObjectHelper.CopyOneToTwo <ContractBoqChangeInfo>(HDAutoMapper.DynamicMap <ContractBoqChangeInfo>(result), BoqChangeEx.ChangeInfo);
        }
Esempio n. 8
0
 /// <summary>
 /// 更新扩展对象新增和修改的值
 /// </summary>
 /// <param name="Node"></param>
 void UpdateChangeEx(ContractBoiChangeNode Node)
 {
     if (Node.ChangeDetailEx == null)
     {
         Node.ChangeDetailEx = HDAutoMapper.DynamicMap <ContractBoqChangeDetailEx>(Node);
         ChangeDetailExList.Add(Node.ChangeDetailEx);
     }
     Node.ChangeDetailEx.AfAmount   = Node.CtrctAmount;
     Node.ChangeDetailEx.AfPrice    = Node.CtrctPrjPrice;
     Node.ChangeDetailEx.AfQty      = Node.CtrctQty;
     Node.ChangeDetailEx.ItemCode   = Node.ItemCode;
     Node.ChangeDetailEx.IItemCoe   = Node.IItemCoe;
     Node.ChangeDetailEx.ItemName   = Node.ItemName;
     Node.ChangeDetailEx.ParentCode = Node.ParentCode;
     Node.ChangeDetailEx.ItemNo     = Node.ItemNo;
     Node.ChangeDetailEx.Uom        = Node.Uom;
     if (Node.OriginalBoi != null)
     {
         Node.ChangeDetailEx.BefAmount    = Node.OriginalBoi.CtrctAmount;
         Node.ChangeDetailEx.BefPrjPrice  = Node.OriginalBoi.CtrctPrjPrice;
         Node.ChangeDetailEx.BefQty       = Node.OriginalBoi.CtrctQty;
         Node.ChangeDetailEx.ChangeQty    = Node.CtrctQty - Node.OriginalBoi.CtrctQty;
         Node.ChangeDetailEx.ChangePrice  = Node.CtrctPrjPrice - Node.OriginalBoi.CtrctPrjPrice;
         Node.ChangeDetailEx.ChangeAmount = Node.CtrctAmount - Node.OriginalBoi.CtrctAmount;
         if (Node.StatId != Node.OriginalBoi.StatId)
         {
             Node.ChangeDetailEx.ChangeType = Node.StatId == 1 ? ChangeType.Enable : ChangeType.Disable;
             if (Node.StatId == 0)
             {
                 Node.ChangeDetailEx.BefAmount    = Node.OriginalBoi.CtrctAmount;
                 Node.ChangeDetailEx.BefPrjPrice  = Node.OriginalBoi.CtrctPrjPrice;
                 Node.ChangeDetailEx.BefQty       = Node.OriginalBoi.CtrctQty;
                 Node.ChangeDetailEx.AfAmount     = 0;
                 Node.ChangeDetailEx.AfPrice      = 0;
                 Node.ChangeDetailEx.AfQty        = 0;
                 Node.ChangeDetailEx.ChangeQty    = 0 - Node.OriginalBoi.CtrctQty;
                 Node.ChangeDetailEx.ChangePrice  = 0 - Node.OriginalBoi.CtrctPrjPrice;
                 Node.ChangeDetailEx.ChangeAmount = 0 - Node.OriginalBoi.CtrctAmount;
             }
             else
             {
                 Node.ChangeDetailEx.BefAmount    = 0;
                 Node.ChangeDetailEx.BefPrjPrice  = 0;
                 Node.ChangeDetailEx.BefQty       = 0;
                 Node.ChangeDetailEx.AfAmount     = Node.OriginalBoi.CtrctAmount;
                 Node.ChangeDetailEx.AfPrice      = Node.OriginalBoi.CtrctPrjPrice;
                 Node.ChangeDetailEx.AfQty        = Node.OriginalBoi.CtrctQty;
                 Node.ChangeDetailEx.ChangeQty    = Node.OriginalBoi.CtrctQty;
                 Node.ChangeDetailEx.ChangePrice  = Node.OriginalBoi.CtrctPrjPrice;
                 Node.ChangeDetailEx.ChangeAmount = Node.OriginalBoi.CtrctAmount;
             }
         }
         else
         {
             Node.ChangeDetailEx.ChangeType = ChangeType.Update;
             Node.ChangeDetailEx.IsUpQty    = HasQtyChanged(Node);
             Node.ChangeDetailEx.IsUpPrice  = HasPriceChanged(Node);
             Node.ChangeDetailEx.IsUpInfo   = HasInfoChanged(Node);
         }
     }
     else
     {
         Node.ChangeDetailEx.BefAmount    = 0;
         Node.ChangeDetailEx.BefPrjPrice  = 0;
         Node.ChangeDetailEx.BefQty       = 0;
         Node.ChangeDetailEx.ChangeQty    = Node.CtrctQty;
         Node.ChangeDetailEx.ChangePrice  = Node.CtrctPrjPrice;
         Node.ChangeDetailEx.ChangeAmount = Node.CtrctAmount;
         Node.ChangeDetailEx.ChangeType   = ChangeType.Add;
     }
 }