public void SetMaterialInQueue(long materialId, string queue, int position) { if (!fmsSettings.Queues.ContainsKey(queue)) { throw new BlackMaple.MachineFramework.BadRequestException("Queue " + queue + " does not exist"); } Log.Debug("Adding material {matId} to queue {queue} in position {pos}", materialId, queue, position ); var proc = log.GetLogForMaterial(materialId) .SelectMany(e => e.Material) .Where(m => m.MaterialID == materialId) .Select(m => m.Process) .DefaultIfEmpty(0) .Max(); log.RecordAddMaterialToQueue(materialId, proc, queue, position); logReader.RecheckQueues(); RaiseNewCurrentStatus(GetCurrentStatus()); }