internal static void TryRemoveCommercialDocumentToSalesOrderRelations(CommercialDocumentLine documentLine) { DocumentLineAttrValue rsoliAttr = documentLine.Attributes[DocumentFieldName.LineAttribute_RealizedSalesOrderLineId]; if (rsoliAttr != null) { documentLine.Attributes.Remove(rsoliAttr); } }
internal static string GetOption(CommercialDocumentLine line) { DocumentLineAttrValue sogdoAttr = line.Attributes[DocumentFieldName.LineAttribute_SalesOrderGenerateDocumentOption]; if (sogdoAttr == null) { throw new ClientException(ClientExceptionId.MissingLineAttribute, null, "ordinalNumber:" + line.OrdinalNumber.ToString(CultureInfo.InvariantCulture)); } return(sogdoAttr.Value.Value); }
private void ProcessDocumentsGeneration(ServiceDocument document) { if (document.DocumentStatus == DocumentStatus.Canceled) { return; } //przelatujemy po liniach i porownujemy z alternate version co sie zmienilo //slowniki w ktorych bedziemy bilansowac WarehouseItemQuantityDictionary dctWarehouseItemIdQuantity = new WarehouseItemQuantityDictionary(); this.mapper.AddItemsToItemTypesCache(document); IDictionary <Guid, Guid> cache = SessionManager.VolatileElements.ItemTypesCache; foreach (CommercialDocumentLine line in document.Lines.Children) { Guid itemTypeId = cache[line.ItemId]; ItemType itemType = DictionaryMapper.Instance.GetItemType(itemTypeId); if (!itemType.IsWarehouseStorable) { continue; } DocumentLineAttrValue attr = line.Attributes[DocumentFieldName.LineAttribute_GenerateDocumentOption]; if (attr.Value.Value != "2" && attr.Value.Value != "4") //czyli opcja ze NIE generujemy MMki { continue; } dctWarehouseItemIdQuantity.Add(line.WarehouseId.Value, line.ItemId, line.Quantity); } ServiceDocument alternateDocument = document.AlternateVersion as ServiceDocument; if (alternateDocument != null) { this.mapper.AddItemsToItemTypesCache(alternateDocument); cache = SessionManager.VolatileElements.ItemTypesCache; foreach (CommercialDocumentLine line in alternateDocument.Lines.Children) { Guid itemTypeId = cache[line.ItemId]; ItemType itemType = DictionaryMapper.Instance.GetItemType(itemTypeId); if (!itemType.IsWarehouseStorable) { continue; } DocumentLineAttrValue attr = line.Attributes[DocumentFieldName.LineAttribute_GenerateDocumentOption]; if (attr.Value.Value != "2" && attr.Value.Value != "4") //czyli opcja ze NIE generujemy MMki { continue; } dctWarehouseItemIdQuantity.Subtract(line.WarehouseId.Value, line.ItemId, line.Quantity); } } //teraz majac zbilansowane wszystko ladnie co sie zmienilo przystepujemy do generacji MMek. //jezeli cos sie zmienilo na plus to oznacza ze musimy z danego warehouseId przesunac na serviceWarehouse podana ilosc //jezeli cos sie zmienilo na minus to oznacza ze z serviceWarehouse musimy przesunac na ten magazyn ServiceDocumentLogic.GenerateShifts(document, dctWarehouseItemIdQuantity); }
internal static string TryGetOption(CommercialDocumentLine line) { DocumentLineAttrValue sogdoAttr = line.Attributes[DocumentFieldName.LineAttribute_SalesOrderGenerateDocumentOption]; return(sogdoAttr == null ? null : sogdoAttr.Value.Value); }