Esempio n. 1
0
        public Task <Int64> Create(MoveQueuesPost movequeuesPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._movequeuesRepository.RegisterCreate(movequeuesPost);
            try
            {
                this._movequeuesRepository.Commit();
            }
            catch (Exception ex)
            {
                this._movequeuesRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            //Custom Code Start | Added Code Block
            //We update the queued utilization if necesary
            if (movequeuesPost.ixMoveQueueType == _commonLookUps.getMoveQueueTypes().Where(x => x.sMoveQueueType == "Consolidated Pickup - Consolidated Drop").Select(x => x.ixMoveQueueType).FirstOrDefault()
                //&& movequeuesPost.ixMoveQueueContext == _commonLookUps.getMoveQueueContexts().Where(x => x.sMoveQueueContext == "Putaway").Select(x => x.ixMoveQueueContext).FirstOrDefault()
                &&
                movequeuesPost.ixSourceInventoryLocation != movequeuesPost.ixTargetInventoryLocation
                )
            {
                var targetInventoryLocation      = _inventorylocationsService.GetPost(movequeuesPost.ixTargetInventoryLocation ?? 0);
                var inventoryUnitsOnHandlingUnit = _inventoryunitsService.IndexDb().Where(x => x.ixHandlingUnit == movequeuesPost.ixTargetHandlingUnit).ToList();
                targetInventoryLocation.nQueuedUtilisationPercent = _volumeAndWeight.getNewLocationQueuedUtilisationPercent(movequeuesPost.ixTargetHandlingUnit ?? 0, inventoryUnitsOnHandlingUnit, targetInventoryLocation, true);
                targetInventoryLocation.UserName = movequeuesPost.UserName;
                _inventorylocationsService.Edit(targetInventoryLocation);
            }

            if (movequeuesPost.ixMoveQueueType == _commonLookUps.getMoveQueueTypes().Where(x => x.sMoveQueueType == "Unit Pickup - Consolidated Drop").Select(x => x.ixMoveQueueType).FirstOrDefault()
                //&& movequeuesPost.ixMoveQueueContext == _commonLookUps.getMoveQueueContexts().Where(x => x.sMoveQueueContext == "Picking").Select(x => x.ixMoveQueueContext).FirstOrDefault()
                &&
                movequeuesPost.ixSourceInventoryLocation != movequeuesPost.ixTargetInventoryLocation
                )
            {
                var targetInventoryLocation = _inventorylocationsService.GetPost(movequeuesPost.ixTargetInventoryLocation ?? 0);
                var targetInventoryUnit     = _inventoryunitsService.GetPost(movequeuesPost.ixTargetInventoryUnit ?? 0);
                targetInventoryLocation.nQueuedUtilisationPercent = _volumeAndWeight.getNewLocationQueuedUtilisationPercent(targetInventoryUnit, targetInventoryLocation, true);
                targetInventoryLocation.UserName = movequeuesPost.UserName;
                _inventorylocationsService.Edit(targetInventoryLocation);
            }



            //Custom Code End

            return(Task.FromResult(movequeuesPost.ixMoveQueue));
        }
Esempio n. 2
0
        //Custom Code Start | Replaced Code Block
        //Replaced Code Block Start
        //public Task<Int64> Create(InventoryUnitsPost inventoryunitsPost)
        //Replaced Code Block End
        public Task <Int64> Create(InventoryUnitsPost inventoryunitsPost, Int64 ixInventoryUnitTransactionContext)
        {
            //Custom Code End

            // Additional validations

            // Pre-process
            //Custom Code Start | Added Code Block
            _inventorylocations = _inventorylocationsService.GetPost(inventoryunitsPost.ixInventoryLocation);
            var newUtilizationPercent = _volumeAndWeight.getNewLocationUtilisationPercent(inventoryunitsPost, _inventorylocations);

            _inventorylocations.nUtilisationPercent = newUtilizationPercent;
            _inventorylocations.UserName            = inventoryunitsPost.UserName;
            _inventorylocationsService.Edit(_inventorylocations);
            //Custom Code End

            // Process
            this._inventoryunitsRepository.RegisterCreate(inventoryunitsPost);
            try
            {
                this._inventoryunitsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._inventoryunitsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process
            //Custom Code Start | Added Code Block

            //If bTrackUtilisation is true we update the location utilisation
            //Check if orders need to be batched (which means allocated)

            _inventoryunittransactions.ixInventoryUnit = inventoryunitsPost.ixInventoryUnit;
            _inventoryunittransactions.ixInventoryUnitTransactionContext = ixInventoryUnitTransactionContext;
            _inventoryunittransactions.ixFacilityAfter          = inventoryunitsPost.ixFacility;
            _inventoryunittransactions.ixCompanyAfter           = inventoryunitsPost.ixCompany;
            _inventoryunittransactions.ixMaterialAfter          = inventoryunitsPost.ixMaterial;
            _inventoryunittransactions.ixInventoryStateAfter    = inventoryunitsPost.ixInventoryState;
            _inventoryunittransactions.ixHandlingUnitAfter      = inventoryunitsPost.ixHandlingUnit;
            _inventoryunittransactions.ixInventoryLocationAfter = inventoryunitsPost.ixInventoryLocation;
            _inventoryunittransactions.nBaseUnitQuantityAfter   = inventoryunitsPost.nBaseUnitQuantity;
            _inventoryunittransactions.sSerialNumberAfter       = inventoryunitsPost.sSerialNumber;
            _inventoryunittransactions.sBatchNumberAfter        = inventoryunitsPost.sBatchNumber;
            _inventoryunittransactions.dtExpireAtAfter          = inventoryunitsPost.dtExpireAt;
            _inventoryunittransactions.ixStatusAfter            = inventoryunitsPost.ixStatus;
            _inventoryunittransactions.UserName = inventoryunitsPost.UserName;
            this._inventoryunittransactionsService.Create(_inventoryunittransactions);

            //Custom Code End

            return(Task.FromResult(inventoryunitsPost.ixInventoryUnit));
        }
        public ActionResult Edit([Bind("ixInventoryLocation,sInventoryLocation,ixLocationFunction,ixFacility,ixCompany,ixFacilityFloor,ixFacilityZone,ixFacilityWorkArea,ixFacilityAisleFace,sLevel,sBay,sSlot,ixInventoryLocationSize,nSequence,nXOffset,ixXOffsetUnit,nYOffset,ixYOffsetUnit,nZOffset,ixZOffsetUnit,sLatitude,sLongitude,bTrackUtilisation,nUtilisationPercent,nQueuedUtilisationPercent")] InventoryLocationsPost inventorylocations)
        {
            if (ModelState.IsValid)
            {
                inventorylocations.UserName = User.Identity.Name;
                _inventorylocationsService.Edit(inventorylocations);
                return(RedirectToAction("Index"));
            }
            ViewBag.ixCompany               = new SelectList(_inventorylocationsService.selectCompaniesNullable().Select(x => new { ixCompany = x.Key, sCompany = x.Value }), "ixCompany", "sCompany", inventorylocations.ixCompany);
            ViewBag.ixFacility              = new SelectList(_inventorylocationsService.selectFacilities().Select(x => new { x.ixFacility, x.sFacility }), "ixFacility", "sFacility", inventorylocations.ixFacility);
            ViewBag.ixFacilityAisleFace     = new SelectList(_inventorylocationsService.selectFacilityAisleFaces().Select(x => new { x.ixFacilityAisleFace, x.sFacilityAisleFace }), "ixFacilityAisleFace", "sFacilityAisleFace", inventorylocations.ixFacilityAisleFace);
            ViewBag.ixFacilityFloor         = new SelectList(_inventorylocationsService.selectFacilityFloors().Select(x => new { x.ixFacilityFloor, x.sFacilityFloor }), "ixFacilityFloor", "sFacilityFloor", inventorylocations.ixFacilityFloor);
            ViewBag.ixFacilityWorkArea      = new SelectList(_inventorylocationsService.selectFacilityWorkAreas().Select(x => new { x.ixFacilityWorkArea, x.sFacilityWorkArea }), "ixFacilityWorkArea", "sFacilityWorkArea", inventorylocations.ixFacilityWorkArea);
            ViewBag.ixFacilityZone          = new SelectList(_inventorylocationsService.selectFacilityZones().Select(x => new { x.ixFacilityZone, x.sFacilityZone }), "ixFacilityZone", "sFacilityZone", inventorylocations.ixFacilityZone);
            ViewBag.ixInventoryLocationSize = new SelectList(_inventorylocationsService.selectInventoryLocationSizesNullable().Select(x => new { ixInventoryLocationSize = x.Key, sInventoryLocationSize = x.Value }), "ixInventoryLocationSize", "sInventoryLocationSize", inventorylocations.ixInventoryLocationSize);
            ViewBag.ixLocationFunction      = new SelectList(_inventorylocationsService.selectLocationFunctions().Select(x => new { x.ixLocationFunction, x.sLocationFunction }), "ixLocationFunction", "sLocationFunction", inventorylocations.ixLocationFunction);
            ViewBag.ixXOffsetUnit           = new SelectList(_inventorylocationsService.selectUnitsOfMeasurementNullable().Select(x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", inventorylocations.ixXOffsetUnit);
            ViewBag.ixYOffsetUnit           = new SelectList(_inventorylocationsService.selectUnitsOfMeasurementNullable().Select(x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", inventorylocations.ixYOffsetUnit);
            ViewBag.ixZOffsetUnit           = new SelectList(_inventorylocationsService.selectUnitsOfMeasurementNullable().Select(x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", inventorylocations.ixZOffsetUnit);

            return(View(inventorylocations));
        }
Esempio n. 4
0
        public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
        {
            // use state accessor to extract the didBotWelcomeUser flag
            var didBotWelcomeUser = await _botSpielUserStateAccessors.DidBotWelcomeUser.GetAsync(turnContext, () => false);

            var currentBotUserData = await _botSpielUserStateAccessors.BotUserDataAccessor.GetAsync(turnContext, () => _botUserData);

            string        conCat          = "";
            List <string> existInEntities = new List <string>();
            bool          DeleteOK        = true;

            if (turnContext.Activity.Type == ActivityTypes.Message)
            {
                // Establish dialog state from the conversation state.
                DialogContext dc = await _dialogs.CreateContextAsync(turnContext, cancellationToken);

                //Custom Code Start | Added Code Block
                if (turnContext.Activity.Text.ToLowerInvariant() == "cancel")
                {
                    await dc.CancelAllDialogsAsync(cancellationToken);
                }
                //Custom Code End

                // Continue any current dialog.
                DialogTurnResult dialogTurnResult = await dc.ContinueDialogAsync();

                // Process the result of any complete dialog.
                if (dialogTurnResult.Status is DialogTurnStatus.Complete)
                {
                    switch (dialogTurnResult.Result)
                    {
                    case BotUserEntityContext botUserEntityContext:
                        if (botUserEntityContext.module != "Choose an area")
                        {
                            // Store the results of the root dialog.
                            currentBotUserData.botUserEntityContext = botUserEntityContext;
                            await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                            await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                            await dc.PromptAsync(ConfirmPromptId, new PromptOptions { Prompt = MessageFactory.Text($"Please confirm that you want to {botUserEntityContext.entityIntent} {botUserEntityContext.entity}. Is that correct?") }, cancellationToken);
                        }
                        else
                        {
                            await turnContext.SendActivityAsync("OK, Let's choose a different area.", cancellationToken : cancellationToken);

                            await dc.BeginDialogAsync(RootDialogId, null, cancellationToken);
                        }
                        break;

                    case bool botYesNo:
                        if (botYesNo)
                        {
                            switch (currentBotUserData.botUserEntityContext.entity)
                            {
                            case "PickBatchPicking":
                                if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                                {
                                    //Custom Code Start | Replaced Code Block
                                    //Replaced Code Block Start
                                    //await dc.BeginDialogAsync(CreatePickBatchPickingDialogId, null, cancellationToken);
                                    //Replaced Code Block End
                                    await dc.BeginDialogAsync(CreatePickBatchPickingDialogId, new PickBatchPickingPost(), cancellationToken);

                                    //Custom Code End
                                }
                                break;

                            case "PutAwayHandlingUnits":
                                if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                                {
                                    await dc.BeginDialogAsync(CreatePutAwayHandlingUnitsDialogId, null, cancellationToken);
                                }
                                break;

                            case "SetUpExecutionParameters":
                                if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                                {
                                    await dc.BeginDialogAsync(CreateSetUpExecutionParametersDialogId, null, cancellationToken);
                                }
                                break;

                            case "DropInventoryUnits":
                                if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                                {
                                    await dc.BeginDialogAsync(CreateDropInventoryUnitsDialogId, null, cancellationToken);
                                }
                                break;

                            default:
                                // We shouldn't get here.
                                break;
                            }
                        }
                        else
                        {
                            await turnContext.SendActivityAsync(MessageFactory.Text("OK, let's try again."), cancellationToken);

                            await dc.BeginDialogAsync(RootDialogId, null, cancellationToken);
                        }
                        break;

                    case GetPickBatchesPost getpickbatchesPost:
                        if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                        {
                            //Custom Code Start | Removed Block
                            //ixGetPickBatch = await _getpickbatchesService.Create(getpickbatchesPost);
                            //await turnContext.SendActivityAsync(MessageFactory.Text($"The GetPickBatch {ixGetPickBatch} was created"), cancellationToken);
                            //currentBotUserData.ixGetPickBatch = ixGetPickBatch;
                            //Custom Code End

                            await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                            await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                            //await dc.BeginDialogAsync(RootDialogId, currentBotUserData.botUserEntityContext, cancellationToken);

                            //Custom Code Start | Added Code Block
                            //We can now set the pick batch status to started
                            var pickbatch = _pickbatchesService.GetPost(_pickbatchesService.IndexDb().Where(x => x.sPickBatch == getpickbatchesPost.sGetPickBatch).Select(x => x.ixPickBatch).FirstOrDefault());
                            pickbatch.ixStatus = _commonLookUps.getStatuses().Where(x => x.sStatus == "Started").Select(x => x.ixStatus).FirstOrDefault();
                            pickbatch.UserName = dc.Context.Activity.Conversation.Id;
                            await _pickbatchesService.Edit(pickbatch);

                            _pickbatchpickingPost.sPickBatchPick = getpickbatchesPost.sGetPickBatch;
                            await dc.BeginDialogAsync(CreatePickBatchPickingDialogId, _pickbatchpickingPost, cancellationToken);

                            //Custom Code End
                        }
                        break;

                    case PickBatchPickingPost pickbatchpickingPost:
                        if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                        {
                            ixPickBatchPick = await _pickbatchpickingService.Create(pickbatchpickingPost);

                            //Custom Code Start | Removed Block
                            //await turnContext.SendActivityAsync(MessageFactory.Text($"The PickBatchPick {ixPickBatchPick} was created"), cancellationToken);
                            //Custom Code End
                            //Custom Code Start | Added Code Block
                            //We check if the batch is complete
                            if (!_picking.isPickBatchComplete(pickbatchpickingPost.ixPickBatch))
                            {
                                currentBotUserData.ixPickBatchPick = ixPickBatchPick;
                                await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                                await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                                await dc.BeginDialogAsync(CreatePickBatchPickingDialogId, pickbatchpickingPost, cancellationToken);
                            }
                            else
                            {
                                currentBotUserData.ixPickBatchPick = 0;
                                await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                                await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                                //await dc.BeginDialogAsync(RootDialogId, currentBotUserData.botUserEntityContext, cancellationToken);
                                //We can now set the pick batch status to complete
                                var pickbatch = _pickbatchesService.GetPost(pickbatchpickingPost.ixPickBatch);
                                pickbatch.ixStatus = _commonLookUps.getStatuses().Where(x => x.sStatus == "Complete").Select(x => x.ixStatus).FirstOrDefault();
                                pickbatch.UserName = dc.Context.Activity.Conversation.Id;
                                await _pickbatchesService.Edit(pickbatch);

                                //We begin the drop cycle
                                await dc.BeginDialogAsync(CreateDropInventoryUnitsDialogId, pickbatchpickingPost, cancellationToken);
                            }
                            //Custom Code End
                        }
                        break;

                    case PutAwayHandlingUnitsPost putawayhandlingunitsPost:
                        if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                        {
                            ixPutAwayHandlingUnit = await _putawayhandlingunitsService.Create(putawayhandlingunitsPost);

                            //Custom Code Start | Removed Block
                            //await turnContext.SendActivityAsync(MessageFactory.Text($"The PutAwayHandlingUnit {ixPutAwayHandlingUnit} was created"), cancellationToken);
                            //Custom Code End
                            currentBotUserData.ixPutAwayHandlingUnit = ixPutAwayHandlingUnit;
                            await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                            await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                            //Custom Code Start | Replaced Code Block
                            //Replaced Code Block Start
                            //await dc.BeginDialogAsync(RootDialogId, currentBotUserData.botUserEntityContext, cancellationToken);
                            //Replaced Code Block End
                            await dc.BeginDialogAsync(CreatePutAwayHandlingUnitsDialogId, null, cancellationToken);

                            //Custom Code End
                        }
                        break;

                    case SetUpExecutionParametersPost setupexecutionparametersPost:
                        if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                        {
                            //Custom Code Start | Removed Block
                            //ixSetUpExecutionParameter = await _setupexecutionparametersService.Create(setupexecutionparametersPost);
                            //await turnContext.SendActivityAsync(MessageFactory.Text($"The SetUpExecutionParameter {ixSetUpExecutionParameter} was created"), cancellationToken);
                            //currentBotUserData.ixSetUpExecutionParameter = ixSetUpExecutionParameter;
                            //Custom Code End
                            //Custom Code Start | Added Code Block
                            currentBotUserData.ixFacility         = setupexecutionparametersPost.ixFacility;
                            currentBotUserData.ixCompany          = setupexecutionparametersPost.ixCompany;
                            currentBotUserData.ixFacilityWorkArea = setupexecutionparametersPost.ixFacilityWorkArea;
                            //We check if the user location exists - if not we create it
                            if (_userManager.Users.Where(x => x.UserName == dc.Context.Activity.Conversation.Id).Any())
                            {
                                if (!_inventorylocationsService.IndexDb().Where(x => x.sInventoryLocation.ToLower().Trim() == dc.Context.Activity.Conversation.Id.ToLower().Trim()).Any())
                                {
                                    InventoryLocationsPost inventoryLocationsPost = new InventoryLocationsPost();
                                    inventoryLocationsPost.sInventoryLocation  = dc.Context.Activity.Conversation.Id.ToLower().Trim();
                                    inventoryLocationsPost.ixLocationFunction  = _locationfunctionsService.IndexDb().Where(x => x.sLocationFunctionCode == "PE").Select(x => x.ixLocationFunction).FirstOrDefault();
                                    inventoryLocationsPost.ixFacility          = currentBotUserData.ixFacility;
                                    inventoryLocationsPost.ixFacilityFloor     = _inventorylocationsService.FacilityFloorsDb().Select(x => x.ixFacilityFloor).FirstOrDefault();
                                    inventoryLocationsPost.ixFacilityZone      = _inventorylocationsService.FacilityZonesDb().Select(x => x.ixFacilityZone).FirstOrDefault();
                                    inventoryLocationsPost.ixFacilityWorkArea  = _inventorylocationsService.FacilityWorkAreasDb().Select(x => x.ixFacilityWorkArea).FirstOrDefault();
                                    inventoryLocationsPost.ixFacilityAisleFace = _inventorylocationsService.FacilityAisleFacesDb().Select(x => x.ixFacilityAisleFace).FirstOrDefault();
                                    inventoryLocationsPost.nSequence           = 0;
                                    inventoryLocationsPost.bTrackUtilisation   = false;
                                    currentBotUserData.ixInventoryLocation     = await _inventorylocationsService.Create(inventoryLocationsPost);
                                }
                                else
                                {
                                    currentBotUserData.ixInventoryLocation = _inventorylocationsService.IndexDb().Where(x => x.sInventoryLocation.ToLower().Trim() == dc.Context.Activity.Conversation.Id.ToLower().Trim()).Select(x => x.ixInventoryLocation).FirstOrDefault();
                                    var inventoryLocationsPost = _inventorylocationsService.GetPost(currentBotUserData.ixInventoryLocation);
                                    inventoryLocationsPost.ixFacility = currentBotUserData.ixFacility;
                                    await _inventorylocationsService.Edit(inventoryLocationsPost);
                                }
                            }
                            //Custom Code End
                            await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                            await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                            //Custom Code Start | Removed Block
                            //await dc.BeginDialogAsync(RootDialogId, currentBotUserData.botUserEntityContext, cancellationToken);
                            //Custom Code End
                            //Custom Code Start | Added Code Block
                            await turnContext.SendActivityAsync(MessageFactory.Text($"The setup parameters have been updated. Say/type putaway, pick or cancel."), cancellationToken);

                            //Custom Code End
                        }
                        break;

                    case DropInventoryUnitsPost dropinventoryunitsPost:
                        if (currentBotUserData.botUserEntityContext.entityIntent == "Create")
                        {
                            //Custom Code Start | Removed Block
                            //ixDropInventoryUnit = await _dropinventoryunitsService.Create(dropinventoryunitsPost);
                            //await turnContext.SendActivityAsync(MessageFactory.Text($"The DropInventoryUnit {ixDropInventoryUnit} was created"), cancellationToken);
                            //currentBotUserData.ixDropInventoryUnit = ixDropInventoryUnit;
                            //await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);
                            //await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);
                            //await dc.BeginDialogAsync(RootDialogId, currentBotUserData.botUserEntityContext, cancellationToken);
                            //Custom Code End
                            await dc.BeginDialogAsync(CreateGetPickBatchesDialogId, null, cancellationToken);
                        }
                        break;

                    default:
                        // We shouldn't get here.
                        break;
                    }
                }

                // Proactively send a welcome message to a personal chat the first time
                // (and only the first time) a user initiates a personal chat.
                //Custom Code Start | Replaced Code Block
                //Replaced Code Block Start
                //if (didBotWelcomeUser == false)
                //Replaced Code Block End
                if (true == false)
                //Custom Code End
                {
                    // Update user state flag to reflect bot handled first user interaction.
                    await _botSpielUserStateAccessors.DidBotWelcomeUser.SetAsync(turnContext, true);

                    await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                    // the channel should sends the user name in the 'From' object
                    var userName = turnContext.Activity.From.Name;

                    // We give the user the opportunity to say or request something using natural language and funnel through recognizer
                    await turnContext.SendActivityAsync($"What would like to do? You can say things like ... or help me.", cancellationToken : cancellationToken);
                }
                //Custom Code Start | Added Code Block
                else if (!currentBotUserData.bIsInitialSetUpParametersSet)
                {
                    currentBotUserData.bIsInitialSetUpParametersSet      = true;
                    currentBotUserData.botUserEntityContext.module       = "Execution";
                    currentBotUserData.botUserEntityContext.entity       = "SetUpExecutionParameters";
                    currentBotUserData.botUserEntityContext.entityIntent = "Create";
                    await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                    await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                    await dc.BeginDialogAsync(CreateSetUpExecutionParametersDialogId, null, cancellationToken);
                }
                //Custom Code End
                else if ((dialogTurnResult.Status is DialogTurnStatus.Empty) || turnContext.Activity.Text.ToLowerInvariant() == "putaway" || turnContext.Activity.Text.ToLowerInvariant() == "cancel")
                {
                    var text = turnContext.Activity.Text.ToLowerInvariant();

                    // Now attempt to infer the context (NLP)
                    // Placeholder for code to added

                    switch (text)
                    {
                    //Custom Code Start | Removed Block
                    //case "help me":
                    //    await turnContext.SendActivityAsync($"You said: {text}.", cancellationToken: cancellationToken);
                    //    break;
                    //Custom Code End
                    //Custom Code Start | Added Code Block
                    case "putaway":
                        currentBotUserData.botUserEntityContext.module       = "Execution";
                        currentBotUserData.botUserEntityContext.entity       = "PutAwayHandlingUnits";
                        currentBotUserData.botUserEntityContext.entityIntent = "Create";
                        await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                        await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                        await dc.BeginDialogAsync(CreatePutAwayHandlingUnitsDialogId, null, cancellationToken);

                        break;

                    case "pick":
                        currentBotUserData.botUserEntityContext.module       = "Execution";
                        currentBotUserData.botUserEntityContext.entity       = "PickBatchPicking";
                        currentBotUserData.botUserEntityContext.entityIntent = "Create";
                        await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(turnContext, currentBotUserData, cancellationToken);

                        await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

                        //await dc.BeginDialogAsync(CreatePickBatchPickingDialogId, new PickBatchPickingPost(), cancellationToken);
                        await dc.BeginDialogAsync(CreateGetPickBatchesDialogId, null, cancellationToken);

                        break;

                    case "cancel":
                        await dc.CancelAllDialogsAsync(cancellationToken);

                        break;

                    //Custom Code End
                    default:
                        if (dc.ActiveDialog == null && (dialogTurnResult.Status is DialogTurnStatus.Complete || dialogTurnResult.Status is DialogTurnStatus.Empty || dialogTurnResult.Status is DialogTurnStatus.Cancelled))
                        {
                            await turnContext.SendActivityAsync("I do not understand, let's try something different.", cancellationToken : cancellationToken);

                            await dc.BeginDialogAsync(RootDialogId, null, cancellationToken);
                        }
                        break;
                    }
                }
            }
            else if (turnContext.Activity.Type == ActivityTypes.ConversationUpdate)
            {
                if (turnContext.Activity.MembersAdded.Any())
                {
                    // Iterate over all new members added to the conversation
                    foreach (var member in turnContext.Activity.MembersAdded)
                    {
                        if (member.Id != turnContext.Activity.Recipient.Id)
                        {
                            await turnContext.SendActivityAsync($"Hi there - {member.Name}. {WelcomeMessage}", cancellationToken : cancellationToken);
                        }
                    }
                }
            }
            else
            {
                // Default behaviour for all other type of activities.
                await turnContext.SendActivityAsync($"{turnContext.Activity.Type} activity detected");
            }

            // save any state changes made to your state objects.
            await _botSpielUserStateAccessors.UserState.SaveChangesAsync(turnContext);

            await _botSpielUserStateAccessors.ConversationState.SaveChangesAsync(turnContext);
        }