Exemplo n.º 1
0
        /// <summary>
        /// Creates the transport document.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task CreateTransportDocument()
        {
            var dossierNumber = ConsoleApp.AskStringValue("DossierNumber");
            var externalId    = ConsoleApp.AskStringValue("ExternalId");

            TransportDocument newDocument = new TransportDocument
            {
                DossierNumber = dossierNumber,
                ExternalId    = externalId,
                IssuedDate    = DateTime.Today,
                Consignor     = new Contact
                {
                    ExternalId = "14-14",
                    Name       = "ACME Bakeries",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Zeebrugge",
                        Postalcode    = "8380",
                    },
                    // Use the signature text to provide the information to put into field 14 of the CMR
                    SignatureText = "ACME Bakeries"
                },
                PrimaryCarrier = new Carrier
                {
                    ExternalId = "16-16",
                    Name       = "PIONIRA",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 15",
                        City          = "Zeebrugge",
                        Postalcode    = "8380"
                    },
                    License = "9999999",
                    // Use the signature text to provide the information to put into field 15 of the CMR
                    SignatureText = "Transport PIONIRA"
                },
                Consignee = new Contact
                {
                    ExternalId = "15-15",
                    Name       = "ACME Warehouse",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Gent",
                        Postalcode    = "9000"
                    }
                },
                TransportExecutions = new TransportExecution[]
                {
                    new TransportExecution
                    {
                        Driver = new Driver
                        {
                            Name       = "John Doe",
                            ExternalId = "JOHNDOE_42"
                        },
                        Truck = new Vehicle
                        {
                            ExternalId   = "12345",
                            LicensePlate = "5-JNK-736"
                        },
                        Trailer = new Vehicle
                        {
                            ExternalId   = "67890",
                            LicensePlate = "5-TRV-368"
                        },
                    }
                },
                //GoodsText = "2 pal. bruin brood",
                Goods = new Product[]
                {
                    new Product
                    {
                        Code        = "Code",
                        Description = "u",
                        LotNumber   = "-",
                        Quantity    = 5,
                        Reference   = "8",
                        SealNumber  = "Sealnr",
                        ExternalId  = "4646",
                    },
                    new Product
                    {
                        Code       = "Code2",
                        SealNumber = "Sealnr",
                        ExternalId = "422646",
                    }
                },
                ECmr = true
            };

            TransportDocumentReturnState state = await this.client.PostJsonAsync <TransportDocumentReturnState>(new Uri(this.oauthSettings.BaseUrl + "/api/v2/transportdocuments"), newDocument);

            if (state != null)
            {
                Console.WriteLine("CMR succesfully created!");
                DumpReturnState(state);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the transport document.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task CreateTransportDocument()
        {
            var dossierNumber = ConsoleApp.AskStringValue("DossierNumber");
            var externalId    = ConsoleApp.AskStringValue("ExternalId");

            TransportDocument newDocument = new TransportDocument
            {
                DossierNumber = dossierNumber,
                ExternalId    = externalId,
                IssuedDate    = DateTime.Today,
                IssuedPlace   = "Zeebrugge",
                Consignor     = new Contact
                {
                    ExternalId   = "14-14",
                    Name         = "ACME Bakeries",
                    EmailAddress = "*****@*****.**",
                    Address      = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Zeebrugge",
                        Postalcode    = "8380",
                    },
                    // Use the signature text to provide the information to put into field 14 of the CMR
                    SignatureText = "ACME Bakeries"
                },
                Pickup = new Destination
                {
                    ExternalId = "14-14",
                    Name       = "ACME Bakeries",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Zeebrugge",
                        Postalcode    = "8380",
                    },
                    Datetime = DateTime.Now.AddDays(1),
                    // Use the signature text to provide the information to put into field 14 of the CMR
                    SignatureText = "ACME Bakeries"
                },
                PrimaryCarrier = new Carrier
                {
                    ExternalId = "16-16",
                    Name       = "PIONIRA",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 15",
                        City          = "Zeebrugge",
                        Postalcode    = "8380"
                    },
                    License = "9999999",
                    // Use the signature text to provide the information to put into field 15 of the CMR
                    SignatureText = "Transport PIONIRA"
                },
                Consignee = new Contact
                {
                    ExternalId = "15-15",
                    Name       = "ACME Warehouse",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Gent",
                        Postalcode    = "9000"
                    }
                },
                Delivery = new Destination
                {
                    Datetime   = DateTime.Now.AddDays(2),
                    ExternalId = "15-15",
                    Name       = "ACME Warehouse",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Gent",
                        Postalcode    = "9000"
                    }
                },
                TransportExecutions = new TransportExecution[]
                {
                    new TransportExecution
                    {
                        Driver = new Driver
                        {
                            Name       = "John Doe",
                            ExternalId = "JOHNDOE_42"
                        },
                        Truck = new Vehicle
                        {
                            ExternalId   = "12345",
                            LicensePlate = "5-JNK-736"
                        },
                        Trailer = new Vehicle
                        {
                            ExternalId   = "67890",
                            LicensePlate = "5-TRV-368"
                        },
                    }
                },
                GoodsText = "2 pal. bruin brood",
                Goods     = new Product[]
                {
                    new Product
                    {
                        Code       = "Code",
                        SealNumber = "Sealnr",
                        ExternalId = "4646",
                    }
                },
                ECmr = true
            };

            TransportDocumentReturnState state = await this.soapClient.CreateTransportDocumentAsync(newDocument);

            if (state != null)
            {
                Console.WriteLine("CMR succesfully created!");
                DumpReturnState(state);
            }
        }