public ActionResult MultiRowPickBatchActivate(string Ids) { string validationResponse = ""; string[] sIDs = Ids.Split("|"); List <long> iDs = new List <long>(); long nID; string sPickBatch; bool bIsAllocated = true; PickBatchesPost pickbatches; sIDs.ToList() .ForEach(s => { if (long.TryParse(s, out nID)) { //First check if activation OK bIsAllocated = true; var pickBatch = _pickbatchesService.GetPost(nID); //We need to check if the batch has been allocated and that the batch is Inactive _outboundordersService.IndexDb().Where(x => x.ixPickBatch == nID).Select(x => x.ixOutboundOrder).ToList() .ForEach(o => { if (_picking.getOrderAllocationStatus(o) == "Not Allocated") { bIsAllocated = false; } }); if (bIsAllocated) { pickBatch.ixStatus = _statusesService.IndexDb().Where(x => x.sStatus == "Active").Select(x => x.ixStatus).FirstOrDefault(); pickBatch.UserName = User.Identity.Name; _pickbatchesService.Edit(pickBatch); iDs.Add(nID); } } } ); iDs.ForEach(n => validationResponse = validationResponse + ", " + n.ToString()); return(Json(validationResponse)); }
private async Task <DialogTurnResult> InventoryDropLocationPrompt( WaterfallStepContext step, CancellationToken cancellationToken = default(CancellationToken)) { var sPutAwayHandlingUnit = (string)step.Result; ((PutAwayHandlingUnitsPost)step.Values[DialogKey]).sPutAwayHandlingUnit = sPutAwayHandlingUnit; //Custom Code Start | Added Code Block var currentBotUserData = await _botSpielUserStateAccessors.BotUserDataAccessor.GetAsync(step.Context, () => _botUserData); var ixHandlingUnit = _handlingunitsService.IndexDb().Where(x => x.sHandlingUnit.Trim().ToLower() == sPutAwayHandlingUnit).Select(x => x.ixHandlingUnit).FirstOrDefault(); ((PutAwayHandlingUnitsPost)step.Values[DialogKey]).ixHandlingUnit = ixHandlingUnit; //We now create and execute the move queue for the pickup MoveQueuesPost moveQueuePost = new MoveQueuesPost(); moveQueuePost.ixMoveQueueType = _movequeuetypesService.IndexDb().Where(x => x.sMoveQueueType == "Consolidated Pickup - Consolidated Drop").Select(x => x.ixMoveQueueType).FirstOrDefault(); moveQueuePost.ixMoveQueueContext = _movequeuecontextsService.IndexDb().Where(x => x.sMoveQueueContext == "Putaway").Select(x => x.ixMoveQueueContext).FirstOrDefault(); moveQueuePost.ixSourceInventoryLocation = _inventoryunitsService.IndexDbPost().Where(x => x.ixHandlingUnit == ixHandlingUnit).Select(x => x.ixInventoryLocation).FirstOrDefault(); moveQueuePost.ixTargetInventoryLocation = currentBotUserData.ixInventoryLocation; moveQueuePost.ixSourceHandlingUnit = ixHandlingUnit; moveQueuePost.ixTargetHandlingUnit = ixHandlingUnit; moveQueuePost.sPreferredResource = step.Context.Activity.Conversation.Id; moveQueuePost.nBaseUnitQuantity = 0; moveQueuePost.dtStartedAt = DateTime.Now; moveQueuePost.ixStatus = _statusesService.IndexDb().Where(x => x.sStatus == "Active").Select(x => x.ixStatus).FirstOrDefault(); moveQueuePost.UserName = step.Context.Activity.Conversation.Id; var ixMoveQueue = await _movequeuesService.Create(moveQueuePost); //We now complete the move queue for the pickup var moveQueuePickUp = _movequeuesService.GetPost(ixMoveQueue); moveQueuePickUp.dtCompletedAt = DateTime.Now; moveQueuePickUp.ixStatus = _statusesService.IndexDb().Where(x => x.sStatus == "Complete").Select(x => x.ixStatus).FirstOrDefault(); moveQueuePickUp.UserName = moveQueuePost.UserName; await _movequeuesService.Edit(moveQueuePickUp); var ixInventoryLocationSuggestion = _putAway.getPutAwaySuggestion(ixHandlingUnit, currentBotUserData.ixCompany, currentBotUserData.ixFacility, currentBotUserData.ixInventoryLocation); string sPutAwaySuggestion = ""; if (_inventorylocationsService.IndexDb().Where(x => x.ixInventoryLocation == ixInventoryLocationSuggestion).Any()) { sPutAwaySuggestion = _inventorylocationsService.IndexDb().Where(x => x.ixInventoryLocation == ixInventoryLocationSuggestion).Select(x => x.sInventoryLocation).FirstOrDefault(); //We now create the move queue for the drop MoveQueuesPost moveQueuePostDrop = new MoveQueuesPost(); moveQueuePostDrop.ixMoveQueueType = moveQueuePost.ixMoveQueueType; moveQueuePostDrop.ixMoveQueueContext = moveQueuePost.ixMoveQueueContext; moveQueuePostDrop.ixSourceInventoryLocation = currentBotUserData.ixInventoryLocation; moveQueuePostDrop.ixTargetInventoryLocation = ixInventoryLocationSuggestion; moveQueuePostDrop.ixSourceHandlingUnit = ixHandlingUnit; moveQueuePostDrop.ixTargetHandlingUnit = ixHandlingUnit; moveQueuePostDrop.sPreferredResource = step.Context.Activity.Conversation.Id; moveQueuePostDrop.nBaseUnitQuantity = 0; moveQueuePostDrop.dtStartedAt = DateTime.Now; moveQueuePostDrop.ixStatus = _statusesService.IndexDb().Where(x => x.sStatus == "Active").Select(x => x.ixStatus).FirstOrDefault(); moveQueuePostDrop.UserName = step.Context.Activity.Conversation.Id; var ixMoveQueueDrop = await _movequeuesService.Create(moveQueuePostDrop); step.Values[MoveQueuePostDropKey] = moveQueuePostDrop; } else { sPutAwaySuggestion = "No Suggestion"; } step.Values[PutAwaySuggestionKey] = sPutAwaySuggestion; currentBotUserData.sPutAwaySuggestion = sPutAwaySuggestion; await _botSpielUserStateAccessors.BotUserDataAccessor.SetAsync(step.Context, currentBotUserData, cancellationToken); await _botSpielUserStateAccessors.UserState.SaveChangesAsync(step.Context); //Custom Code End return(await step.PromptAsync( InventoryDropLocationPromptId, new PromptOptions { Prompt = MessageFactory.Text($"The suggested drop location is {sPutAwaySuggestion}.{Environment.NewLine} Please enter/scan the Inventory Drop Location."), RetryPrompt = MessageFactory.Text("I didn't understand. Please try again."), }, cancellationToken)); }
public List <Statuses> getStatuses() { return(_statusesService.IndexDb().ToList()); }