Beispiel #1
0
        /// <summary>
        /// Order line item type
        /// </summary>
        public OrderLineItemType CreateOrderLineItem(ActParticipation participation)
        {
            var material     = participation.LoadProperty <Material>("PlayerEntity");
            var quantityCode = ApplicationContext.Current.GetService <IConceptRepositoryService>().GetConceptReferenceTerm(material.QuantityConceptKey.Value, "UCUM");

            return(new OrderLineItemType()
            {
                requestedQuantity = new QuantityType()
                {
                    Value = (decimal)participation.Quantity, measurementUnitCode = quantityCode?.Mnemonic ?? "dose", codeListVersion = "UCUM"
                },
                additionalOrderLineInstruction =
                    material.LoadProperty <Concept>("TypeConcept")?.Mnemonic.StartsWith("VaccineType") == true ?
                    new Description200Type[] {
                    new Description200Type()
                    {
                        languageCode = "en", Value = "FRAGILE"
                    },
                    new Description200Type()
                    {
                        languageCode = "en", Value = "KEEP REFRIGERATED"
                    }
                } : null,
                transactionalTradeItem = this.CreateTradeItem(material)
            });
        }
Beispiel #2
0
        /// <summary>
        /// Create receive line item
        /// </summary>
        public ReceivingAdviceLogisticUnitType CreateReceiveLineItem(ActParticipation orderReceivePtcpt, ActParticipation orderSentPtcpt)
        {
            if (orderSentPtcpt == null)
            {
                throw new ArgumentNullException(nameof(orderSentPtcpt), "Missing sending order participation");
            }
            else if (orderReceivePtcpt == null)
            {
                throw new ArgumentNullException(nameof(orderReceivePtcpt), "Missing receiving order participation");
            }

            // Quantity code
            var quantityCode = ApplicationContext.Current.GetService <IConceptRepositoryService>().GetConceptReferenceTerm(orderReceivePtcpt.LoadProperty <Material>("PlayerEntity").QuantityConceptKey.Value, "UCUM");

            if (quantityCode == null)
            {
                throw new InvalidOperationException($"Missing quantity code for {orderReceivePtcpt.LoadProperty<Material>("PlayerEntity").QuantityConceptKey.Value}");
            }

            // Receiving logistic unit type
            return(new ReceivingAdviceLogisticUnitType()
            {
                receivingAdviceLineItem = new ReceivingAdviceLineItemType[]
                {
                    new ReceivingAdviceLineItemType()
                    {
                        quantityDespatched = new QuantityType()
                        {
                            Value = Math.Abs((decimal)orderSentPtcpt.Quantity),
                            measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM"
                        },
                        quantityAccepted = new QuantityType()
                        {
                            Value = (decimal)orderReceivePtcpt.Quantity,
                            measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM"
                        },
                        transactionalTradeItem = this.CreateTradeItem(orderReceivePtcpt.LoadProperty <Material>("PlayerEntity")),
                        receivingConditionInformation = new ReceivingConditionInformationType[]
                        {
                            new ReceivingConditionInformationType()
                            {
                                receivingConditionCode = new ReceivingConditionCodeType()
                                {
                                    Value = "DAMAGED_PRODUCT_OR_CONTAINER"
                                },
                                receivingConditionQuantity = new QuantityType()
                                {
                                    Value = (decimal)(Math.Abs(orderSentPtcpt.Quantity.Value) - orderReceivePtcpt.Quantity),
                                    measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM"
                                }
                            },
                            new ReceivingConditionInformationType()
                            {
                                receivingConditionCode = new ReceivingConditionCodeType()
                                {
                                    Value = "GOOD_CONDITION"
                                },
                                receivingConditionQuantity = new QuantityType()
                                {
                                    Value = (decimal)orderReceivePtcpt.Quantity,
                                    measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM"
                                }
                            }
                        }
                    }
                }
            });
        }