public override void Validate() { base.Validate(); if (this.Quantity <= 0) { throw new ClientException(ClientExceptionId.ZeroQuantityOnShift); } bool isRelatedToOutcome = false; if (this.Parent != null && this.Parent.Parent != null && this.Parent.Parent.BOType == BusinessObjectType.WarehouseDocument) { WarehouseDocument whDoc = (WarehouseDocument)this.Parent.Parent; if (whDoc.WarehouseDirection == WarehouseDirection.Outcome || whDoc.WarehouseDirection == WarehouseDirection.OutcomeShift) { isRelatedToOutcome = true; } } if (!isRelatedToOutcome && this.ContainerId == null) { throw new ClientException(ClientExceptionId.NoContainerIdOnShift); } if (this.Attributes != null) { this.Attributes.Validate(); } }
public void ExecuteDocumentOptions(WarehouseDocument document) { foreach (IDocumentOption option in document.DocumentOptions) { option.Execute(document); } }
private void GenerateLines(WarehouseDocument sourceDocument, WarehouseDocument destinationDocument) { //look for new and modified lines List <DeliveryRequest> deliveryRequests = new List <DeliveryRequest>(); //collection of lines that are new, modified or deleted and require further processing. List <WarehouseDocumentLine> linesToProcess = new List <WarehouseDocumentLine>(); foreach (WarehouseDocumentLine line in sourceDocument.Lines.Children) { DeliveryRequest delivery = deliveryRequests.Where(d => d.ItemId == line.ItemId && d.WarehouseId == line.WarehouseId).FirstOrDefault(); if (delivery == null) { deliveryRequests.Add(new DeliveryRequest(line.ItemId, line.WarehouseId, line.UnitId)); } linesToProcess.Add(line); } ICollection <DeliveryResponse> deliveryResponses = this.mapper.GetDeliveries(deliveryRequests); IOutcomeStrategy strategy = OutcomeStrategyManager.Instance.GetOutcomeStrategy(sourceDocument.WarehouseId); strategy.CreateLinesForOutcomeShiftDocument(linesToProcess, deliveryResponses, destinationDocument); }
protected void CorrectDocumentConsistency(WarehouseDocument document) { DateTime documentIssueDate = document.IssueDate; //FIX by ambro if (document.IsNew) { DateTime currentIssueDate = SessionManager.VolatileElements.CurrentDateTime; document.IssueDate = currentIssueDate; documentIssueDate = currentIssueDate; } //FIX by ambro Guid warehouseId = document.WarehouseId; foreach (WarehouseDocumentLine line in document.Lines.Children) { line.OutcomeDate = documentIssueDate; line.WarehouseId = warehouseId; } if (document.ShiftTransaction != null) { foreach (Shift shift in document.ShiftTransaction.Shifts.Children) { shift.WarehouseId = warehouseId; } } this.DeliverySelectionCheck(document); }
public static void CreateOutcomeShiftFromWarehouseDocument(XElement source, WarehouseDocument destination) { /* * <root> * <warehouseDocumentId>GUID</warehouseDocumentId> * </root> */ DocumentMapper mapper = DependencyContainerManager.Container.Get <DocumentMapper>(); WarehouseDocument incomeDocument = (WarehouseDocument)mapper.LoadBusinessObject(BusinessObjectType.WarehouseDocument, new Guid(source.Element("warehouseDocumentId").Value)); destination.WarehouseId = incomeDocument.WarehouseId; //create lines foreach (var incLine in incomeDocument.Lines) { WarehouseDocumentLine line = destination.Lines.CreateNew(); line.ItemId = incLine.ItemId; line.ItemName = incLine.ItemName; line.Quantity = incLine.Quantity; line.UnitId = incLine.UnitId; line.ItemTypeId = incLine.ItemTypeId; } //Duplicate attributes DuplicableAttributeFactory.DuplicateAttributes(incomeDocument, destination); }
/// <summary> /// Validations the document during transaction. /// </summary> /// <param name="document">The document to validate.</param> private void ValidationDuringTransaction(WarehouseDocument document) { if (!document.IsNew) { if (this.mapper.HasOutcomeDocumentAnyCommercialRelation(document.Id.Value) && (document.Lines.IsAnyChildNew() || document.Lines.IsAnyChildModified() || document.Lines.IsAnyChildDeleted())) { throw new ClientException(ClientExceptionId.UnableToEditOutcomeWarehouseDocument2); } ICollection <Guid> allCorrections = mapper.GetWarehouseCorrectiveDocumentsId(document.Id.Value); if (allCorrections != null && allCorrections.Count != 0 && !document.CorrectedDocumentEditEnabled) { throw new ClientException(ClientExceptionId.UnableToEditDocumentBecauseOfCorrections); } } this.ValidateShiftsToLinesRelations(document); if (document.IsNew && document.Source != null && document.Source.Attribute("type") != null && document.Source.Attribute("type").Value == "multipleReservations") { string[] versions = document.Tag.Split(new char[] { ',' }); foreach (string version in versions) { this.mapper.CheckCommercialDocumentVersion(new Guid(version)); } } }
private void ProcessLocalOutcomeShift(WarehouseDocument document) { if (document.Status != BusinessObjectStatus.New && document.Status != BusinessObjectStatus.Modified && !document.Attributes.IsAnyChildNew() && !document.Attributes.IsAnyChildModified()) { return; } if (document.IsLocalShift()) //mamy MMke lokalna { XElement outcomeShiftDbXml = this.mapper.LoadWarehouseDocumentDbXml(document.Id.Value); //zeby xml byl zgodny z takim jaki uzywa komunikacja (bo ja bedziemy "emulowac") to musimy na wycenach poustawiac //ordinal number pozycji ktorych dotycza foreach (XElement valuation in outcomeShiftDbXml.Element("warehouseDocumentValuation").Elements()) { string outcomeWarehouseDocumentLineId = valuation.Element("outcomeWarehouseDocumentLineId").Value; string ordinalNumber = outcomeShiftDbXml.Element("warehouseDocumentLine").Elements().Where(l => l.Element("id").Value == outcomeWarehouseDocumentLineId).First().Element("ordinalNumber").Value; valuation.Add(new XAttribute("outcomeShiftOrdinalNumber", ordinalNumber)); } outcomeShiftDbXml.Element("warehouseDocumentValuation").Add(new XAttribute("outcomeShiftId", document.Id.ToUpperString())); using (DocumentCoordinator c = new DocumentCoordinator(false, false)) { c.CreateOrUpdateIncomeShiftDocumentFromOutcomeShift(outcomeShiftDbXml); c.ValuateIncomeShiftDocument(outcomeShiftDbXml); } } }
public override async Task <ExtPostContainer <string> > SaveInput(WarehouseDocumentInput input) { var id = !string.IsNullOrWhiteSpace(input.Id) ? input.Id : Guid.NewGuid().ToString("N"); await Validate(input); var warehouseDocument = new WarehouseDocument { Id = id, IdWarehouse = input.IdWarehouse, DocumentType = input.DocumentType, EmissionDate = input.EmissionDate, PaymentType = input.PaymentType, DocumentState = input.DocumentState, Output = input.Output, ProductDocuments = input.ProductDocuments == null || !input.ProductDocuments.Any() ? new List <ProductDocument>() : input.ProductDocuments.Select(PD_Input => new ProductDocument { IdProduct = PD_Input.IdProduct, Quantity = PD_Input.Quantity, Price = PD_Input.Price }).ToList(), Destiny = input.Destiny, Source = input.Source }; await SaveDb(warehouseDocument); return(await SaveSearch(warehouseDocument)); }
private void ProcessShiftOrder(WarehouseDocument document) { var attr = document.Attributes[DocumentFieldName.Attribute_IncomeShiftOrderId]; if (attr != null && document.IsNew) { CommercialDocument shiftOrder = (CommercialDocument)this.mapper.LoadBusinessObject(BusinessObjectType.CommercialDocument, new Guid(attr.Value.Value)); foreach (var whLine in document.Lines) { decimal quantityToGo = whLine.Quantity; foreach (var comLine in shiftOrder.Lines) { if (quantityToGo == 0) { break; } if (whLine.ItemId == comLine.ItemId) { decimal unrealizedQty = comLine.Quantity - comLine.CommercialWarehouseRelations.Sum(r => r.Quantity); if (unrealizedQty > quantityToGo) { var relation = whLine.CommercialWarehouseRelations.CreateNew(); relation.RelatedLine = comLine; relation.IsOrderRelation = true; relation.Quantity = quantityToGo; relation = comLine.CommercialWarehouseRelations.CreateNew(); relation.RelatedLine = whLine; relation.IsOrderRelation = true; relation.Quantity = quantityToGo; relation.DontSave = true; quantityToGo = 0; } else if (unrealizedQty > 0) //unrealizedQty <= quantityToGo { var relation = whLine.CommercialWarehouseRelations.CreateNew(); relation.RelatedLine = comLine; relation.IsOrderRelation = true; relation.Quantity = unrealizedQty; relation = comLine.CommercialWarehouseRelations.CreateNew(); relation.RelatedLine = whLine; relation.IsOrderRelation = true; relation.Quantity = unrealizedQty; relation.DontSave = true; quantityToGo -= unrealizedQty; } } } } } }
protected void SaveDocumentHeaderAndAttributes(WarehouseDocument document) { DocumentLogicHelper.AssignNumber(document, mapper); XDocument operations = XDocument.Parse("<root/>"); document.SaveChanges(operations); operations.Root.Elements().Where(e => e.Name.LocalName != "warehouseDocumentHeader" && e.Name.LocalName != "documentAttrValue").Remove(); this.mapper.ExecuteOperations(operations); }
private void ResetWarehouseDocumentLinesFlags(WarehouseDocument document) { foreach (WarehouseDocumentLine line in document.Lines.Children) { line.Direction = 0; line.CommercialWarehouseRelations.RemoveAll(); line.CommercialWarehouseValuations.RemoveAll(); } document.Relations.RemoveAll(); }
/// <summary> /// Generates the and update commercial warehouse valuations. /// </summary> /// <param name="document">The document that contains lines to generate and update valuations.</param> private void GenerateAndUpdateCommercialWarehouseValuations(WarehouseDocument document) { if (document.SkipManualValuations) { return; } this.ValuateFromOutcome(document); foreach (WarehouseDocumentLine line in document.Lines.Children) { int cwvCount = line.CommercialWarehouseValuations.Children.Count; bool beforeSystemStartCorrectionLine = line.Direction < 0 && line.Quantity < 0; if (line.Value == 0) { continue; //line.CommercialWarehouseValuations.RemoveAll(); //document.Value = 0; } else if (line.Value != 0 && cwvCount >= 0 && cwvCount <= 1) //create new valuation or remove and create (update) { if (cwvCount == 1) { line.CommercialWarehouseValuations.RemoveAll(); } CommercialWarehouseValuation valuation = line.CommercialWarehouseValuations.CreateNew(); valuation.Quantity = line.Quantity; valuation.Price = line.Price; valuation.Value = line.Value; //Jeśli mamy do czynienia z korektą sprzed startu systemu wiąże wycenę z pozycją korekty sprzedażowej //na podstawie commercialWarehouseRelation, która jest prawidłowo powiązana //potrzebne to aby koszt na takiej fakturze był widoczny w zestawieniu if (beforeSystemStartCorrectionLine) { CommercialWarehouseRelation cwr = line.CommercialWarehouseRelations.FirstOrDefault(); if (cwr != null && cwr.RelatedLine != null) { valuation.RelatedLine = cwr.RelatedLine; cwr.Value = valuation.Price; cwr.IsValuated = true; } } } else { throw new InvalidOperationException("Critical and fatal exception: too many commercial warehouse valuations to update 'mon!"); } } }
internal UpdateLastPurchasePriceRequest(WarehouseDocument warehouseDocument) { //for each unique pair itemId and warehouse Id finds last record and sets its netPrice as lastPurchaseNetPrice this.requestItems = warehouseDocument.Lines.GroupBy(line => new { line.WarehouseId, line.ItemId }). Select(group => new RequestItem() { ItemId = group.Key.ItemId, WarehouseId = group.Key.WarehouseId, UnitId = group.Last().UnitId, LastPurchaseNetPrice = group.Last().Price }).ToArray(); this.issueDate = (warehouseDocument.InitialCorrectedDocument ?? warehouseDocument).IssueDate; }
public static void CheckIfSalesOrderHasWarehouseDocumentsWithInvoices(CommercialDocument salesOrder, bool closeOrder) { //sprawdzamy czy ZSP ma WZ ktory ma fakture foreach (var relation in salesOrder.Relations.Where(r => r.RelationType == DocumentRelationType.SalesOrderToWarehouseDocument)) { WarehouseDocument whDoc = null; if (relation.RelatedDocument.Version != null) { whDoc = (WarehouseDocument)relation.RelatedDocument; } else { whDoc = (WarehouseDocument)DependencyContainerManager.Container.Get <DocumentMapper>().LoadBusinessObject(BusinessObjectType.WarehouseDocument, relation.RelatedDocument.Id.Value); relation.RelatedDocument = whDoc; } if (whDoc.Relations.Where(rr => rr.RelationType == DocumentRelationType.SalesOrderToWarehouseDocument).Count() > 1) { if (closeOrder) { throw new ClientException(ClientExceptionId.UnableToCreateSettlementDocument2); } else { throw new ClientException(ClientExceptionId.UnableToCreatePrepaymentDocument2); } } foreach (var line in whDoc.Lines) { if (line.CommercialWarehouseRelations.Where(l => l.IsCommercialRelation).FirstOrDefault() != null) { if (closeOrder) { throw new ClientException(ClientExceptionId.UnableToCreateSettlementDocument); } else { throw new ClientException(ClientExceptionId.UnableToCreatePrepaymentDocument); } } } } }
protected void DeliverySelectionCheck(WarehouseDocument document) { Guid warehouseId = document.WarehouseId; bool isDeliverySelection = DictionaryMapper.Instance.GetWarehouse(warehouseId).ValuationMethod == ValuationMethod.DeliverySelection; if (!isDeliverySelection && document.ShiftTransaction != null) { throw new ClientException(ClientExceptionId.DeliveriesInNonDeliverySelectedWarehouseError); } foreach (WarehouseDocumentLine line in document.Lines.Children) { if (!isDeliverySelection && line.IsNew && line.IncomeOutcomeRelations.Children.Count != 0) { throw new ClientException(ClientExceptionId.DeliveriesInNonDeliverySelectedWarehouseError); } } }
private static void AddShiftPosition(ServiceDocument serviceDocument, Guid sourceWarehouseId, Guid destinationWarehouseId, List <WarehouseDocument> shiftDocumentsList, Guid itemId, decimal quantity, Guid unitId) { WarehouseDocument shift = (from doc in shiftDocumentsList where doc.WarehouseId == sourceWarehouseId && doc.Attributes.Children.Where(a => a.DocumentFieldName == DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId) .First().Value.Value.ToUpperInvariant() == destinationWarehouseId.ToUpperString() select doc).FirstOrDefault(); if (shift == null) //tworzymy takiego szifta { using (DocumentCoordinator c = new DocumentCoordinator(false, false)) { string processType = serviceDocument.Attributes[DocumentFieldName.Attribute_ProcessType].Value.Value; string template = ProcessManager.Instance.GetDocumentTemplate(serviceDocument, "outcomeShift"); shift = (WarehouseDocument)c.CreateNewBusinessObject(BusinessObjectType.WarehouseDocument, template, null); ProcessManager.Instance.AppendProcessAttributes(shift, processType, "outcomeShift", serviceDocument.Id, DocumentRelationType.ServiceToOutcomeShift); DuplicableAttributeFactory.DuplicateAttributes(serviceDocument, shift); serviceDocument.AddRelatedObject(shift); shiftDocumentsList.Add(shift); shift.WarehouseId = sourceWarehouseId; var dstWarehouseId = shift.Attributes[DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId]; if (dstWarehouseId == null) { dstWarehouseId = shift.Attributes.CreateNew(); dstWarehouseId.DocumentFieldName = DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId; } dstWarehouseId.Value.Value = destinationWarehouseId.ToUpperString(); } } //sprawdzamy czy moze juz jest pozycja na ten sam towar. jak jest to edytujemy quantity, jak nie to tworzymy nowa WarehouseDocumentLine line = shift.Lines.Children.Where(l => l.ItemId == itemId).FirstOrDefault(); if (line == null) { line = shift.Lines.CreateNew(); line.ItemId = itemId; line.UnitId = unitId; } line.Quantity += quantity; }
private static WarehouseDocument GetDocumentFromList(Guid warehouseId, string template, List <WarehouseDocument> list) { WarehouseDocument doc = list.Where(d => d.WarehouseId == warehouseId).FirstOrDefault(); if (doc != null) { return(doc); } else { using (DocumentCoordinator c = new DocumentCoordinator(false, false)) { doc = (WarehouseDocument)c.CreateNewBusinessObject(BusinessObjectType.WarehouseDocument, template, null); } doc.WarehouseId = warehouseId; list.Add(doc); return(doc); } }
/// <summary> /// Corrects the document consistency that comes from client and can be incomplete. /// </summary> /// <param name="document">The document to correct.</param> private void CorrectDocumentConsistency(WarehouseDocument document) { DateTime documentIssueDate = document.IssueDate; if (!document.IsNew) { //if its editing process so we can change the issue date to the current date if //there is any new position DateTime currentIssueDate = SessionManager.VolatileElements.CurrentDateTime; if ((documentIssueDate.Year != currentIssueDate.Year || documentIssueDate.Month != currentIssueDate.Month || documentIssueDate.Day != currentIssueDate.Day) && document.Lines.IsAnyChildNew()) { document.IssueDate = currentIssueDate; documentIssueDate = document.IssueDate; } } //FIX by ambro else { DateTime currentIssueDate = SessionManager.VolatileElements.CurrentDateTime; document.IssueDate = SessionManager.VolatileElements.CurrentDateTime; documentIssueDate = document.IssueDate; } //FIX by ambro Guid warehouseId = document.WarehouseId; foreach (WarehouseDocumentLine line in document.Lines.Children) { line.IncomeDate = documentIssueDate; line.WarehouseId = warehouseId; } this.DeliverySelectionCheck(document); this.GenerateAndUpdateCommercialWarehouseValuations(document); }
private void ProcessLocalIncomeShift(WarehouseDocument document) { if (document.Status != BusinessObjectStatus.New && document.Status != BusinessObjectStatus.Modified) { return; } if (document.IsLocalShift()) //mamy MMke lokalna { Guid outcomeShiftId = new Guid(document.Attributes.Children.Where(aa => aa.DocumentFieldName == DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentId).First().Value.Value); using (DocumentCoordinator c = new DocumentCoordinator(false, false)) { WarehouseDocument outcomeShift = (WarehouseDocument)c.LoadBusinessObject(BusinessObjectType.WarehouseDocument, outcomeShiftId); var oppositeDocAttr = outcomeShift.Attributes.Children.Where(o => o.DocumentFieldName == DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentId).FirstOrDefault(); if (oppositeDocAttr == null) { oppositeDocAttr = outcomeShift.Attributes.CreateNew(); oppositeDocAttr.DocumentFieldName = DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentId; oppositeDocAttr.Value.Value = document.Id.ToUpperString(); } var oppositeStatusAttr = outcomeShift.Attributes.Children.Where(s => s.DocumentFieldName == DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentStatus).FirstOrDefault(); if (oppositeStatusAttr == null) { oppositeStatusAttr = outcomeShift.Attributes.CreateNew(); oppositeStatusAttr.DocumentFieldName = DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentStatus; } oppositeStatusAttr.Value.Value = ((int)document.DocumentStatus).ToString(CultureInfo.InvariantCulture); c.SaveBusinessObject(outcomeShift); } } }
private void ValuateFromOutcome(WarehouseDocument document) { if (document.ValuateFromOutcomeDocumentId != null) { WarehouseDocument outcome = (WarehouseDocument)this.mapper.LoadBusinessObject(BusinessObjectType.WarehouseDocument, document.ValuateFromOutcomeDocumentId.Value); decimal totalValue = 0; foreach (var incLine in document.Lines) { if (incLine.ValuateFromOutcomeDocumentLinesId == null) { continue; } decimal value = outcome.Lines.Where(l => incLine.ValuateFromOutcomeDocumentLinesId.Contains(l.Id.Value)).Sum(ll => ll.Value); totalValue += value; incLine.Value = value; incLine.Price = Decimal.Round(value / incLine.Quantity, 2, MidpointRounding.AwayFromZero); } document.Value = totalValue; } }
private static void UpdateDocumentStatus(XDocument commPkg) { using (DocumentCoordinator cord = new DocumentCoordinator(false, false)) { Guid documentId = new Guid(commPkg.Root.Element("shiftDocumentStatus").Attribute("outcomeShiftId").Value); WarehouseDocument outcomeShiftDocument = (WarehouseDocument)cord.LoadBusinessObject(Makolab.Fractus.Kernel.Enums.BusinessObjectType.WarehouseDocument, documentId); DocumentAttrValue oppositeDocStatus = outcomeShiftDocument.Attributes.Children.Where(attr => attr.DocumentFieldName == Makolab.Fractus.Kernel.Enums.DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentStatus).SingleOrDefault(); if (oppositeDocStatus == null) { oppositeDocStatus = outcomeShiftDocument.Attributes.CreateNew(); oppositeDocStatus.DocumentFieldName = Makolab.Fractus.Kernel.Enums.DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentStatus; } DocumentAttrValue oppositeDocId = outcomeShiftDocument.Attributes.Children.Where(attr => attr.DocumentFieldName == Makolab.Fractus.Kernel.Enums.DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentId).SingleOrDefault(); if (oppositeDocId == null) { oppositeDocId = outcomeShiftDocument.Attributes.CreateNew(); oppositeDocId.DocumentFieldName = Makolab.Fractus.Kernel.Enums.DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentId; oppositeDocId.Value.Value = commPkg.Root.Element("shiftDocumentStatus").Attribute("incomeShiftId").Value; } oppositeDocStatus.Value.Value = commPkg.Root.Element("shiftDocumentStatus").Attribute("status").Value; cord.SaveBusinessObject(outcomeShiftDocument); } }
/// <summary> /// Validations the document during transaction. /// </summary> /// <param name="document">The document to validate.</param> private void ValidationDuringTransaction(WarehouseDocument document) { if (!document.IsNew) { if (this.mapper.HasIncomeWarehouseDocumentAnyOutcomeRelation(document.Id.Value)) { //sprawdzamy czy jakies linie byly dodane nowe a jak byly to czy zmiana byla od wartosci zero do wiekszej od zera foreach (WarehouseDocumentLine line in document.Lines.Children) { if (line.Status == BusinessObjectStatus.Modified) { WarehouseDocumentLine alternateLine = (WarehouseDocumentLine)line.AlternateVersion; if (alternateLine.Value != 0 || alternateLine.ItemId != line.ItemId || alternateLine.Quantity != line.Quantity || alternateLine.Direction != line.Direction) { throw new ClientException(ClientExceptionId.UnableToEditIncomeWarehouseDocument); } } } if ((document.Lines.IsAnyChildNew() || document.Lines.IsAnyChildDeleted())) { throw new ClientException(ClientExceptionId.UnableToEditIncomeWarehouseDocument); } } ICollection <Guid> allCorrections = mapper.GetWarehouseCorrectiveDocumentsId(document.Id.Value); if (allCorrections != null && allCorrections.Count != 0) { throw new ClientException(ClientExceptionId.UnableToEditDocumentBecauseOfCorrections); } } }
public static void CreateCorrectiveDocument(XElement source, WarehouseDocument destination) { Guid sourceDocumentId = new Guid(source.Element("correctedDocumentId").Value); DocumentMapper mapper = DependencyContainerManager.Container.Get <DocumentMapper>(); WarehouseDocument sourceDocument = (WarehouseDocument)mapper.LoadBusinessObject(BusinessObjectType.WarehouseDocument, sourceDocumentId); WarehouseDirection direction = sourceDocument.WarehouseDirection; if (ConfigurationMapper.Instance.PreventDocumentCorrectionBeforeSystemStart && sourceDocument.IsBeforeSystemStart) { throw new ClientException(ClientExceptionId.DocumentCorrectionBeforeSystemStartError); } destination.Contractor = sourceDocument.Contractor; destination.WarehouseId = sourceDocument.WarehouseId; DuplicableAttributeFactory.DuplicateAttributes(sourceDocument, destination); foreach (WarehouseDocumentLine line in sourceDocument.Lines.Children) { WarehouseDocumentLine correctedLine = mapper.GetWarehouseDocumentLineAfterCorrection(line, direction); if (correctedLine != null) { destination.Lines.AppendChild(correctedLine); } } if (destination.Lines.Children.Count == 0) { throw new ClientException(ClientExceptionId.FullyCorrectedCorrectionError); } destination.InitialCorrectedDocument = sourceDocument; }
protected void MakeDifferentialDocument(WarehouseDocument document) { WarehouseDocument whDoc = (WarehouseDocument)this.coordinator.CreateNewBusinessObject(BusinessObjectType.WarehouseDocument, document.Source.Attribute("template").Value, new XElement(document.Source)); document.SetAlternateVersion(whDoc); document.UpdateStatus(true); List <WarehouseDocumentLine> linesToDelete = new List <WarehouseDocumentLine>(); foreach (WarehouseDocumentLine line in document.Lines.Children) { if (line.Status != BusinessObjectStatus.Modified) { linesToDelete.Add(line); } else { //sprawdzamy czy nie jest to korekta na plus if (line.Quantity > ((WarehouseDocumentLine)line.AlternateVersion).Quantity) { throw new ClientException(ClientExceptionId.QuantityOnCorrectionAboveZero); } } } foreach (WarehouseDocumentLine line in linesToDelete) { document.Lines.Children.Remove(line); } if (whDoc.InitialCorrectedDocument != null) { document.InitialCorrectedDocument = whDoc.InitialCorrectedDocument; } }
/// <summary> /// Creates the outcomes for the specifies lines using specified deliveries. /// </summary> /// <param name="lines">The lines for which to create the outcomes. They have to be from the same warehouse.</param> /// <param name="deliveryResponses">Collection of delivery responses. Can contain deliveries from other warehouses too.</param> public void CreateOutcomes(ICollection <WarehouseDocumentLine> lines, ICollection <DeliveryResponse> deliveryResponses) { foreach (WarehouseDocumentLine line in lines) { WarehouseDocument warehouseDocument = line.Parent as WarehouseDocument; var deliveryResponse = (from del in deliveryResponses where del.ItemId == line.ItemId && del.WarehouseId == line.WarehouseId select del).FirstOrDefault(); var validDeliveries = deliveryResponse.Deliveries.Where(d => this.IsValidDelivery(d.IssueDate, warehouseDocument.IssueDate)); decimal originalAvailableQuantity = deliveryResponse.AvailableQuantity; //tutaj zliczam wszystkie nowe na wypadek edycji bo wtedy powinny zostac wszystkie relacje usuniete i na nowo utworzone decimal lineDeliveriesSelected = line.IncomeOutcomeRelations.Children.Where(rr => rr.IsNew).Sum(r => r.Quantity); if (lineDeliveriesSelected != Math.Abs(line.Quantity)) { if (warehouseDocument.IsBeforeSystemStartOutcomeCorrection) { throw new ClientException(ClientExceptionId.NotEnoughQuantityContainerSlot); } else { throw new ClientException(ClientExceptionId.NotEnoughDeliveriesSelected, null, "itemName:" + line.ItemName ?? line.ItemId.ToString()); } } foreach (IncomeOutcomeRelation relation in line.IncomeOutcomeRelations.Children.Where(c => c.IsNew)) { //odszukujemy dostawe var del = validDeliveries.Where(d => d.IncomeWarehouseDocumentLineId == relation.RelatedLine.Id.Value).FirstOrDefault(); if (del == null || del.Quantity == 0 || del.Quantity < relation.Quantity) { string itemName = DependencyContainerManager.Container.Get <ItemMapper>().GetItemName(line.ItemId); throw new ClientException(ClientExceptionId.NoItemInStock, null, "itemName:" + itemName, "warehouseName:" + this.warehouseName); } //ustawiamy income date na relacji relation.IncomeDate = del.IncomeDate; relation.Status = BusinessObjectStatus.New; line.IncomeDate = del.IncomeDate; deliveryResponse.AvailableQuantity -= relation.Quantity; del.Quantity -= relation.Quantity; } //dla wz-tow realizujacych rezerwacje pomijamy ilosci zarezerwowane. bierzemy pod uwage tylko ilosc na stanie i koniec if ((!line.CommercialWarehouseRelations.Children.Any(r => r.IsOrderRelation) || warehouseDocument.SkipReservedQuantityCheck) && deliveryResponse.AvailableQuantity < 0) { WarehouseDocumentLine altLine = line.AlternateVersion as WarehouseDocumentLine; /* * tutaj ten if jest w celu obsluzenia takiego przypadku: * Mamy na magazynie 0 sztuk, a zarezerwowane 2 * Edytujemy dokument, ktory ma 3 szt. wiec zwalniamy powiazania i tworzymy je na nowo * W tej sytuacji bez tego if'a wyskoczy nam ze mozemy tylko 1 szt. zabrac, a mozemy w praktyce wziasc * wszystkie 3 bo te 3 zostaly przez naz zwolnione */ if (altLine == null || altLine.Quantity - originalAvailableQuantity < deliveryResponse.AvailableQuantity) { string itemName = DependencyContainerManager.Container.Get <ItemMapper>().GetItemName(line.ItemId); throw new ClientException(ClientExceptionId.NoItemInStock, null, "itemName:" + itemName, "warehouseName:" + this.warehouseName); } } } }
public void CreateLinesForOutcomeShiftDocument(ICollection <WarehouseDocumentLine> sourceLines, ICollection <DeliveryResponse> deliveryResponses, WarehouseDocument destinationDocument) { foreach (WarehouseDocumentLine line in sourceLines) { WarehouseDocument warehouseDocument = line.Parent as WarehouseDocument; var deliveryResponse = (from del in deliveryResponses where del.ItemId == line.ItemId && del.WarehouseId == line.WarehouseId select del).FirstOrDefault(); var validDeliveries = deliveryResponse.Deliveries.Where(d => this.IsValidDelivery(d.IssueDate, warehouseDocument.IssueDate)); decimal originalAvailableQuantity = deliveryResponse.AvailableQuantity; //tutaj zliczam wszystkie nowe na wypadek edycji bo wtedy powinny zostac wszystkie relacje usuniete i na nowo utworzone decimal lineDeliveriesSelected = line.IncomeOutcomeRelations.Children.Where(rr => rr.IsNew).Sum(r => r.Quantity); if (lineDeliveriesSelected != line.Quantity) { throw new ClientException(ClientExceptionId.NotEnoughDeliveriesSelected, null, "itemName:" + line.ItemName); } foreach (IncomeOutcomeRelation relation in line.IncomeOutcomeRelations.Children.Where(c => c.IsNew)) { //odszukujemy dostawe var del = validDeliveries.Where(d => d.IncomeWarehouseDocumentLineId == relation.RelatedLine.Id.Value).FirstOrDefault(); if (del == null || del.Quantity == 0 || del.Quantity < relation.Quantity) { string itemName = DependencyContainerManager.Container.Get <ItemMapper>().GetItemName(line.ItemId); throw new ClientException(ClientExceptionId.NoItemInStock, null, "itemName:" + itemName, "warehouseName:" + this.warehouseName); } WarehouseDocumentLine dstLine = destinationDocument.Lines.CreateNew(); dstLine.SourceOutcomeShiftLine = line; //ustawiamy income date na relacji dstLine.ItemId = line.ItemId; dstLine.OutcomeDate = destinationDocument.IssueDate; dstLine.Price = line.Price; dstLine.Quantity = relation.Quantity; dstLine.UnitId = line.UnitId; dstLine.WarehouseId = destinationDocument.WarehouseId; dstLine.IncomeDate = del.IncomeDate; IncomeOutcomeRelation rel = dstLine.IncomeOutcomeRelations.CreateNew(BusinessObjectStatus.New, WarehouseDirection.Outcome); if (relation.Quantity == del.Quantity) { rel.OutcomeDate = dstLine.OutcomeDate; } rel.IncomeDate = del.IncomeDate; rel.Quantity = relation.Quantity; rel.RelatedLine.Id = del.IncomeWarehouseDocumentLineId; deliveryResponse.AvailableQuantity -= relation.Quantity; del.Quantity -= relation.Quantity; } //dla wz-tow realizujacych rezerwacje pomijamy ilosci zarezerwowane. bierzemy pod uwage tylko ilosc na stanie i koniec if (!line.CommercialWarehouseRelations.Children.Any(r => r.IsOrderRelation) && deliveryResponse.AvailableQuantity < 0) { WarehouseDocumentLine altLine = line.AlternateVersion as WarehouseDocumentLine; /* * tutaj ten if jest w celu obsluzenia takiego przypadku: * Mamy na magazynie 0 sztuk, a zarezerwowane 2 * Edytujemy dokument, ktory ma 3 szt. wiec zwalniamy powiazania i tworzymy je na nowo * W tej sytuacji bez tego if'a wyskoczy nam ze mozemy tylko 1 szt. zabrac, a mozemy w praktyce wziasc * wszystkie 3 bo te 3 zostaly przez naz zwolnione */ if (altLine == null || altLine.Quantity - originalAvailableQuantity < deliveryResponse.AvailableQuantity) { string itemName = DependencyContainerManager.Container.Get <ItemMapper>().GetItemName(line.ItemId); throw new ClientException(ClientExceptionId.NoItemInStock, null, "itemName:" + itemName, "warehouseName:" + this.warehouseName); } } } //przepinamy shifty do nowo podzielonych linii if (destinationDocument.ShiftTransaction != null) { foreach (Shift shift in destinationDocument.ShiftTransaction.Shifts.Children) { var foundLine = destinationDocument.Lines.Children.Where(l => l.IncomeOutcomeRelations.Children.First().RelatedLine.Id.Value == shift.IncomeWarehouseDocumentLineId && shift.LineOrdinalNumber.Value == l.SourceOutcomeShiftLine.OrdinalNumber).FirstOrDefault(); shift.RelatedWarehouseDocumentLine = foundLine; } } }
public XDocument ProcessWarehouseCorrectiveDocument(WarehouseDocument document) { SqlConnectionManager.Instance.BeginTransaction(); try { DictionaryMapper.Instance.CheckForChanges(); this.MakeDifferentialDocument(document); document.AlternateVersion = null; this.coordinator.UpdateStock(document); WarehouseDocument targetDocument = (WarehouseDocument)this.coordinator.CreateNewBusinessObject(BusinessObjectType.WarehouseDocument, document.Source.Attribute("template").Value, null); targetDocument.Contractor = document.Contractor; targetDocument.WarehouseId = document.WarehouseId; DuplicableAttributeFactory.CopyAttributes(document, targetDocument); targetDocument.UpdateStatus(true); this.SaveDocumentHeaderAndAttributes(targetDocument); int ordinalNumber = 0; XDocument xml = null; XDocument operations = XDocument.Parse("<root><incomeOutcomeRelation/><commercialWarehouseRelation/><commercialWarehouseValuation/></root>"); foreach (WarehouseDocumentLine line in document.Lines.Children) { Guid?commercialCorrectiveLineId = null; if (line.CommercialCorrectiveLine != null) { commercialCorrectiveLineId = line.CommercialCorrectiveLine.Id; } xml = this.mapper.CreateOutcomeQuantityCorrection(line.Id.Value, line.Version.Value, targetDocument.Id.Value, line.Quantity, ordinalNumber, commercialCorrectiveLineId); ordinalNumber = Convert.ToInt32(xml.Root.Element("ordinalNumber").Value, CultureInfo.InvariantCulture); if (xml.Root.Element("incomeOutcomeRelation") != null) { operations.Root.Element("incomeOutcomeRelation").Add(xml.Root.Element("incomeOutcomeRelation").Elements()); } if (xml.Root.Element("commercialWarehouseRelation") != null) { operations.Root.Element("commercialWarehouseRelation").Add(xml.Root.Element("commercialWarehouseRelation").Elements()); } if (xml.Root.Element("commercialWarehouseValuation") != null) { operations.Root.Element("commercialWarehouseValuation").Add(xml.Root.Element("commercialWarehouseValuation").Elements()); } } this.mapper.ValuateOutcomeWarehouseDocument(targetDocument); this.mapper.CreateCommunicationXml(targetDocument); this.mapper.CreateCommunicationXmlForDocumentRelations(operations); XDocument returnXml = XDocument.Parse(String.Format(CultureInfo.InvariantCulture, "<root><id>{0}</id></root>", targetDocument.Id.ToUpperString())); //Custom validation this.mapper.ExecuteOnCommitValidationCustomProcedure(targetDocument); if (this.coordinator.CanCommitTransaction) { if (!ConfigurationMapper.Instance.ForceRollbackTransaction) { SqlConnectionManager.Instance.CommitTransaction(); } else { SqlConnectionManager.Instance.RollbackTransaction(); } } return(returnXml); } catch (SqlException sqle) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:57"); Coordinator.ProcessSqlException(sqle, document.BOType, this.coordinator.CanCommitTransaction); throw; } catch (Exception) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:58"); if (this.coordinator.CanCommitTransaction) { SqlConnectionManager.Instance.RollbackTransaction(); } throw; } }
public XDocument SaveBusinessObject(WarehouseDocument shiftDocument) { DictionaryMapper.Instance.CheckForChanges(); this.CorrectDocumentConsistency(shiftDocument); shiftDocument.Validate(); //WarehouseDocument document = (WarehouseDocument)this.coordinator.CreateNewBusinessObject(BusinessObjectType.WarehouseDocument, "outcomeShift", null); //document.Deserialize(shiftDocument.Serialize()); //zmienione bo shiftTransaction sie nie przenosilo WarehouseDocument document = (WarehouseDocument)mapper.ConvertToBusinessObject(shiftDocument.FullXml.Root.Element("warehouseDocument"), shiftDocument.FullXml.Root.Element("options")); if (document.IsNew) //jezeli to edycja to nie ruszamy linii { document.Lines.RemoveAll(); } SqlConnectionManager.Instance.BeginTransaction(); try { DictionaryMapper.Instance.CheckForChanges(); this.mapper.CheckBusinessObjectVersion(document); if (document.IsNew) //jezeli to edycja to nie ruszamy linii { this.GenerateLines(shiftDocument, document); } this.ExecuteDocumentOptions(document); document.Validate(); //load alternate version if (!document.IsNew) { IBusinessObject alternateBusinessObject = this.mapper.LoadBusinessObject(document.BOType, document.Id.Value); document.SetAlternateVersion(alternateBusinessObject); } DocumentLogicHelper.AssignNumber(document, this.mapper); document.UpdateStatus(true); if (document.AlternateVersion != null) { document.AlternateVersion.UpdateStatus(false); } this.coordinator.UpdateStock(document); this.ValidateShiftsToLinesRelations(document); if (document.DocumentStatus == DocumentStatus.Canceled && ConfigurationMapper.Instance.IsWmsEnabled) { DependencyContainerManager.Container.Get <WarehouseMapper>().DeleteShiftsForDocument(document.Id.Value); } XDocument operations = XDocument.Parse("<root/>"); document.SaveChanges(operations); if (document.AlternateVersion != null) { document.AlternateVersion.SaveChanges(operations); } document.SaveRelations(operations); if (document.AlternateVersion != null) { ((WarehouseDocument)document.AlternateVersion).SaveRelations(operations); } if (operations.Root.HasElements) { //this.mapper.UpdateStockForCanceledDocument(document); this.mapper.ExecuteOperations(operations); if (document.IsNew) { this.mapper.ValuateOutcomeWarehouseDocument(document); } this.mapper.CreateCommunicationXml(document); this.mapper.CreateCommunicationXmlForDocumentRelations(operations); this.mapper.UpdateDictionaryIndex(document); } //MM- może realizować rezerwację this.mapper.UpdateReservationAndOrderStock(document); WarehouseCoordinator.ProcessWarehouseManagamentSystem(document.ShiftTransaction); Coordinator.LogSaveBusinessObjectOperation(); this.ProcessLocalOutcomeShift(document); if (document.DraftId != null) { this.mapper.DeleteDraft(document.DraftId.Value); } XDocument returnXml = XDocument.Parse(String.Format(CultureInfo.InvariantCulture, "<root><id>{0}</id></root>", shiftDocument.Id.Value.ToUpperString())); //Custom validation this.mapper.ExecuteOnCommitValidationCustomProcedure(document); if (this.coordinator.CanCommitTransaction) { if (!ConfigurationMapper.Instance.ForceRollbackTransaction) { SqlConnectionManager.Instance.CommitTransaction(); } else { SqlConnectionManager.Instance.RollbackTransaction(); } } return(returnXml); } catch (SqlException sqle) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:78"); Coordinator.ProcessSqlException(sqle, document.BOType, this.coordinator.CanCommitTransaction); throw; } catch (Exception) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:79"); if (this.coordinator.CanCommitTransaction) { SqlConnectionManager.Instance.RollbackTransaction(); } throw; } }
/// <summary> /// Saves the business object. /// </summary> /// <param name="document"><see cref="WarehouseDocument"/> to save.</param> /// <returns>Xml containing result of oper</returns> public XDocument SaveBusinessObject(WarehouseDocument document) { DictionaryMapper.Instance.CheckForChanges(); //correct the document that comes from client this.CorrectDocumentConsistency(document); this.ExecuteDocumentOptions(document); //validate document.Validate(); //Walidacja zmian w dokumencie realizującym zamówienie sprzedażowe document.CheckDoesRealizeClosedSalesOrder(coordinator); //load alternate version if (!document.IsNew) { IBusinessObject alternateBusinessObject = this.mapper.LoadBusinessObject(document.BOType, document.Id.Value); document.SetAlternateVersion(alternateBusinessObject); } //update status document.UpdateStatus(true); if (document.AlternateVersion != null) { document.AlternateVersion.UpdateStatus(false); } SqlConnectionManager.Instance.BeginTransaction(); try { DictionaryMapper.Instance.CheckForChanges(); this.mapper.CheckBusinessObjectVersion(document); //logika dla automatycznego zamykania ZS w realizacji bezzaliczkowej this.coordinator.TryCloseSalesOrdersWhileRealization(document); this.coordinator.UpdateStock(document); this.ValidationDuringTransaction(document); if (document.DocumentStatus == DocumentStatus.Canceled && ConfigurationMapper.Instance.IsWmsEnabled) { DependencyContainerManager.Container.Get <WarehouseMapper>().DeleteShiftsForDocument(document.Id.Value); } if (!document.IsNew && document.DocumentStatus == DocumentStatus.Committed) { this.mapper.DeleteIncomeOutcomeRelations(document); } if (document.DocumentStatus == DocumentStatus.Committed) { this.ProcessIncomeOutcome(document); } DocumentLogicHelper.AssignNumber(document, this.mapper); //Make operations list XDocument operations = XDocument.Parse("<root/>"); document.SaveChanges(operations); if (document.AlternateVersion != null) { document.AlternateVersion.SaveChanges(operations); } if (operations.Root.HasElements) { // this.mapper.UpdateStockForCanceledDocument(document); this.mapper.ExecuteOperations(operations); this.mapper.ValuateOutcomeWarehouseDocument(document); this.mapper.CreateCommunicationXml(document); this.mapper.CreateCommunicationXmlForDocumentRelations(operations); this.mapper.UpdateDictionaryIndex(document); } Coordinator.LogSaveBusinessObjectOperation(); document.SaveRelatedObjects(); operations = XDocument.Parse("<root/>"); document.SaveRelations(operations); if (document.AlternateVersion != null) { ((WarehouseDocument)document.AlternateVersion).SaveRelations(operations); } if (operations.Root.HasElements) { this.mapper.ExecuteOperations(operations); this.mapper.CreateCommunicationXmlForDocumentRelations(operations); //generowanie paczek dla relacji dokumentow } this.mapper.DeleteDocumentAccountingData(document); this.mapper.UpdateReservationAndOrderStock(document); WarehouseCoordinator.ProcessWarehouseManagamentSystem(document.ShiftTransaction); //Custom validation this.mapper.ExecuteOnCommitValidationCustomProcedure(document); Coordinator.LogSaveBusinessObjectOperation(); if (document.DraftId != null) { this.mapper.DeleteDraft(document.DraftId.Value); } XDocument returnXml = XDocument.Parse(String.Format(CultureInfo.InvariantCulture, "<root><id>{0}</id></root>", document.Id.ToUpperString())); if (this.coordinator.CanCommitTransaction) { if (!ConfigurationMapper.Instance.ForceRollbackTransaction) { SqlConnectionManager.Instance.CommitTransaction(); } else { SqlConnectionManager.Instance.RollbackTransaction(); } } return(returnXml); } catch (SqlException sqle) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:80"); Coordinator.ProcessSqlException(sqle, document.BOType, this.coordinator.CanCommitTransaction); throw; } catch (Exception) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:81"); if (this.coordinator.CanCommitTransaction) { SqlConnectionManager.Instance.RollbackTransaction(); } throw; } }
public override XDocument SaveBusinessObject(WarehouseDocument document) { DictionaryMapper.Instance.CheckForChanges(); this.DeliverySelectionCheck(document); //validate document.Validate(); //load alternate version if (!document.IsNew) { IBusinessObject alternateBusinessObject = this.mapper.LoadBusinessObject(document.BOType, document.Id.Value); document.SetAlternateVersion(alternateBusinessObject); } this.ProcessShiftOrder(document); //update status document.UpdateStatus(true); if (document.AlternateVersion != null) { document.AlternateVersion.UpdateStatus(false); } SqlConnectionManager.Instance.BeginTransaction(); try { DictionaryMapper.Instance.CheckForChanges(); this.mapper.CheckBusinessObjectVersion(document); if (document.DocumentStatus == DocumentStatus.Canceled && ConfigurationMapper.Instance.IsWmsEnabled) { DependencyContainerManager.Container.Get <WarehouseMapper>().DeleteShiftsForDocument(document.Id.Value); } if (document.DocumentType.WarehouseDocumentOptions.UpdateLastPurchasePrice) { UpdateLastPurchasePriceRequest updateLastPurchasePriceRequest = new UpdateLastPurchasePriceRequest(document); this.mapper.UpdateStock(updateLastPurchasePriceRequest); } //Make operations list XDocument operations = XDocument.Parse("<root/>"); document.SaveChanges(operations); if (document.AlternateVersion != null) { document.AlternateVersion.SaveChanges(operations); } if (operations.Root.HasElements) { this.coordinator.UpdateStock(document); //this.mapper.UpdateStockForCanceledDocument(document); this.mapper.ExecuteOperations(operations); this.mapper.CreateCommunicationXml(document); this.mapper.CreateCommunicationXmlForDocumentRelations(operations); this.mapper.UpdateDictionaryIndex(document); } Coordinator.LogSaveBusinessObjectOperation(); document.SaveRelatedObjects(); operations = XDocument.Parse("<root/>"); document.SaveRelations(operations); if (document.AlternateVersion != null) { ((WarehouseDocument)document.AlternateVersion).SaveRelations(operations); } if (operations.Root.HasElements) { this.mapper.ExecuteOperations(operations); this.mapper.CreateCommunicationXmlForDocumentRelations(operations); //generowanie paczek dla relacji dokumentow } this.mapper.ValuateIncomeWarehouseDocument(document, false); this.ProcessLocalIncomeShift(document); XDocument returnXml = XDocument.Parse(String.Format(CultureInfo.InvariantCulture, "<root><id>{0}</id></root>", document.Id.ToUpperString())); //Custom validation this.mapper.ExecuteOnCommitValidationCustomProcedure(document); if (this.coordinator.CanCommitTransaction) { if (!ConfigurationMapper.Instance.ForceRollbackTransaction) { SqlConnectionManager.Instance.CommitTransaction(); } else { SqlConnectionManager.Instance.RollbackTransaction(); } } return(returnXml); } catch (SqlException sqle) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:69"); Coordinator.ProcessSqlException(sqle, document.BOType, this.coordinator.CanCommitTransaction); throw; } catch (Exception) { RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:70"); if (this.coordinator.CanCommitTransaction) { SqlConnectionManager.Instance.RollbackTransaction(); } throw; } }