public void ProcessStockInfoRequest(StockInfoRequest stockInfoRequest) { StockInfoResponse stockInfoResponse = new StockInfoResponse(stockInfoRequest.ConverterStream); stockInfoResponse.AdoptHeader(stockInfoRequest); foreach (StockInfoCriteria criteria in stockInfoRequest.Criteria) { List <StockProduct> matchingProduct; var articleCode = String.IsNullOrWhiteSpace(criteria.RobotArticleCode) ? criteria.PISArticleCode : criteria.RobotArticleCode; if (String.IsNullOrEmpty(articleCode)) { matchingProduct = new List <StockProduct>(this.stock.StockProductList.Values); } else { matchingProduct = new List <StockProduct> { this.stock.GetStockProduct(articleCode) }; } #warning to do test Tenant change foreach (StockProduct stockProduct in matchingProduct) { List <RobotPack> stockPackList = stockProduct.GetPackList( criteria.BatchNumber, criteria.ExternalID, criteria.MachineLocation, criteria.StockLocationID, 0, stockInfoRequest.TenantID); stockInfoResponse.Packs.AddRange(stockPackList); } } if (stockInfoRequest.Criteria.Count == 0) { // load all stock. foreach (KeyValuePair <string, StockProduct> stockProduct in this.stock.StockProductList) { stockInfoResponse.Packs.AddRange(stockProduct.Value.GetPackList(stockInfoRequest.TenantID)); } } // add article information stockInfoResponse.Articles.AddRange(this.BuildArticleList(stockInfoResponse.Packs, stockInfoRequest.IncludeArticleDetails)); if (!stockInfoRequest.IncludePacks) { stockInfoResponse.Packs.Clear(); } stockInfoResponse.ConverterStream.Write(stockInfoResponse); }
private void Dialog_RequestReceived(Object sender, MessageReceivedEventArgs <StockInfoRequest> e) { StockInfoRequest request = e.Message; this.OnMessageReceived(request, () => { IStockInfoRequestedProcessState processState = new StockInfoRequestedProcessState(this, request); this.ProcessStarted?.Invoke(this, new ProcessStartedEventArgs <IStockInfoRequestedProcessState>(processState)); }); }
public IStockInfoFinishedProcessState StartProcess(bool?includePacks, bool?includeArticleDetails, IEnumerable <StockInfoRequestCriteria>?criterias) { StockInfoRequest request = this.CreateRequest(includePacks, includeArticleDetails, criterias); StockInfoResponse response = this.SendRequest(request, () => { return(this.Dialog.SendRequest(request)); }); return(new StockInfoFinishedProcessState(request, response)); }
public async Task <IStockInfoFinishedProcessState> StartProcessAsync(bool?includePacks, bool?includeArticleDetails, IEnumerable <StockInfoRequestCriteria>?criterias, CancellationToken cancellationToken = default) { StockInfoRequest request = this.CreateRequest(includePacks, includeArticleDetails, criterias); StockInfoResponse response = await this.SendRequestAsync(request, () => { return(this.Dialog.SendRequestAsync(request, cancellationToken)); }).ConfigureAwait(continueOnCapturedContext: false); return(new StockInfoFinishedProcessState(request, response)); }
/// <summary> /// Processes an incomming Stock Information request. /// </summary> /// <param name="request">The request to be processed.</param> private void ProcessStockInfoRequest(StockInfoRequest request) { // Set the underlying XmlObjectStream to send the response on when request.Accept() or request.Reject() is called. lock (_syncLock) { if (_messageObjectStream == null) { return; } request.MessageObjectStream = _messageObjectStream; } // Raise the corresponding event. base.Raise("StockInfoRequest", _stockInfoRequested, this, request); }
public StockInfoRequestedProcessState(StockInfoWorkflow workflow, StockInfoRequest request) { this.Workflow = workflow; this.Request = request; }
public StockInfoFinishedProcessState(StockInfoRequest request, StockInfoResponse response) { this.Request = request; this.Response = response; }
public Task <StockInfoResponse> SendRequestAsync(StockInfoRequest request, CancellationToken cancellationToken = default) { return(base.SendRequestAsync <StockInfoRequest, StockInfoResponse>(request, cancellationToken)); }
public StockInfoResponse SendRequest(StockInfoRequest request) { return(base.SendRequest <StockInfoRequest, StockInfoResponse>(request)); }
protected void OnRequestReceived(StockInfoRequest request) { this.RequestReceived?.Invoke(this, new MessageReceivedEventArgs <StockInfoRequest>(request, this.DialogProvider)); }