Skip to content

Picking Order

GET

using System;
using System.Threading.Tasks;
using Wdcs.Wip.Api;
using Wdcs.Wip.Client;
using Wdcs.Wip.Model;

namespace wip_project.Api
{
    partial class PickingOrderService : IGetApi
    {
        public async Task GetAsync(string apiUrl, string username, string password)
        {
            var config = new Configuration()
            {
                BasePath = apiUrl
            };
            var tokenRequest = new TokenApi(config);
            // Get the Token
            var response = tokenRequest.Create(new TokenUser(username, password));
            var authorization = "Bearer " + response.AuthToken;
            var api = new PickingOrderApi(config);
            var items = await api.GetAsync(authorization, warehouseId: "01");
            foreach (var item in items.Results)
            {
                Console.WriteLine($"SalesOrder: {item.SalesOrder} Warehouse: {item.WarehouseId}");
            }
            Console.ReadLine();
        }
    }
}

POST

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Wdcs.Wip.Api;
using Wdcs.Wip.Client;
using Wdcs.Wip.Model;

namespace wip_project.Api
{
    partial class PickingOrderService : IPostApi
    {
        public async Task PostAsync(string apiUrl, string username, string password)
        {
            var config = new Configuration()
            {
                BasePath = apiUrl
            };
            var tokenRequest = new TokenApi(config);
            // Get the Token
            var response = tokenRequest.Create(new TokenUser(username, password));
            var authorization = "Bearer " + response.AuthToken;
            var orderId = "OR-001";
            var whId = "01";
            // Create new object
            var payload = new PickingOrder(
                warehouseId: whId,
                salesOrder: orderId,
                orderDate: DateTime.Now,
                detail:
                new List<PickingDetail>()
                    {
                        new PickingDetail(
                            warehouseId: whId,
                            salesOrder: orderId,
                            orderedQuantity: 100,
                            uomId: "EACH",
                            lineNumber: 1,
                            itemId: "I0001"
                            )
                    }
                );
            // Call Api
            var pickingApi = new PickingOrderApi(config);
            await pickingApi.PostAsync(authorization, payload);
        }
    }
}