コード例 #1
0
        public async Task WhenAsync(MergePatchPhysicalInventoryDto c)
        {
            var idObj         = (c as IMergePatchPhysicalInventory).DocumentNumber;
            var uriParameters = new PhysicalInventoryUriParameters();

            uriParameters.Id = idObj;

            var req  = new PhysicalInventoryPatchRequest(uriParameters, (MergePatchPhysicalInventoryDto)c);
            var resp = await _ramlClient.PhysicalInventory.Patch(req);

            PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp);
        }
コード例 #2
0
        public async virtual Task <IPhysicalInventoryLineState> GetPhysicalInventoryLineAsync(string physicalInventoryDocumentNumber, InventoryItemId inventoryItemId)
        {
            var uriParameters = new PhysicalInventoryLineUriParameters();

            uriParameters.PhysicalInventoryDocumentNumber = physicalInventoryDocumentNumber;
            uriParameters.InventoryItemId = ((new ValueObjectTextFormatter <InventoryItemId>())).ToString(inventoryItemId);

            var req  = new PhysicalInventoryLineGetRequest(uriParameters);
            var resp = await _ramlClient.PhysicalInventoryLine.Get(req);

            PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToPhysicalInventoryLineState());
        }
コード例 #3
0
        public async Task <IPhysicalInventoryState> GetHistoryStateAsync(string documentNumber, long version)
        {
            var idObj         = documentNumber;
            var uriParameters = new PhysicalInventoryHistoryStateUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new PhysicalInventoryHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.PhysicalInventoryHistoryState.Get(req);

            PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToPhysicalInventoryState());
        }
コード例 #4
0
        public async Task <IPhysicalInventoryState> GetAsync(string documentNumber)
        {
            IPhysicalInventoryState state = null;
            var idObj         = documentNumber;
            var uriParameters = new PhysicalInventoryUriParameters();

            uriParameters.Id = idObj;

            var req = new PhysicalInventoryGetRequest(uriParameters);

            var resp = await _ramlClient.PhysicalInventory.Get(req);

            PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToPhysicalInventoryState();
            return(state);
        }
コード例 #5
0
        public async Task <IEnumerable <IPhysicalInventoryState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IPhysicalInventoryState> states = null;
            var q = new PhysicalInventoriesGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = PhysicalInventoryProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = PhysicalInventoryProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = PhysicalInventoryProxyUtils.GetFilterQueryValueString(filter);
            var req = new PhysicalInventoriesGetRequest();

            req.Query = q;
            var resp = await _ramlClient.PhysicalInventories.Get(req);

            PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToPhysicalInventoryState());
            return(states);
        }
コード例 #6
0
        public async Task WhenAsync(DeletePhysicalInventoryDto c)
        {
            var idObj         = (c as IDeletePhysicalInventory).DocumentNumber;
            var uriParameters = new PhysicalInventoryUriParameters();

            uriParameters.Id = idObj;

            var q = new PhysicalInventoryDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.Version);

            var req = new PhysicalInventoryDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.PhysicalInventory.Delete(req);

            PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp);
        }
コード例 #7
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new PhysicalInventoriesCountGetQuery();

            q.Filter = PhysicalInventoryProxyUtils.GetFilterQueryValueString(filter);
            var req = new PhysicalInventoriesCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.PhysicalInventoriesCount.Get(req);

            PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp);
            string str = await resp.RawContent.ReadAsStringAsync();

            if (str.StartsWith("\""))
            {
                str = str.Substring(1);
            }
            if (str.EndsWith("\""))
            {
                str = str.Substring(0, str.Length - 1);
            }
            return(long.Parse(str));
        }