示例#1
0
        public override ComplaintDecision CreateNew()
        {
            ComplaintDocumentLine parent = (ComplaintDocumentLine)this.Parent;

            //create new object and attach it to the element
            ComplaintDecision line = new ComplaintDecision(parent);

            line.Order = this.Children.Count + 1;

            //add object to the collection
            this.Children.Add(line);

            return(line);
        }
示例#2
0
        private void RealizeDecisions(ComplaintDocument document)
        {
            var decisionsToRealize = from line in document.Lines.Children
                                     from decision in line.ComplaintDecisions.Children
                                     where decision.IsMarkedForRealization()
                                     select decision;

            this.CheckForNecessaryShifts(document, decisionsToRealize);

            List <WarehouseDocument> generatedWhDocs   = new List <WarehouseDocument>();
            List <ComplaintDecision> realizedDecisions = new List <ComplaintDecision>();

            foreach (var decision in decisionsToRealize)
            {
                if (decision.DecisionType == DecisionType.Disposal)
                {
                    this.AddPositionToWarehouseDocument(document, decision.WarehouseId.Value, generatedWhDocs, decision.ReplacementItemId,
                                                        decision.Quantity, decision.ReplacementUnitId, WarehouseDirection.Outcome);
                }
                else if (decision.DecisionType == DecisionType.ReturnToSupplier)
                {
                    this.AddPositionToWarehouseDocument(document, decision.WarehouseId.Value, generatedWhDocs, decision.ReplacementItemId,
                                                        decision.Quantity, decision.ReplacementUnitId, WarehouseDirection.Outcome);

                    ComplaintDocumentLine line = (ComplaintDocumentLine)decision.Parent;

                    this.AddPositionToWarehouseDocument(document, ProcessManager.Instance.GetComplaintWarehouse(document), generatedWhDocs, line.ItemId,
                                                        decision.Quantity, line.UnitId, WarehouseDirection.Income);
                }

                realizedDecisions.Add(decision);
            }

            foreach (var decision in realizedDecisions)
            {
                decision.RealizeOption = RealizationStage.Realized;
            }

            this.ValuateInternalIncomes(generatedWhDocs);
        }
示例#3
0
 public ComplaintDecisions(ComplaintDocumentLine parent)
     : base(parent, "complaintDecision")
 {
 }