private async Task <DialogTurnResult> BaseUnitQuantityPickedPrompt( WaterfallStepContext step, CancellationToken cancellationToken = default(CancellationToken)) { //Custom Code Start | Removed Block //FoundChoice _InventoryUnit = (FoundChoice)step.Result; //var ixInventoryUnit = _pickbatchpickingService.selectInventoryUnits().Where(ct => ct.sInventoryUnit == _InventoryUnit.Value).Select(ct => ct.ixInventoryUnit).First(); //((PickBatchPickingPost)step.Values[DialogKey]).ixInventoryUnit = ixInventoryUnit; //Custom Code End //if (!(((PickBatchPickingPost)step.Options).ixPickBatch > 0)) //{ // return await step.BeginDialogAsync(CreateGetPickBatchesDialogId, null, cancellationToken); // //var sPickBatchPick = (string)step.Result; // //((PickBatchPickingPost)step.Values[DialogKey]).sPickBatchPick = sPickBatchPick; //} //else //{ step.Values[DialogKey] = new PickBatchPickingPost(); ((PickBatchPickingPost)step.Values[DialogKey]).sPickBatchPick = ((PickBatchPickingPost)step.Options).sPickBatchPick; //} //Custom Code Start | Added Code Block var sPickBatchPick = ((PickBatchPickingPost)step.Options).sPickBatchPick; //((PickBatchPickingPost)step.Values[DialogKey]).sPickBatchPick = sPickBatchPick; var ixPickBatch = _pickbatchesService.IndexDb().Where(x => x.sPickBatch.Trim().ToLower() == sPickBatchPick.Trim().ToLower()).Select(x => x.ixPickBatch).FirstOrDefault(); ((PickBatchPickingPost)step.Values[DialogKey]).ixPickBatch = ixPickBatch; //Now we get the pick suggestion var currentBotUserData = await _botSpielUserStateAccessors.BotUserDataAccessor.GetAsync(step.Context, () => _botUserData); var pickSuggestion = _picking.getPickSuggestion(ixPickBatch, currentBotUserData); currentBotUserData.pickSuggestion = pickSuggestion; await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(step.Context, currentBotUserData, cancellationToken); await _botSpielUserStateAccessors.UserState.SaveChangesAsync(step.Context); var pickSuggestionText = ""; if (pickSuggestion.Item1 > 0 && pickSuggestion.Item2 > 0) { var inventoryUnit = _inventoryunitsService.Get(pickSuggestion.Item1); pickSuggestionText = $@"Please pick inventory unit: Inventory Location: {inventoryUnit.InventoryLocations.sInventoryLocation} Handling Unit: {inventoryUnit.HandlingUnits.sHandlingUnit} Material: {inventoryUnit.Materials.sMaterial} Pick Quantity: {pickSuggestion.Item2} and confirm the quantity picked. "; ((PickBatchPickingPost)step.Values[DialogKey]).ixInventoryUnit = inventoryUnit.ixInventoryUnit; step.Values[PickSuggestionKey] = inventoryUnit; step.Values[PickSuggestionQtyKey] = pickSuggestion.Item2; //We update the queued qty on the iu var inventoryUnitPickedFrom = _inventoryunitsService.GetPost(inventoryUnit.ixInventoryUnit); inventoryUnitPickedFrom.nBaseUnitQuantityQueued += pickSuggestion.Item2; inventoryUnitPickedFrom.UserName = step.Context.Activity.Conversation.Id; await _inventoryunitsService.Edit(inventoryUnitPickedFrom, _commonLookUps.getInventoryUnitTransactionContext().Where(x => x.sInventoryUnitTransactionContext == "Inventory Adjustment").Select(x => x.ixInventoryUnitTransactionContext).FirstOrDefault()); } else { pickSuggestionText = "I cannot find an inventory unit to pick, please exit and choose a different batch or correct the inventory."; } //Custom Code End return(await step.PromptAsync( BaseUnitQuantityPickedPromptId, new PromptOptions { //Custom Code Start | Replaced Code Block //Replaced Code Block Start //Prompt = MessageFactory.Text($"Please enter a BaseUnitQuantityPicked:"), //Replaced Code Block End Prompt = MessageFactory.Text($"{pickSuggestionText}"), //Custom Code End RetryPrompt = MessageFactory.Text("Please enter a number."), }, cancellationToken)); }
public ActionResult Details(long id) { return(View(_inventoryunitsService.Get(id))); }