/// <summary> /// Initializes a new instance of the <see cref="OutputResponseSmallSet"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public OutputResponseSmallSet(MosaicMessage message) { StockOutputResponse response = (StockOutputResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; this.Details = new Details(); this.Details.Priority = TypeConverter.ConvertOutputPriority(response.Order.Priority); this.Details.OutputDestination = response.Order.OutputNumber.ToString(); this.Details.Status = response.Order.State.ToString(); if (response.Order.Items.Count > 0) { this.Criteria = new Criteria[response.Order.Items.Count]; for (int i = 0; i < this.Criteria.Length; ++i) { var item = response.Order.Items[i]; this.Criteria[i] = new Criteria() { ArticleId = string.IsNullOrEmpty(item.RobotArticleCode) ? null : TextConverter.EscapeInvalidXmlChars(item.RobotArticleCode), Quantity = item.RequestedQuantity, BatchNumber = string.IsNullOrEmpty(item.BatchNumber) ? null : TextConverter.EscapeInvalidXmlChars(item.BatchNumber), ExternalId = string.IsNullOrEmpty(item.ExternalID) ? null : TextConverter.EscapeInvalidXmlChars(item.ExternalID), PackId = (item.PackID == 0) ? null : ((ulong)item.PackID).ToString(), MinimumExpiryDate = TypeConverter.ConvertDateNull(item.ExpiryDate) }; } } }
/// <summary> /// Initializes a new instance of the <see cref="ArticleMasterSetRequestSmallSet"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public ArticleMasterSetRequestSmallSet(MosaicMessage message) { var request = (Interfaces.Messages.Stock.ArticleMasterSetRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; if (request.PISArticles.Count == 0) { return; } this.Article = new Article[request.PISArticles.Count]; for (int i = 0; i < this.Article.Length; ++i) { var article = request.PISArticles[i]; this.Article[i] = new Article() { Id = TextConverter.EscapeInvalidXmlChars(article.Code), Name = TextConverter.EscapeInvalidXmlChars(article.Name), DosageForm = TextConverter.EscapeInvalidXmlChars(article.DosageForm), PackagingUnit = TextConverter.EscapeInvalidXmlChars(article.PackagingUnit), }; } }
/// <summary> /// Initializes a new instance of the <see cref="InputRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public InputRequest(MosaicMessage message) { StockInputRequest request = (StockInputRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; this.IsNewDelivery = request.IsDeliveryInput.ToString(); this.SetPickingIndicator = request.SetPickingIndicator.ToString(); this.Article = new Article(); this.Article.Pack = new List <Pack>(); for (int i = 0; i < request.Packs.Count; ++i) { this.Article.Pack.Add(new Pack() { Index = i.ToString(), ScanCode = TextConverter.EscapeInvalidXmlChars(request.Packs[i].ScanCode), BatchNumber = TextConverter.EscapeInvalidXmlChars(request.Packs[i].BatchNumber), ExternalId = TextConverter.EscapeInvalidXmlChars(request.Packs[i].ExternalID), DeliveryNumber = (request.IsDeliveryInput) ? TextConverter.EscapeInvalidXmlChars(request.Packs[i].DeliveryNumber) : null, ExpiryDate = TypeConverter.ConvertDateNull(request.Packs[i].ExpiryDate), SubItemQuantity = request.Packs[i].SubItemQuantity.ToString(), StockLocationId = TextConverter.EscapeInvalidXmlChars(request.Packs[i].StockLocationID), MachineLocation = TextConverter.EscapeInvalidXmlChars(request.Packs[i].MachineLocation) }); } }
/// <summary> /// Initializes a new instance of the <see cref="StatusResponse"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StatusResponse(MosaicMessage message) { var response = (Interfaces.Messages.Status.StatusResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; this.State = response.Component.State.ToString(); this.StateText = response.Component.StateDescription; if ((response.Component.SubComponents != null) && (response.Component.SubComponents.Length > 0)) { this.Component = new Component[response.Component.SubComponents.Length]; for (int i = 0; i < response.Component.SubComponents.Length; ++i) { var subComponent = response.Component.SubComponents[i]; this.Component[i] = new Component() { Description = TextConverter.EscapeInvalidXmlChars(subComponent.Description), State = subComponent.State.ToString(), StateText = TextConverter.EscapeInvalidXmlChars(subComponent.StateDescription), Type = subComponent.Type }; } } }
/// <summary> /// Initializes a new instance of the <see cref="StockInfoRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StockInfoRequest(MosaicMessage message) { var request = (Interfaces.Messages.Stock.StockInfoRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; this.IncludePacks = request.IncludePacks.ToString(); this.IncludeArticleDetails = request.IncludeArticleDetails.ToString(); if (request.Criteria.Count > 0) { this.Criteria = new Criteria[request.Criteria.Count]; for (int i = 0; i < this.Criteria.Length; ++i) { this.Criteria[i] = new Criteria() { ArticleId = TextConverter.EscapeInvalidXmlChars(request.Criteria[i].RobotArticleCode), ExternalId = string.IsNullOrEmpty(request.Criteria[i].ExternalID) ? null : TextConverter.EscapeInvalidXmlChars(request.Criteria[i].ExternalID), BatchNumber = string.IsNullOrEmpty(request.Criteria[i].BatchNumber) ? null : TextConverter.EscapeInvalidXmlChars(request.Criteria[i].BatchNumber), StockLocationId = string.IsNullOrEmpty(request.Criteria[i].StockLocationID) ? null : TextConverter.EscapeInvalidXmlChars(request.Criteria[i].StockLocationID), MachineLocation = string.IsNullOrEmpty(request.Criteria[i].MachineLocation) ? null : TextConverter.EscapeInvalidXmlChars(request.Criteria[i].MachineLocation) }; } } }
/// <summary> /// Checks whether the specified message is a message which does not fit /// to the WWKS2 workflow and should be skipped. /// </summary> /// <param name="message">The message to check.</param> /// <returns><c>true</c> if the message does not fit the WWKS2 workflow and should be skipped.<c>false</c> otherwise.</returns> private bool SkipMessage(MosaicMessage message) { switch (message.Type) { case MessageType.StockOutputMessage: { if (((StockOutputMessage)message).Order.State == StockOutputOrderState.InProcess) { return(true); } break; } case MessageType.LabelPrintMessage: { return(true); } case MessageType.LabelPrintRequest: { var request = (LabelPrintRequest)message; var response = new LabelPrintResponse(); response.AdoptHeader(request); response.SourceName = "Mosaic"; response.OrderNumber = request.OrderNumber; response.ArticleCode = request.ArticleCode; response.LabelId = request.LabelId; response.TemplateId = request.TemplateId; response.PrintLabel = false; request.ConverterStream.Write(response); return(true); } case MessageType.StockInfoMessage: { if (((Interfaces.Messages.Stock.StockInfoMessage)message).Packs.Count == 0) { return(true); } if ((((Interfaces.Messages.Stock.StockInfoMessage)message).StockInfoType != Interfaces.Messages.Stock.StockInfoType.StockUpdate) && (((Interfaces.Messages.Stock.StockInfoMessage)message).StockInfoType != Interfaces.Messages.Stock.StockInfoType.PackInput)) { return(true); } // Singapur workaround -> StockInfoMessage signals pack input only if ((_configuration.SmallMessageSet) && ((((Interfaces.Messages.Stock.StockInfoMessage)message).StockInfoType == Interfaces.Messages.Stock.StockInfoType.StockUpdate))) { return(true); } break; } } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="StockLocationInfoRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StockLocationInfoRequest(MosaicMessage message) { var request = (Interfaces.Messages.Stock.StockLocationInfoRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; }
/// <summary> /// Initializes a new instance of the <see cref="ConfigurationGetRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public ConfigurationGetRequest(MosaicMessage message) { var request = (Interfaces.Messages.Configuration.ConfigurationGetRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; }
/// <summary> /// Initializes a new instance of the <see cref="ArticleSelectedMessage"/> class. /// </summary> public ArticleSelectedMessage(MosaicMessage message) { Interfaces.Messages.Sales.ArticleSelectedMessage msg = (Interfaces.Messages.Sales.ArticleSelectedMessage)message; this.Id = msg.ID; this.Source = msg.Source; this.Destination = msg.Destination; this.Article = msg.Article; }
/// <summary> /// Initializes a new instance of the <see cref="StatusRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StatusRequest(MosaicMessage message) { var request = (Interfaces.Messages.Status.StatusRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; this.IncludeDetails = request.IncludeDetails.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="ConfigurationGetResponse"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public ConfigurationGetResponse(MosaicMessage message) { var response = (Interfaces.Messages.Configuration.ConfigurationGetResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; this.RawContent = response.Configuration; }
/// <summary> /// Initializes a new instance of the <see cref="ShoppingCartUpdateRequest"/> class. /// </summary> public ShoppingCartUpdateRequest(MosaicMessage message) { Interfaces.Messages.Sales.ShoppingCartUpdateRequest request = (Interfaces.Messages.Sales.ShoppingCartUpdateRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; this.ShoppingCart = request.ShoppingCart; }
/// <summary> /// Initializes a new instance of the <see cref="ShoppingCartUpdateMessage"/> class. /// </summary> public ShoppingCartUpdateMessage(MosaicMessage message) { Interfaces.Messages.Sales.ShoppingCartUpdateMessage msg = (Interfaces.Messages.Sales.ShoppingCartUpdateMessage)message; this.Id = msg.ID; this.Source = msg.Source; this.Destination = msg.Destination; this.ShoppingCart = msg.ShoppingCart; }
/// <summary> /// Initializes a new instance of the <see cref="ShoppingCartResponse"/> class. /// </summary> public ShoppingCartResponse(MosaicMessage message) { Interfaces.Messages.Sales.ShoppingCartResponse response = (Interfaces.Messages.Sales.ShoppingCartResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; this.ShoppingCart = response.ShoppingCart; }
/// <summary> /// Initializes a new instance of the <see cref="StockInfoResponse"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StockInfoResponse(MosaicMessage message) : base(message) { var response = (Interfaces.Messages.Stock.StockInfoResponse)message; if (this.Article == null) { return; } for (int i = 0; i < this.Article.Length; ++i) { var article = response.Articles[i]; this.Article[i].Name = TextConverter.EscapeInvalidXmlChars(article.Name); this.Article[i].DosageForm = TextConverter.EscapeInvalidXmlChars(article.DosageForm); this.Article[i].PackagingUnit = TextConverter.EscapeInvalidXmlChars(article.PackagingUnit); this.Article[i].MaxSubItemQuantity = article.MaxSubItemQuantity >= 0 ? article.MaxSubItemQuantity.ToString() : null; } Dictionary <string, Types.Pack> packMap = new Dictionary <string, Types.Pack>(response.Packs.Count); foreach (var article in this.Article) { if (article.Pack == null) { continue; } foreach (var pack in article.Pack) { packMap[pack.Id] = pack; } } foreach (var pack in response.Packs) { var respPack = packMap[((ulong)pack.ID).ToString()]; respPack.StockInDate = TypeConverter.ConvertDateNull(pack.StockInDate); respPack.ScanCode = TextConverter.EscapeInvalidXmlChars(pack.ScanCode); respPack.DeliveryNumber = TextConverter.EscapeInvalidXmlChars(pack.DeliveryNumber); respPack.Width = pack.Width.ToString(); respPack.Height = pack.Height.ToString(); respPack.Depth = pack.Depth.ToString(); respPack.Shape = pack.Shape.ToString(); respPack.IsInFridge = pack.IsInFridge.ToString(); respPack.SubItemQuantity = pack.SubItemQuantity.ToString(); respPack.StockLocationId = TextConverter.EscapeInvalidXmlChars(pack.StockLocationID); respPack.MachineLocation = TextConverter.EscapeInvalidXmlChars(pack.MachineLocation); respPack.State = ((pack.IsAvailable == false) || (pack.IsBlocked == true)) ? PackState.NotAvailable.ToString() : PackState.Available.ToString(); } }
/// <summary> /// Initializes a new instance of the <see cref="ArticleInfoResponse"/> class. /// </summary> public ArticleInfoResponse(MosaicMessage message) { Interfaces.Messages.ArticleInformation.ArticleInfoResponse response = (Interfaces.Messages.ArticleInformation.ArticleInfoResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; this.Article = new Article[response.Articles.Length]; for (int i = 0; i < response.Articles.Length; i++) { this.Article[i] = response.Articles[i]; } }
/// <summary> /// Initializes a new instance of the <see cref="ArticleMasterSetResponse"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public ArticleMasterSetResponse(MosaicMessage message) { var response = (Interfaces.Messages.Stock.ArticleMasterSetResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; this.SetResult = new SetResult() { Value = response.SetResult ? "Accepted" : "Rejected", Text = string.IsNullOrEmpty(response.SetResultText) ? null : TextConverter.EscapeInvalidXmlChars(response.SetResultText) }; }
/// <summary> /// Initializes a new instance of the <see cref="UnprocessedMessage"/> class. /// </summary> /// <param name="message"></param> public UnprocessedMessage(MosaicMessage message) { var msg = (Interfaces.Messages.Unprocessed.UnprocessedMessage)message; this.Id = msg.ID; this.Source = msg.Source; this.Destination = msg.Destination; this.Reason = msg.Reason; this.Text = msg.Text; this.Message = new Message { RawContent = msg.Message.RawContent }; }
/// <summary> /// Initializes a new instance of the <see cref="ArticlePriceRequest"/> class. /// </summary> public ArticlePriceRequest(MosaicMessage message) { Interfaces.Messages.ArticleInformation.ArticlePriceRequest request = (Interfaces.Messages.ArticleInformation.ArticlePriceRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; this.Currency = request.Currency; this.Article = new Article[request.Articles.Length]; for (int i = 0; i < request.Articles.Length; i++) { this.Article[i] = request.Articles[i]; } }
/// <summary> /// Writes the specified Mosaic message to the underlying connection. This method will block until the Mosaic message /// has been written, the converter has been cancelled or an error occurred. /// </summary> /// <param name="message">The Mosaic message to write.</param> /// <returns> /// <c>true</c>if successful; <c>false</c> otherwise. /// </returns> public bool Write(MosaicMessage message) { if (message.Source == 0) { message.Source = _configuration.SubscriberID; } if (message.Destination == 0) { message.Destination = _destinationID; } if (string.IsNullOrEmpty(message.ID)) { message.ID = "1"; } int msgId = 0; if ((int.TryParse(message.ID, out msgId)) && (msgId <= 0)) { message.ID = "1"; } if (SkipMessage(message)) { return(true); } if ((_supportedMessageList.Count > 0) && (_supportedMessageList.Contains(message.Type) == false)) { this.Warning("According to the capabilities of the remote end point, the message '{0}' is not supported.", message.Type.ToString()); return(false); } object messageToWrite = ConvertMosaicMessage(message); if (messageToWrite == null) { this.Error("Conversion of message '{0}' is not supported.", message.Type.ToString()); return(false); } return(_objectStream.Write(messageToWrite)); }
/// <summary> /// Initializes a new instance of the <see cref="ArticleInfoRequest"/> class. /// </summary> public ArticleInfoRequest(MosaicMessage message) { Interfaces.Messages.ArticleInformation.ArticleInfoRequest request = (Interfaces.Messages.ArticleInformation.ArticleInfoRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; this.Article = new Article[request.Articles.Length]; for (int i = 0; i < request.Articles.Length; i++) { this.Article[i] = request.Articles[i]; } this.IncludeCrossSellingArticles = request.IncludeCrossSellingArticles; this.IncludeAlternativeArticles = request.IncludeAlternativeArticles; this.IncludeAlternativePackSizeArticles = request.IncludeAlternativePackSizeArticles; }
/// <summary> /// Initializes a new instance of the <see cref="StockInfoResponseSmallSet"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StockInfoResponseSmallSet(MosaicMessage message) { var response = (Interfaces.Messages.Stock.StockInfoResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; if (response.Articles.Count > 0) { this.Article = new Article[response.Articles.Count]; Dictionary <string, Article> articleMap = new Dictionary <string, Article>(this.Article.Length); for (int i = 0; i < this.Article.Length; ++i) { var article = response.Articles[i]; this.Article[i] = new Article() { Id = TextConverter.EscapeInvalidXmlChars(article.Code), Quantity = article.PackCount.ToString() }; articleMap[article.Code] = this.Article[i]; } foreach (var pack in response.Packs) { var article = articleMap[pack.RobotArticleCode]; if (article.Pack == null) { article.Pack = new List <Types.Pack>(); } article.Pack.Add(new Types.Pack() { Id = ((ulong)pack.ID).ToString(), BatchNumber = TextConverter.EscapeInvalidXmlChars(pack.BatchNumber), ExternalId = TextConverter.EscapeInvalidXmlChars(pack.ExternalID), ExpiryDate = TypeConverter.ConvertDateNull(pack.ExpiryDate) }); } } }
/// <summary> /// Initializes a new instance of the <see cref="OutputResponse"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public OutputResponse(MosaicMessage message) : base(message) { StockOutputResponse response = (StockOutputResponse)message; this.BoxNumber = response.Order.BoxNumber; this.Details.OutputPoint = response.Order.OutputPoint != 0 ? response.Order.OutputPoint.ToString() : null; if (response.Order.Items.Count > 0) { for (int i = 0; i < this.Criteria.Length; ++i) { if (response.Order.Items[i].PackID != 0) { this.Criteria[i].PackId = ((ulong)response.Order.Items[i].PackID).ToString(); } if (response.Order.Items[i].RequestedSubItemQuantity > 0) { this.Criteria[i].Quantity = 0; this.Criteria[i].SubItemQuantity = response.Order.Items[i].RequestedSubItemQuantity.ToString(); } foreach (var label in response.Order.Items[i].Labels) { if (this.Criteria[i].Label == null) { this.Criteria[i].Label = new List <Label>(); } this.Criteria[i].Label.Add(new Label() { TemplateId = label.TemplateID, RawContent = label.Content }); } this.Criteria[i].ArticleId = string.IsNullOrEmpty(response.Order.Items[i].PISArticleCode) ? null : TextConverter.EscapeInvalidXmlChars(response.Order.Items[i].PISArticleCode); this.Criteria[i].SingleBatchNumber = response.Order.Items[i].SingleBatchNumber.ToString(); this.Criteria[i].StockLocationId = string.IsNullOrEmpty(response.Order.Items[i].StockLocationID) ? null : TextConverter.EscapeInvalidXmlChars(response.Order.Items[i].StockLocationID); this.Criteria[i].MachineLocation = string.IsNullOrEmpty(response.Order.Items[i].MachineLocation) ? null : TextConverter.EscapeInvalidXmlChars(response.Order.Items[i].MachineLocation); } } }
/// <summary> /// Initializes a new instance of the <see cref="InitiateInputRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public InitiateInputRequest(MosaicMessage message) { var request = (InitiateStockInputRequest)message; this.Id = request.ID; this.Destination = request.Destination; this.Source = request.Source; this.IsNewDelivery = request.IsDeliveryInput.ToString(); this.SetPickingIndicator = request.SetPickingIndicator.ToString(); this.Details = new Types.Details() { InputSource = request.InputSource.ToString(), InputPoint = request.InputPoint.ToString() }; this.Article = new Article(); if (request.Packs.Count > 0) { this.Article.Pack = new List <Types.Pack>(); foreach (var pack in request.Packs) { this.Article.Pack.Add(new Types.Pack() { ScanCode = TextConverter.EscapeInvalidXmlChars(pack.ScanCode), DeliveryNumber = TextConverter.EscapeInvalidXmlChars(pack.DeliveryNumber), BatchNumber = TextConverter.EscapeInvalidXmlChars(pack.BatchNumber), ExternalId = TextConverter.EscapeInvalidXmlChars(pack.ExternalID), ExpiryDate = TypeConverter.ConvertDateNull(pack.ExpiryDate), SubItemQuantity = pack.SubItemQuantity.ToString(), Depth = pack.Depth.ToString(), Width = pack.Width.ToString(), Height = pack.Height.ToString(), Shape = pack.Shape.ToString(), StockLocationId = TextConverter.EscapeInvalidXmlChars(pack.StockLocationID), MachineLocation = TextConverter.EscapeInvalidXmlChars(pack.MachineLocation) }); } } }
/// <summary> /// Initializes a new instance of the <see cref="StockDeliverySetRequestSmallSet"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StockDeliverySetRequestSmallSet(MosaicMessage message) { var request = (Interfaces.Messages.Stock.StockDeliverySetRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; if (request.StockDeliveries.Count == 0) { return; } this.StockDelivery = new StockDelivery[request.StockDeliveries.Count]; for (int i = 0; i < this.StockDelivery.Length; ++i) { var stockDelivery = request.StockDeliveries[i]; this.StockDelivery[i] = new StockDelivery() { DeliveryNumber = stockDelivery.DeliveryNumber, Article = new List <Article>() }; foreach (var article in stockDelivery.Items) { this.StockDelivery[i].Article.Add(new Article() { Id = TextConverter.EscapeInvalidXmlChars(article.ArticleCode), Name = TextConverter.EscapeInvalidXmlChars(article.Name), DosageForm = TextConverter.EscapeInvalidXmlChars(article.DosageForm), PackagingUnit = TextConverter.EscapeInvalidXmlChars(article.PackagingUnit), BatchNumber = string.IsNullOrEmpty(article.BatchNumber) ? null : TextConverter.EscapeInvalidXmlChars(article.BatchNumber), ExternalId = string.IsNullOrEmpty(article.ExternalID) ? null : TextConverter.EscapeInvalidXmlChars(article.ExternalID), ExpiryDate = TypeConverter.ConvertDateNull(article.ExpiryDate), Quantity = (article.RequestedQuantity != 0) ? null : article.RequestedQuantity.ToString() }); } } }
/// <summary> /// Initializes a new instance of the <see cref="StockDeliverySetRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StockDeliverySetRequest(MosaicMessage message) : base(message) { var request = (Interfaces.Messages.Stock.StockDeliverySetRequest)message; if (this.StockDelivery == null) { return; } for (int i = 0; i < this.StockDelivery.Length; ++i) { for (int k = 0, max = this.StockDelivery[i].Article.Count; k < max; ++k) { this.StockDelivery[i].Article[k].RequiresFridge = request.StockDeliveries[i].Items[k].RequiresFridge.ToString(); this.StockDelivery[i].Article[k].MaxSubItemQuantity = request.StockDeliveries[i].Items[k].MaxSubItemQuantity.ToString(); this.StockDelivery[i].Article[k].StockLocationId = TextConverter.EscapeInvalidXmlChars(request.StockDeliveries[i].Items[k].StockLocationID); this.StockDelivery[i].Article[k].MachineLocation = TextConverter.EscapeInvalidXmlChars(request.StockDeliveries[i].Items[k].MachineLocation); } } }
/// <summary> /// Initializes a new instance of the <see cref="ArticleMasterSetRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public ArticleMasterSetRequest(MosaicMessage message) : base(message) { var request = (Interfaces.Messages.Stock.ArticleMasterSetRequest)message; if (this.Article == null) { return; } for (int i = 0; i < this.Article.Length; ++i) { this.Article[i].RequiresFridge = request.PISArticles[i].Attributes[PisArticleAttribute.RequiredFridge].Value; this.Article[i].MaxSubItemQuantity = request.PISArticles[i].MaxSubItemQuantity.ToString(); this.Article[i].StockLocationId = TextConverter.EscapeInvalidXmlChars(request.PISArticles[i].StockLocationID); this.Article[i].MachineLocation = TextConverter.EscapeInvalidXmlChars(request.PISArticles[i].MachineLocation); this.Article[i].BatchTracking = request.PISArticles[i].BatchTracking.ToString(); this.Article[i].SerialTracking = request.PISArticles[i].SerialTracking.ToString(); this.Article[i].ExpiryTracking = request.PISArticles[i].ExpiryTracking.ToString(); } }
/// <summary> /// Initializes a new instance of the <see cref="TaskCancelRequest"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public TaskCancelRequest(MosaicMessage message) { var request = (Interfaces.Messages.Task.TaskCancelRequest)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; if (request.Tasks.Count > 0) { this.Task = new Types.Task[request.Tasks.Count]; for (int i = 0; i < this.Task.Length; ++i) { var task = request.Tasks[i]; this.Task[i] = new Types.Task() { Id = task.ID, Type = task.Type.ToString() }; } } }
/// <summary> /// Initializes a new instance of the <see cref="StockLocationInfoResponse"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public StockLocationInfoResponse(MosaicMessage message) { var request = (Interfaces.Messages.Stock.StockLocationInfoResponse)message; this.Id = request.ID; this.Source = request.Source; this.Destination = request.Destination; if (request.StockLocations.Count > 0) { this.StockLocation = new StockLocation[request.StockLocations.Count]; for (int i = 0; i < this.StockLocation.Length; ++i) { this.StockLocation[i] = new StockLocation() { Id = TextConverter.EscapeInvalidXmlChars(request.StockLocations[i].ID), Description = TextConverter.EscapeInvalidXmlChars(request.StockLocations[i].Description), }; } } }
/// <summary> /// Initializes a new instance of the <see cref="InputResponse"/> class. /// </summary> /// <param name="message">The message to use for initialization.</param> public InputResponse(MosaicMessage message) { StockInputResponse response = (StockInputResponse)message; this.Id = response.ID; this.Source = response.Source; this.Destination = response.Destination; this.IsNewDelivery = response.IsDeliveryInput.ToString(); if ((response.ArticleTrees != null) && (response.ArticleTrees.Count != 0)) { throw new System.Exception("public InputResponse(MosaicMessage message), using ArticleTree not supported."); } else { if (response.Articles.Count > 0) { this.Article = new List <Article>(response.Articles.Count); foreach (var article in response.Articles) { var a = new Article(); a.DosageForm = TextConverter.EscapeInvalidXmlChars(article.DosageForm); a.Id = TextConverter.EscapeInvalidXmlChars(article.Code); a.Name = TextConverter.EscapeInvalidXmlChars(article.Name); a.PackagingUnit = TextConverter.EscapeInvalidXmlChars(article.PackagingUnit); a.MaxSubItemQuantity = article.MaxSubItemQuantity.ToString(); a.Pack = new List <Types.Pack>(); a.RequiresFridge = article.RequiresFridge.ToString(); for (int i = 0; i < response.Packs.Count; ++i) { if (response.Packs[i].RobotArticleCode != article.Code) { continue; } a.Pack.Add(new Types.Pack() { Index = i.ToString(), Id = ((ulong)response.Packs[i].ID).ToString(), ScanCode = TextConverter.EscapeInvalidXmlChars(response.Packs[i].ScanCode), DeliveryNumber = TextConverter.EscapeInvalidXmlChars(response.Packs[i].DeliveryNumber), BatchNumber = TextConverter.EscapeInvalidXmlChars(response.Packs[i].BatchNumber), ExternalId = TextConverter.EscapeInvalidXmlChars(response.Packs[i].ExternalID), ExpiryDate = TypeConverter.ConvertDateNull(response.Packs[i].ExpiryDate), SubItemQuantity = response.Packs[i].SubItemQuantity.ToString(), StockLocationId = TextConverter.EscapeInvalidXmlChars(response.Packs[i].StockLocationID), Handling = new Handling() { Input = response.Handlings[response.Packs[i]].Handling, Text = TextConverter.EscapeInvalidXmlChars(response.Handlings[response.Packs[i]].Description) } }); } this.Article.Add(a); } } } }