Пример #1
0
        public bool PutawayItem(string sku, string lpn, string orderNumber)
        {
            var client  = new RestClient(_baseServiceUrl);
            var request = new RestRequest(_urlPath + "putaway/{sku}/{lpn}/{ordernumber}", Method.POST);

            request.AddUrlSegment("lpn", lpn);                 // replaces matching token in request.Resource
            request.AddUrlSegment("sku", sku);                 // replaces matching token in request.Resource
            request.AddUrlSegment("ordernumber", orderNumber); // replaces matching token in request.Resource


            // execute the request
            // or automatically deserialize result
            // return content type is sniffed but can be explicitly set via RestClient.AddHandler();
            var response = client.Execute(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                // Something other than HTTP-200 returned.
                _logger.LogError(string.Format("HTTP ERROR: {0} Returned from CMS Inventory movement, for SKU {1} and LPN {2}", response.StatusCode, sku, lpn));
                return(false);
            }


            return(true);
        }
Пример #2
0
        public LocationStatusCode ChkValidLocation(string location)
        {
            LocationStatusCode locationStatus;

            var client  = new RestClient(_baseServiceUrl);
            var request = new RestRequest(_urlPath + "chklocation/{location}", Method.GET);

            request.AddUrlSegment("location", location);     // replaces matching token in request.Resource

            // execute the request
            // or automatically deserialize result
            // return content type is sniffed but can be explicitly set via RestClient.AddHandler();
            var response = client.Execute <ChkLocationServiceResponse>(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                // Something other than HTTP-200 returned. Therefore default to noLocationString.
                //locationStatus = LocationStatusCode.NotFound;

                // Something other than HTTP-200 returned.
                _logger.LogError(string.Format("HTTP ERROR: {0} Returned from ChkLocationService", response.StatusCode));
                locationStatus = LocationStatusCode.HTTPerror;
            }
            else
            {
                // Response back, but did we get a Location or an empty list? Need to check.
                if (response.Data.items.Count == 0)
                {
                    locationStatus = LocationStatusCode.NotFound;
                }
                else
                // We have had a value back from ORDS. Therefore pick it from the JSON to populate locally.
                {
                    if (response.Data.items[0].locn_status == "T")
                    {
                        locationStatus = LocationStatusCode.Valid;
                    }
                    else
                    {
                        locationStatus = LocationStatusCode.Invalid;
                    }
                }
            }

            return(locationStatus);
        }