예제 #1
0
        /// <summary>
        /// Issue order information
        /// </summary>
        private void IssueOrder(Act act)
        {
            var orderMessage = new OrderMessageType();

            orderMessage.StandardBusinessDocumentHeader = this.m_gs1Util.CreateDocumentHeader("order", act.LoadCollection <ActParticipation>("Participations").FirstOrDefault(o => o.ParticipationRoleKey == ActParticipationKey.Authororiginator).LoadProperty <Entity>("PlayerEntity"));

            var type = ApplicationServiceContext.Current.GetService <IConceptRepositoryService>().GetConceptReferenceTerm(act.TypeConceptKey.Value, "GS1");

            Place shipTo   = act.LoadCollection <ActParticipation>("Participations").FirstOrDefault(o => o.ParticipationRoleKey == ActParticipationKey.Location)?.LoadProperty <Place>("PlayerEntity"),
                  shipFrom = act.LoadCollection <ActParticipation>("Participations").FirstOrDefault(o => o.ParticipationRoleKey == ActParticipationKey.Distributor)?.LoadProperty <Place>("PlayerEntity");

            OrderType order = new OrderType()
            {
                creationDateTime    = act.CreationTime.DateTime,
                documentStatusCode  = DocumentStatusEnumerationType.ORIGINAL,
                orderIdentification = new Ecom_EntityIdentificationType()
                {
                    entityIdentification = act.Key.Value.ToString()
                },
                orderTypeCode = new OrderTypeCodeType()
                {
                    Value = type?.Mnemonic, codeListVersion = type?.LoadProperty <CodeSystem>("CodeSystem").Authority
                },
                isApplicationReceiptAcknowledgementRequired          = true,
                isApplicationReceiptAcknowledgementRequiredSpecified = true,
                note = new Description500Type()
                {
                    Value = act.LoadCollection <ActNote>("Notes").FirstOrDefault()?.Text
                },
                isOrderFreeOfExciseTaxDuty          = false,
                isOrderFreeOfExciseTaxDutySpecified = true,
                orderLogisticalInformation          = new OrderLogisticalInformationType()
                {
                    shipFrom = this.m_gs1Util.CreateLocation(shipFrom),
                    shipTo   = this.m_gs1Util.CreateLocation(shipTo),
                    orderLogisticalDateInformation = new OrderLogisticalDateInformationType()
                    {
                        requestedDeliveryDateTime = new DateOptionalTimeType()
                        {
                            date = act.ActTime.Date
                        }
                    }
                },
                orderLineItem = act.LoadCollection <ActParticipation>("Participations").Where(o => o.ParticipationRoleKey == ActParticipationKey.Product).Select(o => this.m_gs1Util.CreateOrderLineItem(o)).ToArray()
            };

            for (int i = 0; i < order.orderLineItem.Length; i++)
            {
                order.orderLineItem[i].lineItemNumber = (i + 1).ToString();
            }

            orderMessage.order = new OrderType[] { order };

            // Queue The order on the file system
            this.QueueMessage(orderMessage);
        }
예제 #2
0
        /// <summary>
        /// Issue an order
        /// </summary>
        public void IssueOrder(OrderMessageType orderType)
        {
            String boundary = String.Format("------{0:N}", Guid.NewGuid());

            if (this.m_configuration.UseAS2MimeEncoding)
            {
                this.Client.Post <MultipartAttachment, object>("orderRequest", String.Format("multipart/form-data; boundary={0}", boundary), this.CreateAttachment(orderType));
            }
            else
            {
                this.Client.Post <OrderMessageType, object>("orderRequest", "application/xml", orderType);
            }
        }